TSP: The Transport Sample Protocol



The BB Utilities Library
[BlackBoard (BB)]

Collaboration diagram for The BB Utilities Library:General utility functions for TSP BlackBoard. More...

Functions

char * bb_utils_build_msg_name (const char *msg_name)
 Build the string name used for creating a message queue from a user supplied name.
char * bb_utils_build_sem_name (const char *sem_name)
 Build the string name used for creating a semaphore from a user supplied name.
char * bb_utils_build_shm_name (const char *shm_name)
 Build the string name used for creating a shm segment from a user supplied name.
int32_t bb_utils_convert_string2hexbuf (const char *string, unsigned char *buf, size_t buflen, int hexval)
 Write the value represented as string in a buffer of unsigned char.
key_t bb_utils_ntok (const char *name)
 Build a SysV IPC key from a name.
key_t bb_utils_ntok_user (const char *name, int32_t user_specific_value)
 Build a SysV IPC key from a name and user specific value.


Detailed Description

General utility functions for TSP BlackBoard.


Function Documentation

char* bb_utils_build_msg_name ( const char *  msg_name  ) 

Build the string name used for creating a message queue from a user supplied name.

We use this for easy MSG name 'normalization' for easy message queue portability. One may use the name with either POSIX mq_open(3) or sys V msgget(2) through

See also:
bb_utils_ntok or

bb_utils_ntok_user.

Parameters:
msg_name IN, user supplied name.
Returns:
the name to be used by message queue creator. The string is allocated (as strdup(3) do) so that caller should free it.

char* bb_utils_build_sem_name ( const char *  sem_name  ) 

Build the string name used for creating a semaphore from a user supplied name.

We use this for easy SEM name 'normalization' for easy semaphore portability. One may use the name with either POSIX sem_open(3) or sys V semget(2) through

See also:
bb_utils_ntok or

bb_utils_ntok_user.

Parameters:
sem_name IN, user supplied name.
Returns:
the name to be used by semaphore creator. The string is allocated (as strdup(3) do) so that caller should free it.

char* bb_utils_build_shm_name ( const char *  shm_name  ) 

Build the string name used for creating a shm segment from a user supplied name.

We use this for easy SHM name 'normalization' for easy shm portability. One may use the name with either POSIX shm_open(3) or sys V shmget(2) through

See also:
bb_utils_ntok or

bb_utils_ntok_user.

Parameters:
shm_name IN, user supplied name.
Returns:
the name to be used by shm creator. The string is allocated (as strdup(3) do) so that caller should free it.

int32_t bb_utils_convert_string2hexbuf ( const char *  string,
unsigned char *  buf,
size_t  buflen,
int  hexval 
)

Write the value represented as string in a buffer of unsigned char.

The value is understood as decimal of hexadecimal value representation

Parameters:
string IN, the value to be written to buf
buf OUT, the buffer to be written to
buflen IN, the buffer length
hexval IN, 0 if string is to be interpreted as decimal value 1 if string is to be interpreted as hexadecimal value
Returns:
0 if success !=0 otherwise

key_t bb_utils_ntok ( const char *  name  ) 

Build a SysV IPC key from a name.

L'objectif de cette fonction est de générer des clefs différentes pour des noms différents, à la manière d'une fonction de hachage ou checksum parfaite. Cette fonction vise les même objectifs que ftok(3) avec les noms de fichiers mais avec une chaine de caractere quelconque.

Parameters:
name un nom représentant l'élément IPC pour lequel on veut générer une clef.
Returns:
SysV IPC key corresponding to the specified name.

key_t bb_utils_ntok_user ( const char *  name,
int32_t  user_specific_value 
)

Build a SysV IPC key from a name and user specific value.

The purpose of this function is to build a (quasi) unique key from unique entry as ftok(3) do with existing file name. We use SHA1 hash function Xored with the user_specific value supplied.

Parameters:
name IN, the name representing the IPC element for which we want a key.
user_specific_value IN, any user specific value (for example uid).
Returns:
The generated SysV IPC key corresponding to the specified entry

Framework Home Page.


Beware !! TSP wave is coming...