11 #ifndef __SANDESH_CLIENT_H__
12 #define __SANDESH_CLIENT_H__
14 #include <boost/asio.hpp>
15 #include <boost/statechart/state_machine.hpp>
16 #include <boost/asio/ip/tcp.hpp>
17 #include <boost/scoped_ptr.hpp>
18 #include <boost/ptr_container/ptr_map.hpp>
19 #include <boost/tuple/tuple.hpp>
26 #include <sandesh/stats_client.h>
27 #include <sandesh/sandesh_session.h>
37 uint64_t last_close_interval_usec,
int *close_interval_msec);
46 bool periodicuve =
false);
64 const SandeshHeader &header,
const std::string &sandesh_name,
65 const uint32_t header_offset);
67 const std::string & stateName,
const std::string & server,
68 const Endpoint & server_ip,
const std::vector<Endpoint> & collector_eps);
79 if (
sm_->session())
return true;
84 return sm_->session();
101 std::vector<Sandesh::QueueWaterMarkInfo> &scwm_info)
const;
132 boost::scoped_ptr<SandeshClientSM>
sm_;
140 const SandeshHeader &header,
const std::string &sandesh_name,
141 const uint32_t header_offset);
void InitializeSMSession(int connects)
int session_close_interval_msec() const
virtual SandeshSession * CreateSMSession(SslSession::EventObserver eocb, SandeshReceiveMsgCb rmcb, TcpServer::Endpoint ep)
SandeshSession * session() const
std::vector< Sandesh::QueueWaterMarkInfo > session_wm_info_
void ReConfigCollectors(const std::vector< std::string > &)
std::vector< Endpoint > collectors_
static const std::string kSessionReaderTask
uint64_t session_close_time_usec_
void DeleteSMSession(SandeshSession *session)
void GetSessionWaterMarkInfo(std::vector< Sandesh::QueueWaterMarkInfo > &scwm_info) const
bool ReceiveMsg(const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t header_offset)
friend class CollectorInfoRequest
boost::scoped_ptr< StatsClient > stats_client_
int session_task_instance_
static bool task_policy_set_
void ResetSessionWaterMarkInfo()
static const int kInitialSMSessionCloseIntervalMSec
void SetDscpValue(uint8_t value)
bool CloseSMSessionInternal()
bool SendSandeshUVE(Sandesh *snh_uve)
uint64_t session_close_time_usec() const
void SendUVE(int count, const std::string &stateName, const std::string &server, const Endpoint &server_ip, const std::vector< Endpoint > &collector_eps)
uint8_t dscp_value() const
SandeshClientSM::State state()
StatsClient * stats_client() const
std::string stats_collector_
static const int kMaxSMSessionCloseIntervalMSec
static const int kSMTaskInstance
int session_writer_task_id_
bool SendSandesh(Sandesh *snh)
int session_close_interval_msec_
static const int kSessionTaskInstance
bool ReceiveCtrlMsg(const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t header_offset)
static const std::vector< Sandesh::QueueWaterMarkInfo > kSessionWaterMarkInfo
static const std::string kSessionWriterTask
int session_reader_task_id_
static const std::string kSMTask
DISALLOW_COPY_AND_ASSIGN(SandeshClient)
boost::scoped_ptr< SandeshClientSM > sm_
SandeshClient(EventManager *evm, const std::vector< Endpoint > &collectors, const SandeshConfig &config, bool periodicuve=false)
void SetSessionWaterMarkInfo(Sandesh::QueueWaterMarkInfo &scwm)
SandeshClientSM * state_machine() const
virtual SslSession * AllocSession(SslSocket *socket)
boost::tuple< size_t, SandeshLevel::type, bool, bool > QueueWaterMarkInfo
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > SslSocket
static const int kTaskInstanceAny
Specifies value for wildcard (any or *) task data ID.
boost::asio::ip::tcp::endpoint Endpoint
virtual void DeleteSession(TcpSession *session)
boost::function< void(TcpSession *, Event)> EventObserver
bool DoCloseSMSession(uint64_t now_usec, uint64_t last_close_usec, uint64_t last_close_interval_usec, int *close_interval_msec)
boost::function< bool(const std::string &, SandeshSession *)> SandeshReceiveMsgCb