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