OpenSDN source code
|
#include <tcp_server.h>
Classes | |
struct | TcpSessionPtrCmp |
Public Types | |
typedef boost::asio::ip::tcp::endpoint | Endpoint |
typedef boost::asio::ip::tcp::socket | Socket |
typedef boost::asio::ip::tcp::socket::native_handle_type | NativeSocketType |
Public Member Functions | |
TcpServer (EventManager *evm) | |
virtual | ~TcpServer () |
virtual bool | Initialize (unsigned short port) |
virtual bool | Initialize (unsigned short port, const IpAddress &host_ip, int intf_id=-1) |
bool | InitializeInternal (boost::asio::ip::tcp::endpoint localaddr) |
const std::string | ToString () const |
void | SetAcceptor () |
void | ResetAcceptor () |
void | Shutdown () |
void | ClearSessions () |
void | UpdateSessionsDscp (uint8_t dscp) |
virtual TcpSession * | CreateSession () |
virtual void | DeleteSession (TcpSession *session) |
virtual void | Connect (TcpSession *session, Endpoint remote) |
virtual bool | DisableSandeshLogMessages () const |
int | GetPort () const |
const io::SocketStats & | GetSocketStats () const |
size_t | GetSessionCount () const |
EventManager * | event_manager () |
bool | HasSessionReadAvailable () const |
bool | HasSessions () const |
TcpSession * | GetSession (Endpoint remote) |
void | WaitForEmpty () |
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 (NativeSocketType fd, uint32_t peer_ip, const std::string &md5_password) |
int | SetListenSocketMd5Option (uint32_t peer_ip, const std::string &md5_password) |
int | SetDscpSocketOption (NativeSocketType fd, uint8_t value) |
uint8_t | GetDscpValue (NativeSocketType fd) const |
int | SetListenSocketDscp (uint8_t value) |
int | SetSocketOptions (const SandeshConfig &sandesh_config) |
int | SetKeepAliveSocketOption (int fd, const SandeshConfig &sandesh_config) |
Protected Types | |
typedef boost::intrusive_ptr < TcpServer > | TcpServerPtr |
typedef boost::intrusive_ptr < TcpSession > | TcpSessionPtr |
Protected Member Functions | |
virtual TcpSession * | AllocSession (Socket *socket)=0 |
virtual TcpSession * | AllocSession (bool server_session) |
virtual Socket * | accept_socket () const |
virtual void | set_accept_socket () |
virtual bool | AcceptSession (TcpSession *session) |
void | set_socket_open_failure (bool flag) |
bool | socket_open_failure () const |
Endpoint | LocalEndpoint () const |
virtual void | AcceptHandlerComplete (TcpSessionPtr session) |
virtual void | ConnectHandlerComplete (TcpSessionPtr session) |
Private Types | |
typedef std::set < TcpSessionPtr, TcpSessionPtrCmp > | SessionSet |
typedef std::multimap < Endpoint, TcpSession * > | SessionMap |
Private Member Functions | |
void | InsertSessionToMap (Endpoint remote, TcpSession *session) |
bool | RemoveSessionFromMap (Endpoint remote, TcpSession *session) |
void | AcceptHandlerInternal (TcpServerPtr server, const boost::system::error_code &error) |
void | ConnectHandler (TcpServerPtr server, TcpSessionPtr session, const boost::system::error_code &error) |
void | AsyncAccept () |
void | OnSessionClose (TcpSession *session) |
void | SetName (Endpoint local_endpoint) |
DISALLOW_COPY_AND_ASSIGN (TcpServer) | |
Private Attributes | |
io::SocketStats | stats_ |
EventManager * | evm_ |
tbb::mutex | mutex_ |
tbb::interface5::condition_variable | cond_var_ |
SessionSet | session_ref_ |
SessionMap | session_map_ |
std::unique_ptr< Socket > | so_accept_ |
boost::scoped_ptr < boost::asio::ip::tcp::acceptor > | acceptor_ |
tbb::atomic< int > | refcount_ |
std::string | name_ |
bool | socket_open_failure_ |
int | intf_id_ |
Friends | |
class | TcpSession |
class | SslSession |
class | TcpMessageWriter |
class | BgpServerUnitTest |
void | intrusive_ptr_add_ref (TcpServer *server) |
void | intrusive_ptr_release (TcpServer *server) |
Definition at line 28 of file tcp_server.h.
typedef boost::asio::ip::tcp::endpoint TcpServer::Endpoint |
Definition at line 30 of file tcp_server.h.
typedef boost::asio::ip::tcp::socket::native_handle_type TcpServer::NativeSocketType |
Definition at line 32 of file tcp_server.h.
|
private |
Definition at line 156 of file tcp_server.h.
|
private |
Definition at line 155 of file tcp_server.h.
typedef boost::asio::ip::tcp::socket TcpServer::Socket |
Definition at line 31 of file tcp_server.h.
|
protected |
Definition at line 110 of file tcp_server.h.
|
protected |
Definition at line 111 of file tcp_server.h.
|
explicit |
|
virtual |
Definition at line 42 of file tcp_server.cc.
|
protectedvirtual |
Reimplemented in SslServer.
Definition at line 336 of file tcp_server.cc.
|
protectedvirtual |
Reimplemented in SslServer.
Definition at line 405 of file tcp_server.cc.
|
private |
|
protectedvirtual |
Reimplemented in OVSDB::OvsdbClientSsl, XmppServer, SandeshServer, HttpServer, and BgpSessionManager.
Definition at line 344 of file tcp_server.cc.
|
protectedpure virtual |
Implemented in KSyncSockTcp, HttpClient, OVSDB::OvsdbClientTcp, SslServer, BgpSessionManager, and MetadataClient.
|
protectedvirtual |
Reimplemented in SslServer.
Definition at line 319 of file tcp_server.cc.
|
private |
void TcpServer::ClearSessions | ( | ) |
|
virtual |
|
private |
|
protectedvirtual |
Reimplemented in SslServer.
Definition at line 451 of file tcp_server.cc.
|
virtual |
Reimplemented in HttpClient, XmppServer, XmppClient, SandeshServer, and BgpSessionManager.
Definition at line 188 of file tcp_server.cc.
|
virtual |
|
inlinevirtual |
Reimplemented in SandeshServer.
Definition at line 64 of file tcp_server.h.
|
private |
|
inline |
Definition at line 76 of file tcp_server.h.
uint8_t TcpServer::GetDscpValue | ( | NativeSocketType | fd | ) | const |
int TcpServer::GetPort | ( | ) | const |
Definition at line 272 of file tcp_server.cc.
void TcpServer::GetRxSocketStats | ( | SocketIOStats * | socket_stats | ) | const |
|
inline |
TcpSession * TcpServer::GetSession | ( | Endpoint | remote | ) |
Definition at line 430 of file tcp_server.cc.
|
inline |
Definition at line 72 of file tcp_server.h.
|
inline |
Definition at line 67 of file tcp_server.h.
void TcpServer::GetTxSocketStats | ( | SocketIOStats * | socket_stats | ) | const |
|
inline |
bool TcpServer::HasSessionReadAvailable | ( | ) | const |
bool TcpServer::HasSessions | ( | ) | const |
Definition at line 285 of file tcp_server.cc.
|
virtual |
Reimplemented in BgpSessionManager.
Definition at line 59 of file tcp_server.cc.
|
virtual |
bool TcpServer::InitializeInternal | ( | boost::asio::ip::tcp::endpoint | localaddr | ) |
|
private |
Definition at line 215 of file tcp_server.cc.
|
protected |
Definition at line 306 of file tcp_server.cc.
|
private |
|
private |
Definition at line 224 of file tcp_server.cc.
void TcpServer::ResetAcceptor | ( | ) |
Definition at line 54 of file tcp_server.cc.
|
protectedvirtual |
Reimplemented in SslServer.
Definition at line 340 of file tcp_server.cc.
|
inlineprotected |
Definition at line 133 of file tcp_server.h.
void TcpServer::SetAcceptor | ( | ) |
int TcpServer::SetDscpSocketOption | ( | NativeSocketType | fd, |
uint8_t | value | ||
) |
int TcpServer::SetKeepAliveSocketOption | ( | int | fd, |
const SandeshConfig & | sandesh_config | ||
) |
int TcpServer::SetListenSocketDscp | ( | uint8_t | value | ) |
int TcpServer::SetListenSocketMd5Option | ( | uint32_t | peer_ip, |
const std::string & | md5_password | ||
) |
int TcpServer::SetMd5SocketOption | ( | NativeSocketType | fd, |
uint32_t | peer_ip, | ||
const std::string & | md5_password | ||
) |
|
private |
int TcpServer::SetSocketOptions | ( | const SandeshConfig & | sandesh_config | ) |
void TcpServer::Shutdown | ( | void | ) |
|
inlineprotected |
Definition at line 134 of file tcp_server.h.
|
inline |
Definition at line 43 of file tcp_server.h.
void TcpServer::UpdateSessionsDscp | ( | uint8_t | dscp | ) |
void TcpServer::WaitForEmpty | ( | ) |
Definition at line 254 of file tcp_server.cc.
|
friend |
Definition at line 145 of file tcp_server.h.
|
friend |
Definition at line 193 of file tcp_server.h.
|
friend |
Definition at line 197 of file tcp_server.h.
|
friend |
Definition at line 143 of file tcp_server.h.
|
friend |
Definition at line 144 of file tcp_server.h.
|
friend |
Definition at line 142 of file tcp_server.h.
|
private |
Definition at line 182 of file tcp_server.h.
|
private |
Definition at line 178 of file tcp_server.h.
|
private |
Definition at line 175 of file tcp_server.h.
|
private |
Definition at line 186 of file tcp_server.h.
|
mutableprivate |
Definition at line 177 of file tcp_server.h.
|
private |
Definition at line 184 of file tcp_server.h.
|
private |
Definition at line 183 of file tcp_server.h.
|
private |
Definition at line 180 of file tcp_server.h.
|
private |
Definition at line 179 of file tcp_server.h.
|
private |
Definition at line 181 of file tcp_server.h.
|
private |
Definition at line 185 of file tcp_server.h.
|
private |
Definition at line 174 of file tcp_server.h.