• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 // Copyright 2014 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 // This file defines some basic types used by the P2P-related IPC
6 // messages.
7 
8 #ifndef CONTENT_COMMON_P2P_SOCKET_TYPE_H_
9 #define CONTENT_COMMON_P2P_SOCKET_TYPE_H_
10 
11 #include <string>
12 
13 #include "net/base/ip_endpoint.h"
14 
15 namespace content {
16 
17 enum P2PSocketOption {
18   P2P_SOCKET_OPT_RCVBUF,  // Receive buffer size.
19   P2P_SOCKET_OPT_SNDBUF,  // Send buffer size.
20   P2P_SOCKET_OPT_DSCP,    // DSCP code.
21   P2P_SOCKET_OPT_MAX
22 };
23 
24 // Type of P2P Socket.
25 enum P2PSocketType {
26   P2P_SOCKET_UDP,
27   P2P_SOCKET_TCP_SERVER,
28   P2P_SOCKET_STUN_TCP_SERVER,
29   P2P_SOCKET_TCP_CLIENT,
30   P2P_SOCKET_STUN_TCP_CLIENT,
31   P2P_SOCKET_SSLTCP_CLIENT,
32   P2P_SOCKET_STUN_SSLTCP_CLIENT,
33   P2P_SOCKET_TLS_CLIENT,
34   P2P_SOCKET_STUN_TLS_CLIENT,
35   P2P_SOCKET_TYPE_LAST = P2P_SOCKET_STUN_TLS_CLIENT
36 };
37 
38 // Struct which carries both resolved IP address and host string literal.
39 // Port number will be part of |ip_address|.
40 struct P2PHostAndIPEndPoint {
P2PHostAndIPEndPointP2PHostAndIPEndPoint41   P2PHostAndIPEndPoint() {}
P2PHostAndIPEndPointP2PHostAndIPEndPoint42   P2PHostAndIPEndPoint(const std::string& hostname,
43                        const net::IPEndPoint& ip_address)
44       : hostname(hostname), ip_address(ip_address) {
45   }
46 
47   std::string hostname;
48   net::IPEndPoint ip_address;
49 };
50 
51 }  // namespace content
52 
53 #endif  // CONTENT_COMMON_P2P_SOCKET_TYPE_H_
54