\section{liblnp.cpp File Reference}
\label{liblnp_8cpp}\index{liblnp.cpp@{liblnp.cpp}}
{\tt \#include $<$cstdio$>$}\par
{\tt \#include $<$ctime$>$}\par
{\tt \#include $<$atlbase.h$>$}\par
{\tt \#include \char`\"{}liblnp.h\char`\"{}}\par
\subsection*{Defines}
\begin{CompactItemize}
\item 
\#define {\bf DEBUGLNP}~0
\item 
\#define {\bf LNPCHECKSOMSTOP}~0
\item 
\#define {\bf LNPBLOCK}~0
\item 
\#define {\bf DEFAULT\_\-LNP\_\-ADDR}~0x80
\item 
\#define {\bf DEFAULT\_\-LNP\_\-MASK}~0xf0
\item 
\#define {\bf MAX\_\-LNP\_\-PACKET}~(256+3)
\item 
\#define {\bf TOWER\_\-KEEP\_\-ALIVE\_\-CHAR}~0x\-FF
\item 
\#define {\bf TOWER\_\-KEEP\_\-ALIVE\_\-DELAY}~2000
\item 
\#define {\bf BAUDRATE}~4800
\item 
\#define {\bf STOPBITS}~0
\item 
\#define {\bf PARITY}~0
\item 
\#define {\bf BYTESIZE}~8
\item 
\#define {\bf READTIMEOUT}~2000
\item 
\#define {\bf AFTERWRITESLEEPTIME}~500
\end{CompactItemize}
\subsection*{Enumerations}
\begin{CompactItemize}
\item 
enum {\bf lnp\_\-integrity\_\-state\_\-t} \{ {\bf LNPwait\-Header}, 
{\bf LNPwait\-Length}, 
{\bf LNPwait\-Data}, 
{\bf LNPwait\-CRC}
 \}
\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
void {\bf lnp\_\-shutdown} (void)
\item 
bool {\bf lnp\_\-test} (void)
\item 
{\bf lnp\_\-tx\_\-result} {\bf lnp\_\-integrity\_\-write} (const unsigned char $\ast$data, unsigned char length)
\item 
{\bf lnp\_\-tx\_\-result} {\bf lnp\_\-addressing\_\-write} (const unsigned char $\ast$data, unsigned char length, unsigned char dest, unsigned char srcport)
\item 
void {\bf lnp\_\-integrity\_\-set\_\-handler} ({\bf lnp\_\-integrity\_\-handler\_\-t} handler)
\item 
void {\bf lnp\_\-addressing\_\-set\_\-handler} (unsigned char port, {\bf lnp\_\-addressing\_\-handler\_\-t} handler)
\item 
void {\bf lnp\_\-receive\_\-packet} (const unsigned char $\ast$data)
\item 
void {\bf lnp\_\-integrity\_\-byte} (unsigned char b)
\item 
{\bf lnp\_\-init\_\-result} {\bf lnp\_\-init} (char $\ast$tcp\_\-hostname, unsigned short tcp\_\-port, unsigned char lnp\_\-address, unsigned char lnp\_\-mask, int flags)
\end{CompactItemize}


\subsection{Define Documentation}
\index{liblnp.cpp@{liblnp.cpp}!AFTERWRITESLEEPTIME@{AFTERWRITESLEEPTIME}}
\index{AFTERWRITESLEEPTIME@{AFTERWRITESLEEPTIME}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define AFTERWRITESLEEPTIME~500}\label{liblnp_8cpp_8d25c5e077344cb96da57ac1d4859726}




Definition at line 73 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!BAUDRATE@{BAUDRATE}}
\index{BAUDRATE@{BAUDRATE}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define BAUDRATE~4800}\label{liblnp_8cpp_734bbab06e1a9fd2e5522db0221ff6e3}




Definition at line 64 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!BYTESIZE@{BYTESIZE}}
\index{BYTESIZE@{BYTESIZE}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define BYTESIZE~8}\label{liblnp_8cpp_d0505b0797fd0c921b9e5c0968bcb8db}




Definition at line 67 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!DEBUGLNP@{DEBUGLNP}}
\index{DEBUGLNP@{DEBUGLNP}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define DEBUGLNP~0}\label{liblnp_8cpp_39858e1fb822910e75ea85873ee834ce}




Definition at line 47 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!DEFAULT_LNP_ADDR@{DEFAULT\_\-LNP\_\-ADDR}}
\index{DEFAULT_LNP_ADDR@{DEFAULT\_\-LNP\_\-ADDR}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define DEFAULT\_\-LNP\_\-ADDR~0x80}\label{liblnp_8cpp_dd8e14cd9a593d59fcc32ae646cea20b}




