Arduino DLNA Server
HttpRequestHandlerLine.h
Go to the documentation of this file.
1 #pragma once
2 
3 #include "HttpHeader.h"
4 
5 namespace tiny_dlna {
6 
7 // forward declarations for the callback
8 class HttpServer;
9 class HttpRequestHandlerLine;
10 
11 // Callback function which provides result
12 typedef void (*web_callback_fn)(HttpServer* server, const char* requestPath,
13  HttpRequestHandlerLine* handlerLine);
14 
20  public:
21  HttpRequestHandlerLine(int ctxSize = 0) {
22  DlnaLogger.log(DlnaDebug, "HttpRequestHandlerLine");
23  contextCount = ctxSize;
24  context = new void*[ctxSize];
25  }
26 
28  DlnaLogger.log(DlnaDebug, "~HttpRequestHandlerLine");
29  if (contextCount > 0) {
30  DlnaLogger.log(DlnaDebug, "HttpRequestHandlerLine %s", "free");
31  delete[] context;
32  }
33  }
34 
37  const char* mime = nullptr;
39  void** context;
41  StrView* header = nullptr;
42 };
43 
44 } // namespace tiny_dlna
Used to register and process callbacks.
Definition: HttpRequestHandlerLine.h:19
StrView * header
Definition: HttpRequestHandlerLine.h:41
web_callback_fn fn
Definition: HttpRequestHandlerLine.h:38
HttpRequestHandlerLine(int ctxSize=0)
Definition: HttpRequestHandlerLine.h:21
Str path
Definition: HttpRequestHandlerLine.h:36
TinyMethodID method
Definition: HttpRequestHandlerLine.h:35
~HttpRequestHandlerLine()
Definition: HttpRequestHandlerLine.h:27
void ** context
Definition: HttpRequestHandlerLine.h:39
const char * mime
Definition: HttpRequestHandlerLine.h:37
int contextCount
Definition: HttpRequestHandlerLine.h:40
A Simple Header only implementation of Http Server that allows the registration of callback functions...
Definition: HttpServer.h:24
void log(DlnaLogLevel current_level, const char *fmt...)
Print log message.
Definition: Logger.h:40
A simple wrapper to provide string functions on char*. If the underlying char* is a const we do not a...
Definition: StrView.h:25
String implementation which keeps the data on the heap. We grow the allocated memory only if the copy...
Definition: Str.h:22
Definition: Allocator.h:6
void(* web_callback_fn)(HttpServer *server, const char *requestPath, HttpRequestHandlerLine *handlerLine)
Definition: HttpRequestHandlerLine.h:12
@ DlnaDebug
Definition: Logger.h:16
TinyMethodID
Definition: HttpHeader.h:35
LoggerClass DlnaLogger
Definition: Logger.cpp:5