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.
5 // IPC messages for the P2P Transport API.
6 // Multiply-included message file, hence no include guard.
8 #include "content/common/p2p_sockets.h"
9 #include "ipc/ipc_message_macros.h"
10 #include "net/base/ip_endpoint.h"
11 #include "net/base/net_util.h"
13 #define IPC_MESSAGE_START P2PMsgStart
15 IPC_ENUM_TRAITS(content::P2PSocketType
)
17 IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface
)
18 IPC_STRUCT_TRAITS_MEMBER(name
)
19 IPC_STRUCT_TRAITS_MEMBER(address
)
20 IPC_STRUCT_TRAITS_END()
22 // P2P Socket messages sent from the browser to the renderer.
24 IPC_MESSAGE_ROUTED1(P2PMsg_NetworkListChanged
,
25 net::NetworkInterfaceList
/* networks */)
27 IPC_MESSAGE_ROUTED2(P2PMsg_GetHostAddressResult
,
28 int32
/* request_id */,
29 net::IPAddressNumber
/* address */)
31 IPC_MESSAGE_ROUTED2(P2PMsg_OnSocketCreated
,
33 net::IPEndPoint
/* socket_address */)
35 IPC_MESSAGE_ROUTED1(P2PMsg_OnError
,
38 IPC_MESSAGE_ROUTED2(P2PMsg_OnIncomingTcpConnection
,
40 net::IPEndPoint
/* socket_address */)
42 IPC_MESSAGE_ROUTED3(P2PMsg_OnDataReceived
,
44 net::IPEndPoint
/* socket_address */,
45 std::vector
<char> /* data */)
47 // P2P Socket messages sent from the renderer to the browser.
49 // Start/stop sending P2PMsg_NetworkListChanged messages when network
50 // configuration changes.
51 IPC_MESSAGE_ROUTED0(P2PHostMsg_StartNetworkNotifications
)
52 IPC_MESSAGE_ROUTED0(P2PHostMsg_StopNetworkNotifications
)
54 IPC_MESSAGE_ROUTED2(P2PHostMsg_GetHostAddress
,
55 std::string
/* host_name */,
56 int32
/* request_id */)
58 IPC_MESSAGE_ROUTED4(P2PHostMsg_CreateSocket
,
59 content::P2PSocketType
/* type */,
61 net::IPEndPoint
/* local_address */,
62 net::IPEndPoint
/* remote_address */)
64 IPC_MESSAGE_ROUTED3(P2PHostMsg_AcceptIncomingTcpConnection
,
65 int /* listen_socket_id */,
66 net::IPEndPoint
/* remote_address */,
67 int /* connected_socket_id */)
69 // TODO(sergeyu): Use shared memory to pass the data.
70 IPC_MESSAGE_ROUTED3(P2PHostMsg_Send
,
72 net::IPEndPoint
/* socket_address */,
73 std::vector
<char> /* data */)
75 IPC_MESSAGE_ROUTED1(P2PHostMsg_DestroySocket
,