OLD | NEW |
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. |
2 // Use of this source code is governed by a BSD-style license that can be | 2 // Use of this source code is governed by a BSD-style license that can be |
3 // found in the LICENSE file. | 3 // found in the LICENSE file. |
4 | 4 |
5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 5 #ifndef CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 6 #define CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
7 | 7 |
8 #include <queue> | 8 #include <queue> |
9 #include <vector> | 9 #include <vector> |
10 | 10 |
(...skipping 21 matching lines...) Expand all Loading... |
32 int socket_id, | 32 int socket_id, |
33 P2PSocketType type, | 33 P2PSocketType type, |
34 net::URLRequestContextGetter* url_context); | 34 net::URLRequestContextGetter* url_context); |
35 virtual ~P2PSocketHostTcpBase(); | 35 virtual ~P2PSocketHostTcpBase(); |
36 | 36 |
37 bool InitAccepted(const net::IPEndPoint& remote_address, | 37 bool InitAccepted(const net::IPEndPoint& remote_address, |
38 net::StreamSocket* socket); | 38 net::StreamSocket* socket); |
39 | 39 |
40 // P2PSocketHost overrides. | 40 // P2PSocketHost overrides. |
41 virtual bool Init(const net::IPEndPoint& local_address, | 41 virtual bool Init(const net::IPEndPoint& local_address, |
42 const P2PHostAndIPEndPoint& remote_address) OVERRIDE; | 42 const P2PHostAndIPEndPoint& remote_address) override; |
43 virtual void Send(const net::IPEndPoint& to, | 43 virtual void Send(const net::IPEndPoint& to, |
44 const std::vector<char>& data, | 44 const std::vector<char>& data, |
45 const rtc::PacketOptions& options, | 45 const rtc::PacketOptions& options, |
46 uint64 packet_id) OVERRIDE; | 46 uint64 packet_id) override; |
47 virtual P2PSocketHost* AcceptIncomingTcpConnection( | 47 virtual P2PSocketHost* AcceptIncomingTcpConnection( |
48 const net::IPEndPoint& remote_address, int id) OVERRIDE; | 48 const net::IPEndPoint& remote_address, int id) override; |
49 virtual bool SetOption(P2PSocketOption option, int value) OVERRIDE; | 49 virtual bool SetOption(P2PSocketOption option, int value) override; |
50 | 50 |
51 protected: | 51 protected: |
52 // Derived classes will provide the implementation. | 52 // Derived classes will provide the implementation. |
53 virtual int ProcessInput(char* input, int input_len) = 0; | 53 virtual int ProcessInput(char* input, int input_len) = 0; |
54 virtual void DoSend(const net::IPEndPoint& to, | 54 virtual void DoSend(const net::IPEndPoint& to, |
55 const std::vector<char>& data, | 55 const std::vector<char>& data, |
56 const rtc::PacketOptions& options) = 0; | 56 const rtc::PacketOptions& options) = 0; |
57 | 57 |
58 void WriteOrQueue(scoped_refptr<net::DrainableIOBuffer>& buffer); | 58 void WriteOrQueue(scoped_refptr<net::DrainableIOBuffer>& buffer); |
59 void OnPacket(const std::vector<char>& data); | 59 void OnPacket(const std::vector<char>& data); |
(...skipping 40 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
100 | 100 |
101 class CONTENT_EXPORT P2PSocketHostTcp : public P2PSocketHostTcpBase { | 101 class CONTENT_EXPORT P2PSocketHostTcp : public P2PSocketHostTcpBase { |
102 public: | 102 public: |
103 P2PSocketHostTcp(IPC::Sender* message_sender, | 103 P2PSocketHostTcp(IPC::Sender* message_sender, |
104 int socket_id, | 104 int socket_id, |
105 P2PSocketType type, | 105 P2PSocketType type, |
106 net::URLRequestContextGetter* url_context); | 106 net::URLRequestContextGetter* url_context); |
107 virtual ~P2PSocketHostTcp(); | 107 virtual ~P2PSocketHostTcp(); |
108 | 108 |
109 protected: | 109 protected: |
110 virtual int ProcessInput(char* input, int input_len) OVERRIDE; | 110 virtual int ProcessInput(char* input, int input_len) override; |
111 virtual void DoSend(const net::IPEndPoint& to, | 111 virtual void DoSend(const net::IPEndPoint& to, |
112 const std::vector<char>& data, | 112 const std::vector<char>& data, |
113 const rtc::PacketOptions& options) OVERRIDE; | 113 const rtc::PacketOptions& options) override; |
114 private: | 114 private: |
115 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcp); | 115 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostTcp); |
116 }; | 116 }; |
117 | 117 |
118 // P2PSocketHostStunTcp class provides the framing of STUN messages when used | 118 // P2PSocketHostStunTcp class provides the framing of STUN messages when used |
119 // with TURN. These messages will not have length at front of the packet and | 119 // with TURN. These messages will not have length at front of the packet and |
120 // are padded to multiple of 4 bytes. | 120 // are padded to multiple of 4 bytes. |
121 // Formatting of messages is defined in RFC5766. | 121 // Formatting of messages is defined in RFC5766. |
122 class CONTENT_EXPORT P2PSocketHostStunTcp : public P2PSocketHostTcpBase { | 122 class CONTENT_EXPORT P2PSocketHostStunTcp : public P2PSocketHostTcpBase { |
123 public: | 123 public: |
124 P2PSocketHostStunTcp(IPC::Sender* message_sender, | 124 P2PSocketHostStunTcp(IPC::Sender* message_sender, |
125 int socket_id, | 125 int socket_id, |
126 P2PSocketType type, | 126 P2PSocketType type, |
127 net::URLRequestContextGetter* url_context); | 127 net::URLRequestContextGetter* url_context); |
128 | 128 |
129 virtual ~P2PSocketHostStunTcp(); | 129 virtual ~P2PSocketHostStunTcp(); |
130 | 130 |
131 protected: | 131 protected: |
132 virtual int ProcessInput(char* input, int input_len) OVERRIDE; | 132 virtual int ProcessInput(char* input, int input_len) override; |
133 virtual void DoSend(const net::IPEndPoint& to, | 133 virtual void DoSend(const net::IPEndPoint& to, |
134 const std::vector<char>& data, | 134 const std::vector<char>& data, |
135 const rtc::PacketOptions& options) OVERRIDE; | 135 const rtc::PacketOptions& options) override; |
136 private: | 136 private: |
137 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); | 137 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); |
138 | 138 |
139 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); | 139 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); |
140 }; | 140 }; |
141 | 141 |
142 | 142 |
143 } // namespace content | 143 } // namespace content |
144 | 144 |
145 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 145 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
OLD | NEW |