[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]

FreeBSD/Linux Kernel Cross Reference
sys/bsm/audit_internal.h

Version: -  FREEBSD  -  FREEBSD7  -  FREEBSD70  -  FREEBSD6  -  FREEBSD63  -  FREEBSD62  -  FREEBSD61  -  FREEBSD60  -  FREEBSD5  -  FREEBSD55  -  FREEBSD54  -  FREEBSD53  -  FREEBSD52  -  FREEBSD51  -  FREEBSD50  -  FREEBSD4  -  FREEBSD3  -  FREEBSD22  -  linux-2.6  -  linux-2.4.22  -  MK83  -  MK84  -  PLAN9  -  DFBSD  -  NETBSD  -  NETBSD4  -  NETBSD3  -  NETBSD20  -  OPENBSD  -  xnu-517  -  xnu-792  -  xnu-792.6.70  -  xnu-1228  -  OPENSOLARIS  -  minix-3-1-1  -  TRUSTEDBSD-SEBSD  -  FREEBSD-LIBC  -  FREEBSD7-LIBC  -  FREEBSD6-LIBC  -  GLIBC27 
SearchContext: -  none  -  excerpts  -  bigexcerpts 

  1 /*
  2  * Copyright (c) 2005 Apple Inc.
  3  * Copyright (c) 2005 SPARTA, Inc.
  4  * All rights reserved.
  5  *
  6  * This code was developed in part by Robert N. M. Watson, Senior Principal
  7  * Scientist, SPARTA, Inc.
  8  *
  9  * Redistribution and use in source and binary forms, with or without
 10  * modification, are permitted provided that the following conditions
 11  * are met:
 12  *
 13  * 1.  Redistributions of source code must retain the above copyright
 14  *     notice, this list of conditions and the following disclaimer.
 15  * 2.  Redistributions in binary form must reproduce the above copyright
 16  *     notice, this list of conditions and the following disclaimer in the
 17  *     documentation and/or other materials provided with the distribution.
 18  * 3.  Neither the name of Apple Computer, Inc. ("Apple") nor the names of
 19  *     its contributors may be used to endorse or promote products derived
 20  *     from this software without specific prior written permission.
 21  *
 22  * THIS SOFTWARE IS PROVIDED BY APPLE AND ITS CONTRIBUTORS "AS IS" AND ANY
 23  * EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
 24  * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
 25  * DISCLAIMED. IN NO EVENT SHALL APPLE OR ITS CONTRIBUTORS BE LIABLE FOR ANY
 26  * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
 27  * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
 28  * LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
 29  * ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
 30  * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
 31  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 32  *
 33  * P4: //depot/projects/trustedbsd/audit3/sys/bsm/audit_internal.h#18
 34  * $FreeBSD: src/sys/bsm/audit_internal.h,v 1.10 2008/11/11 21:57:03 csjp Exp $
 35  */
 36 
 37 #ifndef _AUDIT_INTERNAL_H
 38 #define _AUDIT_INTERNAL_H
 39 
 40 #if defined(__linux__) && !defined(__unused)
 41 #define __unused
 42 #endif
 43 
 44 /*
 45  * audit_internal.h contains private interfaces that are shared by user space
 46  * and the kernel for the purposes of assembling audit records.  Applications
 47  * should not include this file or use the APIs found within, or it may be
 48  * broken with future releases of OpenBSM, which may delete, modify, or
 49  * otherwise break these interfaces or the assumptions they rely on.
 50  */
 51 struct au_token {
 52         u_char                  *t_data;
 53         size_t                   len;
 54         TAILQ_ENTRY(au_token)    tokens;
 55 };
 56 
 57 struct au_record {
 58         char                     used;          /* Record currently in use? */
 59         int                      desc;          /* Descriptor for record. */
 60         TAILQ_HEAD(, au_token)   token_q;       /* Queue of BSM tokens. */
 61         u_char                  *data;
 62         size_t                   len;
 63         LIST_ENTRY(au_record)    au_rec_q;
 64 };
 65 typedef struct au_record        au_record_t;
 66 
 67 
 68 /*
 69  * We could determined the header and trailer sizes by defining appropriate
 70  * structures.  We hold off that approach until we have a consistent way of
 71  * using structures for all tokens.  This is not straightforward since these
 72  * token structures may contain pointers of whose contents we do not know the
 73  * size (e.g text tokens).
 74  */
 75 #define AUDIT_HEADER_EX_SIZE(a) ((a)->ai_termid.at_type+18+sizeof(u_int32_t))
 76 #define AUDIT_HEADER_SIZE       18
 77 #define MAX_AUDIT_HEADER_SIZE   (5*sizeof(u_int32_t)+18)
 78 #define AUDIT_TRAILER_SIZE      7
 79 
 80 /*
 81  * BSM token streams store fields in big endian byte order, so as to be
 82  * portable; when encoding and decoding, we must convert byte orders for
 83  * typed values.
 84  */
 85 #define ADD_U_CHAR(loc, val)                                            \
 86         do {                                                            \
 87                 *(loc) = (val);                                         \
 88                 (loc) += sizeof(u_char);                                \
 89         } while(0)
 90 
 91 
 92 #define ADD_U_INT16(loc, val)                                           \
 93         do {                                                            \
 94                 be16enc((loc), (val));                                  \
 95                 (loc) += sizeof(u_int16_t);                             \
 96         } while(0)
 97 
 98 #define ADD_U_INT32(loc, val)                                           \
 99         do {                                                            \
100                 be32enc((loc), (val));                                  \
101                 (loc) += sizeof(u_int32_t);                             \
102         } while(0)
103 
104 #define ADD_U_INT64(loc, val)                                           \
105         do {                                                            \
106                 be64enc((loc), (val));                                  \
107                 (loc) += sizeof(u_int64_t);                             \
108         } while(0)
109 
110 #define ADD_MEM(loc, data, size)                                        \
111         do {                                                            \
112                 memcpy((loc), (data), (size));                          \
113                 (loc) += size;                                          \
114         } while(0)
115 
116 #define ADD_STRING(loc, data, size)     ADD_MEM(loc, data, size)
117 
118 #endif /* !_AUDIT_INTERNAL_H_ */
119 

[ source navigation ] [ diff markup ] [ identifier search ] [ freetext search ] [ file search ]


This page is part of the FreeBSD/Linux Linux Kernel Cross-Reference, and was automatically generated using a modified version of the LXR engine.