Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / content / common / p2p_socket_type.h
blobed77296b28de513dc2fcbacb949afd41199342bc
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.
5 // This file defines some basic types used by the P2P-related IPC
6 // messages.
8 #ifndef CONTENT_COMMON_P2P_SOCKET_TYPE_H_
9 #define CONTENT_COMMON_P2P_SOCKET_TYPE_H_
11 #include <string>
13 #include "net/base/ip_endpoint.h"
15 namespace content {
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
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
38 // Struct which carries both resolved IP address and host string literal.
39 // Port number will be part of |ip_address|.
40 struct P2PHostAndIPEndPoint {
41 P2PHostAndIPEndPoint() {}
42 P2PHostAndIPEndPoint(const std::string& hostname,
43 const net::IPEndPoint& ip_address)
44 : hostname(hostname), ip_address(ip_address) {
47 std::string hostname;
48 net::IPEndPoint ip_address;
51 // Stuct which keeps track of metrics during a send operation on P2P sockets.
52 // Currently, it only carries packet_id but could be expanded to include
53 // timestamps when packet arrives at various points.
54 struct P2PSendPacketMetrics {
55 P2PSendPacketMetrics() : packet_id(0) {}
56 explicit P2PSendPacketMetrics(uint64_t packet_id) : packet_id(packet_id) {}
58 uint64_t packet_id;
61 } // namespace content
63 #endif // CONTENT_COMMON_P2P_SOCKET_TYPE_H_