| OLD | NEW |
| 1 /* | 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * | 3 * |
| 4 * Use of this source code is governed by a BSD-style license | 4 * Use of this source code is governed by a BSD-style license |
| 5 * that can be found in the LICENSE file in the root of the source | 5 * that can be found in the LICENSE file in the root of the source |
| 6 * tree. An additional intellectual property rights grant can be found | 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ | 9 */ |
| 10 | 10 |
| (...skipping 10 matching lines...) Expand all Loading... |
| 21 | 21 |
| 22 namespace buzz { | 22 namespace buzz { |
| 23 | 23 |
| 24 class AsyncSocket { | 24 class AsyncSocket { |
| 25 public: | 25 public: |
| 26 enum State { | 26 enum State { |
| 27 STATE_CLOSED = 0, //!< Socket is not open. | 27 STATE_CLOSED = 0, //!< Socket is not open. |
| 28 STATE_CLOSING, //!< Socket is closing but can have buffered data | 28 STATE_CLOSING, //!< Socket is closing but can have buffered data |
| 29 STATE_CONNECTING, //!< In the process of | 29 STATE_CONNECTING, //!< In the process of |
| 30 STATE_OPEN, //!< Socket is connected | 30 STATE_OPEN, //!< Socket is connected |
| 31 #if defined(FEATURE_ENABLE_SSL) | |
| 32 STATE_TLS_CONNECTING, //!< Establishing TLS connection | 31 STATE_TLS_CONNECTING, //!< Establishing TLS connection |
| 33 STATE_TLS_OPEN, //!< TLS connected | 32 STATE_TLS_OPEN, //!< TLS connected |
| 34 #endif | |
| 35 }; | 33 }; |
| 36 | 34 |
| 37 enum Error { | 35 enum Error { |
| 38 ERROR_NONE = 0, //!< No error | 36 ERROR_NONE = 0, //!< No error |
| 39 ERROR_WINSOCK, //!< Winsock error | 37 ERROR_WINSOCK, //!< Winsock error |
| 40 ERROR_DNS, //!< Couldn't resolve host name | 38 ERROR_DNS, //!< Couldn't resolve host name |
| 41 ERROR_WRONGSTATE, //!< Call made while socket is in the wrong state | 39 ERROR_WRONGSTATE, //!< Call made while socket is in the wrong state |
| 42 #if defined(FEATURE_ENABLE_SSL) | |
| 43 ERROR_SSL, //!< Something went wrong with OpenSSL | 40 ERROR_SSL, //!< Something went wrong with OpenSSL |
| 44 #endif | |
| 45 }; | 41 }; |
| 46 | 42 |
| 47 virtual ~AsyncSocket() {} | 43 virtual ~AsyncSocket() {} |
| 48 virtual State state() = 0; | 44 virtual State state() = 0; |
| 49 virtual Error error() = 0; | 45 virtual Error error() = 0; |
| 50 virtual int GetError() = 0; // winsock error code | 46 virtual int GetError() = 0; // winsock error code |
| 51 | 47 |
| 52 virtual bool Connect(const rtc::SocketAddress& addr) = 0; | 48 virtual bool Connect(const rtc::SocketAddress& addr) = 0; |
| 53 virtual bool Read(char * data, size_t len, size_t* len_read) = 0; | 49 virtual bool Read(char * data, size_t len, size_t* len_read) = 0; |
| 54 virtual bool Write(const char * data, size_t len) = 0; | 50 virtual bool Write(const char * data, size_t len) = 0; |
| 55 virtual bool Close() = 0; | 51 virtual bool Close() = 0; |
| 56 #if defined(FEATURE_ENABLE_SSL) | |
| 57 // We allow matching any passed domain. This allows us to avoid | 52 // We allow matching any passed domain. This allows us to avoid |
| 58 // handling the valuable certificates for logins into proxies. If | 53 // handling the valuable certificates for logins into proxies. If |
| 59 // both names are passed as empty, we do not require a match. | 54 // both names are passed as empty, we do not require a match. |
| 60 virtual bool StartTls(const std::string & domainname) = 0; | 55 virtual bool StartTls(const std::string & domainname) = 0; |
| 61 #endif | |
| 62 | 56 |
| 63 sigslot::signal0<> SignalConnected; | 57 sigslot::signal0<> SignalConnected; |
| 64 sigslot::signal0<> SignalSSLConnected; | 58 sigslot::signal0<> SignalSSLConnected; |
| 65 sigslot::signal0<> SignalClosed; | 59 sigslot::signal0<> SignalClosed; |
| 66 sigslot::signal0<> SignalRead; | 60 sigslot::signal0<> SignalRead; |
| 67 sigslot::signal0<> SignalError; | 61 sigslot::signal0<> SignalError; |
| 68 }; | 62 }; |
| 69 | 63 |
| 70 } | 64 } |
| 71 | 65 |
| 72 #endif // WEBRTC_LIBJINGLE_XMPP_ASYNCSOCKET_H_ | 66 #endif // WEBRTC_LIBJINGLE_XMPP_ASYNCSOCKET_H_ |
| OLD | NEW |