7 #include <boost/foreach.hpp>
8 #include <boost/tuple/tuple.hpp>
15 #include "sandesh/common/vns_types.h"
16 #include "sandesh/common/vns_constants.h"
17 #include "sandesh/xmpp_client_server_sandesh_types.h"
20 using namespace boost::asio;
26 :
LifetimeActor(client->lifetime_manager()), client_(client) { }
29 return (client_->GetSessionQueueSize() == 0);
54 evm, ssl::context::sslv23_client, config->auth_enabled, true),
59 auth_enabled_(config->auth_enabled),
60 tcp_hold_time_(config->tcp_hold_time) {
65 boost::asio::ssl::context *ctx =
context();
66 boost::system::error_code ec;
69 ctx->set_options(ssl::context::default_workarounds |
70 ssl::context::no_sslv3 | ssl::context::no_sslv2 | ssl::context::no_tlsv1, ec);
71 if (ec.value() != 0) {
72 LOG(ERROR,
"Error : " << ec.message() <<
", setting ssl options");
79 if (!ca_cert_filename.empty()) {
82 ctx->set_verify_mode(boost::asio::ssl::verify_peer, ec);
83 if (ec.value() != 0) {
84 LOG(ERROR,
"Error : " << ec.message()
85 <<
", while setting ssl verification mode");
90 if (ec.value() != 0) {
91 LOG(ERROR,
"Error : " << ec.message()
92 <<
", while using cacert file : "
100 if (ec.value() != 0) {
101 LOG(ERROR,
"Error : " << ec.message() <<
102 ", while using server cert file : "
109 boost::asio::ssl::context::pem, ec);
110 if (ec.value() != 0) {
111 LOG(ERROR,
"Error : " << ec.message()
112 <<
", while using privkey file : "
137 SOL_SOCKET, SO_REUSEADDR> reuse_addr_t;
142 boost::system::error_code err;
143 socket->open(ip::tcp::v4(), err);
151 socket->set_option(reuse_addr_t(
true), err);
182 loc->second->ManagedDelete();
233 if (value.second->ToString() == address)
242 XmppStaticObjectFactory::Create<XmppClientConnection>(
this, config);
244 ConnectionMap::iterator loc;
246 tie(loc, result) =
connection_map_.insert(make_pair(endpoint, connection));
255 ConnectionMap::iterator loc;
257 tie(loc, result) =
connection_map_.insert(make_pair(endpoint, connection));
271 return (connection ? connection->
ChannelMux() : NULL);
boost::asio::ip::tcp::endpoint endpoint
virtual SslSession * AllocSession(SslSocket *socket)
int SetDscpValue(uint8_t value, const char *conn_id)
LifetimeManager * lifetime_manager()
void InsertConnection(XmppClientConnection *connection)
boost::function< void(XmppChannelMux *, xmps::PeerState)> ConnectionEventCb
XmppClientConnection * FindConnection(const std::string &address)
virtual void DeleteSession(TcpSession *session)
virtual TcpSession * CreateSession()
The TaskScheduler keeps track of what tasks are currently schedulable. When a task is enqueued it is ...
boost::asio::ip::tcp::socket Socket
virtual boost::asio::ip::tcp::endpoint endpoint() const
void UpdateKeepAliveTimer(uint8_t time_out)
XmppClient(EventManager *evm)
boost::scoped_ptr< XmppConfigManager > config_mgr_
virtual TcpSession * CreateSession()
uint32_t XmppTimeOut(const char *conn_id)
boost::asio::ssl::context * context()
#define XMPP_PEER_DIR_OUT
XmppClientConnection * CreateConnection(const XmppChannelConfig *config)
std::string path_to_ca_cert
size_t ConnectionCount() const
void ConfigUpdate(const XmppConfigData *cfg)
tbb::mutex connection_event_map_mutex_
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > SslSocket
void RemoveConnection(XmppClientConnection *connection)
void ProcessConfigUpdate(XmppConfigManager::DiffType delta, const XmppChannelConfig *current, const XmppChannelConfig *future)
#define CHECK_CONCURRENCY(...)
int SetDscpValue(uint8_t value)
void UnRegisterConnectionEvent(xmps::PeerId)
std::string path_to_server_cert
ConnectionEventCbMap connection_event_map_
ConnectionMap connection_map_
XmppChannelMux * ChannelMux()
XmppChannel * FindChannel(const std::string &address)
boost::scoped_ptr< LifetimeManager > lifetime_manager_
boost::asio::ip::tcp::endpoint Endpoint
virtual bool MayDelete() const
const std::string & ToUVEKey() const
size_t ConnectionEventCount() const
boost::scoped_ptr< DeleteActor > deleter_
void RegisterConnectionEvent(xmps::PeerId, ConnectionEventCb)
#define LOG(_Level, _Msg)
virtual bool Initialize(unsigned short port)
void NotifyConnectionEvent(XmppChannelMux *, xmps::PeerState)
XmppStateMachine * state_machine()
virtual Socket * socket() const
void UpdateTimeOut(uint8_t time_out, const char *conn_id)
DeleteActor(XmppClient *client)
std::string path_to_server_priv_key
virtual bool Initialize(short port)
virtual boost::system::error_code SetSocketOptions()
virtual LifetimeActor * deleter()
#define XMPP_WARNING(obj,...)