/* This is -*-c-*- */

/* $Id: bos.xg,v 1.3 2000/06/05 20:43:35 jimmy Exp $ */

/*
 * Interface to BOS server
 */

package BOZO_

%#include <config.h>
%#include <roken.h>
%#include <fs_errors.h>

error-function conv_to_arla_errno

const BZNOTACTIVE		= 39424;
const BZNOENT			= 39425;
const BZBUSY			= 39426;
const BZEXISTS			= 39427;
const BZNOCREATE		= 39428;
const BZDOM			= 39429;
const BZACCESS			= 39430;
const BZSYNTAX			= 39431;
const BZIO			= 39432;
const BZNET			= 39433;
const BZBADTYPE			= 39434;

const BOZO_BSSIZE = 256;

/*
 *
 */

const BSTAT_SHUTDOWN		= 0;
const BSTAT_NORMAL		= 1;
const BSTAT_SHUTTINGDOWN	= 2;
const BSTAT_STARTINGUP		= 3;

const BOZO_PRUNEOLD		= 1;
const BOZO_PRUNEBAK		= 2;
const BOZO_PRUNECORE		= 3;

const BPROC_STARTED		= 1;
const BPROC_EXITED		= 2;

const BOZO_HASCORE		= 1;
const BOZO_ERRORSTOP		= 2;
const BOZO_BADDIRACCESS		= 3;

const BNODE_NEEDTIMEOUT		= 0x01;
const BNODE_ACTIVE		= 0x02;
const BNODE_WAIT		= 0x04;
const BNODE_DELETE		= 0x08;
const BNODE_ERRORSTOP		= 0x10;

const KTIME_HOUR		= 0x01;
const KTIME_MIN			= 0x02;
const KTIME_SEC			= 0x04; /* XXX check me */
const KTIME_DAY			= 0x08;
const KTIME_TIME		= 0x07;
const KTIME_NEVER		= 0x10;
const KTIME_NOW			= 0x20;

#if 0
const GETSTATUS_FSRUN  		= "file server running";
const GETSTATUS_RSRUNVOLDOWN	= "file server running; volser down";
const GETSTATUS_SALVAGE		= "salvaging file system";
const GETSTATUS_FSSTART		= "starting file server";
const GETSTATUS_FSDOWN		= "file server shutting down";
const GETSTATUS_SALVAGERDOWN	= "salvager shutting down";
const GETSTATUS_FSSTOP		= "salvager shut down";
#endif

struct bozo_status {
    long goal;
    long fileGoal;
    long porcStartTime;
    long procStarts;
    long lastAnyExit;
    long lastErrorExit;
    long errorCode;
    long errorSignal;
    long flags;
    long spare[8];
};

struct bozo_netKTime {
    long mask;
    short hour;
    short min;
    short sec;
    short day;
};

struct bozo_key {
    char data[8];
};

struct bozo_keyInfo {
    long mod_sec;
    long mod_usec;
    unsigned long keyCheckSum;
    long spare2;
};

struct bozo_keyInfoFOOO {
    long goal;
    long fileGoal;
    long procStartTime;
    long procStarts;
    long lastAnyExit;
    long lastErrorExit;
    long errorCode;
    long errorSignal;
    long flags;
    long spare[8];
};

#if 0
struct bnode_ops {
    struct bnode *(*create)();
    long (*timeout)();
    long (*getstat)();
    long (*setstat)();
    long (*delete)();
    long (*procexit)();
    long (*getstring)();
    long (*getparm)();
    long (*restartp)();
    long (*hascore)();
};
#endif


CreateBnode (IN string type,
	     IN string instance,
	     IN string p1,
	     IN string p2,
	     IN string p3,
	     IN string p4,
	     IN string p5,
	     IN string p6) = 80;

DeleteBnode (IN string instance) = 81;

SetStatus (IN string instance) = 82;

GetStatus (IN string instance,
	   OUT long *inStat,
	   OUT string statdescr<BOZO_BSSIZE>) = 83;


EnumerateInstance (IN long instance,
		   OUT string iname) = 84;

GetInstanceInfo ( IN string instance,
		  OUT string type<>,
		  OUT struct bozo_status *status) = 85;
		  
GetInstanceParm (IN string instance<>,
		 IN long num,
		 OUT string param<>) = 86;

#if 0
AddSUser 87
DeleteSUser 88
ListSUsers 89
ListKeys 90
AddKey 91
DeleteKey 92
SetCellName 93
GetCellName 94
GetCellHost 95
AddCellHost 96
DeleteCellHost 97
SetTStatus 98
ShutdownAll 99
RestartAll 100
StartupAll 101
SetNoAuthFlag 102
ReBozo 103
Restart 104
Install 105
UnInstall 106
GetDates 107
Exec 108
Prune 109
SetRestartTime 110
GetRestartTime 111
GetLog 112
WaitAll 113
GetInstanceStrings 114
#endif

/* XXX */
