14 #include "sandesh/sandesh_trace.h"
15 #include "sandesh/xmpp_trace_sandesh_types.h"
22 using boost::asio::mutable_buffer;
41 keepalive_probes_(kSessionKeepaliveProbes) {
109 char *keepalive_time_str = getenv(
"TCP_KEEPALIVE_SECONDS");
110 if (keepalive_time_str) {
111 hold_time = strtoul(keepalive_time_str, NULL, 0) * 3;
113 return boost::system::error_code();
116 if (hold_time <= 9) {
119 hold_time = ((hold_time > 18)? hold_time/2 : hold_time);
132 std::string token(
"</");
134 token +=
"[\\s\\t\\r\\n]*>";
136 regex exp(token.c_str());
166 std::string::const_iterator end =
buf_.end();
169 boost::match_default | boost::match_partial) == 0) {
172 if(
res_[0].matched ==
false) {
186 if (connection == NULL) {
208 if (pos == string::npos) pos =
buf_.size();
263 }
else if (m == -1) {
293 bool more =
Match(buffer, &result,
true);
302 std::string::const_iterator st =
buf_.begin();
303 std::string xml = string(st,
offset_);
320 std::string::const_iterator st =
buf_.end();
322 more =
Match(buffer, &result,
false);
XmppConnectionManager * manager_
virtual void WriteReady()
static const contrail::regex starttls_patt_
virtual void WriteReady(const boost::system::error_code &error)
boost::asio::const_buffer Buffer
XmppSession(XmppConnectionManager *manager, SslSocket *sock, bool async_ready=true)
bool disable_read() const
virtual void StartHoldTimer()
static size_t BufferSize(const Buffer &buffer)
std::string::const_iterator offset_
boost::system::error_code SetSocketKeepaliveOptions(int keepalive_time, int keepalive_intvl, int keepalive_probes, int tcp_user_timeout_val=0)
boost::system::error_code EnableTcpKeepalive(int tcp_hold_time)
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > SslSocket
static const contrail::regex stream_features_patt_
#define rXMPP_STREAM_START
void EnqueueSession(XmppSession *session)
xmsm::XmOpenConfirmState GetStateMcOpenConfirmState() const
void set_observer(EventObserver observer)
static bool regex_match(const std::string &input, const regex ®ex)
static const contrail::regex proceed_patt_
static const contrail::regex end_patt_
StatsPair Stats(unsigned int message_type) const
XmppConnection * Connection()
void ReplaceBuf(const std::string &)
std::vector< StatsPair > stats_
static const contrail::regex whitespace_
static const contrail::regex stream_res_end_
void IncStats(unsigned int message_type, uint64_t bytes)
#define rXMPP_STREAM_STARTTLS
contrail::regex tag_to_pattern(const char *)
xmsm::XmState GetStateMcState() const
static bool regex_search(const std::string &input, const regex ®ex)
static const int kMaxMessageSize
std::pair< uint64_t, uint64_t > StatsPair
virtual void ReceiveMsg(XmppSession *session, const std::string &)
XmppConnection * connection_
int GetTaskInstance() const
static const contrail::regex stream_patt_
static const contrail::regex patt_
void SetConnection(XmppConnection *connection)
void SetBuf(const std::string &)
boost::match_results< std::string::const_iterator > res_
int MatchRegex(const contrail::regex &patt)
virtual void ReleaseBuffer(Buffer buffer)
virtual void OnRead(Buffer buffer)
#define rXMPP_STREAM_FEATURES
void SetSslHandShakeInProgress(bool state)
bool stream_open_matched_
XmppStateMachine * state_machine()
static const uint8_t * BufferData(const Buffer &buffer)
bool Match(Buffer buffer, int *result, bool NewBuf)
#define rXMPP_STREAM_STANZA_END
#define rXMPP_STREAM_PROCEED