\hypertarget{sampUtil_8c}{ \section{sampUtil.c File Reference} \label{sampUtil_8c}\index{sampUtil.c@{sampUtil.c}} } Utility methods to convert struct pointers to user handles. {\tt \#include $<$stdlib.h$>$}\par {\tt \#include $<$stdio.h$>$}\par {\tt \#include $<$unistd.h$>$}\par {\tt \#include $<$string.h$>$}\par {\tt \#include $<$time.h$>$}\par {\tt \#include $<$ctype.h$>$}\par {\tt \#include \char`\"{}samp.h\char`\"{}}\par \subsection*{Defines} \begin{CompactItemize} \item \hypertarget{sampUtil_8c_23ed8e629c0a28eab14f92c888c8d7ef}{ \#define \textbf{MAX\_\-HANDLES}~128} \label{sampUtil_8c_23ed8e629c0a28eab14f92c888c8d7ef} \end{CompactItemize} \subsection*{Functions} \begin{CompactItemize} \item \hypertarget{sampUtil_8c_4d0aef2f09b9cce38d4ea8024831c6e5}{ handle\_\-t \textbf{samp\_\-P2H} (void $\ast$ptr)} \label{sampUtil_8c_4d0aef2f09b9cce38d4ea8024831c6e5} \item \hypertarget{sampUtil_8c_909310a995650c224515c9ca0a3ef582}{ void $\ast$ \textbf{samp\_\-H2P} (handle\_\-t handle)} \label{sampUtil_8c_909310a995650c224515c9ca0a3ef582} \item \hypertarget{sampUtil_8c_711aa545f55e9307f662062deefd5903}{ handle\_\-t \textbf{samp\_\-newHandle} (void $\ast$ptr)} \label{sampUtil_8c_711aa545f55e9307f662062deefd5903} \item \hypertarget{sampUtil_8c_f02a7c646a9ed56e545d8bf33434c207}{ void \textbf{samp\_\-freeHandle} (handle\_\-t handle)} \label{sampUtil_8c_f02a7c646a9ed56e545d8bf33434c207} \item char $\ast$ \hyperlink{sampUtil_8c_aed9017996a8361f8abf5b5c6a954414}{samp\_\-app2id} (handle\_\-t handle, char $\ast$appName) \begin{CompactList}\small\item\em Convert an application name to a public-ID. \item\end{CompactList}\item char $\ast$ \hyperlink{sampUtil_8c_a75368198ec8cd2fff6ad304806862b8}{samp\_\-id2app} (handle\_\-t handle, char $\ast$pubId) \begin{CompactList}\small\item\em Convert a public-ID to the application name. \item\end{CompactList}\item int \hyperlink{sampUtil_8c_0fb77074a0a38a4eab5dcf4e397dfef3}{samp\_\-serverPort} () \begin{CompactList}\small\item\em Return a unique port number for the server. \item\end{CompactList}\item void \hyperlink{sampUtil_8c_c7538c339e59556bfd0a87973ad61a43}{samp\_\-printMetadata} (handle\_\-t handle, \hyperlink{sampDecl_8h_2efe6d463d80744789f228f5dc4baa39}{String} name) \begin{CompactList}\small\item\em Print the metadata for the application. \item\end{CompactList}\item char $\ast$ \hyperlink{sampUtil_8c_ed777ec70a7f11254f04a2ee11be391b}{samp\_\-getMetadata} (handle\_\-t handle, \hyperlink{sampDecl_8h_2efe6d463d80744789f228f5dc4baa39}{String} name) \begin{CompactList}\small\item\em Get the metadata item for the application. \item\end{CompactList}\end{CompactItemize} \subsection*{Variables} \begin{CompactItemize} \item \hypertarget{sampUtil_8c_ef3481f5da99207929f0c0c5ee4c328b}{ int \textbf{numHandles} = 0} \label{sampUtil_8c_ef3481f5da99207929f0c0c5ee4c328b} \item \hypertarget{sampUtil_8c_c3d68c02a974f30f9150b4556e5e00d4}{ long \textbf{sampHandles} \mbox{[}MAX\_\-HANDLES\mbox{]}} \label{sampUtil_8c_c3d68c02a974f30f9150b4556e5e00d4} \end{CompactItemize} \label{_details} \hypertarget{_details}{} \subsection{Detailed Description} Utility methods to convert struct pointers to user handles. SAMPUTIL.C -- Utility methods to convert struct pointers to user handles. \begin{Desc} \item[Author:]Mike Fitzpatrick \end{Desc} \begin{Desc} \item[Date:]7/10/09 \end{Desc} \subsection{Function Documentation} \hypertarget{sampUtil_8c_aed9017996a8361f8abf5b5c6a954414}{ \index{sampUtil.c@{sampUtil.c}!samp\_\-app2id@{samp\_\-app2id}} \index{samp\_\-app2id@{samp\_\-app2id}!sampUtil.c@{sampUtil.c}} \subsubsection[{samp\_\-app2id}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ samp\_\-app2id (handle\_\-t {\em handle}, \/ char $\ast$ {\em appName})}} \label{sampUtil_8c_aed9017996a8361f8abf5b5c6a954414} Convert an application name to a public-ID. SAMP\_\-APP2ID -- Convert an application name to a public-ID. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \item[{\em appName}]name of registered application \end{description} \end{Desc} \begin{Desc} \item[Returns:]public ID of application \end{Desc} References Samp::clients, Client::name, and Samp::nclients. Referenced by samp\_\-call(), samp\_\-callAndWait(), samp\_\-envGet(), samp\_\-notify(), samp\_\-paramGet(), samp\_\-Ping(), and samp\_\-sendMsg().\hypertarget{sampUtil_8c_ed777ec70a7f11254f04a2ee11be391b}{ \index{sampUtil.c@{sampUtil.c}!samp\_\-getMetadata@{samp\_\-getMetadata}} \index{samp\_\-getMetadata@{samp\_\-getMetadata}!sampUtil.c@{sampUtil.c}} \subsubsection[{samp\_\-getMetadata}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ samp\_\-getMetadata (handle\_\-t {\em handle}, \/ {\bf String} {\em name})}} \label{sampUtil_8c_ed777ec70a7f11254f04a2ee11be391b} Get the metadata item for the application. SAMP\_\-GETMETADATA -- Get the metadata item for the application. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} References appMD::aKey, appMD::aVal, Samp::description, appMD::docURL, appMD::iconURL, Samp::meta, and appMD::nkeys.\hypertarget{sampUtil_8c_a75368198ec8cd2fff6ad304806862b8}{ \index{sampUtil.c@{sampUtil.c}!samp\_\-id2app@{samp\_\-id2app}} \index{samp\_\-id2app@{samp\_\-id2app}!sampUtil.c@{sampUtil.c}} \subsubsection[{samp\_\-id2app}]{\setlength{\rightskip}{0pt plus 5cm}char$\ast$ samp\_\-id2app (handle\_\-t {\em handle}, \/ char $\ast$ {\em pubId})}} \label{sampUtil_8c_a75368198ec8cd2fff6ad304806862b8} Convert a public-ID to the application name. SAMP\_\-ID2APP -- Convert a public-ID to the application name. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \item[{\em pubId}]public ID of application \end{description} \end{Desc} \begin{Desc} \item[Returns:]name of registered application \end{Desc} References Samp::clients, Client::name, and Samp::nclients.\hypertarget{sampUtil_8c_c7538c339e59556bfd0a87973ad61a43}{ \index{sampUtil.c@{sampUtil.c}!samp\_\-printMetadata@{samp\_\-printMetadata}} \index{samp\_\-printMetadata@{samp\_\-printMetadata}!sampUtil.c@{sampUtil.c}} \subsubsection[{samp\_\-printMetadata}]{\setlength{\rightskip}{0pt plus 5cm}void samp\_\-printMetadata (handle\_\-t {\em handle}, \/ {\bf String} {\em name})}} \label{sampUtil_8c_c7538c339e59556bfd0a87973ad61a43} Print the metadata for the application. SAMP\_\-PRINTMETADATA -- Print the metadata for the application. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]nothing \end{Desc} References appMD::aKey, appMD::aVal, Samp::description, appMD::docURL, appMD::iconURL, Samp::meta, and appMD::nkeys.\hypertarget{sampUtil_8c_0fb77074a0a38a4eab5dcf4e397dfef3}{ \index{sampUtil.c@{sampUtil.c}!samp\_\-serverPort@{samp\_\-serverPort}} \index{samp\_\-serverPort@{samp\_\-serverPort}!sampUtil.c@{sampUtil.c}} \subsubsection[{samp\_\-serverPort}]{\setlength{\rightskip}{0pt plus 5cm}int samp\_\-serverPort (void)}} \label{sampUtil_8c_0fb77074a0a38a4eab5dcf4e397dfef3} Return a unique port number for the server. SAMP\_\-SERVERPORT -- Return a unique port number for the server. \begin{Desc} \item[Returns:]port number \end{Desc} Referenced by samp\_\-hubSetXmlrpcCallback(), and sampInit().