ipsecesp.h revision 3448:aaf16568054b
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
35extern "C" {
36#endif
37
38#ifdef _KERNEL
39
40/* Named Dispatch Parameter Management Structure */
41typedef 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 */
51struct 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};
78typedef struct ipsecesp_stack ipsecesp_stack_t;
79
80
81#endif	/* _KERNEL */
82
83/*
84 * For now, only provide "aligned" version of header.
85 * If aligned version is needed, we'll go with the naming conventions then.
86 */
87
88typedef struct esph {
89	uint32_t esph_spi;
90	uint32_t esph_replay;
91} esph_t;
92
93/* No need for "old" ESP, just point a uint32_t *. */
94
95#ifdef	__cplusplus
96}
97#endif
98
99#endif /* _INET_IPSECESP_H */
100