1 // Copyright (c) 2011 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.
5 // The XmppSignalStrategy encapsulates all the logic to perform the signaling
6 // STUN/ICE for jingle via a direct XMPP connection.
8 // This class is not threadsafe.
10 #ifndef REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_
11 #define REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_
13 #include "remoting/jingle_glue/signal_strategy.h"
15 #include "base/compiler_specific.h"
16 #include "third_party/libjingle/source/talk/base/sigslot.h"
17 #include "third_party/libjingle/source/talk/xmpp/xmppclient.h"
23 class XmppSignalStrategy
: public SignalStrategy
,
24 public buzz::XmppStanzaHandler
,
25 public sigslot::has_slots
<> {
27 XmppSignalStrategy(JingleThread
* thread
,
28 const std::string
& username
,
29 const std::string
& auth_token
,
30 const std::string
& auth_token_service
);
31 virtual ~XmppSignalStrategy();
33 // SignalStrategy interface.
34 virtual void Init(StatusObserver
* observer
) OVERRIDE
;
35 virtual void Close() OVERRIDE
;
36 virtual void SetListener(Listener
* listener
) OVERRIDE
;
37 virtual void SendStanza(buzz::XmlElement
* stanza
) OVERRIDE
;
38 virtual std::string
GetNextId() OVERRIDE
;
39 virtual IqRequest
* CreateIqRequest() OVERRIDE
;
41 // buzz::XmppStanzaHandler interface.
42 virtual bool HandleStanza(const buzz::XmlElement
* stanza
) OVERRIDE
;
45 void OnConnectionStateChanged(buzz::XmppEngine::State state
);
46 static buzz::PreXmppAuth
* CreatePreXmppAuth(
47 const buzz::XmppClientSettings
& settings
);
49 JingleThread
* thread_
;
53 std::string username_
;
54 std::string auth_token_
;
55 std::string auth_token_service_
;
56 buzz::XmppClient
* xmpp_client_
;
57 StatusObserver
* observer_
;
59 DISALLOW_COPY_AND_ASSIGN(XmppSignalStrategy
);
62 } // namespace remoting
64 #endif // REMOTING_JINGLE_GLUE_XMPP_SIGNAL_STRATEGY_H_