\doxysection{Utility functions}
\hypertarget{group__util__h}{}\label{group__util__h}\index{Utility functions@{Utility functions}}


Checks if two \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} structs are equal.  


\doxysubsubsection*{Data Structures}
\begin{DoxyCompactItemize}
\item 
struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}}
\begin{DoxyCompactList}\small\item\em The \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} struct stores a IPv4 or IPv6 address in host byte order. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Enumerations}
\begin{DoxyCompactItemize}
\item 
enum \mbox{\hyperlink{group__util__h_gab1e0d2320694c34806cabed231e00f4d}{lrtr\+\_\+ip\+\_\+version}} \{ \mbox{\hyperlink{group__util__h_ggab1e0d2320694c34806cabed231e00f4dad94652cc34a88a9ef29ca697e3a17952}{LRTR\+\_\+\+IPV4}}
, \mbox{\hyperlink{group__util__h_ggab1e0d2320694c34806cabed231e00f4da0bab871ffd3fb06fad7acdaecea1c42c}{LRTR\+\_\+\+IPV6}}
 \}
\begin{DoxyCompactList}\small\item\em Version of the IP protocol. \end{DoxyCompactList}\end{DoxyCompactItemize}
\doxysubsubsection*{Functions}
\begin{DoxyCompactItemize}
\item 
int \mbox{\hyperlink{group__util__h_ga01be4a9d17952175d50b298aad7b9479}{lrtr\+\_\+ip\+\_\+addr\+\_\+to\+\_\+str}} (const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} \texorpdfstring{$\ast$}{*}ip, char \texorpdfstring{$\ast$}{*}str, const unsigned int \mbox{\hyperlink{rtr__pdus_8h_a96bbf959016e4411c9e6b9812a8be60a}{len}})
\begin{DoxyCompactList}\small\item\em Converts the passed \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} struct to string representation. \end{DoxyCompactList}\item 
int \mbox{\hyperlink{group__util__h_gac667b04e3b155ebc6bebb983e99decb6}{lrtr\+\_\+ip\+\_\+str\+\_\+to\+\_\+addr}} (const char \texorpdfstring{$\ast$}{*}str, struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} \texorpdfstring{$\ast$}{*}ip)
\begin{DoxyCompactList}\small\item\em Converts the passed IP address in string representation to an \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{group__util__h_ga6b25b2ae306cf374df18044190b04793}{lrtr\+\_\+ip\+\_\+addr\+\_\+equal}} (const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} a, const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} b)
\begin{DoxyCompactList}\small\item\em Checks if two \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} structs are equal. \end{DoxyCompactList}\item 
bool \mbox{\hyperlink{group__util__h_ga9a31d2cd8a621a77681fb4aa86d2c2b5}{lrtr\+\_\+ip\+\_\+str\+\_\+cmp}} (const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} \texorpdfstring{$\ast$}{*}addr1, const char \texorpdfstring{$\ast$}{*}addr2)
\begin{DoxyCompactList}\small\item\em Compares addr1 in the \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} struct with addr2 in string representation. \end{DoxyCompactList}\item 
void \mbox{\hyperlink{group__util__h_ga91aaafa31a937931b6db6cb2c480ae6e}{lrtr\+\_\+ipv4\+\_\+addr\+\_\+convert\+\_\+byte\+\_\+order}} (const uint32\+\_\+t src, uint32\+\_\+t \texorpdfstring{$\ast$}{*}dest, const enum \mbox{\hyperlink{convert__byte__order__private_8h_ac7f9e54856274b72079ec96ab0e18fa1}{target\+\_\+byte\+\_\+order}} tbo)
\begin{DoxyCompactList}\small\item\em \mbox{[}\{ \end{DoxyCompactList}\end{DoxyCompactItemize}
\begin{DoxyCompactItemize}
\item 
void \mbox{\hyperlink{group__util__h_gaf1180d77166d4f87f81541e752cdc4d6}{lrtr\+\_\+ipv6\+\_\+addr\+\_\+convert\+\_\+byte\+\_\+order}} (const uint32\+\_\+t \texorpdfstring{$\ast$}{*}src, uint32\+\_\+t \texorpdfstring{$\ast$}{*}dest, const enum \mbox{\hyperlink{convert__byte__order__private_8h_ac7f9e54856274b72079ec96ab0e18fa1}{target\+\_\+byte\+\_\+order}} tbo)
\begin{DoxyCompactList}\small\item\em Converts the passed IPv6 address to given byte order. \end{DoxyCompactList}\end{DoxyCompactItemize}


\doxysubsection{Detailed Description}
Checks if two \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} structs are equal. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em a} & \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} \\
\hline
\mbox{\texttt{ in}}  & {\em b} & \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true If a == b. 

