xref: /xnu-8796.101.5/bsd/netkey/key_var.h (revision aca3beaa3dfbd42498b42c5e5ce20a938e6554e5)
1*aca3beaaSApple OSS Distributions /*	$KAME: key_var.h,v 1.5 2000/02/22 14:06:41 itojun Exp $	*/
2*aca3beaaSApple OSS Distributions 
3*aca3beaaSApple OSS Distributions /*
4*aca3beaaSApple OSS Distributions  * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
5*aca3beaaSApple OSS Distributions  * All rights reserved.
6*aca3beaaSApple OSS Distributions  *
7*aca3beaaSApple OSS Distributions  * Redistribution and use in source and binary forms, with or without
8*aca3beaaSApple OSS Distributions  * modification, are permitted provided that the following conditions
9*aca3beaaSApple OSS Distributions  * are met:
10*aca3beaaSApple OSS Distributions  * 1. Redistributions of source code must retain the above copyright
11*aca3beaaSApple OSS Distributions  *    notice, this list of conditions and the following disclaimer.
12*aca3beaaSApple OSS Distributions  * 2. Redistributions in binary form must reproduce the above copyright
13*aca3beaaSApple OSS Distributions  *    notice, this list of conditions and the following disclaimer in the
14*aca3beaaSApple OSS Distributions  *    documentation and/or other materials provided with the distribution.
15*aca3beaaSApple OSS Distributions  * 3. Neither the name of the project nor the names of its contributors
16*aca3beaaSApple OSS Distributions  *    may be used to endorse or promote products derived from this software
17*aca3beaaSApple OSS Distributions  *    without specific prior written permission.
18*aca3beaaSApple OSS Distributions  *
19*aca3beaaSApple OSS Distributions  * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
20*aca3beaaSApple OSS Distributions  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
21*aca3beaaSApple OSS Distributions  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
22*aca3beaaSApple OSS Distributions  * ARE DISCLAIMED.  IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
23*aca3beaaSApple OSS Distributions  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
24*aca3beaaSApple OSS Distributions  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
25*aca3beaaSApple OSS Distributions  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
26*aca3beaaSApple OSS Distributions  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
27*aca3beaaSApple OSS Distributions  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
28*aca3beaaSApple OSS Distributions  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
29*aca3beaaSApple OSS Distributions  * SUCH DAMAGE.
30*aca3beaaSApple OSS Distributions  */
31*aca3beaaSApple OSS Distributions 
32*aca3beaaSApple OSS Distributions #ifndef _NETKEY_KEY_VAR_H_
33*aca3beaaSApple OSS Distributions #define _NETKEY_KEY_VAR_H_
34*aca3beaaSApple OSS Distributions #include <sys/appleapiopts.h>
35*aca3beaaSApple OSS Distributions 
36*aca3beaaSApple OSS Distributions /* sysctl */
37*aca3beaaSApple OSS Distributions #define KEYCTL_DEBUG_LEVEL              1
38*aca3beaaSApple OSS Distributions #define KEYCTL_SPI_TRY                  2
39*aca3beaaSApple OSS Distributions #define KEYCTL_SPI_MIN_VALUE            3
40*aca3beaaSApple OSS Distributions #define KEYCTL_SPI_MAX_VALUE            4
41*aca3beaaSApple OSS Distributions #define KEYCTL_RANDOM_INT               5
42*aca3beaaSApple OSS Distributions #define KEYCTL_LARVAL_LIFETIME          6
43*aca3beaaSApple OSS Distributions #define KEYCTL_BLOCKACQ_COUNT           7
44*aca3beaaSApple OSS Distributions #define KEYCTL_BLOCKACQ_LIFETIME        8
45*aca3beaaSApple OSS Distributions #define KEYCTL_ESP_KEYMIN               9
46*aca3beaaSApple OSS Distributions #define KEYCTL_ESP_AUTH                 10
47*aca3beaaSApple OSS Distributions #define KEYCTL_AH_KEYMIN                11
48*aca3beaaSApple OSS Distributions #define KEYCTL_PREFERED_OLDSA           12
49*aca3beaaSApple OSS Distributions #define KEYCTL_NATT_KEEPALIVE_INTERVAL  13
50*aca3beaaSApple OSS Distributions #define KEYCTL_PFKEYSTAT                14
51*aca3beaaSApple OSS Distributions #define KEYCTL_MAXID                    15
52*aca3beaaSApple OSS Distributions 
53*aca3beaaSApple OSS Distributions #ifdef BSD_KERNEL_PRIVATE
54*aca3beaaSApple OSS Distributions #define KEYCTL_NAMES { \
55*aca3beaaSApple OSS Distributions 	{ 0, 0 }, \
56*aca3beaaSApple OSS Distributions 	{ "debug", CTLTYPE_INT }, \
57*aca3beaaSApple OSS Distributions 	{ "spi_try", CTLTYPE_INT }, \
58*aca3beaaSApple OSS Distributions 	{ "spi_min_value", CTLTYPE_INT }, \
59*aca3beaaSApple OSS Distributions 	{ "spi_max_value", CTLTYPE_INT }, \
60*aca3beaaSApple OSS Distributions 	{ "random_int", CTLTYPE_INT }, \
61*aca3beaaSApple OSS Distributions 	{ "larval_lifetime", CTLTYPE_INT }, \
62*aca3beaaSApple OSS Distributions 	{ "blockacq_count", CTLTYPE_INT }, \
63*aca3beaaSApple OSS Distributions 	{ "blockacq_lifetime", CTLTYPE_INT }, \
64*aca3beaaSApple OSS Distributions 	{ "esp_keymin", CTLTYPE_INT }, \
65*aca3beaaSApple OSS Distributions 	{ "esp_auth", CTLTYPE_INT }, \
66*aca3beaaSApple OSS Distributions 	{ "ah_keymin", CTLTYPE_INT }, \
67*aca3beaaSApple OSS Distributions 	{ "prefered_oldsa", CTLTYPE_INT }, \
68*aca3beaaSApple OSS Distributions 	{ "natt_keepalive_interval", CTLTYPE_INT }, \
69*aca3beaaSApple OSS Distributions 	{ "pfkeystat", CTLTYPE_STRUCT }, \
70*aca3beaaSApple OSS Distributions }
71*aca3beaaSApple OSS Distributions 
72*aca3beaaSApple OSS Distributions #define KEYCTL_VARS { \
73*aca3beaaSApple OSS Distributions 	0, \
74*aca3beaaSApple OSS Distributions 	&key_debug_level, \
75*aca3beaaSApple OSS Distributions 	&key_spi_trycnt, \
76*aca3beaaSApple OSS Distributions 	&key_spi_minval, \
77*aca3beaaSApple OSS Distributions 	&key_spi_maxval, \
78*aca3beaaSApple OSS Distributions 	&key_int_random, \
79*aca3beaaSApple OSS Distributions 	&key_larval_lifetime, \
80*aca3beaaSApple OSS Distributions 	&key_blockacq_count, \
81*aca3beaaSApple OSS Distributions 	&key_blockacq_lifetime, \
82*aca3beaaSApple OSS Distributions 	&ipsec_esp_keymin, \
83*aca3beaaSApple OSS Distributions 	&ipsec_ah_keymin, \
84*aca3beaaSApple OSS Distributions 	&ipsec_prefered_oldsa, \
85*aca3beaaSApple OSS Distributions 	&natt_keepalive_interval, \
86*aca3beaaSApple OSS Distributions }
87*aca3beaaSApple OSS Distributions 
88*aca3beaaSApple OSS Distributions #define _ARRAYLEN(p) (sizeof(p)/sizeof(p[0]))
89*aca3beaaSApple OSS Distributions #define _KEYLEN(key) ((u_int)((key)->sadb_key_bits >> 3))
90*aca3beaaSApple OSS Distributions #define _KEYBITS(key) ((u_int)((key)->sadb_key_bits))
91*aca3beaaSApple OSS Distributions #define _KEYBUF(key) ((caddr_t)((caddr_t)(key) + sizeof(struct sadb_key)))
92*aca3beaaSApple OSS Distributions 
93*aca3beaaSApple OSS Distributions #endif /* BSD_KERNEL_PRIVATE */
94*aca3beaaSApple OSS Distributions #endif /* _NETKEY_KEY_VAR_H_ */
95