OLD | NEW |
(Empty) | |
| 1 /* |
| 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
| 3 * |
| 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 |
| 6 * tree. An additional intellectual property rights grant can be found |
| 7 * in the file PATENTS. All contributing project authors may |
| 8 * be found in the AUTHORS file in the root of the source tree. |
| 9 */ |
| 10 |
| 11 #ifndef WEBRTC_LIBJINGLE_XMPP_XMPPPUMP_H_ |
| 12 #define WEBRTC_LIBJINGLE_XMPP_XMPPPUMP_H_ |
| 13 |
| 14 #include "webrtc/libjingle/xmpp/xmppclient.h" |
| 15 #include "webrtc/libjingle/xmpp/xmppengine.h" |
| 16 #include "webrtc/libjingle/xmpp/xmpptask.h" |
| 17 #include "webrtc/base/messagequeue.h" |
| 18 #include "webrtc/base/taskrunner.h" |
| 19 #include "webrtc/base/thread.h" |
| 20 #include "webrtc/base/timeutils.h" |
| 21 |
| 22 namespace buzz { |
| 23 |
| 24 // Simple xmpp pump |
| 25 |
| 26 class XmppPumpNotify { |
| 27 public: |
| 28 virtual ~XmppPumpNotify() {} |
| 29 virtual void OnStateChange(buzz::XmppEngine::State state) = 0; |
| 30 }; |
| 31 |
| 32 class XmppPump : public rtc::MessageHandler, public rtc::TaskRunner { |
| 33 public: |
| 34 XmppPump(buzz::XmppPumpNotify * notify = NULL); |
| 35 |
| 36 buzz::XmppClient *client() { return client_; } |
| 37 |
| 38 void DoLogin(const buzz::XmppClientSettings & xcs, |
| 39 buzz::AsyncSocket* socket, |
| 40 buzz::PreXmppAuth* auth); |
| 41 void DoDisconnect(); |
| 42 |
| 43 void OnStateChange(buzz::XmppEngine::State state); |
| 44 |
| 45 void WakeTasks(); |
| 46 |
| 47 int64_t CurrentTime(); |
| 48 |
| 49 void OnMessage(rtc::Message *pmsg); |
| 50 |
| 51 buzz::XmppReturnStatus SendStanza(const buzz::XmlElement *stanza); |
| 52 |
| 53 private: |
| 54 buzz::XmppClient *client_; |
| 55 buzz::XmppEngine::State state_; |
| 56 buzz::XmppPumpNotify *notify_; |
| 57 }; |
| 58 |
| 59 } // namespace buzz |
| 60 |
| 61 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPPUMP_H_ |
| 62 |
OLD | NEW |