Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(275)

Side by Side Diff: third_party/libjingle_xmpp/xmpp/xmppsocket.h

Issue 2443903004: Add xmllite and xmpp sources to third_party/ (Closed)
Patch Set: Fix GN and sort includes Created 3 years, 12 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View unified diff | Download patch
OLDNEW
(Empty)
1 // Copyright 2004 The Chromium Authors. All rights reserved.
2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file.
4
5 #ifndef WEBRTC_LIBJINGLE_XMPP_XMPPSOCKET_H_
6 #define WEBRTC_LIBJINGLE_XMPP_XMPPSOCKET_H_
7
8 #include "third_party/libjingle_xmpp/xmpp/asyncsocket.h"
9 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h"
10 #include "webrtc/base/asyncsocket.h"
11 #include "webrtc/base/buffer.h"
12 #include "webrtc/base/sigslot.h"
13
14 // The below define selects the SSLStreamAdapter implementation for
15 // SSL, as opposed to the SSLAdapter socket adapter.
16 // #define USE_SSLSTREAM
17
18 namespace rtc {
19 class StreamInterface;
20 class SocketAddress;
21 };
22 extern rtc::AsyncSocket* cricket_socket_;
23
24 namespace buzz {
25
26 class XmppSocket : public buzz::AsyncSocket, public sigslot::has_slots<> {
27 public:
28 XmppSocket(buzz::TlsOptions tls);
29 ~XmppSocket();
30
31 virtual buzz::AsyncSocket::State state();
32 virtual buzz::AsyncSocket::Error error();
33 virtual int GetError();
34
35 virtual bool Connect(const rtc::SocketAddress& addr);
36 virtual bool Read(char * data, size_t len, size_t* len_read);
37 virtual bool Write(const char * data, size_t len);
38 virtual bool Close();
39 virtual bool StartTls(const std::string & domainname);
40
41 sigslot::signal1<int> SignalCloseEvent;
42
43 private:
44 void CreateCricketSocket(int family);
45 #ifndef USE_SSLSTREAM
46 void OnReadEvent(rtc::AsyncSocket * socket);
47 void OnWriteEvent(rtc::AsyncSocket * socket);
48 void OnConnectEvent(rtc::AsyncSocket * socket);
49 void OnCloseEvent(rtc::AsyncSocket * socket, int error);
50 #else // USE_SSLSTREAM
51 void OnEvent(rtc::StreamInterface* stream, int events, int err);
52 #endif // USE_SSLSTREAM
53
54 rtc::AsyncSocket * cricket_socket_;
55 #ifdef USE_SSLSTREAM
56 rtc::StreamInterface *stream_;
57 #endif // USE_SSLSTREAM
58 buzz::AsyncSocket::State state_;
59 rtc::Buffer buffer_;
60 buzz::TlsOptions tls_;
61 };
62
63 } // namespace buzz
64
65 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPSOCKET_H_
66
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698