/* <ciadef.h>
 */
#ifndef _CIADEF_H
#define _CIADEF_H

#define CIA$K_SCAN		1
#define CIA$K_DELETE		2
#define CIA$K_SHOW		3
#define CIA$K_PERFORMANCE	4
#define CIA$K_ZERO_PERFORMANCE	5
#define CIA$K_MAX_CIA_CODE	6
#define CIA$K_PERFORMANCE_LENGTH 40

struct cia$performance {
    unsigned long cia$l_total_messages;
    unsigned long cia$l_total_exceptions;
    unsigned long cia$l_shows;
    unsigned long cia$l_scans;
    unsigned long cia$l_deletes;
    unsigned long cia$l_performance;
    unsigned long cia$l_audits;
    unsigned long cia$l_invalid_messages;
    unsigned long cia$l_intruders;
    unsigned long cia$l_suspects;
};

#define CIA$K_SOURCE_TERMINAL_LENGTH	64
#define CIA$K_SOURCE_NODE_MAX_LENGTH	1024
#define CIA$K_USER_SPEC_MAX_LENGTH	1058
#define CIA$K_USER_STRING_MAX_LENGTH	32
#define CIA$K_PASSWORD_MAX_LENGTH	32
#define CIA$K_SOURCE_ADDRESS_MAX_LENGTH 128
struct cia$generic_desc {
    unsigned short cia$w_desc_length;
    unsigned short cia$w_filler;
    char cia$t_desc_data[1];
};

#define CIA$V_IGNORE_RETURN	  0
#define CIA$V_RESERVED_1	  1
#define CIA$V_SUSPECTS		  8
#define CIA$V_INTRUDERS		  9
#define CIA$V_SECONDARY_PASSWORD 10
#define CIA$V_NOAUDIT		 11
#define CIA$V_REAL_USERNAME	 12
#define CIA$M_IGNORE_RETURN	 (1<<CIA$V_IGNORE_RETURN)	/* 0x0001 */
#define CIA$M_RESERVED_1	 0x0FE
#define CIA$M_SUSPECTS		 (1<<CIA$V_SUSPECTS)		/* 0x0100 */
#define CIA$M_INTRUDERS		 (1<<CIA$V_INTRUDERS)		/* 0x0200 */
#define CIA$M_SECONDARY_PASSWORD (1<<CIA$V_SECONDARY_PASSWORD)	/* 0x0400 */
#define CIA$M_NOAUDIT		 (1<<CIA$V_NOAUDIT)		/* 0x0800 */
#define CIA$M_REAL_USERNAME	 (1<<CIA$V_REAL_USERNAME)	/* 0x1000 */
#define CIA$K_HEADER_LENGTH	8
struct cia$header {
    unsigned long cia$l_context;
    union {
	unsigned long cia$l_header_flags;
	struct {
	    unsigned cia$v_ignore_return	: 1;
	    unsigned cia$v_reserved_1		: 7;
	    unsigned cia$v_suspects		: 1;
	    unsigned cia$v_intruders		: 1;
	    unsigned cia$v_secondary_password	: 1;
	    unsigned cia$v_noaudit		: 1;
	    unsigned cia$v_real_username	: 1;
	    unsigned				: 19;
	} cia$r_header_flags_fields;
    } cia$r_header_flags_overlay;
};

#define CIA$K_SHOW_INPUT_LENGTH		1062
#define CIA$K_DELETE_INPUT_LENGTH	1062
struct cia$contents {
    unsigned short cia$w_length;
    unsigned short cia$w_unused;
    char cia$t_name[1058];
};

