\hypertarget{sampCommands_8c}{ \section{sampCommands.c File Reference} \label{sampCommands_8c}\index{sampCommands.c@{sampCommands.c}} } SAMP commands used by app to send administrative messages. {\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*{Functions} \begin{CompactItemize} \item int \hyperlink{sampCommands_8c_84ffd50bd4b8dc79e9cf32398c6b3d69}{samp\_\-Register} (handle\_\-t handle) \begin{CompactList}\small\item\em Register with the \hyperlink{structHub}{Hub} using the currently stored metadata. \item\end{CompactList}\item int \hyperlink{sampCommands_8c_106fc27544de7c25625ed60eb48e4edd}{samp\_\-UnRegister} (handle\_\-t handle) \begin{CompactList}\small\item\em Un-Register from the hub. \item\end{CompactList}\item int \hyperlink{sampCommands_8c_9c6024ae76103069355256c29ee22722}{samp\_\-DeclareMetadata} (handle\_\-t handle) \begin{CompactList}\small\item\em (Re)Declare all of our metadata. \item\end{CompactList}\item int \hyperlink{sampCommands_8c_2be0812dc8d34c68407c62762f727c51}{samp\_\-Ping} (handle\_\-t handle, \hyperlink{sampDecl_8h_2efe6d463d80744789f228f5dc4baa39}{String} appName) \begin{CompactList}\small\item\em Ping the hub/app to see if it is alive (returns $>$0). \item\end{CompactList}\item \hyperlink{sampDecl_8h_39a90bc041db57e1a6ba736ba91eee30}{Map} \hyperlink{sampCommands_8c_2ac4b5c50094c394a74f18d6ebe3cd91}{samp\_\-GetMetadata} (handle\_\-t handle, \hyperlink{sampDecl_8h_2efe6d463d80744789f228f5dc4baa39}{String} pubId) \begin{CompactList}\small\item\em Get the metadata for a specified app. \item\end{CompactList}\item int \hyperlink{sampCommands_8c_d2b0bdea58688142f55faeffcfc65525}{samp\_\-DeclareSubscriptions} (handle\_\-t handle) \begin{CompactList}\small\item\em Declare the messages we're interested in. \item\end{CompactList}\item \hypertarget{sampCommands_8c_c4f65b6315c8bd7380176d2b97462354}{ \hyperlink{sampDecl_8h_39a90bc041db57e1a6ba736ba91eee30}{Map} \textbf{samp\_\-GetSubscriptions} (handle\_\-t handle, \hyperlink{sampDecl_8h_2efe6d463d80744789f228f5dc4baa39}{String} pubId)} \label{sampCommands_8c_c4f65b6315c8bd7380176d2b97462354} \item \hyperlink{sampDecl_8h_39f9d235896a8fd920f319105eb82791}{List} \hyperlink{sampCommands_8c_954712a523e3f86826b4711abd35b165}{samp\_\-GetRegisteredClients} (handle\_\-t handle) \begin{CompactList}\small\item\em Get public-ids of the registered clients. \item\end{CompactList}\item \hyperlink{sampDecl_8h_39f9d235896a8fd920f319105eb82791}{List} \hyperlink{sampCommands_8c_367a24fc0aa7a81416e6a0d0dbfcd93f}{samp\_\-GetSubscribedClients} (handle\_\-t handle, \hyperlink{sampDecl_8h_2efe6d463d80744789f228f5dc4baa39}{String} mtype) \begin{CompactList}\small\item\em Get clients matching the mtype subscription. \item\end{CompactList}\end{CompactItemize} \label{_details} \hypertarget{_details}{} \subsection{Detailed Description} SAMP commands used by app to send administrative messages. SAMPCOMMANDS.C -- SAMP commands used by app to send administrative messages. stat = samp\_\-Register (handle) stat = samp\_\-UnRegister (handle) stat = samp\_\-DeclareMetadata (handle) stat = samp\_\-Ping (handle, appName) map = samp\_\-GetMetadata (handle, pubId) samp\_\-DeclareSubscriptions (handle) map = samp\_\-GetSubscriptions (handle) list = samp\_\-GetRegisteredClients (handle) list = samp\_\-GetSubscribedClients (handle, mtype) \begin{Desc} \item[Author:]Mike Fitzpatrick \end{Desc} \begin{Desc} \item[Date:]7/10/11 \end{Desc} \subsection{Function Documentation} \hypertarget{sampCommands_8c_9c6024ae76103069355256c29ee22722}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-DeclareMetadata@{samp\_\-DeclareMetadata}} \index{samp\_\-DeclareMetadata@{samp\_\-DeclareMetadata}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-DeclareMetadata}]{\setlength{\rightskip}{0pt plus 5cm}int samp\_\-DeclareMetadata (handle\_\-t {\em handle})}} \label{sampCommands_8c_9c6024ae76103069355256c29ee22722} (Re)Declare all of our metadata. SAMP\_\-DECLAREMETATA -- (Re)Declare all of our metadata. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]SAMP\_\-OK or SAMP\_\-ERR \end{Desc} References Samp::hub, hub, and samp\_\-hubDeclareMetadata().\hypertarget{sampCommands_8c_d2b0bdea58688142f55faeffcfc65525}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-DeclareSubscriptions@{samp\_\-DeclareSubscriptions}} \index{samp\_\-DeclareSubscriptions@{samp\_\-DeclareSubscriptions}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-DeclareSubscriptions}]{\setlength{\rightskip}{0pt plus 5cm}int samp\_\-DeclareSubscriptions (handle\_\-t {\em handle})}} \label{sampCommands_8c_d2b0bdea58688142f55faeffcfc65525} Declare the messages we're interested in. SAMP\_\-DECLARESUBSCRIPIONS -- Declare the messages we're interested in. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]SAMP\_\-OK or SAMP\_\-ERR \end{Desc} References Samp::hub, hub, and samp\_\-hubDeclareSubscriptions(). Referenced by samp\_\-Unsubscribe().\hypertarget{sampCommands_8c_2ac4b5c50094c394a74f18d6ebe3cd91}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-GetMetadata@{samp\_\-GetMetadata}} \index{samp\_\-GetMetadata@{samp\_\-GetMetadata}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-GetMetadata}]{\setlength{\rightskip}{0pt plus 5cm}{\bf Map} samp\_\-GetMetadata (handle\_\-t {\em handle}, \/ {\bf String} {\em pubId})}} \label{sampCommands_8c_2ac4b5c50094c394a74f18d6ebe3cd91} Get the metadata for a specified app. SAMP\_\-GETMETADATA -- Get the metadata for a specified app. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \item[{\em pubId}]App public-id \end{description} \end{Desc} \begin{Desc} \item[Returns:]Map to message response \end{Desc} References Samp::errortxt, Samp::hub, hub, Hub::id, and Hub::privateKey. Referenced by samp\_\-mapClients().\hypertarget{sampCommands_8c_954712a523e3f86826b4711abd35b165}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-GetRegisteredClients@{samp\_\-GetRegisteredClients}} \index{samp\_\-GetRegisteredClients@{samp\_\-GetRegisteredClients}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-GetRegisteredClients}]{\setlength{\rightskip}{0pt plus 5cm}{\bf List} samp\_\-GetRegisteredClients (handle\_\-t {\em handle})}} \label{sampCommands_8c_954712a523e3f86826b4711abd35b165} Get public-ids of the registered clients. SAMP\_\-GETREGISTEREDCLIENTS -- Get public-ids of the registered clients. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]handle to list of registered clients \end{Desc} References Samp::hub, Hub::id, Hub::privateKey, samp\_\-listLen(), samp\_\-newList(), and samp\_\-setStringInList(). Referenced by samp\_\-mapClients().\hypertarget{sampCommands_8c_367a24fc0aa7a81416e6a0d0dbfcd93f}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-GetSubscribedClients@{samp\_\-GetSubscribedClients}} \index{samp\_\-GetSubscribedClients@{samp\_\-GetSubscribedClients}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-GetSubscribedClients}]{\setlength{\rightskip}{0pt plus 5cm}{\bf List} samp\_\-GetSubscribedClients (handle\_\-t {\em handle}, \/ {\bf String} {\em mtype})}} \label{sampCommands_8c_367a24fc0aa7a81416e6a0d0dbfcd93f} Get clients matching the mtype subscription. SAMP\_\-GETSUBSCRIBEDCLIENTS -- Get clients matching the mtype subscription. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \item[{\em mtype}]mtype string \end{description} \end{Desc} \begin{Desc} \item[Returns:]handle to list of clients having mtype subscription \end{Desc} References Samp::hub, Hub::id, Hub::privateKey, samp\_\-listLen(), samp\_\-newList(), and samp\_\-setStringInList().\hypertarget{sampCommands_8c_2be0812dc8d34c68407c62762f727c51}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-Ping@{samp\_\-Ping}} \index{samp\_\-Ping@{samp\_\-Ping}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-Ping}]{\setlength{\rightskip}{0pt plus 5cm}int samp\_\-Ping (handle\_\-t {\em handle}, \/ {\bf String} {\em appName})}} \label{sampCommands_8c_2be0812dc8d34c68407c62762f727c51} Ping the hub/app to see if it is alive (returns $>$0). SAMP\_\-PING -- Ping the hub/app to see if it is alive (returns $>$0). \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \item[{\em appName}]application name \end{description} \end{Desc} \begin{Desc} \item[Returns:]OK or ERR if no response \end{Desc} References Samp::hub, samp\_\-app2id(), samp\_\-callAll(), samp\_\-callAndWait(), samp\_\-freeMap(), samp\_\-freeMsg(), samp\_\-hubPing(), samp\_\-msgParam(), samp\_\-newMsg(), samp\_\-newParam(), and samp\_\-setErr().\hypertarget{sampCommands_8c_84ffd50bd4b8dc79e9cf32398c6b3d69}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-Register@{samp\_\-Register}} \index{samp\_\-Register@{samp\_\-Register}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-Register}]{\setlength{\rightskip}{0pt plus 5cm}int samp\_\-Register (handle\_\-t {\em handle})}} \label{sampCommands_8c_84ffd50bd4b8dc79e9cf32398c6b3d69} Register with the \hyperlink{structHub}{Hub} using the currently stored metadata. SAMP\_\-REGISTER -- Register with the \hyperlink{structHub}{Hub} using the currently stored metadata. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]SAMP\_\-OK or SAMP\_\-ERR \end{Desc} References Samp::hub, hub, Hub::hubId, Hub::id, Hub::privateKey, samp\_\-replyStatus(), Hub::secret, and Hub::selfId.\hypertarget{sampCommands_8c_106fc27544de7c25625ed60eb48e4edd}{ \index{sampCommands.c@{sampCommands.c}!samp\_\-UnRegister@{samp\_\-UnRegister}} \index{samp\_\-UnRegister@{samp\_\-UnRegister}!sampCommands.c@{sampCommands.c}} \subsubsection[{samp\_\-UnRegister}]{\setlength{\rightskip}{0pt plus 5cm}int samp\_\-UnRegister (handle\_\-t {\em handle})}} \label{sampCommands_8c_106fc27544de7c25625ed60eb48e4edd} Un-Register from the hub. SAMP\_\-UNREGISTER -- Un-Register from the hub. \begin{Desc} \item[Parameters:] \begin{description} \item[{\em handle}]samp struct handle \end{description} \end{Desc} \begin{Desc} \item[Returns:]SAMP\_\-OK or SAMP\_\-ERR \end{Desc} References Samp::hub, hub, and samp\_\-hubUnRegister().