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"
23 } // namespace talk_base
29 // JingleInfoRequest handles requesting STUN/Relay information from
30 // the Google Talk network. The query is made when Send() is
31 // called. The callback given to Send() is called when response to the
32 // request is received.
34 // This class is not threadsafe and should be used on the same thread it is
36 class JingleInfoRequest
{
38 // Callback to receive the Jingle configuration settings. All fields are empty
39 // if the request has timed out.
40 typedef base::Callback
<void(const std::string
& relay_token
,
41 const std::vector
<std::string
>& relay_servers
,
42 const std::vector
<talk_base::SocketAddress
>&
43 stun_servers
)> OnJingleInfoCallback
;
45 explicit JingleInfoRequest(SignalStrategy
* signal_strategy
);
46 virtual ~JingleInfoRequest();
48 void Send(const OnJingleInfoCallback
& callback
);
51 struct PendingDnsRequest
;
53 void OnResponse(IqRequest
* request
, const buzz::XmlElement
* stanza
);
56 scoped_ptr
<IqRequest
> request_
;
57 OnJingleInfoCallback on_jingle_info_cb_
;
59 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest
);
62 } // namespace remoting
64 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_