xref: /titanic_51/usr/src/uts/common/inet/ipsecesp.h (revision 791a814c934fcd4deb13b26c1f116ff283272a0d)
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 2007 Sun Microsystems, Inc.  All rights reserved.
23  * Use is subject to license terms.
24  */
25 
26 #ifndef	_INET_IPSECESP_H
27 #define	_INET_IPSECESP_H
28 
29 #pragma ident	"%Z%%M%	%I%	%E% SMI"
30 
31 #include <inet/ip.h>
32 #include <inet/ipdrop.h>
33 
34 #ifdef	__cplusplus
35 extern "C" {
36 #endif
37 
38 #ifdef _KERNEL
39 
40 /* Named Dispatch Parameter Management Structure */
41 typedef struct ipsecespparam_s {
42 	uint_t	ipsecesp_param_min;
43 	uint_t	ipsecesp_param_max;
44 	uint_t	ipsecesp_param_value;
45 	char	*ipsecesp_param_name;
46 } ipsecespparam_t;
47 
48 /*
49  * IPSECESP stack instances
50  */
51 struct ipsecesp_stack {
52 	netstack_t		*ipsecesp_netstack;	/* Common netstack */
53 
54 	caddr_t			ipsecesp_g_nd;
55 	struct ipsecespparam_s	*ipsecesp_params;
56 	kmutex_t		ipsecesp_param_lock;	/* Protects params */
57 
58 	/* Packet dropper for ESP drops. */
59 	ipdropper_t		esp_dropper;
60 
61 	kstat_t			*esp_ksp;
62 	struct esp_kstats_s	*esp_kstats;
63 
64 	/*
65 	 * Keysock instance of ESP.  There can be only one per stack instance.
66 	 * Use casptr() on this because I don't set it until KEYSOCK_HELLO
67 	 * comes down.
68 	 * Paired up with the esp_pfkey_q is the esp_event, which will age SAs.
69 	 */
70 	queue_t			*esp_pfkey_q;
71 	timeout_id_t		esp_event;
72 
73 	mblk_t			*esp_ip_unbind;
74 
75 	sadbp_t			esp_sadb;
76 
77 };
78 typedef struct ipsecesp_stack ipsecesp_stack_t;
79 
80 /* Define *this* NDD variable here because we use it outside ESP proper. */
81 #define	ipsecesp_nat_keepalive_interval	\
82 	ipsecesp_params[14].ipsecesp_param_value
83 
84 #endif	/* _KERNEL */
85 
86 /*
87  * For now, only provide "aligned" version of header.
88  * If aligned version is needed, we'll go with the naming conventions then.
89  */
90 
91 typedef struct esph {
92 	uint32_t esph_spi;
93 	uint32_t esph_replay;
94 } esph_t;
95 
96 /* No need for "old" ESP, just point a uint32_t *. */
97 
98 #ifdef	__cplusplus
99 }
100 #endif
101 
102 #endif /* _INET_IPSECESP_H */
103