SDRAngel
4.11.5
Developer docs for <a href="https://github.com/f4exb/sdrangel">SDRangel<\a>, an Open Source Qt5 / OpenGL 3.0+ SDR and signal analyzer frontend to various hardware.
|
#include <httplistener.h>
Inherits QTcpServer.
Signals | |
void | handleConnection (tSocketDescriptor socketDescriptor) |
Public Member Functions | |
HttpListener (QSettings *settings, HttpRequestHandler *requestHandler, QObject *parent=NULL) | |
HttpListener (const HttpListenerSettings &settings, HttpRequestHandler *requestHandler, QObject *parent=NULL) | |
virtual | ~HttpListener () |
void | listen () |
void | close () |
HttpListenerSettings | getListenerSettings () const |
void | setListenerSettings (const HttpListenerSettings &settings) |
Protected Member Functions | |
void | incomingConnection (tSocketDescriptor socketDescriptor) |
Private Attributes | |
QSettings * | settings |
HttpListenerSettings | listenerSettings |
HttpRequestHandler * | requestHandler |
HttpConnectionHandlerPool * | pool |
bool | useQtSettings |
Listens for incoming TCP connections and and passes all incoming HTTP requests to your implementation of HttpRequestHandler, which processes the request and generates the response (usually a HTML document).
Example for the required settings in the config file:
;host=192.168.0.100 port=8080 minThreads=1 maxThreads=10 cleanupInterval=1000 readTimeout=60000 ;sslKeyFile=ssl/my.key ;sslCertFile=ssl/my.cert maxRequestSize=16000 maxMultiPartSize=1000000
The optional host parameter binds the listener to one network interface. The listener handles all network interfaces if no host is configured. The port number specifies the incoming TCP port that this listener listens to.
Definition at line 47 of file httplistener.h.
HttpListener::HttpListener | ( | QSettings * | settings, |
HttpRequestHandler * | requestHandler, | ||
QObject * | parent = NULL |
||
) |
Constructor. Creates a connection pool and starts listening on the configured host and port.
settings | Configuration settings for the HTTP server. Must not be 0. |
requestHandler | Processes each received HTTP request, usually by dispatching to controller classes. |
parent | Parent object. |
Definition at line 14 of file httplistener.cpp.
References listen(), pool, requestHandler, and settings.
HttpListener::HttpListener | ( | const HttpListenerSettings & | settings, |
HttpRequestHandler * | requestHandler, | ||
QObject * | parent = NULL |
||
) |
Constructor. Creates a connection pool and starts listening on the configured host and port.
settings | Configuration settings for the HTTP server as a structure. |
requestHandler | Processes each received HTTP request, usually by dispatching to controller classes. |
parent | Parent object. |
Definition at line 28 of file httplistener.cpp.
References listen(), listenerSettings, pool, requestHandler, and settings.
|
virtual |
Destructor
Definition at line 43 of file httplistener.cpp.
References close().
void HttpListener::close | ( | ) |
Closes the listener, waits until all pending requests are processed, then closes the connection pool.
Definition at line 73 of file httplistener.cpp.
References pool.
Referenced by ~HttpListener().
|
inline |
Get a listener settings copy
Definition at line 90 of file httplistener.h.
|
signal |
Sent to the connection handler to process a new incoming connection.
socketDescriptor | references the accepted connection. |
|
protected |
Serves new incoming connection requests
Definition at line 82 of file httplistener.cpp.
References qtwebapp::HttpConnectionHandlerPool::getConnectionHandler(), and pool.
void HttpListener::listen | ( | ) |
Restart listeing after close().
Definition at line 50 of file httplistener.cpp.
References qtwebapp::HttpListenerSettings::host, listenerSettings, pool, qtwebapp::HttpListenerSettings::port, requestHandler, settings, and useQtSettings.
Referenced by HttpListener().
|
inline |
Set new listener settings data
Listener | settings to replace current data |
Definition at line 96 of file httplistener.h.
|
private |
Configuration settings for the HTTP server as a structure
Definition at line 109 of file httplistener.h.
Referenced by HttpListener(), and listen().
|
private |
Pool of connection handlers
Definition at line 115 of file httplistener.h.
Referenced by close(), HttpListener(), incomingConnection(), and listen().
|
private |
Point to the reuqest handler which processes all HTTP requests
Definition at line 112 of file httplistener.h.
Referenced by HttpListener(), and listen().
|
private |
Configuration settings for the HTTP server
Definition at line 106 of file httplistener.h.
Referenced by HttpListener(), and listen().
|
private |