NVIDIA DeepStream SDK API Reference

9.2 Release
HTTP_SERVER_NS::HttpServer Class Reference

Detailed Description

Inheritance diagram for HTTP_SERVER_NS::HttpServer:
Collaboration diagram for HTTP_SERVER_NS::HttpServer:

Data Structures

struct  Connection
 
class  HttpRequestHandler
 

Public Member Functions

void setKeepalive (bool keepAlive)
 
 HttpServer ()
 
 HttpServer (const std::string &serverHost, int port=30000)
 
 ~HttpServer () override
 
void setRequestLimits (size_t maxRequestHeadersSize, size_t maxRequestContentSize)
 
void setServerName (std::string const &name)
 
int addListeningPort (int port)
 
HttpRequestHandler & addHandler (const std::string &root, HttpRequestCallback &handler)
 
HttpRequestHandler & operator[] (const std::string &root)
 
HttpServer & operator+= (std::pair< const std::string &, HttpRequestCallback & > other)
 
void start ()
 
void stop ()
 
void setKeepalive (bool keepAlive)
 
 HttpServer ()
 
 HttpServer (const std::string &serverHost, int port=30000)
 
 ~HttpServer () override
 
void setRequestLimits (size_t maxRequestHeadersSize, size_t maxRequestContentSize)
 
void setServerName (std::string const &name)
 
int addListeningPort (int port)
 
HttpRequestHandler & addHandler (const std::string &root, HttpRequestCallback &handler)
 
HttpRequestHandler & operator[] (const std::string &root)
 
HttpServer & operator+= (std::pair< const std::string &, HttpRequestCallback & > other)
 
void start ()
 
void stop ()
 

Static Public Member Functions

static const char * getDefaultResponseMessage (int code)
 
static const char * getDefaultResponseMessage (int code)
 

Protected Member Functions

virtual void onSocketAcceptable (SocketTools::Socket socket) override
 
virtual void onSocketReadable (SocketTools::Socket socket) override
 
virtual void onSocketWritable (SocketTools::Socket socket) override
 
virtual void onSocketClosed (SocketTools::Socket socket) override
 
bool sendMore (Connection &conn)
 
void handleConnectionClosed (Connection &conn)
 
void handleConnection (Connection &conn)
 
bool parseHeaders (Connection &conn)
 
void processRequest (Connection &conn)
 
virtual void onSocketAcceptable (SocketTools::Socket socket) override
 
virtual void onSocketReadable (SocketTools::Socket socket) override
 
virtual void onSocketWritable (SocketTools::Socket socket) override
 
virtual void onSocketClosed (SocketTools::Socket socket) override
 
bool sendMore (Connection &conn)
 
void handleConnectionClosed (Connection &conn)
 
void handleConnection (Connection &conn)
 
bool parseHeaders (Connection &conn)
 
void processRequest (Connection &conn)
 

Static Protected Member Functions

static bool equalsLowercased (std::string const &str, char const *mask)
 
static std::string normalizeHeaderName (char const *begin, char const *end)
 
static std::string formatTimestamp (time_t time)
 
static bool equalsLowercased (std::string const &str, char const *mask)
 
static std::string normalizeHeaderName (char const *begin, char const *end)
 
static std::string formatTimestamp (time_t time)
 

Protected Attributes

std::string m_serverHost
 
bool allowKeepalive {true}
 
SocketTools::Reactor m_reactor
 
std::list< SocketTools::Socket > m_listeningSockets
 
std::list< HttpRequestHandler > m_handlers
 
std::map< SocketTools::Socket, Connection > m_connections
 
size_t m_maxRequestHeadersSize
 
size_t m_maxRequestContentSize
 

Constructor & Destructor Documentation

◆ HttpServer() [1/4]

HTTP_SERVER_NS::HttpServer::HttpServer ( )
inline

◆ HttpServer() [2/4]

HTTP_SERVER_NS::HttpServer::HttpServer ( const std::string &  serverHost,
int  port = 30000 
)
inline

◆ ~HttpServer() [1/2]

HTTP_SERVER_NS::HttpServer::~HttpServer ( )
inlineoverride

◆ HttpServer() [3/4]

HTTP_SERVER_NS::HttpServer::HttpServer ( )
inline

◆ HttpServer() [4/4]

HTTP_SERVER_NS::HttpServer::HttpServer ( const std::string &  serverHost,
int  port = 30000 
)
inline

◆ ~HttpServer() [2/2]

HTTP_SERVER_NS::HttpServer::~HttpServer ( )
inlineoverride

Member Function Documentation

