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 _XMPPCLIENTSETTINGS_H_
29
#define _XMPPCLIENTSETTINGS_H_
31
#include "talk/p2p/base/port.h"
32
#include "talk/base/cryptstring.h"
33
#include "talk/xmpp/xmppengine.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 talk_base::CryptString & pass) { pass_ = pass; }
47
void set_auth_cookie(const std::string & cookie) { auth_cookie_ = cookie; }
48
void set_resource(const std::string & resource) { resource_ = resource; }
49
void set_use_tls(const TlsOptions use_tls) { use_tls_ = use_tls; }
50
void set_allow_plain(bool f) { allow_plain_ = f; }
51
void set_test_server_domain(const std::string & test_server_domain) {
52
test_server_domain_ = test_server_domain;
54
void set_token_service(const std::string & token_service) {
55
token_service_ = token_service;
58
const std::string & user() const { return user_; }
59
const std::string & host() const { return host_; }
60
const talk_base::CryptString & pass() const { return pass_; }
61
const std::string & auth_cookie() const { return auth_cookie_; }
62
const std::string & resource() const { return resource_; }
63
TlsOptions use_tls() const { return use_tls_; }
64
bool allow_plain() const { return allow_plain_; }
65
const std::string & test_server_domain() const { return test_server_domain_; }
66
const std::string & token_service() const { return token_service_; }
71
talk_base::CryptString pass_;
72
std::string auth_cookie_;
73
std::string resource_;
76
std::string test_server_domain_;
77
std::string token_service_;
80
class XmppClientSettings : public XmppUserSettings {
83
: protocol_(cricket::PROTO_TCP),
84
proxy_(talk_base::PROXY_NONE),
86
use_proxy_auth_(false) {
89
void set_server(const talk_base::SocketAddress & server) {
92
void set_protocol(cricket::ProtocolType protocol) { protocol_ = protocol; }
93
void set_proxy(talk_base::ProxyType f) { proxy_ = f; }
94
void set_proxy_host(const std::string & host) { proxy_host_ = host; }
95
void set_proxy_port(int port) { proxy_port_ = port; };
96
void set_use_proxy_auth(bool f) { use_proxy_auth_ = f; }
97
void set_proxy_user(const std::string & user) { proxy_user_ = user; }
98
void set_proxy_pass(const talk_base::CryptString & pass) { proxy_pass_ = pass; }
100
const talk_base::SocketAddress & server() const { return server_; }
101
cricket::ProtocolType protocol() const { return protocol_; }
102
talk_base::ProxyType proxy() const { return proxy_; }
103
const std::string & proxy_host() const { return proxy_host_; }
104
int proxy_port() const { return proxy_port_; }
105
bool use_proxy_auth() const { return use_proxy_auth_; }
106
const std::string & proxy_user() const { return proxy_user_; }
107
const talk_base::CryptString & proxy_pass() const { return proxy_pass_; }
110
talk_base::SocketAddress server_;
111
cricket::ProtocolType protocol_;
112
talk_base::ProxyType proxy_;
113
std::string proxy_host_;
115
bool use_proxy_auth_;
116
std::string proxy_user_;
117
talk_base::CryptString proxy_pass_;