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