◆ addHandler() [1/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::addHandler ( const std::string &  root,
HttpRequestCallback &  handler 
)
inline

Definition at line 213 of file includes/opentelemetry/ext/http/server/http_server.h.

References LOG_INFO, and m_handlers.

◆ addHandler() [2/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::addHandler ( const std::string &  root,
HttpRequestCallback &  handler 
)
inline

◆ addListeningPort() [1/2]

◆ addListeningPort() [2/2]

◆ equalsLowercased() [1/2]

static bool HTTP_SERVER_NS::HttpServer::equalsLowercased ( std::string const &  str,
char const *  mask 
)
inlinestaticprotected

◆ equalsLowercased() [2/2]

static bool HTTP_SERVER_NS::HttpServer::equalsLowercased ( std::string const &  str,
char const *  mask 
)
inlinestaticprotected

◆ formatTimestamp() [1/2]

static std::string HTTP_SERVER_NS::HttpServer::formatTimestamp ( time_t  time)
inlinestaticprotected

◆ formatTimestamp() [2/2]

static std::string HTTP_SERVER_NS::HttpServer::formatTimestamp ( time_t  time)
inlinestaticprotected

◆ getDefaultResponseMessage() [1/2]

static const char* HTTP_SERVER_NS::HttpServer::getDefaultResponseMessage ( int  code)
inlinestatic

◆ getDefaultResponseMessage() [2/2]

static const char* HTTP_SERVER_NS::HttpServer::getDefaultResponseMessage ( int  code)
inlinestatic

◆ handleConnection() [1/2]

void HTTP_SERVER_NS::HttpServer::handleConnection ( Connection &  conn)
inlineprotected

Definition at line 366 of file includes/opentelemetry/ext/http/server/http_server.h.

References SocketTools::Reactor::addSocket(), allowKeepalive, HTTP_SERVER_NS::HttpResponse::body, HTTP_SERVER_NS::HttpRequest::client, SocketTools::Reactor::Closed, HTTP_SERVER_NS::HttpServer::Connection::Closing, HTTP_SERVER_NS::HttpResponse::code, HTTP_SERVER_NS::HttpRequest::content, HTTP_SERVER_NS::HttpServer::Connection::contentLength, equalsLowercased(), HTTP_SERVER_NS::HttpRequest::headers, HTTP_SERVER_NS::HttpResponse::headers, HTTP_SERVER_NS::HttpServer::Connection::Idle, HTTP_SERVER_NS::HttpServer::Connection::keepalive, LOG_INFO, LOG_TRACE, LOG_WARN, m_maxRequestContentSize, m_maxRequestHeadersSize, m_reactor, HTTP_SERVER_NS::HttpResponse::message, HTTP_SERVER_NS::HttpRequest::method, absl::move(), parseHeaders(), HTTP_SERVER_NS::HttpServer::Connection::Processing, processRequest(), HTTP_SERVER_NS::HttpRequest::protocol, SocketTools::Reactor::Readable, HTTP_SERVER_NS::HttpServer::Connection::receiveBuffer, HTTP_SERVER_NS::HttpServer::Connection::ReceivingBody, HTTP_SERVER_NS::HttpServer::Connection::ReceivingHeaders, HTTP_SERVER_NS::HttpServer::Connection::request, HTTP_SERVER_NS::HttpServer::Connection::response, HTTP_SERVER_NS::HttpServer::Connection::sendBuffer, HTTP_SERVER_NS::HttpServer::Connection::Sending100Continue, HTTP_SERVER_NS::HttpServer::Connection::SendingBody, HTTP_SERVER_NS::HttpServer::Connection::SendingHeaders, sendMore(), SocketTools::Socket::shutdown(), SocketTools::Socket::ShutdownSend, HTTP_SERVER_NS::HttpServer::Connection::socket, HTTP_SERVER_NS::HttpServer::Connection::state, and HTTP_SERVER_NS::HttpRequest::uri.

Referenced by onSocketReadable(), and onSocketWritable().

◆ handleConnection() [2/2]

◆ handleConnectionClosed() [1/2]

◆ handleConnectionClosed() [2/2]

◆ normalizeHeaderName() [1/2]

static std::string HTTP_SERVER_NS::HttpServer::normalizeHeaderName ( char const *  begin,
char const *  end 
)
inlinestaticprotected

◆ normalizeHeaderName() [2/2]

static std::string HTTP_SERVER_NS::HttpServer::normalizeHeaderName ( char const *  begin,
char const *  end 
)
inlinestaticprotected

◆ onSocketAcceptable() [1/2]

◆ onSocketAcceptable() [2/2]

◆ onSocketClosed() [1/2]

virtual void HTTP_SERVER_NS::HttpServer::onSocketClosed ( SocketTools::Socket  socket)
inlineoverrideprotectedvirtual

◆ onSocketClosed() [2/2]

virtual void HTTP_SERVER_NS::HttpServer::onSocketClosed ( SocketTools::Socket  socket)
inlineoverrideprotectedvirtual

◆ onSocketReadable() [1/2]

◆ onSocketReadable() [2/2]

◆ onSocketWritable() [1/2]

virtual void HTTP_SERVER_NS::HttpServer::onSocketWritable ( SocketTools::Socket  socket)
inlineoverrideprotectedvirtual

◆ onSocketWritable() [2/2]

virtual void HTTP_SERVER_NS::HttpServer::onSocketWritable ( SocketTools::Socket  socket)
inlineoverrideprotectedvirtual

◆ operator+=() [1/2]

HttpServer& HTTP_SERVER_NS::HttpServer::operator+= ( std::pair< const std::string &, HttpRequestCallback & >  other)
inline

Definition at line 229 of file includes/opentelemetry/ext/http/server/http_server.h.

References LOG_INFO, and m_handlers.

◆ operator+=() [2/2]

HttpServer& HTTP_SERVER_NS::HttpServer::operator+= ( std::pair< const std::string &, HttpRequestCallback & >  other)
inline

◆ operator[]() [1/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::operator[] ( const std::string &  root)
inline

◆ operator[]() [2/2]

HttpRequestHandler& HTTP_SERVER_NS::HttpServer::operator[] ( const std::string &  root)
inline

Definition at line 221 of file includes/opentelemetry/ext/http/server/http_server.h.

References LOG_INFO, and m_handlers.

◆ parseHeaders() [1/2]

◆ parseHeaders() [2/2]

bool HTTP_SERVER_NS::HttpServer::parseHeaders ( Connection &  conn)
inlineprotected

◆ processRequest() [1/2]

void HTTP_SERVER_NS::HttpServer::processRequest ( Connection &  conn)
inlineprotected

◆ processRequest() [2/2]

◆ sendMore() [1/2]

◆ sendMore() [2/2]

◆ setKeepalive() [1/2]

void HTTP_SERVER_NS::HttpServer::setKeepalive ( bool  keepAlive)
inline

◆ setKeepalive() [2/2]

void HTTP_SERVER_NS::HttpServer::setKeepalive ( bool  keepAlive)
inline

◆ setRequestLimits() [1/2]

void HTTP_SERVER_NS::HttpServer::setRequestLimits ( size_t  maxRequestHeadersSize,
size_t  maxRequestContentSize 
)
inline

◆ setRequestLimits() [2/2]

void HTTP_SERVER_NS::HttpServer::setRequestLimits ( size_t  maxRequestHeadersSize,
size_t  maxRequestContentSize 
)
inline

◆ setServerName() [1/2]

void HTTP_SERVER_NS::HttpServer::setServerName ( std::string const &  name)
inline

◆ setServerName() [2/2]

void HTTP_SERVER_NS::HttpServer::setServerName ( std::string const &  name)
inline

◆ start() [1/2]

void HTTP_SERVER_NS::HttpServer::start ( )
inline

◆ start() [2/2]

void HTTP_SERVER_NS::HttpServer::start ( )
inline

◆ stop() [1/2]

void HTTP_SERVER_NS::HttpServer::stop ( )
inline

◆ stop() [2/2]

void HTTP_SERVER_NS::HttpServer::stop ( )
inline

Field Documentation

◆ allowKeepalive

bool HTTP_SERVER_NS::HttpServer::allowKeepalive {true}
protected

◆ m_connections

std::map< SocketTools::Socket, Connection > HTTP_SERVER_NS::HttpServer::m_connections
protected

◆ m_handlers

std::list< HttpRequestHandler > HTTP_SERVER_NS::HttpServer::m_handlers
protected

◆ m_listeningSockets

std::list< SocketTools::Socket > HTTP_SERVER_NS::HttpServer::m_listeningSockets
protected

◆ m_maxRequestContentSize

size_t HTTP_SERVER_NS::HttpServer::m_maxRequestContentSize
protected

◆ m_maxRequestHeadersSize

size_t HTTP_SERVER_NS::HttpServer::m_maxRequestHeadersSize
protected

◆ m_reactor

◆ m_serverHost

std::string HTTP_SERVER_NS::HttpServer::m_serverHost
protected

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