/* <nsadef.h>
 *
 *	Security auditing definitions.
 */
#ifndef _NSADEF_H
#define _NSADEF_H

/* Define the packet header and record types used for security auditing. */
#define NSA$C_MSG_SERVER	1	/* audit server control message */
#define NSA$C_MSG_AUDIT		2	/* change in auditable events */
#define NSA$C_MSG_BREAKIN	3	/* breakin attempt */
#define NSA$C_MSG_INSTALL	4	/* change to INSTALLed database */
#define NSA$C_MSG_LOGFAIL	5	/* login failure */
#define NSA$C_MSG_LOGIN		6	/* successful login */
#define NSA$C_MSG_LOGOUT	7	/* successful logout */
#define NSA$C_MSG_MOUNT		8	/* volume mount or dismount */
#define NSA$C_MSG_NETUAF	9	/* network UAF change */
#define NSA$C_MSG_ACCESS	10	/* object access audit */
#define NSA$C_MSG_SYSUAF	11	/* UAF change */
#define NSA$C_MSG_RIGHTSDB	12	/* rights database change */
#define NSA$C_MSG_CUSTOMER	13	/* customer application event */
#define NSA$C_MSG_CSS		14	/* CSS application event */
#define NSA$C_MSG_LP		15	/* layered product event */
#define NSA$C_MSG_PRVAUD	16	/* privilege audit */
#define NSA$C_MSG_RESERVED_1	17	/* reserved message type code */
#define NSA$C_MSG_RESERVED_2	18	/* reserved message type code */
#define NSA$C_MSG_RESERVED_3	19	/* reserved message type code */
#define NSA$C_MSG_RESERVED_4	20	/* reserved message type code */
#define NSA$C_MSG_MAX_CODE	21	/* last type code (plus one) */
#define NSA$V_MANDATORY 0
#define NSA$V_ACL	1
#define NSA$V_INTERNAL	2
#define NSA$V_ALARM	3
#define NSA$V_AUDIT	4
#define NSA$M_MANDATORY (1<<NSA$V_MANDATORY)	/* 0x01 */
#define NSA$M_ACL	(1<<NSA$V_ACL)		/* 0x02 */
#define NSA$M_INTERNAL	(1<<NSA$V_INTERNAL)	/* 0x04 */
#define NSA$M_ALARM	(1<<NSA$V_ALARM)	/* 0x08 */
#define NSA$M_AUDIT	(1<<NSA$V_AUDIT)	/* 0x10 */
#define NSA$C_F11X	1	/* XQP initiated audit */
#define NSA$C_RMS	2	/* known file audit */
#define NSA$C_SYS	3	/* global section audit */
#define NSA$C_VERSION_1 1	/* first version of auditing */
#define NSA$C_VERSION_2 2	/* second version of auditing (change message header) */
#define NSA$C_VERSION_3 3	/* third version of auditing (support facility code) */
#define NSA$C_V1_MSG_HDR_LENGTH 12	/* for version 1 messages */
#define NSA$K_V1_MSG_HDR_LENGTH 12
#define NSA$C_MSG_HDR_LENGTH	20	/* for latest version messages */
#define NSA$K_MSG_HDR_LENGTH	20
/* define the packet header */
struct nsamsgdef {
    unsigned short nsa$w_record_type;	 /* audit event type */
    unsigned short nsa$w_record_subtype; /* audit event subtype */
    union {
	unsigned short nsa$w_flags;	 /* auditing flags */
	struct {
	    unsigned nsa$v_mandatory: 1; /* mandatory process alarm or audit */
	    unsigned nsa$v_acl	    : 1; /* ACL generated event */
	    unsigned nsa$v_internal : 1; /* trusted entity auditing */
	    unsigned nsa$v_alarm    : 1; /* generated due to system alarm */
	    unsigned nsa$v_audit    : 1; /* generated due to system audit */
	    unsigned		    : 3;
	    unsigned		    : 8; /* padding */
	} nsa$r_flags_bits;
    } nsa$r_flags_overlay;
    unsigned short nsa$w_packet_count;	/* number of data packets */
    unsigned short nsa$w_rec_size;	/* total size (header + data packets) */
    unsigned char nsa$b_spare_3;	/* spare byte */
    unsigned char nsa$b_version;	/* security auditing version number */
    unsigned short nsa$w_spare_4[3];	/* spare words */
    unsigned short nsa$w_facility;	/* VMS facility code */
    unsigned char nsa$r_packet_list;	/* start of packets */
};
/* server control message types */
#define NSA$C_SRV_ADD_JOURNAL		1	/* add a new audit journal */
#define NSA$C_SRV_REM_JOURNAL		2	/* remove an existing audit journal */
#define NSA$C_SRV_FLUSH_JOURNAL		3	/* flush specified journal */
#define NSA$C_SRV_FLUSH_ALL_JOURNALS	4	/* flush all audit journals */
#define NSA$C_SRV_FLUSH_INTERVAL	5	/* journal flushing time interval */
#define NSA$C_SRV_ARCHIVE_DEVICE	6	/* specify archiving device */
#define NSA$C_SRV_ARCHIVE_ENABLE	7	/* archiving enable flags */
#define NSA$C_SRV_ARCHIVE_DISABLE	8	/* archiving disable flags */
#define NSA$C_SRV_ARCHIVE_INTERVAL	9	/* guaranteed archinving interval */
#define NSA$C_SRV_BADJNL_INTERVAL	10	/* bad journal scan interval */
#define NSA$C_SRV_BADJNL_LIMIT		11	/* maximum number of bad journals to keep track of */
#define NSA$C_SRV_EXIT			12	/* shut down the server */
#define NSA$C_SRV_CREATE_SYSTEM_LOG	13	/* create a new system audit log file */
#define NSA$C_SRV_AUDIT_CHANGE		14	/* change state of system auditing/alarming */
#define NSA$C_SRV_REDIRECT_SYSTEM_LOG	15	/* open the latest version of the system audit log file */
#define NSA$C_SRV_REM_ENABLE		16	/* enable resource monitoring on a journal */
#define NSA$C_SRV_REM_DISABLE		17	/* disable resource monitoring on a journal */
#define NSA$C_SRV_REM_MONITOR_INTERVAL	18	/* resource monitor interval */
#define NSA$C_SRV_REM_RESUME_INTERVAL	19	/* resource resume monitor interval */
#define NSA$C_SRV_REM_MONITOR_MODE	20	/* specify new resource monitor mode */
#define NSA$C_SRV_REM_FINAL_ACTION	21	/* specify final resource exhaustion action */
#define NSA$C_SRV_REM_WARN_THRESHOLD	22	/* resource warning threshold */
#define NSA$C_SRV_REM_ACTION_THRESHOLD	23	/* resource exhaustion action threshold */
#define NSA$C_SRV_REM_RESUME_THRESHOLD	24	/* resource resumption threshold */
#define NSA$C_SRV_REM_RESUME		25	/* force resource re-evaluation */
#define NSA$C_SRV_REM_ADD_EXCLUDE	26	/* add process to exclusion list */
#define NSA$C_SRV_REM_DEL_EXCLUDE	27	/* remove process from exclusion list */
#define NSA$C_SRV_LISTENER_ENABLE	28	/* specify listener device */
#define NSA$C_SRV_LISTENER_DISABLE	29	/* cancel listener device */
#define NSA$C_SRV_NEW_LOG		30	/* create new cluster-wide system audit log file */
#define NSA$C_SRV_RESTART		31	/* restart audit server */
#define NSA$C_SRV_LOCK_SERVER		32	/* lock audit server to prevent change */
#define NSA$C_SRV_RESERVED_1		33	/* reserved server code */
#define NSA$C_SRV_RESERVED_2		34	/* reserved server code */
#define NSA$C_SRV_RESERVED_3		35	/* reserved server code */
#define NSA$C_SRV_RESERVED_4		36	/* reserved server code */
#define NSA$C_SRV_FAILURE_MODE		37	/* change security auditing failure mode */
#define NSA$C_SRV_MAX_CODE		38	/* last message code (plus one) */
/* Define resource exhaustion monitor modes. */
#define NSA$C_REM_SPACE		1	/* # blocks to keep free on volume */
#define NSA$C_REM_PERCENTAGE	2	/* % of volume to keep free */
#define NSA$C_REM_COUNT		3	/* # msgs to reserve space for */
#define NSA$C_REM_TIME		4	/* # secs to reserve ave. msg space for */
#define NSA$C_REM_MAX_MODE	5	/* last resource monitor mode (plus one) */
/* Define final action to take when process buffer space exhausted. */
#define NSA$C_REM_PURGE_OLD	1	/* purge oldest entry from queue */
#define NSA$C_REM_IGNORE_NEW	2	/* ignore newest (current) message */
#define NSA$C_REM_RESTART	3	/* restart server - create process dump */
#define NSA$C_REM_CRASH		4	/* shutdown VMS (BUG_CHECK) */
#define NSA$C_REM_MAX_FINAL	5	/* last final action mode (plus one) */
/* Define security auditing state modification codes. */
#define NSA$C_AUDIT_DISABLED	1
#define NSA$C_AUDIT_ENABLED	2
#define NSA$C_AUDIT_TERMINATE	3
#define NSA$C_AUDIT_INITIATE	4
/* define audit flags */
#define NSA$V_AUD_ACL		0
#define NSA$V_AUD_AUDIT		1
#define NSA$V_AUD_BREAKIN	2
#define NSA$V_AUD_FILE_ACCESS	3
#define NSA$V_AUD_INSTALL	4
#define NSA$V_AUD_LOGFAIL	5
#define NSA$V_AUD_LOGIN		6
#define NSA$V_AUD_LOGOUT	7
#define NSA$V_AUD_MOUNT		8
#define NSA$V_AUD_UAF		9
#define NSA$V_AUD_PRIVILEGE	10
#define NSA$M_AUD_ACL		(1<<NSA$V_AUD_ACL)		/* 0x01 */
#define NSA$M_AUD_AUDIT		(1<<NSA$V_AUD_AUDIT)		/* 0x02 */
#define NSA$M_AUD_BREAKIN	(1<<NSA$V_AUD_BREAKIN)		/* 0x04 */
#define NSA$M_AUD_FILE_ACCESS	(1<<NSA$V_AUD_FILE_ACCESS)	/* 0x08 */
#define NSA$M_AUD_INSTALL	(1<<NSA$V_AUD_INSTALL)		/* 0x10 */
#define NSA$M_AUD_LOGFAIL	(1<<NSA$V_AUD_LOGFAIL)		/* 0x20 */
#define NSA$M_AUD_LOGIN		(1<<NSA$V_AUD_LOGIN)		/* 0x40 */
#define NSA$M_AUD_LOGOUT	(1<<NSA$V_AUD_LOGOUT)		/* 0x80 */
#define NSA$M_AUD_MOUNT		(1<<NSA$V_AUD_MOUNT)		/* 0x0100 */
#define NSA$M_AUD_UAF		(1<<NSA$V_AUD_UAF)		/* 0x0200 */
#define NSA$M_AUD_PRIVILEGE	(1<<NSA$V_AUD_PRIVILEGE)	/* 0x0400 */
union nsa$r_audit_flags {
    long nsa$l_audit_flags;
    struct {
	unsigned nsa$v_aud_acl	      : 1; /* ACL requested audit */
	unsigned nsa$v_aud_audit      : 1; /* SET AUDIT operations */
	unsigned nsa$v_aud_breakin    : 1; /* BREAKIN detection */
	unsigned nsa$v_aud_file_access: 1; /* privileged file access */
	unsigned nsa$v_aud_install    : 1; /* INSTALL operations */
	unsigned nsa$v_aud_logfail    : 1; /* LOGIN failures */
	unsigned nsa$v_aud_login      : 1; /* successful LOGINs */
	unsigned nsa$v_aud_logout     : 1; /* LOGOUTs */
	unsigned nsa$v_aud_mount      : 1; /* MOUNT and DISMOUNT requests */
	unsigned nsa$v_aud_uaf	      : 1; /* SYSUAF and NETUAF operations */
	unsigned nsa$v_aud_privilege  : 1; /* privilege audit mask */
	unsigned		      : 5;
	unsigned		      : 16; /* padding */
    } nsa$r_aud_flags_bits;
};
/* Define security auditing failure mode codes. */
#define NSA$C_FAIL_WAIT		1	/* wait for resource (if possible) */
#define NSA$C_FAIL_CRASH	2	/* crash system on failure */
#define NSA$C_FAIL_IGNORE	3	/* ignore failing audit */
#define NSA$C_FAIL_MAX_MODE	4	/* last failure mode (plus one) */
/* Define breakin, login, logout, and login failure codes. */
#define NSA$C_BATCH	1
#define NSA$C_DETACHED	2
#define NSA$C_DIALUP	3
#define NSA$C_LOCAL	4
#define NSA$C_NETWORK	5
#define NSA$C_REMOTE	6
#define NSA$C_SUBPROCESS 7
/* Define installed file database state modification codes. */
#define NSA$C_INSTALL_ADD	1
#define NSA$C_INSTALL_REMOVE	2
/* Define installed file database state modification qualifier codes. */
/* Also, the codes used by the audit message formatting tables. */
#define NSA$V_INS_SPARE_0	0
#define NSA$V_INS_OPEN		1
#define NSA$V_INS_HEADER_RESIDENT 2
#define NSA$V_INS_SHARED	3
#define NSA$V_INS_EXECUTE_ONLY	4
#define NSA$V_INS_WRITEABLE	5
#define NSA$V_INS_PRIVILEGED	6
#define NSA$V_INS_PROTECTED	7
#define NSA$V_INS_NOPURGE	8
#define NSA$V_INS_ACCOUNTING	9
#define NSA$M_INS_SPARE_0	(1<<NSA$V_INS_SPARE_0)		/* 0x01 */
#define NSA$M_INS_OPEN		(1<<NSA$V_INS_OPEN)		/* 0x02 */
#define NSA$M_INS_HEADER_RESIDENT (1<<NSA$V_INS_HEADER_RESIDENT) /* 0x04 */
#define NSA$M_INS_SHARED	(1<<NSA$V_INS_SHARED)		/* 0x08 */
#define NSA$M_INS_EXECUTE_ONLY	(1<<NSA$V_INS_EXECUTE_ONLY)	/* 0x10 */
#define NSA$M_INS_WRITEABLE	(1<<NSA$V_INS_WRITEABLE)	/* 0x20 */
#define NSA$M_INS_PRIVILEGED	(1<<NSA$V_INS_PRIVILEGED)	/* 0x40 */
#define NSA$M_INS_PROTECTED	(1<<NSA$V_INS_PROTECTED)	/* 0x80 */
#define NSA$M_INS_NOPURGE	(1<<NSA$V_INS_NOPURGE)		/* 0x0100 */
#define NSA$M_INS_ACCOUNTING	(1<<NSA$V_INS_ACCOUNTING)	/* 0x0200 */
union nsa$r_install_flags {
    long nsa$l_install_flags;
    struct {
	unsigned nsa$v_ins_spare_0	: 1;
	unsigned nsa$v_ins_open		: 1;
	unsigned nsa$v_ins_header_resident : 1;
	unsigned nsa$v_ins_shared	: 1;
	unsigned nsa$v_ins_execute_only : 1;
	unsigned nsa$v_ins_writeable	: 1;
	unsigned nsa$v_ins_privileged	: 1;
	unsigned nsa$v_ins_protected	: 1;
	unsigned nsa$v_ins_nopurge	: 1;
	unsigned nsa$v_ins_accounting	: 1;
	unsigned			: 6;
	unsigned			: 16;	/* padding */
    } nsa$r_ins_flags_bits;
};
#define NSA$C_INS_SPARE_0	1
#define NSA$C_INS_OPEN		2
#define NSA$C_INS_HEADER_RESIDENT 3
#define NSA$C_INS_SHARED	4
#define NSA$C_INS_EXECUTE_ONLY	5
#define NSA$C_INS_WRITEABLE	6
#define NSA$C_INS_PRIVILEGED	7
#define NSA$C_INS_PROTECTED	8
#define NSA$C_INS_NOPURGE	9
#define NSA$C_INS_ACCOUNTING	10
#define NSA$C_INS_MAX_CODE	11
/* Define volume state modification codes. */
#define NSA$C_VOL_DISMOUNT	1
#define NSA$C_VOL_MOUNT		2
/* Define volume state modification qualifier codes. */
/* Also, the codes used by the audit message formatting tables. */
#define NSA$V_MNT_FOREIGN	0
#define NSA$V_MNT_GROUP		1
#define NSA$V_MNT_NOASSIST	2
#define NSA$V_MNT_NODISKQ	3
#define NSA$V_MNT_NOHDR3	4
#define NSA$V_MNT_NOLABEL	5
#define NSA$V_MNT_NOWRITE	6
#define NSA$V_MNT_OVR_ACCESS	7
#define NSA$V_MNT_OVR_EXP	8
#define NSA$V_MNT_OVR_IDENT	9
#define NSA$V_MNT_OVR_SETID	10
#define NSA$V_MNT_READCHECK	11
#define NSA$V_MNT_SHARE		12
#define NSA$V_MNT_MESSAGE	13
#define NSA$V_MNT_SYSTEM	14
#define NSA$V_MNT_WRITECHECK	15
#define NSA$V_MNT_WRITETHRU	16
#define NSA$V_MNT_NOCACHE	17
#define NSA$V_MNT_OVR_LOCK	18
#define NSA$V_MNT_NOMNTVER	19
#define NSA$V_MNT_NOUNLOAD	20
#define NSA$V_MNT_NOJRNL	21
#define NSA$V_MNT_NEWJRNL	22
#define NSA$V_MNT_NOAUTO	23
#define NSA$V_MNT_INIT_ALL	24
#define NSA$V_MNT_INIT_CONT	25
#define NSA$V_MNT_OVR_VOLO	26
#define NSA$V_MNT_INTERCHG	27
#define NSA$V_MNT_CLUSTER	28
#define NSA$M_MNT_FOREIGN	(1<<NSA$V_MNT_FOREIGN)		/* 0x01 */
#define NSA$M_MNT_GROUP		(1<<NSA$V_MNT_GROUP)		/* 0x02 */
#define NSA$M_MNT_NOASSIST	(1<<NSA$V_MNT_NOASSIST)		/* 0x04 */
#define NSA$M_MNT_NODISKQ	(1<<NSA$V_MNT_NODISKQ)		/* 0x08 */
#define NSA$M_MNT_NOHDR3	(1<<NSA$V_MNT_NOHDR3)		/* 0x10 */
#define NSA$M_MNT_NOLABEL	(1<<NSA$V_MNT_NOLABEL)		/* 0x20 */
#define NSA$M_MNT_NOWRITE	(1<<NSA$V_MNT_NOWRITE)		/* 0x40 */
#define NSA$M_MNT_OVR_ACCESS	(1<<NSA$V_MNT_OVR_ACCESS)	/* 0x80 */
#define NSA$M_MNT_OVR_EXP	(1<<NSA$V_MNT_OVR_EXP)		/* 0x0100 */
#define NSA$M_MNT_OVR_IDENT	(1<<NSA$V_MNT_OVR_IDENT)	/* 0x0200 */
#define NSA$M_MNT_OVR_SETID	(1<<NSA$V_MNT_OVR_SETID)	/* 0x0400 */
#define NSA$M_MNT_READCHECK	(1<<NSA$V_MNT_READCHECK)	/* 0x0800 */
#define NSA$M_MNT_SHARE		(1<<NSA$V_MNT_SHARE)		/* 0x1000 */
#define NSA$M_MNT_MESSAGE	(1<<NSA$V_MNT_MESSAGE)		/* 0x2000 */
#define NSA$M_MNT_SYSTEM	(1<<NSA$V_MNT_SYSTEM)		/* 0x4000 */
#define NSA$M_MNT_WRITECHECK	(1<<NSA$V_MNT_WRITECHECK)	/* 0x8000 */
#define NSA$M_MNT_WRITETHRU	(1<<NSA$V_MNT_WRITETHRU)	/* 0x010000 */
#define NSA$M_MNT_NOCACHE	(1<<NSA$V_MNT_NOCACHE)		/* 0x020000 */
#define NSA$M_MNT_OVR_LOCK	(1<<NSA$V_MNT_OVR_LOCK)		/* 0x040000 */
#define NSA$M_MNT_NOMNTVER	(1<<NSA$V_MNT_NOMNTVER)		/* 0x080000 */
#define NSA$M_MNT_NOUNLOAD	(1<<NSA$V_MNT_NOUNLOAD)		/* 0x100000 */
#define NSA$M_MNT_NOJRNL	(1<<NSA$V_MNT_NOJRNL)		/* 0x200000 */
#define NSA$M_MNT_NEWJRNL	(1<<NSA$V_MNT_NEWJRNL)		/* 0x400000 */
#define NSA$M_MNT_NOAUTO	(1<<NSA$V_MNT_NOAUTO)		/* 0x800000 */
#define NSA$M_MNT_INIT_ALL	(1<<NSA$V_MNT_INIT_ALL)		/* 0x01000000 */
#define NSA$M_MNT_INIT_CONT	(1<<NSA$V_MNT_INIT_CONT)	/* 0x02000000 */
#define NSA$M_MNT_OVR_VOLO	(1<<NSA$V_MNT_OVR_VOLO)		/* 0x04000000 */
#define NSA$M_MNT_INTERCHG	(1<<NSA$V_MNT_INTERCHG)		/* 0x08000000 */
#define NSA$M_MNT_CLUSTER	(1<<NSA$V_MNT_CLUSTER)		/* 0x10000000 */
union nsa$r_mount_flags {
    long nsa$l_mount_flags;
    struct {
	unsigned nsa$v_mnt_foreign   : 1;
	unsigned nsa$v_mnt_group     : 1;
	unsigned nsa$v_mnt_noassist  : 1;
	unsigned nsa$v_mnt_nodiskq   : 1;
	unsigned nsa$v_mnt_nohdr3    : 1;
	unsigned nsa$v_mnt_nolabel   : 1;
	unsigned nsa$v_mnt_nowrite   : 1;
	unsigned nsa$v_mnt_ovr_access: 1;
	unsigned nsa$v_mnt_ovr_exp   : 1;
	unsigned nsa$v_mnt_ovr_ident : 1;
	unsigned nsa$v_mnt_ovr_setid : 1;
	unsigned nsa$v_mnt_readcheck : 1;
	unsigned nsa$v_mnt_share     : 1;
	unsigned nsa$v_mnt_message   : 1;
	unsigned nsa$v_mnt_system    : 1;
	unsigned nsa$v_mnt_writecheck: 1;
	unsigned nsa$v_mnt_writethru : 1;
	unsigned nsa$v_mnt_nocache   : 1;
	unsigned nsa$v_mnt_ovr_lock  : 1;
	unsigned nsa$v_mnt_nomntver  : 1;
	unsigned nsa$v_mnt_nounload  : 1;
	unsigned nsa$v_mnt_nojrnl    : 1;
	unsigned nsa$v_mnt_newjrnl   : 1;
	unsigned nsa$v_mnt_noauto    : 1;
	unsigned nsa$v_mnt_init_all  : 1;
	unsigned nsa$v_mnt_init_cont : 1;
	unsigned nsa$v_mnt_ovr_volo  : 1;
	unsigned nsa$v_mnt_interchg  : 1;
	unsigned nsa$v_mnt_cluster   : 1;
	unsigned		     : 3;
    } nsa$r_mnt_flags_bits;
};
#define NSA$C_MNT_FOREIGN	1
#define NSA$C_MNT_GROUP		2
#define NSA$C_MNT_NOASSIST	3
#define NSA$C_MNT_NODISKQ	4
#define NSA$C_MNT_NOHDR3	5
#define NSA$C_MNT_NOLABEL	6
#define NSA$C_MNT_NOWRITE	7
#define NSA$C_MNT_OVR_ACCESS	8
#define NSA$C_MNT_OVR_EXP	9
#define NSA$C_MNT_OVR_IDENT	10
#define NSA$C_MNT_OVR_SETID	11
#define NSA$C_MNT_READCHECK	12
#define NSA$C_MNT_SHARE		13
#define NSA$C_MNT_MESSAGE	14
#define NSA$C_MNT_SYSTEM	15
#define NSA$C_MNT_WRITECHECK	16
#define NSA$C_MNT_WRITETHRU	17
#define NSA$C_MNT_NOCACHE	18
#define NSA$C_MNT_OVR_LOCK	19
#define NSA$C_MNT_NOMNTVER	20
#define NSA$C_MNT_NOUNLOAD	21
#define NSA$C_MNT_NOJRNL	22
#define NSA$C_MNT_NEWJRNL	23
#define NSA$C_MNT_NOAUTO	24
#define NSA$C_MNT_INIT_ALL	25
#define NSA$C_MNT_INIT_CONT	26
#define NSA$C_MNT_OVR_VOLO	27
#define NSA$C_MNT_INTERCHG	28
#define NSA$C_MNT_CLUSTER	29
#define NSA$C_MNT_MAX_CODE	30
#define NSA$V_DMT_NOUNLOAD	0
#define NSA$V_DMT_UNIT		1
#define NSA$V_DMT_ABORT		2
#define NSA$V_DMT_CLUSTER	3
#define NSA$M_DMT_NOUNLOAD	(1<<NSA$V_DMT_NOUNLOAD) /* 0x01 */
#define NSA$M_DMT_UNIT		(1<<NSA$V_DMT_UNIT)	/* 0x02 */
#define NSA$M_DMT_ABORT		(1<<NSA$V_DMT_ABORT)	/* 0x04 */
#define NSA$M_DMT_CLUSTER	(1<<NSA$V_DMT_CLUSTER)	/* 0x08 */
union nsa$r_dismount_flags {
    long nsa$l_dismount_flags;
    struct {
	unsigned nsa$v_dmt_nounload: 1;
	unsigned nsa$v_dmt_unit    : 1;
	unsigned nsa$v_dmt_abort   : 1;
	unsigned nsa$v_dmt_cluster : 1;
	unsigned		   : 4;
	unsigned		   : 24; /* padding */
    } nsa$r_dmt_flags_bits;
};
#define NSA$C_DMT_NOUNLOAD	1
#define NSA$C_DMT_UNIT		2
#define NSA$C_DMT_ABORT		3
#define NSA$C_DMT_CLUSTER	4
#define NSA$C_DMT_MAX_CODE	5
/* Define network authorization file modification codes. */
#define NSA$C_NETUAF_ADD	1
#define NSA$C_NETUAF_DELETE	2
#define NSA$C_NETUAF_MODIFY	3
/* Define object access codes; these parallel object codes defined in $ACEDEF */
#define NSA$C_FILE_ACCESS	1
#define NSA$C_DEVICE_ACCESS	2
#define NSA$C_JOBCTL_QUEUE_ACCESS 3
#define NSA$C_CEF_ACCESS	4
#define NSA$C_LNM_ACCESS	5
#define NSA$C_PROCESS_ACCESS	6
#define NSA$C_GRPGBL_ACCESS	7
#define NSA$C_SYSGBL_ACCESS	8
#define NSA$C_RESERVED_1_ACCESS 9
#define NSA$C_RESERVED_2_ACCESS 10
#define NSA$C_RESERVED_3_ACCESS 11
#define NSA$C_RESERVED_4_ACCESS 12
#define NSA$C_OBJECT_ACCESS	13	/* obsolete -- must be last */
#define NSA$C_ACCESS_MAX_CODE	14
/* Define system authorization file modification codes. */
#define NSA$C_SYSUAF_ADD	1
#define NSA$C_SYSUAF_COPY	2
#define NSA$C_SYSUAF_DELETE	3
#define NSA$C_SYSUAF_MODIFY	4
#define NSA$C_SYSUAF_RENAME	5
/* Define rights database modification codes. */
#define NSA$C_RDB_ADD_ID	1
#define NSA$C_RDB_CREATE	2
#define NSA$C_RDB_GRANT_ID	3
#define NSA$C_RDB_MOD_HOLDER	4
#define NSA$C_RDB_MOD_ID	5
#define NSA$C_RDB_REM_ID	6
#define NSA$C_RDB_REVOKE_ID	7
#define NSA$C_RDB_MAX_CODE	8
/* Define enhanced privilege audit codes. */
#define NSA$C_PRVAUD_SUCCESS	1	/* successful use of privilege */
#define NSA$C_PRVAUD_FAILURE	2	/* event due to privilege failure */
/* define data packet format */
#define NSA$C_PKT_ACCESS_DESIRED 1	/* access requested */
#define NSA$C_PKT_ACCOUNT	2	/* account name */
#define NSA$C_PKT_ALARM_NAME	3	/* alarm journal name */
#define NSA$C_PKT_APPL_DATA	4	/* application supplied data */
#define NSA$C_PKT_AUDIT_FLAGS	5	/* audit flags */
#define NSA$C_PKT_AUDIT_NAME	6	/* audit journal name */
#define NSA$C_PKT_SYSTEM_NAME	7	/* SCS system node name */
#define NSA$C_PKT_SYSTEM_ID	8	/* SCS system node identification */
#define NSA$C_PKT_DEVICE_NAME	9	/* primary device name on which the volume resides */
#define NSA$C_PKT_DISMOUNT_FLAGS 10	/* volume dismount flags */
#define NSA$C_PKT_HOLDER_NAME	11	/* holder name */
#define NSA$C_PKT_HOLDER_OWNER	12	/* holder owner ID */
#define NSA$C_PKT_ID_ATTRIBUTES 13	/* identifier attributes */
#define NSA$C_PKT_ID_NAME	14	/* identifier name */
#define NSA$C_PKT_ID_NEW_NAME	15	/* identifer new name */
#define NSA$C_PKT_ID_VALUE	16	/* identifier value */
#define NSA$C_PKT_ID_NEW_VALUE	17	/* identifier new value */
#define NSA$C_PKT_IDENTIFIERS_USED 18	/* identifiers used to gain access */
#define NSA$C_PKT_IMAGE_NAME	19	/* name of the image being executed */
#define NSA$C_PKT_INSTALL_FILE	20	/* installed file */
#define NSA$C_PKT_INSTALL_FLAGS 21	/* INSTALL flags */
#define NSA$C_PKT_INSTALL_PRIVS 22	/* INSTALL privileges */
#define NSA$C_PKT_LOGICAL_NAME	23	/* logical name associated with the device. */
#define NSA$C_PKT_MOUNT_FLAGS	24	/* volume mount flags */
#define NSA$C_PKT_NEW_DATA	25	/* data after modification */
#define NSA$C_PKT_OBJECT_ID	26	/* unique object identification code */
#define NSA$C_PKT_OBJECT_MIN_CLASS 27	/* minimum object access classification */
#define NSA$C_PKT_OBJECT_MAX_CLASS 28	/* maximum object access classification */
#define NSA$C_PKT_OBJECT_NAME	29	/* the object's name */
#define NSA$C_PKT_OBJECT_NAME_2 30	/* secondary (path) object name */
#define NSA$C_PKT_OBJECT_OWNER	31	/* owner identifier (UIC) of the process */
#define NSA$C_PKT_OBJECT_PROTECTION 32	/* UIC based protection of the object */
#define NSA$C_PKT_OBJECT_TYPE	33	/* object's type code */
#define NSA$C_PKT_ORIGINAL_DATA 34	/* data before modification */
#define NSA$C_PKT_PARENT_ID	35	/* PID of the parent process */
#define NSA$C_PKT_PARENT_NAME	36	/* parent process name */
#define NSA$C_PKT_PARENT_OWNER	37	/* parent process' current 'UIC' */
#define NSA$C_PKT_PARENT_USERNAME 38	/* parent process' username */
#define NSA$C_PKT_PASSWORD	39	/* breakin password */
#define NSA$C_PKT_PRIVS_USED	40	/* privileges used to gain access */
#define NSA$C_PKT_PROCESS_ID	41	/* current process PID */
#define NSA$C_PKT_PROCESS_NAME	42	/* current process name */
#define NSA$C_PKT_REMOTE_NODE_ID 43	/* node ID of network source */
#define NSA$C_PKT_REMOTE_NODENAME 44	/* remote nodename */
#define NSA$C_PKT_REMOTE_USERNAME 45	/* remote username */
#define NSA$C_PKT_SUBJECT_CLASS 46	/* process' current access class */
#define NSA$C_PKT_SUBJECT_OWNER 47	/* process' current 'UIC' */
#define NSA$C_PKT_FINAL_STATUS	48	/* completion status */
#define NSA$C_PKT_TERMINAL	49	/* process' terminal name */
#define NSA$C_PKT_TIME_STAMP	50	/* when the event took place */
#define NSA$C_PKT_UAF_ADD	51	/* UAF record added */
#define NSA$C_PKT_UAF_DELETE	52	/* UAF record removed */
#define NSA$C_PKT_UAF_MODIFY	53	/* UAF record modified */
#define NSA$C_PKT_UAF_COPY	54	/* UAF record copied */
#define NSA$C_PKT_UAF_FIELDS	55	/* UAF fields modified */
#define NSA$C_PKT_USERNAME	56	/* requestor username */
#define NSA$C_PKT_UAF_SOURCE	57	/* UAF source username */
#define NSA$C_PKT_UAF_RENAME	58	/* UAF record renamed */
#define NSA$C_PKT_VOLUME_NAME	59	/* mount/dismount volume name */
#define NSA$C_PKT_VOLUME_SET_NAME 60	/* volume set name */
/* Define client/server packets. */
#define NSA$C_PKT_SERVER_ACCOUNT	61	/* server account */
#define NSA$C_PKT_SERVER_SYSTEM_ID	62	/* server system id */
#define NSA$C_PKT_SERVER_SYSTEM_NAME	63	/* server system name */
#define NSA$C_PKT_SERVER_FINAL_STATUS	64	/* server status */
#define NSA$C_PKT_SERVER_IMAGE_NAME	65	/* server image name */
#define NSA$C_PKT_SERVER_PARENT_ID	66	/* server parent id */
#define NSA$C_PKT_SERVER_PARENT_OWNER	67	/* server parent owner */
#define NSA$C_PKT_SERVER_PARENT_NAME	68	/* server parent process name */
#define NSA$C_PKT_SERVER_PROCESS_ID	69	/* server process id */
#define NSA$C_PKT_SERVER_PROCESS_NAME	70	/* server process name */
#define NSA$C_PKT_SERVER_SUBJECT_CLASS	71	/* server classification */
#define NSA$C_PKT_SERVER_SUBJECT_OWNER	72	/* server owner ('UIC') */
#define NSA$C_PKT_SERVER_TERMINAL	73	/* server terminal */
#define NSA$C_PKT_SERVER_TIME_STAMP	74	/* server timestamp */
#define NSA$C_PKT_SERVER_USERNAME	75	/* server username */
/* additional packets */
#define NSA$C_PKT_AUDIT_DISABLE		76	/* audit event disable mask */
#define NSA$C_PKT_AUDIT_ENABLE		77	/* audit event enable mask */
#define NSA$C_PKT_ALARM_DISABLE		78	/* alarm event disable mask */
#define NSA$C_PKT_ALARM_ENABLE		79	/* alarm event enable mask */
#define NSA$C_PKT_PERFORMANCE_NOP	80	/* no-op (delete) packet for performance */
#define NSA$C_PKT_REPLY_MAILBOX		81	/* message acknowledge mailbox */
#define NSA$C_PKT_DEFAULT_USERNAME	82	/* NETUAF default proxy account */
#define NSA$C_PKT_LOCAL_USERNAME	83	/* NETUAF local proxy account */
#define NSA$C_PKT_FIELD_NAME		84	/* name of (NEW_DATA/ORIGINAL_DATA) field */
#define NSA$C_PKT_LISTENER_DEVICE	85	/* listener device name */
#define NSA$C_PKT_FIELD_TITLE_STR	86	/* field title string (formerly PKT_RESERVED_1_1) */
#define NSA$C_PKT_FIELD_DATA_STR	87	/* field data string (formerly PKT_RESERVED_1_2) */
#define NSA$C_PKT_MESSAGE_TYPE_STR	88	/* event message type string (formerly PKT_RESERVED_1_3) */
#define NSA$C_PKT_RESERVED_1_4	89	/* reserved packet codes, block 1 */
#define NSA$C_PKT_RESERVED_1_5	90
#define NSA$C_PKT_RESERVED_1_6	91
#define NSA$C_PKT_RESERVED_1_7	92
#define NSA$C_PKT_RESERVED_1_8	93
#define NSA$C_PKT_CUSTOMER_1	94	/* customer packet codes, block 1 */
#define NSA$C_PKT_CUSTOMER_2	95
#define NSA$C_PKT_CUSTOMER_3	96
#define NSA$C_PKT_CUSTOMER_4	97
#define NSA$C_PKT_CUSTOMER_5	98
#define NSA$C_PKT_CUSTOMER_6	99
#define NSA$C_PKT_CUSTOMER_7	100
#define NSA$C_PKT_CUSTOMER_8	101
#define NSA$C_PKT_CSS_1		102	/* CSS packet codes, block 1 */
#define NSA$C_PKT_CSS_2		103
#define NSA$C_PKT_CSS_3		104
#define NSA$C_PKT_CSS_4		105
#define NSA$C_PKT_CSS_5		106
#define NSA$C_PKT_CSS_6		107
#define NSA$C_PKT_CSS_7		108
#define NSA$C_PKT_CSS_8		109
#define NSA$C_PKT_LP_1		110	/* layered product packet codes, block 1 */
#define NSA$C_PKT_LP_2		111
#define NSA$C_PKT_LP_3		112
#define NSA$C_PKT_LP_4		113
#define NSA$C_PKT_LP_5		114
#define NSA$C_PKT_LP_6		115
#define NSA$C_PKT_LP_7		116
#define NSA$C_PKT_LP_8		117
#define NSA$C_PKT_ALARM_FAILURE 118	/* alarm failure mode */
#define NSA$C_PKT_AUDIT_FAILURE 119	/* audit failure mode */
#define NSA$C_PKT_MAX_CODE	120	/* must be last */
#define NSA$C_PKT_HDR_LENGTH	4
#define NSA$K_PKT_HDR_LENGTH	4
/* Define $audit_event item codes. */
#define NSA$_ACCESS_DESIRED	1	/* access requested */
#define NSA$_ACCOUNT		2	/* account name */
#define NSA$_ALARM_NAME		3	/* alarm journal name */
#define NSA$_APPL_DATA		4	/* application supplied data */
#define NSA$_AUDIT_FLAGS	5	/* audit flags */
#define NSA$_AUDIT_NAME		6	/* audit journal name */
#define NSA$_SYSTEM_NAME	7	/* SCS system node name */
#define NSA$_SYSTEM_ID		8	/* SCS system node identification */
#define NSA$_DEVICE_NAME	9	/* primary device name on which the volume resides */
#define NSA$_DISMOUNT_FLAGS	10	/* volume dismount flags */
#define NSA$_HOLDER_NAME	11	/* holder name */
#define NSA$_HOLDER_OWNER	12	/* holder owner ID */
#define NSA$_ID_ATTRIBUTES	13	/* identifier attributes */
#define NSA$_ID_NAME		14	/* identifier name */
#define NSA$_ID_NEW_NAME	15	/* identifer new name */
#define NSA$_ID_VALUE		16	/* identifier value */
#define NSA$_ID_NEW_VALUE	17	/* identifier new value */
#define NSA$_IDENTIFIERS_USED	18	/* identifiers used to gain access */
#define NSA$_IMAGE_NAME		19	/* name of the image being executed */
#define NSA$_INSTALL_FILE	20	/* installed file */
#define NSA$_INSTALL_FLAGS	21	/* INSTALL flags */
#define NSA$_INSTALL_PRIVS	22	/* INSTALL privileges */
#define NSA$_LOGICAL_NAME	23	/* logical name associated with the device. */
#define NSA$_MOUNT_FLAGS	24	/* volume mount flags */
#define NSA$_NEW_DATA		25	/* data after modification */
#define NSA$_OBJECT_ID		26	/* unique object identification code */
#define NSA$_OBJECT_MIN_CLASS	27	/* minimum object access classification */
#define NSA$_OBJECT_MAX_CLASS	28	/* maximum object access classification */
#define NSA$_OBJECT_NAME	29	/* the object's name */
#define NSA$_OBJECT_NAME_2	30	/* secondary (path) object name */
#define NSA$_OBJECT_OWNER	31	/* owner identifier (UIC) of the process */
#define NSA$_OBJECT_PROTECTION	32	/* UIC based protection of the object */
#define NSA$_OBJECT_TYPE	33	/* object's type code */
#define NSA$_ORIGINAL_DATA	34	/* data before modification */
#define NSA$_PARENT_ID		35	/* PID of the parent process */
#define NSA$_PARENT_NAME	36	/* parent process' name */
#define NSA$_PARENT_OWNER	37	/* parent process' current 'UIC' */
#define NSA$_PARENT_USERNAME	38	/* parent process' username */
#define NSA$_PASSWORD		39	/* breakin password */
#define NSA$_PRIVS_USED		40	/* privileges used to gain access */
#define NSA$_PROCESS_ID		41	/* current process PID */
#define NSA$_PROCESS_NAME	42	/* current process name */
#define NSA$_REMOTE_NODE_ID	43	/* node ID of network source */
#define NSA$_REMOTE_NODENAME	44	/* remote nodename */
#define NSA$_REMOTE_USERNAME	45	/* remote username */
#define NSA$_SUBJECT_CLASS	46	/* process' current access class */
#define NSA$_SUBJECT_OWNER	47	/* process' current 'UIC' */
#define NSA$_FINAL_STATUS	48	/* completion status */
#define NSA$_TERMINAL		49	/* process' terminal name */
#define NSA$_TIME_STAMP		50	/* when the event took place */
#define NSA$_UAF_ADD		51	/* UAF record added */
#define NSA$_UAF_DELETE		52	/* UAF record removed */
#define NSA$_UAF_MODIFY		53	/* UAF record modified */
#define NSA$_UAF_COPY		54	/* UAF record copied */
#define NSA$_UAF_FIELDS		55	/* UAF fields modified */
#define NSA$_USERNAME		56	/* requestor username */
#define NSA$_UAF_SOURCE		57	/* secondary username */
#define NSA$_UAF_RENAME		58	/* UAF record renamed */
#define NSA$_VOLUME_NAME	59	/* mount/dismount volume name */
#define NSA$_VOLUME_SET_NAME	60	/* volume set name */
#define NSA$_SERVER_ACCOUNT	61	/* server account */
#define NSA$_SERVER_SYSTEM_ID	62	/* server system id */
#define NSA$_SERVER_SYSTEM_NAME 63	/* server system name */
#define NSA$_SERVER_FINAL_STATUS 64	/* server status */
#define NSA$_SERVER_IMAGE_NAME	65	/* server image name */
#define NSA$_SERVER_PARENT_ID	66	/* server parent id */
#define NSA$_SERVER_PARENT_OWNER 67	/* server parent owner */
#define NSA$_SERVER_PARENT_NAME 68	/* server parent process name */
#define NSA$_SERVER_PROCESS_ID	69	/* server process id */
#define NSA$_SERVER_PROCESS_NAME 70	/* server process name */
#define NSA$_SERVER_SUBJECT_CLASS 71	/* server classification */
#define NSA$_SERVER_SUBJECT_OWNER 72	/* server owner ('UIC') */
#define NSA$_SERVER_TERMINAL	73	/* server terminal */
#define NSA$_SERVER_TIME_STAMP	74	/* server timestamp */
#define NSA$_SERVER_USERNAME	75	/* server username */
#define NSA$_AUDIT_DISABLE	76	/* audit event disable mask */
#define NSA$_AUDIT_ENABLE	77	/* audit event enable mask */
#define NSA$_ALARM_DISABLE	78	/* alarm event disable mask */
#define NSA$_ALARM_ENABLE	79	/* alarm event enable mask */
#define NSA$_PERFORMANCE_NOP	80	/* no-op (delete) packet for performance */
#define NSA$_REPLY_MAILBOX	81	/* message acknowledge mailbox */
#define NSA$_DEFAULT_USERNAME	82	/* NETUAF proxy default account */
#define NSA$_LOCAL_USERNAME	83	/* NETUAF proxy local account */
#define NSA$_FIELD_NAME		84	/* name of (NEW_DATA/ORIGINAL_DATA) field */
#define NSA$_LISTENER_DEVICE	85	/* listener device name */
#define NSA$_FIELD_TITLE_STR	86	/* field title string (formerly RESERVED_1_1) */
#define NSA$_FIELD_DATA_STR	87	/* field data string (formerly RESERVED_1_2) */
#define NSA$_MESSAGE_TYPE_STR	88	/* event message type string (formerly RESERVED_1_3) */
#define NSA$_RESERVED_1_4	89	/* reserved packet codes, block 1 */
#define NSA$_RESERVED_1_5	90
#define NSA$_RESERVED_1_6	91
#define NSA$_RESERVED_1_7	92
#define NSA$_RESERVED_1_8	93
#define NSA$_CUSTOMER_1		94	/* customer packet codes, block 1 */
#define NSA$_CUSTOMER_2		95
#define NSA$_CUSTOMER_3		96
#define NSA$_CUSTOMER_4		97
#define NSA$_CUSTOMER_5		98
#define NSA$_CUSTOMER_6		99
#define NSA$_CUSTOMER_7		100
#define NSA$_CUSTOMER_8		101
#define NSA$_CSS_1		102	/* CSS packet codes, block 1 */
#define NSA$_CSS_2		103
#define NSA$_CSS_3		104
#define NSA$_CSS_4		105
#define NSA$_CSS_5		106
#define NSA$_CSS_6		107
#define NSA$_CSS_7		108
#define NSA$_CSS_8		109
#define NSA$_LP_1		110	/* layered product packet codes, block 1 */
#define NSA$_LP_2		111
#define NSA$_LP_3		112
#define NSA$_LP_4		113
#define NSA$_LP_5		114
#define NSA$_LP_6		115
#define NSA$_LP_7		116
#define NSA$_LP_8		117
#define NSA$_MAX_ITM_CODE	118	/* must be last */
#define NSA$_CLIENT_ACCOUNT		2
#define NSA$_CLIENT_SYSTEM_NAME		7
#define NSA$_CLIENT_SYSTEM_ID		8
#define NSA$_CLIENT_IMAGE_NAME		19
#define NSA$_CLIENT_PARENT_ID		35
#define NSA$_CLIENT_PARENT_NAME		36
#define NSA$_CLIENT_PARENT_OWNER	37
#define NSA$_CLIENT_PROCESS_ID		41
#define NSA$_CLIENT_PROCESS_NAME	42
#define NSA$_CLIENT_SUBJECT_CLASS	46
#define NSA$_CLIENT_SUBJECT_OWNER	47
#define NSA$_CLIENT_FINAL_STATUS	48
#define NSA$_CLIENT_TERMINAL		49
#define NSA$_CLIENT_TIME_STAMP		50
#define NSA$_CLIENT_USERNAME		56
struct nsadatadef {
    unsigned short nsa$w_packet_size;	/* Data packet size */
    unsigned short nsa$w_packet_type;	/* Data packet type */
    unsigned char nsa$r_packet_data;	/* Start of packet data */
};
/* Define flag masks for nsa$event_audit supplied parameter. */
/* Each bit set tells nsa$event_audit *not* to default that */
/* corresponding packet from the current process. */
#define NSA$V_ACCOUNT_NAME	0
#define NSA$V_SYSTEM_ID		1
#define NSA$V_SYSTEM_NAME	2
#define NSA$V_FINAL_STATUS	3
#define NSA$V_IMAGE_NAME	4
#define NSA$V_PARENT_ID		5
#define NSA$V_PARENT_OWNER	6
#define NSA$V_PARENT_NAME	7
#define NSA$V_PROCESS_ID	8
#define NSA$V_PROCESS_NAME	9
#define NSA$V_SUBJECT_CLASS	10
#define NSA$V_SUBJECT_OWNER	11
#define NSA$V_TERMINAL		12
#define NSA$V_TIME_STAMP	13
#define NSA$V_USERNAME		14
#define NSA$V_PARENT_USERNAME	15
#define NSA$M_ACCOUNT_NAME	(1<<NSA$V_ACCOUNT_NAME)		/* 0x01 */
#define NSA$M_SYSTEM_ID		(1<<NSA$V_SYSTEM_ID)		/* 0x02 */
#define NSA$M_SYSTEM_NAME	(1<<NSA$V_SYSTEM_NAME)		/* 0x04 */
#define NSA$M_FINAL_STATUS	(1<<NSA$V_FINAL_STATUS)		/* 0x08 */
#define NSA$M_IMAGE_NAME	(1<<NSA$V_IMAGE_NAME)		/* 0x10 */
#define NSA$M_PARENT_ID		(1<<NSA$V_PARENT_ID)		/* 0x20 */
#define NSA$M_PARENT_OWNER	(1<<NSA$V_PARENT_OWNER)		/* 0x40 */
#define NSA$M_PARENT_NAME	(1<<NSA$V_PARENT_NAME)		/* 0x80 */
#define NSA$M_PROCESS_ID	(1<<NSA$V_PROCESS_ID)		/* 0x0100 */
#define NSA$M_PROCESS_NAME	(1<<NSA$V_PROCESS_NAME)		/* 0x0200 */
#define NSA$M_SUBJECT_CLASS	(1<<NSA$V_SUBJECT_CLASS)	/* 0x0400 */
#define NSA$M_SUBJECT_OWNER	(1<<NSA$V_SUBJECT_OWNER)	/* 0x0800 */
#define NSA$M_TERMINAL		(1<<NSA$V_TERMINAL)		/* 0x1000 */
#define NSA$M_TIME_STAMP	(1<<NSA$V_TIME_STAMP)		/* 0x2000 */
#define NSA$M_USERNAME		(1<<NSA$V_USERNAME)		/* 0x4000 */
#define NSA$M_PARENT_USERNAME	(1<<NSA$V_PARENT_USERNAME)	/* 0x8000 */
union nsa$r_supplied_flags {
    long nsa$l_supplied_flags;
    struct {
	unsigned nsa$v_account_name : 1; /* account */
	unsigned nsa$v_system_id    : 1; /* system id */
	unsigned nsa$v_system_name  : 1; /* system name */
	unsigned nsa$v_final_status : 1; /* status */
	unsigned nsa$v_image_name   : 1; /* image name */
	unsigned nsa$v_parent_id    : 1; /* parent id */
	unsigned nsa$v_parent_owner : 1; /* parent owner */
	unsigned nsa$v_parent_name  : 1; /* parent process name */
	unsigned nsa$v_process_id   : 1; /* process id */
	unsigned nsa$v_process_name : 1; /* process name */
	unsigned nsa$v_subject_class: 1; /* classification */
	unsigned nsa$v_subject_owner: 1; /* owner ('UIC') */
	unsigned nsa$v_terminal     : 1; /* terminal */
	unsigned nsa$v_time_stamp   : 1; /* timestamp */
	unsigned nsa$v_username     : 1; /* username */
	unsigned nsa$v_parent_username : 1; /* parent username */
	unsigned		    : 16; /* padding */
    } nsa$r_sup_flags_bits;
};
/* Define the format of an audit server reply message.	This defines the */
/* format of the message written to any supplied reply mailbox. */
#define NSA$C_REPLY_LENGTH	4
#define NSA$K_REPLY_LENGTH	4
struct nsareplydef {
    unsigned long nsa$l_reply_status;	/* condition status value */
};
/* Define the structure of a message formating table entry.  These entries */
/* define the order in which the data packets are displayed, and the manner */
/* in which they are formatted. */
#define NSA$C_FMTINF_NONE	0	/* no value to format */
#define NSA$C_FMTINF_LONG_VALUE 1	/* value is supplied as a longword */
#define NSA$C_FMTINF_IDENTIFIER 2	/* value supplied is an identifier */
#define NSA$C_FMTINF_DATE	3	/* value supplied is address of quadword date */
#define NSA$C_FMTINF_STRING	4	/* string size (count) and address supplied to FAO */
#define NSA$C_FMTINF_CLASSIFICATION 5	/* vector represents a classification */
#define NSA$C_FMTINF_SPECIAL	6	/* special processing required */
#define NSA$V_FMTINF_CHECK_PREVIOUS 0
#define NSA$V_FMTINF_NTH_NEW_LINE   1
#define NSA$V_FMTINF_NOFORMAT	    2
#define NSA$V_FMTINF_SENSITIVE	    3
#define NSA$M_FMTINF_CHECK_PREVIOUS (1<<NSA$V_FMTINF_CHECK_PREVIOUS) /* 0x01 */
#define NSA$M_FMTINF_NTH_NEW_LINE   (1<<NSA$V_FMTINF_NTH_NEW_LINE)   /* 0x02 */
#define NSA$M_FMTINF_NOFORMAT	    (1<<NSA$V_FMTINF_NOFORMAT)	     /* 0x04 */
#define NSA$M_FMTINF_SENSITIVE	    (1<<NSA$V_FMTINF_SENSITIVE)      /* 0x08 */
#define NSA$K_FMTINF_LENGTH	28
#define NSA$C_FMTINF_LENGTH	28
/* Define the format style codes. */
#define NSA$C_FORMAT_STYLE_BRIEF	1	/* single line briefly formatted message */
#define NSA$C_FORMAT_STYLE_FULL		2	/* fully formatted message */
#define NSA$C_FORMAT_STYLE_PACKET_TYPE	3	/* packet type format */
struct fmttbldef {
    unsigned long nsa$l_fmtinf_packet_name;	/* address of the packet name descriptor */
    unsigned short nsa$w_fmtinf_packet_type;	/* define the type of packet represented by this entry (NSA$C_PKT_xxx) */
    unsigned short nsa$w_fmtinf_output_order;	/* define the order in the output buffer */
    unsigned long nsa$l_fmtinf_fao_ctrstr;	/* normal FAO control string */
    unsigned long nsa$l_fmtinf_client_fao_ctrstr; /* FAO control string for client/server combination */
    unsigned long nsa$l_fmtinf_nth_fao_ctrstr;	/* FAO control string for the Nth packet of the same type */
    unsigned char nsa$b_fmtinf_data_type;	/* type of data to format */
    union {
	unsigned char nsa$b_fmtinf_fmt_flags;
	struct {
	    unsigned nsa$v_fmtinf_check_previous: 1; /* check adjacency with previous output item */
	    unsigned nsa$v_fmtinf_nth_new_line	: 1; /* force duplicate packets to a new line */
	    unsigned nsa$v_fmtinf_noformat	: 1; /* don't format the packet(s) */
	    unsigned nsa$v_fmtinf_sensitive	: 1; /* packet contains sensitive information */
	    unsigned				: 4;
	} nsa$r_fmtinf_flags_bits;
    } nsa$r_fmtinf_flags_overlay;
    unsigned short nsa$w_fmtinf_server_pkt;	/* Associated (server) packet */
    unsigned short nsa$w_fmtinf_indent;		/* Indent for multi-line packets */
    unsigned short nsa$w_fmtinf_spare_1;	/* Unused */
};
/* Define the structure of the format image callout block.  This block is used */
/* to determine which routines should be used to format event messages and event */
/* message data packets that are unknown to the base VMS operating system. */
#define NSA$K_IMGXFR_LENGTH	25
#define NSA$C_IMGXFR_LENGTH	25
struct fmtcalldef {
    unsigned long nsa$l_imgxfr_flink;	/* address of next entry (must be first) */
    unsigned long nsa$l_imgxfr_blink;	/* address of previous entry (must be secomd) */
    unsigned short nsa$w_imgxfr_size;	/* size of entry block */
    unsigned short nsa$w_imgxfr_facility; /* facility code for image */
    unsigned long nsa$l_imgxfr_base_addr; /* base address of merged image */
    unsigned long nsa$l_imgxfr_end_addr; /* end address of merged image */
    unsigned long nsa$l_imgxfr_base_order_offset; /* base output order offset */
    char nsa$t_imgxfr_image_name[1];	/* start of image name */
};
/* The following structure defines the common argument block passed to all */
/* the various formatting routines (which actually format information). */
#define NSA$V_FMTARG_SENSITIVE	    0
#define NSA$V_FMTARG_DISPLAY_TITLE  1
#define NSA$M_FMTARG_SENSITIVE	    (1<<NSA$V_FMTARG_SENSITIVE)      /* 0x01 */
#define NSA$M_FMTARG_DISPLAY_TITLE  (1<<NSA$V_FMTARG_DISPLAY_TITLE)  /* 0x02 */
#define NSA$V_FMTARG_CHECK_PREVIOUS 0
#define NSA$V_FMTARG_NTH_NEW_LINE   1
#define NSA$V_FMTARG_NOFORMAT	    2
#define NSA$M_FMTARG_CHECK_PREVIOUS (1<<NSA$V_FMTARG_CHECK_PREVIOUS) /* 0x01 */
#define NSA$M_FMTARG_NTH_NEW_LINE   (1<<NSA$V_FMTARG_NTH_NEW_LINE)   /* 0x02 */
#define NSA$M_FMTARG_NOFORMAT	    (1<<NSA$V_FMTARG_NOFORMAT)	     /* 0x04 */
#define NSA$K_FMTARG_LENGTH	32
#define NSA$C_FMTARG_LENGTH	32
struct fmtargdef {
    union {
	int nsa$q_fmtarg_buffer[2];
	struct {
	    unsigned short nsa$w_fmtarg_buffer_size;	/* output buffer size */
	    unsigned short nsa$w_fmtarg_spare_1;	/* unused */
	    unsigned long nsa$a_fmtarg_buffer_pointer;	/* output buffer address */
	} nsa$r_fmtarg_buf_fields;
    } nsa$r_fmtarg_buf_overlay;
    unsigned short nsa$w_fmtarg_buffer_offset;	/* current position in output buffer */
    unsigned short nsa$w_fmtarg_bol_offset;	/* offset to beginning of current line */
    union {
	int nsa$q_fmtarg_terminator[2];
	struct {
	    unsigned short nsa$w_fmtarg_term_size; /* size of line terminator */
	    unsigned short nsa$w_fmtarg_spare_2;   /* unused */
	    unsigned long nsa$a_fmtarg_term_text;  /* address of terminator text */
	} nsa$r_fmtarg_trm_fields;
    } nsa$r_fmtarg_trm_overlay;
    unsigned short nsa$w_fmtarg_line_width;	/* output display width */
    unsigned short nsa$w_fmtarg_line_indent;	/* positions to indent (when needed) */
    unsigned long nsa$a_fmtarg_output_routine;	/* address of an output routine */
    union {
	unsigned long nsa$l_fmtarg_flags;
	struct {
	    union {
		unsigned short nsa$w_fmtarg_flags_low;
		struct {
		    unsigned nsa$v_fmtarg_sensitive	: 1; /* packet contains sensitive information */
		    unsigned nsa$v_fmtarg_display_title : 1; /* display title */
		    unsigned				: 6;
		} nsa$r_fmtarg_flags_lo_bits;
	    } nsa$r_fmtarg_flags_lo_overlay;
	    union {
		unsigned short nsa$w_fmtarg_flags_high;
		struct {
		    unsigned nsa$v_fmtarg_check_previous: 1; /* check adjacency with previous output item */
		    unsigned nsa$v_fmtarg_nth_new_line	: 1; /* force duplicate packets to a new line */
		    unsigned nsa$v_fmtarg_noformat	: 1; /* don't format the packet(s) */
		    unsigned				: 5;
		} nsa$r_fmtarg_flags_hi_bits;
	    } nsa$r_fmtarg_flags_hi_overlay;
	} nsa$r_fmtarg_flags_fields;
    } nsa$r_fmtarg_flags_overlay;
};
/* The following list of constants is used to index into the transfer vector area */
/* defined below.  The structure definition and constant list must parallel each other. */
#define NSA$C_IMGXFR_MESSAGE_INFO	0	/* message information routine */
#define NSA$C_IMGXFR_VALIDATE_PACKET	1	/* packet validation routine */
#define NSA$C_IMGXFR_DISPLAY_INFO	2	/* packet display information routine */
#define NSA$C_IMGXFR_LINE_BREAK		3	/* line break processing routine */
#define NSA$C_IMGXFR_FORMAT_SPECIAL	4	/* special packet formatting routine */
#define NSA$C_IMGXFR_FORMAT_INFO	5	/* normal packet formatting routine */
#define NSA$C_IMGXFR_FORMAT_BRIEF	6	/* brief format routine */
#define NSA$C_IMGXFR_FORMAT_PACKET_TYPE 7	/* packet type format routine */
#define NSA$C_IMGXFR_FORMAT_EVENT_TYPE	8	/* message type/subtype format routine */
/* The following structure defines the transfer vector area for the format image. */
struct fmtxferdef {
    unsigned int nsa$r_imgxfr_message_info[2];	  /* message information routine */
    unsigned int nsa$r_imgxfr_validate_packet[2]; /* packet validation routine */
    unsigned int nsa$r_imgxfr_display_info[2];	  /* packet display information routine */
    unsigned int nsa$r_imgxfr_line_break[2];	  /* line break processing routine */
    unsigned int nsa$r_imgxfr_format_special[2];  /* special packet formatting routine */
    unsigned int nsa$r_imgxfr_format_info[2];	  /* normal packet formatting routine */
    unsigned int nsa$r_imgxfr_format_brief[2];	  /* brief format routine */
    unsigned int nsa$r_imgxfr_format_packet_type[2]; /* packet type format routine */
    unsigned int nsa$r_imgxfr_format_event_type[2]; /* message type/subtype format routine */
};
/* Define the format of the message information block.	This block defines */
/* some general characteristics of messages for a particular facility. */
#define NSA$K_MSGINF_LENGTH	8
#define NSA$C_MSGINF_LENGTH	8
struct msginfodef {
    unsigned long nsa$l_msginf_max_order_offset; /* maximum (output) line index */
    unsigned long nsa$a_msginf_brief_title;	 /* address of brief format titleline */
};
/* Define the structure of a formatting table subtype entry.  This entry consists of */
/* a description of the subtype as well as the name of the subtype. */
#define NSA$K_SUBTBL_LENGTH	8
#define NSA$C_SUBTBL_LENGTH	8
struct subfmttbldef {
    union {
	unsigned long nsa$l_subtbl_description; /* address of the description string */
	unsigned long nsa$l_subtbl_table_size;	/* number of entries in the subtable */
    } nsa$r_subtbl_overlay_3;
    unsigned long nsa$l_subtbl_mnemonic; /* Mnemonic name for the entry */
};
/* Define all obsolete symbol definitions here. */
#define NSA$C_MSG_PRIV_AUDIT	16
#define NSA$C_PKT_PRIV_MASK	22
#define NSA$C_PKT_RESERVED_1_1	86
#define NSA$C_PKT_RESERVED_1_2	87
#define NSA$C_PKT_RESERVED_1_3	88
#define NSA$C_PRIV_AUDIT	1
#define NSA$_RESERVED_1_1	86
#define NSA$_RESERVED_1_2	87
#define NSA$_RESERVED_1_3	88

#endif	/*_NSADEF_H*/
