xref: /titanic_41/usr/src/uts/common/inet/spdsock.h (revision 177fd15c9f814babb60e824f89984cdd8acf7c85)
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	_INET_SPDSOCK_H
27 #define	_INET_SPDSOCK_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #ifdef	__cplusplus
32 extern "C" {
33 #endif
34 
35 /*
36  * spdsock (PF_POLICY) session state; one per open PF_POLICY socket.
37  *
38  * These are kept on a linked list by the spdsock module.
39  */
40 
41 typedef struct spdsock_s
42 {
43 	uint_t	spdsock_state;	/* TLI gorp */
44 
45 	minor_t spdsock_minor;
46 
47 	/*
48 	 * In-progress SPD_DUMP state, valid if spdsock_dump_req is non-NULL.
49 	 *
50 	 * spdsock_dump_req is the request which got us started.
51 	 * spdsock_dump_head is a reference to a policy head.
52 	 * spdsock_dump_cur_* tell us where we are in the policy walk,
53 	 * validated by looking at spdsock_dump_gen vs
54 	 * dump_head->iph_gen after taking a read lock on the policy
55 	 * head.
56 	 */
57 	mblk_t			*spdsock_dump_req;
58 	ipsec_policy_head_t 	*spdsock_dump_head;
59 	uint64_t 		spdsock_dump_gen;
60 	timeout_id_t		spdsock_timeout;
61 	mblk_t			*spdsock_timeout_arg;
62 	int			spdsock_dump_cur_type;
63 	int			spdsock_dump_cur_af;
64 	ipsec_policy_t 		*spdsock_dump_cur_rule;
65 	uint32_t		spdsock_dump_cur_chain;
66 	uint32_t		spdsock_dump_count;
67 	/* These are used for all-polhead dumps. */
68 	int			spdsock_dump_tun_gen;
69 	boolean_t		spdsock_dump_active;
70 	boolean_t		spdsock_dump_tunnel;
71 	int			spdsock_dump_remaining_polheads;
72 	char			spdsock_dump_name[LIFNAMSIZ];
73 } spdsock_t;
74 
75 #define	LOADCHECK_INTERVAL	(drv_usectohz(30000))
76 
77 /*
78  * Socket option boilerplate code.
79  */
80 
81 extern optdb_obj_t	spdsock_opt_obj;
82 extern uint_t		spdsock_max_optsize;
83 
84 extern int spdsock_opt_get(queue_t *, int, int, uchar_t *);
85 extern int spdsock_opt_set(queue_t *, uint_t, int, int, uint_t, uchar_t *,
86     uint_t *, uchar_t *, void *, cred_t *,
87     mblk_t *);
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif /* _INET_SPDSOCK_H */
94