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) {
virtual LifetimeManager * lifetime_manager()
virtual ~SandeshServerConnection()
boost::scoped_ptr< DeleteActor > deleter_
#define CONNECTION_LOG(_Level, _Msg)
void RemoveConnection(SandeshConnection *connection)
virtual void DeleteSession(TcpSession *session)
virtual bool MayDelete() const
SandeshConnection(const char *prefix, TcpServer *server, Endpoint endpoint, int task_instance, int task_id)
SandeshSession * session() const
void AcceptSession(SandeshSession *session)
virtual LifetimeActor * deleter()=0
SandeshServerConnection * parent_
virtual bool ReceiveSandeshCtrlMsg(SandeshStateMachine *state_machine, SandeshSession *session, const Sandesh *sandesh)
SandeshServerConnection(TcpServer *server, Endpoint endpoint, int task_instance, int task_id)
boost::asio::ip::tcp::endpoint Endpoint
virtual void DisconnectSession(SandeshSession *session)
SandeshSession * session()
void SetAdminState(bool down)
void set_session(SandeshSession *session)
static Sandesh * DecodeCtrlSandesh(const std::string &msg, const SandeshHeader &header, const std::string &sandesh_name, const uint32_t &header_offset)
SandeshSession * session_
virtual bool ReceiveSandeshMsg(SandeshSession *session, const SandeshMessage *msg, bool resource)=0
virtual bool ReceiveResourceUpdate(SandeshSession *session, bool rsc)
DeleteActor(SandeshServer *server, SandeshServerConnection *parent)
void SetConnection(SandeshConnection *connection)
virtual LifetimeActor * deleter()
Sandesh::SandeshQueue * send_queue()
virtual ~SandeshConnection()
virtual bool ProcessResourceUpdate(bool res)
int GetTaskInstance() const
virtual void ProcessDisconnect(SandeshSession *session)
virtual void ManagedDelete()
virtual bool ProcessSandeshMessage(const SandeshMessage *msg, bool resource)
SandeshStateMachine * state_machine() const
virtual bool ReceiveMsg(const std::string &msg, SandeshSession *session)
void SetReceiveMsgCb(SandeshReceiveMsgCb cb)
virtual bool ProcessSandeshCtrlMessage(const std::string &msg, const SandeshHeader &header, const std::string sandesh_name, const uint32_t header_offset)
LifetimeManager * lifetime_manager()
bool Enqueue(QueueEntryT entry)
bool SendSandesh(Sandesh *snh)
void FreeConnectionIndex(int)
boost::scoped_ptr< SandeshStateMachine > state_machine_