[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 1 | // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
| 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 | |
| 8 | #include "content/common/p2p_sockets.h" |
| 9 | #include "ipc/ipc_message_macros.h" |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 10 | #include "net/base/ip_endpoint.h" |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 11 | #include "net/base/net_util.h" |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 12 | |
| 13 | #define IPC_MESSAGE_START P2PMsgStart |
| 14 | |
[email protected] | b3f8f972 | 2011-08-25 20:56:07 | [diff] [blame^] | 15 | IPC_ENUM_TRAITS(content::P2PSocketType) |
[email protected] | db803aae | 2011-03-05 02:00:42 | [diff] [blame] | 16 | |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 17 | IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface) |
| 18 | IPC_STRUCT_TRAITS_MEMBER(name) |
| 19 | IPC_STRUCT_TRAITS_MEMBER(address) |
| 20 | IPC_STRUCT_TRAITS_END() |
| 21 | |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 22 | // P2P Socket messages sent from the browser to the renderer. |
| 23 | |
[email protected] | 6d802c6 | 2011-07-13 18:20:44 | [diff] [blame] | 24 | IPC_MESSAGE_ROUTED1(P2PMsg_NetworkListChanged, |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 25 | net::NetworkInterfaceList /* networks */) |
| 26 | |
[email protected] | efa5d938 | 2011-08-09 20:09:14 | [diff] [blame] | 27 | IPC_MESSAGE_ROUTED2(P2PMsg_GetHostAddressResult, |
| 28 | int32 /* request_id */, |
| 29 | net::IPAddressNumber /* address */) |
| 30 | |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 31 | IPC_MESSAGE_ROUTED2(P2PMsg_OnSocketCreated, |
| 32 | int /* socket_id */, |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 33 | net::IPEndPoint /* socket_address */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 34 | |
| 35 | IPC_MESSAGE_ROUTED1(P2PMsg_OnError, |
| 36 | int /* socket_id */) |
| 37 | |
[email protected] | 0f2b2e95 | 2011-04-19 04:40:56 | [diff] [blame] | 38 | IPC_MESSAGE_ROUTED2(P2PMsg_OnIncomingTcpConnection, |
| 39 | int /* socket_id */, |
| 40 | net::IPEndPoint /* socket_address */) |
| 41 | |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 42 | IPC_MESSAGE_ROUTED3(P2PMsg_OnDataReceived, |
| 43 | int /* socket_id */, |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 44 | net::IPEndPoint /* socket_address */, |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 45 | std::vector<char> /* data */) |
| 46 | |
| 47 | // P2P Socket messages sent from the renderer to the browser. |
| 48 | |
[email protected] | 6d802c6 | 2011-07-13 18:20:44 | [diff] [blame] | 49 | // Start/stop sending P2PMsg_NetworkListChanged messages when network |
| 50 | // configuration changes. |
| 51 | IPC_MESSAGE_ROUTED0(P2PHostMsg_StartNetworkNotifications) |
| 52 | IPC_MESSAGE_ROUTED0(P2PHostMsg_StopNetworkNotifications) |
[email protected] | 91ed478b | 2011-04-21 23:20:07 | [diff] [blame] | 53 | |
[email protected] | efa5d938 | 2011-08-09 20:09:14 | [diff] [blame] | 54 | IPC_MESSAGE_ROUTED2(P2PHostMsg_GetHostAddress, |
| 55 | std::string /* host_name */, |
| 56 | int32 /* request_id */) |
| 57 | |
[email protected] | 73a19c1 | 2011-04-20 00:25:44 | [diff] [blame] | 58 | IPC_MESSAGE_ROUTED4(P2PHostMsg_CreateSocket, |
[email protected] | b3f8f972 | 2011-08-25 20:56:07 | [diff] [blame^] | 59 | content::P2PSocketType /* type */, |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 60 | int /* socket_id */, |
[email protected] | 73a19c1 | 2011-04-20 00:25:44 | [diff] [blame] | 61 | net::IPEndPoint /* local_address */, |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 62 | net::IPEndPoint /* remote_address */) |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 63 | |
[email protected] | 0f2b2e95 | 2011-04-19 04:40:56 | [diff] [blame] | 64 | IPC_MESSAGE_ROUTED3(P2PHostMsg_AcceptIncomingTcpConnection, |
| 65 | int /* listen_socket_id */, |
| 66 | net::IPEndPoint /* remote_address */, |
| 67 | int /* connected_socket_id */) |
| 68 | |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 69 | // TODO(sergeyu): Use shared memory to pass the data. |
| 70 | IPC_MESSAGE_ROUTED3(P2PHostMsg_Send, |
| 71 | int /* socket_id */, |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 72 | net::IPEndPoint /* socket_address */, |
[email protected] | 6c54e7e4 | 2011-03-02 20:52:34 | [diff] [blame] | 73 | std::vector<char> /* data */) |
| 74 | |
| 75 | IPC_MESSAGE_ROUTED1(P2PHostMsg_DestroySocket, |
[email protected] | 1a2123c6 | 2011-03-12 04:42:39 | [diff] [blame] | 76 | int /* socket_id */) |