18 using boost::asio::mutable_buffer;
24 int remain = size - offset;
32 assert(length <= 4096);
46 session_mgr_(session_mgr),
98 const string &peer_key,
104 peer_key, direction, code, subcode, msg.
ToString());
106 BGP_LOG(BgpPeerNotificationNotice, SandeshLevel::SYS_NOTICE,
113 const string &data) {
124 Send(buf, msglen, NULL);
#define BGP_LOG(obj, level, flags,...)
virtual ~BgpMessageReader()
BgpMessageReader(TcpSession *session, ReceiveCallback callback)
virtual int MsgLength(Buffer buffer, int offset)
static const int kHeaderLenSize
virtual const std::string & ToUVEKey() const
virtual BgpServer * server()
virtual bool ReceiveMsg(BgpSession *session, const u_int8_t *msg, size_t size)
int GetTaskInstance() const
static const int kMinMessageSize
static const int kMaxMessageSize
static int Encode(const BgpMessage *msg, uint8_t *data, size_t size, EncodeOffsets *offsets=NULL, bool as4=false)
void EnqueueWriteReady(BgpSession *session)
virtual void WriteReady(const boost::system::error_code &error)
void SendNotification(int code, int subcode, const std::string &data=std::string())
bool ReceiveMsg(const u_int8_t *msg, size_t size)
BgpSession(BgpSessionManager *session_mgr, Socket *socket)
void LogNotification(int code, int subcode, const std::string &direction, const std::string &peer_key, const BgpProto::Notification &msg) const
BgpSessionManager * session_mgr_
void set_peer(BgpPeer *peer)
void PeerSendReady(IPeerUpdate *peer)
boost::function< bool(const uint8_t *, size_t)> ReceiveCallback
boost::asio::const_buffer Buffer
static const uint8_t * BufferData(const Buffer &buffer)
virtual std::string ToString() const
static size_t BufferSize(const Buffer &buffer)
boost::asio::ip::tcp::socket Socket
virtual bool Send(const uint8_t *data, size_t size, size_t *sent)
static uint64_t get_value(const uint8_t *data, int size)
virtual const std::string ToString() const