3 * Copyright 2004--2005, Google Inc.
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that the following conditions are met:
8 * 1. Redistributions of source code must retain the above copyright notice,
9 * this list of conditions and the following disclaimer.
10 * 2. Redistributions in binary form must reproduce the above copyright notice,
11 * this list of conditions and the following disclaimer in the documentation
12 * and/or other materials provided with the distribution.
13 * 3. The name of the author may not be used to endorse or promote products
14 * derived from this software without specific prior written permission.
16 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR IMPLIED
17 * WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
18 * MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
19 * EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
20 * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
21 * PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
22 * OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
23 * WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
24 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
25 * ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
28 #ifndef TALK_XMPP_XMPPCLIENTSETTINGS_H_
29 #define TALK_XMPP_XMPPCLIENTSETTINGS_H_
31 #include "webrtc/p2p/base/port.h"
32 #include "webrtc/libjingle/xmpp/xmppengine.h"
33 #include "webrtc/base/cryptstring.h"
37 class XmppUserSettings {
40 : use_tls_(buzz::TLS_DISABLED),
44 void set_user(const std::string& user) { user_ = user; }
45 void set_host(const std::string& host) { host_ = host; }
46 void set_pass(const rtc::CryptString& pass) { pass_ = pass; }
47 void set_auth_token(const std::string& mechanism,
48 const std::string& token) {
49 auth_mechanism_ = mechanism;
52 void set_resource(const std::string& resource) { resource_ = resource; }
53 void set_use_tls(const TlsOptions use_tls) { use_tls_ = use_tls; }
54 void set_allow_plain(bool f) { allow_plain_ = f; }
55 void set_test_server_domain(const std::string& test_server_domain) {
56 test_server_domain_ = test_server_domain;
58 void set_token_service(const std::string& token_service) {
59 token_service_ = token_service;
62 const std::string& user() const { return user_; }
63 const std::string& host() const { return host_; }
64 const rtc::CryptString& pass() const { return pass_; }
65 const std::string& auth_mechanism() const { return auth_mechanism_; }
66 const std::string& auth_token() const { return auth_token_; }
67 const std::string& resource() const { return resource_; }
68 TlsOptions use_tls() const { return use_tls_; }
69 bool allow_plain() const { return allow_plain_; }
70 const std::string& test_server_domain() const { return test_server_domain_; }
71 const std::string& token_service() const { return token_service_; }
76 rtc::CryptString pass_;
77 std::string auth_mechanism_;
78 std::string auth_token_;
79 std::string resource_;
82 std::string test_server_domain_;
83 std::string token_service_;
86 class XmppClientSettings : public XmppUserSettings {
89 : protocol_(cricket::PROTO_TCP),
90 proxy_(rtc::PROXY_NONE),
92 use_proxy_auth_(false) {
95 void set_server(const rtc::SocketAddress& server) {
98 void set_protocol(cricket::ProtocolType protocol) { protocol_ = protocol; }
99 void set_proxy(rtc::ProxyType f) { proxy_ = f; }
100 void set_proxy_host(const std::string& host) { proxy_host_ = host; }
101 void set_proxy_port(int port) { proxy_port_ = port; };
102 void set_use_proxy_auth(bool f) { use_proxy_auth_ = f; }
103 void set_proxy_user(const std::string& user) { proxy_user_ = user; }
104 void set_proxy_pass(const rtc::CryptString& pass) { proxy_pass_ = pass; }
106 const rtc::SocketAddress& server() const { return server_; }
107 cricket::ProtocolType protocol() const { return protocol_; }
108 rtc::ProxyType proxy() const { return proxy_; }
109 const std::string& proxy_host() const { return proxy_host_; }
110 int proxy_port() const { return proxy_port_; }
111 bool use_proxy_auth() const { return use_proxy_auth_; }
112 const std::string& proxy_user() const { return proxy_user_; }
113 const rtc::CryptString& proxy_pass() const { return proxy_pass_; }
116 rtc::SocketAddress server_;
117 cricket::ProtocolType protocol_;
118 rtc::ProxyType proxy_;
119 std::string proxy_host_;
121 bool use_proxy_auth_;
122 std::string proxy_user_;
123 rtc::CryptString proxy_pass_;
128 #endif // TALK_XMPP_XMPPCLIENT_H_