\section{Byte-swapping functions}
\label{group__KSWAP}\index{Byte-swapping functions@{Byte-swapping functions}}
{\bf kswap.h}{\rm (p.\,\pageref{kswap_8h})} contains functions that will help converting 16, 32 and 64 bit length data between little-endian and big-endian representations.  
\subsection*{Functions}
\begin{CompactItemize}
\item 
Q\_\-UINT16 {\bf KFrom\-To\-Big\-Endian} (Q\_\-UINT16 b)
\item 
void {\bf KFrom\-To\-Big\-Endian} (Q\_\-UINT16 $\ast$out, Q\_\-UINT16 $\ast$in, uint len)
\item 
Q\_\-UINT32 {\bf KFrom\-To\-Big\-Endian} (Q\_\-UINT32 b)
\item 
void {\bf KFrom\-To\-Big\-Endian} (Q\_\-UINT32 $\ast$out, Q\_\-UINT32 $\ast$in, uint len)
\item 
Q\_\-UINT64 {\bf KFrom\-To\-Big\-Endian} (Q\_\-UINT64 b)
\item 
void {\bf KFrom\-To\-Big\-Endian} (Q\_\-UINT64 $\ast$out, Q\_\-UINT64 $\ast$in, uint len)
\item 
Q\_\-INT16 {\bf KFrom\-To\-Big\-Endian} (Q\_\-INT16 b)
\item 
void {\bf KFrom\-To\-Big\-Endian} (Q\_\-INT16 $\ast$out, Q\_\-INT16 $\ast$in, uint len)
\item 
Q\_\-INT32 {\bf KFrom\-To\-Big\-Endian} (Q\_\-INT32 b)
\item 
void {\bf KFrom\-To\-Big\-Endian} (Q\_\-INT32 $\ast$out, Q\_\-INT32 $\ast$in, uint len)
\item 
Q\_\-INT64 {\bf KFrom\-To\-Big\-Endian} (Q\_\-INT64 b)
\item 
void {\bf KFrom\-To\-Big\-Endian} (Q\_\-INT64 $\ast$out, Q\_\-INT64 $\ast$in, uint len)
\item 
Q\_\-UINT16 {\bf KFrom\-To\-Little\-Endian} (Q\_\-UINT16 b)
\item 
void {\bf KFrom\-To\-Little\-Endian} (Q\_\-UINT16 $\ast$out, Q\_\-UINT16 $\ast$in, uint len)
\item 
Q\_\-UINT32 {\bf KFrom\-To\-Little\-Endian} (Q\_\-UINT32 b)
\item 
void {\bf KFrom\-To\-Little\-Endian} (Q\_\-UINT32 $\ast$out, Q\_\-UINT32 $\ast$in, uint len)
\item 
Q\_\-UINT64 {\bf KFrom\-To\-Little\-Endian} (Q\_\-UINT64 b)
\item 
void {\bf KFrom\-To\-Little\-Endian} (Q\_\-UINT64 $\ast$out, Q\_\-UINT64 $\ast$in, uint len)
\item 
Q\_\-INT16 {\bf KFrom\-To\-Little\-Endian} (Q\_\-INT16 b)
\item 
void {\bf KFrom\-To\-Little\-Endian} (Q\_\-INT16 $\ast$out, Q\_\-INT16 $\ast$in, uint len)
\item 
Q\_\-INT32 {\bf KFrom\-To\-Little\-Endian} (Q\_\-INT32 b)
\item 
void {\bf KFrom\-To\-Little\-Endian} (Q\_\-INT32 $\ast$out, Q\_\-INT32 $\ast$in, uint len)
\item 
Q\_\-INT64 {\bf KFrom\-To\-Little\-Endian} (Q\_\-INT64 b)
\item 
void {\bf KFrom\-To\-Little\-Endian} (Q\_\-INT64 $\ast$out, Q\_\-INT64 $\ast$in, uint len)
\end{CompactItemize}


\subsection{Detailed Description}
{\bf kswap.h}{\rm (p.\,\pageref{kswap_8h})} contains functions that will help converting 16, 32 and 64 bit length data between little-endian and big-endian representations. 

The KSWAP\_\-16, KSWAP\_\-32 and KSWAP\_\-64 functions are always swaps the byte order of the supplied argument (which should be 16, 32 or 64 bit wide). These functions are inline, and tries to use the most optimized function of the underlying system (bswap\_\-xx functions from byteswap.h in GLIBC, or ntohs and ntohl on little-endian machines, and if neither are applicable, some fast custom code).

The KFrom\-To\{Little$|$Big\}Endian functions are for converting big-endian and little-endian data to and from the machine endianness. 

\subsection{Function Documentation}
\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-UINT16 KFrom\-To\-Big\-Endian (Q\_\-UINT16 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga0}


Converts a 16 bit unsigned value from/to big-endian byte order to/from the machine order. 

Definition at line 120 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Big\-Endian (Q\_\-UINT16 $\ast$ {\em out}, Q\_\-UINT16 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga1}


Converts a 16 bit unsigned array from/to big-endian byte order to/from the machine order. 

Definition at line 133 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-UINT32 KFrom\-To\-Big\-Endian (Q\_\-UINT32 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga2}


