OpenSDN source code
 All Classes Namespaces Files Functions Variables Typedefs Enumerations Enumerator Friends Macros Pages
HttpServer Class Reference

#include <http_server.h>

Inheritance diagram for HttpServer:
Collaboration diagram for HttpServer:

Public Types

typedef boost::function< void(HttpSession
*session, const HttpRequest *)> 
HttpHandlerFn
 
- Public Types inherited from SslServer
typedef
boost::asio::ssl::stream
< boost::asio::ip::tcp::socket > 
SslSocket
 
- Public Types inherited from TcpServer
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

 HttpServer (EventManager *evm, const SslConfig &config=SslConfig(), uint8_t dscp=0)
 
virtual ~HttpServer ()
 
virtual SslSessionAllocSession (SslSocket *socket)
 
virtual bool AcceptSession (SslSession *session)
 
virtual bool AcceptSession (TcpSession *session)
 
void RegisterHandler (const std::string &path, HttpHandlerFn handler)
 
HttpHandlerFn GetHandler (const std::string &path)
 
void Shutdown ()
 
void UpdateDscp (uint8_t value)
 
- Public Member Functions inherited from SslServer
 SslServer (EventManager *evm, boost::asio::ssl::context::method m, bool ssl_enabled=true, bool ssl_handshake_delayed=false)
 
virtual ~SslServer ()
 
- Public Member Functions inherited from TcpServer
 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 TcpSessionCreateSession ()
 
virtual void DeleteSession (TcpSession *session)
 
virtual void Connect (TcpSession *session, Endpoint remote)
 
virtual bool DisableSandeshLogMessages () const
 
int GetPort () const
 
const io::SocketStatsGetSocketStats () const
 
size_t GetSessionCount () const
 
EventManagerevent_manager ()
 
bool HasSessionReadAvailable () const
 
bool HasSessions () const
 
TcpSessionGetSession (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)
 

Private Types

typedef std::map< std::string,
HttpHandlerFn
HandlerTrie
 

Private Member Functions

 DISALLOW_COPY_AND_ASSIGN (HttpServer)
 

Private Attributes

HandlerTrie http_handlers_
 
uint8_t dscp_value_
 

Additional Inherited Members

- Protected Types inherited from TcpServer
typedef boost::intrusive_ptr
< TcpServer
TcpServerPtr
 
typedef boost::intrusive_ptr
< TcpSession
TcpSessionPtr
 
- Protected Member Functions inherited from SslServer
boost::asio::ssl::context * context ()
 
- Protected Member Functions inherited from TcpServer
void set_socket_open_failure (bool flag)
 
bool socket_open_failure () const
 
Endpoint LocalEndpoint () const
 

Detailed Description

Definition at line 35 of file http_server.h.

Member Typedef Documentation

typedef std::map<std::string, HttpHandlerFn> HttpServer::HandlerTrie
private

Definition at line 53 of file http_server.h.

typedef boost::function<void(HttpSession *session, const HttpRequest *)> HttpServer::HttpHandlerFn

Definition at line 38 of file http_server.h.

Constructor & Destructor Documentation

HttpServer::HttpServer ( EventManager evm,
const SslConfig config = SslConfig(),
uint8_t  dscp = 0 
)
explicit

Definition at line 12 of file http_server.cc.

Here is the call graph for this function:

HttpServer::~HttpServer ( )
virtual

Definition at line 67 of file http_server.cc.

Member Function Documentation

bool HttpServer::AcceptSession ( SslSession session)
virtual

Definition at line 93 of file http_server.cc.

Here is the call graph for this function:

bool HttpServer::AcceptSession ( TcpSession session)
virtual

Reimplemented from TcpServer.

Definition at line 84 of file http_server.cc.

Here is the call graph for this function:

SslSession * HttpServer::AllocSession ( SslSocket socket)
virtual

Implements SslServer.

Reimplemented in MetadataServer.

Definition at line 76 of file http_server.cc.

Here is the call graph for this function:

HttpServer::DISALLOW_COPY_AND_ASSIGN ( HttpServer  )
private
HttpServer::HttpHandlerFn HttpServer::GetHandler ( const std::string &  path)

Definition at line 106 of file http_server.cc.

void HttpServer::RegisterHandler ( const std::string &  path,
HttpHandlerFn  handler 
)

Definition at line 102 of file http_server.cc.

void HttpServer::Shutdown ( void  )

Definition at line 71 of file http_server.cc.

Here is the call graph for this function:

void HttpServer::UpdateDscp ( uint8_t  value)

Definition at line 118 of file http_server.cc.

Here is the call graph for this function:

Member Data Documentation

uint8_t HttpServer::dscp_value_
private

Definition at line 55 of file http_server.h.

HandlerTrie HttpServer::http_handlers_
private

Definition at line 54 of file http_server.h.


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