|
Arduino DLNA Server
|
Header-only HTTP server wrapper that registers callback handlers. More...
#include <HttpServer.h>

Public Member Functions | |
| HttpServer (ServerType &server, int bufferSize=1024) | |
| ~HttpServer () override | |
| IPAddress & | localIP () override |
| Provides the local ip address. | |
| bool | begin () override |
| Starts the server. | |
| void | end () override |
| stops the server_ptr | |
| void | rewrite (const char *from, const char *to) override |
| adds a rewrite rule | |
| void | on (const char *url, TinyMethodID method, web_callback_fn fn, void *ctx[]=nullptr, int ctxCount=0) override |
| register a generic handler | |
| void | on (const char *url, TinyMethodID method, const char *mime, web_callback_fn fn) override |
| register a handler with mime | |
| void | on (const char *url, TinyMethodID method, const char *mime, const char *result) override |
| register a handler which provides the indicated string | |
| void | on (const char *url, TinyMethodID method, const char *mime, const uint8_t *data, int len) override |
| register a handler which provides the indicated string | |
| void | on (const char *url, TinyMethodID method, Url &redirect) override |
| register a redirection | |
| bool | onRequest (const char *path) override |
| void | replyChunked (const char *contentType, Stream &inputStream, int status=200, const char *msg=SUCCESS) override |
| chunked reply with data from an input stream | |
| void | replyChunked (const char *contentType, int status=200, const char *msg=SUCCESS) override |
| start of chunked reply: use HttpChunkWriter to provde the data | |
| void | reply (const char *contentType, Stream &inputStream, int size, int status=200, const char *msg=SUCCESS) override |
| write reply - copies data from input stream with header size | |
| void | reply (const char *contentType, size_t(*callback)(Print &out, void *ref), int status=200, const char *msg=SUCCESS, void *ref=nullptr) override |
| write reply - using callback that writes to stream | |
| void | reply (const char *contentType, const char *str, int status=200, const char *msg=SUCCESS) override |
| write reply - string with header size | |
| void | reply (const char *contentType, const uint8_t *str, int len, int status=200, const char *msg=SUCCESS) override |
| Send binary data response. | |
| void | replyOK () override |
| write OK reply with 200 SUCCESS | |
| void | replyNotFound () override |
| write 404 reply | |
| void | replyError (int err, const char *msg="Internal Server Error") override |
| Send error response with status code. | |
| HttpRequestHeader & | requestHeader () override |
| provides the request header | |
| HttpReplyHeader & | replyHeader () override |
| provides the reply header | |
| void | endClient () override |
| closes the connection to the current client_ptr | |
| void | crlf () override |
| print a CR LF | |
| void | addHandler (HttpRequestHandlerLine *handlerLinePtr) override |
| adds a new handler | |
| bool | doLoop () override |
| Legacy method: same as copy();. | |
| bool | copy () override |
| Call this method from your loop! | |
| ClientType & | client () override |
| Provides the current client. | |
| operator bool () override | |
| Provides true if the server has been started. | |
| bool | isActive () override |
| Check if server is active. | |
| const char * | localHost () override |
| Determines the local ip address. | |
| void | setNoConnectDelay (int delay) override |
| Set no-connect delay. | |
| Str | contentStr () override |
| converts the client content to a string | |
| void | setReference (void *reference) override |
| Definesa reference/context object. | |
| void * | getReference () override |
| Provides access to a reference/context object. | |
Protected Member Functions | |
| void | removeClosedClients () |
| void | reply (int status, const char *msg) |
| Writes the status and message to the reply. | |
| const char * | nullstr (const char *in) |
| Converts null to an empty string. | |
| void | processRequest () |
| const char * | resolveRewrite (const char *from) |
| bool | matchesMime (const char *handler_mime, const char *request_mime) |
Protected Attributes | |
| HttpRequestHeader | request_header |
| HttpReplyHeader | reply_header |
| List< HttpRequestHandlerLine * > | handler_collection |
| List< HttpRequestRewrite * > | rewrite_collection |
| List< ClientType > | open_clients |
| List< ClientType >::Iterator | current_client_iterator |
| ClientType * | client_ptr = nullptr |
| ServerType * | server_ptr = nullptr |
| bool | is_active |
| Vector< char > | buffer {0} |
| const char * | local_host = nullptr |
| int | no_connect_delay = 5 |
| void * | ref = nullptr |
Header-only HTTP server wrapper that registers callback handlers.
This server is templated so you can provide the concrete Arduino networking classes that back the transport. ClientType is the socket implementation accepted from the server (for example WiFiClient or EthernetClient) and ServerType is the listener type (for example WiFiServer). Default template arguments keep the legacy WiFi behaviour intact, while custom transports can swap in their own client/server types.
| ClientType | Arduino client class accepted from the listener (e.g. WiFiClient, EthernetClient). |
| ServerType | Arduino server/listener class that produces ClientType instances (e.g. WiFiServer, EthernetServer). |
|
inline |
|
inlineoverride |
|
inlineoverridevirtual |
adds a new handler
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Starts the server.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Provides the current client.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
converts the client content to a string
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Call this method from your loop!
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
print a CR LF
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Legacy method: same as copy();.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
stops the server_ptr
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
closes the connection to the current client_ptr
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Provides access to a reference/context object.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Check if server is active.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Determines the local ip address.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Provides the local ip address.
Implements tiny_dlna::IHttpServer.
|
inlineprotected |
compares mime of handler with mime of request: provides true if they match of one is null (=any value)
|
inlineprotected |
Converts null to an empty string.
|
inlineoverridevirtual |
register a handler which provides the indicated string
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
register a handler which provides the indicated string
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
register a handler with mime
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
register a redirection
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
register a generic handler
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
generic handler - you can overwrite this method to provide your specifc processing logic
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Provides true if the server has been started.
Implements tiny_dlna::IHttpServer.
|
inlineprotected |
|
inlineprotected |
|
inlineoverridevirtual |
write reply - string with header size
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Send binary data response.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
write reply - using callback that writes to stream
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
write reply - copies data from input stream with header size
Implements tiny_dlna::IHttpServer.
|
inlineprotected |
Writes the status and message to the reply.
|
inlineoverridevirtual |
start of chunked reply: use HttpChunkWriter to provde the data
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
chunked reply with data from an input stream
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Send error response with status code.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
provides the reply header
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
write 404 reply
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
write OK reply with 200 SUCCESS
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
provides the request header
Implements tiny_dlna::IHttpServer.
|
inlineprotected |
determiens the potentially rewritten url which should be used for the further processing
|
inlineoverridevirtual |
adds a rewrite rule
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Set no-connect delay.
Implements tiny_dlna::IHttpServer.
|
inlineoverridevirtual |
Definesa reference/context object.
Implements tiny_dlna::IHttpServer.
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |
|
protected |