\hypertarget{nmsgLib_8h}{
\section{nmsg\-Lib.h File Reference}
\label{nmsgLib_8h}\index{nmsgLib.h@{nmsgLib.h}}
}
Definitions for the network message routines.  


{\tt \#include \char`\"{}vx\-Works.h\char`\"{}}\par


Include dependency graph for nmsg\-Lib.h:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=50pt]{nmsgLib_8h__incl}
\end{center}
\end{figure}


This graph shows which files directly or indirectly include this file:\begin{figure}[H]
\begin{center}
\leavevmode
\includegraphics[width=48pt]{nmsgLib_8h__dep__incl}
\end{center}
\end{figure}
\subsection*{Data Structures}
\begin{CompactItemize}
\item 
struct \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-s}
\begin{CompactList}\small\item\em Prototype message buffer. \item\end{CompactList}\item 
struct \hyperlink{structnmsgHead__s}{nmsg\-Head\_\-s}
\begin{CompactList}\small\item\em Network message header. \item\end{CompactList}\end{CompactItemize}
\subsection*{Typedefs}
\begin{CompactItemize}
\item 
\hypertarget{nmsgLib_8h_a0}{
typedef \hyperlink{structnmsgHead__s}{nmsg\-Head\_\-s} \hyperlink{nmsgLib_8h_a0}{nmsg\-Head\_\-t}}
\label{nmsgLib_8h_a0}

\begin{CompactList}\small\item\em Network message header. \item\end{CompactList}\item 
\hypertarget{nmsgLib_8h_a1}{
typedef \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-s} \hyperlink{nmsgLib_8h_a1}{nmsg\-Buff\_\-t}}
\label{nmsgLib_8h_a1}

\begin{CompactList}\small\item\em Prototype message buffer. \item\end{CompactList}\end{CompactItemize}
\subsection*{Functions}
\begin{CompactItemize}
\item 
STATUS \hyperlink{nmsgLib_8h_a2}{nmsg\-Connect} (void $\ast$$\ast$hndl, char $\ast$node, int port)
\begin{CompactList}\small\item\em Connect to a message server. \item\end{CompactList}\item 
STATUS \hyperlink{nmsgLib_8h_a3}{nmsg\-Connect\-Asy} (void $\ast$$\ast$hndl, char $\ast$node, int port, int($\ast$conn\-Rtn)(void $\ast$hndl, void $\ast$$\ast$u\-Parm), int($\ast$disc\-Rtn)(void $\ast$hndl, void $\ast$$\ast$u\-Parm), void $\ast$u\-Parm)
\begin{CompactList}\small\item\em Connect asynchronously (robustly) to a message server. \item\end{CompactList}\item 
STATUS \hyperlink{nmsgLib_8h_a4}{nmsg\-Listen} (void $\ast$$\ast$hndl, int port, int max\-Conn, int max\-Data, int($\ast$conn\-Rtn)(void $\ast$hndl, void $\ast$$\ast$u\-Parm), int($\ast$disc\-Rtn)(void $\ast$hndl, void $\ast$$\ast$u\-Parm), int($\ast$rcve\-Rtn)(void $\ast$hndl, void $\ast$$\ast$u\-Parm, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$msg), void $\ast$u\-Parm)
\begin{CompactList}\small\item\em Establish a message server. \item\end{CompactList}\item 
STATUS \hyperlink{nmsgLib_8h_a5}{nmsg\-Close} (void $\ast$hndl, int force)
\begin{CompactList}\small\item\em Terminate a message client or server. \item\end{CompactList}\item 
STATUS \hyperlink{nmsgLib_8h_a6}{nmsg\-Send\-W} (void $\ast$hndl, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$msg, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$reply, int max\-Data)
\begin{CompactList}\small\item\em Send a message and receive reply. \item\end{CompactList}\item 
STATUS \hyperlink{nmsgLib_8h_a7}{nmsg\-Send} (void $\ast$hndl, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$msg)
\begin{CompactList}\small\item\em Send a message and return immediately. \item\end{CompactList}\item 
STATUS \hyperlink{nmsgLib_8h_a8}{nmsg\-Wait} (void $\ast$hndl, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$reply, int max\-Data)
\begin{CompactList}\small\item\em Wait for a reply to a sent message. \item\end{CompactList}\item 
int \hyperlink{nmsgLib_8h_a9}{nmsg\-Remote\-IP} (void $\ast$hndl)
\begin{CompactList}\small\item\em Get the IP address of the remote end. \item\end{CompactList}\item 
int \hyperlink{nmsgLib_8h_a10}{nmsg\-Check} (void $\ast$hndl)
\begin{CompactList}\small\item\em Check a network connection handle. \item\end{CompactList}\end{CompactItemize}


