|
PTLib
Version 2.18.8
|
Listener for incoming HTTP request with thread pool to handle those requests. More...
#include <http.h>


Classes | |
| struct | Worker |
Public Types | |
| typedef PQueuedThreadPool< Worker > | ThreadPool |
Public Member Functions | |
| PHTTPListener (unsigned maxWorkers=10) | |
| Construct new HTTP listsner with specified maximum number of threads in pool. More... | |
| ~PHTTPListener () | |
| Shut down all listeners on destruction. More... | |
| bool | ListenForHTTP (WORD port, PSocket::Reusability reuse=PSocket::CanReuseAddress, unsigned queueSize=10) |
| Start listening for HTTP connections. More... | |
| bool | ListenForHTTP (const PString &interfaces, WORD port, PSocket::Reusability reuse=PSocket::CanReuseAddress, unsigned queueSize=10) |
| void | ShutdownListeners () |
| Shut down the listener socket, it's thread, and all threads in the pool. More... | |
| bool | IsListening () const |
| Indicate is currently listening and processing requests. More... | |
| WORD | GetPort () const |
| Get the port we are lkstening on. More... | |
| virtual PChannel * | CreateChannelForHTTP (PChannel *channel) |
| Call back to create transport socket, or TLS, channel. More... | |
| virtual PHTTPServer * | CreateServerForHTTP () |
| virtual void | OnHTTPStarted (PHTTPServer &server) |
| Callback when a new HTTP connection has begun. More... | |
| virtual void | OnHTTPEnded (PHTTPServer &server) |
| Callback when an existing HTTP connection has ended. More... | |
| const ThreadPool & | GetThreadPool () const |
| Get the thread pool in use for this HTTP listener. More... | |
| ThreadPool & | GetThreadPool () |
| const PHTTPSpace & | GetSpace () const |
| Get the resource space for HTTP listener. More... | |
| PHTTPSpace & | GetSpace () |
Protected Member Functions | |
| void | ListenMain () |
| PDECLARE_MUTEX (m_httpServersMutex) | |
Protected Attributes | |
| PHTTPSpace | m_httpNameSpace |
| PString | m_listenerInterfaces |
| WORD | m_listenerPort |
| PThread * | m_listenerThread |
| PSocketList | m_httpListeningSockets |
| PList< PHTTPServer > | m_httpServers |
| ThreadPool | m_threadPool |
Listener for incoming HTTP request with thread pool to handle those requests.
| PHTTPListener::PHTTPListener | ( | unsigned | maxWorkers = 10 | ) |
Construct new HTTP listsner with specified maximum number of threads in pool.
| PHTTPListener::~PHTTPListener | ( | ) |
Shut down all listeners on destruction.
Call back to create transport socket, or TLS, channel.
Reimplemented in PSecureHTTPServiceProcess.
|
virtual |
|
inline |
Get the port we are lkstening on.
References m_httpListeningSockets.
|
inline |
Get the resource space for HTTP listener.
References m_httpNameSpace.
|
inline |
References m_httpNameSpace.
|
inline |
Get the thread pool in use for this HTTP listener.
References m_threadPool.
|
inline |
References m_threadPool.
|
inline |
Indicate is currently listening and processing requests.
References m_httpListeningSockets.
| bool PHTTPListener::ListenForHTTP | ( | WORD | port, |
| PSocket::Reusability | reuse = PSocket::CanReuseAddress, |
||
| unsigned | queueSize = 10 |
||
| ) |
Start listening for HTTP connections.
| port | Port to listen on, zero picks a random one |
| reuse | Can/Cant listen more than once. |
| queueSize | Number of pending accepts that may be queued. |
| bool PHTTPListener::ListenForHTTP | ( | const PString & | interfaces, |
| WORD | port, | ||
| PSocket::Reusability | reuse = PSocket::CanReuseAddress, |
||
| unsigned | queueSize = 10 |
||
| ) |
| interfaces | Comma separated list of interfaces to listen on. |
| port | Port to listen on, zero picks a random one |
| reuse | Can/Cant listen more than once. |
| queueSize | Number of pending accepts that may be queued. |
|
protected |
|
virtual |
Callback when an existing HTTP connection has ended.
Reimplemented in PHTTPServiceProcess.
|
virtual |
Callback when a new HTTP connection has begun.
Reimplemented in PSecureHTTPServiceProcess.
|
protected |
| void PHTTPListener::ShutdownListeners | ( | ) |
Shut down the listener socket, it's thread, and all threads in the pool.
|
protected |
Referenced by GetPort(), and IsListening().
|
protected |
Referenced by GetSpace().
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
Referenced by GetThreadPool().