Main Page   Compound List   File List   Compound Members   File Members  

lib/idmgr/file.c File Reference

Idmgr implementation based on a file. More...

#include "../gobj/idmgr.h"
#include "../gobj/errors.h"
#include "../gobj/ids.h"
#include <fcntl.h>
#include <unistd.h>

Compounds

struct  Gj_Idmgr_struct

Defines

#define _GJ_STATUSFILE   "idstat.bin"
 Status file name. More...

#define _READBUF   1000
 Buffer for gj_idmgr_createSystemIdFromMAC. More...


Functions

int gj_idmgr_load (Gj_Idmgr* mgr, Gj_Id* global, Gj_Id* local)
 Try to load the actual ids. More...

int gj_idmgr_save (Gj_Ctx* ctx, Gj_Id* global, Gj_Id* local)
 Try to save the actual ids. More...

void gj_idmgr_assignMACToSysid (unsigned char* mac, Gj_Sysid* sysid)
 Assign a MAC of type 'char mac[6]' to a sysid. More...

int gj_idmgr_createSystemIdFromMAC (Gj_Idmgr* mgr, Gj_Sysid* sysid)
 Try to create a unique system id from the MAC address of an ethernet card. More...

int gj_idmgr_createSystemId (Gj_Idmgr* mgr, Gj_Sysid* sysid)
 Try to create a unique system id. More...

int Gj_idmgr_new (Gj_Ctx* ctx)
 Create a new id manager. More...

void Gj_idmgr_delete (Gj_Ctx* ctx)
 Delete the id manager.

int gj_idmgr_open (Gj_Ctx* ctx, Gj_Id* global, Gj_Id* local)
 Do the loading or creating process for the dataset. More...

int gj_idmgr_close (Gj_Ctx* ctx)
 Close the data set. More...

int Gj_idmgr_createId (Gj_Ctx* ctx, Gj_Id* id)
 Create a new world-wide unique id. More...

int Gj_idmgr_createLocalId (Gj_Ctx* ctx, Gj_Id* id)
 Create a new local-unique id. More...

int Gj_idmgr_getSysid (Gj_Ctx* ctx, Gj_Sysid* sysid)
 Get the system id. More...


Detailed Description

Idmgr implementation based on a file.


Define Documentation

#define _GJ_STATUSFILE   "idstat.bin"
 

Status file name.

For internal use only.

#define _READBUF   1000
 

Buffer for gj_idmgr_createSystemIdFromMAC.

For internal use only.


Function Documentation

int gj_idmgr_load ( Gj_Idmgr * mgr,
Gj_Id * global,
Gj_Id * local )
 

Try to load the actual ids.

Returns:
  • 0 on success
  • -1 if we cannot access the data,
  • -2 if the data did not exist (but the dataset has now been created and gj_idmgr_save can be applied on it)

For internal use only.

int gj_idmgr_save ( Gj_Ctx * ctx,
Gj_Id * global,
Gj_Id * local )
 

Try to save the actual ids.

Returns:
0 on success, -1 if the data could not be saved.

For internal use only.

void gj_idmgr_assignMACToSysid ( unsigned char * mac,
Gj_Sysid * sysid )
 

Assign a MAC of type 'char mac[6]' to a sysid.

For internal use only.

int gj_idmgr_createSystemIdFromMAC ( Gj_Idmgr * mgr,
Gj_Sysid * sysid )
 

Try to create a unique system id from the MAC address of an ethernet card.

Returns:
0 on success, -1 otherwise.

int gj_idmgr_createSystemId ( Gj_Idmgr * mgr,
Gj_Sysid * sysid )
 

Try to create a unique system id.

Returns:
0 on success, -1 otherwise.

For internal use only.

int Gj_idmgr_new ( Gj_Ctx * ctx )
 

Create a new id manager.

Returns:
0 on success, -1 otherwise.

int gj_idmgr_open ( Gj_Ctx * ctx,
Gj_Id * global,
Gj_Id * local )
 

Do the loading or creating process for the dataset.

Returns:
0 on success, -1 otherwise.

For internal use only.

int gj_idmgr_close ( Gj_Ctx * ctx )
 

Close the data set.

For internal use only.

int Gj_idmgr_createId ( Gj_Ctx * ctx,
Gj_Id * id )
 

Create a new world-wide unique id.

Returns:
0 on success, -1 otherwise.

int Gj_idmgr_createLocalId ( Gj_Ctx * ctx,
Gj_Id * id )
 

Create a new local-unique id.

Returns:
0 on success, -1 otherwise.

int Gj_idmgr_getSysid ( Gj_Ctx * ctx,
Gj_Sysid * sysid )
 

Get the system id.

Returns:
0 on success, -1 otherwise.


Generated at Fri Aug 17 18:28:58 2001 for Gobj by doxygen1.2.1 written by Dimitri van Heesch, © 1997-2000