- add sources.
[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 "content/common/content_export.h"
9 #include "content/common/p2p_sockets.h"
10 #include "ipc/ipc_message_macros.h"
11 #include "net/base/ip_endpoint.h"
12 #include "net/base/net_util.h"
13
14 #undef IPC_MESSAGE_EXPORT
15 #define IPC_MESSAGE_EXPORT CONTENT_EXPORT
16 #define IPC_MESSAGE_START P2PMsgStart
17
18 IPC_ENUM_TRAITS(content::P2PSocketType)
19 IPC_ENUM_TRAITS(net::DiffServCodePoint)
20
21 IPC_STRUCT_TRAITS_BEGIN(net::NetworkInterface)
22   IPC_STRUCT_TRAITS_MEMBER(name)
23   IPC_STRUCT_TRAITS_MEMBER(address)
24 IPC_STRUCT_TRAITS_END()
25
26 // P2P Socket messages sent from the browser to the renderer.
27
28 IPC_MESSAGE_CONTROL1(P2PMsg_NetworkListChanged,
29                      net::NetworkInterfaceList /* networks */)
30
31 IPC_MESSAGE_CONTROL2(P2PMsg_GetHostAddressResult,
32                      int32 /* request_id */,
33                      net::IPAddressNumber /* address */)
34
35 IPC_MESSAGE_CONTROL2(P2PMsg_OnSocketCreated,
36                      int /* socket_id */,
37                      net::IPEndPoint /* socket_address */)
38
39 IPC_MESSAGE_CONTROL1(P2PMsg_OnSendComplete,
40                      int /* socket_id */)
41
42 IPC_MESSAGE_CONTROL1(P2PMsg_OnError,
43                      int /* socket_id */)
44
45 IPC_MESSAGE_CONTROL2(P2PMsg_OnIncomingTcpConnection,
46                      int /* socket_id */,
47                      net::IPEndPoint /* socket_address */)
48
49 IPC_MESSAGE_CONTROL3(P2PMsg_OnDataReceived,
50                      int /* socket_id */,
51                      net::IPEndPoint /* socket_address */,
52                      std::vector<char> /* data */)
53
54 // P2P Socket messages sent from the renderer to the browser.
55
56 // Start/stop sending P2PMsg_NetworkListChanged messages when network
57 // configuration changes.
58 IPC_MESSAGE_CONTROL0(P2PHostMsg_StartNetworkNotifications)
59 IPC_MESSAGE_CONTROL0(P2PHostMsg_StopNetworkNotifications)
60
61 IPC_MESSAGE_CONTROL2(P2PHostMsg_GetHostAddress,
62                     std::string /* host_name */,
63                     int32 /* request_id */)
64
65 IPC_MESSAGE_CONTROL4(P2PHostMsg_CreateSocket,
66                      content::P2PSocketType /* type */,
67                      int /* socket_id */,
68                      net::IPEndPoint /* local_address */,
69                      net::IPEndPoint /* remote_address */)
70
71 IPC_MESSAGE_CONTROL3(P2PHostMsg_AcceptIncomingTcpConnection,
72                     int /* listen_socket_id */,
73                     net::IPEndPoint /* remote_address */,
74                     int /* connected_socket_id */)
75
76 // TODO(sergeyu): Use shared memory to pass the data.
77 IPC_MESSAGE_CONTROL5(P2PHostMsg_Send,
78                      int /* socket_id */,
79                      net::IPEndPoint /* socket_address */,
80                      std::vector<char> /* data */,
81                      net::DiffServCodePoint /* dscp */,
82                      uint64 /* packet_id */)
83
84 IPC_MESSAGE_CONTROL1(P2PHostMsg_DestroySocket,
85                      int /* socket_id */)