Sophie

Sophie

distrib > Fedora > 20 > x86_64 > media > updates > by-pkgid > c579c38484b8ffa244858626df1128ca > files > 247

libhtp-doc-0.5.6-3.fc20.noarch.rpm

\hypertarget{htp__table_8c}{\section{htp\-\_\-table.\-c File Reference}
\label{htp__table_8c}\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}}
}
{\ttfamily \#include \char`\"{}htp\-\_\-private.\-h\char`\"{}}\\*
\subsection*{Functions}
\begin{DoxyCompactItemize}
\item 
\hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp__table_8c_a80ff6b5f23273fa08d13d8d2d0efc4a0}{htp\-\_\-table\-\_\-add} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, const \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$key, const void $\ast$element)
\item 
\hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp__table_8c_ad325b4502a5e8b81759dba779eacdf25}{htp\-\_\-table\-\_\-addn} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, const \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$key, const void $\ast$element)
\item 
\hyperlink{htp__core_8h_ab8a71422665c0773654b9b4d96f01e31}{htp\-\_\-status\-\_\-t} \hyperlink{htp__table_8c_a1452a5b06e4945d71716c7c72d91efea}{htp\-\_\-table\-\_\-addk} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, const \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$key, const void $\ast$element)
\item 
void \hyperlink{htp__table_8c_ac14ab63ac2bc19ac3f61d324b484dd2e}{htp\-\_\-table\-\_\-clear} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table)
\item 
void \hyperlink{htp__table_8c_a413789ed8a002742ac02e9ef238ae653}{htp\-\_\-table\-\_\-clear\-\_\-ex} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table)
\item 
\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$ \hyperlink{htp__table_8c_a4eb7f8a9d51ad2d6358c87162b7585d4}{htp\-\_\-table\-\_\-create} (size\-\_\-t size)
\item 
void \hyperlink{htp__table_8c_a408659a54a7dd0e715be8bab67a107e6}{htp\-\_\-table\-\_\-destroy} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table)
\item 
void \hyperlink{htp__table_8c_a0f147b2c5067fe3862f23c0c56492702}{htp\-\_\-table\-\_\-destroy\-\_\-ex} (\hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table)
\item 
void $\ast$ \hyperlink{htp__table_8c_ac852ef60754016fac1c214ea1d771025}{htp\-\_\-table\-\_\-get} (const \hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, const \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$key)
\item 
void $\ast$ \hyperlink{htp__table_8c_ab9af397f9e822cad4b9cd89c46ff0391}{htp\-\_\-table\-\_\-get\-\_\-c} (const \hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, const char $\ast$ckey)
\item 
void $\ast$ \hyperlink{htp__table_8c_aa2c2702311ce4bbb7614133098c50b4e}{htp\-\_\-table\-\_\-get\-\_\-index} (const \hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, size\-\_\-t idx, \hyperlink{bstr_8h_ad24e3759c8d17c13ae2f05d9dde4d0b6}{bstr} $\ast$$\ast$key)
\item 
void $\ast$ \hyperlink{htp__table_8c_a83786554bfb029211749edad007c9b28}{htp\-\_\-table\-\_\-get\-\_\-mem} (const \hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table, const void $\ast$key, size\-\_\-t key\-\_\-len)
\item 
size\-\_\-t \hyperlink{htp__table_8c_aa1f72cd85c808b758b6efd6ea0351524}{htp\-\_\-table\-\_\-size} (const \hyperlink{structhtp__table__t}{htp\-\_\-table\-\_\-t} $\ast$table)
\end{DoxyCompactItemize}


\subsection{Detailed Description}
\begin{DoxyAuthor}{Author}
Ivan Ristic \href{mailto:ivanr@webkreator.com}{\tt ivanr@webkreator.\-com} 
\end{DoxyAuthor}


