[email protected] | 7de8404 | 2012-02-21 16:04:50 | [diff] [blame] | 1 | // Copyright (c) 2012 The Chromium Authors. All rights reserved. |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 2 | // Use of this source code is governed by a BSD-style license that can be |
| 3 | // found in the LICENSE file. |
| 4 | |
| 5 | // IPC messages for the P2P Transport API. |
[email protected] | db803aae | 2011-03-05 02:00:42 | [diff] [blame] | 6 | // Multiply-included message file, hence no include guard. |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 7 | |
[email protected] | 7de8404 | 2012-02-21 16:04:50 | [diff] [blame] | 8 | #include "content/common/content_export.h" |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 9 | #include "content/common/p2p_sockets.h" |
| 10 | #include "ipc/ipc_message_macros.h" |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 11 | #include "net/base/ip_endpoint.h" |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 12 | #include "net/base/net_util.h" |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 13 | |
[email protected] | 7de8404 | 2012-02-21 16:04:50 | [diff] [blame] | 14 | #undef IPC_MESSAGE_EXPORT |
| 15 | #define IPC_MESSAGE_EXPORT CONTENT_EXPORT |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 16 | #define IPC_MESSAGE_START P2PMsgStart |
| 17 | |
[email protected] | b3f8f972 | 2011-08-25 20:56:07 | [diff] [blame] | 18 | IPC_ENUM_TRAITS(content::P2PSocketType) |
[email protected] | db803aae | 2011-03-05 02:00:42 | [diff] [blame] | 19 | |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 20 | IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface) |
| 21 | IPC_STRUCT_TRAITS_MEMBER(name) |
| 22 | IPC_STRUCT_TRAITS_MEMBER(address) |
| 23 | IPC_STRUCT_TRAITS_END() |
| 24 | |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 25 | // P2P Socket messages sent from the browser to the renderer. |
| 26 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 27 | IPC_MESSAGE_CONTROL1(P2PMsg_NetworkListChanged, |
| 28 | net::NetworkInterfaceList /* networks */) |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 29 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 30 | IPC_MESSAGE_CONTROL2(P2PMsg_GetHostAddressResult, |
| 31 | int32 /* request_id */, |
| 32 | net::IPAddressNumber /* address */) |
[email protected] | efa5d938 | 2011-08-09 20:09:14 | [diff] [blame] | 33 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 34 | IPC_MESSAGE_CONTROL2(P2PMsg_OnSocketCreated, |
| 35 | int /* socket_id */, |
| 36 | net::IPEndPoint /* socket_address */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 37 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 38 | IPC_MESSAGE_CONTROL1(P2PMsg_OnError, |
| 39 | int /* socket_id */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 40 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 41 | IPC_MESSAGE_CONTROL2(P2PMsg_OnIncomingTcpConnection, |
| 42 | int /* socket_id */, |
| 43 | net::IPEndPoint /* socket_address */) |
[email protected] | 0f2b2e95 | 2011-04-19 04:40:56 | [diff] [blame] | 44 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 45 | IPC_MESSAGE_CONTROL3(P2PMsg_OnDataReceived, |
| 46 | int /* socket_id */, |
| 47 | net::IPEndPoint /* socket_address */, |
| 48 | std::vector<char> /* data */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 49 | |
| 50 | // P2P Socket messages sent from the renderer to the browser. |
| 51 | |
[email protected] | 6d802c6 | 2011-07-13 18:20:44 | [diff] [blame] | 52 | // Start/stop sending P2PMsg_NetworkListChanged messages when network |
| 53 | // configuration changes. |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 54 | IPC_MESSAGE_CONTROL0(P2PHostMsg_StartNetworkNotifications) |
| 55 | IPC_MESSAGE_CONTROL0(P2PHostMsg_StopNetworkNotifications) |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 56 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 57 | IPC_MESSAGE_CONTROL2(P2PHostMsg_GetHostAddress, |
[email protected] | efa5d938 | 2011-08-09 20:09:14 | [diff] [blame] | 58 | std::string /* host_name */, |
| 59 | int32 /* request_id */) |
| 60 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 61 | IPC_MESSAGE_CONTROL4(P2PHostMsg_CreateSocket, |
| 62 | content::P2PSocketType /* type */, |
| 63 | int /* socket_id */, |
| 64 | net::IPEndPoint /* local_address */, |
| 65 | net::IPEndPoint /* remote_address */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 66 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 67 | IPC_MESSAGE_CONTROL3(P2PHostMsg_AcceptIncomingTcpConnection, |
[email protected] | 0f2b2e95 | 2011-04-19 04:40:56 | [diff] [blame] | 68 | int /* listen_socket_id */, |
| 69 | net::IPEndPoint /* remote_address */, |
| 70 | int /* connected_socket_id */) |
| 71 | |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 72 | // TODO(sergeyu): Use shared memory to pass the data. |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 73 | IPC_MESSAGE_CONTROL3(P2PHostMsg_Send, |
| 74 | int /* socket_id */, |
| 75 | net::IPEndPoint /* socket_address */, |
| 76 | std::vector<char> /* data */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 77 | |
[email protected] | 4761cf1 | 2012-09-12 10:37:55 | [diff] [blame] | 78 | IPC_MESSAGE_CONTROL1(P2PHostMsg_DestroySocket, |
| 79 | int /* socket_id */) |