Main Page   Compound List   File List   Compound Members   File Members  

dicelib.h File Reference

This is the main header. More...

Go to the source code of this file.

Compounds

struct  dice_func
struct  dice_type

Type functions

#define DICE_no_types   DICE_Type DICE_MyTypes[] = { NULL, NULL, NULL, NULL };
typedef dice_type DICE_Type
int DICE_type_free (char *type, void *data)
char * DICE_type_pack (char *type, void *data, int *n)
 Packs a variable. More...

void * DICE_type_unpack (char *type, char *packet, int *n)
DICE_Type DICE_MyTypes []

DICE attributes

typedef enum dice_attributetype DICE_AttributeType
 Typedef encapsulation.

enum  dice_attributetype {
  LIBVERSION, VERBOSE, PORT, MAX_CONNECTIONS,
  OUTPUT, COLOR
}
 Attributes of DICE API.. More...

int DICE_set_attribute (DICE_AttributeType t, void *value)
 Sets an attribute value. See enum for list. More...

void * DICE_get_attribute (DICE_AttributeType t)
int DICE_is_original (void)

Initialization/finalization

int DICE_init (int *argc, char **argv)
 Inits the library. More...

void DICE_close (void)

Sync functions

int DICE_sync (void)
 Synchronizes the applications. More...

int DICE_sync_new (char *name, char *type, void *value)
 Creates a new synchronized variable. More...

int DICE_sync_delete (char *name)
 Internal: Deletes an existing synchronized variable. More...

int DICE_sync_update (char *name, void *value)
void * DICE_sync_get (char *name)
void * DICE_sync_get_next (char *name)
 Get the content of the next update. More...


Async functions

int DICE_async_new (char *name, char *type, void *value)
int DICE_async_delete (char *name)
int DICE_async_update (char *name, void *value)
void * DICE_async_get (char *name)
int DICE_async_lock (char *name)
int DICE_async_unlock (char *name)

Defines

#define DICE_no_functions   DICE_Function DICE_MyFunctions[] = { NULL, NULL };

Typedefs

typedef dice_func DICE_Function

Functions

int DICE_function (void *data)

Variables

DICE_Function DICE_MyFunctions []


Detailed Description

This is the main header.

Author:
Bruno Barberi Gnecco <brunobg@lsi.usp.br>

Definition in file dicelib.h.


Enumeration Type Documentation

enum dice_attributetype
 

Attributes of DICE API..

Enumeration values:
LIBVERSION   Library version.
VERBOSE   Sets the verbose level.\ Minimum = 0, Maximum = 3.\ Default: 1.
PORT   Port used to connect
MAX_CONNECTIONS   Max concurrent connections (see listen())
OUTPUT   Error file
COLOR   Output color codes

Definition at line 45 of file dicelib.h.


Function Documentation

int DICE_init int * argc,
char ** argv
 

Inits the library.

This function must be called before any other DICE function. Recognized arguments are:

  • --dice-client-num [number]: expect number clients. If used with a rc file, spawn number clients.
  • --dice-client-only: do not start client.
  • --dice-control-is [name]: use name as control server name.
  • --dice-control-only: do not start control.
  • --dice-environment [env]: set the \env environment in the clients. Useful for X11 remote display.
  • --dice-no-rc: don't read rc file.
  • --dice-spawn [type]: type of spawning. /c Type is either none, rsh, ssh or bproc. The default is rsh.
  • --dice-original: only original node can update.
  • --dice-output [file]: output error messages to file. The default is stderr.
  • --dice-port [port]: use port as port. The default is 6748.
  • --dice-verbose [level]: set verbose level to level.
DICE_init "cleans" argc and argv, taking out all arguments that are used.
Parameters:
argc   pointer number of arguments.
argv   pointer to the arguments.
Return values:
0   OK
-1   error.

Definition at line 83 of file init.c.

int DICE_set_attribute DICE_AttributeType t,
void * value
 

Sets an attribute value. See enum for list.

Parameters:
t   Attribute type.
value   Attribute value, cast to void *.
See also:
DICE_getAttribute.
Return values:
0   OK
-1   error.

Definition at line 368 of file init.c.

int DICE_sync void
 

Synchronizes the applications.

What it does:

  • Send SYNC packet
  • Send VARIABLE_SYNC packets
  • Send READY
  • Wait for packets: get VARIABLE_SYNCs, get SYNC
  • Send READY
  • Wait for CONTINUE packet
Return values:
0   OK
-1   error.

Definition at line 515 of file sync.c.

int DICE_sync_delete char * name
 

Internal: Deletes an existing synchronized variable.

Deletes an existing synchronized variable. Takes care of memory deallocation.

Parameters:
name   The variable name.
Return values:
0   OK.
-1   error.
-2   Variable does not exist.
-3   You do not have permission to delete variables.
See also:
DICE_sync_new.

Definition at line 381 of file sync.c.

void* DICE_sync_get_next char * name
 

Get the content of the next update.

Long description

Parameters:
name   The variable name.
See also:
DICE_sync_create.
Returns:
Old variable content(cast to void *), or NULL if error.

Definition at line 647 of file sync.c.

int DICE_sync_new char * name,
char * type,
void * value
 

Creates a new synchronized variable.

Long description

Parameters:
name   The variable name.
type   The variable type. Must be previously registered.
value   The variable value, converted to void *.
See also:
DICE_type_register, dice_sync_delete.
Return values:
0   OK.
-1   error.
-2   Variable already exists.
-3   You do not have permission to create variables.

Definition at line 360 of file sync.c.

char* DICE_type_pack char * type,
void * data,
int * n
 

Packs a variable.

Process a variable data of type type, and returns a string, and the length of this string in the pointer n. The type must have been previously registered. The user is responsible for freeing the returned string.

Parameters:
type   Variable type name.
data   Data to pack.
n   Pointer to an int, will contain the size of the string returned.
See also:
DICE_type_register. dice_unpack.
Returns:
The packed variable in a string, and its size in n.

Definition at line 225 of file type.c.


Generated at Sun Dec 9 16:13:18 2001 for dicelib by doxygen1.2.9.1 written by Dimitri van Heesch, © 1997-2001