false If a != b. 
\end{DoxyReturn}


\doxysubsection{Enumeration Type Documentation}
\Hypertarget{group__util__h_gab1e0d2320694c34806cabed231e00f4d}\label{group__util__h_gab1e0d2320694c34806cabed231e00f4d} 
\index{Utility functions@{Utility functions}!lrtr\_ip\_version@{lrtr\_ip\_version}}
\index{lrtr\_ip\_version@{lrtr\_ip\_version}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ip\_version}{lrtr\_ip\_version}}
{\footnotesize\ttfamily enum \mbox{\hyperlink{group__util__h_gab1e0d2320694c34806cabed231e00f4d}{lrtr\+\_\+ip\+\_\+version}}}



{\ttfamily \#include $<$\mbox{\hyperlink{ip_8h}{rtrlib/lib/ip.\+h}}$>$}



Version of the IP protocol. 

\begin{DoxyEnumFields}{Enumerator}
\raisebox{\heightof{T}}[0pt][0pt]{\index{LRTR\_IPV4@{LRTR\_IPV4}!Utility functions@{Utility functions}}\index{Utility functions@{Utility functions}!LRTR\_IPV4@{LRTR\_IPV4}}}\Hypertarget{group__util__h_ggab1e0d2320694c34806cabed231e00f4dad94652cc34a88a9ef29ca697e3a17952}\label{group__util__h_ggab1e0d2320694c34806cabed231e00f4dad94652cc34a88a9ef29ca697e3a17952} 
LRTR\+\_\+\+IPV4&IPV4. \\
\hline

\raisebox{\heightof{T}}[0pt][0pt]{\index{LRTR\_IPV6@{LRTR\_IPV6}!Utility functions@{Utility functions}}\index{Utility functions@{Utility functions}!LRTR\_IPV6@{LRTR\_IPV6}}}\Hypertarget{group__util__h_ggab1e0d2320694c34806cabed231e00f4da0bab871ffd3fb06fad7acdaecea1c42c}\label{group__util__h_ggab1e0d2320694c34806cabed231e00f4da0bab871ffd3fb06fad7acdaecea1c42c} 
LRTR\+\_\+\+IPV6&LRTR\+\_\+\+IPV6. \\
\hline

\end{DoxyEnumFields}


\doxysubsection{Function Documentation}
\Hypertarget{group__util__h_ga6b25b2ae306cf374df18044190b04793}\label{group__util__h_ga6b25b2ae306cf374df18044190b04793} 
\index{Utility functions@{Utility functions}!lrtr\_ip\_addr\_equal@{lrtr\_ip\_addr\_equal}}
\index{lrtr\_ip\_addr\_equal@{lrtr\_ip\_addr\_equal}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ip\_addr\_equal()}{lrtr\_ip\_addr\_equal()}}
{\footnotesize\ttfamily bool lrtr\+\_\+ip\+\_\+addr\+\_\+equal (\begin{DoxyParamCaption}\item[{const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}}}]{a,  }\item[{const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}}}]{b }\end{DoxyParamCaption})}



{\ttfamily \#include $<$\mbox{\hyperlink{ip_8h}{rtrlib/lib/ip.\+h}}$>$}



Checks if two \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} structs are equal. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em a} & \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} \\
\hline
\mbox{\texttt{ in}}  & {\em b} & \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true If a == b. 

