/* <acrdef.h>
 *
 *	Accounting record definitions
 */
#ifndef _ACRDEF_H
#define _ACRDEF_H

/* Record/packet versions (ACR$V_VERSION) */
#define ACR$K_VERSION2 0		/* VMS version 2 accounting format */
#define ACR$K_VERSION3T 1		/* VMS version 3 field test */
#define ACR$K_VERSION3 2		/* VMS version 3 accounting format */
#define ACR$K_CURVER 2			/* current format version number */
#define ACR$V_PACKET	0
#define ACR$M_PACKET	1
#define ACR$S_PACKET	1
#define ACR$V_TYPE	1
#define ACR$M_TYPE	0x00FE
#define ACR$S_TYPE	7
#define ACR$V_SUBTYPE	8
#define ACR$M_SUBTYPE	0x0F00
#define ACR$S_SUBTYPE	4
#define ACR$V_VERSION	12
#define ACR$M_VERSION	0x7000
#define ACR$S_VERSION	3
#define ACR$V_CUSTOMER	15
#define ACR$M_CUSTOMER	0x8000
#define ACR$S_CUSTOMER	1
/* Record type (acr$v_type) constants */
#define ACR$K_PRCDEL	1		/* process delete */
#define ACR$K_PRCPUR	2		/* process purge */
#define ACR$K_IMGDEL	3		/* image delete */
#define ACR$K_IMGPUR	4		/* image purge */
#define ACR$K_SYSINIT	5		/* system initialization */
#define ACR$K_SETTIME	6		/* set system time */
#define ACR$K_LOGFAIL	7		/* login validation failure */
#define ACR$K_PRINT	8		/* print job */
#define ACR$K_USER	9		/* user supplied data */
#define ACR$K_ENABLE   10		/* acc. mang. function enable */
#define ACR$K_DISABLE  11		/* acc. mang. function disable */
#define ACR$K_ALTACM   12		/* declare alternate acc. mang. */
#define ACR$K_FILE_FL  13		/* accounting file - forward link */
#define ACR$K_FILE_BL  14		/* accounting file - backward link */
/* Record subtype (acr$v_subtype) constants */
#define ACR$K_INTERACTIVE 1		/* interactive process */
#define ACR$K_SUBPROCESS  2		/* subprocess */
#define ACR$K_DETACHED	  3		/* detached process */
#define ACR$K_BATCH	  4		/* batch process */
#define ACR$K_NETWORK	  5		/* network process */
/* Packet type (acr$v_type) constants */
#define ACR$K_ID	1		/* identification packet */
#define ACR$K_RESOURCE	2		/* resource usage packet */
#define ACR$K_IMAGENAME 3		/* imagename packet */
#define ACR$K_FILENAME	4		/* filename packet */
#define ACR$K_USER_DATA 5		/* user data packet */

/* Record header */
struct acrdef {
    union {
	unsigned short acr$w_type;	/* record/packet type */
	struct {
	    unsigned acr$v_packet   : 1; /* record(0)/packet(1) */
	    unsigned acr$v_type     : 7; /* record/packet type */
	    unsigned acr$v_subtype  : 4; /* record/packet subtype */
	    unsigned acr$v_version  : 3; /* record/packet version number */
	    unsigned acr$v_customer : 1; /* Digital(0)/customer(1) */
	} acr$r_type_bits;
    } acr$r_type_overlay;
    unsigned short acr$w_length;	/* record or packet length */
};
#define ACR$K_HDRLEN 12			/* record header length */
#define ACR$C_HDRLEN 12			/* record header length */
struct acrdef1 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    unsigned int acr$q_systime[2];	/* event system time */
};
#ifndef NO_VMS_V6
#define ACR$V_FULLNAME	0
#define ACR$M_FULLNAME	(1<<ACR$V_FULLNAME)	/* 0x01 */
#define ACR$K_IDVAR 50		/* beginning of variable storage area */
#define ACR$C_IDVAR 50
#else
#define ACR$K_IDVAR 46		/* beginning of variable storage area */
#define ACR$C_IDVAR 46
#endif
/* Identification packet */
struct acrdef2 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    unsigned long acr$l_pid;		/* process id */
    unsigned long acr$l_owner;		/* owner proces id */
    union {
	unsigned long acr$l_uic;	/* process uic */
	struct {
	    unsigned short acr$w_mem;	/* member uic */
	    unsigned short acr$w_grp;	/* group uic */
	} acr$r_uic_fields;
    } acr$r_uic_overlay;
    unsigned int acr$q_priv[2];		/* process priv */
    unsigned char acr$b_pri;		/* process priority */
#ifndef NO_VMS_V6
    union {
	unsigned char acr$b_idflgs;	/* flags bit mask */
	struct {
	    unsigned acr$v_fullname	: 1; /* not present(0)/present(1) */
	    unsigned			: 7; /* spare bits */
	} acr$r_idflgs_bits;
    } acr$r_idflgs_overlay;
#else
    unsigned	: 8;			/* char fill; spare */
#endif
    unsigned short acr$w_username;	/* username offset */
    unsigned short acr$w_account;	/* account name offset */
    unsigned short acr$w_nodename;	/* node name offset */
    unsigned short acr$w_terminal;	/* terminal name offset */
    unsigned short acr$w_jobname;	/* job name offset */
    unsigned long acr$l_jobid;		/* job id */
    unsigned short acr$w_queue;		/* queue name offset */
    unsigned short acr$w_nodeaddr;	/* remote node address */
    unsigned short acr$w_remoteid;	/* remote id offset */
#ifndef NO_VMS_V6
    unsigned short acr$w_fulladdr;	/* remote Phase V address */
    unsigned short acr$w_fullname;	/* remote Phase V fullname */
#endif
};
/* Resource packet */
struct acrdef3 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    unsigned int acr$q_login[2];	/* process/image start time */
    unsigned long acr$l_status;		/* process/image final status */
    unsigned long acr$l_imgcnt;		/* image execution count/sequence number */
    unsigned long acr$l_cputime;	/* process/image cpu time */
    unsigned long acr$l_faults;		/* process/image page fault count */
    unsigned long acr$l_faultio;	/* process/image page fault i/o count */
    unsigned long acr$l_wspeak;		/* process/image working set peak */
    unsigned long acr$l_pagefl;		/* process/image peak page file usage */
    unsigned long acr$l_diocnt;		/* process/image direct i/o count */
    unsigned long acr$l_biocnt;		/* process/image buffered i/o count */
    unsigned long acr$l_volumes;	/* process/image volume mount count */
    unsigned long acr$l_vp_cputime;	/* process/image vector cpu time */
};
/* Imagename packet */
struct acrdef4 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    char acr$t_imagename[256];		/* imagename */
};
/* Print resource packet */
struct acrdef5 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    unsigned long acr$l_printsts;	/* job status */
    unsigned int acr$q_quetime[2];	/* time job was queued */
    unsigned int acr$q_begtime[2];	/* time job was begun */
    unsigned long acr$l_symcputim;	/* symbiont cpu time */
    unsigned long acr$l_pagecnt;	/* total pages printed */
    unsigned long acr$l_qiocnt;		/* total qios issued */
    unsigned long acr$l_getcnt;		/* total gets issued */
};
/* Filename packet */
struct acrdef6 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    char acr$t_filename[256];		/* filename */
};
/* User data packet */
struct acrdef7 {
    unsigned	: 8, : 8, : 8, : 8;	/* char fill[4]; */
    char acr$t_user_data[256];		/* user data */
};

#endif	/*_ACRDEF_H*/
