0217538a0b30055f71e8dd9d1ac6cb73ffd743c5
[strongswan.git] / src / libfreeswan / pfkey_v2_debug.c
1 /*
2 * @(#) pfkey version 2 debugging messages
3 *
4 * Copyright (C) 2001 Richard Guy Briggs <rgb@freeswan.org>
5 * and Michael Richardson <mcr@freeswan.org>
6 *
7 * This program is free software; you can redistribute it and/or modify it
8 * under the terms of the GNU General Public License as published by the
9 * Free Software Foundation; either version 2 of the License, or (at your
10 * option) any later version. See <http://www.fsf.org/copyleft/gpl.txt>.
11 *
12 * This program is distributed in the hope that it will be useful, but
13 * WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
14 * or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
15 * for more details.
16 */
17
18 # include <sys/types.h>
19 # include <errno.h>
20
21 #include "freeswan.h"
22 #include "pfkeyv2.h"
23 #include "pfkey.h"
24
25 /*
26 * This file provides ASCII translations of PF_KEY magic numbers.
27 *
28 */
29
30 static char *pfkey_sadb_ext_strings[]={
31 "reserved", /* SADB_EXT_RESERVED 0 */
32 "security-association", /* SADB_EXT_SA 1 */
33 "lifetime-current", /* SADB_EXT_LIFETIME_CURRENT 2 */
34 "lifetime-hard", /* SADB_EXT_LIFETIME_HARD 3 */
35 "lifetime-soft", /* SADB_EXT_LIFETIME_SOFT 4 */
36 "source-address", /* SADB_EXT_ADDRESS_SRC 5 */
37 "destination-address", /* SADB_EXT_ADDRESS_DST 6 */
38 "proxy-address", /* SADB_EXT_ADDRESS_PROXY 7 */
39 "authentication-key", /* SADB_EXT_KEY_AUTH 8 */
40 "cipher-key", /* SADB_EXT_KEY_ENCRYPT 9 */
41 "source-identity", /* SADB_EXT_IDENTITY_SRC 10 */
42 "destination-identity", /* SADB_EXT_IDENTITY_DST 11 */
43 "sensitivity-label", /* SADB_EXT_SENSITIVITY 12 */
44 "proposal", /* SADB_EXT_PROPOSAL 13 */
45 "supported-auth", /* SADB_EXT_SUPPORTED_AUTH 14 */
46 "supported-cipher", /* SADB_EXT_SUPPORTED_ENCRYPT 15 */
47 "spi-range", /* SADB_EXT_SPIRANGE 16 */
48 "X-kmpprivate", /* SADB_X_EXT_KMPRIVATE 17 */
49 "X-satype2", /* SADB_X_EXT_SATYPE2 18 */
50 "X-security-association", /* SADB_X_EXT_SA2 19 */
51 "X-destination-address2", /* SADB_X_EXT_ADDRESS_DST2 20 */
52 "X-source-flow-address", /* SADB_X_EXT_ADDRESS_SRC_FLOW 21 */
53 "X-dest-flow-address", /* SADB_X_EXT_ADDRESS_DST_FLOW 22 */
54 "X-source-mask", /* SADB_X_EXT_ADDRESS_SRC_MASK 23 */
55 "X-dest-mask", /* SADB_X_EXT_ADDRESS_DST_MASK 24 */
56 "X-set-debug", /* SADB_X_EXT_DEBUG 25 */
57 "X-NAT-T-type", /* SADB_X_EXT_NAT_T_TYPE 26 */
58 "X-NAT-T-sport", /* SADB_X_EXT_NAT_T_SPORT 27 */
59 "X-NAT-T-dport", /* SADB_X_EXT_NAT_T_DPORT 28 */
60 "X-NAT-T-OA", /* SADB_X_EXT_NAT_T_OA 29 */
61 };
62
63 const char *
64 pfkey_v2_sadb_ext_string(int ext)
65 {
66 if(ext <= SADB_EXT_MAX) {
67 return pfkey_sadb_ext_strings[ext];
68 } else {
69 return "unknown-ext";
70 }
71 }
72
73
74 static char *pfkey_sadb_type_strings[]={
75 "reserved", /* SADB_RESERVED */
76 "getspi", /* SADB_GETSPI */
77 "update", /* SADB_UPDATE */
78 "add", /* SADB_ADD */
79 "delete", /* SADB_DELETE */
80 "get", /* SADB_GET */
81 "acquire", /* SADB_ACQUIRE */
82 "register", /* SADB_REGISTER */
83 "expire", /* SADB_EXPIRE */
84 "flush", /* SADB_FLUSH */
85 "dump", /* SADB_DUMP */
86 "x-promisc", /* SADB_X_PROMISC */
87 "x-pchange", /* SADB_X_PCHANGE */
88 "x-groupsa", /* SADB_X_GRPSA */
89 "x-addflow(eroute)", /* SADB_X_ADDFLOW */
90 "x-delflow(eroute)", /* SADB_X_DELFLOW */
91 "x-debug", /* SADB_X_DEBUG */
92 };
93
94 const char *
95 pfkey_v2_sadb_type_string(int sadb_type)
96 {
97 if(sadb_type <= SADB_MAX) {
98 return pfkey_sadb_type_strings[sadb_type];
99 } else {
100 return "unknown-sadb-type";
101 }
102 }