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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _NET_PFKEYV2_H
27 #define _NET_PFKEYV2_H
28
29 /*
30 * Definitions and structures for PF_KEY version 2. See RFC 2367 for
31 * more details. SA == Security Association, which is what PF_KEY provides
32 * an API for managing.
33 */
34
35 #ifdef __cplusplus
36 extern "C" {
37 #endif
38
39 #define PF_KEY_V2 2
40 #define PFKEYV2_REVISION 200109L
41
42 /*
43 * Base PF_KEY message.
44 */
460 #define sadb_x_ereg_exttype \
461 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_uexttype
462 #define sadb_x_ereg_satypes \
463 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_usatypes
464 } sadb_x_ereg_t;
465
466 /*
467 * For conveying a Key Management Cookie with SADB_GETSPI, SADB_ADD,
468 * SADB_ACQUIRE, or SADB_X_INVERSE_ACQUIRE.
469 */
470
471 typedef struct sadb_x_kmc {
472 uint16_t sadb_x_kmc_len;
473 uint16_t sadb_x_kmc_exttype; /* X_KM_COOKIE */
474 uint32_t sadb_x_kmc_proto; /* KM protocol */
475 union {
476 struct {
477 uint32_t sadb_x_kmc_ucookie; /* KMP-specific */
478 uint32_t sadb_x_kmc_ureserved; /* Must be zero */
479 } sadb_x_kmc_actual;
480 uint64_t sadb_x_kmc_alignment;
481 } sadb_x_kmc_u;
482 #define sadb_x_kmc_cookie sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ucookie
483 #define sadb_x_kmc_reserved sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ureserved
484 } sadb_x_kmc_t;
485
486 typedef struct sadb_x_pair {
487 union {
488 /* Union is for guaranteeing 64-bit alignment. */
489 struct {
490 uint16_t sadb_x_pair_ulen;
491 uint16_t sadb_x_pair_uexttype;
492 uint32_t sadb_x_pair_uspi; /* SPI of paired SA */
493 } sadb_x_pair_actual;
494 uint64_t sadb_x_ext_alignment;
495 } sadb_x_pair_u;
496 #define sadb_x_pair_len sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_ulen
497 #define sadb_x_pair_exttype \
498 sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uexttype
499 #define sadb_x_pair_spi sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uspi
500 } sadb_x_pair_t;
501
502 /*
503 * For the Sequence numbers to be used with SADB_DUMP, SADB_GET, SADB_UPDATE.
817 #define SADB_X_DIAGNOSTIC_SA_NOTFOUND 78
818 #define SADB_X_DIAGNOSTIC_SA_EXPIRED 79
819 #define SADB_X_DIAGNOSTIC_BAD_CTX 80
820 #define SADB_X_DIAGNOSTIC_INVALID_REPLAY 81
821 #define SADB_X_DIAGNOSTIC_MISSING_LIFETIME 82
822
823 #define SADB_X_DIAGNOSTIC_BAD_LABEL 83
824 #define SADB_X_DIAGNOSTIC_MAX 83
825
826 /* Algorithm type for sadb_x_algdesc above... */
827
828 #define SADB_X_ALGTYPE_NONE 0
829 #define SADB_X_ALGTYPE_AUTH 1
830 #define SADB_X_ALGTYPE_CRYPT 2
831 #define SADB_X_ALGTYPE_COMPRESS 3
832
833 #define SADB_X_ALGTYPE_MAX 3
834
835 /* Key management protocol for sadb_x_kmc above... */
836
837 #define SADB_X_KMP_MANUAL 0
838 #define SADB_X_KMP_IKE 1
839 #define SADB_X_KMP_KINK 2
840
841 #define SADB_X_KMP_MAX 2
842
843 /*
844 * Handy conversion macros. Not part of the PF_KEY spec...
845 */
846
847 #define SADB_64TO8(x) ((x) << 3)
848 #define SADB_8TO64(x) ((x) >> 3)
849 #define SADB_8TO1(x) ((x) << 3)
850 #define SADB_1TO8(x) ((x) >> 3)
851
852 #ifdef __cplusplus
853 }
854 #endif
855
856 #endif /* _NET_PFKEYV2_H */
|
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 2009 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25 /*
26 * Copyright 2017 Joyent, Inc.
27 */
28
29 #ifndef _NET_PFKEYV2_H
30 #define _NET_PFKEYV2_H
31
32 /*
33 * Definitions and structures for PF_KEY version 2. See RFC 2367 for
34 * more details. SA == Security Association, which is what PF_KEY provides
35 * an API for managing.
36 */
37
38 #ifdef __cplusplus
39 extern "C" {
40 #endif
41
42 #define PF_KEY_V2 2
43 #define PFKEYV2_REVISION 200109L
44
45 /*
46 * Base PF_KEY message.
47 */
463 #define sadb_x_ereg_exttype \
464 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_uexttype
465 #define sadb_x_ereg_satypes \
466 sadb_x_ereg_u.sadb_x_ereg_actual.sadb_x_ereg_usatypes
467 } sadb_x_ereg_t;
468
469 /*
470 * For conveying a Key Management Cookie with SADB_GETSPI, SADB_ADD,
471 * SADB_ACQUIRE, or SADB_X_INVERSE_ACQUIRE.
472 */
473
474 typedef struct sadb_x_kmc {
475 uint16_t sadb_x_kmc_len;
476 uint16_t sadb_x_kmc_exttype; /* X_KM_COOKIE */
477 uint32_t sadb_x_kmc_proto; /* KM protocol */
478 union {
479 struct {
480 uint32_t sadb_x_kmc_ucookie; /* KMP-specific */
481 uint32_t sadb_x_kmc_ureserved; /* Must be zero */
482 } sadb_x_kmc_actual;
483 uint64_t sadb_x_kmc_ucookie64;
484 } sadb_x_kmc_u;
485 #define sadb_x_kmc_cookie sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ucookie
486 #define sadb_x_kmc_reserved sadb_x_kmc_u.sadb_x_kmc_actual.sadb_x_kmc_ureserved
487 #define sadb_x_kmc_cookie64 sadb_x_kmc_u.sadb_x_kmc_ucookie64
488 } sadb_x_kmc_t;
489
490 typedef struct sadb_x_pair {
491 union {
492 /* Union is for guaranteeing 64-bit alignment. */
493 struct {
494 uint16_t sadb_x_pair_ulen;
495 uint16_t sadb_x_pair_uexttype;
496 uint32_t sadb_x_pair_uspi; /* SPI of paired SA */
497 } sadb_x_pair_actual;
498 uint64_t sadb_x_ext_alignment;
499 } sadb_x_pair_u;
500 #define sadb_x_pair_len sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_ulen
501 #define sadb_x_pair_exttype \
502 sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uexttype
503 #define sadb_x_pair_spi sadb_x_pair_u.sadb_x_pair_actual.sadb_x_pair_uspi
504 } sadb_x_pair_t;
505
506 /*
507 * For the Sequence numbers to be used with SADB_DUMP, SADB_GET, SADB_UPDATE.
821 #define SADB_X_DIAGNOSTIC_SA_NOTFOUND 78
822 #define SADB_X_DIAGNOSTIC_SA_EXPIRED 79
823 #define SADB_X_DIAGNOSTIC_BAD_CTX 80
824 #define SADB_X_DIAGNOSTIC_INVALID_REPLAY 81
825 #define SADB_X_DIAGNOSTIC_MISSING_LIFETIME 82
826
827 #define SADB_X_DIAGNOSTIC_BAD_LABEL 83
828 #define SADB_X_DIAGNOSTIC_MAX 83
829
830 /* Algorithm type for sadb_x_algdesc above... */
831
832 #define SADB_X_ALGTYPE_NONE 0
833 #define SADB_X_ALGTYPE_AUTH 1
834 #define SADB_X_ALGTYPE_CRYPT 2
835 #define SADB_X_ALGTYPE_COMPRESS 3
836
837 #define SADB_X_ALGTYPE_MAX 3
838
839 /* Key management protocol for sadb_x_kmc above... */
840
841 #define SADB_X_KMP_MANUAL 0 /* Cookie is ignored. */
842 #define SADB_X_KMP_IKE 1
843 #define SADB_X_KMP_KINK 2
844
845 #define SADB_X_KMP_MAX 2
846
847 /*
848 * Handy conversion macros. Not part of the PF_KEY spec...
849 */
850
851 #define SADB_64TO8(x) ((x) << 3)
852 #define SADB_8TO64(x) ((x) >> 3)
853 #define SADB_8TO1(x) ((x) << 3)
854 #define SADB_1TO8(x) ((x) >> 3)
855
856 #ifdef __cplusplus
857 }
858 #endif
859
860 #endif /* _NET_PFKEYV2_H */
|