1 /*
2  * CDDL HEADER START
3  *
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.
7  *
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.
12  *
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]
18  *
19  * CDDL HEADER END
20  */
21 /*
22  * Copyright 2006 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef _BSM_AUDIT_RECORD_H
27 #define	_BSM_AUDIT_RECORD_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef _KERNEL
32 #include <sys/priv.h>
33 #else
34 #include <priv.h>
35 #endif
36 #include <sys/socket.h>
37 #include <sys/acl.h>
38 
39 #include <sys/tsol/label.h>
40 
41 #ifdef __cplusplus
42 extern "C" {
43 #endif
44 
45 /*
46  * Version of audit attributes
47  *
48  * OS Release      Version Number    Comments
49  * ==========      ==============    ========
50  * SunOS 5.1              2        Unbundled Package
51  * SunOS 5.3              2        Bundled into the base OS
52  * SunOS 5.4-5.x          2
53  * Trusted Solaris 2.5    3        To distinguish potential new tokens
54  * Trusted Solaris 7-8    4        Redefine X tokens that overlap with
55  *                                 SunOS 5.7
56  */
57 
58 #ifdef	TSOL
59 #define	TOKEN_VERSION   4
60 #else	/* !TSOL */
61 #define	TOKEN_VERSION   2
62 #endif	/* TSOL */
63 
64 /*
65  * Audit record token type codes
66  */
67 
68 /*
69  * Control token types
70  */
71 
72 #define	AUT_INVALID		((char)0x00)
73 #define	AUT_OTHER_FILE		((char)0x11)
74 #define	AUT_OTHER_FILE32	AUT_OTHER_FILE
75 #define	AUT_OHEADER		((char)0x12)
76 #define	AUT_TRAILER		((char)0x13)
77 #define	AUT_HEADER		((char)0x14)
78 #define	AUT_HEADER32		AUT_HEADER
79 #define	AUT_HEADER32_EX		((char)0x15)
80 #define	AUT_TRAILER_MAGIC	((short)0xB105)
81 
82 /*
83  * Data token types
84  */
85 
86 #define	AUT_DATA		((char)0x21)
87 #define	AUT_IPC			((char)0x22)
88 #define	AUT_PATH		((char)0x23)
89 #define	AUT_SUBJECT		((char)0x24)
90 #define	AUT_SUBJECT32		AUT_SUBJECT
91 #define	AUT_XATPATH		((char)0x25)
92 #define	AUT_PROCESS		((char)0x26)
93 #define	AUT_PROCESS32		AUT_PROCESS
94 #define	AUT_RETURN		((char)0x27)
95 #define	AUT_RETURN32		AUT_RETURN
96 #define	AUT_TEXT		((char)0x28)
97 #define	AUT_OPAQUE		((char)0x29)
98 #define	AUT_IN_ADDR		((char)0x2A)
99 #define	AUT_IP			((char)0x2B)
100 #define	AUT_IPORT		((char)0x2C)
101 #define	AUT_ARG			((char)0x2D)
102 #define	AUT_ARG32		AUT_ARG
103 #define	AUT_SOCKET		((char)0x2E)
104 #define	AUT_SEQ			((char)0x2F)
105 #define	AUT_TID			((char)0x61)
106 
107 /*
108  * Modifier token types
109  */
110 
111 #define	AUT_ACL			((char)0x30)
112 #define	AUT_ATTR		((char)0x31)
113 #define	AUT_IPC_PERM		((char)0x32)
114 #define	AUT_LABEL		((char)0x33)
115 #define	AUT_GROUPS		((char)0x34)
116 #define	AUT_ILABEL		((char)0x35)
117 #define	AUT_SLABEL		((char)0x36)
118 #define	AUT_CLEAR		((char)0x37)
119 #define	AUT_PRIV		((char)0x38)
120 #define	AUT_UPRIV		((char)0x39)
121 #define	AUT_LIAISON		((char)0x3A)
122 #define	AUT_NEWGROUPS		((char)0x3B)
123 #define	AUT_EXEC_ARGS		((char)0x3C)
124 #define	AUT_EXEC_ENV		((char)0x3D)
125 #define	AUT_ATTR32		((char)0x3E)
126 #define	AUT_UAUTH		((char)0x3F)
127 #define	AUT_ZONENAME		((char)0x60)
128 
129 /*
130  * X windows token types
131  */
132 
133 #define	AUT_XATOM		((char)0x40)
134 #define	AUT_XOBJ		((char)0x41)
135 #define	AUT_XPROTO		((char)0x42)
136 #define	AUT_XSELECT		((char)0x43)
137 
138 #if	TOKEN_VERSION != 3
139 #define	AUT_XCOLORMAP		((char)0x44)
140 #define	AUT_XCURSOR		((char)0x45)
141 #define	AUT_XFONT		((char)0x46)
142 #define	AUT_XGC			((char)0x47)
143 #define	AUT_XPIXMAP		((char)0x48)
144 #define	AUT_XPROPERTY		((char)0x49)
145 #define	AUT_XWINDOW		((char)0x4A)
146 #define	AUT_XCLIENT		((char)0x4B)
147 #else	/* TOKEN_VERSION == 3 */
148 #define	AUT_XCOLORMAP		((char)0x74)
149 #define	AUT_XCURSOR		((char)0x75)
150 #define	AUT_XFONT		((char)0x76)
151 #define	AUT_XGC			((char)0x77)
152 #define	AUT_XPIXMAP		((char)0x78)
153 #define	AUT_XPROPERTY		((char)0x79)
154 #define	AUT_XWINDOW		((char)0x7A)
155 #define	AUT_XCLIENT		((char)0x7B)
156 #endif	/* TOKEN_VERSION != 3 */
157 
158 /*
159  * Command token types
160  */
161 
162 #define	AUT_CMD   		((char)0x51)
163 #define	AUT_EXIT   		((char)0x52)
164 
165 /*
166  * Miscellaneous token types
167  */
168 
169 #define	AUT_HOST		((char)0x70)
170 
171 /*
172  * Solaris64 token types
173  */
174 
175 #define	AUT_ARG64		((char)0x71)
176 #define	AUT_RETURN64		((char)0x72)
177 #define	AUT_ATTR64		((char)0x73)
178 #define	AUT_HEADER64		((char)0x74)
179 #define	AUT_SUBJECT64		((char)0x75)
180 #define	AUT_PROCESS64		((char)0x77)
181 #define	AUT_OTHER_FILE64	((char)0x78)
182 
183 /*
184  * Extended network address token types
185  */
186 
187 #define	AUT_HEADER64_EX		((char)0x79)
188 #define	AUT_SUBJECT32_EX	((char)0x7a)
189 #define	AUT_PROCESS32_EX	((char)0x7b)
190 #define	AUT_SUBJECT64_EX	((char)0x7c)
191 #define	AUT_PROCESS64_EX	((char)0x7d)
192 #define	AUT_IN_ADDR_EX		((char)0x7e)
193 #define	AUT_SOCKET_EX		((char)0x7f)
194 
195 
196 /*
197  * Audit print suggestion types.
198  */
199 
200 #define	AUP_BINARY	((char)0)
201 #define	AUP_OCTAL	((char)1)
202 #define	AUP_DECIMAL	((char)2)
203 #define	AUP_HEX		((char)3)
204 #define	AUP_STRING	((char)4)
205 
206 /*
207  * Audit data member types.
208  */
209 
210 #define	AUR_BYTE	((char)0)
211 #define	AUR_CHAR	((char)0)
212 #define	AUR_SHORT	((char)1)
213 #define	AUR_INT		((char)2)
214 #define	AUR_INT32	((char)2)
215 #define	AUR_INT64	((char)3)
216 
217 /*
218  * Adr structures
219  */
220 
221 struct adr_s {
222 	char *adr_stream;	/* The base of the stream */
223 	char *adr_now;		/* The location within the stream */
224 };
225 
226 typedef struct adr_s adr_t;
227 
228 
229 #ifdef _KERNEL
230 
231 #include <sys/param.h>
232 #include <sys/systm.h>		/* for rval */
233 #include <sys/time.h>
234 #include <sys/types.h>
235 #include <sys/vnode.h>
236 #include <sys/mode.h>
237 #include <sys/user.h>
238 #include <sys/session.h>
239 #include <sys/ipc_impl.h>
240 #include <netinet/in_systm.h>
241 #include <netinet/in.h>
242 #include <netinet/ip.h>
243 #include <sys/socket.h>
244 #include <net/route.h>
245 #include <netinet/in_pcb.h>
246 
247 /*
248  * au_close flag arguments
249  */
250 
251 #define	AU_OK		0x1	/* Good audit record */
252 #define	AU_DONTBLOCK	0x2	/* Don't block or discard if queue full */
253 #define	AU_DEFER	0x4	/* Defer record queueing to syscall end */
254 
255 /*
256  * Audit token type is really an au_membuf pointer
257  */
258 typedef au_buff_t token_t;
259 /*
260  * token generation functions
261  */
262 token_t *au_append_token(token_t *, token_t *);
263 token_t *au_set(caddr_t, uint_t);
264 
265 void au_free_rec(au_buff_t *);
266 
267 #define	au_getclr()		((token_t *)au_get_buff())
268 #define	au_toss_token(tok)	(au_free_rec((au_buff_t *)(tok)))
269 
270 token_t *au_to_acl();
271 token_t *au_to_attr(struct vattr *);
272 token_t *au_to_data(char, char, char, char *);
273 token_t *au_to_header(int, au_event_t, au_emod_t);
274 token_t *au_to_header_ex(int, au_event_t, au_emod_t);
275 token_t *au_to_ipc(char, int);
276 token_t *au_to_ipc_perm(kipc_perm_t *);
277 token_t *au_to_iport(ushort_t);
278 token_t *au_to_in_addr(struct in_addr *);
279 token_t *au_to_in_addr_ex(int32_t *);
280 token_t *au_to_ip(struct ip *);
281 token_t *au_to_groups(const gid_t *, uint_t);
282 token_t *au_to_path(struct audit_path *);
283 token_t *au_to_seq();
284 token_t *au_to_process(uid_t, gid_t, uid_t, gid_t, pid_t,
285 			au_id_t, au_asid_t, const au_tid_addr_t *);
286 token_t *au_to_subject(uid_t, gid_t, uid_t, gid_t, pid_t,
287 			au_id_t, au_asid_t, const au_tid_addr_t *);
288 token_t *au_to_return32(int, int32_t);
289 token_t *au_to_return64(int, int64_t);
290 token_t *au_to_text(const char *);
291 /* token_t *au_to_tid(au_generic_tid_t *);  no kernel implementation */
292 token_t *au_to_trailer(int);
293 token_t *au_to_uauth(char *);
294 size_t	au_zonename_length(void);
295 token_t *au_to_zonename(size_t);
296 token_t *au_to_arg32(char, char *, uint32_t);
297 token_t *au_to_arg64(char, char *, uint64_t);
298 token_t *au_to_socket(struct socket *);
299 token_t *au_to_socket_ex(short, short, char *, char *);
300 token_t *au_to_sock_inet(struct sockaddr_in *);
301 token_t *au_to_exec_args(const char *, ssize_t);
302 token_t *au_to_exec_env(const char *, ssize_t);
303 token_t	*au_to_label(bslabel_t *);
304 token_t	*au_to_privset(const char *, const priv_set_t *, char, int);
305 
306 void	au_uwrite();
307 void	au_close(au_kcontext_t *, caddr_t *, int, au_event_t, au_emod_t);
308 void	au_close_defer(token_t *, int, au_event_t, au_emod_t);
309 void	au_close_time(au_kcontext_t *, token_t *, int, au_event_t, au_emod_t,
310 	    timestruc_t *);
311 void	au_free_rec(au_buff_t *);
312 void	au_write(caddr_t *, token_t *);
313 void	au_mem_init(void);
314 void	au_zone_setup();
315 void	au_enqueue(au_kcontext_t *, au_buff_t *, adr_t *, adr_t *, int, int);
316 int	au_doorio(au_kcontext_t *);
317 int	au_doormsg(au_kcontext_t *, uint32_t, void *);
318 int	au_doio(struct vnode *, int);
319 int	au_token_size(token_t *);
320 int	au_append_rec(au_buff_t *, au_buff_t *, int);
321 int	au_append_buf(const char *, int, au_buff_t *);
322 
323 #else /* !_KERNEL */
324 
325 #include <limits.h>
326 #include <sys/types.h>
327 #include <sys/vnode.h>
328 #include <netinet/in_systm.h>
329 #include <netinet/in.h>
330 #include <netinet/ip.h>
331 #include <sys/ipc.h>
332 
333 struct token_s {
334 	struct token_s	*tt_next;	/* Next in the list	*/
335 	short		tt_size;	/* Size of data		*/
336 	char		*tt_data;	/* The data		*/
337 };
338 typedef struct token_s token_t;
339 
340 struct au_arg32_tok {
341 	uchar_t num;
342 	uint32_t val;
343 	ushort_t length;
344 	char *data;
345 };
346 typedef struct au_arg32_tok au_arg32_tok_t;
347 
348 struct au_acl_tok {
349 	ulong_t type;
350 	ulong_t id;
351 	ulong_t mode;
352 };
353 typedef struct au_acl_tok au_acl_tok_t;
354 
355 struct au_arg64_tok {
356 	uchar_t num;
357 	uint64_t val;
358 	ushort_t length;
359 	char *data;
360 };
361 typedef struct au_arg64_tok au_arg64_tok_t;
362 
363 struct au_attr_tok {
364 	uint_t mode;
365 	uint_t uid;
366 	uint_t gid;
367 	int fs;
368 	int32_t node;
369 	uint32_t dev;
370 };
371 typedef struct au_attr_tok au_attr_tok_t;
372 
373 struct au_attr32_tok {
374 	uint_t mode;
375 	uint_t uid;
376 	uint_t gid;
377 	int fs;
378 	int64_t node;
379 	uint32_t dev;
380 };
381 typedef struct au_attr32_tok au_attr32_tok_t;
382 
383 struct au_attr64_tok {
384 	uint_t mode;
385 	uint_t uid;
386 	uint_t gid;
387 	int fs;
388 	int64_t node;
389 	uint64_t dev;
390 };
391 typedef struct au_attr64_tok au_attr64_tok_t;
392 
393 struct au_data_tok {
394 	uchar_t pfmt;
395 	uchar_t size;
396 	uchar_t number;
397 	char *data;
398 };
399 typedef struct au_data_tok au_data_tok_t;
400 
401 struct au_exit_tok {
402 	int status;
403 	int retval;
404 };
405 typedef struct au_exit_tok au_exit_tok_t;
406 
407 struct au_file32_tok {
408 	/* really struct timeval from gettimeofday() */
409 	int32_t sec;		/* seconds since epoc */
410 	int32_t usec;		/* microseconds */
411 	ushort_t length;
412 	char *fname;
413 };
414 typedef struct au_file32_tok au_file32_tok_t;
415 
416 struct au_file64_tok {
417 	/* really struct timeval */
418 	int64_t sec;		/* seconds since epoc */
419 	int64_t usec;		/* microseconds */
420 	ushort_t length;
421 	char *fname;
422 };
423 typedef struct au_file64_tok au_file64_tok_t;
424 
425 
426 struct au_groups_tok {
427 	gid_t groups[NGROUPS_MAX];
428 };
429 typedef struct au_groups_tok au_groups_tok_t;
430 
431 struct au_header32_tok {
432 	uint_t length;
433 	uchar_t version;
434 	au_event_t event;
435 	ushort_t emod;
436 	/* really timestruct_t (struct timespec) from hrestime */
437 	int32_t sec;		/* seconds since epoc */
438 	int32_t nsec;		/* nanoseconds */
439 };
440 typedef struct au_header32_tok au_header32_tok_t;
441 
442 struct au_header64_tok {
443 	uint_t length;
444 	uchar_t version;
445 	au_event_t event;
446 	ushort_t emod;
447 	/* really timestruct_t (struct timespec) from hrestime */
448 	int64_t sec;		/* seconds since epoc */
449 	int64_t nsec;		/* nanoseconds */
450 };
451 typedef struct au_header64_tok au_header64_tok_t;
452 
453 struct au_inaddr_tok {
454 	struct in_addr ia;
455 };
456 typedef struct au_inaddr_tok au_inaddr_tok_t;
457 
458 struct au_ip_tok {
459 	uchar_t version;
460 	struct ip ip;
461 };
462 typedef struct au_ip_tok au_ip_tok_t;
463 
464 struct au_ipc_tok {
465 	key_t id;
466 };
467 typedef struct au_ipc_tok au_ipc_tok_t;
468 
469 struct au_ipc_perm_tok {
470 	struct ipc_perm ipc_perm;
471 };
472 typedef struct au_ipc_perm_tok au_ipc_perm_tok_t;
473 
474 struct au_iport_tok {
475 	ushort_t iport;
476 };
477 typedef struct au_iport_tok au_iport_tok_t;
478 
479 struct au_invalid_tok {
480 	ushort_t length;
481 	char *data;
482 };
483 typedef struct au_invalid_tok au_invalid_tok_t;
484 
485 struct au_opaque_tok {
486 	ushort_t length;
487 	char *data;
488 };
489 typedef struct au_opaque_tok au_opaque_tok_t;
490 
491 struct au_path_tok {
492 	ushort_t length;
493 	char *name;
494 };
495 typedef struct au_path_tok au_path_tok_t;
496 
497 struct au_tid32 {
498 	uint32_t port;
499 	uint32_t machine;
500 };
501 typedef struct au_tid32 au_tid32_t;
502 
503 struct au_tid64 {
504 	uint64_t port;
505 	uint32_t machine;
506 };
507 typedef struct au_tid64 au_tid64_t;
508 
509 struct au_proc32_tok {
510 	au_id_t auid;
511 	uid_t euid;
512 	gid_t egid;
513 	uid_t ruid;
514 	gid_t rgid;
515 	pid_t pid;
516 	pid_t sid;
517 	au_tid32_t tid;
518 };
519 typedef struct au_proc32_tok au_proc32_tok_t;
520 
521 struct au_proc64_tok {
522 	au_id_t auid;
523 	uid_t euid;
524 	gid_t egid;
525 	uid_t ruid;
526 	gid_t rgid;
527 	pid_t pid;
528 	pid_t sid;
529 	au_tid64_t tid;
530 };
531 typedef struct au_proc64_tok au_proc64_tok_t;
532 
533 struct au_ret32_tok {
534 	uchar_t error;
535 	uint32_t retval;
536 };
537 typedef struct au_ret32_tok au_ret32_tok_t;
538 
539 struct au_ret64_tok {
540 	uchar_t error;
541 	uint64_t retval;
542 };
543 typedef struct au_ret64_tok au_ret64_tok_t;
544 
545 struct au_seq_tok {
546 	uint_t num;
547 };
548 typedef struct au_seq_tok au_seq_tok_t;
549 
550 struct au_socket_tok {
551 	short type;
552 	ushort_t lport;
553 	struct in_addr laddr;
554 	ushort_t fport;
555 	struct in_addr faddr;
556 };
557 typedef struct au_socket_tok au_socket_tok_t;
558 
559 struct au_subj32_tok {
560 	au_id_t auid;
561 	uid_t euid;
562 	gid_t egid;
563 	uid_t ruid;
564 	gid_t rgid;
565 	pid_t pid;
566 	pid_t sid;
567 	au_tid32_t tid;
568 };
569 typedef struct au_subj32_tok au_subj32_tok_t;
570 
571 struct au_subj64_tok {
572 	au_id_t auid;
573 	uid_t euid;
574 	gid_t egid;
575 	uid_t ruid;
576 	gid_t rgid;
577 	pid_t pid;
578 	pid_t sid;
579 	au_tid64_t tid;
580 };
581 typedef struct au_subj64_tok au_subj64_tok_t;
582 
583 struct au_server_tok {
584 	au_id_t auid;
585 	uid_t euid;
586 	uid_t ruid;
587 	gid_t egid;
588 	pid_t pid;
589 };
590 typedef struct au_server_tok au_server_tok_t;
591 
592 struct au_text_tok {
593 	ushort_t length;
594 	char *data;
595 };
596 typedef struct au_text_tok au_text_tok_t;
597 
598 struct au_trailer_tok {
599 	ushort_t magic;
600 	uint_t length;
601 };
602 typedef struct au_trailer_tok au_trailer_tok_t;
603 
604 struct au_uauth_tok {
605 	ushort_t length;
606 	char *data;
607 };
608 typedef struct au_uauth_tok au_uauth_tok_t;
609 
610 struct au_token {
611 	char id;
612 	struct au_token *next;
613 	struct au_token *prev;
614 	char *data;
615 	ushort_t size;
616 	union {
617 		au_arg32_tok_t arg32;
618 		au_arg64_tok_t arg64;
619 		au_acl_tok_t acl;
620 		au_attr32_tok_t attr32;
621 		au_attr64_tok_t attr64;
622 		au_data_tok_t data;
623 		au_exit_tok_t exit;
624 		au_file32_tok_t file32;
625 		au_file64_tok_t file64;
626 		au_groups_tok_t groups;
627 		au_header32_tok_t header32;
628 		au_header64_tok_t header64;
629 		au_inaddr_tok_t inaddr;
630 		au_ip_tok_t ip;
631 		au_ipc_perm_tok_t ipc_perm;
632 		au_ipc_tok_t ipc;
633 		au_iport_tok_t iport;
634 		au_invalid_tok_t invalid;
635 		au_opaque_tok_t opaque;
636 		au_path_tok_t path;
637 		au_proc32_tok_t proc32;
638 		au_proc64_tok_t proc64;
639 		au_ret32_tok_t ret32;
640 		au_ret64_tok_t ret64;
641 		au_server_tok_t server;
642 		au_seq_tok_t seq;
643 		au_socket_tok_t socket;
644 		au_subj32_tok_t subj32;
645 		au_subj64_tok_t subj64;
646 		au_text_tok_t text;
647 		au_trailer_tok_t trailer;
648 		au_uauth_tok_t useofauth;
649 	} un;
650 };
651 typedef struct au_token au_token_t;
652 
653 
654 /*
655  *	Old socket structure definition, formerly in <sys/socketvar.h>
656  */
657 struct oldsocket {
658 	short	so_type;		/* generic type, see socket.h */
659 	short	so_options;		/* from socket call, see socket.h */
660 	short	so_linger;		/* time to linger while closing */
661 	short	so_state;		/* internal state flags SS_*, below */
662 	struct inpcb	*so_pcb;	/* protocol control block */
663 	struct	protosw *so_proto;	/* protocol handle */
664 /*
665  * Variables for connection queueing.
666  * Socket where accepts occur is so_head in all subsidiary sockets.
667  * If so_head is 0, socket is not related to an accept.
668  * For head socket so_q0 queues partially completed connections,
669  * while so_q is a queue of connections ready to be accepted.
670  * If a connection is aborted and it has so_head set, then
671  * it has to be pulled out of either so_q0 or so_q.
672  * We allow connections to queue up based on current queue lengths
673  * and limit on number of queued connections for this socket.
674  */
675 	struct	oldsocket *so_head;	/* back pointer to accept socket */
676 	struct	oldsocket *so_q0;	/* queue of partial connections */
677 	struct	oldsocket *so_q;	/* queue of incoming connections */
678 	short	so_q0len;		/* partials on so_q0 */
679 	short	so_qlen;		/* number of connections on so_q */
680 	short	so_qlimit;		/* max number queued connections */
681 	short	so_timeo;		/* connection timeout */
682 	ushort_t so_error;		/* error affecting connection */
683 	short	so_pgrp;		/* pgrp for signals */
684 	ulong_t	so_oobmark;		/* chars to oob mark */
685 /*
686  * Variables for socket buffering.
687  */
688 	struct	sockbuf {
689 		ulong_t	sb_cc;		/* actual chars in buffer */
690 		ulong_t	sb_hiwat;	/* max actual char count */
691 		ulong_t	sb_mbcnt;	/* chars of mbufs used */
692 		ulong_t	sb_mbmax;	/* max chars of mbufs to use */
693 		ulong_t	sb_lowat;	/* low water mark (not used yet) */
694 		struct	mbuf *sb_mb;	/* the mbuf chain */
695 		struct	proc *sb_sel;	/* process selecting read/write */
696 		short	sb_timeo;	/* timeout (not used yet) */
697 		short	sb_flags;	/* flags, see below */
698 	} so_rcv, so_snd;
699 /*
700  * Hooks for alternative wakeup strategies.
701  * These are used by kernel subsystems wishing to access the socket
702  * abstraction.  If so_wupfunc is nonnull, it is called in place of
703  * wakeup any time that wakeup would otherwise be called with an
704  * argument whose value is an address lying within a socket structure.
705  */
706 	struct wupalt	*so_wupalt;
707 };
708 extern token_t *au_to_arg32(char, char *, uint32_t);
709 extern token_t *au_to_arg64(char, char *, uint64_t);
710 extern token_t *au_to_acl(struct acl *);
711 extern token_t *au_to_attr(struct vattr *);
712 extern token_t *au_to_cmd(uint_t, char **, char **);
713 extern token_t *au_to_data(char, char, char, char *);
714 extern token_t *au_to_exec_args(char **);
715 extern token_t *au_to_exec_env(char **);
716 extern token_t *au_to_exit(int, int);
717 extern token_t *au_to_groups(int *);
718 extern token_t *au_to_newgroups(int, gid_t *);
719 extern token_t *au_to_header(au_event_t, au_emod_t);
720 extern token_t *au_to_header_ex(au_event_t, au_emod_t);
721 extern token_t *au_to_in_addr(struct in_addr *);
722 extern token_t *au_to_in_addr_ex(int32_t *);
723 extern token_t *au_to_ipc(char, int);
724 extern token_t *au_to_ipc_perm(struct ipc_perm *);
725 extern token_t *au_to_iport(ushort_t);
726 extern token_t *au_to_me(void);
727 extern token_t *au_to_mylabel(void);
728 extern token_t *au_to_opaque(char *, short);
729 extern token_t *au_to_path(char *);
730 extern token_t *au_to_privset(const char *, const priv_set_t *);
731 extern token_t *au_to_process(au_id_t, uid_t, gid_t, uid_t, gid_t,
732 				pid_t, au_asid_t, au_tid_t *);
733 extern token_t *au_to_process_ex(au_id_t, uid_t, gid_t, uid_t, gid_t,
734 				pid_t, au_asid_t, au_tid_addr_t *);
735 extern token_t *au_to_return32(char, uint32_t);
736 extern token_t *au_to_return64(char, uint64_t);
737 extern token_t *au_to_seq(int);
738 extern token_t *au_to_label(bslabel_t *);
739 extern token_t *au_to_socket(struct oldsocket *);
740 extern token_t *au_to_socket_ex(short, short,
741 				struct sockaddr *, struct sockaddr *);
742 extern token_t *au_to_sock_inet(struct sockaddr_in *);
743 extern token_t *au_to_subject(au_id_t, uid_t, gid_t, uid_t, gid_t,
744 				pid_t, au_asid_t, au_tid_t *);
745 extern token_t *au_to_subject_ex(au_id_t, uid_t, gid_t, uid_t, gid_t,
746 				pid_t, au_asid_t, au_tid_addr_t *);
747 extern token_t *au_to_text(char *);
748 extern token_t *au_to_tid(au_generic_tid_t *);
749 extern token_t *au_to_trailer(void);
750 extern token_t *au_to_uauth(char *);
751 extern token_t *au_to_xatom(ushort_t, char *);
752 extern token_t *au_to_xobj(int, int, int);
753 extern token_t *au_to_xproto(pid_t);
754 extern token_t *au_to_xselect(char *, char *, short, char *);
755 extern token_t *au_to_zonename(char *);
756 #endif /* _KERNEL */
757 
758 #ifdef	_KERNEL
759 
760 void	adr_char(adr_t *, char *, int);
761 void	adr_int32(adr_t *, int32_t *, int);
762 void	adr_uint32(adr_t *, uint32_t *, int);
763 void	adr_int64(adr_t *, int64_t *, int);
764 void	adr_uint64(adr_t *, uint64_t *, int);
765 void	adr_short(adr_t *, short *, int);
766 void	adr_ushort(adr_t *, ushort_t *, int);
767 void	adr_start(adr_t *, char *);
768 
769 char	*adr_getchar(adr_t *, char *);
770 char	*adr_getshort(adr_t *, short  *);
771 char	*adr_getushort(adr_t *, ushort_t  *);
772 char	*adr_getint32(adr_t *, int32_t *);
773 char	*adr_getuint32(adr_t *, uint32_t *);
774 char	*adr_getint64(adr_t *, int64_t *);
775 char	*adr_getuint64(adr_t *, uint64_t *);
776 
777 int	adr_count(adr_t *);
778 
779 #endif	/* _KERNEL */
780 
781 #ifdef __cplusplus
782 }
783 #endif
784 
785 #endif /* _BSM_AUDIT_RECORD_H */
786