1 // Copyright (c) 2012 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 #ifndef REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
6 #define REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
12 #include "base/basictypes.h"
13 #include "base/callback.h"
14 #include "base/memory/scoped_ptr.h"
15 #include "remoting/jingle_glue/iq_sender.h"
16 #include "third_party/libjingle/source/talk/base/sigslot.h"
24 } // namespace talk_base
30 // JingleInfoRequest handles requesting STUN/Relay information from
31 // the Google Talk network. The query is made when Send() is
32 // called. The callback given to Send() is called when response to the
33 // request is received.
35 // This class is not threadsafe and should be used on the same thread it is
38 // TODO(ajwong): Add support for a timeout.
39 class JingleInfoRequest
: public sigslot::has_slots
<> {
41 // Callback to receive the Jingle configuration settings. The arguments are
42 // passed by pointer so the receive may call swap on them. The receiver does
43 // NOT own the arguments, which are guaranteed only to be alive for the
44 // duration of the callback.
45 typedef base::Callback
<void (
46 const std::string
&, const std::vector
<std::string
>&,
47 const std::vector
<talk_base::SocketAddress
>&)> OnJingleInfoCallback
;
49 explicit JingleInfoRequest(SignalStrategy
* signal_strategy
);
50 virtual ~JingleInfoRequest();
52 void Send(const OnJingleInfoCallback
& callback
);
55 struct PendingDnsRequest
;
57 void OnResponse(IqRequest
* request
, const buzz::XmlElement
* stanza
);
60 scoped_ptr
<IqRequest
> request_
;
61 OnJingleInfoCallback on_jingle_info_cb_
;
63 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest
);
66 } // namespace remoting
68 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_