/*
 * bnode.h:
 * This file is automatically generated; please do not edit it.
 */
/* Including bnode.p.h at beginning of bnode.h file. */

/*
 * P_R_P_Q_# (C) COPYRIGHT IBM CORPORATION 1987, 1988
 * LICENSED MATERIALS - PROPERTY OF IBM
 * REFER TO COPYRIGHT INSTRUCTIONS FORM NUMBER G120-2083
 */

#define	BOP_TIMEOUT(bnode)	((*(bnode)->ops->timeout)((bnode)))
#define	BOP_GETSTAT(bnode, a)	((*(bnode)->ops->getstat)((bnode),(a)))
#define	BOP_SETSTAT(bnode, a)	((*(bnode)->ops->setstat)((bnode),(a)))
#define	BOP_DELETE(bnode)	((*(bnode)->ops->delete)((bnode)))
#define	BOP_PROCEXIT(bnode, a)	((*(bnode)->ops->procexit)((bnode),(a)))
#define	BOP_GETSTRING(bnode, a, b)	((*(bnode)->ops->getstring)((bnode),(a), (b)))
#define	BOP_GETPARM(bnode, n, b, l)	((*(bnode)->ops->getparm)((bnode),(n),(b),(l)))
#define	BOP_RESTARTP(bnode)	((*(bnode)->ops->restartp)((bnode)))
#define BOP_HASCORE(bnode)	((*(bnode)->ops->hascore)((bnode)))

struct bnode_ops {
    struct bnode *(*create)(/* variable args */);
    int (*timeout) (/* bnode */);
    int (*getstat) (/* bnode, status */);
    int (*setstat) (/* bnode, status */);
    int (*delete) (/* bnode */);
    int (*procexit) (/* bnode, proc */);
    int (*getstring) (/* bnode, buffer, bufLen */);
    int (*getparm) (/* bnode, parmIndex, buffer, bufLen */);
    int	(*restartp) (/*	bnode */);
    int (*hascore) (/* bnode */);
};

struct bnode_type {
    struct bnode_type *next;
    char *name;
    struct bnode_ops *ops;
};

struct bnode_token {
    struct bnode_token *next;
    char *key;
};

struct bnode {
    struct bnode *next;		    /* next pointer in top-level's list */
    char *name;			    /* instance name */
    int32 nextTimeout;		    /* next time this guy should be woken */
    int32 period;		    /* period between calls */
    int32 rsTime;		    /* time we started counting restarts */
    int32 rsCount;		    /* count of restarts since rsTime */
    struct bnode_type *type;	    /* type object */
    struct bnode_ops *ops;	    /* functions implementing bnode class */
    int32 procStartTime;		    /* last time a process was started */
    int32 procStarts;		    /* number of process starts */
    int32 lastAnyExit;		    /* last time a process exited, for any reason */
    int32 lastErrorExit;		    /* last time a process exited unexpectedly */
    int32 errorCode;		    /* last exit return code */
    int32 errorSignal;		    /* last proc terminating signal */
    char *lastErrorName;	    /* name of proc that failed last */
    char *notifier;		    /* notifier program to be executed on exits */
    short refCount;		    /* reference count */
    short flags;		    /* random flags */
    char goal;			    /* 1=running or 0=not running */
    char fileGoal;		    /* same, but to be stored in file */
};

struct bnode_proc {
    struct bnode_proc *next;	    /* next guy in top-level's list */
    struct bnode *bnode;	    /* bnode creating this process */
    char *comLine;		    /* command line used to start this process */
    char *coreName;		    /* optional core file component name */
    int32 pid;			    /* pid if created */
    int32 lastExit;		    /* last termination code */
    int32 lastSignal;		    /* last signal that killed this guy */
    int32 flags;			    /* flags giving process state */
};

/* bnode flags */
#define	BNODE_NEEDTIMEOUT	    1	    /* timeouts are active */
#define	BNODE_ACTIVE		    2	    /* in generic lists */
#define	BNODE_WAIT		    4	    /* someone waiting for status change */
#define	BNODE_DELETE		    8	    /* delete this bnode asap */
#define	BNODE_ERRORSTOP		    0x10    /* stopped due to errors */

/* flags for bnode_proc */
#define	BPROC_STARTED		    1	    /* ever started */
#define	BPROC_EXITED		    2	    /* exited */

#define	NONOTIFIER		    "__NONOTIFIER__"

/* status values for bnodes, and goals */
#define	BSTAT_SHUTDOWN		    0	    /* shutdown normally */
#define	BSTAT_NORMAL		    1	    /* running normally */
#define	BSTAT_SHUTTINGDOWN	    2	    /* normal --> shutdown */
#define	BSTAT_STARTINGUP	    3	    /* shutdown --> normal */

/* calls back up to the generic bnode layer */
extern int bnode_SetTimeout(/* bnode, timeout */);
extern int bnode_Init(/* bnode, bnodeops */);
extern int bnode_Activate(/* bnode */);
extern int bnode_NewProc(/* bnode, execstring, corename, procaddr */);
extern int bnode_Init(/* no parms */);
extern int32 bnode_Create();
extern struct bnode *bnode_FindInstance();

/* End of prolog file bnode.p.h. */

#define BZNOTACTIVE                              (39424L)
#define BZNOENT                                  (39425L)
#define BZBUSY                                   (39426L)
#define BZEXISTS                                 (39427L)
#define BZNOCREATE                               (39428L)
#define BZDOM                                    (39429L)
#define BZACCESS                                 (39430L)
#define BZSYNTAX                                 (39431L)
#define BZIO                                     (39432L)
#define BZNET                                    (39433L)
#define BZBADTYPE                                (39434L)
extern void initialize_bz_error_table ();
#define ERROR_TABLE_BASE_bz (39424L)

/* for compatibility with older versions... */
#define init_bz_err_tbl initialize_bz_error_table
#define bz_err_base ERROR_TABLE_BASE_bz
