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