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>
21 #include <tbb/mutex.h>
22 #include <tbb/atomic.h>
29 #include <sandesh/stats_client.h>
30 #include <sandesh/sandesh_session.h>
40 uint64_t last_close_interval_usec,
int *close_interval_msec);
49 bool periodicuve =
false);
67 const SandeshHeader &header,
const std::string &sandesh_name,
68 const uint32_t header_offset);
70 const std::string & stateName,
const std::string & server,
71 const Endpoint & server_ip,
const std::vector<Endpoint> & collector_eps);
82 if (
sm_->session())
return true;
87 return sm_->session();
104 std::vector<Sandesh::QueueWaterMarkInfo> &scwm_info)
const;
135 boost::scoped_ptr<SandeshClientSM>
sm_;
143 const SandeshHeader &header,
const std::string &sandesh_name,
144 const uint32_t header_offset);
149 #endif // __SANDESH_CLIENT_H__
void DeleteSMSession(SandeshSession *session)
int session_writer_task_id_
virtual SandeshSession * CreateSMSession(SslSession::EventObserver eocb, SandeshReceiveMsgCb rmcb, TcpServer::Endpoint ep)
uint8_t dscp_value() const
static const std::string kSMTask
StatsClient * stats_client() const
virtual void DeleteSession(TcpSession *session)
static const int kMaxSMSessionCloseIntervalMSec
int session_close_interval_msec() const
static const int kTaskInstanceAny
friend class CollectorInfoRequest
SandeshSession * session() const
virtual SslSession * AllocSession(SslSocket *socket)
static const int kSMTaskInstance
boost::scoped_ptr< SandeshClientSM > sm_
bool CloseSMSessionInternal()
uint64_t session_close_time_usec() const
SandeshClient(EventManager *evm, const std::vector< Endpoint > &collectors, const SandeshConfig &config, bool periodicuve=false)
static const int kInitialSMSessionCloseIntervalMSec
void GetSessionWaterMarkInfo(std::vector< Sandesh::QueueWaterMarkInfo > &scwm_info) const
void SetDscpValue(uint8_t value)
int session_close_interval_msec_
DISALLOW_COPY_AND_ASSIGN(SandeshClient)
bool ReceiveCtrlMsg(const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t header_offset)
void SetSessionWaterMarkInfo(Sandesh::QueueWaterMarkInfo &scwm)
bool SendSandeshUVE(Sandesh *snh_uve)
uint64_t session_close_time_usec_
static const std::vector< Sandesh::QueueWaterMarkInfo > kSessionWaterMarkInfo
boost::asio::ssl::stream< boost::asio::ip::tcp::socket > SslSocket
SandeshClientSM::State state()
std::vector< Sandesh::QueueWaterMarkInfo > session_wm_info_
int session_task_instance_
int session_reader_task_id_
boost::scoped_ptr< StatsClient > stats_client_
void InitializeSMSession(int connects)
SandeshClientSM * state_machine() const
void ResetSessionWaterMarkInfo()
bool SendSandesh(Sandesh *snh)
void ReConfigCollectors(const std::vector< std::string > &)
static bool task_policy_set_
boost::tuple< size_t, SandeshLevel::type, bool, bool > QueueWaterMarkInfo
boost::function< bool(const std::string &, SandeshSession *)> SandeshReceiveMsgCb
boost::function< void(TcpSession *, Event)> EventObserver
static const int kSessionTaskInstance
boost::asio::ip::tcp::endpoint Endpoint
void SendUVE(int count, const std::string &stateName, const std::string &server, const Endpoint &server_ip, const std::vector< Endpoint > &collector_eps)
bool ReceiveMsg(const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t header_offset)
std::vector< Endpoint > collectors_
std::string stats_collector_
static const std::string kSessionReaderTask
bool DoCloseSMSession(uint64_t now_usec, uint64_t last_close_usec, uint64_t last_close_interval_usec, int *close_interval_msec)
static const std::string kSessionWriterTask