\subsection{Function Documentation}
\hypertarget{htp__table_8c_a80ff6b5f23273fa08d13d8d2d0efc4a0}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-add@{htp\-\_\-table\-\_\-add}}
\index{htp\-\_\-table\-\_\-add@{htp\-\_\-table\-\_\-add}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-add}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-table\-\_\-add (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{const {\bf bstr} $\ast$}]{key, }
\item[{const void $\ast$}]{element}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a80ff6b5f23273fa08d13d8d2d0efc4a0}
Add a new element to the table. The key will be copied, and the copy managed by the table. The table keeps a pointer to the element. It is the callers responsibility to ensure the pointer remains valid.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em key} & \\
\hline
\mbox{\tt in}  & {\em element} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on failure. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_a1452a5b06e4945d71716c7c72d91efea}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-addk@{htp\-\_\-table\-\_\-addk}}
\index{htp\-\_\-table\-\_\-addk@{htp\-\_\-table\-\_\-addk}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-addk}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-table\-\_\-addk (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{const {\bf bstr} $\ast$}]{key, }
\item[{const void $\ast$}]{element}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a1452a5b06e4945d71716c7c72d91efea}
Add a new element to the table. The key provided will be only referenced and the caller remains responsible to keep it alive until after the table is destroyed. The table keeps a pointer to the element. It is the callers responsibility to ensure the pointer remains valid.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em key} & \\
\hline
\mbox{\tt in}  & {\em element} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on failure. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_ad325b4502a5e8b81759dba779eacdf25}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-addn@{htp\-\_\-table\-\_\-addn}}
\index{htp\-\_\-table\-\_\-addn@{htp\-\_\-table\-\_\-addn}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-addn}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-status\-\_\-t} htp\-\_\-table\-\_\-addn (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{const {\bf bstr} $\ast$}]{key, }
\item[{const void $\ast$}]{element}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_ad325b4502a5e8b81759dba779eacdf25}
Add a new element to the table. The key provided will be adopted and managed by the table. You should not keep a copy of the pointer to the key unless you're certain that the table will live longer that the copy. The table keeps a pointer to the element. It is the callers responsibility to ensure the pointer remains valid.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em key} & \\
\hline
\mbox{\tt in}  & {\em element} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on failure. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_ac14ab63ac2bc19ac3f61d324b484dd2e}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-clear@{htp\-\_\-table\-\_\-clear}}
\index{htp\-\_\-table\-\_\-clear@{htp\-\_\-table\-\_\-clear}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-clear}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-table\-\_\-clear (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_ac14ab63ac2bc19ac3f61d324b484dd2e}
Remove all elements from the table. This function handles keys according to the active allocation strategy. If the elements need freeing, you need to free them before invoking this function.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\end{DoxyParams}
\hypertarget{htp__table_8c_a413789ed8a002742ac02e9ef238ae653}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-clear\-\_\-ex@{htp\-\_\-table\-\_\-clear\-\_\-ex}}
\index{htp\-\_\-table\-\_\-clear\-\_\-ex@{htp\-\_\-table\-\_\-clear\-\_\-ex}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-clear\-\_\-ex}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-table\-\_\-clear\-\_\-ex (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a413789ed8a002742ac02e9ef238ae653}
Remove all elements from the table without freeing any of the keys, even if the table is using an allocation strategy where keys belong to it. This function is useful if all the keys have been adopted by some other structure.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\end{DoxyParams}
\hypertarget{htp__table_8c_a4eb7f8a9d51ad2d6358c87162b7585d4}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-create@{htp\-\_\-table\-\_\-create}}
\index{htp\-\_\-table\-\_\-create@{htp\-\_\-table\-\_\-create}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-create}]{\setlength{\rightskip}{0pt plus 5cm}{\bf htp\-\_\-table\-\_\-t}$\ast$ htp\-\_\-table\-\_\-create (
\begin{DoxyParamCaption}
\item[{size\-\_\-t}]{size}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a4eb7f8a9d51ad2d6358c87162b7585d4}
Create a new table structure. The table will grow automatically as needed, but you are required to provide a starting size.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em size} & The starting size. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Newly created table instance, or N\-U\-L\-L on failure. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_a408659a54a7dd0e715be8bab67a107e6}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-destroy@{htp\-\_\-table\-\_\-destroy}}
\index{htp\-\_\-table\-\_\-destroy@{htp\-\_\-table\-\_\-destroy}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-destroy}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-table\-\_\-destroy (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a408659a54a7dd0e715be8bab67a107e6}
Destroy a table. This function handles the keys according to the active allocation strategy. If the elements need freeing, you need to free them before invoking this function. After the table has been destroyed, the pointer is set to N\-U\-L\-L.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\end{DoxyParams}
\hypertarget{htp__table_8c_a0f147b2c5067fe3862f23c0c56492702}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-destroy\-\_\-ex@{htp\-\_\-table\-\_\-destroy\-\_\-ex}}
\index{htp\-\_\-table\-\_\-destroy\-\_\-ex@{htp\-\_\-table\-\_\-destroy\-\_\-ex}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-destroy\-\_\-ex}]{\setlength{\rightskip}{0pt plus 5cm}void htp\-\_\-table\-\_\-destroy\-\_\-ex (
\begin{DoxyParamCaption}
\item[{{\bf htp\-\_\-table\-\_\-t} $\ast$}]{table}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a0f147b2c5067fe3862f23c0c56492702}
Destroy the given table, but don't free the keys. even if they are managed by the table. Use this method when the responsibility for the keys has been transferred elsewhere. After the table has been destroyed, the pointer is set to N\-U\-L\-L.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\end{DoxyParams}
\hypertarget{htp__table_8c_ac852ef60754016fac1c214ea1d771025}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-get@{htp\-\_\-table\-\_\-get}}
\index{htp\-\_\-table\-\_\-get@{htp\-\_\-table\-\_\-get}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-get}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ htp\-\_\-table\-\_\-get (
\begin{DoxyParamCaption}
\item[{const {\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{const {\bf bstr} $\ast$}]{key}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_ac852ef60754016fac1c214ea1d771025}
Retrieve the first element that matches the given bstr key.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em key} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Matched element, or N\-U\-L\-L if no elements match the key. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_ab9af397f9e822cad4b9cd89c46ff0391}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-get\-\_\-c@{htp\-\_\-table\-\_\-get\-\_\-c}}
\index{htp\-\_\-table\-\_\-get\-\_\-c@{htp\-\_\-table\-\_\-get\-\_\-c}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-get\-\_\-c}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ htp\-\_\-table\-\_\-get\-\_\-c (
\begin{DoxyParamCaption}
\item[{const {\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{const char $\ast$}]{ckey}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_ab9af397f9e822cad4b9cd89c46ff0391}
Retrieve the first element that matches the given N\-U\-L-\/terminated key.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em ckey} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Matched element, or N\-U\-L\-L if no elements match the key. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_aa2c2702311ce4bbb7614133098c50b4e}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-get\-\_\-index@{htp\-\_\-table\-\_\-get\-\_\-index}}
\index{htp\-\_\-table\-\_\-get\-\_\-index@{htp\-\_\-table\-\_\-get\-\_\-index}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-get\-\_\-index}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ htp\-\_\-table\-\_\-get\-\_\-index (
\begin{DoxyParamCaption}
\item[{const {\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{size\-\_\-t}]{idx, }
\item[{{\bf bstr} $\ast$$\ast$}]{key}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_aa2c2702311ce4bbb7614133098c50b4e}
Retrieve key and element at the given index.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em idx} & \\
\hline
\mbox{\tt in,out}  & {\em key} & Pointer in which the key will be returned. Can be N\-U\-L\-L. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
H\-T\-P\-\_\-\-O\-K on success, H\-T\-P\-\_\-\-E\-R\-R\-O\-R on failure. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_a83786554bfb029211749edad007c9b28}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-get\-\_\-mem@{htp\-\_\-table\-\_\-get\-\_\-mem}}
\index{htp\-\_\-table\-\_\-get\-\_\-mem@{htp\-\_\-table\-\_\-get\-\_\-mem}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-get\-\_\-mem}]{\setlength{\rightskip}{0pt plus 5cm}void$\ast$ htp\-\_\-table\-\_\-get\-\_\-mem (
\begin{DoxyParamCaption}
\item[{const {\bf htp\-\_\-table\-\_\-t} $\ast$}]{table, }
\item[{const void $\ast$}]{key, }
\item[{size\-\_\-t}]{key\-\_\-len}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_a83786554bfb029211749edad007c9b28}
Retrieve table key defined by the provided pointer and length.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\mbox{\tt in}  & {\em key} & \\
\hline
\mbox{\tt in}  & {\em key\-\_\-len} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
Matched element, or N\-U\-L\-L if no elements match the key. 
\end{DoxyReturn}
\hypertarget{htp__table_8c_aa1f72cd85c808b758b6efd6ea0351524}{\index{htp\-\_\-table.\-c@{htp\-\_\-table.\-c}!htp\-\_\-table\-\_\-size@{htp\-\_\-table\-\_\-size}}
\index{htp\-\_\-table\-\_\-size@{htp\-\_\-table\-\_\-size}!htp_table.c@{htp\-\_\-table.\-c}}
\subsubsection[{htp\-\_\-table\-\_\-size}]{\setlength{\rightskip}{0pt plus 5cm}size\-\_\-t htp\-\_\-table\-\_\-size (
\begin{DoxyParamCaption}
\item[{const {\bf htp\-\_\-table\-\_\-t} $\ast$}]{table}
\end{DoxyParamCaption}
)}}\label{htp__table_8c_aa1f72cd85c808b758b6efd6ea0351524}
Return the size of the table.


\begin{DoxyParams}[1]{Parameters}
\mbox{\tt in}  & {\em table} & \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
table size 
\end{DoxyReturn}