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

Side by Side Diff: remoting/jingle_glue/jingle_info_request.h

Issue 7598004: Resolve addresses of STUN/Relay servers in JingleInfoRequest. (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: - Created 9 years, 4 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 | Annotate | Revision Log
« no previous file with comments | « remoting/jingle_glue/host_resolver.cc ('k') | remoting/jingle_glue/jingle_info_request.cc » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 // Copyright (c) 2011 The Chromium Authors. All rights reserved. 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 2 // Use of this source code is governed by a BSD-style license that can be
3 // found in the LICENSE file. 3 // found in the LICENSE file.
4 4
5 #ifndef REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_ 5 #ifndef REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
6 #define REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_ 6 #define REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
7 7
8 #include <set>
8 #include <string> 9 #include <string>
9 #include <vector> 10 #include <vector>
10 11
11 #include "base/basictypes.h" 12 #include "base/basictypes.h"
12 #include "base/callback.h" 13 #include "base/callback.h"
13 #include "base/memory/scoped_ptr.h" 14 #include "base/memory/scoped_ptr.h"
15 #include "third_party/libjingle/source/talk/base/sigslot.h"
14 16
15 class Task; 17 class Task;
16 18
17 namespace buzz { 19 namespace buzz {
18 class XmlElement; 20 class XmlElement;
19 } // namespace buzz 21 } // namespace buzz
20 22
21 namespace talk_base { 23 namespace talk_base {
22 class SocketAddress; 24 class SocketAddress;
23 } // namespace talk_base 25 } // namespace talk_base
24 26
25 namespace remoting { 27 namespace remoting {
26 28
27 class IqRequest; 29 class IqRequest;
30 class HostResolver;
31 class HostResolverFactory;
28 32
29 // JingleInfoRequest handles requesting STUN/Relay infromation from 33 // JingleInfoRequest handles requesting STUN/Relay infromation from
30 // the Google Talk network. The query is made when Send() is 34 // the Google Talk network. The query is made when Send() is
31 // called. The callback given to Send() is called when response to the 35 // called. The callback given to Send() is called when response to the
32 // request is received. 36 // request is received.
33 // 37 //
34 // This class is not threadsafe and should be used on the same thread it is 38 // This class is not threadsafe and should be used on the same thread it is
35 // created on. 39 // created on.
36 // 40 //
37 // TODO(ajwong): Add support for a timeout. 41 // TODO(ajwong): Add support for a timeout.
38 class JingleInfoRequest { 42 class JingleInfoRequest : public sigslot::has_slots<> {
39 public: 43 public:
40 // Callback to receive the Jingle configuration settings. The argumetns are 44 // Callback to receive the Jingle configuration settings. The argumetns are
41 // passed by pointer so the receive may call swap on them. The receiver does 45 // passed by pointer so the receive may call swap on them. The receiver does
42 // NOT own the arguments, which are guaranteed only to be alive for the 46 // NOT own the arguments, which are guaranteed only to be alive for the
43 // duration of the callback. 47 // duration of the callback.
44 typedef base::Callback<void ( 48 typedef base::Callback<void (
45 const std::string&, const std::vector<std::string>&, 49 const std::string&, const std::vector<std::string>&,
46 const std::vector<talk_base::SocketAddress>&)> OnJingleInfoCallback; 50 const std::vector<talk_base::SocketAddress>&)> OnJingleInfoCallback;
47 51
48 explicit JingleInfoRequest(IqRequest* request); 52 explicit JingleInfoRequest(IqRequest* request,
49 ~JingleInfoRequest(); 53 HostResolverFactory* host_resolver_factory);
54 virtual ~JingleInfoRequest();
50 55
51 void Send(const OnJingleInfoCallback& callback); 56 void Send(const OnJingleInfoCallback& callback);
52 57
53 private: 58 private:
59 struct PendingDnsRequest;
60
54 void OnResponse(const buzz::XmlElement* stanza); 61 void OnResponse(const buzz::XmlElement* stanza);
62 void OnStunAddressResponse(HostResolver* resolver,
63 const talk_base::SocketAddress& address);
55 64
65 HostResolverFactory* host_resolver_factory_;
56 scoped_ptr<IqRequest> request_; 66 scoped_ptr<IqRequest> request_;
57 OnJingleInfoCallback on_jingle_info_cb_; 67 OnJingleInfoCallback on_jingle_info_cb_;
58 68
69 std::vector<std::string> relay_hosts_;
70 std::vector<talk_base::SocketAddress> stun_hosts_;
71 std::string relay_token_;
72
73 std::set<HostResolver*> stun_dns_requests_;
74
59 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest); 75 DISALLOW_COPY_AND_ASSIGN(JingleInfoRequest);
60 }; 76 };
61 77
62 } // namespace remoting 78 } // namespace remoting
63 79
64 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_ 80 #endif // REMOTING_JINGLE_GLUE_JINGLE_INFO_REQUEST_H_
OLDNEW
« no previous file with comments | « remoting/jingle_glue/host_resolver.cc ('k') | remoting/jingle_glue/jingle_info_request.cc » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698