false If a != b. 
\end{DoxyReturn}
\Hypertarget{group__util__h_ga01be4a9d17952175d50b298aad7b9479}\label{group__util__h_ga01be4a9d17952175d50b298aad7b9479} 
\index{Utility functions@{Utility functions}!lrtr\_ip\_addr\_to\_str@{lrtr\_ip\_addr\_to\_str}}
\index{lrtr\_ip\_addr\_to\_str@{lrtr\_ip\_addr\_to\_str}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ip\_addr\_to\_str()}{lrtr\_ip\_addr\_to\_str()}}
{\footnotesize\ttfamily int lrtr\+\_\+ip\+\_\+addr\+\_\+to\+\_\+str (\begin{DoxyParamCaption}\item[{const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} \texorpdfstring{$\ast$}{*}}]{ip,  }\item[{char \texorpdfstring{$\ast$}{*}}]{str,  }\item[{const unsigned int}]{len }\end{DoxyParamCaption})}



{\ttfamily \#include $<$\mbox{\hyperlink{ip_8h}{rtrlib/lib/ip.\+h}}$>$}



Converts the passed \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} struct to string representation. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em ip} & \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} \\
\hline
\mbox{\texttt{ out}}  & {\em str} & Pointer to a char array. The array must be at least INET\+\_\+\+ADDRSTRLEN bytes long if the passed \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} stores an IPv4 address. If \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} stores an IPv6 address, str must be at least INET6\+\_\+\+ADDRSTRLEN bytes long. \\
\hline
\mbox{\texttt{ in}}  & {\em len} & Length of the str array. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 On success. 

-\/1 On error. 
\end{DoxyReturn}
\Hypertarget{group__util__h_ga9a31d2cd8a621a77681fb4aa86d2c2b5}\label{group__util__h_ga9a31d2cd8a621a77681fb4aa86d2c2b5} 
\index{Utility functions@{Utility functions}!lrtr\_ip\_str\_cmp@{lrtr\_ip\_str\_cmp}}
\index{lrtr\_ip\_str\_cmp@{lrtr\_ip\_str\_cmp}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ip\_str\_cmp()}{lrtr\_ip\_str\_cmp()}}
{\footnotesize\ttfamily bool lrtr\+\_\+ip\+\_\+str\+\_\+cmp (\begin{DoxyParamCaption}\item[{const struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} \texorpdfstring{$\ast$}{*}}]{addr1,  }\item[{const char \texorpdfstring{$\ast$}{*}}]{addr2 }\end{DoxyParamCaption})}



{\ttfamily \#include $<$\mbox{\hyperlink{ip_8h}{rtrlib/lib/ip.\+h}}$>$}



Compares addr1 in the \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} struct with addr2 in string representation. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em addr1} & \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} \\
\hline
\mbox{\texttt{ in}}  & {\em addr2} & IP-\/address as string \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
true If a == b 

false If a != b 
\end{DoxyReturn}
\Hypertarget{group__util__h_gac667b04e3b155ebc6bebb983e99decb6}\label{group__util__h_gac667b04e3b155ebc6bebb983e99decb6} 
\index{Utility functions@{Utility functions}!lrtr\_ip\_str\_to\_addr@{lrtr\_ip\_str\_to\_addr}}
\index{lrtr\_ip\_str\_to\_addr@{lrtr\_ip\_str\_to\_addr}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ip\_str\_to\_addr()}{lrtr\_ip\_str\_to\_addr()}}
{\footnotesize\ttfamily int lrtr\+\_\+ip\+\_\+str\+\_\+to\+\_\+addr (\begin{DoxyParamCaption}\item[{const char \texorpdfstring{$\ast$}{*}}]{str,  }\item[{struct \mbox{\hyperlink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}} \texorpdfstring{$\ast$}{*}}]{ip }\end{DoxyParamCaption})}



{\ttfamily \#include $<$\mbox{\hyperlink{ip_8h}{rtrlib/lib/ip.\+h}}$>$}



Converts the passed IP address in string representation to an \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr}. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em str} & Pointer to a Null terminated char array. \\
\hline
\mbox{\texttt{ out}}  & {\em ip} & Pointer to a \doxylink{structlrtr__ip__addr}{lrtr\+\_\+ip\+\_\+addr} struct. \\
\hline
\end{DoxyParams}
\begin{DoxyReturn}{Returns}
0 On success. 

