OpenSDN source code
BgpSession Class Reference

#include <bgp_session.h>

Inheritance diagram for BgpSession:
Collaboration diagram for BgpSession:

Public Member Functions

 BgpSession (BgpSessionManager *session_mgr, Socket *socket)
 
virtual ~BgpSession ()
 
void SendNotification (int code, int subcode, const std::string &data=std::string())
 
virtual int GetSessionInstance () const
 
void ProcessWriteReady ()
 
void set_peer (BgpPeer *peer)
 
void clear_peer ()
 
BgpPeerpeer ()
 
void LogNotification (int code, int subcode, const std::string &direction, const std::string &peer_key, const BgpProto::Notification &msg) const
 
- Public Member Functions inherited from TcpSession
 TcpSession (TcpServer *server, Socket *socket, bool async_read_ready=true, size_t buffer_send_size=TcpSession::kDefaultWriteBufferSize)
 
virtual bool Send (const uint8_t *data, size_t size, size_t *sent)
 
virtual bool Connected (Endpoint remote)
 
virtual void Accepted ()
 
void ConnectFailed ()
 
void Close ()
 
virtual std::string ToString () const
 
virtual Socketsocket () const
 
NativeSocketType sock_descriptor ()
 
TcpServerserver ()
 
int32_t local_port () const
 
int32_t remote_port () const
 
void set_observer (EventObserver observer)
 
virtual void ReleaseBuffer (Buffer buffer)
 
bool IsEstablished () const
 
bool IsClosed () const
 
bool IsServerSession ()
 
Endpoint remote_endpoint () const
 
const std::string & remote_addr_string () const
 
Endpoint local_endpoint () const
 
const boost::system::error_code & close_reason () const
 
virtual boost::system::error_code SetSocketOptions ()
 
void set_read_on_connect (bool read)
 
void SessionEstablished (Endpoint remote, Direction direction)
 
virtual void AsyncReadStart ()
 
virtual void SetDeferReader (bool defer_reader)
 
virtual bool IsReaderDeferred () const
 
const io::SocketStatsGetSocketStats () const
 
void GetRxSocketStats (SocketIOStats *socket_stats) const
 
void GetTxSocketStats (SocketIOStats *socket_stats) const
 
void GetRxSocketStats (SocketIOStats &socket_stats) const
 
void GetTxSocketStats (SocketIOStats &socket_stats) const
 
int SetMd5SocketOption (uint32_t peer_ip, const std::string &md5_password)
 
int ClearMd5SocketOption (uint32_t peer_ip)
 
int SetDscpSocketOption (uint8_t value)
 
uint8_t GetDscpValue () const
 
const std::string & ToUVEKey () const
 
boost::system::error_code SetTcpNoDelay ()
 
boost::system::error_code SetTcpSendBufSize (uint32_t size)
 
boost::system::error_code SetTcpRecvBufSize (uint32_t size)
 

Protected Member Functions

virtual void OnRead (Buffer buffer)
 
- Protected Member Functions inherited from TcpSession
void AsyncReadStartInternal (TcpSessionPtr session)
 
virtual TaskCreateReaderTask (boost::asio::mutable_buffer, size_t)
 
virtual ~TcpSession ()
 
void AsyncWriteInternal (TcpSessionPtr session)
 
virtual void AsyncReadSome ()
 
virtual size_t GetReadBufferSize () const
 
virtual size_t ReadSome (boost::asio::mutable_buffer buffer, boost::system::error_code *error)
 
virtual void AsyncWrite (const uint8_t *data, std::size_t size)
 
virtual int reader_task_id () const
 
bool established () const
 
EventObserver observer ()
 
boost::system::error_code SetSocketKeepaliveOptions (int keepalive_time, int keepalive_intvl, int keepalive_probes, int tcp_user_timeout_val=0)
 
void CloseInternal (const boost::system::error_code &ec, bool call_observer, bool notify_server=true)
 
void TriggerAsyncReadHandler ()
 

Private Member Functions

bool ReceiveMsg (const u_int8_t *msg, size_t size)
 
virtual void WriteReady (const boost::system::error_code &error)
 
 DISALLOW_COPY_AND_ASSIGN (BgpSession)
 

Private Attributes

BgpSessionManagersession_mgr_
 
BgpPeerpeer_
 
int task_instance_
 
boost::scoped_ptr< BgpMessageReaderreader_
 

Additional Inherited Members

- Public Types inherited from TcpSession
enum  Event {
  EVENT_NONE , ACCEPT , CONNECT_COMPLETE , CONNECT_FAILED ,
  CLOSE
}
 