Definition at line 54 of file liblnp.cpp.

Referenced by lnp\_\-init().\index{liblnp.cpp@{liblnp.cpp}!DEFAULT_LNP_MASK@{DEFAULT\_\-LNP\_\-MASK}}
\index{DEFAULT_LNP_MASK@{DEFAULT\_\-LNP\_\-MASK}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define DEFAULT\_\-LNP\_\-MASK~0xf0}\label{liblnp_8cpp_bc9e496af10afdc7e1d3c2b91464cb33}




Definition at line 55 of file liblnp.cpp.

Referenced by lnp\_\-init().\index{liblnp.cpp@{liblnp.cpp}!LNPBLOCK@{LNPBLOCK}}
\index{LNPBLOCK@{LNPBLOCK}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LNPBLOCK~0}\label{liblnp_8cpp_4166fce0a6c22db336decda1268c974c}




Definition at line 49 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!LNPCHECKSOMSTOP@{LNPCHECKSOMSTOP}}
\index{LNPCHECKSOMSTOP@{LNPCHECKSOMSTOP}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define LNPCHECKSOMSTOP~0}\label{liblnp_8cpp_2d59a0e432351862fb85879fa393b433}




Definition at line 48 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!MAX_LNP_PACKET@{MAX\_\-LNP\_\-PACKET}}
\index{MAX_LNP_PACKET@{MAX\_\-LNP\_\-PACKET}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define MAX\_\-LNP\_\-PACKET~(256+3)}\label{liblnp_8cpp_b1a58a78fc306282ef63647c0ce9dc81}




Definition at line 56 of file liblnp.cpp.

Referenced by lnp\_\-integrity\_\-byte().\index{liblnp.cpp@{liblnp.cpp}!PARITY@{PARITY}}
\index{PARITY@{PARITY}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define PARITY~0}\label{liblnp_8cpp_f6996d12e71a534569c41a25de7d6d52}




Definition at line 66 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!READTIMEOUT@{READTIMEOUT}}
\index{READTIMEOUT@{READTIMEOUT}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define READTIMEOUT~2000}\label{liblnp_8cpp_d030137ebba0d7ab7c1b93a6bc450b0e}




Definition at line 71 of file liblnp.cpp.

Referenced by lnp\_\-integrity\_\-byte().\index{liblnp.cpp@{liblnp.cpp}!STOPBITS@{STOPBITS}}
\index{STOPBITS@{STOPBITS}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define STOPBITS~0}\label{liblnp_8cpp_a5d0b84610803adad91c781c7a51be82}




Definition at line 65 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!TOWER_KEEP_ALIVE_CHAR@{TOWER\_\-KEEP\_\-ALIVE\_\-CHAR}}
\index{TOWER_KEEP_ALIVE_CHAR@{TOWER\_\-KEEP\_\-ALIVE\_\-CHAR}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define TOWER\_\-KEEP\_\-ALIVE\_\-CHAR~0x\-FF}\label{liblnp_8cpp_b8d13415619988bf6c60ee7fa4257673}




