From eb4416d4df1aa88945ba6589b2ff66981feef9b3 Mon Sep 17 00:00:00 2001 From: Niklas Hallqvist Date: Fri, 20 Nov 1998 07:34:08 +0000 Subject: Add submaps to constant maps, and add a mechanism to the constant description language to link maps. --- sbin/isakmpd/constants.c | 15 +++++++++++++-- sbin/isakmpd/constants.h | 6 ++++-- sbin/isakmpd/genconstants.sh | 7 ++++--- sbin/isakmpd/ipsec_num.cst | 18 +++++++++--------- 4 files changed, 30 insertions(+), 16 deletions(-) (limited to 'sbin') diff --git a/sbin/isakmpd/constants.c b/sbin/isakmpd/constants.c index 0d4a20c6420..f58d0e5072a 100644 --- a/sbin/isakmpd/constants.c +++ b/sbin/isakmpd/constants.c @@ -1,5 +1,5 @@ -/* $OpenBSD: constants.c,v 1.3 1998/11/17 11:10:08 niklas Exp $ */ -/* $EOM: constants.c,v 1.4 1998/08/28 23:04:27 niklas Exp $ */ +/* $OpenBSD: constants.c,v 1.4 1998/11/20 07:34:06 niklas Exp $ */ +/* $EOM: constants.c,v 1.5 1998/11/20 07:17:00 niklas Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist. All rights reserved. @@ -61,6 +61,17 @@ constant_lookup (struct constant_map *map, int value) return 0; } +struct constant_map * +constant_link_lookup (struct constant_map *map, int value) +{ + struct constant_map *entry = map; + + for (entry = map; entry->name; entry++) + if (entry->value == value) + return entry->link; + return 0; +} + char * constant_name (struct constant_map *map, int value) { diff --git a/sbin/isakmpd/constants.h b/sbin/isakmpd/constants.h index 55cf9709390..dbf3d9bd7d4 100644 --- a/sbin/isakmpd/constants.h +++ b/sbin/isakmpd/constants.h @@ -1,5 +1,5 @@ -/* $OpenBSD: constants.h,v 1.3 1998/11/17 11:10:08 niklas Exp $ */ -/* $EOM: constants.h,v 1.4 1998/08/28 23:04:28 niklas Exp $ */ +/* $OpenBSD: constants.h,v 1.4 1998/11/20 07:34:06 niklas Exp $ */ +/* $EOM: constants.h,v 1.5 1998/11/20 07:17:01 niklas Exp $ */ /* * Copyright (c) 1998 Niklas Hallqvist. All rights reserved. @@ -40,8 +40,10 @@ struct constant_map { int value; char *name; + struct constant_map *link; }; +struct constant_map *constant_link_lookup (struct constant_map *, int); extern char *constant_lookup (struct constant_map *, int); extern char *constant_name (struct constant_map *, int); extern char *constant_name_maps (struct constant_map **, int); diff --git a/sbin/isakmpd/genconstants.sh b/sbin/isakmpd/genconstants.sh index acb16776f91..aca78ca463c 100644 --- a/sbin/isakmpd/genconstants.sh +++ b/sbin/isakmpd/genconstants.sh @@ -1,5 +1,6 @@ -# $OpenBSD: genconstants.sh,v 1.2 1998/11/17 11:10:11 niklas Exp $ -# $EOM: genconstants.sh,v 1.2 1998/07/24 22:25:42 niklas Exp $ +# $OpenBSD: genconstants.sh,v 1.3 1998/11/20 07:34:07 niklas Exp $ +# $EOM: genconstants.sh,v 1.3 1998/11/20 07:17:02 niklas Exp $ +# $EOM: genconstants.sh,v 1.3 1998/11/20 07:17:02 niklas Exp $ # # Copyright (c) 1998 Niklas Hallqvist. All rights reserved. @@ -106,7 +107,7 @@ BEGIN { } /^[ ]/ && $1 { - printf (" { %s_%s, \"%s\" }, \n", prefix, $1, $1) + printf (" { %s_%s, \"%s\", %s }, \n", prefix, $1, $1, $3 ? $3 : 0) next } diff --git a/sbin/isakmpd/ipsec_num.cst b/sbin/isakmpd/ipsec_num.cst index 9e067f9c07b..7698f8f8962 100644 --- a/sbin/isakmpd/ipsec_num.cst +++ b/sbin/isakmpd/ipsec_num.cst @@ -1,5 +1,5 @@ -# $OpenBSD: ipsec_num.cst,v 1.3 1998/11/17 11:10:14 niklas Exp $ -# $EOM: ipsec_num.cst,v 1.1 1998/07/25 11:19:11 niklas Exp $ +# $OpenBSD: ipsec_num.cst,v 1.4 1998/11/20 07:34:07 niklas Exp $ +# $EOM: ipsec_num.cst,v 1.2 1998/11/20 07:17:03 niklas Exp $ # # Copyright (c) 1998 Niklas Hallqvist. All rights reserved. @@ -92,19 +92,19 @@ IPSEC_ID # IKE SA attributes IKE_ATTR - ENCRYPTION_ALGORITHM 1 - HASH_ALGORITHM 2 - AUTHENTICATION_METHOD 3 - GROUP_DESCRIPTION 4 - GROUP_TYPE 5 + ENCRYPTION_ALGORITHM 1 ike_encrypt_cst + HASH_ALGORITHM 2 ike_hash_cst + AUTHENTICATION_METHOD 3 ike_auth_cst + GROUP_DESCRIPTION 4 ike_group_desc_cst + GROUP_TYPE 5 ike_group_cst GROUP_PRIME 6 GROUP_GENERATOR_1 7 GROUP_GENERATOR_2 8 GROUP_CURVE_A 9 GROUP_CURVE_B 10 - LIFE_TYPE 11 + LIFE_TYPE 11 ike_duration_cst LIFE_DURATION 12 - PRF 13 + PRF 13 ike_prf_cst KEY_LENGTH 14 FIELD_SIZE 15 GROUP_ORDER 16 -- cgit v1.2.3