sampUtil.c File Reference

Utility methods to convert struct pointers to user handles. More...

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

Defines

#define MAX_HANDLES   128

Functions

handle_t samp_P2H (void *ptr)
void * samp_H2P (handle_t handle)
handle_t samp_newHandle (void *ptr)
void samp_freeHandle (handle_t handle)
char * samp_app2id (handle_t handle, char *appName)
 Convert an application name to a public-ID.
char * samp_id2app (handle_t handle, char *pubId)
 Convert a public-ID to the application name.
int samp_serverPort ()
 Return a unique port number for the server.
void samp_printMetadata (handle_t handle, String name)
 Print the metadata for the application.
char * samp_getMetadata (handle_t handle, String name)
 Get the metadata item for the application.

Variables

int numHandles = 0
long sampHandles [MAX_HANDLES]


Detailed Description

Utility methods to convert struct pointers to user handles.

SAMPUTIL.C -- Utility methods to convert struct pointers to user handles.

Author:
Mike Fitzpatrick
Date:
7/10/09

Function Documentation

char* samp_app2id ( handle_t  handle,
char *  appName 
)

Convert an application name to a public-ID.

SAMP_APP2ID -- Convert an application name to a public-ID.

Parameters:
handle samp struct handle
appName name of registered application
Returns:
public ID of application

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

char* samp_getMetadata ( handle_t  handle,
String  name 
)

Get the metadata item for the application.

SAMP_GETMETADATA -- Get the metadata item for the application.

Parameters:
handle samp handle
Returns:
nothing

References appMD::aKey, appMD::aVal, Samp::description, appMD::docURL, appMD::iconURL, Samp::meta, and appMD::nkeys.

char* samp_id2app ( handle_t  handle,
char *  pubId 
)

Convert a public-ID to the application name.

SAMP_ID2APP -- Convert a public-ID to the application name.

Parameters:
handle samp struct handle
pubId public ID of application
Returns:
name of registered application

References Samp::clients, Client::name, and Samp::nclients.

void samp_printMetadata ( handle_t  handle,
String  name 
)

Print the metadata for the application.

SAMP_PRINTMETADATA -- Print the metadata for the application.

Parameters:
handle samp handle
Returns:
nothing

References appMD::aKey, appMD::aVal, Samp::description, appMD::docURL, appMD::iconURL, Samp::meta, and appMD::nkeys.

int samp_serverPort ( void   ) 

Return a unique port number for the server.

SAMP_SERVERPORT -- Return a unique port number for the server.

Returns:
port number

Referenced by samp_hubSetXmlrpcCallback(), and sampInit().


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