sampCommands.c File Reference

SAMP commands used by app to send administrative messages. More...

#include <stdlib.h>
#include <stdio.h>
#include <unistd.h>
#include <string.h>
#include <time.h>
#include <ctype.h>
#include "samp.h"

Functions

int samp_Register (handle_t handle)
 Register with the Hub using the currently stored metadata.
int samp_UnRegister (handle_t handle)
 Un-Register from the hub.
int samp_DeclareMetadata (handle_t handle)
 (Re)Declare all of our metadata.
int samp_Ping (handle_t handle, String appName)
 Ping the hub/app to see if it is alive (returns >0).
Map samp_GetMetadata (handle_t handle, String pubId)
 Get the metadata for a specified app.
int samp_DeclareSubscriptions (handle_t handle)
 Declare the messages we're interested in.
Map samp_GetSubscriptions (handle_t handle, String pubId)
List samp_GetRegisteredClients (handle_t handle)
 Get public-ids of the registered clients.
List samp_GetSubscribedClients (handle_t handle, String mtype)
 Get clients matching the mtype subscription.


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)

Author:
Mike Fitzpatrick
Date:
7/10/11

Function Documentation

int samp_DeclareMetadata ( handle_t  handle  ) 

(Re)Declare all of our metadata.

SAMP_DECLAREMETATA -- (Re)Declare all of our metadata.

Parameters:
handle samp struct handle
Returns:
SAMP_OK or SAMP_ERR

References Samp::hub, hub, and samp_hubDeclareMetadata().

int samp_DeclareSubscriptions ( handle_t  handle  ) 

Declare the messages we're interested in.

SAMP_DECLARESUBSCRIPIONS -- Declare the messages we're interested in.

Parameters:
handle samp struct handle
Returns:
SAMP_OK or SAMP_ERR

References Samp::hub, hub, and samp_hubDeclareSubscriptions().

Referenced by samp_Unsubscribe().

Map samp_GetMetadata ( handle_t  handle,
String  pubId 
)

Get the metadata for a specified app.

SAMP_GETMETADATA -- Get the metadata for a specified app.

Parameters:
handle samp struct handle
pubId App public-id
Returns:
Map to message response

References Samp::errortxt, Samp::hub, hub, Hub::id, and Hub::privateKey.

Referenced by samp_mapClients().

List samp_GetRegisteredClients ( handle_t  handle  ) 

Get public-ids of the registered clients.

SAMP_GETREGISTEREDCLIENTS -- Get public-ids of the registered clients.

Parameters:
handle samp struct handle
Returns:
handle to list of registered clients

References Samp::hub, Hub::id, Hub::privateKey, samp_listLen(), samp_newList(), and samp_setStringInList().

Referenced by samp_mapClients().

List samp_GetSubscribedClients ( handle_t  handle,
String  mtype 
)

Get clients matching the mtype subscription.

SAMP_GETSUBSCRIBEDCLIENTS -- Get clients matching the mtype subscription.

Parameters:
handle samp struct handle
mtype mtype string
Returns:
handle to list of clients having mtype subscription

References Samp::hub, Hub::id, Hub::privateKey, samp_listLen(), samp_newList(), and samp_setStringInList().

int samp_Ping ( handle_t  handle,
String  appName 
)

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).

Parameters:
handle samp struct handle
appName application name
Returns:
OK or ERR if no response

References Samp::hub, samp_app2id(), samp_callAll(), samp_callAndWait(), samp_freeMap(), samp_freeMsg(), samp_hubPing(), samp_msgParam(), samp_newMsg(), samp_newParam(), and samp_setErr().

int samp_Register ( handle_t  handle  ) 

Register with the Hub using the currently stored metadata.

SAMP_REGISTER -- Register with the Hub using the currently stored metadata.

Parameters:
handle samp struct handle
Returns:
SAMP_OK or SAMP_ERR

References Samp::hub, hub, Hub::hubId, Hub::id, Hub::privateKey, samp_replyStatus(), Hub::secret, and Hub::selfId.

int samp_UnRegister ( handle_t  handle  ) 

Un-Register from the hub.

SAMP_UNREGISTER -- Un-Register from the hub.

Parameters:
handle samp struct handle
Returns:
SAMP_OK or SAMP_ERR

References Samp::hub, hub, and samp_hubUnRegister().


Generated on Wed Feb 27 21:10:15 2013 for SAMP Client Library by  doxygen 1.5.9