OLD | NEW |
1 // Copyright (c) 2012 The Chromium Authors. All rights reserved. | 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 | 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 // An implementation of buzz::AsyncSocket that uses Chrome sockets. | 5 // An implementation of buzz::AsyncSocket that uses Chrome sockets. |
6 | 6 |
7 #ifndef JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ | 7 #ifndef JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ |
8 #define JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ | 8 #define JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ |
9 | 9 |
10 #if !defined(FEATURE_ENABLE_SSL) | 10 #if !defined(FEATURE_ENABLE_SSL) |
(...skipping 54 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
65 // | 65 // |
66 // If |address| has an empty hostname or a zero port, sets error to | 66 // If |address| has an empty hostname or a zero port, sets error to |
67 // ERROR_DNS and returns false. (We don't use the IP address even | 67 // ERROR_DNS and returns false. (We don't use the IP address even |
68 // if it's present, as DNS resolution is done by | 68 // if it's present, as DNS resolution is done by |
69 // |resolving_client_socket_factory_|. But it's perfectly fine if | 69 // |resolving_client_socket_factory_|. But it's perfectly fine if |
70 // the hostname is a stringified IP address.) | 70 // the hostname is a stringified IP address.) |
71 // | 71 // |
72 // Otherwise, starts the connection process and returns true. | 72 // Otherwise, starts the connection process and returns true. |
73 // SignalConnected will be raised when the connection is successful; | 73 // SignalConnected will be raised when the connection is successful; |
74 // otherwise, SignalClosed will be raised with a net error set. | 74 // otherwise, SignalClosed will be raised with a net error set. |
75 virtual bool Connect(const talk_base::SocketAddress& address) OVERRIDE; | 75 virtual bool Connect(const rtc::SocketAddress& address) OVERRIDE; |
76 | 76 |
77 // Tries to read at most |len| bytes into |data|. | 77 // Tries to read at most |len| bytes into |data|. |
78 // | 78 // |
79 // If state() is not STATE_TLS_CONNECTING, STATE_OPEN, or | 79 // If state() is not STATE_TLS_CONNECTING, STATE_OPEN, or |
80 // STATE_TLS_OPEN, sets error to ERROR_WRONGSTATE and returns false. | 80 // STATE_TLS_OPEN, sets error to ERROR_WRONGSTATE and returns false. |
81 // | 81 // |
82 // Otherwise, fills in |len_read| with the number of bytes read and | 82 // Otherwise, fills in |len_read| with the number of bytes read and |
83 // returns true. If this is called when state() is | 83 // returns true. If this is called when state() is |
84 // STATE_TLS_CONNECTING, reads 0 bytes. (We have to handle this | 84 // STATE_TLS_CONNECTING, reads 0 bytes. (We have to handle this |
85 // case because StartTls() is called during a slot connected to | 85 // case because StartTls() is called during a slot connected to |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
205 size_t write_end_; | 205 size_t write_end_; |
206 | 206 |
207 base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_; | 207 base::WeakPtrFactory<ChromeAsyncSocket> weak_ptr_factory_; |
208 | 208 |
209 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); | 209 DISALLOW_COPY_AND_ASSIGN(ChromeAsyncSocket); |
210 }; | 210 }; |
211 | 211 |
212 } // namespace jingle_glue | 212 } // namespace jingle_glue |
213 | 213 |
214 #endif // JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ | 214 #endif // JINGLE_GLUE_CHROME_ASYNC_SOCKET_H_ |
OLD | NEW |