#define CIA$K_SCAN_CONTENTS_LENGTH	1386
struct cai$scan_contents {
    unsigned long cia$l_parent_id;
    unsigned long cia$l_job_type;
    unsigned long cia$l_login_status;
    union {
	char cia$t_source_terminal[68];
	struct {
	    unsigned short cia$w_source_term_length;
	    unsigned short cia$w_unused_1;
	    char cia$t_source_term_name[64];
	} cia$r_source_term_fields;
    } cia$r_source_term_overlay;
    union {
	char cia$t_source_user[36];
	struct {
	    unsigned short cia$w_source_user_length;
	    unsigned short cia$w_unused_2;
	    char cia$t_source_user_name[32];
	} cia$r_source_user_fields;
    } cia$r_source_user_overlay;
    union {
	char cia$t_source_address[132];
	struct {
	    unsigned short cia$w_source_addr_length;
	    unsigned short cia$w_unused_3;
	    char cia$t_source_address_name[128];
	} cia$r_source_addr_fields;
    } cia$r_source_addr_overlay;
    unsigned short cia$w_unused_4;
    struct {
	unsigned short cia$w_failed_user_length;
	unsigned short cia$w_unused_5;
	char cia$t_failed_user_name[32];
    } cia$r_failed_user;
    union {
	char cia$t_failed_password[36];
	struct {
	    unsigned short cia$w_failed_pass_length;
	    unsigned short cia$w_unused_6;
	    char cia$t_failed_pass_name[32];
	} cia$r_failed_pass_fields;
    } cia$r_failed_pass_overlay;
    union {
	char cia$t_parent_user[36];
	struct {
	    unsigned short cia$w_parent_user_length;
	    unsigned short cia$w_unused_7;
	    char cia$t_parent_user_name[32];
	} cia$r_parent_user_fields;
    } cia$r_parent_user_overlay;
    union {
	char cia$t_source_node[1028];
	struct {
	    unsigned short cia$w_source_node_length;
	    unsigned short cia$w_unused_8;
	    char cia$t_source_node_name[1024];
	} cia$r_source_node_fields;
    } cia$r_source_node_overlay;
};

#define CIA$V_INTRUDER	0
#define CIA$V_SUSPECT	1
#define CIA$V_NETWORK	2
#define CIA$V_TERM_USER 3
#define CIA$V_TERMINAL	4
#define CIA$V_USERNAME	5
#define CIA$M_INTRUDER	(1<<CIA$V_INTRUDER)	/* 0x01 */
#define CIA$M_SUSPECT	(1<<CIA$V_SUSPECT)	/* 0x02 */
#define CIA$M_NETWORK	(1<<CIA$V_NETWORK)	/* 0x04 */
#define CIA$M_TERM_USER (1<<CIA$V_TERM_USER)	/* 0x08 */
#define CIA$M_TERMINAL	(1<<CIA$V_TERMINAL)	/* 0x10 */
#define CIA$M_USERNAME	(1<<CIA$V_USERNAME)	/* 0x20 */
#define CIA$K_SHOW_OUTPUT_LENGTH 1086
struct cia$show_output {
    unsigned long cia$l_status;
    unsigned long cia$l_returned_context;
    unsigned long cia$q_expiration_time[2];
    union {
	unsigned long cia$l_flags;
	struct {
	    unsigned cia$v_intruder	: 1;
	    unsigned cia$v_suspect	: 1;
	    unsigned cia$v_network	: 1;
	    unsigned cia$v_term_user	: 1;
	    unsigned cia$v_terminal	: 1;
	    unsigned cia$v_username	: 1;
	    unsigned			: 26;
	} cia$r_flags_fields;
    } cia$r_flags_overlay;
    unsigned long cia$l_attempt_count;
    union {
	char cia$t_user_spec[1062];
	struct {
	    unsigned short cia$w_user_spec_length;
	    unsigned short cia$w_filler;
	    char cia$t_user_spec_name[1058];
	} cia$r_user_spec_fields;
    } cia$r_user_spec_overlay;
};
struct cia$breakin_block {
    unsigned long cia$l_break_flags;
    unsigned long cia$l_break_count;
    unsigned long cia$q_break_time[2];
};
struct cia$generic_reply {
    unsigned long cia$l_reply_status;	/* status of request */
};

#endif	/*_CIADEF_H*/