\doxysection{httpd.\+h}
\hypertarget{httpd_8h_source}{}\label{httpd_8h_source}\index{src/httpd.h@{src/httpd.h}}

\begin{DoxyCode}{0}
\DoxyCodeLine{00001\ \textcolor{comment}{/*******************************************************************************}}
\DoxyCodeLine{00002\ \textcolor{comment}{\ *\ Copyright\ (c)\ 2014,\ Jan\ Koester\ jan.koester@gmx.net}}
\DoxyCodeLine{00003\ \textcolor{comment}{\ *\ All\ rights\ reserved.}}
\DoxyCodeLine{00004\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00005\ \textcolor{comment}{\ *\ Redistribution\ and\ use\ in\ source\ and\ binary\ forms,\ with\ or\ without}}
\DoxyCodeLine{00006\ \textcolor{comment}{\ *\ modification,\ are\ permitted\ provided\ that\ the\ following\ conditions\ are\ met:}}
\DoxyCodeLine{00007\ \textcolor{comment}{\ *\ Redistributions\ of\ source\ code\ must\ retain\ the\ above\ copyright}}
\DoxyCodeLine{00008\ \textcolor{comment}{\ *\ \ \ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer.}}
\DoxyCodeLine{00009\ \textcolor{comment}{\ *\ Redistributions\ in\ binary\ form\ must\ reproduce\ the\ above\ copyright}}
\DoxyCodeLine{00010\ \textcolor{comment}{\ *\ \ \ \ \ \ notice,\ this\ list\ of\ conditions\ and\ the\ following\ disclaimer\ in\ the}}
\DoxyCodeLine{00011\ \textcolor{comment}{\ *\ \ \ \ \ \ documentation\ and/or\ other\ materials\ provided\ with\ the\ distribution.}}
\DoxyCodeLine{00012\ \textcolor{comment}{\ *\ Neither\ the\ name\ of\ the\ <organization>\ nor\ the}}
\DoxyCodeLine{00013\ \textcolor{comment}{\ *\ \ \ \ \ \ names\ of\ its\ contributors\ may\ be\ used\ to\ endorse\ or\ promote\ products}}
\DoxyCodeLine{00014\ \textcolor{comment}{\ *\ \ \ \ \ \ derived\ from\ this\ software\ without\ specific\ prior\ written\ permission.}}
\DoxyCodeLine{00015\ \textcolor{comment}{\ *\ }}
\DoxyCodeLine{00016\ \textcolor{comment}{\ *\ THIS\ SOFTWARE\ IS\ PROVIDED\ BY\ THE\ COPYRIGHT\ HOLDERS\ AND\ CONTRIBUTORS\ "{}AS\ IS"{}\ AND}}
\DoxyCodeLine{00017\ \textcolor{comment}{\ *\ ANY\ EXPRESS\ OR\ IMPLIED\ WARRANTIES,\ INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ THE\ IMPLIED}}
\DoxyCodeLine{00018\ \textcolor{comment}{\ *\ WARRANTIES\ OF\ MERCHANTABILITY\ AND\ FITNESS\ FOR\ A\ PARTICULAR\ PURPOSE\ ARE}}
\DoxyCodeLine{00019\ \textcolor{comment}{\ *\ DISCLAIMED.\ IN\ NO\ EVENT\ SHALL\ <COPYRIGHT\ HOLDER>\ BE\ LIABLE\ FOR\ ANY}}
\DoxyCodeLine{00020\ \textcolor{comment}{\ *\ DIRECT,\ INDIRECT,\ INCIDENTAL,\ SPECIAL,\ EXEMPLARY,\ OR\ CONSEQUENTIAL\ DAMAGES}}
\DoxyCodeLine{00021\ \textcolor{comment}{\ *\ (INCLUDING,\ BUT\ NOT\ LIMITED\ TO,\ PROCUREMENT\ OF\ SUBSTITUTE\ GOODS\ OR\ SERVICES;}}
\DoxyCodeLine{00022\ \textcolor{comment}{\ *\ LOSS\ OF\ USE,\ DATA,\ OR\ PROFITS;\ OR\ BUSINESS\ INTERRUPTION)\ HOWEVER\ CAUSED\ AND}}
\DoxyCodeLine{00023\ \textcolor{comment}{\ *\ ON\ ANY\ THEORY\ OF\ LIABILITY,\ WHETHER\ IN\ CONTRACT,\ STRICT\ LIABILITY,\ OR\ TORT}}
\DoxyCodeLine{00024\ \textcolor{comment}{\ *\ (INCLUDING\ NEGLIGENCE\ OR\ OTHERWISE)\ ARISING\ IN\ ANY\ WAY\ OUT\ OF\ THE\ USE\ OF\ THIS}}
\DoxyCodeLine{00025\ \textcolor{comment}{\ *\ SOFTWARE,\ EVEN\ IF\ ADVISED\ OF\ THE\ POSSIBILITY\ OF\ SUCH\ DAMAGE.}}
\DoxyCodeLine{00026\ \textcolor{comment}{\ *******************************************************************************/}}
\DoxyCodeLine{00027\ }
\DoxyCodeLine{00028\ \textcolor{preprocessor}{\#include\ <netplus/socket.h>}}
\DoxyCodeLine{00029\ \textcolor{preprocessor}{\#include\ <netplus/eventapi.h>}}
\DoxyCodeLine{00030\ \textcolor{preprocessor}{\#include\ <cstdint>}}
\DoxyCodeLine{00031\ \textcolor{preprocessor}{\#include\ <map>}}
\DoxyCodeLine{00032\ \textcolor{preprocessor}{\#include\ <memory>}}
\DoxyCodeLine{00033\ \textcolor{preprocessor}{\#include\ <mutex>}}
\DoxyCodeLine{00034\ \textcolor{preprocessor}{\#include\ <string>}}
\DoxyCodeLine{00035\ \textcolor{preprocessor}{\#include\ <vector>}}
\DoxyCodeLine{00036\ }
\DoxyCodeLine{00037\ \textcolor{preprocessor}{\#include\ "{}http.h"{}}}
\DoxyCodeLine{00038\ \textcolor{preprocessor}{\#include\ "{}exception.h"{}}}
\DoxyCodeLine{00039\ }
\DoxyCodeLine{00040\ \textcolor{preprocessor}{\#pragma\ once}}
\DoxyCodeLine{00041\ }
\DoxyCodeLine{00042\ \textcolor{keyword}{namespace\ }cmdplus\ \{}
\DoxyCodeLine{00043\ \ \ \ \ \textcolor{keyword}{class\ }CmdController;\ \ \ \ }
\DoxyCodeLine{00044\ \}}
\DoxyCodeLine{00045\ }
\DoxyCodeLine{00046\ \textcolor{keyword}{namespace\ }libhttppp\ \{}
\DoxyCodeLine{00047\ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{classlibhttppp_1_1HttpEvent}{HttpEvent}}\ :\ \textcolor{keyword}{public}\ netplus::event\ \{}
\DoxyCodeLine{00048\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00049\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classlibhttppp_1_1HttpEvent}{HttpEvent}}(std::vector<netplus::socket*>\ serversocket,\textcolor{keywordtype}{int}\ timeout\ =\ 1000);}
\DoxyCodeLine{00050\ }
\DoxyCodeLine{00051\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ RequestEvent(\mbox{\hyperlink{classlibhttppp_1_1HttpRequest}{HttpRequest}}\ \&curreq,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00052\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ ResponseEvent(\mbox{\hyperlink{classlibhttppp_1_1HttpRequest}{HttpRequest}}\ \&curreq,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00053\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ ConnectEvent(\mbox{\hyperlink{classlibhttppp_1_1HttpRequest}{HttpRequest}}\ \&curreq,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00054\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ DisconnectEvent(\mbox{\hyperlink{classlibhttppp_1_1HttpRequest}{HttpRequest}}\ \&curreq,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00055\ }
\DoxyCodeLine{00056\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{bool}\ Http2RequestEvent(netplus::con\ \&curcon,}
\DoxyCodeLine{00057\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,}
\DoxyCodeLine{00058\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ ULONG\_PTR\ args,}
\DoxyCodeLine{00059\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ std::string\ \&alpn,}
\DoxyCodeLine{00060\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ netplus::ssl::FramingCallback\ \&frame\_cb);}
\DoxyCodeLine{00061\ \ \ \ \ \ \ \ \ \textcolor{keyword}{virtual}\ \textcolor{keywordtype}{void}\ Http3StreamEvent(netplus::socket\ *sock,}
\DoxyCodeLine{00062\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint64\_t\ stream\_id,}
\DoxyCodeLine{00063\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ std::vector<uint8\_t>\ \&data,}
\DoxyCodeLine{00064\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ fin);}
\DoxyCodeLine{00065\ }
\DoxyCodeLine{00066\ \ \ \ \ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00067\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ CreateConnection(std::shared\_ptr<netplus::con>\ \&res);}
\DoxyCodeLine{00068\ \ \ \ \ \ \ \ \ std::string\ \_altSvcH3;\ \ \ \textcolor{comment}{//\ Alt-\/Svc\ value\ for\ HTTP/3\ advertisement}}
\DoxyCodeLine{00069\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00070\ \ \ \ \ \ \ \ \ \textcolor{comment}{//\ Per-\/stream\ buffer\ for\ HTTP/3:\ accumulates\ data\ until\ fin}}
\DoxyCodeLine{00071\ \ \ \ \ \ \ \ \ \textcolor{keyword}{struct\ }H3StreamBuffer\ \{}
\DoxyCodeLine{00072\ \ \ \ \ \ \ \ \ \ \ \ \ std::vector<uint8\_t>\ data;}
\DoxyCodeLine{00073\ \ \ \ \ \ \ \ \ \};}
\DoxyCodeLine{00074\ \ \ \ \ \ \ \ \ std::mutex\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \_h3BufferMutex;}
\DoxyCodeLine{00075\ \ \ \ \ \ \ \ \ std::map<uint64\_t,\ H3StreamBuffer>\ \ \ \ \_h3StreamBuffers;}
\DoxyCodeLine{00076\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \_dispatchH2Stream(\mbox{\hyperlink{classlibhttppp_1_1HttpRequest}{HttpRequest}}\ \&cureq,\ std::string\ \&out,}
\DoxyCodeLine{00077\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ uint32\_t\ sid,}
\DoxyCodeLine{00078\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ std::vector<hpack::HeaderField>\ \&decoded,}
\DoxyCodeLine{00079\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ std::string\ \&reqBody,}
\DoxyCodeLine{00080\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,\ ULONG\_PTR\ args);}
\DoxyCodeLine{00081\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ RequestEvent(netplus::con\ \&curcon,\ \textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,\ ULONG\_PTR\ args);}
\DoxyCodeLine{00082\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ ResponseEvent(netplus::con\ \&curcon,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00083\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ ConnectEvent(netplus::con\ \&curcon,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00084\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ DisconnectEvent(netplus::con\ \&curcon,\textcolor{keyword}{const}\ \textcolor{keywordtype}{int}\ tid,ULONG\_PTR\ args);}
\DoxyCodeLine{00085\ }
\DoxyCodeLine{00086\ \ \ \ \ \};}
\DoxyCodeLine{00087\ }
\DoxyCodeLine{00088\ \ \ \ \ \textcolor{keyword}{class\ }\mbox{\hyperlink{classlibhttppp_1_1HttpD}{HttpD}}\ \{}
\DoxyCodeLine{00089\ \ \ \ \ \textcolor{keyword}{public}:}
\DoxyCodeLine{00090\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classlibhttppp_1_1HttpD}{HttpD}}(\textcolor{keywordtype}{int}\ argc,\ \textcolor{keywordtype}{char}**\ argv);}
\DoxyCodeLine{00091\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classlibhttppp_1_1HttpD}{HttpD}}(\textcolor{keyword}{const}\ std::string\ \&httpaddr,\ \textcolor{keywordtype}{int}\ port,\ \textcolor{keywordtype}{int}\ maxconnections,\ \textcolor{keyword}{const}\ std::string\ \&sslcertpath,\ \textcolor{keyword}{const}\ \ std::string\ \&sslkeypath);}
\DoxyCodeLine{00092\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classlibhttppp_1_1HttpD}{\string~HttpD}}();}
\DoxyCodeLine{00093\ \ \ \ \ \ \ \ \ std::vector<netplus::socket*>\ getServerSockets();}
\DoxyCodeLine{00094\ \ \ \ \ \textcolor{keyword}{protected}:}
\DoxyCodeLine{00095\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{void}\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ FileServer();}
\DoxyCodeLine{00096\ \ \ \ \ \textcolor{keyword}{private}:}
\DoxyCodeLine{00097\ }
\DoxyCodeLine{00098\ \ \ \ \ \ \ \ \ \textcolor{keywordtype}{bool}\ \ \ \ \ \ \ \ \ \ \ \ \ \_fileServer;}
\DoxyCodeLine{00099\ \ \ \ \ \ \ \ \ std::vector<std::unique\_ptr<netplus::socket>>\ \_ServerSockets;}
\DoxyCodeLine{00100\ \ \ \ \ \ \ \ \ std::map<std::string,\ netplus::ssl::CertificateBundle>\ \_certBundle;}
\DoxyCodeLine{00101\ \ \ \ \ \ \ \ \ \mbox{\hyperlink{classlibhttppp_1_1HTTPException}{HTTPException}}\ \ \ \ \_httpexception;}
\DoxyCodeLine{00102\ \ \ \ \ \};}
\DoxyCodeLine{00103\ \};}

\end{DoxyCode}