-\/1 On error. 
\end{DoxyReturn}
\Hypertarget{group__util__h_ga91aaafa31a937931b6db6cb2c480ae6e}\label{group__util__h_ga91aaafa31a937931b6db6cb2c480ae6e} 
\index{Utility functions@{Utility functions}!lrtr\_ipv4\_addr\_convert\_byte\_order@{lrtr\_ipv4\_addr\_convert\_byte\_order}}
\index{lrtr\_ipv4\_addr\_convert\_byte\_order@{lrtr\_ipv4\_addr\_convert\_byte\_order}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ipv4\_addr\_convert\_byte\_order()}{lrtr\_ipv4\_addr\_convert\_byte\_order()}}
{\footnotesize\ttfamily void lrtr\+\_\+ipv4\+\_\+addr\+\_\+convert\+\_\+byte\+\_\+order (\begin{DoxyParamCaption}\item[{const uint32\+\_\+t}]{src,  }\item[{uint32\+\_\+t \texorpdfstring{$\ast$}{*}}]{dest,  }\item[{const enum \mbox{\hyperlink{convert__byte__order__private_8h_ac7f9e54856274b72079ec96ab0e18fa1}{target\+\_\+byte\+\_\+order}}}]{tbo }\end{DoxyParamCaption})}



{\ttfamily \#include $<$\mbox{\hyperlink{ipv4__private_8h}{rtrlib/lib/ipv4\+\_\+private.\+h}}$>$}



\mbox{[}\{ 

Converts the passed IPv4 address to given byte order.


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em src} & IPv4 address in source byte order. \\
\hline
\mbox{\texttt{ out}}  & {\em dest} & IPv4 address in target byte order. \\
\hline
\mbox{\texttt{ in}}  & {\em tbo} & Target byte order for address conversion. \} \\
\hline
\end{DoxyParams}
\Hypertarget{group__util__h_gaf1180d77166d4f87f81541e752cdc4d6}\label{group__util__h_gaf1180d77166d4f87f81541e752cdc4d6} 
\index{Utility functions@{Utility functions}!lrtr\_ipv6\_addr\_convert\_byte\_order@{lrtr\_ipv6\_addr\_convert\_byte\_order}}
\index{lrtr\_ipv6\_addr\_convert\_byte\_order@{lrtr\_ipv6\_addr\_convert\_byte\_order}!Utility functions@{Utility functions}}
\doxysubsubsection{\texorpdfstring{lrtr\_ipv6\_addr\_convert\_byte\_order()}{lrtr\_ipv6\_addr\_convert\_byte\_order()}}
{\footnotesize\ttfamily void lrtr\+\_\+ipv6\+\_\+addr\+\_\+convert\+\_\+byte\+\_\+order (\begin{DoxyParamCaption}\item[{const uint32\+\_\+t \texorpdfstring{$\ast$}{*}}]{src,  }\item[{uint32\+\_\+t \texorpdfstring{$\ast$}{*}}]{dest,  }\item[{const enum \mbox{\hyperlink{convert__byte__order__private_8h_ac7f9e54856274b72079ec96ab0e18fa1}{target\+\_\+byte\+\_\+order}}}]{tbo }\end{DoxyParamCaption})}



{\ttfamily \#include $<$\mbox{\hyperlink{ipv6__private_8h}{rtrlib/lib/ipv6\+\_\+private.\+h}}$>$}



Converts the passed IPv6 address to given byte order. 


\begin{DoxyParams}[1]{Parameters}
\mbox{\texttt{ in}}  & {\em src} & IPv6 address (uint32\+\_\+t array) in source byte order. \\
\hline
\mbox{\texttt{ out}}  & {\em dest} & IPv6 address (uint32\+\_\+t array) in target byte order. \\
\hline
\mbox{\texttt{ in}}  & {\em tbo} & Target byte order for address conversion. \\
\hline
\end{DoxyParams}
