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