2N/A/*
2N/A * CDDL HEADER START
2N/A *
2N/A * The contents of this file are subject to the terms of the
2N/A * Common Development and Distribution License (the "License").
2N/A * You may not use this file except in compliance with the License.
2N/A *
2N/A * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
2N/A * or http://www.opensolaris.org/os/licensing.
2N/A * See the License for the specific language governing permissions
2N/A * and limitations under the License.
2N/A *
2N/A * When distributing Covered Code, include this CDDL HEADER in each
2N/A * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
2N/A * If applicable, add the following below this CDDL HEADER, with the
2N/A * fields enclosed by brackets "[]" replaced with your own identifying
2N/A * information: Portions Copyright [yyyy] [name of copyright owner]
2N/A *
2N/A * CDDL HEADER END
2N/A */
2N/A/*
2N/A * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
2N/A * Use is subject to license terms.
2N/A *
2N/A */
2N/A
2N/A#ifndef _AUDIT_REMOTE_H
2N/A#define _AUDIT_REMOTE_H
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/Aextern "C" {
2N/A#endif
2N/A
2N/A#include <stdio.h>
2N/A#include <security/auditd.h>
2N/A
2N/A/* gettext() obfuscation routine for lint */
2N/A#ifdef __lint
2N/A#define gettext(x) x
2N/A#endif
2N/A
2N/A
2N/A/* send_record() return code */
2N/Aenum send_record_rc {
2N/A SEND_RECORD_SUCCESS,
2N/A SEND_RECORD_NEXT,
2N/A SEND_RECORD_RETRY,
2N/A SEND_RECORD_FAIL
2N/A};
2N/Atypedef enum send_record_rc send_record_rc_t;
2N/A
2N/A/* closing helpers - the reason of connection closure */
2N/Aenum close_rsn_e {
2N/A RSN_UNDEFINED, /* reason not defined */
2N/A RSN_INIT_POLL, /* poll() initialization failed */
2N/A RSN_TOK_RECV_FAILED, /* token receiving failed */
2N/A RSN_TOK_TOO_BIG, /* unacceptable token size */
2N/A RSN_TOK_UNVERIFIABLE, /* received unverifiable token */
2N/A RSN_SOCKET_CLOSE, /* socket closure */
2N/A RSN_SOCKET_CREATE, /* socket creation */
2N/A RSN_CONNECTION_CREATE, /* connection creation */
2N/A RSN_PROTOCOL_NEGOTIATE, /* protocol version negotiation */
2N/A RSN_GSS_CTX_ESTABLISH, /* establish GSS-API context */
2N/A RSN_GSS_CTX_EXP, /* expiration of the GSS-API context */
2N/A RSN_UNKNOWN_AF, /* unknown address family */
2N/A RSN_MEMORY_ALLOCATE, /* memory allocation failure */
2N/A RSN_OTHER_ERR /* other, not classified error */
2N/A};
2N/Atypedef enum close_rsn_e close_rsn_t;
2N/A
2N/A/* linked list of remote audit hosts (servers) */
2N/Atypedef struct hostlist_s hostlist_t;
2N/Astruct hostlist_s {
2N/A hostlist_t *next_host;
2N/A struct hostent *host;
2N/A in_port_t port; /* TCP port number */
2N/A gss_OID mech; /* GSS mechanism - see mech(4) */
2N/A};
2N/A
2N/A/* transq_t - single, already sent token in the transmit queue. */
2N/Astruct transq_node_s {
2N/A struct transq_node_s *next;
2N/A struct transq_node_s *prev;
2N/A gss_buffer_desc seq_token; /* seq num || plain token */
2N/A uint64_t seq_num; /* seq number */
2N/A};
2N/Atypedef struct transq_node_s transq_node_t;
2N/A
2N/A/* transq_hdr_t - the transmit queue header structure */
2N/Astruct transq_hdr_s {
2N/A struct transq_node_s *head;
2N/A struct transq_node_s *end;
2N/A long count; /* amount of nodes in the queue */
2N/A};
2N/Atypedef struct transq_hdr_s transq_hdr_t;
2N/A
2N/A/* pipe_msg_s - the notification pipe message */
2N/Astruct pipe_msg_s {
2N/A int sock_num; /* socket fd to be poll()ed and more */
2N/A boolean_t sync; /* call the sync routines */
2N/A};
2N/Atypedef struct pipe_msg_s pipe_msg_t;
2N/A
2N/A
2N/A/*
2N/A * Cross audit_remote plugin source code shared functions and bool parameters.
2N/A *
2N/A * reset_transport() helpers:
2N/A * arg1) DO_SYNC, DO_NOT_SYNC
2N/A * arg2) DO_EXIT, DO_CLOSE, DO_NOT_EXIT, DO_NOT_CLOSE
2N/A */
2N/A#define DO_SYNC B_TRUE
2N/A#define DO_NOT_SYNC B_FALSE
2N/A#define DO_EXIT B_FALSE
2N/A#define DO_CLOSE B_TRUE
2N/A#define DO_NOT_EXIT B_CLOSE
2N/A#define DO_NOT_CLOSE B_EXIT
2N/Aextern void reset_transport(boolean_t, boolean_t);
2N/Aextern send_record_rc_t send_record(struct hostlist_s *, const char *, size_t,
2N/A uint64_t, close_rsn_t *);
2N/A
2N/A#if DEBUG
2N/A#define DPRINT(x) { (void) fprintf x; (void) fflush(dfile); }
2N/A#else
2N/A#define DPRINT(x)
2N/A#endif
2N/A
2N/A#if DEBUG
2N/Aextern FILE *dfile;
2N/A#endif
2N/A
2N/A
2N/A#ifdef __cplusplus
2N/A}
2N/A#endif
2N/A
2N/A#endif /* _AUDIT_REMOTE_H */