OLD | NEW |
1 // Copyright (c) 2009 The Chromium Authors. All rights reserved. | 1 // Copyright (c) 2009 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 REMOTING_JINGLE_GLUE_XMPP_SOCKET_ADAPTER_H_ | 5 #ifndef REMOTING_JINGLE_GLUE_XMPP_SOCKET_ADAPTER_H_ |
6 #define REMOTING_JINGLE_GLUE_XMPP_SOCKET_ADAPTER_H_ | 6 #define REMOTING_JINGLE_GLUE_XMPP_SOCKET_ADAPTER_H_ |
7 | 7 |
8 #include <string> | 8 #include <string> |
9 | 9 |
10 #include "third_party/libjingle/source/talk/base/asyncsocket.h" | 10 #include "third_party/libjingle/source/talk/base/asyncsocket.h" |
11 #include "third_party/libjingle/source/talk/xmpp/asyncsocket.h" | 11 #include "third_party/libjingle/source/talk/xmpp/asyncsocket.h" |
12 #include "third_party/libjingle/source/talk/xmpp/xmppclientsettings.h" | 12 #include "third_party/libjingle/source/talk/xmpp/xmppclientsettings.h" |
13 #include "third_party/libjingle/source/talk/xmpp/xmppengine.h" | 13 #include "third_party/libjingle/source/talk/xmpp/xmppengine.h" |
14 | 14 |
15 #ifndef _WIN32 | 15 #ifndef _WIN32 |
16 // Additional errors used by us from Win32 headers. | 16 // Additional errors used by us from Win32 headers. |
17 #define SEC_E_CERT_EXPIRED static_cast<int>(0x80090328L) | 17 #define SEC_E_CERT_EXPIRED static_cast<int>(0x80090328L) |
18 #define WSA_NOT_ENOUGH_MEMORY ENOMEM | 18 #define WSA_NOT_ENOUGH_MEMORY ENOMEM |
19 #endif | 19 #endif |
20 | 20 |
21 namespace remoting { | 21 namespace remoting { |
22 | 22 |
23 class XmppSocketAdapter : public buzz::AsyncSocket, | 23 class XmppSocketAdapter : public buzz::AsyncSocket, |
24 public sigslot::has_slots<> { | 24 public sigslot::has_slots<> { |
25 public: | 25 public: |
26 XmppSocketAdapter(const buzz::XmppClientSettings& xcs, | 26 XmppSocketAdapter(const buzz::XmppClientSettings& xcs, |
27 bool allow_unverified_certs); | 27 bool allow_unverified_certs); |
28 virtual ~XmppSocketAdapter(); | 28 virtual ~XmppSocketAdapter(); |
29 | 29 |
30 virtual State state() { return state_; } | 30 virtual State state(); |
31 virtual Error error() { return error_; } | 31 virtual Error error(); |
32 virtual int GetError() { return wsa_error_; } | 32 virtual int GetError(); |
33 | 33 |
34 void set_firewall(bool firewall) { firewall_ = firewall; } | 34 void set_firewall(bool firewall) { firewall_ = firewall; } |
35 | 35 |
36 virtual bool Connect(const talk_base::SocketAddress& addr); | 36 virtual bool Connect(const talk_base::SocketAddress& addr); |
37 virtual bool Read(char* data, size_t len, size_t* len_read); | 37 virtual bool Read(char* data, size_t len, size_t* len_read); |
38 virtual bool Write(const char* data, size_t len); | 38 virtual bool Write(const char* data, size_t len); |
39 virtual bool Close(); | 39 virtual bool Close(); |
40 | 40 |
41 #if defined(FEATURE_ENABLE_SSL) | 41 #if defined(FEATURE_ENABLE_SSL) |
42 virtual bool StartTls(const std::string& domainname); | 42 virtual bool StartTls(const std::string& domainname); |
(...skipping 35 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
78 void FlushWriteQueue(Error* error, int* wsa_error); | 78 void FlushWriteQueue(Error* error, int* wsa_error); |
79 | 79 |
80 void SetError(Error error); | 80 void SetError(Error error); |
81 void SetWSAError(int error); | 81 void SetWSAError(int error); |
82 DISALLOW_COPY_AND_ASSIGN(XmppSocketAdapter); | 82 DISALLOW_COPY_AND_ASSIGN(XmppSocketAdapter); |
83 }; | 83 }; |
84 | 84 |
85 } // namespace remoting | 85 } // namespace remoting |
86 | 86 |
87 #endif // REMOTING_JINGLE_GLUE_XMPP_SOCKET_ADAPTER_H_ | 87 #endif // REMOTING_JINGLE_GLUE_XMPP_SOCKET_ADAPTER_H_ |
OLD | NEW |