Definition at line 59 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!TOWER_KEEP_ALIVE_DELAY@{TOWER\_\-KEEP\_\-ALIVE\_\-DELAY}}
\index{TOWER_KEEP_ALIVE_DELAY@{TOWER\_\-KEEP\_\-ALIVE\_\-DELAY}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}\#define TOWER\_\-KEEP\_\-ALIVE\_\-DELAY~2000}\label{liblnp_8cpp_128d91c58c6c3c6cb5f15275a9423e88}




Definition at line 60 of file liblnp.cpp.

\subsection{Enumeration Type Documentation}
\index{liblnp.cpp@{liblnp.cpp}!lnp_integrity_state_t@{lnp\_\-integrity\_\-state\_\-t}}
\index{lnp_integrity_state_t@{lnp\_\-integrity\_\-state\_\-t}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}enum {\bf lnp\_\-integrity\_\-state\_\-t}}\label{liblnp_8cpp_4cf57a1bc16cb928578c0273f28e990e}


\begin{Desc}
\item[Enumerator: ]\par
\begin{description}
\index{LNPwaitHeader@{LNPwaitHeader}!liblnp.cpp@{liblnp.cpp}}\index{liblnp.cpp@{liblnp.cpp}!LNPwaitHeader@{LNPwaitHeader}}\item[{\em 
LNPwait\-Header\label{liblnp_8cpp_4cf57a1bc16cb928578c0273f28e990e55f097ea1b16b8a29211ea03319841b6}
}]\index{LNPwaitLength@{LNPwaitLength}!liblnp.cpp@{liblnp.cpp}}\index{liblnp.cpp@{liblnp.cpp}!LNPwaitLength@{LNPwaitLength}}\item[{\em 
LNPwait\-Length\label{liblnp_8cpp_4cf57a1bc16cb928578c0273f28e990e45e868af242be47fb3c0fa1f4a447117}
}]\index{LNPwaitData@{LNPwaitData}!liblnp.cpp@{liblnp.cpp}}\index{liblnp.cpp@{liblnp.cpp}!LNPwaitData@{LNPwaitData}}\item[{\em 
LNPwait\-Data\label{liblnp_8cpp_4cf57a1bc16cb928578c0273f28e990e9255e9a0d3143e08a2b0a6078fc482d7}
}]\index{LNPwaitCRC@{LNPwaitCRC}!liblnp.cpp@{liblnp.cpp}}\index{liblnp.cpp@{liblnp.cpp}!LNPwaitCRC@{LNPwaitCRC}}\item[{\em 
LNPwait\-CRC\label{liblnp_8cpp_4cf57a1bc16cb928578c0273f28e990ef17e11d9c1a9c994967e30596bbdff95}
}]\end{description}
\end{Desc}



Definition at line 100 of file liblnp.cpp.

\subsection{Function Documentation}
\index{liblnp.cpp@{liblnp.cpp}!lnp_addressing_set_handler@{lnp\_\-addressing\_\-set\_\-handler}}
\index{lnp_addressing_set_handler@{lnp\_\-addressing\_\-set\_\-handler}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lnp\_\-addressing\_\-set\_\-handler (unsigned char {\em port}, {\bf lnp\_\-addressing\_\-handler\_\-t} {\em handler})}\label{liblnp_8cpp_a51be5e31dcf22ec05289025c941db5f}




Definition at line 312 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!lnp_addressing_write@{lnp\_\-addressing\_\-write}}
\index{lnp_addressing_write@{lnp\_\-addressing\_\-write}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf lnp\_\-tx\_\-result} lnp\_\-addressing\_\-write (const unsigned char $\ast$ {\em data}, unsigned char {\em length}, unsigned char {\em dest}, unsigned char {\em srcport})}\label{liblnp_8cpp_6e548337170e77b577bf20a7ea29b9a0}




