import less(1)
[unleashed/tickless.git] / usr / src / lib / auditd_plugins / remote / audit_remote.h
blob5971426175771e72de0381945f7ab65a7a893cde
1 /*
2 * CDDL HEADER START
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
19 * CDDL HEADER END
22 * Copyright 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
27 #ifndef _AUDIT_REMOTE_H
28 #define _AUDIT_REMOTE_H
31 #ifdef __cplusplus
32 extern "C" {
33 #endif
35 #include <stdio.h>
36 #include <security/auditd.h>
38 /* send_record() return code */
39 enum send_record_rc {
40 SEND_RECORD_SUCCESS,
41 SEND_RECORD_NEXT,
42 SEND_RECORD_RETRY,
43 SEND_RECORD_FAIL
45 typedef enum send_record_rc send_record_rc_t;
47 /* closing helpers - the reason of connection closure */
48 enum close_rsn_e {
49 RSN_UNDEFINED, /* reason not defined */
50 RSN_INIT_POLL, /* poll() initialization failed */
51 RSN_TOK_RECV_FAILED, /* token receiving failed */
52 RSN_TOK_TOO_BIG, /* unacceptable token size */
53 RSN_TOK_UNVERIFIABLE, /* received unverifiable token */
54 RSN_SOCKET_CLOSE, /* socket closure */
55 RSN_SOCKET_CREATE, /* socket creation */
56 RSN_CONNECTION_CREATE, /* connection creation */
57 RSN_PROTOCOL_NEGOTIATE, /* protocol version negotiation */
58 RSN_GSS_CTX_ESTABLISH, /* establish GSS-API context */
59 RSN_GSS_CTX_EXP, /* expiration of the GSS-API context */
60 RSN_UNKNOWN_AF, /* unknown address family */
61 RSN_MEMORY_ALLOCATE, /* memory allocation failure */
62 RSN_OTHER_ERR /* other, not classified error */
64 typedef enum close_rsn_e close_rsn_t;
66 /* linked list of remote audit hosts (servers) */
67 typedef struct hostlist_s hostlist_t;
68 struct hostlist_s {
69 hostlist_t *next_host;
70 struct hostent *host;
71 in_port_t port; /* TCP port number */
72 gss_OID mech; /* GSS mechanism - see mech(4) */
75 /* transq_t - single, already sent token in the transmit queue. */
76 struct transq_node_s {
77 struct transq_node_s *next;
78 struct transq_node_s *prev;
79 gss_buffer_desc seq_token; /* seq num || plain token */
80 uint64_t seq_num; /* seq number */
82 typedef struct transq_node_s transq_node_t;
84 /* transq_hdr_t - the transmit queue header structure */
85 struct transq_hdr_s {
86 struct transq_node_s *head;
87 struct transq_node_s *end;
88 long count; /* amount of nodes in the queue */
90 typedef struct transq_hdr_s transq_hdr_t;
92 /* pipe_msg_s - the notification pipe message */
93 struct pipe_msg_s {
94 int sock_num; /* socket fd to be poll()ed and more */
95 boolean_t sync; /* call the sync routines */
97 typedef struct pipe_msg_s pipe_msg_t;
101 * Cross audit_remote plugin source code shared functions and bool parameters.
103 * reset_transport() helpers:
104 * arg1) DO_SYNC, DO_NOT_SYNC
105 * arg2) DO_EXIT, DO_CLOSE, DO_NOT_EXIT, DO_NOT_CLOSE
107 #define DO_SYNC B_TRUE
108 #define DO_NOT_SYNC B_FALSE
109 #define DO_EXIT B_FALSE
110 #define DO_CLOSE B_TRUE
111 #define DO_NOT_EXIT B_CLOSE
112 #define DO_NOT_CLOSE B_EXIT
113 extern void reset_transport(boolean_t, boolean_t);
114 extern send_record_rc_t send_record(struct hostlist_s *, const char *, size_t,
115 uint64_t, close_rsn_t *);
117 #if DEBUG
118 #define DPRINT(x) { (void) fprintf x; (void) fflush(dfile); }
119 #else
120 #define DPRINT(x)
121 #endif
123 #if DEBUG
124 extern FILE *dfile;
125 #endif
128 #ifdef __cplusplus
130 #endif
132 #endif /* _AUDIT_REMOTE_H */