Converts a 32 bit unsigned value from/to big-endian byte order to/from the machine order. 

Definition at line 146 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Big\-Endian (Q\_\-UINT32 $\ast$ {\em out}, Q\_\-UINT32 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga3}


Converts a 32 bit unsigned array from/to big-endian byte order to/from the machine order. 

Definition at line 159 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-UINT64 KFrom\-To\-Big\-Endian (Q\_\-UINT64 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga4}


Converts a 64 bit unsigned value from/to big-endian byte order to/from the machine order. 

Definition at line 172 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Big\-Endian (Q\_\-UINT64 $\ast$ {\em out}, Q\_\-UINT64 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga5}


Converts a 64 bit unsigned array from/to big-endian byte order to/from the machine order. 

Definition at line 185 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-INT16 KFrom\-To\-Big\-Endian (Q\_\-INT16 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga6}


Converts a 16 bit signed value from/to big-endian byte order to/from the machine order. 

Definition at line 198 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Big\-Endian (Q\_\-INT16 $\ast$ {\em out}, Q\_\-INT16 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga7}


Converts a 16 bit signed array from/to big-endian byte order to/from the machine order. 

Definition at line 211 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-INT32 KFrom\-To\-Big\-Endian (Q\_\-INT32 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga8}


Converts a 32 bit signed value from/to big-endian byte order to/from the machine order. 

Definition at line 224 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Big\-Endian (Q\_\-INT32 $\ast$ {\em out}, Q\_\-INT32 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga9}


Converts a 32 bit signed array from/to big-endian byte order to/from the machine order. 

Definition at line 237 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-INT64 KFrom\-To\-Big\-Endian (Q\_\-INT64 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga10}


Converts a 64 bit signed value from/to big-endian byte order to/from the machine order. 

Definition at line 250 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToBigEndian@{KFromToBigEndian}}
\index{KFromToBigEndian@{KFromToBigEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Big\-Endian (Q\_\-INT64 $\ast$ {\em out}, Q\_\-INT64 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga11}


Converts a 64 bit signed array from/to big-endian byte order to/from the machine order. 

Definition at line 263 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-UINT16 KFrom\-To\-Little\-Endian (Q\_\-UINT16 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga12}


Converts a 16 bit unsigned value from/to little-endian byte order to/from the machine order. 

Definition at line 276 of file kswap.h.

Referenced by KNTLM::get\-Auth(), and KNTLM::get\-Negotiate().\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Little\-Endian (Q\_\-UINT16 $\ast$ {\em out}, Q\_\-UINT16 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga13}


Converts a 16 bit unsigned array from/to little-endian byte order to/from the machine order. 

Definition at line 289 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-UINT32 KFrom\-To\-Little\-Endian (Q\_\-UINT32 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga14}


Converts a 32 bit unsigned value from/to little-endian byte order to/from the machine order. 

Definition at line 302 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Little\-Endian (Q\_\-UINT32 $\ast$ {\em out}, Q\_\-UINT32 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga15}


Converts a 32 bit unsigned array from/to little-endian byte order to/from the machine order. 

Definition at line 315 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-UINT64 KFrom\-To\-Little\-Endian (Q\_\-UINT64 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga16}


Converts a 64 bit unsigned value from/to little-endian byte order to/from the machine order. 

Definition at line 328 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Little\-Endian (Q\_\-UINT64 $\ast$ {\em out}, Q\_\-UINT64 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga17}


Converts a 64 bit unsigned array from/to little-endian byte order to/from the machine order. 

Definition at line 341 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-INT16 KFrom\-To\-Little\-Endian (Q\_\-INT16 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga18}


Converts a 16 bit signed value from/to little-endian byte order to/from the machine order. 

Definition at line 354 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Little\-Endian (Q\_\-INT16 $\ast$ {\em out}, Q\_\-INT16 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga19}


Converts a 16 bit signed array from/to little-endian byte order to/from the machine order. 

Definition at line 367 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-INT32 KFrom\-To\-Little\-Endian (Q\_\-INT32 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga20}


Converts a 32 bit signed value from/to little-endian byte order to/from the machine order. 

Definition at line 380 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Little\-Endian (Q\_\-INT32 $\ast$ {\em out}, Q\_\-INT32 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga21}


Converts a 32 bit signed array from/to little-endian byte order to/from the machine order. 

Definition at line 393 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}Q\_\-INT64 KFrom\-To\-Little\-Endian (Q\_\-INT64 {\em b})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga22}


Converts a 64 bit signed value from/to little-endian byte order to/from the machine order. 

Definition at line 406 of file kswap.h.\index{KSWAP@{KSWAP}!KFromToLittleEndian@{KFromToLittleEndian}}
\index{KFromToLittleEndian@{KFromToLittleEndian}!KSWAP@{KSWAP}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void KFrom\-To\-Little\-Endian (Q\_\-INT64 $\ast$ {\em out}, Q\_\-INT64 $\ast$ {\em in}, uint {\em len})\hspace{0.3cm}{\tt  [inline]}}\label{group__KSWAP_ga23}


Converts a 64 bit signed array from/to little-endian byte order to/from the machine order. 

Definition at line 419 of file kswap.h.