Definition at line 274 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!lnp_init@{lnp\_\-init}}
\index{lnp_init@{lnp\_\-init}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf lnp\_\-init\_\-result} lnp\_\-init (char $\ast$ {\em tcp\_\-hostname}, unsigned short {\em tcp\_\-port}, unsigned char {\em lnp\_\-address}, unsigned char {\em lnp\_\-mask}, int {\em flags})}\label{liblnp_8cpp_58ab3032ab44c66839d61df6959f87e3}




Definition at line 818 of file liblnp.cpp.

References DEFAULT\_\-LNP\_\-ADDR, DEFAULT\_\-LNP\_\-MASK, INIT\_\-BAD\_\-PARAM, INIT\_\-ERROR, INIT\_\-OK, lnp\_\-shutdown(), lnp\_\-test(), and LNPwait\-Header.

Referenced by init\_\-com().\index{liblnp.cpp@{liblnp.cpp}!lnp_integrity_byte@{lnp\_\-integrity\_\-byte}}
\index{lnp_integrity_byte@{lnp\_\-integrity\_\-byte}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lnp\_\-integrity\_\-byte (unsigned char {\em b})}\label{liblnp_8cpp_1009811d8ff82654344ecc35ea36bd36}




Definition at line 397 of file liblnp.cpp.

References lnp\_\-receive\_\-packet(), LNPwait\-CRC, LNPwait\-Data, LNPwait\-Header, LNPwait\-Length, MAX\_\-LNP\_\-PACKET, and READTIMEOUT.\index{liblnp.cpp@{liblnp.cpp}!lnp_integrity_set_handler@{lnp\_\-integrity\_\-set\_\-handler}}
\index{lnp_integrity_set_handler@{lnp\_\-integrity\_\-set\_\-handler}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lnp\_\-integrity\_\-set\_\-handler ({\bf lnp\_\-integrity\_\-handler\_\-t} {\em handler})}\label{liblnp_8cpp_61742657139e498b9379dfd1bb36271e}




Definition at line 294 of file liblnp.cpp.

Referenced by init\_\-com().\index{liblnp.cpp@{liblnp.cpp}!lnp_integrity_write@{lnp\_\-integrity\_\-write}}
\index{lnp_integrity_write@{lnp\_\-integrity\_\-write}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}{\bf lnp\_\-tx\_\-result} lnp\_\-integrity\_\-write (const unsigned char $\ast$ {\em data}, unsigned char {\em length})}\label{liblnp_8cpp_ae649f5d602c773e8fc9ab2d6a4f4bda}




Definition at line 259 of file liblnp.cpp.\index{liblnp.cpp@{liblnp.cpp}!lnp_receive_packet@{lnp\_\-receive\_\-packet}}
\index{lnp_receive_packet@{lnp\_\-receive\_\-packet}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lnp\_\-receive\_\-packet (const unsigned char $\ast$ {\em data})}\label{liblnp_8cpp_9c0f178424c13ca513418b772bf6e8ac}




Definition at line 332 of file liblnp.cpp.

Referenced by lnp\_\-integrity\_\-byte().\index{liblnp.cpp@{liblnp.cpp}!lnp_shutdown@{lnp\_\-shutdown}}
\index{lnp_shutdown@{lnp\_\-shutdown}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}void lnp\_\-shutdown (void)}\label{liblnp_8cpp_080d0f7e5b9d37daf0a3b5dc753d7492}




Definition at line 170 of file liblnp.cpp.

References LNPwait\-Header.

Referenced by lnp\_\-init().\index{liblnp.cpp@{liblnp.cpp}!lnp_test@{lnp\_\-test}}
\index{lnp_test@{lnp\_\-test}!liblnp.cpp@{liblnp.cpp}}
\subsubsection{\setlength{\rightskip}{0pt plus 5cm}bool lnp\_\-test (void)}\label{liblnp_8cpp_2341b68c4a7cef0fb17f8a275717b51f}




Definition at line 201 of file liblnp.cpp.

Referenced by lnp\_\-init().