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/common/p2p_socket_type.h"
11 #include "ipc/ipc_message_macros.h"
12 #include "net/base/net_util.h"
13 #include "third_party/libjingle/source/talk/base/asyncpacketsocket.h"
15 #undef IPC_MESSAGE_EXPORT
16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
17 #define IPC_MESSAGE_START P2PMsgStart
19 IPC_ENUM_TRAITS_MAX_VALUE(content::P2PSocketType
,
20 content::P2P_SOCKET_TYPE_LAST
)
21 IPC_ENUM_TRAITS_MAX_VALUE(content::P2PSocketOption
,
22 content::P2P_SOCKET_OPT_MAX
- 1)
23 IPC_ENUM_TRAITS_MIN_MAX_VALUE(talk_base::DiffServCodePoint
,
24 talk_base::DSCP_NO_CHANGE
,
27 IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface
)
28 IPC_STRUCT_TRAITS_MEMBER(name
)
29 IPC_STRUCT_TRAITS_MEMBER(type
)
30 IPC_STRUCT_TRAITS_MEMBER(address
)
31 IPC_STRUCT_TRAITS_END()
33 IPC_STRUCT_TRAITS_BEGIN(talk_base::PacketTimeUpdateParams
)
34 IPC_STRUCT_TRAITS_MEMBER(rtp_sendtime_extension_id
)
35 IPC_STRUCT_TRAITS_MEMBER(srtp_auth_key
)
36 IPC_STRUCT_TRAITS_MEMBER(srtp_auth_tag_len
)
37 IPC_STRUCT_TRAITS_MEMBER(srtp_packet_index
)
38 IPC_STRUCT_TRAITS_END()
40 IPC_STRUCT_TRAITS_BEGIN(talk_base::PacketOptions
)
41 IPC_STRUCT_TRAITS_MEMBER(dscp
)
42 IPC_STRUCT_TRAITS_MEMBER(packet_time_params
)
43 IPC_STRUCT_TRAITS_END()
45 IPC_STRUCT_TRAITS_BEGIN(content::P2PHostAndIPEndPoint
)
46 IPC_STRUCT_TRAITS_MEMBER(hostname
)
47 IPC_STRUCT_TRAITS_MEMBER(ip_address
)
48 IPC_STRUCT_TRAITS_END()
50 // P2P Socket messages sent from the browser to the renderer.
52 IPC_MESSAGE_CONTROL1(P2PMsg_NetworkListChanged
,
53 net::NetworkInterfaceList
/* networks */)
55 IPC_MESSAGE_CONTROL2(P2PMsg_GetHostAddressResult
,
56 int32
/* request_id */,
57 net::IPAddressList
/* address list*/)
59 IPC_MESSAGE_CONTROL3(P2PMsg_OnSocketCreated
,
61 net::IPEndPoint
/* local_address */,
62 net::IPEndPoint
/* remote_address */)
64 IPC_MESSAGE_CONTROL1(P2PMsg_OnSendComplete
,
67 IPC_MESSAGE_CONTROL1(P2PMsg_OnError
,
70 IPC_MESSAGE_CONTROL2(P2PMsg_OnIncomingTcpConnection
,
72 net::IPEndPoint
/* socket_address */)
74 IPC_MESSAGE_CONTROL4(P2PMsg_OnDataReceived
,
76 net::IPEndPoint
/* socket_address */,
77 std::vector
<char> /* data */,
78 base::TimeTicks
/* timestamp */ )
80 // P2P Socket messages sent from the renderer to the browser.
82 // Start/stop sending P2PMsg_NetworkListChanged messages when network
83 // configuration changes.
84 IPC_MESSAGE_CONTROL0(P2PHostMsg_StartNetworkNotifications
)
85 IPC_MESSAGE_CONTROL0(P2PHostMsg_StopNetworkNotifications
)
87 IPC_MESSAGE_CONTROL2(P2PHostMsg_GetHostAddress
,
88 std::string
/* host_name */,
89 int32
/* request_id */)
91 IPC_MESSAGE_CONTROL4(P2PHostMsg_CreateSocket
,
92 content::P2PSocketType
/* type */,
94 net::IPEndPoint
/* local_address */,
95 content::P2PHostAndIPEndPoint
/* remote_address */)
97 IPC_MESSAGE_CONTROL3(P2PHostMsg_AcceptIncomingTcpConnection
,
98 int /* listen_socket_id */,
99 net::IPEndPoint
/* remote_address */,
100 int /* connected_socket_id */)
102 // TODO(sergeyu): Use shared memory to pass the data.
103 IPC_MESSAGE_CONTROL5(P2PHostMsg_Send
,
105 net::IPEndPoint
/* socket_address */,
106 std::vector
<char> /* data */,
107 talk_base::PacketOptions
/* packet options */,
108 uint64
/* packet_id */)
110 IPC_MESSAGE_CONTROL1(P2PHostMsg_DestroySocket
,
113 IPC_MESSAGE_CONTROL3(P2PHostMsg_SetOption
,
115 content::P2PSocketOption
/* socket option type */,