\hypertarget{htp__hooks_8h}{\section{htp\-\_\-hooks.\-h File Reference} \label{htp__hooks_8h}\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}} } {\ttfamily \#include \char`\"{}htp.\-h\char`\"{}}\\* \subsection*{Data Structures} \begin{DoxyCompactItemize} \item struct \hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} \item struct \hyperlink{structhtp__callback__t}{htp\-\_\-callback\-\_\-t} \end{DoxyCompactItemize} \subsection*{Typedefs} \begin{DoxyCompactItemize} \item typedef struct \hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} \hyperlink{htp__hooks_8h_ac6fad8473390218b56a817b0106a74e4}{htp\-\_\-hook\-\_\-t} \item typedef struct \hyperlink{structhtp__callback__t}{htp\-\_\-callback\-\_\-t} \hyperlink{htp__hooks_8h_a8bc82968d351e0455d767b6eaa990b7d}{htp\-\_\-callback\-\_\-t} \item typedef int($\ast$ \hyperlink{htp__hooks_8h_abc1dcd1da25b169b45d7c78570bb0f32}{htp\-\_\-callback\-\_\-fn\-\_\-t} )(void $\ast$) \end{DoxyCompactItemize} \subsection*{Functions} \begin{DoxyCompactItemize} \item \hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$ \hyperlink{htp__hooks_8h_a1f1e4fb530d86ef619a0eaff8bfe491e}{htp\-\_\-hook\-\_\-copy} (const \hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$hook) \item \hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$ \hyperlink{htp__hooks_8h_aa1cdd71dc6965b5a9a6647e8ed650997}{htp\-\_\-hook\-\_\-create} (void) \item void \hyperlink{htp__hooks_8h_a58b480fb42419dec49170dbeb1189a73}{htp\-\_\-hook\-\_\-destroy} (\hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$hook) \item \hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp__hooks_8h_ae22b914ef6ae582b88a44e413efc48db}{htp\-\_\-hook\-\_\-register} (\hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$$\ast$hook, const \hyperlink{htp__hooks_8h_abc1dcd1da25b169b45d7c78570bb0f32}{htp\-\_\-callback\-\_\-fn\-\_\-t} callback\-\_\-fn) \item \hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp__hooks_8h_a8981d368a73f78ddfb4ad1de1f4a5fc2}{htp\-\_\-hook\-\_\-run\-\_\-all} (\hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$hook, void $\ast$user\-\_\-data) \item \hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp__hooks_8h_a67c417adb40bcf110515cc00b6f8f956}{htp\-\_\-hook\-\_\-run\-\_\-one} (\hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} $\ast$hook, void $\ast$user\-\_\-data) \end{DoxyCompactItemize} \subsection{Detailed Description} \begin{DoxyAuthor}{Author} Ivan Ristic \href{mailto:ivanr@webkreator.com}{\tt ivanr@webkreator.\-com} \end{DoxyAuthor} \subsection{Typedef Documentation} \hypertarget{htp__hooks_8h_abc1dcd1da25b169b45d7c78570bb0f32}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-callback\-\_\-fn\-\_\-t@{htp\-\_\-callback\-\_\-fn\-\_\-t}} \index{htp\-\_\-callback\-\_\-fn\-\_\-t@{htp\-\_\-callback\-\_\-fn\-\_\-t}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-callback\-\_\-fn\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef int($\ast$ htp\-\_\-callback\-\_\-fn\-\_\-t)(void $\ast$)}}\label{htp__hooks_8h_abc1dcd1da25b169b45d7c78570bb0f32} \hypertarget{htp__hooks_8h_a8bc82968d351e0455d767b6eaa990b7d}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-callback\-\_\-t@{htp\-\_\-callback\-\_\-t}} \index{htp\-\_\-callback\-\_\-t@{htp\-\_\-callback\-\_\-t}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-callback\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf htp\-\_\-callback\-\_\-t} {\bf htp\-\_\-callback\-\_\-t}}}\label{htp__hooks_8h_a8bc82968d351e0455d767b6eaa990b7d} \hypertarget{htp__hooks_8h_ac6fad8473390218b56a817b0106a74e4}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-t@{htp\-\_\-hook\-\_\-t}} \index{htp\-\_\-hook\-\_\-t@{htp\-\_\-hook\-\_\-t}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-t}]{\setlength{\rightskip}{0pt plus 5cm}typedef struct {\bf htp\-\_\-hook\-\_\-t} {\bf htp\-\_\-hook\-\_\-t}}}\label{htp__hooks_8h_ac6fad8473390218b56a817b0106a74e4} \subsection{Function Documentation} \hypertarget{htp__hooks_8h_a1f1e4fb530d86ef619a0eaff8bfe491e}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-copy@{htp\-\_\-hook\-\_\-copy}} \index{htp\-\_\-hook\-\_\-copy@{htp\-\_\-hook\-\_\-copy}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-copy}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-hook\-\_\-t}$\ast$ htp\-\_\-hook\-\_\-copy ( \begin{DoxyParamCaption} \item[{const {\bf htp\-\_\-hook\-\_\-t} $\ast$}]{hook} \end{DoxyParamCaption} )}}\label{htp__hooks_8h_a1f1e4fb530d86ef619a0eaff8bfe491e} Creates a copy of the provided hook. The hook is allowed to be N\-U\-L\-L, in which case this function simply returns a N\-U\-L\-L. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em hook} & \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} A copy of the hook, or N\-U\-L\-L (if the provided hook was N\-U\-L\-L or, if it wasn't, if there was a memory allocation problem while constructing a copy). \end{DoxyReturn} \hypertarget{htp__hooks_8h_aa1cdd71dc6965b5a9a6647e8ed650997}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-create@{htp\-\_\-hook\-\_\-create}} \index{htp\-\_\-hook\-\_\-create@{htp\-\_\-hook\-\_\-create}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-hook\-\_\-t}$\ast$ htp\-\_\-hook\-\_\-create ( \begin{DoxyParamCaption} \item[{void}]{} \end{DoxyParamCaption} )}}\label{htp__hooks_8h_aa1cdd71dc6965b5a9a6647e8ed650997} Creates a new hook. \begin{DoxyReturn}{Returns} New \hyperlink{structhtp__hook__t}{htp\-\_\-hook\-\_\-t} structure on success, N\-U\-L\-L on failure. \end{DoxyReturn} \hypertarget{htp__hooks_8h_a58b480fb42419dec49170dbeb1189a73}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-destroy@{htp\-\_\-hook\-\_\-destroy}} \index{htp\-\_\-hook\-\_\-destroy@{htp\-\_\-hook\-\_\-destroy}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-destroy}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-hook\-\_\-destroy ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-hook\-\_\-t} $\ast$}]{hook} \end{DoxyParamCaption} )}}\label{htp__hooks_8h_a58b480fb42419dec49170dbeb1189a73} Destroys an existing hook. It is all right to send a N\-U\-L\-L to this method because it will simply return straight away. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em hook} & \\ \hline \end{DoxyParams} \hypertarget{htp__hooks_8h_ae22b914ef6ae582b88a44e413efc48db}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-register@{htp\-\_\-hook\-\_\-register}} \index{htp\-\_\-hook\-\_\-register@{htp\-\_\-hook\-\_\-register}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-register}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-hook\-\_\-register ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-hook\-\_\-t} $\ast$$\ast$}]{hook, } \item[{const {\bf htp\-\_\-callback\-\_\-fn\-\_\-t}}]{callback\-\_\-fn} \end{DoxyParamCaption} )}}\label{htp__hooks_8h_ae22b914ef6ae582b88a44e413efc48db} Registers a new callback with the hook. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em hook} & \\ \hline \mbox{\tt in} & {\em callback\-\_\-fn} & \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on memory allocation error. \end{DoxyReturn} \hypertarget{htp__hooks_8h_a8981d368a73f78ddfb4ad1de1f4a5fc2}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-run\-\_\-all@{htp\-\_\-hook\-\_\-run\-\_\-all}} \index{htp\-\_\-hook\-\_\-run\-\_\-all@{htp\-\_\-hook\-\_\-run\-\_\-all}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-run\-\_\-all}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-hook\-\_\-run\-\_\-all ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-hook\-\_\-t} $\ast$}]{hook, } \item[{void $\ast$}]{user\-\_\-data} \end{DoxyParamCaption} )}}\label{htp__hooks_8h_a8981d368a73f78ddfb4ad1de1f4a5fc2} Runs all the callbacks associated with a given hook. Only stops if one of the callbacks returns an error (H\-T\-P\-\_\-\-E\-R\-R\-O\-R) or stop (H\-T\-P\-\_\-\-S\-T\-O\-P). \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em hook} & \\ \hline \mbox{\tt in} & {\em user\-\_\-data} & \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} H\-T\-P\-\_\-\-O\-K if at least one hook ran successfully, H\-T\-P\-\_\-\-S\-T\-O\-P if there was no error but processing should stop, and H\-T\-P\-\_\-\-E\-R\-R\-O\-R or any other value less than zero on error. \end{DoxyReturn} \hypertarget{htp__hooks_8h_a67c417adb40bcf110515cc00b6f8f956}{\index{htp\-\_\-hooks.\-h@{htp\-\_\-hooks.\-h}!htp\-\_\-hook\-\_\-run\-\_\-one@{htp\-\_\-hook\-\_\-run\-\_\-one}} \index{htp\-\_\-hook\-\_\-run\-\_\-one@{htp\-\_\-hook\-\_\-run\-\_\-one}!htp_hooks.h@{htp\-\_\-hooks.\-h}} \subsubsection[{htp\-\_\-hook\-\_\-run\-\_\-one}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-hook\-\_\-run\-\_\-one ( \begin{DoxyParamCaption} \item[{{\bf htp\-\_\-hook\-\_\-t} $\ast$}]{hook, } \item[{void $\ast$}]{user\-\_\-data} \end{DoxyParamCaption} )}}\label{htp__hooks_8h_a67c417adb40bcf110515cc00b6f8f956} Run callbacks one by one until one of them accepts to service the hook. \begin{DoxyParams}[1]{Parameters} \mbox{\tt in} & {\em hook} & \\ \hline \mbox{\tt in} & {\em user\-\_\-data} & \\ \hline \end{DoxyParams} \begin{DoxyReturn}{Returns} H\-T\-P\-\_\-\-O\-K if a hook was found to process the callback, H\-T\-P\-\_\-\-D\-E\-C\-L\-I\-N\-E\-D if no hook could be found, H\-T\-P\-\_\-\-S\-T\-O\-P if a hook signalled the processing to stop, and H\-T\-P\-\_\-\-E\-R\-R\-O\-R or any other value less than zero on error. \end{DoxyReturn}