gxPL  1.0
Tools, Application and Framework for xPL
Identifiers

Detailed Description

Collaboration diagram for Identifiers:

Functions

int gxPLGenerateUniqueId (const gxPLApplication *app, char *id, int len)
 Generates a fairly unique identifier. More...
 
int gxPLIdCmp (const gxPLId *id1, const gxPLId *id2)
 Compare two identifiers. More...
 
int gxPLIdCopy (gxPLId *dst, const gxPLId *src)
 Copy two identifiers. More...
 
int gxPLIdDeviceIdSet (gxPLId *id, const char *device_id)
 Sets device identifier. More...
 
int gxPLIdFromString (gxPLId *dest, char *src)
 Gets an identifier from a string. More...
 
int gxPLIdInstanceIdSet (gxPLId *id, const char *instance_id)
 Sets instance identifier. More...
 
int gxPLIdSet (gxPLId *id, const char *vendor_id, const char *device_id, const char *instance_id)
 Sets an identifier. More...
 
int gxPLIdVendorIdSet (gxPLId *id, const char *vendor_id)
 Sets vendor identifier. More...
 

Function Documentation

int gxPLGenerateUniqueId ( const gxPLApplication *  app,
char *  id,
int  len 
)

Generates a fairly unique identifier.

The identifier consists only of valid characters in xPL (0-9,a-z). The algorithm uses the hardware address of the host and the time of day. Two spaced successive calls of less than one millisecond give the same result.

Parameters
apppointer to a gxPLApplication object
idthe generated id string
lenlength of the generated string not including the terminating null character
Returns
length of the generated string, -1 if error occurs
int gxPLIdCmp ( const gxPLId id1,
const gxPLId id2 
)

Compare two identifiers.

Parameters
id1first id
id2second id
Returns
It returns an integer less than, equal to, or greater than zero if id1 is found, respectively, to be less than, to match, or be greater than id2.
int gxPLIdCopy ( gxPLId dst,
const gxPLId src 
)

Copy two identifiers.

Parameters
dstdestination
srcsource
Returns
0, -1 if an error occurs
int gxPLIdDeviceIdSet ( gxPLId id,
const char *  device_id 
)

Sets device identifier.

Parameters
idpointer to the identifier
device_iddevice identifier as string
Returns
0, -1 if an error occurs
int gxPLIdFromString ( gxPLId dest,
char *  src 
)

Gets an identifier from a string.

Parameters
destdestination
srcsource string vendor-device.instance\0, this string is modified by the function and is no longer valid after call.
Returns
0, -1 if an error occurs
Examples:
sender/gxpl-sender.c.
int gxPLIdInstanceIdSet ( gxPLId id,
const char *  instance_id 
)

Sets instance identifier.

Parameters
idpointer to the identifier
instance_idinstance identifier as string
Returns
0, -1 if an error occurs
int gxPLIdSet ( gxPLId id,
const char *  vendor_id,
const char *  device_id,
const char *  instance_id 
)

Sets an identifier.

Parameters
idpointer to the identifier
vendor_idvendor identifier as string
device_iddevice identifier as string
instance_idinstance identifier as string
Returns
0, -1 if an error occurs
int gxPLIdVendorIdSet ( gxPLId id,
const char *  vendor_id 
)

Sets vendor identifier.

Parameters
idpointer to the identifier
vendor_idvendor identifier as string
Returns
0, -1 if an error occurs