Upstream version 7.36.149.0
[platform/framework/web/crosswalk.git] / src / content / common / p2p_messages.h
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.
4
5 // IPC messages for the P2P Transport API.
6 // Multiply-included message file, hence no include guard.
7
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"
14
15 #undef IPC_MESSAGE_EXPORT
16 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
17 #define IPC_MESSAGE_START P2PMsgStart
18
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,
25                               talk_base::DSCP_CS7)
26 IPC_ENUM_TRAITS_MIN_MAX_VALUE(net::NetworkChangeNotifier::ConnectionType,
27                               net::NetworkChangeNotifier::CONNECTION_UNKNOWN,
28                               net::NetworkChangeNotifier::CONNECTION_NONE)
29
30
31 IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface)
32   IPC_STRUCT_TRAITS_MEMBER(name)
33   IPC_STRUCT_TRAITS_MEMBER(type)
34   IPC_STRUCT_TRAITS_MEMBER(address)
35 IPC_STRUCT_TRAITS_END()
36
37 IPC_STRUCT_TRAITS_BEGIN(talk_base::PacketTimeUpdateParams)
38   IPC_STRUCT_TRAITS_MEMBER(rtp_sendtime_extension_id)
39   IPC_STRUCT_TRAITS_MEMBER(srtp_auth_key)
40   IPC_STRUCT_TRAITS_MEMBER(srtp_auth_tag_len)
41   IPC_STRUCT_TRAITS_MEMBER(srtp_packet_index)
42 IPC_STRUCT_TRAITS_END()
43
44 IPC_STRUCT_TRAITS_BEGIN(talk_base::PacketOptions)
45   IPC_STRUCT_TRAITS_MEMBER(dscp)
46   IPC_STRUCT_TRAITS_MEMBER(packet_time_params)
47 IPC_STRUCT_TRAITS_END()
48
49 IPC_STRUCT_TRAITS_BEGIN(content::P2PHostAndIPEndPoint)
50   IPC_STRUCT_TRAITS_MEMBER(hostname)
51   IPC_STRUCT_TRAITS_MEMBER(ip_address)
52 IPC_STRUCT_TRAITS_END()
53
54 // P2P Socket messages sent from the browser to the renderer.
55
56 IPC_MESSAGE_CONTROL1(P2PMsg_NetworkListChanged,
57                      net::NetworkInterfaceList /* networks */)
58
59 IPC_MESSAGE_CONTROL2(P2PMsg_GetHostAddressResult,
60                      int32 /* request_id */,
61                      net::IPAddressList /* address list*/)
62
63 IPC_MESSAGE_CONTROL2(P2PMsg_OnSocketCreated,
64                      int /* socket_id */,
65                      net::IPEndPoint /* socket_address */)
66
67 IPC_MESSAGE_CONTROL1(P2PMsg_OnSendComplete,
68                      int /* socket_id */)
69
70 IPC_MESSAGE_CONTROL1(P2PMsg_OnError,
71                      int /* socket_id */)
72
73 IPC_MESSAGE_CONTROL2(P2PMsg_OnIncomingTcpConnection,
74                      int /* socket_id */,
75                      net::IPEndPoint /* socket_address */)
76
77 IPC_MESSAGE_CONTROL4(P2PMsg_OnDataReceived,
78                      int /* socket_id */,
79                      net::IPEndPoint /* socket_address */,
80                      std::vector<char> /* data */,
81                      base::TimeTicks /* timestamp */ )
82
83 // P2P Socket messages sent from the renderer to the browser.
84
85 // Start/stop sending P2PMsg_NetworkListChanged messages when network
86 // configuration changes.
87 IPC_MESSAGE_CONTROL0(P2PHostMsg_StartNetworkNotifications)
88 IPC_MESSAGE_CONTROL0(P2PHostMsg_StopNetworkNotifications)
89
90 IPC_MESSAGE_CONTROL2(P2PHostMsg_GetHostAddress,
91                     std::string /* host_name */,
92                     int32 /* request_id */)
93
94 IPC_MESSAGE_CONTROL4(P2PHostMsg_CreateSocket,
95                      content::P2PSocketType /* type */,
96                      int /* socket_id */,
97                      net::IPEndPoint /* local_address */,
98                      content::P2PHostAndIPEndPoint /* remote_address */)
99
100 IPC_MESSAGE_CONTROL3(P2PHostMsg_AcceptIncomingTcpConnection,
101                     int /* listen_socket_id */,
102                     net::IPEndPoint /* remote_address */,
103                     int /* connected_socket_id */)
104
105 // TODO(sergeyu): Use shared memory to pass the data.
106 IPC_MESSAGE_CONTROL5(P2PHostMsg_Send,
107                      int /* socket_id */,
108                      net::IPEndPoint /* socket_address */,
109                      std::vector<char> /* data */,
110                      talk_base::PacketOptions /* packet options */,
111                      uint64 /* packet_id */)
112
113 IPC_MESSAGE_CONTROL1(P2PHostMsg_DestroySocket,
114                      int /* socket_id */)
115
116 IPC_MESSAGE_CONTROL3(P2PHostMsg_SetOption,
117                      int /* socket_id */,
118                      content::P2PSocketOption /* socket option type */,
119                      int /* value */)