\subsection{Detailed Description}
Definitions for the network message routines. 

\begin{Desc}
\item[Author:]Owen H Saxton\end{Desc}
\begin{Desc}
\item[Id]\hyperlink{nmsgLib_8h}{nmsg\-Lib.h},v 1.4 2004/12/08 23:47:10 saxton Exp \end{Desc}


\subsection{Function Documentation}
\hypertarget{nmsgLib_8h_a10}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgCheck@{nmsgCheck}}
\index{nmsgCheck@{nmsgCheck}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgCheck]{\setlength{\rightskip}{0pt plus 5cm}int nmsg\-Check (void $\ast$ {\em hndl})}}
\label{nmsgLib_8h_a10}


Check a network connection handle. 

This routine checks whether a network handle is valid or not.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The handle for the connection.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em TRUE}]The handle is valid.\item[{\em FALSE}]The handle is invalid. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a5}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgClose@{nmsgClose}}
\index{nmsgClose@{nmsgClose}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgClose]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Close (void $\ast$ {\em hndl}, int {\em force})}}
\label{nmsgLib_8h_a5}


Terminate a message client or server. 

This routine closes a network connection or stops a network server.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The handle of the connection or server.\item[{\em force}]For a client connection, if TRUE, the connection is closed even if another task is in the process of sending a message. If FALSE, the closing waits until any activity has ceased. Not used for a server.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]Success.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a2}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgConnect@{nmsgConnect}}
\index{nmsgConnect@{nmsgConnect}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgConnect]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Connect (void $\ast$$\ast$ {\em hndl}, char $\ast$ {\em node}, int {\em port})}}
\label{nmsgLib_8h_a2}


Connect to a message server. 

This routine establishes a network connection to a message server.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The address of a pointer to receive the identifying handle for the network connection.\item[{\em node}]The address of the name of the node containing the message server.\item[{\em port}]The port number on which to establish the connection.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]The connection was established successfully.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a3}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgConnectAsy@{nmsgConnectAsy}}
\index{nmsgConnectAsy@{nmsgConnectAsy}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgConnectAsy]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Connect\-Asy (void $\ast$$\ast$ {\em hndl}, char $\ast$ {\em node}, int {\em port}, int($\ast$ {\em conn\-Rtn})(void $\ast$hndl, void $\ast$$\ast$u\-Parm), int($\ast$ {\em disc\-Rtn})(void $\ast$hndl, void $\ast$$\ast$u\-Parm), void $\ast$ {\em u\-Parm})}}
\label{nmsgLib_8h_a3}


Connect asynchronously (robustly) to a message server. 

This routine establishes a robust network connection to a message server. The connection is done asynchronously, and the attempt is retried periodically if the initial attempt fails, or if the connection is broken.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The address of a pointer to receive the identifying handle for the network connection.\item[{\em node}]The address of the name of the node containing the message server.\item[{\em port}]The port number on which to establish the connection.\item[{\em conn\-Rtn}]The address of a routine to be called when the connection has been made.\item[{\em disc\-Rtn}]The address of a routine to be called when the connection is broken.\item[{\em u\-Parm}]A parameter to be passed to the connect and disconnect callback routines.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]The connection process was started successfully.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a4}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgListen@{nmsgListen}}
\index{nmsgListen@{nmsgListen}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgListen]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Listen (void $\ast$$\ast$ {\em hndl}, int {\em port}, int {\em max\-Conn}, int {\em max\-Data}, int($\ast$ {\em conn\-Rtn})(void $\ast$hndl, void $\ast$$\ast$u\-Parm), int($\ast$ {\em disc\-Rtn})(void $\ast$hndl, void $\ast$$\ast$u\-Parm), int($\ast$ {\em rcve\-Rtn})(void $\ast$hndl, void $\ast$$\ast$u\-Parm, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$msg), void $\ast$ {\em u\-Parm})}}
\label{nmsgLib_8h_a4}


