OLD | NEW |
1 /* | 1 /* |
2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. | 2 * Copyright 2004 The WebRTC Project Authors. All rights reserved. |
3 * | 3 * |
4 * Use of this source code is governed by a BSD-style license | 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 | 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 | 6 * tree. An additional intellectual property rights grant can be found |
7 * in the file PATENTS. All contributing project authors may | 7 * in the file PATENTS. All contributing project authors may |
8 * be found in the AUTHORS file in the root of the source tree. | 8 * be found in the AUTHORS file in the root of the source tree. |
9 */ | 9 */ |
10 | 10 |
11 #ifndef WEBRTC_LIBJINGLE_XMPP_XMPPCLIENTSETTINGS_H_ | 11 #ifndef WEBRTC_LIBJINGLE_XMPP_XMPPCLIENTSETTINGS_H_ |
12 #define WEBRTC_LIBJINGLE_XMPP_XMPPCLIENTSETTINGS_H_ | 12 #define WEBRTC_LIBJINGLE_XMPP_XMPPCLIENTSETTINGS_H_ |
13 | 13 |
14 #include "third_party/webrtc/p2p/base/port.h" | 14 #include "third_party/webrtc/p2p/base/port.h" |
15 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" | 15 #include "third_party/libjingle_xmpp/xmpp/xmppengine.h" |
16 #include "third_party/webrtc/base/cryptstring.h" | |
17 | 16 |
18 namespace buzz { | 17 namespace buzz { |
19 | 18 |
20 class XmppUserSettings { | 19 class XmppUserSettings { |
21 public: | 20 public: |
22 XmppUserSettings() | 21 XmppUserSettings() |
23 : use_tls_(buzz::TLS_DISABLED), | 22 : use_tls_(buzz::TLS_DISABLED), |
24 allow_plain_(false) { | 23 allow_plain_(false) { |
25 } | 24 } |
26 | 25 |
27 void set_user(const std::string& user) { user_ = user; } | 26 void set_user(const std::string& user) { user_ = user; } |
28 void set_host(const std::string& host) { host_ = host; } | 27 void set_host(const std::string& host) { host_ = host; } |
29 void set_pass(const rtc::CryptString& pass) { pass_ = pass; } | 28 void set_pass(const std::string& pass) { pass_ = pass; } |
30 void set_auth_token(const std::string& mechanism, | 29 void set_auth_token(const std::string& mechanism, |
31 const std::string& token) { | 30 const std::string& token) { |
32 auth_mechanism_ = mechanism; | 31 auth_mechanism_ = mechanism; |
33 auth_token_ = token; | 32 auth_token_ = token; |
34 } | 33 } |
35 void set_resource(const std::string& resource) { resource_ = resource; } | 34 void set_resource(const std::string& resource) { resource_ = resource; } |
36 void set_use_tls(const TlsOptions use_tls) { use_tls_ = use_tls; } | 35 void set_use_tls(const TlsOptions use_tls) { use_tls_ = use_tls; } |
37 void set_allow_plain(bool f) { allow_plain_ = f; } | 36 void set_allow_plain(bool f) { allow_plain_ = f; } |
38 void set_test_server_domain(const std::string& test_server_domain) { | 37 void set_test_server_domain(const std::string& test_server_domain) { |
39 test_server_domain_ = test_server_domain; | 38 test_server_domain_ = test_server_domain; |
40 } | 39 } |
41 void set_token_service(const std::string& token_service) { | 40 void set_token_service(const std::string& token_service) { |
42 token_service_ = token_service; | 41 token_service_ = token_service; |
43 } | 42 } |
44 | 43 |
45 const std::string& user() const { return user_; } | 44 const std::string& user() const { return user_; } |
46 const std::string& host() const { return host_; } | 45 const std::string& host() const { return host_; } |
47 const rtc::CryptString& pass() const { return pass_; } | 46 const std::string& pass() const { return pass_; } |
48 const std::string& auth_mechanism() const { return auth_mechanism_; } | 47 const std::string& auth_mechanism() const { return auth_mechanism_; } |
49 const std::string& auth_token() const { return auth_token_; } | 48 const std::string& auth_token() const { return auth_token_; } |
50 const std::string& resource() const { return resource_; } | 49 const std::string& resource() const { return resource_; } |
51 TlsOptions use_tls() const { return use_tls_; } | 50 TlsOptions use_tls() const { return use_tls_; } |
52 bool allow_plain() const { return allow_plain_; } | 51 bool allow_plain() const { return allow_plain_; } |
53 const std::string& test_server_domain() const { return test_server_domain_; } | 52 const std::string& test_server_domain() const { return test_server_domain_; } |
54 const std::string& token_service() const { return token_service_; } | 53 const std::string& token_service() const { return token_service_; } |
55 | 54 |
56 private: | 55 private: |
57 std::string user_; | 56 std::string user_; |
58 std::string host_; | 57 std::string host_; |
59 rtc::CryptString pass_; | 58 std::string pass_; |
60 std::string auth_mechanism_; | 59 std::string auth_mechanism_; |
61 std::string auth_token_; | 60 std::string auth_token_; |
62 std::string resource_; | 61 std::string resource_; |
63 TlsOptions use_tls_; | 62 TlsOptions use_tls_; |
64 bool allow_plain_; | 63 bool allow_plain_; |
65 std::string test_server_domain_; | 64 std::string test_server_domain_; |
66 std::string token_service_; | 65 std::string token_service_; |
67 }; | 66 }; |
68 | 67 |
69 class XmppClientSettings : public XmppUserSettings { | 68 class XmppClientSettings : public XmppUserSettings { |
70 public: | 69 public: |
71 XmppClientSettings() | 70 XmppClientSettings() |
72 : protocol_(cricket::PROTO_TCP), | 71 : protocol_(cricket::PROTO_TCP), |
73 proxy_(rtc::PROXY_NONE), | 72 proxy_(rtc::PROXY_NONE), |
74 proxy_port_(80), | 73 proxy_port_(80), |
75 use_proxy_auth_(false) { | 74 use_proxy_auth_(false) { |
76 } | 75 } |
77 | 76 |
78 void set_server(const rtc::SocketAddress& server) { | 77 void set_server(const rtc::SocketAddress& server) { |
79 server_ = server; | 78 server_ = server; |
80 } | 79 } |
81 void set_protocol(cricket::ProtocolType protocol) { protocol_ = protocol; } | 80 void set_protocol(cricket::ProtocolType protocol) { protocol_ = protocol; } |
82 void set_proxy(rtc::ProxyType f) { proxy_ = f; } | 81 void set_proxy(rtc::ProxyType f) { proxy_ = f; } |
83 void set_proxy_host(const std::string& host) { proxy_host_ = host; } | 82 void set_proxy_host(const std::string& host) { proxy_host_ = host; } |
84 void set_proxy_port(int port) { proxy_port_ = port; }; | 83 void set_proxy_port(int port) { proxy_port_ = port; }; |
85 void set_use_proxy_auth(bool f) { use_proxy_auth_ = f; } | 84 void set_use_proxy_auth(bool f) { use_proxy_auth_ = f; } |
86 void set_proxy_user(const std::string& user) { proxy_user_ = user; } | 85 void set_proxy_user(const std::string& user) { proxy_user_ = user; } |
87 void set_proxy_pass(const rtc::CryptString& pass) { proxy_pass_ = pass; } | 86 void set_proxy_pass(const std::string& pass) { proxy_pass_ = pass; } |
88 | 87 |
89 const rtc::SocketAddress& server() const { return server_; } | 88 const rtc::SocketAddress& server() const { return server_; } |
90 cricket::ProtocolType protocol() const { return protocol_; } | 89 cricket::ProtocolType protocol() const { return protocol_; } |
91 rtc::ProxyType proxy() const { return proxy_; } | 90 rtc::ProxyType proxy() const { return proxy_; } |
92 const std::string& proxy_host() const { return proxy_host_; } | 91 const std::string& proxy_host() const { return proxy_host_; } |
93 int proxy_port() const { return proxy_port_; } | 92 int proxy_port() const { return proxy_port_; } |
94 bool use_proxy_auth() const { return use_proxy_auth_; } | 93 bool use_proxy_auth() const { return use_proxy_auth_; } |
95 const std::string& proxy_user() const { return proxy_user_; } | 94 const std::string& proxy_user() const { return proxy_user_; } |
96 const rtc::CryptString& proxy_pass() const { return proxy_pass_; } | 95 const std::string& proxy_pass() const { return proxy_pass_; } |
97 | 96 |
98 private: | 97 private: |
99 rtc::SocketAddress server_; | 98 rtc::SocketAddress server_; |
100 cricket::ProtocolType protocol_; | 99 cricket::ProtocolType protocol_; |
101 rtc::ProxyType proxy_; | 100 rtc::ProxyType proxy_; |
102 std::string proxy_host_; | 101 std::string proxy_host_; |
103 int proxy_port_; | 102 int proxy_port_; |
104 bool use_proxy_auth_; | 103 bool use_proxy_auth_; |
105 std::string proxy_user_; | 104 std::string proxy_user_; |
106 rtc::CryptString proxy_pass_; | 105 std::string proxy_pass_; |
107 }; | 106 }; |
108 | 107 |
109 } | 108 } |
110 | 109 |
111 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPCLIENT_H_ | 110 #endif // WEBRTC_LIBJINGLE_XMPP_XMPPCLIENT_H_ |
OLD | NEW |