Annotation of embedaddon/ipsec-tools/src/racoon/strnames.c, revision 1.1.1.1
1.1 misho 1: /* $NetBSD: strnames.c,v 1.9 2008/07/14 05:40:13 tteras Exp $ */
2:
3: /* $KAME: strnames.c,v 1.25 2003/11/13 10:53:26 itojun Exp $ */
4:
5: /*
6: * Copyright (C) 1995, 1996, 1997, and 1998 WIDE Project.
7: * All rights reserved.
8: *
9: * Redistribution and use in source and binary forms, with or without
10: * modification, are permitted provided that the following conditions
11: * are met:
12: * 1. Redistributions of source code must retain the above copyright
13: * notice, this list of conditions and the following disclaimer.
14: * 2. Redistributions in binary form must reproduce the above copyright
15: * notice, this list of conditions and the following disclaimer in the
16: * documentation and/or other materials provided with the distribution.
17: * 3. Neither the name of the project nor the names of its contributors
18: * may be used to endorse or promote products derived from this software
19: * without specific prior written permission.
20: *
21: * THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
22: * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
23: * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
24: * ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
25: * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
26: * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
27: * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
28: * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
29: * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
30: * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
31: * SUCH DAMAGE.
32: */
33:
34: #include "config.h"
35:
36: #include <sys/types.h>
37: #include <sys/param.h>
38: #include <sys/socket.h>
39:
40: #include <netinet/in.h>
41: #include PATH_IPSEC_H
42: #include <netinet/in.h>
43:
44: #include <stdio.h>
45: #include <stdlib.h>
46: #ifdef ENABLE_HYBRID
47: #include <resolv.h>
48: #endif
49:
50: #include "var.h"
51: #include "misc.h"
52: #include "vmbuf.h"
53: #include "plog.h"
54:
55: #include "isakmp_var.h"
56: #include "isakmp.h"
57: #ifdef ENABLE_HYBRID
58: # include "isakmp_xauth.h"
59: # include "isakmp_unity.h"
60: # include "isakmp_cfg.h"
61: #endif
62: #include "ipsec_doi.h"
63: #include "oakley.h"
64: #include "handler.h"
65: #include "pfkey.h"
66: #include "strnames.h"
67: #include "algorithm.h"
68:
69: struct ksmap {
70: int key;
71: char *str;
72: char *(*f) __P((int));
73: };
74:
75: char *
76: num2str(n)
77: int n;
78: {
79: static char buf[20];
80:
81: snprintf(buf, sizeof(buf), "%d", n);
82:
83: return buf;
84: }
85:
86: /* isakmp.h */
87: char *
88: s_isakmp_state(t, d, s)
89: int t, d, s;
90: {
91: switch (t) {
92: case ISAKMP_ETYPE_AGG:
93: switch (d) {
94: case INITIATOR:
95: switch (s) {
96: case PHASE1ST_MSG1SENT:
97: return "agg I msg1";
98: case PHASE1ST_ESTABLISHED:
99: return "agg I msg2";
100: default:
101: break;
102: }
103: case RESPONDER:
104: switch (s) {
105: case PHASE1ST_MSG1SENT:
106: return "agg R msg1";
107: default:
108: break;
109: }
110: }
111: break;
112: case ISAKMP_ETYPE_BASE:
113: switch (d) {
114: case INITIATOR:
115: switch (s) {
116: case PHASE1ST_MSG1SENT:
117: return "base I msg1";
118: case PHASE1ST_MSG2SENT:
119: return "base I msg2";
120: default:
121: break;
122: }
123: case RESPONDER:
124: switch (s) {
125: case PHASE1ST_MSG1SENT:
126: return "base R msg1";
127: case PHASE1ST_ESTABLISHED:
128: return "base R msg2";
129: default:
130: break;
131: }
132: }
133: break;
134: case ISAKMP_ETYPE_IDENT:
135: switch (d) {
136: case INITIATOR:
137: switch (s) {
138: case PHASE1ST_MSG1SENT:
139: return "ident I msg1";
140: case PHASE1ST_MSG2SENT:
141: return "ident I msg2";
142: case PHASE1ST_MSG3SENT:
143: return "ident I msg3";
144: default:
145: break;
146: }
147: case RESPONDER:
148: switch (s) {
149: case PHASE1ST_MSG1SENT:
150: return "ident R msg1";
151: case PHASE1ST_MSG2SENT:
152: return "ident R msg2";
153: case PHASE1ST_ESTABLISHED:
154: return "ident R msg3";
155: default:
156: break;
157: }
158: }
159: break;
160: case ISAKMP_ETYPE_QUICK:
161: switch (d) {
162: case INITIATOR:
163: switch (s) {
164: case PHASE2ST_MSG1SENT:
165: return "quick I msg1";
166: case PHASE2ST_ADDSA:
167: return "quick I msg2";
168: default:
169: break;
170: }
171: case RESPONDER:
172: switch (s) {
173: case PHASE2ST_MSG1SENT:
174: return "quick R msg1";
175: case PHASE2ST_COMMIT:
176: return "quick R msg2";
177: default:
178: break;
179: }
180: }
181: break;
182: default:
183: case ISAKMP_ETYPE_NONE:
184: case ISAKMP_ETYPE_AUTH:
185: case ISAKMP_ETYPE_INFO:
186: case ISAKMP_ETYPE_NEWGRP:
187: case ISAKMP_ETYPE_ACKINFO:
188: break;
189: }
190: /*NOTREACHED*/
191:
192: return "???";
193: }
194:
195: static struct ksmap name_isakmp_certtype[] = {
196: { ISAKMP_CERT_NONE, "NONE", NULL },
197: { ISAKMP_CERT_PKCS7, "PKCS #7 wrapped X.509 certificate", NULL },
198: { ISAKMP_CERT_PGP, "PGP Certificate", NULL },
199: { ISAKMP_CERT_DNS, "DNS Signed Key", NULL },
200: { ISAKMP_CERT_X509SIGN, "X.509 Certificate Signature", NULL },
201: { ISAKMP_CERT_X509KE, "X.509 Certificate Key Exchange", NULL },
202: { ISAKMP_CERT_KERBEROS, "Kerberos Tokens", NULL },
203: { ISAKMP_CERT_CRL, "Certificate Revocation List (CRL)", NULL },
204: { ISAKMP_CERT_ARL, "Authority Revocation List (ARL)", NULL },
205: { ISAKMP_CERT_SPKI, "SPKI Certificate", NULL },
206: { ISAKMP_CERT_X509ATTR, "X.509 Certificate Attribute", NULL },
207: };
208:
209: char *
210: s_isakmp_certtype(k)
211: int k;
212: {
213: int i;
214: for (i = 0; i < ARRAYLEN(name_isakmp_certtype); i++)
215: if (name_isakmp_certtype[i].key == k)
216: return name_isakmp_certtype[i].str;
217: return num2str(k);
218: }
219:
220: static struct ksmap name_isakmp_etype[] = {
221: { ISAKMP_ETYPE_NONE, "None", NULL },
222: { ISAKMP_ETYPE_BASE, "Base", NULL },
223: { ISAKMP_ETYPE_IDENT, "Identity Protection", NULL },
224: { ISAKMP_ETYPE_AUTH, "Authentication Only", NULL },
225: { ISAKMP_ETYPE_AGG, "Aggressive", NULL },
226: { ISAKMP_ETYPE_INFO, "Informational", NULL },
227: { ISAKMP_ETYPE_CFG, "Mode config", NULL },
228: { ISAKMP_ETYPE_QUICK, "Quick", NULL },
229: { ISAKMP_ETYPE_NEWGRP, "New Group", NULL },
230: { ISAKMP_ETYPE_ACKINFO, "Acknowledged Informational", NULL },
231: };
232:
233: char *
234: s_isakmp_etype(k)
235: int k;
236: {
237: int i;
238: for (i = 0; i < ARRAYLEN(name_isakmp_etype); i++)
239: if (name_isakmp_etype[i].key == k)
240: return name_isakmp_etype[i].str;
241: return num2str(k);
242: }
243:
244: static struct ksmap name_isakmp_notify_msg[] = {
245: { ISAKMP_NTYPE_INVALID_PAYLOAD_TYPE, "INVALID-PAYLOAD-TYPE", NULL },
246: { ISAKMP_NTYPE_DOI_NOT_SUPPORTED, "DOI-NOT-SUPPORTED", NULL },
247: { ISAKMP_NTYPE_SITUATION_NOT_SUPPORTED, "SITUATION-NOT-SUPPORTED", NULL },
248: { ISAKMP_NTYPE_INVALID_COOKIE, "INVALID-COOKIE", NULL },
249: { ISAKMP_NTYPE_INVALID_MAJOR_VERSION, "INVALID-MAJOR-VERSION", NULL },
250: { ISAKMP_NTYPE_INVALID_MINOR_VERSION, "INVALID-MINOR-VERSION", NULL },
251: { ISAKMP_NTYPE_INVALID_EXCHANGE_TYPE, "INVALID-EXCHANGE-TYPE", NULL },
252: { ISAKMP_NTYPE_INVALID_FLAGS, "INVALID-FLAGS", NULL },
253: { ISAKMP_NTYPE_INVALID_MESSAGE_ID, "INVALID-MESSAGE-ID", NULL },
254: { ISAKMP_NTYPE_INVALID_PROTOCOL_ID, "INVALID-PROTOCOL-ID", NULL },
255: { ISAKMP_NTYPE_INVALID_SPI, "INVALID-SPI", NULL },
256: { ISAKMP_NTYPE_INVALID_TRANSFORM_ID, "INVALID-TRANSFORM-ID", NULL },
257: { ISAKMP_NTYPE_ATTRIBUTES_NOT_SUPPORTED, "ATTRIBUTES-NOT-SUPPORTED", NULL },
258: { ISAKMP_NTYPE_NO_PROPOSAL_CHOSEN, "NO-PROPOSAL-CHOSEN", NULL },
259: { ISAKMP_NTYPE_BAD_PROPOSAL_SYNTAX, "BAD-PROPOSAL-SYNTAX", NULL },
260: { ISAKMP_NTYPE_PAYLOAD_MALFORMED, "PAYLOAD-MALFORMED", NULL },
261: { ISAKMP_NTYPE_INVALID_KEY_INFORMATION, "INVALID-KEY-INFORMATION", NULL },
262: { ISAKMP_NTYPE_INVALID_ID_INFORMATION, "INVALID-ID-INFORMATION", NULL },
263: { ISAKMP_NTYPE_INVALID_CERT_ENCODING, "INVALID-CERT-ENCODING", NULL },
264: { ISAKMP_NTYPE_INVALID_CERTIFICATE, "INVALID-CERTIFICATE", NULL },
265: { ISAKMP_NTYPE_BAD_CERT_REQUEST_SYNTAX, "BAD-CERT-REQUEST-SYNTAX", NULL },
266: { ISAKMP_NTYPE_INVALID_CERT_AUTHORITY, "INVALID-CERT-AUTHORITY", NULL },
267: { ISAKMP_NTYPE_INVALID_HASH_INFORMATION, "INVALID-HASH-INFORMATION", NULL },
268: { ISAKMP_NTYPE_AUTHENTICATION_FAILED, "AUTHENTICATION-FAILED", NULL },
269: { ISAKMP_NTYPE_INVALID_SIGNATURE, "INVALID-SIGNATURE", NULL },
270: { ISAKMP_NTYPE_ADDRESS_NOTIFICATION, "ADDRESS-NOTIFICATION", NULL },
271: { ISAKMP_NTYPE_NOTIFY_SA_LIFETIME, "NOTIFY-SA-LIFETIME", NULL },
272: { ISAKMP_NTYPE_CERTIFICATE_UNAVAILABLE, "CERTIFICATE-UNAVAILABLE", NULL },
273: { ISAKMP_NTYPE_UNSUPPORTED_EXCHANGE_TYPE, "UNSUPPORTED-EXCHANGE-TYPE", NULL },
274: { ISAKMP_NTYPE_UNEQUAL_PAYLOAD_LENGTHS, "UNEQUAL-PAYLOAD-LENGTHS", NULL },
275: { ISAKMP_NTYPE_CONNECTED, "CONNECTED", NULL },
276: { ISAKMP_NTYPE_RESPONDER_LIFETIME, "RESPONDER-LIFETIME", NULL },
277: { ISAKMP_NTYPE_REPLAY_STATUS, "REPLAY-STATUS", NULL },
278: { ISAKMP_NTYPE_INITIAL_CONTACT, "INITIAL-CONTACT", NULL },
279: { ISAKMP_NTYPE_R_U_THERE, "R-U-THERE", NULL },
280: { ISAKMP_NTYPE_R_U_THERE_ACK, "R-U-THERE-ACK", NULL },
281: #ifdef ENABLE_HYBRID
282: { ISAKMP_NTYPE_UNITY_HEARTBEAT, "HEARTBEAT (Unity)", NULL },
283: #endif
284: { ISAKMP_LOG_RETRY_LIMIT_REACHED, "RETRY-LIMIT-REACHED", NULL },
285: };
286:
287: char *
288: s_isakmp_notify_msg(k)
289: int k;
290: {
291: int i;
292: for (i = 0; i < ARRAYLEN(name_isakmp_notify_msg); i++)
293: if (name_isakmp_notify_msg[i].key == k)
294: return name_isakmp_notify_msg[i].str;
295:
296: return num2str(k);
297: }
298:
299: static struct ksmap name_isakmp_nptype[] = {
300: { ISAKMP_NPTYPE_NONE, "none", NULL },
301: { ISAKMP_NPTYPE_SA, "sa", NULL },
302: { ISAKMP_NPTYPE_P, "prop", NULL },
303: { ISAKMP_NPTYPE_T, "trns", NULL },
304: { ISAKMP_NPTYPE_KE, "ke", NULL },
305: { ISAKMP_NPTYPE_ID, "id", NULL },
306: { ISAKMP_NPTYPE_CERT, "cert", NULL },
307: { ISAKMP_NPTYPE_CR, "cr", NULL },
308: { ISAKMP_NPTYPE_HASH, "hash", NULL },
309: { ISAKMP_NPTYPE_SIG, "sig", NULL },
310: { ISAKMP_NPTYPE_NONCE, "nonce", NULL },
311: { ISAKMP_NPTYPE_N, "notify", NULL },
312: { ISAKMP_NPTYPE_D, "delete", NULL },
313: { ISAKMP_NPTYPE_VID, "vid", NULL },
314: { ISAKMP_NPTYPE_ATTR, "attr", NULL },
315: { ISAKMP_NPTYPE_GSS, "gss id", NULL },
316: { ISAKMP_NPTYPE_NATD_RFC, "nat-d", NULL },
317: { ISAKMP_NPTYPE_NATOA_RFC, "nat-oa", NULL },
318: { ISAKMP_NPTYPE_NATD_DRAFT, "nat-d", NULL },
319: { ISAKMP_NPTYPE_NATOA_DRAFT, "nat-oa", NULL },
320: { ISAKMP_NPTYPE_FRAG, "ike frag", NULL },
321: };
322:
323: char *
324: s_isakmp_nptype(k)
325: int k;
326: {
327: int i;
328: for (i = 0; i < ARRAYLEN(name_isakmp_nptype); i++)
329: if (name_isakmp_nptype[i].key == k)
330: return name_isakmp_nptype[i].str;
331: return num2str(k);
332: }
333:
334: #ifdef ENABLE_HYBRID
335: /* isakmp_cfg.h / isakmp_unity.h / isakmp_xauth.h */
336: static struct ksmap name_isakmp_cfg_type[] = {
337: { INTERNAL_IP4_ADDRESS, "INTERNAL_IP4_ADDRESS", NULL },
338: { INTERNAL_IP4_NETMASK, "INTERNAL_IP4_NETMASK", NULL },
339: { INTERNAL_IP4_DNS, "INTERNAL_IP4_DNS", NULL },
340: { INTERNAL_IP4_NBNS, "INTERNAL_IP4_NBNS", NULL },
341: { INTERNAL_ADDRESS_EXPIRY, "INTERNAL_ADDRESS_EXPIRY", NULL },
342: { INTERNAL_IP4_DHCP, "INTERNAL_IP4_DHCP", NULL },
343: { APPLICATION_VERSION, "APPLICATION_VERSION", NULL },
344: { INTERNAL_IP6_ADDRESS, "INTERNAL_IP6_ADDRESS", NULL },
345: { INTERNAL_IP6_NETMASK, "INTERNAL_IP6_NETMASK", NULL },
346: { INTERNAL_IP6_DNS, "INTERNAL_IP6_DNS", NULL },
347: { INTERNAL_IP6_NBNS, "INTERNAL_IP6_NBNS", NULL },
348: { INTERNAL_IP6_DHCP, "INTERNAL_IP6_DHCP", NULL },
349: { INTERNAL_IP4_SUBNET, "INTERNAL_IP4_SUBNET", NULL },
350: { SUPPORTED_ATTRIBUTES, "SUPPORTED_ATTRIBUTES", NULL },
351: { INTERNAL_IP6_SUBNET, "INTERNAL_IP6_SUBNET", NULL },
352: { XAUTH_TYPE, "XAUTH_TYPE", NULL },
353: { XAUTH_USER_NAME, "XAUTH_USER_NAME", NULL },
354: { XAUTH_USER_PASSWORD, "XAUTH_USER_PASSWORD", NULL },
355: { XAUTH_PASSCODE, "XAUTH_PASSCODE", NULL },
356: { XAUTH_MESSAGE, "XAUTH_MESSAGE", NULL },
357: { XAUTH_CHALLENGE, "XAUTH_CHALLENGE", NULL },
358: { XAUTH_DOMAIN, "XAUTH_DOMAIN", NULL },
359: { XAUTH_STATUS, "XAUTH_STATUS", NULL },
360: { XAUTH_NEXT_PIN, "XAUTH_NEXT_PIN", NULL },
361: { XAUTH_ANSWER, "XAUTH_ANSWER", NULL },
362: { UNITY_BANNER, "UNITY_BANNER", NULL },
363: { UNITY_SAVE_PASSWD, "UNITY_SAVE_PASSWD", NULL },
364: { UNITY_DEF_DOMAIN, "UNITY_DEF_DOMAIN", NULL },
365: { UNITY_SPLITDNS_NAME, "UNITY_SPLITDNS_NAME", NULL },
366: { UNITY_SPLIT_INCLUDE, "UNITY_SPLIT_INCLUDE", NULL },
367: { UNITY_NATT_PORT, "UNITY_NATT_PORT", NULL },
368: { UNITY_LOCAL_LAN, "UNITY_LOCAL_LAN", NULL },
369: { UNITY_PFS, "UNITY_PFS", NULL },
370: { UNITY_FW_TYPE, "UNITY_FW_TYPE", NULL },
371: { UNITY_BACKUP_SERVERS, "UNITY_BACKUP_SERVERS", NULL },
372: { UNITY_DDNS_HOSTNAME, "UNITY_DDNS_HOSTNAME", NULL },
373: };
374:
375: char *
376: s_isakmp_cfg_type(k)
377: int k;
378: {
379: int i;
380: for (i = 0; i < ARRAYLEN(name_isakmp_cfg_type); i++)
381: if (name_isakmp_cfg_type[i].key == k)
382: return name_isakmp_cfg_type[i].str;
383: return num2str(k);
384: }
385:
386: /* isakmp_cfg.h / isakmp_unity.h / isakmp_xauth.h */
387: static struct ksmap name_isakmp_cfg_ptype[] = {
388: { ISAKMP_CFG_ACK, "mode config ACK", NULL },
389: { ISAKMP_CFG_SET, "mode config SET", NULL },
390: { ISAKMP_CFG_REQUEST, "mode config REQUEST", NULL },
391: { ISAKMP_CFG_REPLY, "mode config REPLY", NULL },
392: };
393:
394: char *
395: s_isakmp_cfg_ptype(k)
396: int k;
397: {
398: int i;
399: for (i = 0; i < ARRAYLEN(name_isakmp_cfg_ptype); i++)
400: if (name_isakmp_cfg_ptype[i].key == k)
401: return name_isakmp_cfg_ptype[i].str;
402: return num2str(k);
403: }
404:
405: #endif
406:
407: /* ipsec_doi.h */
408: static struct ksmap name_ipsecdoi_proto[] = {
409: { IPSECDOI_PROTO_ISAKMP, "ISAKMP", s_ipsecdoi_trns_isakmp },
410: { IPSECDOI_PROTO_IPSEC_AH, "AH", s_ipsecdoi_trns_ah },
411: { IPSECDOI_PROTO_IPSEC_ESP, "ESP", s_ipsecdoi_trns_esp },
412: { IPSECDOI_PROTO_IPCOMP, "IPCOMP", s_ipsecdoi_trns_ipcomp },
413: };
414:
415: char *
416: s_ipsecdoi_proto(k)
417: int k;
418: {
419: int i;
420: for (i = 0; i < ARRAYLEN(name_ipsecdoi_proto); i++)
421: if (name_ipsecdoi_proto[i].key == k)
422: return name_ipsecdoi_proto[i].str;
423: return num2str(k);
424: }
425:
426: static struct ksmap name_ipsecdoi_trns_isakmp[] = {
427: { IPSECDOI_KEY_IKE, "IKE", NULL },
428: };
429:
430: char *
431: s_ipsecdoi_trns_isakmp(k)
432: int k;
433: {
434: int i;
435: for (i = 0; i < ARRAYLEN(name_ipsecdoi_trns_isakmp); i++)
436: if (name_ipsecdoi_trns_isakmp[i].key == k)
437: return name_ipsecdoi_trns_isakmp[i].str;
438: return num2str(k);
439: }
440:
441: static struct ksmap name_ipsecdoi_trns_ah[] = {
442: { IPSECDOI_AH_MD5, "MD5", NULL },
443: { IPSECDOI_AH_SHA, "SHA", NULL },
444: { IPSECDOI_AH_DES, "DES", NULL },
445: { IPSECDOI_AH_SHA256, "SHA256", NULL },
446: { IPSECDOI_AH_SHA384, "SHA384", NULL },
447: { IPSECDOI_AH_SHA512, "SHA512", NULL },
448: };
449:
450: char *
451: s_ipsecdoi_trns_ah(k)
452: int k;
453: {
454: int i;
455: for (i = 0; i < ARRAYLEN(name_ipsecdoi_trns_ah); i++)
456: if (name_ipsecdoi_trns_ah[i].key == k)
457: return name_ipsecdoi_trns_ah[i].str;
458: return num2str(k);
459: }
460:
461: static struct ksmap name_ipsecdoi_trns_esp[] = {
462: { IPSECDOI_ESP_DES_IV64, "DES_IV64", NULL },
463: { IPSECDOI_ESP_DES, "DES", NULL },
464: { IPSECDOI_ESP_3DES, "3DES", NULL },
465: { IPSECDOI_ESP_RC5, "RC5", NULL },
466: { IPSECDOI_ESP_IDEA, "IDEA", NULL },
467: { IPSECDOI_ESP_CAST, "CAST", NULL },
468: { IPSECDOI_ESP_BLOWFISH, "BLOWFISH", NULL },
469: { IPSECDOI_ESP_3IDEA, "3IDEA", NULL },
470: { IPSECDOI_ESP_DES_IV32, "DES_IV32", NULL },
471: { IPSECDOI_ESP_RC4, "RC4", NULL },
472: { IPSECDOI_ESP_NULL, "NULL", NULL },
473: { IPSECDOI_ESP_AES, "AES", NULL },
474: { IPSECDOI_ESP_TWOFISH, "TWOFISH", NULL },
475: { IPSECDOI_ESP_CAMELLIA, "CAMELLIA", NULL },
476: };
477:
478: char *
479: s_ipsecdoi_trns_esp(k)
480: int k;
481: {
482: int i;
483: for (i = 0; i < ARRAYLEN(name_ipsecdoi_trns_esp); i++)
484: if (name_ipsecdoi_trns_esp[i].key == k)
485: return name_ipsecdoi_trns_esp[i].str;
486: return num2str(k);
487: }
488:
489: static struct ksmap name_ipsecdoi_trns_ipcomp[] = {
490: { IPSECDOI_IPCOMP_OUI, "OUI", NULL},
491: { IPSECDOI_IPCOMP_DEFLATE, "DEFLATE", NULL},
492: { IPSECDOI_IPCOMP_LZS, "LZS", NULL},
493: };
494:
495: char *
496: s_ipsecdoi_trns_ipcomp(k)
497: int k;
498: {
499: int i;
500: for (i = 0; i < ARRAYLEN(name_ipsecdoi_trns_ipcomp); i++)
501: if (name_ipsecdoi_trns_ipcomp[i].key == k)
502: return name_ipsecdoi_trns_ipcomp[i].str;
503: return num2str(k);
504: }
505:
506: char *
507: s_ipsecdoi_trns(proto, trns)
508: int proto, trns;
509: {
510: int i;
511: for (i = 0; i < ARRAYLEN(name_ipsecdoi_proto); i++)
512: if (name_ipsecdoi_proto[i].key == proto
513: && name_ipsecdoi_proto[i].f)
514: return (name_ipsecdoi_proto[i].f)(trns);
515: return num2str(trns);
516: }
517:
518: static struct ksmap name_attr_ipsec[] = {
519: { IPSECDOI_ATTR_SA_LD_TYPE, "SA Life Type", s_ipsecdoi_ltype },
520: { IPSECDOI_ATTR_SA_LD, "SA Life Duration", NULL },
521: { IPSECDOI_ATTR_GRP_DESC, "Group Description", NULL },
522: { IPSECDOI_ATTR_ENC_MODE, "Encryption Mode", s_ipsecdoi_encmode },
523: { IPSECDOI_ATTR_AUTH, "Authentication Algorithm", s_ipsecdoi_auth },
524: { IPSECDOI_ATTR_KEY_LENGTH, "Key Length", NULL },
525: { IPSECDOI_ATTR_KEY_ROUNDS, "Key Rounds", NULL },
526: { IPSECDOI_ATTR_COMP_DICT_SIZE, "Compression Dictionary Size", NULL },
527: { IPSECDOI_ATTR_COMP_PRIVALG, "Compression Private Algorithm", NULL },
528: };
529:
530: char *
531: s_ipsecdoi_attr(k)
532: int k;
533: {
534: int i;
535: for (i = 0; i < ARRAYLEN(name_attr_ipsec); i++)
536: if (name_attr_ipsec[i].key == k)
537: return name_attr_ipsec[i].str;
538: return num2str(k);
539: }
540:
541: static struct ksmap name_attr_ipsec_ltype[] = {
542: { IPSECDOI_ATTR_SA_LD_TYPE_SEC, "seconds", NULL },
543: { IPSECDOI_ATTR_SA_LD_TYPE_KB, "kilobytes", NULL },
544: };
545:
546: char *
547: s_ipsecdoi_ltype(k)
548: int k;
549: {
550: int i;
551: for (i = 0; i < ARRAYLEN(name_attr_ipsec_ltype); i++)
552: if (name_attr_ipsec_ltype[i].key == k)
553: return name_attr_ipsec_ltype[i].str;
554: return num2str(k);
555: }
556:
557: static struct ksmap name_attr_ipsec_encmode[] = {
558: { IPSECDOI_ATTR_ENC_MODE_ANY, "Any", NULL },
559: { IPSECDOI_ATTR_ENC_MODE_TUNNEL, "Tunnel", NULL },
560: { IPSECDOI_ATTR_ENC_MODE_TRNS, "Transport", NULL },
561: { IPSECDOI_ATTR_ENC_MODE_UDPTUNNEL_RFC, "UDP-Tunnel", NULL },
562: { IPSECDOI_ATTR_ENC_MODE_UDPTRNS_RFC, "UDP-Transport", NULL },
563: { IPSECDOI_ATTR_ENC_MODE_UDPTUNNEL_DRAFT, "UDP-Tunnel", NULL },
564: { IPSECDOI_ATTR_ENC_MODE_UDPTRNS_DRAFT, "UDP-Transport", NULL },
565: };
566:
567: char *
568: s_ipsecdoi_encmode(k)
569: int k;
570: {
571: int i;
572: for (i = 0; i < ARRAYLEN(name_attr_ipsec_encmode); i++)
573: if (name_attr_ipsec_encmode[i].key == k)
574: return name_attr_ipsec_encmode[i].str;
575: return num2str(k);
576: }
577:
578: static struct ksmap name_attr_ipsec_auth[] = {
579: { IPSECDOI_ATTR_AUTH_HMAC_MD5, "hmac-md5", NULL },
580: { IPSECDOI_ATTR_AUTH_HMAC_SHA1, "hmac-sha", NULL },
581: { IPSECDOI_ATTR_AUTH_HMAC_SHA2_256, "hmac-sha256", NULL },
582: { IPSECDOI_ATTR_AUTH_HMAC_SHA2_384, "hmac-sha384", NULL },
583: { IPSECDOI_ATTR_AUTH_HMAC_SHA2_512, "hmac-sha512", NULL },
584: { IPSECDOI_ATTR_AUTH_DES_MAC, "des-mac", NULL },
585: { IPSECDOI_ATTR_AUTH_KPDK, "kpdk", NULL },
586: };
587:
588: char *
589: s_ipsecdoi_auth(k)
590: int k;
591: {
592: int i;
593: for (i = 0; i < ARRAYLEN(name_attr_ipsec_auth); i++)
594: if (name_attr_ipsec_auth[i].key == k)
595: return name_attr_ipsec_auth[i].str;
596: return num2str(k);
597: }
598:
599: char *
600: s_ipsecdoi_attr_v(type, val)
601: int type, val;
602: {
603: int i;
604: for (i = 0; i < ARRAYLEN(name_attr_ipsec); i++)
605: if (name_attr_ipsec[i].key == type
606: && name_attr_ipsec[i].f)
607: return (name_attr_ipsec[i].f)(val);
608: return num2str(val);
609: }
610:
611: static struct ksmap name_ipsecdoi_ident[] = {
612: { IPSECDOI_ID_IPV4_ADDR, "IPv4_address", NULL },
613: { IPSECDOI_ID_FQDN, "FQDN", NULL },
614: { IPSECDOI_ID_USER_FQDN, "User_FQDN", NULL },
615: { IPSECDOI_ID_IPV4_ADDR_SUBNET, "IPv4_subnet", NULL },
616: { IPSECDOI_ID_IPV6_ADDR, "IPv6_address", NULL },
617: { IPSECDOI_ID_IPV6_ADDR_SUBNET, "IPv6_subnet", NULL },
618: { IPSECDOI_ID_IPV4_ADDR_RANGE, "IPv4_address_range", NULL },
619: { IPSECDOI_ID_IPV6_ADDR_RANGE, "IPv6_address_range", NULL },
620: { IPSECDOI_ID_DER_ASN1_DN, "DER_ASN1_DN", NULL },
621: { IPSECDOI_ID_DER_ASN1_GN, "DER_ASN1_GN", NULL },
622: { IPSECDOI_ID_KEY_ID, "KEY_ID", NULL },
623: };
624:
625: char *
626: s_ipsecdoi_ident(k)
627: int k;
628: {
629: int i;
630: for (i = 0; i < ARRAYLEN(name_ipsecdoi_ident); i++)
631: if (name_ipsecdoi_ident[i].key == k)
632: return name_ipsecdoi_ident[i].str;
633: return num2str(k);
634: }
635:
636: /* oakley.h */
637: static struct ksmap name_oakley_attr[] = {
638: { OAKLEY_ATTR_ENC_ALG, "Encryption Algorithm", s_attr_isakmp_enc },
639: { OAKLEY_ATTR_HASH_ALG, "Hash Algorithm", s_attr_isakmp_hash },
640: { OAKLEY_ATTR_AUTH_METHOD, "Authentication Method", s_oakley_attr_method },
641: { OAKLEY_ATTR_GRP_DESC, "Group Description", s_attr_isakmp_desc },
642: { OAKLEY_ATTR_GRP_TYPE, "Group Type", s_attr_isakmp_group },
643: { OAKLEY_ATTR_GRP_PI, "Group Prime/Irreducible Polynomial", NULL },
644: { OAKLEY_ATTR_GRP_GEN_ONE, "Group Generator One", NULL },
645: { OAKLEY_ATTR_GRP_GEN_TWO, "Group Generator Two", NULL },
646: { OAKLEY_ATTR_GRP_CURVE_A, "Group Curve A", NULL },
647: { OAKLEY_ATTR_GRP_CURVE_B, "Group Curve B", NULL },
648: { OAKLEY_ATTR_SA_LD_TYPE, "Life Type", s_attr_isakmp_ltype },
649: { OAKLEY_ATTR_SA_LD, "Life Duration", NULL },
650: { OAKLEY_ATTR_PRF, "PRF", NULL },
651: { OAKLEY_ATTR_KEY_LEN, "Key Length", NULL },
652: { OAKLEY_ATTR_FIELD_SIZE, "Field Size", NULL },
653: { OAKLEY_ATTR_GRP_ORDER, "Group Order", NULL },
654: { OAKLEY_ATTR_BLOCK_SIZE, "Block Size", NULL },
655: { OAKLEY_ATTR_GSS_ID, "GSS-API endpoint name",NULL },
656: };
657:
658: char *
659: s_oakley_attr(k)
660: int k;
661: {
662: int i;
663: for (i = 0; i < ARRAYLEN(name_oakley_attr); i++)
664: if (name_oakley_attr[i].key == k)
665: return name_oakley_attr[i].str;
666: return num2str(k);
667: }
668:
669: static struct ksmap name_attr_isakmp_enc[] = {
670: { OAKLEY_ATTR_ENC_ALG_DES, "DES-CBC", NULL },
671: { OAKLEY_ATTR_ENC_ALG_IDEA, "IDEA-CBC", NULL },
672: { OAKLEY_ATTR_ENC_ALG_BLOWFISH, "Blowfish-CBC", NULL },
673: { OAKLEY_ATTR_ENC_ALG_RC5, "RC5-R16-B64-CBC", NULL },
674: { OAKLEY_ATTR_ENC_ALG_3DES, "3DES-CBC", NULL },
675: { OAKLEY_ATTR_ENC_ALG_CAST, "CAST-CBC", NULL },
676: { OAKLEY_ATTR_ENC_ALG_AES, "AES-CBC", NULL },
677: };
678:
679: char *
680: s_attr_isakmp_enc(k)
681: int k;
682: {
683: int i;
684: for (i = 0; i < ARRAYLEN(name_attr_isakmp_enc); i++)
685: if (name_attr_isakmp_enc[i].key == k)
686: return name_attr_isakmp_enc[i].str;
687: return num2str(k);
688: }
689:
690: static struct ksmap name_attr_isakmp_hash[] = {
691: { OAKLEY_ATTR_HASH_ALG_MD5, "MD5", NULL },
692: { OAKLEY_ATTR_HASH_ALG_SHA, "SHA", NULL },
693: { OAKLEY_ATTR_HASH_ALG_TIGER, "Tiger", NULL },
694: { OAKLEY_ATTR_HASH_ALG_SHA2_256,"SHA256", NULL },
695: { OAKLEY_ATTR_HASH_ALG_SHA2_384,"SHA384", NULL },
696: { OAKLEY_ATTR_HASH_ALG_SHA2_512,"SHA512", NULL },
697: };
698:
699: char *
700: s_attr_isakmp_hash(k)
701: int k;
702: {
703: int i;
704: for (i = 0; i < ARRAYLEN(name_attr_isakmp_hash); i++)
705: if (name_attr_isakmp_hash[i].key == k)
706: return name_attr_isakmp_hash[i].str;
707: return num2str(k);
708: }
709:
710: static struct ksmap name_attr_isakmp_method[] = {
711: { OAKLEY_ATTR_AUTH_METHOD_PSKEY, "pre-shared key", NULL },
712: { OAKLEY_ATTR_AUTH_METHOD_DSSSIG, "DSS signatures", NULL },
713: { OAKLEY_ATTR_AUTH_METHOD_RSASIG, "RSA signatures", NULL },
714: { OAKLEY_ATTR_AUTH_METHOD_RSAENC, "Encryption with RSA", NULL },
715: { OAKLEY_ATTR_AUTH_METHOD_RSAREV, "Revised encryption with RSA", NULL },
716: { OAKLEY_ATTR_AUTH_METHOD_EGENC, "Encryption with El-Gamal", NULL },
717: { OAKLEY_ATTR_AUTH_METHOD_EGREV, "Revised encryption with El-Gamal", NULL },
718: #ifdef HAVE_GSSAPI
719: { OAKLEY_ATTR_AUTH_METHOD_GSSAPI_KRB, "GSS-API on Kerberos 5", NULL },
720: #endif
721: #ifdef ENABLE_HYBRID
722: { OAKLEY_ATTR_AUTH_METHOD_HYBRID_DSS_R, "Hybrid DSS server", NULL },
723: { OAKLEY_ATTR_AUTH_METHOD_HYBRID_RSA_R, "Hybrid RSA server", NULL },
724: { OAKLEY_ATTR_AUTH_METHOD_HYBRID_DSS_I, "Hybrid DSS client", NULL },
725: { OAKLEY_ATTR_AUTH_METHOD_HYBRID_RSA_I, "Hybrid RSA client", NULL },
726: { OAKLEY_ATTR_AUTH_METHOD_XAUTH_PSKEY_I, "XAuth pskey client", NULL },
727: { OAKLEY_ATTR_AUTH_METHOD_XAUTH_PSKEY_R, "XAuth pskey server", NULL },
728: { OAKLEY_ATTR_AUTH_METHOD_XAUTH_RSASIG_I, "XAuth RSASIG client", NULL },
729: { OAKLEY_ATTR_AUTH_METHOD_XAUTH_RSASIG_R, "XAuth RSASIG server", NULL },
730: #endif
731: };
732:
733: char *
734: s_oakley_attr_method(k)
735: int k;
736: {
737: int i;
738: for (i = 0; i < ARRAYLEN(name_attr_isakmp_method); i++)
739: if (name_attr_isakmp_method[i].key == k)
740: return name_attr_isakmp_method[i].str;
741: return num2str(k);
742: }
743:
744: static struct ksmap name_attr_isakmp_desc[] = {
745: { OAKLEY_ATTR_GRP_DESC_MODP768, "768-bit MODP group", NULL },
746: { OAKLEY_ATTR_GRP_DESC_MODP1024, "1024-bit MODP group", NULL },
747: { OAKLEY_ATTR_GRP_DESC_EC2N155, "EC2N group on GP[2^155]", NULL },
748: { OAKLEY_ATTR_GRP_DESC_EC2N185, "EC2N group on GP[2^185]", NULL },
749: { OAKLEY_ATTR_GRP_DESC_MODP1536, "1536-bit MODP group", NULL },
750: { OAKLEY_ATTR_GRP_DESC_MODP2048, "2048-bit MODP group", NULL },
751: { OAKLEY_ATTR_GRP_DESC_MODP3072, "3072-bit MODP group", NULL },
752: { OAKLEY_ATTR_GRP_DESC_MODP4096, "4096-bit MODP group", NULL },
753: { OAKLEY_ATTR_GRP_DESC_MODP6144, "6144-bit MODP group", NULL },
754: { OAKLEY_ATTR_GRP_DESC_MODP8192, "8192-bit MODP group", NULL },
755: };
756:
757: char *
758: s_attr_isakmp_desc(k)
759: int k;
760: {
761: int i;
762: for (i = 0; i < ARRAYLEN(name_attr_isakmp_desc); i++)
763: if (name_attr_isakmp_desc[i].key == k)
764: return name_attr_isakmp_desc[i].str;
765: return num2str(k);
766: }
767:
768: static struct ksmap name_attr_isakmp_group[] = {
769: { OAKLEY_ATTR_GRP_TYPE_MODP, "MODP", NULL },
770: { OAKLEY_ATTR_GRP_TYPE_ECP, "ECP", NULL },
771: { OAKLEY_ATTR_GRP_TYPE_EC2N, "EC2N", NULL },
772: };
773:
774: char *
775: s_attr_isakmp_group(k)
776: int k;
777: {
778: int i;
779: for (i = 0; i < ARRAYLEN(name_attr_isakmp_group); i++)
780: if (name_attr_isakmp_group[i].key == k)
781: return name_attr_isakmp_group[i].str;
782: return num2str(k);
783: }
784:
785: static struct ksmap name_attr_isakmp_ltype[] = {
786: { OAKLEY_ATTR_SA_LD_TYPE_SEC, "seconds", NULL },
787: { OAKLEY_ATTR_SA_LD_TYPE_KB, "kilobytes", NULL },
788: };
789:
790: char *
791: s_attr_isakmp_ltype(k)
792: int k;
793: {
794: int i;
795: for (i = 0; i < ARRAYLEN(name_attr_isakmp_ltype); i++)
796: if (name_attr_isakmp_ltype[i].key == k)
797: return name_attr_isakmp_ltype[i].str;
798: return num2str(k);
799: }
800:
801: char *
802: s_oakley_attr_v(type, val)
803: int type, val;
804: {
805: int i;
806: for (i = 0; i < ARRAYLEN(name_oakley_attr); i++)
807: if (name_oakley_attr[i].key == type
808: && name_oakley_attr[i].f)
809: return (name_oakley_attr[i].f)(val);
810: return num2str(val);
811: }
812:
813: /* netinet6/ipsec.h */
814: static struct ksmap name_ipsec_level[] = {
815: { IPSEC_LEVEL_USE, "use", NULL },
816: { IPSEC_LEVEL_REQUIRE, "require", NULL },
817: { IPSEC_LEVEL_UNIQUE, "unique", NULL },
818: };
819:
820: char *
821: s_ipsec_level(k)
822: int k;
823: {
824: int i;
825: for (i = 0; i < ARRAYLEN(name_ipsec_level); i++)
826: if (name_ipsec_level[i].key == k)
827: return name_ipsec_level[i].str;
828: return num2str(k);
829: }
830:
831: static struct ksmap name_algclass[] = {
832: { algclass_ipsec_enc, "ipsec enc", s_ipsecdoi_trns_esp },
833: { algclass_ipsec_auth, "ipsec auth", s_ipsecdoi_trns_ah },
834: { algclass_ipsec_comp, "ipsec comp", s_ipsecdoi_trns_ipcomp },
835: { algclass_isakmp_enc, "isakmp enc", s_attr_isakmp_enc },
836: { algclass_isakmp_hash, "isakmp hash", s_attr_isakmp_hash },
837: { algclass_isakmp_dh, "isakmp dh", s_attr_isakmp_desc },
838: { algclass_isakmp_ameth, "isakmp auth method", s_oakley_attr_method },
839: };
840:
841: char *
842: s_algclass(k)
843: int k;
844: {
845: int i;
846: for (i = 0; i < ARRAYLEN(name_algclass); i++)
847: if (name_algclass[i].key == k)
848: return name_algclass[i].str;
849: return num2str(k);
850: }
851:
852: char *
853: s_algtype(class, n)
854: int class, n;
855: {
856: int i;
857: for (i = 0; i < ARRAYLEN(name_algclass); i++)
858: if (name_algclass[i].key == class
859: && name_algclass[i].f)
860: return (name_algclass[i].f)(n);
861: return num2str(n);
862: }
863:
864: /* pfkey.h */
865: static struct ksmap name_pfkey_type[] = {
866: { SADB_GETSPI, "GETSPI", NULL },
867: { SADB_UPDATE, "UPDATE", NULL },
868: { SADB_ADD, "ADD", NULL },
869: { SADB_DELETE, "DELETE", NULL },
870: { SADB_GET, "GET", NULL },
871: { SADB_ACQUIRE, "ACQUIRE", NULL },
872: { SADB_REGISTER, "REGISTER", NULL },
873: { SADB_EXPIRE, "EXPIRE", NULL },
874: { SADB_FLUSH, "FLUSH", NULL },
875: { SADB_DUMP, "DUMP", NULL },
876: { SADB_X_PROMISC, "X_PROMISC", NULL },
877: { SADB_X_PCHANGE, "X_PCHANGE", NULL },
878: { SADB_X_SPDUPDATE, "X_SPDUPDATE", NULL },
879: { SADB_X_SPDADD, "X_SPDADD", NULL },
880: { SADB_X_SPDDELETE, "X_SPDDELETE", NULL },
881: { SADB_X_SPDGET, "X_SPDGET", NULL },
882: { SADB_X_SPDACQUIRE, "X_SPDACQUIRE", NULL },
883: { SADB_X_SPDDUMP, "X_SPDDUMP", NULL },
884: { SADB_X_SPDFLUSH, "X_SPDFLUSH", NULL },
885: { SADB_X_SPDSETIDX, "X_SPDSETIDX", NULL },
886: { SADB_X_SPDEXPIRE, "X_SPDEXPIRE", NULL },
887: { SADB_X_SPDDELETE2, "X_SPDDELETE2", NULL },
888: #ifdef SADB_X_NAT_T_NEW_MAPPING
889: { SADB_X_NAT_T_NEW_MAPPING, "X_NAT_T_NEW_MAPPING", NULL },
890: #endif
891: #ifdef SADB_X_MIGRATE
892: { SADB_X_MIGRATE, "X_MIGRATE", NULL },
893: #endif
894: };
895:
896: char *
897: s_pfkey_type(k)
898: int k;
899: {
900: int i;
901: for (i = 0; i < ARRAYLEN(name_pfkey_type); i++)
902: if (name_pfkey_type[i].key == k)
903: return name_pfkey_type[i].str;
904: return num2str(k);
905: }
906:
907: static struct ksmap name_pfkey_satype[] = {
908: { SADB_SATYPE_UNSPEC, "UNSPEC", NULL },
909: { SADB_SATYPE_AH, "AH", NULL },
910: { SADB_SATYPE_ESP, "ESP", NULL },
911: { SADB_SATYPE_RSVP, "RSVP", NULL },
912: { SADB_SATYPE_OSPFV2, "OSPFV2", NULL },
913: { SADB_SATYPE_RIPV2, "RIPV2", NULL },
914: { SADB_SATYPE_MIP, "MIP", NULL },
915: { SADB_X_SATYPE_IPCOMP, "IPCOMP", NULL },
916: };
917:
918: char *
919: s_pfkey_satype(k)
920: int k;
921: {
922: int i;
923: for (i = 0; i < ARRAYLEN(name_pfkey_satype); i++)
924: if (name_pfkey_satype[i].key == k)
925: return name_pfkey_satype[i].str;
926: return num2str(k);
927: }
928:
929: static struct ksmap name_direction[] = {
930: { IPSEC_DIR_INBOUND, "in", NULL },
931: { IPSEC_DIR_OUTBOUND, "out", NULL },
932: #ifdef HAVE_POLICY_FWD
933: { IPSEC_DIR_FWD, "fwd", NULL },
934: #endif
935: };
936:
937: char *
938: s_direction(k)
939: int k;
940: {
941: int i;
942: for (i = 0; i < ARRAYLEN(name_direction); i++)
943: if (name_direction[i].key == k)
944: return name_direction[i].str;
945: return num2str(k);
946: }
947:
948: char *
949: s_proto(k)
950: int k;
951: {
952: switch (k) {
953: case IPPROTO_ICMP:
954: return "icmp";
955: case IPPROTO_TCP:
956: return "tcp";
957: case IPPROTO_UDP:
958: return "udp";
959: case IPPROTO_ICMPV6:
960: return "icmpv6";
961: case IPSEC_ULPROTO_ANY:
962: return "any";
963: }
964:
965: return num2str(k);
966: }
967:
968: char *
969: s_doi(int k)
970: {
971: switch (k) {
972: case IPSEC_DOI:
973: return "ipsec_doi";
974: default:
975: return num2str(k);
976: }
977: }
978:
979: char *
980: s_etype (int k)
981: {
982: switch (k) {
983: case ISAKMP_ETYPE_NONE:
984: return "_none";
985: case ISAKMP_ETYPE_BASE:
986: return "base";
987: case ISAKMP_ETYPE_IDENT:
988: return "main";
989: case ISAKMP_ETYPE_AUTH:
990: return "_auth";
991: case ISAKMP_ETYPE_AGG:
992: return "aggressive";
993: case ISAKMP_ETYPE_INFO:
994: return "_info";
995: case ISAKMP_ETYPE_QUICK:
996: return "_quick";
997: case ISAKMP_ETYPE_NEWGRP:
998: return "_newgrp";
999: case ISAKMP_ETYPE_ACKINFO:
1000: return "_ackinfo";
1001: default:
1002: return num2str(k);
1003: }
1004: }
1005:
1006: char *
1007: s_idtype (int k)
1008: {
1009: switch (k) {
1010: case IDTYPE_FQDN:
1011: return "fqdn";
1012: case IDTYPE_USERFQDN:
1013: return "user_fqdn";
1014: case IDTYPE_KEYID:
1015: return "keyid";
1016: case IDTYPE_ADDRESS:
1017: return "address";
1018: case IDTYPE_ASN1DN:
1019: return "asn1dn";
1020: default:
1021: return num2str(k);
1022: }
1023: }
1024:
1025: char *
1026: s_switch (int k)
1027: {
1028: switch (k) {
1029: case FALSE:
1030: return "off";
1031: case TRUE:
1032: return "on";
1033: default:
1034: return num2str(k);
1035: }
1036: }
FreeBSD-CVSweb <freebsd-cvsweb@FreeBSD.org>