Establish a message server. 

This routine establishes a network message server (listener).

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The address of a pointer to receive the identifying handle for the network listener.\item[{\em port}]The port number on which to establish the server.\item[{\em max\-Conn}]The maximum number of concurrent connections that the server will allow.\item[{\em max\-Data}]The maximum number of data bytes that can be transferred in a single message.\item[{\em conn\-Rtn}]The address of a routine to be called when a new connection has been made. The connection will be rejected if this routine returns ERROR status.\item[{\em disc\-Rtn}]The address of a routine to be called when a connection is broken.\item[{\em rcve\-Rtn}]The address of a routine to be called whenever a message is received.\item[{\em u\-Parm}]A parameter to be passed to the connect, disconnect and receive callback routines.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]The message server was started successfully.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a9}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgRemoteIP@{nmsgRemoteIP}}
\index{nmsgRemoteIP@{nmsgRemoteIP}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgRemoteIP]{\setlength{\rightskip}{0pt plus 5cm}int nmsg\-Remote\-IP (void $\ast$ {\em hndl})}}
\label{nmsgLib_8h_a9}


Get the IP address of the remote end. 

This routine returns the IP address of the remote end of a connection. It can be used on either end of a connection.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The handle for the connection.\end{description}
\end{Desc}
\begin{Desc}
\item[Returns:]The IP address of the remote end of the connection. \end{Desc}
\hypertarget{nmsgLib_8h_a7}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgSend@{nmsgSend}}
\index{nmsgSend@{nmsgSend}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgSend]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Send (void $\ast$ {\em hndl}, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$ {\em msg})}}
\label{nmsgLib_8h_a7}


Send a message and return immediately. 

This routine sends a message on a network connection and returns without waiting for a reply.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The handle for the connection.\item[{\em msg}]The address of message to be sent. It must be formatted using the nmsg\-Buff\_\-t structure type.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]Success.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a6}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgSendW@{nmsgSendW}}
\index{nmsgSendW@{nmsgSendW}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgSendW]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Send\-W (void $\ast$ {\em hndl}, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$ {\em msg}, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$ {\em reply}, int {\em max\-Data})}}
\label{nmsgLib_8h_a6}


Send a message and receive reply. 

This routine sends a message on a network connection and waits for a reply.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The handle for the connection.\item[{\em msg}]The address of message to be sent. It must be formatted using the nmsg\-Buff\_\-t structure type.\item[{\em reply}]The address of an area to receive the reply to the message. It will be formatted using the nmsg\-Buff\_\-t structure type.\item[{\em max\-Data}]The maximum number of data bytes that can be put into the reply.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]Success.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
\hypertarget{nmsgLib_8h_a8}{
\index{nmsgLib.h@{nmsg\-Lib.h}!nmsgWait@{nmsgWait}}
\index{nmsgWait@{nmsgWait}!nmsgLib.h@{nmsg\-Lib.h}}
\subsubsection[nmsgWait]{\setlength{\rightskip}{0pt plus 5cm}STATUS nmsg\-Wait (void $\ast$ {\em hndl}, \hyperlink{structnmsgBuff__s}{nmsg\-Buff\_\-t} $\ast$ {\em reply}, int {\em max\-Data})}}
\label{nmsgLib_8h_a8}


Wait for a reply to a sent message. 

This routine waits for a reply to a previously sent message.

\begin{Desc}
\item[Parameters:]
\begin{description}
\item[{\em hndl}]The handle for the connection.\item[{\em reply}]The address of an area to receive the reply to the message. It will be formatted using the nmsg\-Buff\_\-t structure type.\item[{\em max\-Data}]The maximum number of data bytes that can be put into the reply.\end{description}
\end{Desc}
\begin{Desc}
\item[Return values:]
\begin{description}
\item[{\em OK}]Success.\item[{\em ERROR}]An error occurred. \end{description}
\end{Desc}
