00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024 #ifndef DICELIB_H
00025 #define DICELIB_H
00026
00035 extern int DICE_init ( int *argc, char **argv );
00036 extern void DICE_close ( void );
00045 enum dice_attributetype {
00046 LIBVERSION,
00047 VERBOSE,
00048 PORT,
00049 MAX_CONNECTIONS,
00050 OUTPUT,
00051 COLOR
00052 };
00056 typedef enum dice_attributetype DICE_AttributeType;
00057
00058 extern int DICE_set_attribute ( DICE_AttributeType t, void *value );
00059 extern void * DICE_get_attribute ( DICE_AttributeType t );
00060 extern int DICE_is_original ( void );
00067 struct dice_type {
00068 char *name;
00069 char * (*pack_func) (void *data, int *n);
00070 void * (*unpack_func) (char *data, int *n);
00071 void (*free_func) (void *data);
00072 };
00073 typedef struct dice_type DICE_Type;
00074 extern DICE_Type DICE_MyTypes[];
00075
00076 #define DICE_no_types DICE_Type DICE_MyTypes[] = { NULL, NULL, NULL, NULL };
00077
00078 extern int DICE_type_free ( char *type, void *data );
00079 extern char *DICE_type_pack ( char *type, void *data, int *n );
00080 extern void *DICE_type_unpack ( char *type, char *packet, int *n );
00088 extern int DICE_sync ( void );
00089
00090 extern int DICE_sync_new ( char *name, char *type, void *value );
00091 extern int DICE_sync_delete ( char *name );
00092 extern int DICE_sync_update ( char *name, void *value );
00093 extern void *DICE_sync_get ( char *name );
00094 extern void *DICE_sync_get_next ( char *name );
00101 extern int DICE_async_new ( char *name, char *type, void *value );
00102 extern int DICE_async_delete ( char *name );
00103 extern int DICE_async_update ( char *name, void *value );
00104 extern void *DICE_async_get ( char *name );
00105
00106 extern int DICE_async_lock ( char *name );
00107 extern int DICE_async_unlock ( char *name );
00110 struct dice_func {
00111 char *name;
00112 int (*func) (void *);
00113 };
00114 typedef struct dice_func DICE_Function;
00115
00116 #define DICE_no_functions DICE_Function DICE_MyFunctions[] = { NULL, NULL };
00117 extern int DICE_function ( void *data );
00118 extern DICE_Function DICE_MyFunctions[];
00119 #endif