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 41 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
52 const std::vector<char>& data) = 0; | 52 const std::vector<char>& data) = 0; |
53 | 53 |
54 void WriteOrQueue(scoped_refptr<net::DrainableIOBuffer>& buffer); | 54 void WriteOrQueue(scoped_refptr<net::DrainableIOBuffer>& buffer); |
55 void OnPacket(const std::vector<char>& data); | 55 void OnPacket(const std::vector<char>& data); |
56 void OnError(); | 56 void OnError(); |
57 | 57 |
58 private: | 58 private: |
59 friend class P2PSocketHostTcpTestBase; | 59 friend class P2PSocketHostTcpTestBase; |
60 friend class P2PSocketHostTcpServerTest; | 60 friend class P2PSocketHostTcpServerTest; |
61 | 61 |
| 62 // SSL/TLS connection functions. |
| 63 void StartTls(); |
| 64 void ProcessTlsConnectDone(int status); |
| 65 |
62 void DidCompleteRead(int result); | 66 void DidCompleteRead(int result); |
63 void DoRead(); | 67 void DoRead(); |
64 | 68 |
65 void DoWrite(); | 69 void DoWrite(); |
66 void HandleWriteResult(int result); | 70 void HandleWriteResult(int result); |
67 | 71 |
68 // Callbacks for Connect(), Read() and Write(). | 72 // Callbacks for Connect(), Read() and Write(). |
69 void OnConnected(int result); | 73 void OnConnected(int result); |
70 void OnRead(int result); | 74 void OnRead(int result); |
71 void OnWritten(int result); | 75 void OnWritten(int result); |
72 | 76 |
| 77 void DoSendSocketCreateMsg(); |
| 78 |
73 net::IPEndPoint remote_address_; | 79 net::IPEndPoint remote_address_; |
74 | 80 |
75 scoped_ptr<net::StreamSocket> socket_; | 81 scoped_ptr<net::StreamSocket> socket_; |
76 scoped_refptr<net::GrowableIOBuffer> read_buffer_; | 82 scoped_refptr<net::GrowableIOBuffer> read_buffer_; |
77 std::queue<scoped_refptr<net::DrainableIOBuffer> > write_queue_; | 83 std::queue<scoped_refptr<net::DrainableIOBuffer> > write_queue_; |
78 scoped_refptr<net::DrainableIOBuffer> write_buffer_; | 84 scoped_refptr<net::DrainableIOBuffer> write_buffer_; |
79 | 85 |
80 bool write_pending_; | 86 bool write_pending_; |
81 | 87 |
82 bool connected_; | 88 bool connected_; |
(...skipping 39 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
122 private: | 128 private: |
123 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); | 129 int GetExpectedPacketSize(const char* data, int len, int* pad_bytes); |
124 | 130 |
125 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); | 131 DISALLOW_COPY_AND_ASSIGN(P2PSocketHostStunTcp); |
126 }; | 132 }; |
127 | 133 |
128 | 134 |
129 } // namespace content | 135 } // namespace content |
130 | 136 |
131 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ | 137 #endif // CONTENT_BROWSER_RENDERER_HOST_P2P_SOCKET_HOST_TCP_H_ |
OLD | NEW |