xref: /titanic_41/usr/src/uts/common/inet/spdsock.h (revision 108322fb1c3ed341aba9c80c9774df0ed9e35768)
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 2005 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_cur_chain;
67 	uint32_t		spdsock_dump_count;
68 } spdsock_t;
69 
70 #define	LOADCHECK_INTERVAL	(drv_usectohz(30000))
71 
72 /*
73  * Socket option boilerplate code.
74  */
75 
76 extern optdb_obj_t	spdsock_opt_obj;
77 extern uint_t		spdsock_max_optsize;
78 
79 extern int spdsock_opt_get(queue_t *, int, int, uchar_t *);
80 extern int spdsock_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *,
81     uint_t *, uchar_t *, void *, cred_t *,
82     mblk_t *);
83 
84 #ifdef	__cplusplus
85 }
86 #endif
87 
88 #endif /* _INET_SPDSOCK_H */
89