enum  Direction { ACTIVE , PASSIVE }
 
typedef boost::asio::ip::tcp::socket Socket
 
typedef boost::asio::ip::tcp::socket::native_handle_type NativeSocketType
 
typedef boost::asio::ip::tcp::endpoint Endpoint
 
typedef boost::function< void(TcpSession *, Event)> EventObserver
 
typedef boost::asio::const_buffer Buffer
 
- Static Public Member Functions inherited from TcpSession
static const uint8_t * BufferData (const Buffer &buffer)
 
static size_t BufferSize (const Buffer &buffer)
 
static bool IsSocketErrorHard (const boost::system::error_code &ec)
 
- Static Public Attributes inherited from TcpSession
static const int kDefaultBufferSize = 16 * 1024
 
static const int kDefaultWriteBufferSize = 32 * 1024
 
- Protected Types inherited from TcpSession
typedef boost::intrusive_ptr< TcpSessionTcpSessionPtr
 
typedef boost::asio::strand< boost::asio::io_context::executor_type > Strand
 
- Static Protected Member Functions inherited from TcpSession
static void AsyncReadHandler (TcpSessionPtr session)
 
static void AsyncWriteHandler (TcpSessionPtr session, const boost::system::error_code &error, std::size_t bytes_transferred)
 
- Protected Attributes inherited from TcpSession
tbb::mutex mutex_
 
io::SocketStats stats_
 
boost::scoped_ptr< Strandio_strand_
 

Detailed Description

Definition at line 41 of file bgp_session.h.

Constructor & Destructor Documentation

◆ BgpSession()

BgpSession::BgpSession ( BgpSessionManager session_mgr,
Socket socket 
)

Definition at line 44 of file bgp_session.cc.

◆ ~BgpSession()

BgpSession::~BgpSession ( )
virtual

Definition at line 53 of file bgp_session.cc.

Member Function Documentation

◆ clear_peer()

void BgpSession::clear_peer ( )

Definition at line 138 of file bgp_session.cc.

◆ DISALLOW_COPY_AND_ASSIGN()

BgpSession::DISALLOW_COPY_AND_ASSIGN ( BgpSession  )
private

◆ GetSessionInstance()

virtual int BgpSession::GetSessionInstance ( ) const
inlinevirtual

Reimplemented from TcpSession.

Definition at line 48 of file bgp_session.h.

◆ LogNotification()

void BgpSession::LogNotification ( int  code,
int  subcode,
const std::string &  direction,
const std::string &  peer_key,
const BgpProto::Notification msg 
) const

Definition at line 97 of file bgp_session.cc.

Here is the call graph for this function:

◆ OnRead()

virtual void BgpSession::OnRead ( Buffer  buffer)
inlineprotectedvirtual

Implements TcpSession.

Definition at line 59 of file bgp_session.h.

◆ peer()

BgpPeer* BgpSession::peer ( )
inline

Definition at line 53 of file bgp_session.h.

◆ ProcessWriteReady()

void BgpSession::ProcessWriteReady ( )

Definition at line 71 of file bgp_session.cc.

Here is the call graph for this function:

◆ ReceiveMsg()

bool BgpSession::ReceiveMsg ( const u_int8_t *  msg,
size_t  size 
)
private

Definition at line 59 of file bgp_session.cc.

Here is the call graph for this function:

◆ SendNotification()

void BgpSession::SendNotification ( int  code,
int  subcode,
const std::string &  data = std::string() 
)

Definition at line 112 of file bgp_session.cc.

Here is the call graph for this function:

◆ set_peer()

void BgpSession::set_peer ( BgpPeer peer)

Definition at line 128 of file bgp_session.cc.

Here is the call graph for this function:

◆ WriteReady()

void BgpSession::WriteReady ( const boost::system::error_code &  error)
privatevirtual

Reimplemented from TcpSession.

Definition at line 91 of file bgp_session.cc.

Here is the call graph for this function:

Member Data Documentation

◆ peer_

BgpPeer* BgpSession::peer_
private

Definition at line 68 of file bgp_session.h.

◆ reader_

boost::scoped_ptr<BgpMessageReader> BgpSession::reader_
private

Definition at line 70 of file bgp_session.h.

◆ session_mgr_

BgpSessionManager* BgpSession::session_mgr_
private

Definition at line 67 of file bgp_session.h.

◆ task_instance_

int BgpSession::task_instance_
private

Definition at line 69 of file bgp_session.h.


The documentation for this class was generated from the following files: