xref: /titanic_50/usr/src/uts/common/inet/spdsock.h (revision 7c478bd95313f5f23a4c958a745db2134aa03244)
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, Version 1.0 only
6  * (the "License").  You may not use this file except in compliance
7  * with the License.
8  *
9  * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
10  * or http://www.opensolaris.org/os/licensing.
11  * See the License for the specific language governing permissions
12  * and limitations under the License.
13  *
14  * When distributing Covered Code, include this CDDL HEADER in each
15  * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
16  * If applicable, add the following below this CDDL HEADER, with the
17  * fields enclosed by brackets "[]" replaced with your own identifying
18  * information: Portions Copyright [yyyy] [name of copyright owner]
19  *
20  * CDDL HEADER END
21  */
22 /*
23  * Copyright 2001-2003 Sun Microsystems, Inc.  All rights reserved.
24  * Use is subject to license terms.
25  */
26 
27 #ifndef	_INET_SPDSOCK_H
28 #define	_INET_SPDSOCK_H
29 
30 #pragma ident	"%Z%%M%	%I%	%E% SMI"
31 
32 #ifdef	__cplusplus
33 extern "C" {
34 #endif
35 
36 /*
37  * spdsock (PF_POLICY) session state; one per open PF_POLICY socket.
38  *
39  * These are kept on a linked list by the spdsock module.
40  */
41 
42 typedef struct spdsock_s
43 {
44 	uint_t	spdsock_state;	/* TLI gorp */
45 
46 	minor_t spdsock_minor;
47 
48 	/*
49 	 * In-progress SPD_DUMP state, valid if spdsock_dump_req is non-NULL.
50 	 *
51 	 * spdsock_dump_req is the request which got us started.
52 	 * spdsock_dump_head is a reference to a policy head.
53 	 * spdsock_dump_cur_* tell us where we are in the policy walk,
54 	 * validated by looking at spdsock_dump_gen vs
55 	 * dump_head->iph_gen after taking a read lock on the policy
56 	 * head.
57 	 */
58 	mblk_t			*spdsock_dump_req;
59 	ipsec_policy_head_t 	*spdsock_dump_head;
60 	uint64_t 		spdsock_dump_gen;
61 	timeout_id_t		spdsock_timeout;
62 	mblk_t			*spdsock_timeout_arg;
63 	int			spdsock_dump_cur_type;
64 	int			spdsock_dump_cur_af;
65 	ipsec_policy_t 		*spdsock_dump_cur_rule;
66 	uint32_t		spdsock_dump_count;
67 } spdsock_t;
68 
69 #define	LOADCHECK_INTERVAL	(drv_usectohz(30000))
70 
71 /*
72  * Socket option boilerplate code.
73  */
74 
75 extern optdb_obj_t	spdsock_opt_obj;
76 extern uint_t		spdsock_max_optsize;
77 
78 extern int spdsock_opt_get(queue_t *, int, int, uchar_t *);
79 extern int spdsock_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *,
80     uint_t *, uchar_t *, void *, cred_t *,
81     mblk_t *);
82 
83 #ifdef	__cplusplus
84 }
85 #endif
86 
87 #endif /* _INET_SPDSOCK_H */
88