14 #include <sandesh/protocol/TXMLProtocol.h>
16 #include <sandesh/sandesh_types.h>
17 #include <sandesh/sandesh.h>
18 #include <sandesh/sandesh_ctrl_types.h>
19 #include <sandesh/common/vns_types.h>
20 #include <sandesh/common/vns_constants.h>
28 using boost::system::error_code;
30 #define CONNECTION_LOG(_Level, _Msg) \
32 if (LoggingDisabled()) break; \
33 log4cplus::Logger _Xlogger = Sandesh::logger(); \
34 if (_Xlogger.isEnabledFor(log4cplus::_Level##_LOG_LEVEL)) { \
35 log4cplus::tostringstream _Xbuf; \
36 if (!state_machine()->generator_key().empty()) { \
37 _Xbuf << state_machine()->generator_key() << " (" << \
38 GetTaskInstance() << ") "; \
41 _Xbuf << session()->ToString() << " "; \
44 _Xlogger.forcedLog(log4cplus::_Level##_LOG_LEVEL, \
50 Endpoint endpoint,
int task_instance,
int task_id)
56 task_instance_(task_instance),
150 :
SandeshConnection(
"SandeshServer: ", server, endpoint, task_instance, task_id),
163 const SandeshHeader &header,
const std::string sandesh_name,
164 const uint32_t header_offset) {
boost::asio::ip::tcp::endpoint Endpoint
virtual ~SandeshConnection()
int GetTaskInstance() const
bool SendSandesh(Sandesh *snh)
void SetAdminState(bool down)
SandeshStateMachine * state_machine() const
virtual LifetimeActor * deleter()=0
virtual bool ReceiveMsg(const std::string &msg, SandeshSession *session)
void AcceptSession(SandeshSession *session)
SandeshSession * session_
SandeshConnection(const char *prefix, TcpServer *server, Endpoint endpoint, int task_instance, int task_id)
void set_session(SandeshSession *session)
boost::scoped_ptr< SandeshStateMachine > state_machine_
SandeshSession * session() const
virtual bool MayDelete() const
DeleteActor(SandeshServer *server, SandeshServerConnection *parent)
SandeshServerConnection * parent_
virtual void ManagedDelete()
virtual ~SandeshServerConnection()
virtual bool ProcessSandeshCtrlMessage(const std::string &msg, const SandeshHeader &header, const std::string sandesh_name, const uint32_t header_offset)
boost::scoped_ptr< DeleteActor > deleter_
virtual LifetimeActor * deleter()
virtual bool ProcessResourceUpdate(bool res)
virtual LifetimeManager * lifetime_manager()
virtual void ProcessDisconnect(SandeshSession *session)
virtual bool ProcessSandeshMessage(const SandeshMessage *msg, bool resource)
SandeshServerConnection(TcpServer *server, Endpoint endpoint, int task_instance, int task_id)
virtual bool ReceiveResourceUpdate(SandeshSession *session, bool rsc)
virtual void DisconnectSession(SandeshSession *session)
void FreeConnectionIndex(int)
virtual bool ReceiveSandeshCtrlMsg(SandeshStateMachine *state_machine, SandeshSession *session, const Sandesh *sandesh)
LifetimeManager * lifetime_manager()
void RemoveConnection(SandeshConnection *connection)
virtual bool ReceiveSandeshMsg(SandeshSession *session, const SandeshMessage *msg, bool resource)=0
static Sandesh * DecodeCtrlSandesh(const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t &header_offset)
void SetConnection(SandeshConnection *connection)
void SetReceiveMsgCb(SandeshReceiveMsgCb cb)
Sandesh::SandeshQueue * send_queue()
SandeshSession * session()
virtual void DeleteSession(TcpSession *session)
bool Enqueue(QueueEntryT entry)
#define CONNECTION_LOG(_Level, _Msg)