1 // Copyright (c) 2012 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 "base/time/time.h"
9 #include "content/common/content_export.h"
10 #include "content/public/common/p2p_socket_type.h"
11 #include "ipc/ipc_message_macros.h"
12 #include "net/base/ip_endpoint.h"
13 #include "net/base/net_util.h"
15 #undef IPC_MESSAGE_EXPORT
16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
17 #define IPC_MESSAGE_START P2PMsgStart
19 IPC_ENUM_TRAITS(content::P2PSocketType
)
20 IPC_ENUM_TRAITS(net::DiffServCodePoint
)
22 IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface
)
23 IPC_STRUCT_TRAITS_MEMBER(name
)
24 IPC_STRUCT_TRAITS_MEMBER(address
)
25 IPC_STRUCT_TRAITS_END()
27 // P2P Socket messages sent from the browser to the renderer.
29 IPC_MESSAGE_CONTROL1(P2PMsg_NetworkListChanged
,
30 net::NetworkInterfaceList
/* networks */)
32 IPC_MESSAGE_CONTROL2(P2PMsg_GetHostAddressResult
,
33 int32
/* request_id */,
34 net::IPAddressList
/* address list*/)
36 IPC_MESSAGE_CONTROL2(P2PMsg_OnSocketCreated
,
38 net::IPEndPoint
/* socket_address */)
40 IPC_MESSAGE_CONTROL1(P2PMsg_OnSendComplete
,
43 IPC_MESSAGE_CONTROL1(P2PMsg_OnError
,
46 IPC_MESSAGE_CONTROL2(P2PMsg_OnIncomingTcpConnection
,
48 net::IPEndPoint
/* socket_address */)
50 IPC_MESSAGE_CONTROL4(P2PMsg_OnDataReceived
,
52 net::IPEndPoint
/* socket_address */,
53 std::vector
<char> /* data */,
54 base::TimeTicks
/* timestamp */ )
56 // P2P Socket messages sent from the renderer to the browser.
58 // Start/stop sending P2PMsg_NetworkListChanged messages when network
59 // configuration changes.
60 IPC_MESSAGE_CONTROL0(P2PHostMsg_StartNetworkNotifications
)
61 IPC_MESSAGE_CONTROL0(P2PHostMsg_StopNetworkNotifications
)
63 IPC_MESSAGE_CONTROL2(P2PHostMsg_GetHostAddress
,
64 std::string
/* host_name */,
65 int32
/* request_id */)
67 IPC_MESSAGE_CONTROL4(P2PHostMsg_CreateSocket
,
68 content::P2PSocketType
/* type */,
70 net::IPEndPoint
/* local_address */,
71 net::IPEndPoint
/* remote_address */)
73 IPC_MESSAGE_CONTROL3(P2PHostMsg_AcceptIncomingTcpConnection
,
74 int /* listen_socket_id */,
75 net::IPEndPoint
/* remote_address */,
76 int /* connected_socket_id */)
78 // TODO(sergeyu): Use shared memory to pass the data.
79 IPC_MESSAGE_CONTROL5(P2PHostMsg_Send
,
81 net::IPEndPoint
/* socket_address */,
82 std::vector
<char> /* data */,
83 net::DiffServCodePoint
/* dscp */,
84 uint64
/* packet_id */)
86 IPC_MESSAGE_CONTROL1(P2PHostMsg_DestroySocket
,