adt_xlate.h revision a76042b7b4e2deb62a8f2be75d2bb142e1ee70bf
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License (the "License").
* You may not use this file except in compliance with the License.
*
* You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at usr/src/OPENSOLARIS.LICENSE.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information: Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*/
/*
*
* Copyright 2009 Sun Microsystems, Inc. All rights reserved.
* Use is subject to license terms.
*
*/
#ifndef _BSM_XLATE_H
#define _BSM_XLATE_H
#include <priv.h>
#include "adt_event.h"
#ifdef __cplusplus
extern "C" {
#endif
#ifndef TEXT_DOMAIN
#define TEXT_DOMAIN "SYS_TEST"
#endif
/*
* values for adt_session_model
* In the session model, the session and process are unrelated, so
* such things as the supplementary group token make no sense. In
* the process model, the process and session are the same.
*/
#define ADT_SESSION_MODEL 1
#define ADT_PROCESS_MODEL 0
#define ADT_HAVE_MASK 0x01
#define ADT_HAVE_TID 0x02
#define ADT_HAVE_AUID 0x04
#define ADT_HAVE_ASID 0x08
#define ADT_HAVE_IDS 0x10
#define ADT_HAVE_ALL (uint32_t)\
/*
* dummy token types for privilege
*/
/* dummy token type for alternate command */
#define ADT_CMD_ALT -103
typedef struct adt_internal_state adt_internal_state_t;
union union_of_events {
union adt_event_data d0;
};
/*
* The order of the lists MUST match the order in
* struct msg_text adt_msg_text that is generated by
* auditxml in adt_xlate.c.
*/
enum adt_msg_list {
enum datatype {ADT_UNDEFINED = 0,
ADT_CHAR2STAR, /* char ** */
};
typedef enum datatype datatype_t;
union convert {
enum adt_generic msg_selector;
int tint;
long tlong;
char tchar;
char *tcharstar;
char **tchar2star;
};
struct adt_event_state {
union union_of_events ae_event_data;
/* above is user's area; below is internal. Order matters */
int ae_event_handle;
int ae_rc; /* exit token rc */
int ae_type; /* exit error type */
struct adt_internal_state *ae_session;
};
struct datadefs {
};
typedef void (* adt_token_func_t)(datadef *, void *, int,
struct adt_event_state *, char *);
typedef char *(* adt_msg_func_t)(enum adt_generic);
#define ADT_VALID 0xAAAA5555
struct adt_internal_state {
/* == zero when freed */
struct auditinfo_addr as_info;
/*
* ai_auid audit id
* ai_mask.am_success pre-selection mask
* ai_mask.am_failure
* ai_termid .at_port terminal id
* .at_type
* .ai_termid.at_addr[0]
* .ai_termid.at_addr[1]
* .ai_termid.at_addr[2]
* .ai_termid.at_addr[3]
* ai_asid session id
*/
int as_audit_enabled; /* audit enable/disable state */
/*
* data above this line is exported / imported
* To maintain upward compatibility, the above structures
* can't change, so for version 2, all changes will need
* to be added here and the old format (above) maintained.
*/
int as_session_model;
};
/*
* export data format
* version number changes when adt_internal_state's export portion
* changes.
*/
#define PROTOCOL_VERSION_1 1
#define PROTOCOL_VERSION_2 2
/*
* most recent version is at the top; down level consumers are
* expected to search down via "prev_offsetX" to a version they
* understand. "v1" is first, "v0" is used to illustrate correct
* order for future use.
*/
struct adt_export_v2 {
int ax_audit_enabled;
/* char ax_label[ax_label_len]; if, is_system_labeled */
};
struct adt_export_v1 {
int ax_audit_enabled;
};
struct export_link {
};
struct export_header {
struct export_link ax_link;
};
struct adt_export_data {
struct export_header ax_header;
struct adt_export_v2 ax_v2;
/*
* end of version 2 data
*/
struct export_link ax_next_v1;
struct adt_export_v1 ax_v1;
/*
* end of version 1 data
* struct export_link ax_next_A;
* data for older version
* struct adt_export_v0 ax_v0;
*/
};
/*
* struct entry defines rows in tables defined in adt_xlate.c
*/
struct entry {
char en_token_id; /* token id */
int en_count_types; /* # of input fields for this token */
int en_required; /* if 1, always output a token */
int en_tsol; /* if 1, reserved if for TX */
char *en_msg_format; /* pointer to sprintf format string */
};
struct translation {
int tx_offsetsCalculated; /* eponymous */
int tx_entries; /* array size of entry array */
};
struct token_jmp {
long jmp_id;
};
struct msg_text {
int ml_min_index;
int ml_max_index;
char **ml_msg_list;
int ml_offset;
};
extern struct msg_text adt_msg_text[];
extern void adt_write_syslog(const char *, int);
extern void adt_token_open(struct adt_event_state *);
extern int adt_token_close(struct adt_event_state *);
extern void adt_generate_token(struct entry *, void *,
struct adt_event_state *);
#ifdef __cplusplus
}
#endif
#endif /* _BSM_XLATE_H */