support of the enum printf_hook
authorAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 20 Apr 2009 09:32:59 +0000 (09:32 -0000)
committerAndreas Steffen <andreas.steffen@strongswan.org>
Mon, 20 Apr 2009 09:32:59 +0000 (09:32 -0000)
src/libstrongswan/Makefile.am
src/pluto/connections.c
src/pluto/constants.c
src/pluto/constants.h
src/pluto/crl.c
src/pluto/ipsec_doi.c
src/pluto/library.c
src/pluto/state.c
src/pluto/timer.c
src/pluto/x509.c

index ed3a451..f18549e 100644 (file)
@@ -59,6 +59,7 @@ libstrongswan_la_LIBADD = -lpthread -ldl
 libstrongswan_lite_la_SOURCES = \
 chunk.c chunk.h \
 debug.c debug.h \
+enum.c enum.h \
 printf_hook.c printf_hook.h \
 settings.c settings.h \
 utils.c utils.h \
index 6c1d2b1..cbb48f6 100644 (file)
@@ -4056,11 +4056,11 @@ show_connections_status(bool all, const char *name)
                
                        if (c->dpd_action != DPD_ACTION_NONE)
                                whack_log(RC_COMMENT
-                                       , "\"%s\"%s:   dpd_action: %s;"
+                                       , "\"%s\"%s:   dpd_action: %N;"
                                        " dpd_delay: %lus; dpd_timeout: %lus;"
                                        , c->name
                                        , instance
-                                       , enum_show(&dpd_action_names, c->dpd_action)
+                                       , dpd_action_names, c->dpd_action
                                        , (unsigned long) c->dpd_delay
                                        , (unsigned long) c->dpd_timeout);
 
index 199f8f0..a302777 100644 (file)
@@ -71,52 +71,43 @@ enum_names version_names =
 
 /* RFC 2459 CRL reason codes */
 
-static const char *const crl_reason_name[] = {
-               "unspecified",
-               "key compromise",
-               "ca compromise",
-               "affiliation changed",
-               "superseded",
-               "cessation of operation",
-               "certificate hold",
-               "reason #7",
-               "remove from crl"
-       };
-
-enum_names crl_reason_names =
-       { REASON_UNSPECIFIED, REASON_REMOVE_FROM_CRL, crl_reason_name, NULL};
+ENUM(crl_reason_names, REASON_UNSPECIFIED, REASON_REMOVE_FROM_CRL,
+       "unspecified",
+       "key compromise",
+       "ca compromise",
+       "affiliation changed",
+       "superseded",
+       "cessation of operation",
+       "certificate hold",
+       "reason #7",
+       "remove from crl"
+);
 
 /* RFC 3706 Dead Peer Detection */
 
-static const char *const dpd_action_name[] = {
-               "none",
-               "clear",
-               "hold",
-               "restart"
-       };
-
-enum_names dpd_action_names =
-       { DPD_ACTION_NONE, DPD_ACTION_RESTART, dpd_action_name, NULL};
-               
+ENUM(dpd_action_names, DPD_ACTION_NONE, DPD_ACTION_RESTART,
+       "none",
+       "clear",
+       "hold",
+       "restart"
+);     
+       
 /* Timer events */
 
-static const char *const timer_event_name[] = {
-               "EVENT_NULL",
-               "EVENT_REINIT_SECRET",
-               "EVENT_SHUNT_SCAN",
-               "EVENT_SO_DISCARD",
-               "EVENT_RETRANSMIT",
-               "EVENT_SA_REPLACE",
-               "EVENT_SA_REPLACE_IF_USED",
-               "EVENT_SA_EXPIRE",
-               "EVENT_NAT_T_KEEPALIVE",
-               "EVENT_DPD",
-               "EVENT_DPD_TIMEOUT",
-               "EVENT_LOG_DAILY"
-       };
-
-enum_names timer_event_names =
-       { EVENT_NULL, EVENT_LOG_DAILY, timer_event_name, NULL };
+ENUM(timer_event_names, EVENT_NULL, EVENT_LOG_DAILY,
+       "EVENT_NULL",
+       "EVENT_REINIT_SECRET",
+       "EVENT_SHUNT_SCAN",
+       "EVENT_SO_DISCARD",
+       "EVENT_RETRANSMIT",
+       "EVENT_SA_REPLACE",
+       "EVENT_SA_REPLACE_IF_USED",
+       "EVENT_SA_EXPIRE",
+       "EVENT_NAT_T_KEEPALIVE",
+       "EVENT_DPD",
+       "EVENT_DPD_TIMEOUT",
+       "EVENT_LOG_DAILY"
+);
 
 /* Domain of Interpretation */
 
@@ -135,69 +126,69 @@ enum_names doi_names = { ISAKMP_DOI_ISAKMP, ISAKMP_DOI_IPSEC, doi_name, NULL };
  */
 #ifdef DEBUG
 const char *const debug_bit_names[] = {
-               "raw",
-               "crypt",
-               "parsing",
-               "emitting",
-               "control",
-               "lifecycle",
-               "klips",
-               "dns",
-               "natt",
-               "oppo",
-               "controlmore",
-
-               "private",
-
-               "impair-delay-adns-key-answer",
-               "impair-delay-adns-txt-answer",
-               "impair-bust-mi2",
-               "impair-bust-mr2",
-
-               NULL
-       };
+       "raw",
+       "crypt",
+       "parsing",
+       "emitting",
+       "control",
+       "lifecycle",
+       "klips",
+       "dns",
+       "natt",
+       "oppo",
+       "controlmore",
+
+       "private",
+
+       "impair-delay-adns-key-answer",
+       "impair-delay-adns-txt-answer",
+       "impair-bust-mi2",
+       "impair-bust-mr2",
+
+       NULL
+};
 #endif
 
 /* State of exchanges */
 
 static const char *const state_name[] = {
-               "STATE_MAIN_R0",
-               "STATE_MAIN_I1",
-               "STATE_MAIN_R1",
-               "STATE_MAIN_I2",
-               "STATE_MAIN_R2",
-               "STATE_MAIN_I3",
-               "STATE_MAIN_R3",
-               "STATE_MAIN_I4",
-
-               "STATE_QUICK_R0",
-               "STATE_QUICK_I1",
-               "STATE_QUICK_R1",
-               "STATE_QUICK_I2",
-               "STATE_QUICK_R2",
-
-               "STATE_INFO",
-               "STATE_INFO_PROTECTED",
-
-               "STATE_XAUTH_I0",
-               "STATE_XAUTH_R1",
-               "STATE_XAUTH_I1",
-               "STATE_XAUTH_R2",
-               "STATE_XAUTH_I2",
-               "STATE_XAUTH_R3",
-
-               "STATE_MODE_CFG_R0",
-               "STATE_MODE_CFG_I1",
-               "STATE_MODE_CFG_R1",
-               "STATE_MODE_CFG_I2",
-
-               "STATE_MODE_CFG_I0",
-               "STATE_MODE_CFG_R3",
-               "STATE_MODE_CFG_I3",
-               "STATE_MODE_CFG_R4",
-
-               "STATE_IKE_ROOF"
-       };
+       "STATE_MAIN_R0",
+       "STATE_MAIN_I1",
+       "STATE_MAIN_R1",
+       "STATE_MAIN_I2",
+       "STATE_MAIN_R2",
+       "STATE_MAIN_I3",
+       "STATE_MAIN_R3",
+       "STATE_MAIN_I4",
+
+       "STATE_QUICK_R0",
+       "STATE_QUICK_I1",
+       "STATE_QUICK_R1",
+       "STATE_QUICK_I2",
+       "STATE_QUICK_R2",
+
+       "STATE_INFO",
+       "STATE_INFO_PROTECTED",
+
+       "STATE_XAUTH_I0",
+       "STATE_XAUTH_R1",
+       "STATE_XAUTH_I1",
+       "STATE_XAUTH_R2",
+       "STATE_XAUTH_I2",
+       "STATE_XAUTH_R3",
+
+       "STATE_MODE_CFG_R0",
+       "STATE_MODE_CFG_I1",
+       "STATE_MODE_CFG_R1",
+       "STATE_MODE_CFG_I2",
+
+       "STATE_MODE_CFG_I0",
+       "STATE_MODE_CFG_R3",
+       "STATE_MODE_CFG_I3",
+       "STATE_MODE_CFG_R4",
+
+       "STATE_IKE_ROOF"
+};
 
 enum_names state_names =
        { STATE_MAIN_R0, STATE_IKE_ROOF-1, state_name, NULL };
@@ -205,41 +196,41 @@ enum_names state_names =
 /* story for state */
 
 const char *const state_story[] = {
-               "expecting MI1",                         /* STATE_MAIN_R0 */
-               "sent MI1, expecting MR1",               /* STATE_MAIN_I1 */
-               "sent MR1, expecting MI2",               /* STATE_MAIN_R1 */
-               "sent MI2, expecting MR2",               /* STATE_MAIN_I2 */
-               "sent MR2, expecting MI3",               /* STATE_MAIN_R2 */
-               "sent MI3, expecting MR3",               /* STATE_MAIN_I3 */
-               "sent MR3, ISAKMP SA established",       /* STATE_MAIN_R3 */
-               "ISAKMP SA established",                 /* STATE_MAIN_I4 */
-
-               "expecting QI1",                         /* STATE_QUICK_R0 */
-               "sent QI1, expecting QR1",               /* STATE_QUICK_I1 */
-               "sent QR1, inbound IPsec SA installed, expecting QI2",  /* STATE_QUICK_R1 */
-               "sent QI2, IPsec SA established",        /* STATE_QUICK_I2 */
-               "IPsec SA established",                  /* STATE_QUICK_R2 */
-
-               "got Informational Message in clear",    /* STATE_INFO */
-               "got encrypted Informational Message",   /* STATE_INFO_PROTECTED */
-
-               "expecting XAUTH request",               /* STATE_XAUTH_I0 */
-               "sent XAUTH request, expecting reply",   /* STATE_XAUTH_R1 */
-               "sent XAUTH reply, expecting status",    /* STATE_XAUTH_I1 */
-               "sent XAUTH status, expecting ack",      /* STATE_XAUTH_R2 */
-               "sent XAUTH ack, established",           /* STATE_XAUTH_I2 */
-               "received XAUTH ack, established",       /* STATE_XAUTH_R3 */
-
-               "expecting ModeCfg request",             /* STATE_MODE_CFG_R0 */
-               "sent ModeCfg request, expecting reply", /* STATE_MODE_CFG_I1 */
-               "sent ModeCfg reply, established",       /* STATE_MODE_CFG_R1 */
-               "received ModeCfg reply, established",   /* STATE_MODE_CFG_I2 */
-
-               "expecting ModeCfg set",                 /* STATE_MODE_CFG_I0 */
-               "sent ModeCfg set, expecting ack",       /* STATE_MODE_CFG_R3 */
-               "sent ModeCfg ack, established",         /* STATE_MODE_CFG_I3 */
-               "received ModeCfg ack, established",     /* STATE_MODE_CFG_R4 */
-       };
+       "expecting MI1",                         /* STATE_MAIN_R0 */
+       "sent MI1, expecting MR1",               /* STATE_MAIN_I1 */
+       "sent MR1, expecting MI2",               /* STATE_MAIN_R1 */
+       "sent MI2, expecting MR2",               /* STATE_MAIN_I2 */
+       "sent MR2, expecting MI3",               /* STATE_MAIN_R2 */
+       "sent MI3, expecting MR3",               /* STATE_MAIN_I3 */
+       "sent MR3, ISAKMP SA established",       /* STATE_MAIN_R3 */
+       "ISAKMP SA established",                 /* STATE_MAIN_I4 */
+
+       "expecting QI1",                         /* STATE_QUICK_R0 */
+       "sent QI1, expecting QR1",               /* STATE_QUICK_I1 */
+       "sent QR1, inbound IPsec SA installed, expecting QI2",  /* STATE_QUICK_R1 */
+       "sent QI2, IPsec SA established",        /* STATE_QUICK_I2 */
+       "IPsec SA established",                  /* STATE_QUICK_R2 */
+
+       "got Informational Message in clear",    /* STATE_INFO */
+       "got encrypted Informational Message",   /* STATE_INFO_PROTECTED */
+
+       "expecting XAUTH request",               /* STATE_XAUTH_I0 */
+       "sent XAUTH request, expecting reply",   /* STATE_XAUTH_R1 */
+       "sent XAUTH reply, expecting status",    /* STATE_XAUTH_I1 */
+       "sent XAUTH status, expecting ack",      /* STATE_XAUTH_R2 */
+       "sent XAUTH ack, established",           /* STATE_XAUTH_I2 */
+       "received XAUTH ack, established",       /* STATE_XAUTH_R3 */
+
+       "expecting ModeCfg request",             /* STATE_MODE_CFG_R0 */
+       "sent ModeCfg request, expecting reply", /* STATE_MODE_CFG_I1 */
+       "sent ModeCfg reply, established",       /* STATE_MODE_CFG_R1 */
+       "received ModeCfg reply, established",   /* STATE_MODE_CFG_I2 */
+
+       "expecting ModeCfg set",                 /* STATE_MODE_CFG_I0 */
+       "sent ModeCfg set, expecting ack",       /* STATE_MODE_CFG_R3 */
+       "sent ModeCfg ack, established",         /* STATE_MODE_CFG_I3 */
+       "received ModeCfg ack, established",     /* STATE_MODE_CFG_R4 */
+};
 
 /* kind of struct connection */
 
@@ -265,7 +256,7 @@ static const char *const routing_story_strings[] = {
        "fail erouted",     /* RT_ROUTED_FAILURE: routed, and failure-context shunt eroute installed */
        "erouted",  /* RT_ROUTED_TUNNEL: routed, and erouted to an IPSEC SA group */
        "keyed, unrouted",  /* RT_UNROUTED_KEYED: was routed+keyed, but it got turned into an outer policy */
-       };
+};
 
 enum_names routing_story =
        { RT_UNROUTED, RT_ROUTED_TUNNEL, routing_story_strings, NULL};
@@ -273,36 +264,38 @@ enum_names routing_story =
 /* Payload types (RFC 2408 "ISAKMP" section 3.1) */
 
 const char *const payload_name[] = {
-               "ISAKMP_NEXT_NONE",
-               "ISAKMP_NEXT_SA",
-               "ISAKMP_NEXT_P",
-               "ISAKMP_NEXT_T",
-               "ISAKMP_NEXT_KE",
-               "ISAKMP_NEXT_ID",
-               "ISAKMP_NEXT_CERT",
-               "ISAKMP_NEXT_CR",
-               "ISAKMP_NEXT_HASH",
-               "ISAKMP_NEXT_SIG",
-               "ISAKMP_NEXT_NONCE",
-               "ISAKMP_NEXT_N",
-               "ISAKMP_NEXT_D",
-               "ISAKMP_NEXT_VID",
-               "ISAKMP_NEXT_MODECFG",
-               "ISAKMP_NEXT_15",
-               "ISAKMP_NEXT_16",
-               "ISAKMP_NEXT_17",
-               "ISAKMP_NEXT_18",
-               "ISAKMP_NEXT_19",
-               "ISAKMP_NEXT_NAT-D",
-               "ISAKMP_NEXT_NAT-OA",
-               NULL
-       };
+       "ISAKMP_NEXT_NONE",
+       "ISAKMP_NEXT_SA",
+       "ISAKMP_NEXT_P",
+       "ISAKMP_NEXT_T",
+       "ISAKMP_NEXT_KE",
+       "ISAKMP_NEXT_ID",
+       "ISAKMP_NEXT_CERT",
+       "ISAKMP_NEXT_CR",
+       "ISAKMP_NEXT_HASH",
+       "ISAKMP_NEXT_SIG",
+       "ISAKMP_NEXT_NONCE",
+       "ISAKMP_NEXT_N",
+       "ISAKMP_NEXT_D",
+       "ISAKMP_NEXT_VID",
+       "ISAKMP_NEXT_MODECFG",
+       "ISAKMP_NEXT_15",
+       "ISAKMP_NEXT_16",
+       "ISAKMP_NEXT_17",
+       "ISAKMP_NEXT_18",
+       "ISAKMP_NEXT_19",
+       "ISAKMP_NEXT_NAT-D",
+       "ISAKMP_NEXT_NAT-OA",
+       NULL
+};
 
-const char *const payload_name_nat_d[] = { "ISAKMP_NEXT_NAT-D",
-               "ISAKMP_NEXT_NAT-OA", NULL };
+const char *const payload_name_nat_d[] = {
+       "ISAKMP_NEXT_NAT-D",
+       "ISAKMP_NEXT_NAT-OA", NULL
+};
 
 static enum_names payload_names_nat_d =
-               { ISAKMP_NEXT_NATD_DRAFTS, ISAKMP_NEXT_NATOA_DRAFTS, payload_name_nat_d, NULL };
+       { ISAKMP_NEXT_NATD_DRAFTS, ISAKMP_NEXT_NATOA_DRAFTS, payload_name_nat_d, NULL };
                
 enum_names payload_names =
        { ISAKMP_NEXT_NONE, ISAKMP_NEXT_NATOA_RFC, payload_name, &payload_names_nat_d };
@@ -310,20 +303,20 @@ enum_names payload_names =
 /* Exchange types (note: two discontinuous ranges) */
 
 static const char *const exchange_name[] = {
-               "ISAKMP_XCHG_NONE",
-               "ISAKMP_XCHG_BASE",
-               "ISAKMP_XCHG_IDPROT",
-               "ISAKMP_XCHG_AO",
-               "ISAKMP_XCHG_AGGR",
-               "ISAKMP_XCHG_INFO",
-               "ISAKMP_XCHG_MODE_CFG",
-       };
+       "ISAKMP_XCHG_NONE",
+       "ISAKMP_XCHG_BASE",
+       "ISAKMP_XCHG_IDPROT",
+       "ISAKMP_XCHG_AO",
+       "ISAKMP_XCHG_AGGR",
+       "ISAKMP_XCHG_INFO",
+       "ISAKMP_XCHG_MODE_CFG",
+};
 
 static const char *const exchange_name2[] = {
-               "ISAKMP_XCHG_QUICK",
-               "ISAKMP_XCHG_NGRP",
-               "ISAKMP_XCHG_ACK_INFO",
-       };
+       "ISAKMP_XCHG_QUICK",
+       "ISAKMP_XCHG_NGRP",
+       "ISAKMP_XCHG_ACK_INFO",
+};
 
 static enum_names exchange_desc2 =
        { ISAKMP_XCHG_QUICK, ISAKMP_XCHG_ACK_INFO, exchange_name2, NULL };
@@ -333,28 +326,28 @@ enum_names exchange_names =
 
 /* Flag BITS */
 const char *const flag_bit_names[] = {
-               "ISAKMP_FLAG_ENCRYPTION",
-               "ISAKMP_FLAG_COMMIT",
-               NULL
-       };
+       "ISAKMP_FLAG_ENCRYPTION",
+       "ISAKMP_FLAG_COMMIT",
+       NULL
+};
 
 /* Situation BITS definition for IPsec DOI */
 
 const char *const sit_bit_names[] = {
-               "SIT_IDENTITY_ONLY",
-               "SIT_SECRECY",
-               "SIT_INTEGRITY",
-               NULL
-       };
+       "SIT_IDENTITY_ONLY",
+       "SIT_SECRECY",
+       "SIT_INTEGRITY",
+       NULL
+};
 
 /* Protocol IDs (RFC 2407 "IPsec DOI" section 4.4.1) */
 
 static const char *const protocol_name[] = {
-               "PROTO_ISAKMP",
-               "PROTO_IPSEC_AH",
-               "PROTO_IPSEC_ESP",
-               "PROTO_IPCOMP",
-       };
+       "PROTO_ISAKMP",
+       "PROTO_IPSEC_AH",
+       "PROTO_IPSEC_ESP",
+       "PROTO_IPCOMP",
+};
 
 enum_names protocol_names =
        { PROTO_ISAKMP, PROTO_IPCOMP, protocol_name, NULL };
@@ -362,8 +355,8 @@ enum_names protocol_names =
 /* IPsec ISAKMP transform values */
 
 static const char *const isakmp_transform_name[] = {
-               "KEY_IKE",
-       };
+       "KEY_IKE",
+};
 
 enum_names isakmp_transformid_names =
        { KEY_IKE, KEY_IKE, isakmp_transform_name, NULL };
@@ -371,16 +364,16 @@ enum_names isakmp_transformid_names =
 /* IPsec AH transform values */
 
 static const char *const ah_transform_name[] = {
-               "AH_MD5",
-               "AH_SHA",
-               "AH_DES",
-               "AH_SHA2_256",
-               "AH_SHA2_384",
-               "AH_SHA2_512",
-               "AH_RIPEMD",
-               "AH_AES_XCBC_MAC",
-               "AH_RSA"
-       };
+       "AH_MD5",
+       "AH_SHA",
+       "AH_DES",
+       "AH_SHA2_256",
+       "AH_SHA2_384",
+       "AH_SHA2_512",
+       "AH_RIPEMD",
+       "AH_AES_XCBC_MAC",
+       "AH_RSA"
+};
 
 enum_names ah_transformid_names =
        { AH_MD5, AH_RSA, ah_transform_name, NULL };
@@ -388,38 +381,38 @@ enum_names ah_transformid_names =
 /* IPsec ESP transform values */
 
 static const char *const esp_transform_name[] = {
-               "ESP_DES_IV64",
-               "ESP_DES",
-               "ESP_3DES",
-               "ESP_RC5",
-               "ESP_IDEA",
-               "ESP_CAST",
-               "ESP_BLOWFISH",
-               "ESP_3IDEA",
-               "ESP_DES_IV32",
-               "ESP_RC4",
-               "ESP_NULL",
-               "ESP_AES",
-               "ESP_AES-CTR",
-               "ESP_AES-CCM_8",
-               "ESP_AES-CCM_12",
-               "ESP_AES-CCM_16",
-               "ESP_UNASSIGNED_17",
-               "ESP_AES_GCM_8",
-               "ESP_AES_GCM_12",
-               "ESP_AES_GCM_16",
-               "ESP_SEED_CBC",
-               "ESP_CAMELLIA"
-       };
+       "ESP_DES_IV64",
+       "ESP_DES",
+       "ESP_3DES",
+       "ESP_RC5",
+       "ESP_IDEA",
+       "ESP_CAST",
+       "ESP_BLOWFISH",
+       "ESP_3IDEA",
+       "ESP_DES_IV32",
+       "ESP_RC4",
+       "ESP_NULL",
+       "ESP_AES",
+       "ESP_AES-CTR",
+       "ESP_AES-CCM_8",
+       "ESP_AES-CCM_12",
+       "ESP_AES-CCM_16",
+       "ESP_UNASSIGNED_17",
+       "ESP_AES_GCM_8",
+       "ESP_AES_GCM_12",
+       "ESP_AES_GCM_16",
+       "ESP_SEED_CBC",
+       "ESP_CAMELLIA"
+};
 
 /*
  * ipsec drafts suggest "high" ESP ids values for testing,
  * assign generic ESP_ID<num> if not officially defined
  */
 static const char *const esp_transform_name_high[] = {
-               "ESP_SERPENT",
-               "ESP_TWOFISH"
-       };
+       "ESP_SERPENT",
+       "ESP_TWOFISH"
+};
 
 enum_names esp_transformid_names_high =
        { ESP_SERPENT, ESP_TWOFISH, esp_transform_name_high, NULL };
@@ -430,11 +423,11 @@ enum_names esp_transformid_names =
 /* IPCOMP transform values */
 
 static const char *const ipcomp_transform_name[] = {
-               "IPCOMP_OUI",
-               "IPCOMP_DEFLAT",
-               "IPCOMP_LZS",
-               "IPCOMP_LZJH",
-       };
+       "IPCOMP_OUI",
+       "IPCOMP_DEFLAT",
+       "IPCOMP_LZS",
+       "IPCOMP_LZJH",
+};
 
 enum_names ipcomp_transformid_names =
        { IPCOMP_OUI, IPCOMP_LZJH, ipcomp_transform_name, NULL };
@@ -442,18 +435,18 @@ enum_names ipcomp_transformid_names =
 /* Identification type values */
 
 static const char *const ident_name[] = {
-               "ID_IPV4_ADDR",
-               "ID_FQDN",
-               "ID_USER_FQDN",
-               "ID_IPV4_ADDR_SUBNET",
-               "ID_IPV6_ADDR",
-               "ID_IPV6_ADDR_SUBNET",
-               "ID_IPV4_ADDR_RANGE",
-               "ID_IPV6_ADDR_RANGE",
-               "ID_DER_ASN1_DN",
-               "ID_DER_ASN1_GN",
-               "ID_KEY_ID",
-       };
+       "ID_IPV4_ADDR",
+       "ID_FQDN",
+       "ID_USER_FQDN",
+       "ID_IPV4_ADDR_SUBNET",
+       "ID_IPV6_ADDR",
+       "ID_IPV6_ADDR_SUBNET",
+       "ID_IPV4_ADDR_RANGE",
+       "ID_IPV6_ADDR_RANGE",
+       "ID_DER_ASN1_DN",
+       "ID_DER_ASN1_GN",
+       "ID_KEY_ID",
+};
 
 enum_names ident_names =
        { ID_IPV4_ADDR, ID_KEY_ID, ident_name, NULL };
@@ -461,80 +454,77 @@ enum_names ident_names =
 /* Certificate type values */
 
 static const char *const cert_type_name[] = {
-               "CERT_NONE",
-               "CERT_PKCS7_WRAPPED_X509",
-               "CERT_PGP",
-               "CERT_DNS_SIGNED_KEY",
-               "CERT_X509_SIGNATURE",
-               "CERT_X509_KEY_EXCHANGE",
-               "CERT_KERBEROS_TOKENS",
-               "CERT_CRL",
-               "CERT_ARL",
-               "CERT_SPKI",
-               "CERT_X509_ATTRIBUTE",
-       };
+       "CERT_NONE",
+       "CERT_PKCS7_WRAPPED_X509",
+       "CERT_PGP",
+       "CERT_DNS_SIGNED_KEY",
+       "CERT_X509_SIGNATURE",
+       "CERT_X509_KEY_EXCHANGE",
+       "CERT_KERBEROS_TOKENS",
+       "CERT_CRL",
+       "CERT_ARL",
+       "CERT_SPKI",
+       "CERT_X509_ATTRIBUTE",
+};
 
 enum_names cert_type_names =
        { CERT_NONE, CERT_X509_ATTRIBUTE, cert_type_name, NULL };
 
 /* Certificate policy names */
 
-static const char *const cert_policy_name[] = {
-               "ALWAYS_SEND",
-               "SEND_IF_ASKED",
-               "NEVER_SEND",
-       };
-
-enum_names cert_policy_names =
-       { CERT_ALWAYS_SEND, CERT_NEVER_SEND, cert_policy_name, NULL };
+ENUM(cert_policy_names, CERT_ALWAYS_SEND, CERT_NEVER_SEND,
+       "ALWAYS_SEND",
+       "SEND_IF_ASKED",
+       "NEVER_SEND",
+);
 
 /* Goal BITs for establishing an SA
  * Note: we drop the POLICY_ prefix so that logs are more concise.
  */
 
 const char *const sa_policy_bit_names[] = {
-               "PSK",
-               "RSASIG",
-               "ENCRYPT",
-               "AUTHENTICATE",
-               "COMPRESS",
-               "TUNNEL",
-               "PFS",
-               "DISABLEARRIVALCHECK",
-               "SHUNT0",
-               "SHUNT1",
-               "FAILSHUNT0",
-               "FAILSHUNT1",
-               "DONTREKEY",
-               "OPPORTUNISTIC",
-               "GROUP",
-               "GROUTED",
-               "UP",
-               "MODECFGPUSH",
-               "XAUTHPSK",
-               "XAUTHRSASIG",
-               "XAUTHSERVER",
-               "DONTREAUTH",
-               "BEET",
-               "MOBIKE",
-               "ECDSA",
-               "PROXY",
-               NULL
-       };
+       "PSK",
+       "RSASIG",
+       "ENCRYPT",
+       "AUTHENTICATE",
+       "COMPRESS",
+       "TUNNEL",
+       "PFS",
+       "DISABLEARRIVALCHECK",
+       "SHUNT0",
+       "SHUNT1",
+       "FAILSHUNT0",
+       "FAILSHUNT1",
+       "DONTREKEY",
+       "OPPORTUNISTIC",
+       "GROUP",
+       "GROUTED",
+       "UP",
+       "MODECFGPUSH",
+       "XAUTHPSK",
+       "XAUTHRSASIG",
+       "XAUTHSERVER",
+       "DONTREAUTH",
+       "BEET",
+       "MOBIKE",
+       "ECDSA",
+       "PROXY",
+       NULL
+};
 
 const char *const policy_shunt_names[4] = {
-               "TRAP",
-               "PASS",
-               "DROP",
-               "REJECT",
-       };
+       "TRAP",
+       "PASS",
+       "DROP",
+       "REJECT",
+};
 
 const char *const policy_fail_names[4] = {
-               "NONE",
-               "PASS",
-               "DROP",
-               "REJECT",
-       };
+       "NONE",
+       "PASS",
+       "DROP",
+       "REJECT",
+};
 
 /* Oakley transform attributes
  * oakley_attr_bit_names does double duty: it is used for enum names
@@ -542,39 +532,39 @@ const char *const policy_fail_names[4] = {
  */
 
 const char *const oakley_attr_bit_names[] = {
-               "OAKLEY_ENCRYPTION_ALGORITHM",
-               "OAKLEY_HASH_ALGORITHM",
-               "OAKLEY_AUTHENTICATION_METHOD",
-               "OAKLEY_GROUP_DESCRIPTION",
-               "OAKLEY_GROUP_TYPE",
-               "OAKLEY_GROUP_PRIME",
-               "OAKLEY_GROUP_GENERATOR_ONE",
-               "OAKLEY_GROUP_GENERATOR_TWO",
-               "OAKLEY_GROUP_CURVE_A",
-               "OAKLEY_GROUP_CURVE_B",
-               "OAKLEY_LIFE_TYPE",
-               "OAKLEY_LIFE_DURATION",
-               "OAKLEY_PRF",
-               "OAKLEY_KEY_LENGTH",
-               "OAKLEY_FIELD_SIZE",
-               "OAKLEY_GROUP_ORDER",
-               "OAKLEY_BLOCK_SIZE",
-               NULL
-       };
+       "OAKLEY_ENCRYPTION_ALGORITHM",
+       "OAKLEY_HASH_ALGORITHM",
+       "OAKLEY_AUTHENTICATION_METHOD",
+       "OAKLEY_GROUP_DESCRIPTION",
+       "OAKLEY_GROUP_TYPE",
+       "OAKLEY_GROUP_PRIME",
+       "OAKLEY_GROUP_GENERATOR_ONE",
+       "OAKLEY_GROUP_GENERATOR_TWO",
+       "OAKLEY_GROUP_CURVE_A",
+       "OAKLEY_GROUP_CURVE_B",
+       "OAKLEY_LIFE_TYPE",
+       "OAKLEY_LIFE_DURATION",
+       "OAKLEY_PRF",
+       "OAKLEY_KEY_LENGTH",
+       "OAKLEY_FIELD_SIZE",
+       "OAKLEY_GROUP_ORDER",
+       "OAKLEY_BLOCK_SIZE",
+       NULL
+};
 
 static const char *const oakley_var_attr_name[] = {
-               "OAKLEY_GROUP_PRIME (variable length)",
-               "OAKLEY_GROUP_GENERATOR_ONE (variable length)",
-               "OAKLEY_GROUP_GENERATOR_TWO (variable length)",
-               "OAKLEY_GROUP_CURVE_A (variable length)",
-               "OAKLEY_GROUP_CURVE_B (variable length)",
-               NULL,
-               "OAKLEY_LIFE_DURATION (variable length)",
-               NULL,
-               NULL,
-               NULL,
-               "OAKLEY_GROUP_ORDER (variable length)",
-       };
+       "OAKLEY_GROUP_PRIME (variable length)",
+       "OAKLEY_GROUP_GENERATOR_ONE (variable length)",
+       "OAKLEY_GROUP_GENERATOR_TWO (variable length)",
+       "OAKLEY_GROUP_CURVE_A (variable length)",
+       "OAKLEY_GROUP_CURVE_B (variable length)",
+       NULL,
+       "OAKLEY_LIFE_DURATION (variable length)",
+       NULL,
+       NULL,
+       NULL,
+       "OAKLEY_GROUP_ORDER (variable length)",
+};
 
 static enum_names oakley_attr_desc_tv = {
        OAKLEY_ENCRYPTION_ALGORITHM + ISAKMP_ATTR_AF_TV,
@@ -586,49 +576,49 @@ enum_names oakley_attr_names = {
 
 /* for each Oakley attribute, which enum_names describes its values? */
 enum_names *oakley_attr_val_descs[] = {
-               NULL,                   /* (none) */
-               &oakley_enc_names,      /* OAKLEY_ENCRYPTION_ALGORITHM */
-               &oakley_hash_names,     /* OAKLEY_HASH_ALGORITHM */
-               &oakley_auth_names,     /* OAKLEY_AUTHENTICATION_METHOD */
-               &oakley_group_names,    /* OAKLEY_GROUP_DESCRIPTION */
-               &oakley_group_type_names,/* OAKLEY_GROUP_TYPE */
-               NULL,                   /* OAKLEY_GROUP_PRIME */
-               NULL,                   /* OAKLEY_GROUP_GENERATOR_ONE */
-               NULL,                   /* OAKLEY_GROUP_GENERATOR_TWO */
-               NULL,                   /* OAKLEY_GROUP_CURVE_A */
-               NULL,                   /* OAKLEY_GROUP_CURVE_B */
-               &oakley_lifetime_names, /* OAKLEY_LIFE_TYPE */
-               NULL,                   /* OAKLEY_LIFE_DURATION */
-               &oakley_prf_names,      /* OAKLEY_PRF */
-               NULL,                   /* OAKLEY_KEY_LENGTH */
-               NULL,                   /* OAKLEY_FIELD_SIZE */
-               NULL,                   /* OAKLEY_GROUP_ORDER */
-       };
+       NULL,                   /* (none) */
+       &oakley_enc_names,      /* OAKLEY_ENCRYPTION_ALGORITHM */
+       &oakley_hash_names,     /* OAKLEY_HASH_ALGORITHM */
+       &oakley_auth_names,     /* OAKLEY_AUTHENTICATION_METHOD */
+       &oakley_group_names,    /* OAKLEY_GROUP_DESCRIPTION */
+       &oakley_group_type_names,/* OAKLEY_GROUP_TYPE */
+       NULL,                   /* OAKLEY_GROUP_PRIME */
+       NULL,                   /* OAKLEY_GROUP_GENERATOR_ONE */
+       NULL,                   /* OAKLEY_GROUP_GENERATOR_TWO */
+       NULL,                   /* OAKLEY_GROUP_CURVE_A */
+       NULL,                   /* OAKLEY_GROUP_CURVE_B */
+       &oakley_lifetime_names, /* OAKLEY_LIFE_TYPE */
+       NULL,                   /* OAKLEY_LIFE_DURATION */
+       &oakley_prf_names,      /* OAKLEY_PRF */
+       NULL,                   /* OAKLEY_KEY_LENGTH */
+       NULL,                   /* OAKLEY_FIELD_SIZE */
+       NULL,                   /* OAKLEY_GROUP_ORDER */
+};
 
 /* IPsec DOI attributes (RFC 2407 "IPsec DOI" section 4.5) */
 
 static const char *const ipsec_attr_name[] = {
-               "SA_LIFE_TYPE",
-               "SA_LIFE_DURATION",
-               "GROUP_DESCRIPTION",
-               "ENCAPSULATION_MODE",
-               "AUTH_ALGORITHM",
-               "KEY_LENGTH",
-               "KEY_ROUNDS",
-               "COMPRESS_DICT_SIZE",
-               "COMPRESS_PRIVATE_ALG",
-       };
+       "SA_LIFE_TYPE",
+       "SA_LIFE_DURATION",
+       "GROUP_DESCRIPTION",
+       "ENCAPSULATION_MODE",
+       "AUTH_ALGORITHM",
+       "KEY_LENGTH",
+       "KEY_ROUNDS",
+       "COMPRESS_DICT_SIZE",
+       "COMPRESS_PRIVATE_ALG",
+};
 
 static const char *const ipsec_var_attr_name[] = {
-               "SA_LIFE_DURATION (variable length)",
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               "COMPRESS_PRIVATE_ALG (variable length)",
-       };
+       "SA_LIFE_DURATION (variable length)",
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       "COMPRESS_PRIVATE_ALG (variable length)",
+};
 
 static enum_names ipsec_attr_desc_tv = {
        SA_LIFE_TYPE + ISAKMP_ATTR_AF_TV,
@@ -641,24 +631,24 @@ enum_names ipsec_attr_names = {
 
 /* for each IPsec attribute, which enum_names describes its values? */
 enum_names *ipsec_attr_val_descs[] = {
-               NULL,                   /* (none) */
-               &sa_lifetime_names,     /* SA_LIFE_TYPE */
-               NULL,                   /* SA_LIFE_DURATION */
-               &oakley_group_names,    /* GROUP_DESCRIPTION */
-               &enc_mode_names,                /* ENCAPSULATION_MODE */
-               &auth_alg_names,                /* AUTH_ALGORITHM */
-               NULL,                   /* KEY_LENGTH */
-               NULL,                   /* KEY_ROUNDS */
-               NULL,                   /* COMPRESS_DICT_SIZE */
-               NULL,                   /* COMPRESS_PRIVATE_ALG */
-       };
+       NULL,                   /* (none) */
+       &sa_lifetime_names,     /* SA_LIFE_TYPE */
+       NULL,                   /* SA_LIFE_DURATION */
+       &oakley_group_names,    /* GROUP_DESCRIPTION */
+       &enc_mode_names,                /* ENCAPSULATION_MODE */
+       &auth_alg_names,                /* AUTH_ALGORITHM */
+       NULL,                   /* KEY_LENGTH */
+       NULL,                   /* KEY_ROUNDS */
+       NULL,                   /* COMPRESS_DICT_SIZE */
+       NULL,                   /* COMPRESS_PRIVATE_ALG */
+};
 
 /* SA Lifetime Type attribute */
 
 static const char *const sa_lifetime_name[] = {
-               "SA_LIFE_TYPE_SECONDS",
-               "SA_LIFE_TYPE_KBYTES",
-       };
+       "SA_LIFE_TYPE_SECONDS",
+       "SA_LIFE_TYPE_KBYTES",
+};
 
 enum_names sa_lifetime_names =
        { SA_LIFE_TYPE_SECONDS, SA_LIFE_TYPE_KBYTES, sa_lifetime_name, NULL };
@@ -666,11 +656,11 @@ enum_names sa_lifetime_names =
 /* Encapsulation Mode attribute */
 
 static const char *const enc_mode_name[] = {
-               "ENCAPSULATION_MODE_TUNNEL",
-               "ENCAPSULATION_MODE_TRANSPORT",
-               "ENCAPSULATION_MODE_UDP_TUNNEL",
-               "ENCAPSULATION_MODE_UDP_TRANSPORT",
-       };
+       "ENCAPSULATION_MODE_TUNNEL",
+       "ENCAPSULATION_MODE_TRANSPORT",
+       "ENCAPSULATION_MODE_UDP_TUNNEL",
+       "ENCAPSULATION_MODE_UDP_TRANSPORT",
+};
 
 static const char *const enc_udp_mode_name[] = {
                "ENCAPSULATION_MODE_UDP_TUNNEL",
@@ -686,17 +676,17 @@ enum_names enc_mode_names =
 /* Auth Algorithm attribute */
 
 static const char *const auth_alg_name[] = {
-               "AUTH_ALGORITHM_HMAC_MD5",
-               "AUTH_ALGORITHM_HMAC_SHA1",
-               "AUTH_ALGORITHM_DES_MAC",
-               "AUTH_ALGORITHM_KPDK",
-               "AUTH_ALGORITHM_HMAC_SHA2_256",
-               "AUTH_ALGORITHM_HMAC_SHA2_384",
-               "AUTH_ALGORITHM_HMAC_SHA2_512",
-               "AUTH_ALGORITHM_HMAC_RIPEMD",
-               "AUTH_ALGORITHM_AES_XCBC_MAC",
-               "AUTH_ALGORITHM_SIG_RSA"
-       };
+       "AUTH_ALGORITHM_HMAC_MD5",
+       "AUTH_ALGORITHM_HMAC_SHA1",
+       "AUTH_ALGORITHM_DES_MAC",
+       "AUTH_ALGORITHM_KPDK",
+       "AUTH_ALGORITHM_HMAC_SHA2_256",
+       "AUTH_ALGORITHM_HMAC_SHA2_384",
+       "AUTH_ALGORITHM_HMAC_SHA2_512",
+       "AUTH_ALGORITHM_HMAC_RIPEMD",
+       "AUTH_ALGORITHM_AES_XCBC_MAC",
+       "AUTH_ALGORITHM_SIG_RSA"
+};
 
 static const char *const extended_auth_alg_name[] = {
                "AUTH_ALGORITHM_NULL"
@@ -711,10 +701,10 @@ enum_names auth_alg_names =
 
 /* From draft-beaulieu-ike-xauth */
 static const char *const xauth_type_name[] = {
-  "Generic",
-  "RADIUS-CHAP",
-  "OTP",
-  "S/KEY",
+       "Generic",
+       "RADIUS-CHAP",
+       "OTP",
+       "S/KEY",
 };
 
 enum_names xauth_type_names =
@@ -722,77 +712,77 @@ enum_names xauth_type_names =
 
 /* From draft-beaulieu-ike-xauth */
 static const char *const xauth_attr_tv_name[] = {
-               "XAUTH_TYPE",
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               NULL,
-               "XAUTH_STATUS",
-       };
+       "XAUTH_TYPE",
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       NULL,
+       "XAUTH_STATUS",
+};
 
 enum_names xauth_attr_tv_names = {
        XAUTH_TYPE   + ISAKMP_ATTR_AF_TV,
        XAUTH_STATUS + ISAKMP_ATTR_AF_TV, xauth_attr_tv_name, NULL };
 
 static const char *const unity_attr_name[] = {
-               "UNITY_BANNER",
-               "UNITY_SAVE_PASSWD",
-               "UNITY_DEF_DOMAIN",
-               "UNITY_SPLITDNS_NAME",
-               "UNITY_SPLIT_INCLUDE",
-               "UNITY_NATT_PORT",
-               "UNITY_LOCAL_LAN",
-               "UNITY_PFS",
-               "UNITY_FW_TYPE",
-               "UNITY_BACKUP_SERVERS",
-               "UNITY_DDNS_HOSTNAME",
+       "UNITY_BANNER",
+       "UNITY_SAVE_PASSWD",
+       "UNITY_DEF_DOMAIN",
+       "UNITY_SPLITDNS_NAME",
+       "UNITY_SPLIT_INCLUDE",
+       "UNITY_NATT_PORT",
+       "UNITY_LOCAL_LAN",
+       "UNITY_PFS",
+       "UNITY_FW_TYPE",
+       "UNITY_BACKUP_SERVERS",
+       "UNITY_DDNS_HOSTNAME",
 };
 
 enum_names unity_attr_names =
        { UNITY_BANNER , UNITY_DDNS_HOSTNAME, unity_attr_name , &xauth_attr_tv_names };
 
 static const char *const microsoft_attr_name[] = {
-               "INTERNAL_IP4_SERVER",
-               "INTERNAL_IP6_SERVER",
+       "INTERNAL_IP4_SERVER",
+       "INTERNAL_IP6_SERVER",
 };
 
 enum_names microsoft_attr_names =
        { INTERNAL_IP4_SERVER, INTERNAL_IP6_SERVER, microsoft_attr_name , &unity_attr_names };
 
 static const char *const xauth_attr_name[] = {
-               "XAUTH_USER_NAME",
-               "XAUTH_USER_PASSWORD",
-               "XAUTH_PASSCODE",
-               "XAUTH_MESSAGE",
-               "XAUTH_CHALLENGE",
-               "XAUTH_DOMAIN",
-               "XAUTH_STATUS (wrong TLV syntax, should be TV)",
-               "XAUTH_NEXT_PIN",
-               "XAUTH_ANSWER",
-       };
+       "XAUTH_USER_NAME",
+       "XAUTH_USER_PASSWORD",
+       "XAUTH_PASSCODE",
+       "XAUTH_MESSAGE",
+       "XAUTH_CHALLENGE",
+       "XAUTH_DOMAIN",
+       "XAUTH_STATUS (wrong TLV syntax, should be TV)",
+       "XAUTH_NEXT_PIN",
+       "XAUTH_ANSWER",
+};
 
 enum_names xauth_attr_names =
        { XAUTH_USER_NAME , XAUTH_ANSWER, xauth_attr_name , &microsoft_attr_names };
 
 static const char *const modecfg_attr_name[] = {
-               "INTERNAL_IP4_ADDRESS",
-               "INTERNAL_IP4_NETMASK",
-               "INTERNAL_IP4_DNS",
-               "INTERNAL_IP4_NBNS",
-               "INTERNAL_ADDRESS_EXPIRY",
-               "INTERNAL_IP4_DHCP",
-               "APPLICATION_VERSION",
-               "INTERNAL_IP6_ADDRESS",
-               "INTERNAL_IP6_NETMASK",
-               "INTERNAL_IP6_DNS",
-               "INTERNAL_IP6_NBNS",
-               "INTERNAL_IP6_DHCP",
-               "INTERNAL_IP4_SUBNET",
-               "SUPPORTED_ATTRIBUTES",
-               "INTERNAL_IP6_SUBNET",
-       };
+       "INTERNAL_IP4_ADDRESS",
+       "INTERNAL_IP4_NETMASK",
+       "INTERNAL_IP4_DNS",
+       "INTERNAL_IP4_NBNS",
+       "INTERNAL_ADDRESS_EXPIRY",
+       "INTERNAL_IP4_DHCP",
+       "APPLICATION_VERSION",
+       "INTERNAL_IP6_ADDRESS",
+       "INTERNAL_IP6_NETMASK",
+       "INTERNAL_IP6_DNS",
+       "INTERNAL_IP6_NBNS",
+       "INTERNAL_IP6_DHCP",
+       "INTERNAL_IP4_SUBNET",
+       "SUPPORTED_ATTRIBUTES",
+       "INTERNAL_IP6_SUBNET",
+};
 
 enum_names modecfg_attr_names =
        { INTERNAL_IP4_ADDRESS, INTERNAL_IP6_SUBNET, modecfg_attr_name , &xauth_attr_names };
@@ -800,9 +790,9 @@ enum_names modecfg_attr_names =
 /* Oakley Lifetime Type attribute */
 
 static const char *const oakley_lifetime_name[] = {
-               "OAKLEY_LIFE_SECONDS",
-               "OAKLEY_LIFE_KILOBYTES",
-       };
+       "OAKLEY_LIFE_SECONDS",
+       "OAKLEY_LIFE_KILOBYTES",
+};
 
 enum_names oakley_lifetime_names =
        { OAKLEY_LIFE_SECONDS, OAKLEY_LIFE_KILOBYTES, oakley_lifetime_name, NULL };
@@ -815,29 +805,31 @@ enum_names oakley_prf_names =
 /* Oakley Encryption Algorithm attribute */
 
 static const char *const oakley_enc_name[] = {
-               "OAKLEY_DES_CBC",
-               "OAKLEY_IDEA_CBC",
-               "OAKLEY_BLOWFISH_CBC",
-               "OAKLEY_RC5_R16_B64_CBC",
-               "OAKLEY_3DES_CBC",
-               "OAKLEY_CAST_CBC",
-               "OAKLEY_AES_CBC",
-       };
+       "OAKLEY_DES_CBC",
+       "OAKLEY_IDEA_CBC",
+       "OAKLEY_BLOWFISH_CBC",
+       "OAKLEY_RC5_R16_B64_CBC",
+       "OAKLEY_3DES_CBC",
+       "OAKLEY_CAST_CBC",
+       "OAKLEY_AES_CBC",
+};
 
 #ifdef NO_EXTRA_IKE
 enum_names oakley_enc_names =
        { OAKLEY_DES_CBC, OAKLEY_AES_CBC, oakley_enc_name, NULL };
 #else
 static const char *const oakley_enc_name_draft_aes_cbc_02[] = {
-               "OAKLEY_MARS_CBC"       /*      65001   */,
-               "OAKLEY_RC6_CBC"        /*      65002   */,
-               "OAKLEY_ID_65003"       /*      65003   */,
-               "OAKLEY_SERPENT_CBC"    /*      65004   */,
-               "OAKLEY_TWOFISH_CBC"    /*      65005   */,
+       "OAKLEY_MARS_CBC"       /*      65001   */,
+       "OAKLEY_RC6_CBC"        /*      65002   */,
+       "OAKLEY_ID_65003"       /*      65003   */,
+       "OAKLEY_SERPENT_CBC"    /*      65004   */,
+       "OAKLEY_TWOFISH_CBC"    /*      65005   */,
 };
+
 static const char *const oakley_enc_name_ssh[] = {
                "OAKLEY_TWOFISH_CBC_SSH",
 };
+
 enum_names oakley_enc_names_ssh =
        { OAKLEY_TWOFISH_CBC_SSH, OAKLEY_TWOFISH_CBC_SSH, oakley_enc_name_ssh
                , NULL };
@@ -854,13 +846,13 @@ enum_names oakley_enc_names =
 /* Oakley Hash Algorithm attribute */
 
 static const char *const oakley_hash_name[] = {
-               "OAKLEY_MD5",
-               "OAKLEY_SHA",
-               "OAKLEY_TIGER",
-               "OAKLEY_SHA2_256",
-               "OAKLEY_SHA2_384",
-               "OAKLEY_SHA2_512",
-       };
+       "OAKLEY_MD5",
+       "OAKLEY_SHA",
+       "OAKLEY_TIGER",
+       "OAKLEY_SHA2_256",
+       "OAKLEY_SHA2_384",
+       "OAKLEY_SHA2_512",
+};
 
 enum_names oakley_hash_names =
        { OAKLEY_MD5, OAKLEY_SHA2_512, oakley_hash_name, NULL };
@@ -868,34 +860,34 @@ enum_names oakley_hash_names =
 /* Oakley Authentication Method attribute */
 
 static const char *const oakley_auth_name1[] = {
-               "OAKLEY_PRESHARED_KEY",
-               "OAKLEY_DSS_SIG",
-               "OAKLEY_RSA_SIG",
-               "OAKLEY_RSA_ENC",
-               "OAKLEY_RSA_ENC_REV",
-               "OAKLEY_ELGAMAL_ENC",
-               "OAKLEY_ELGAMAL_ENC_REV",
-       };
+       "OAKLEY_PRESHARED_KEY",
+       "OAKLEY_DSS_SIG",
+       "OAKLEY_RSA_SIG",
+       "OAKLEY_RSA_ENC",
+       "OAKLEY_RSA_ENC_REV",
+       "OAKLEY_ELGAMAL_ENC",
+       "OAKLEY_ELGAMAL_ENC_REV",
+};
 
 static const char *const oakley_auth_name2[] = {
-               "HybridInitRSA",
-               "HybridRespRSA",
-               "HybridInitDSS",
-               "HybridRespDSS",
-       };
+       "HybridInitRSA",
+       "HybridRespRSA",
+       "HybridInitDSS",
+       "HybridRespDSS",
+};
 
 static const char *const oakley_auth_name3[] = {
-               "XAUTHInitPreShared",
-               "XAUTHRespPreShared",
-               "XAUTHInitDSS",
-               "XAUTHRespDSS",
-               "XAUTHInitRSA",
-               "XAUTHRespRSA",
-               "XAUTHInitRSAEncryption",
-               "XAUTHRespRSAEncryption",
-               "XAUTHInitRSARevisedEncryption",
-               "XAUTHRespRSARevisedEncryption",
-       };
+       "XAUTHInitPreShared",
+       "XAUTHRespPreShared",
+       "XAUTHInitDSS",
+       "XAUTHRespDSS",
+       "XAUTHInitRSA",
+       "XAUTHRespRSA",
+       "XAUTHInitRSAEncryption",
+       "XAUTHRespRSAEncryption",
+       "XAUTHInitRSARevisedEncryption",
+       "XAUTHRespRSARevisedEncryption",
+};
 
 static enum_names oakley_auth_names1 =
        { OAKLEY_PRESHARED_KEY, OAKLEY_ELGAMAL_ENC_REV
@@ -912,20 +904,21 @@ enum_names oakley_auth_names =
 /* Oakley Group Description attribute */
 
 static const char *const oakley_group_name[] = {
-               "OAKLEY_GROUP_MODP768",
-               "OAKLEY_GROUP_MODP1024",
-               "OAKLEY_GROUP_GP155",
-               "OAKLEY_GROUP_GP185",
-               "OAKLEY_GROUP_MODP1536",
-       };
+       "OAKLEY_GROUP_MODP768",
+       "OAKLEY_GROUP_MODP1024",
+       "OAKLEY_GROUP_GP155",
+       "OAKLEY_GROUP_GP185",
+       "OAKLEY_GROUP_MODP1536",
+};
 
 static const char *const oakley_group_name_rfc3526[] = {
-               "OAKLEY_GROUP_MODP2048",
-               "OAKLEY_GROUP_MODP3072",
-               "OAKLEY_GROUP_MODP4096",
-               "OAKLEY_GROUP_MODP6144",
-               "OAKLEY_GROUP_MODP8192"
+       "OAKLEY_GROUP_MODP2048",
+       "OAKLEY_GROUP_MODP3072",
+       "OAKLEY_GROUP_MODP4096",
+       "OAKLEY_GROUP_MODP6144",
+       "OAKLEY_GROUP_MODP8192"
 };
+
 enum_names oakley_group_names_rfc3526 =
        { OAKLEY_GROUP_MODP2048, OAKLEY_GROUP_MODP8192,
                        oakley_group_name_rfc3526, NULL };
@@ -937,10 +930,10 @@ enum_names oakley_group_names =
 /* Oakley Group Type attribute */
 
 static const char *const oakley_group_type_name[] = {
-               "OAKLEY_GROUP_TYPE_MODP",
-               "OAKLEY_GROUP_TYPE_ECP",
-               "OAKLEY_GROUP_TYPE_EC2N",
-       };
+       "OAKLEY_GROUP_TYPE_MODP",
+       "OAKLEY_GROUP_TYPE_ECP",
+       "OAKLEY_GROUP_TYPE_EC2N",
+};
 
 enum_names oakley_group_type_names =
        { OAKLEY_GROUP_TYPE_MODP, OAKLEY_GROUP_TYPE_EC2N, oakley_group_type_name, NULL };
@@ -948,51 +941,51 @@ enum_names oakley_group_type_names =
 /* Notify messages -- error types */
 
 static const char *const notification_name[] = {
-               "INVALID_PAYLOAD_TYPE",
-               "DOI_NOT_SUPPORTED",
-               "SITUATION_NOT_SUPPORTED",
-               "INVALID_COOKIE",
-               "INVALID_MAJOR_VERSION",
-               "INVALID_MINOR_VERSION",
-               "INVALID_EXCHANGE_TYPE",
-               "INVALID_FLAGS",
-               "INVALID_MESSAGE_ID",
-               "INVALID_PROTOCOL_ID",
-               "INVALID_SPI",
-               "INVALID_TRANSFORM_ID",
-               "ATTRIBUTES_NOT_SUPPORTED",
-               "NO_PROPOSAL_CHOSEN",
-               "BAD_PROPOSAL_SYNTAX",
-               "PAYLOAD_MALFORMED",
-               "INVALID_KEY_INFORMATION",
-               "INVALID_ID_INFORMATION",
-               "INVALID_CERT_ENCODING",
-               "INVALID_CERTIFICATE",
-               "CERT_TYPE_UNSUPPORTED",
-               "INVALID_CERT_AUTHORITY",
-               "INVALID_HASH_INFORMATION",
-               "AUTHENTICATION_FAILED",
-               "INVALID_SIGNATURE",
-               "ADDRESS_NOTIFICATION",
-               "NOTIFY_SA_LIFETIME",
-               "CERTIFICATE_UNAVAILABLE",
-               "UNSUPPORTED_EXCHANGE_TYPE",
-               "UNEQUAL_PAYLOAD_LENGTHS",
-       };
+       "INVALID_PAYLOAD_TYPE",
+       "DOI_NOT_SUPPORTED",
+       "SITUATION_NOT_SUPPORTED",
+       "INVALID_COOKIE",
+       "INVALID_MAJOR_VERSION",
+       "INVALID_MINOR_VERSION",
+       "INVALID_EXCHANGE_TYPE",
+       "INVALID_FLAGS",
+       "INVALID_MESSAGE_ID",
+       "INVALID_PROTOCOL_ID",
+       "INVALID_SPI",
+       "INVALID_TRANSFORM_ID",
+       "ATTRIBUTES_NOT_SUPPORTED",
+       "NO_PROPOSAL_CHOSEN",
+       "BAD_PROPOSAL_SYNTAX",
+       "PAYLOAD_MALFORMED",
+       "INVALID_KEY_INFORMATION",
+       "INVALID_ID_INFORMATION",
+       "INVALID_CERT_ENCODING",
+       "INVALID_CERTIFICATE",
+       "CERT_TYPE_UNSUPPORTED",
+       "INVALID_CERT_AUTHORITY",
+       "INVALID_HASH_INFORMATION",
+       "AUTHENTICATION_FAILED",
+       "INVALID_SIGNATURE",
+       "ADDRESS_NOTIFICATION",
+       "NOTIFY_SA_LIFETIME",
+       "CERTIFICATE_UNAVAILABLE",
+       "UNSUPPORTED_EXCHANGE_TYPE",
+       "UNEQUAL_PAYLOAD_LENGTHS",
+};
 
 static const char *const notification_status_name[] = {
-               "CONNECTED",
-       };
+       "CONNECTED",
+};
 
 static const char *const ipsec_notification_name[] = {
-               "IPSEC_RESPONDER_LIFETIME",
-               "IPSEC_REPLAY_STATUS",
-               "IPSEC_INITIAL_CONTACT",
-       };
+       "IPSEC_RESPONDER_LIFETIME",
+       "IPSEC_REPLAY_STATUS",
+       "IPSEC_INITIAL_CONTACT",
+};
 
 static const char *const notification_dpd_name[] = {
-               "R_U_THERE",
-               "R_U_THERE_ACK",
+       "R_U_THERE",
+       "R_U_THERE_ACK",
 };
 
 enum_names notification_dpd_names =
@@ -1015,13 +1008,13 @@ enum_names notification_names =
  * From draft-dukes-ike-mode-cfg
  */
 const char *const attr_msg_type_name[] = {
-               "ISAKMP_CFG_RESERVED",
-               "ISAKMP_CFG_REQUEST",
-               "ISAKMP_CFG_REPLY",
-               "ISAKMP_CFG_SET",
-               "ISAKMP_CFG_ACK",
-               NULL
-       };
+       "ISAKMP_CFG_RESERVED",
+       "ISAKMP_CFG_REQUEST",
+       "ISAKMP_CFG_REPLY",
+       "ISAKMP_CFG_SET",
+       "ISAKMP_CFG_ACK",
+       NULL
+};
 
 enum_names attr_msg_type_names =
        { 0 , ISAKMP_CFG_ACK, attr_msg_type_name , NULL };
@@ -1029,12 +1022,12 @@ enum_names attr_msg_type_names =
 /* socket address family info */
 
 static const char *const af_inet_name[] = {
-               "AF_INET",
-       };
+       "AF_INET",
+};
 
 static const char *const af_inet6_name[] = {
-               "AF_INET6",
-       };
+       "AF_INET6",
+};
 
 static enum_names af_names6 = { AF_INET6, AF_INET6, af_inet6_name, NULL };
 
@@ -1045,24 +1038,24 @@ static ip_subnet ipv4_wildcard, ipv6_wildcard;
 static ip_subnet ipv4_all, ipv6_all;
 
 const struct af_info af_inet4_info = {
-               AF_INET,
-               "AF_INET",
-               sizeof(struct in_addr),
-               sizeof(struct sockaddr_in),
-               32,
-               ID_IPV4_ADDR, ID_IPV4_ADDR_SUBNET, ID_IPV4_ADDR_RANGE,
-               &ipv4_any, &ipv4_wildcard, &ipv4_all,
-       };
+       AF_INET,
+       "AF_INET",
+       sizeof(struct in_addr),
+       sizeof(struct sockaddr_in),
+       32,
+       ID_IPV4_ADDR, ID_IPV4_ADDR_SUBNET, ID_IPV4_ADDR_RANGE,
+       &ipv4_any, &ipv4_wildcard, &ipv4_all,
+};
 
 const struct af_info af_inet6_info = {
-               AF_INET6,
-               "AF_INET6",
-               sizeof(struct in6_addr),
-               sizeof(struct sockaddr_in6),
-               128,
-               ID_IPV6_ADDR, ID_IPV6_ADDR_SUBNET, ID_IPV6_ADDR_RANGE,
-               &ipv6_any, &ipv6_wildcard, &ipv6_all,
-       };
+       AF_INET6,
+       "AF_INET6",
+       sizeof(struct in6_addr),
+       sizeof(struct sockaddr_in6),
+       128,
+       ID_IPV6_ADDR, ID_IPV6_ADDR_SUBNET, ID_IPV6_ADDR_RANGE,
+       &ipv6_any, &ipv6_wildcard, &ipv6_all,
+};
 
 const struct af_info *
 aftoinfo(int af)
@@ -1092,62 +1085,62 @@ subnetisnone(const ip_subnet *sn)
 #include <arpa/nameser.h>
 
 static const char *const rr_type_name[] = {
-               "T_A",  /* 1 host address */
-               "T_NS", /* 2 authoritative server */
-               "T_MD", /* 3 mail destination */
-               "T_MF", /* 4 mail forwarder */
-               "T_CNAME",      /* 5 canonical name */
-               "T_SOA",        /* 6 start of authority zone */
-               "T_MB", /* 7 mailbox domain name */
-               "T_MG", /* 8 mail group member */
-               "T_MR", /* 9 mail rename name */
-               "T_NULL",       /* 10 null resource record */
-               "T_WKS",        /* 11 well known service */
-               "T_PTR",        /* 12 domain name pointer */
-               "T_HINFO",      /* 13 host information */
-               "T_MINFO",      /* 14 mailbox information */
-               "T_MX", /* 15 mail routing information */
-               "T_TXT",        /* 16 text strings */
-               "T_RP", /* 17 responsible person */
-               "T_AFSDB",      /* 18 AFS cell database */
-               "T_X25",        /* 19 X_25 calling address */
-               "T_ISDN",       /* 20 ISDN calling address */
-               "T_RT", /* 21 router */
-               "T_NSAP",       /* 22 NSAP address */
-               "T_NSAP_PTR",   /* 23 reverse NSAP lookup (deprecated) */
-               "T_SIG",        /* 24 security signature */
-               "T_KEY",        /* 25 security key */
-               "T_PX", /* 26 X.400 mail mapping */
-               "T_GPOS",       /* 27 geographical position (withdrawn) */
-               "T_AAAA",       /* 28 IP6 Address */
-               "T_LOC",        /* 29 Location Information */
-               "T_NXT",        /* 30 Next Valid Name in Zone */
-               "T_EID",        /* 31 Endpoint identifier */
-               "T_NIMLOC",     /* 32 Nimrod locator */
-               "T_SRV",        /* 33 Server selection */
-               "T_ATMA",       /* 34 ATM Address */
-               "T_NAPTR",      /* 35 Naming Authority PoinTeR */
-               NULL
-       };
+       "T_A",  /* 1 host address */
+       "T_NS", /* 2 authoritative server */
+       "T_MD", /* 3 mail destination */
+       "T_MF", /* 4 mail forwarder */
+       "T_CNAME",      /* 5 canonical name */
+       "T_SOA",        /* 6 start of authority zone */
+       "T_MB", /* 7 mailbox domain name */
+       "T_MG", /* 8 mail group member */
+       "T_MR", /* 9 mail rename name */
+       "T_NULL",       /* 10 null resource record */
+       "T_WKS",        /* 11 well known service */
+       "T_PTR",        /* 12 domain name pointer */
+       "T_HINFO",      /* 13 host information */
+       "T_MINFO",      /* 14 mailbox information */
+       "T_MX", /* 15 mail routing information */
+       "T_TXT",        /* 16 text strings */
+       "T_RP", /* 17 responsible person */
+       "T_AFSDB",      /* 18 AFS cell database */
+       "T_X25",        /* 19 X_25 calling address */
+       "T_ISDN",       /* 20 ISDN calling address */
+       "T_RT", /* 21 router */
+       "T_NSAP",       /* 22 NSAP address */
+       "T_NSAP_PTR",   /* 23 reverse NSAP lookup (deprecated) */
+       "T_SIG",        /* 24 security signature */
+       "T_KEY",        /* 25 security key */
+       "T_PX", /* 26 X.400 mail mapping */
+       "T_GPOS",       /* 27 geographical position (withdrawn) */
+       "T_AAAA",       /* 28 IP6 Address */
+       "T_LOC",        /* 29 Location Information */
+       "T_NXT",        /* 30 Next Valid Name in Zone */
+       "T_EID",        /* 31 Endpoint identifier */
+       "T_NIMLOC",     /* 32 Nimrod locator */
+       "T_SRV",        /* 33 Server selection */
+       "T_ATMA",       /* 34 ATM Address */
+       "T_NAPTR",      /* 35 Naming Authority PoinTeR */
+       NULL
+};
 
 enum_names rr_type_names = { T_A, T_NAPTR, rr_type_name, NULL };
 
 /* Query type values which do not appear in resource records */
 static const char *const rr_qtype_name[] = {
-               "T_IXFR",       /* 251 incremental zone transfer */
-               "T_AXFR",       /* 252 transfer zone of authority */
-               "T_MAILB",      /* 253 transfer mailbox records */
-               "T_MAILA",      /* 254 transfer mail agent records */
-               "T_ANY",        /* 255 wildcard match */
-               NULL
-       };
+       "T_IXFR",       /* 251 incremental zone transfer */
+       "T_AXFR",       /* 252 transfer zone of authority */
+       "T_MAILB",      /* 253 transfer mailbox records */
+       "T_MAILA",      /* 254 transfer mail agent records */
+       "T_ANY",        /* 255 wildcard match */
+       NULL
+};
 
 enum_names rr_qtype_names = { T_IXFR, T_ANY, rr_qtype_name, &rr_type_names };
 
 static const char *const rr_class_name[] = {
-               "C_IN", /* 1 the arpa internet */
-               NULL
-       };
+       "C_IN", /* 1 the arpa internet */
+       NULL
+};
 
 enum_names rr_class_names = { C_IN, C_IN, rr_class_name, NULL };
 
@@ -1156,19 +1149,19 @@ enum_names rr_class_names = { C_IN, C_IN, rr_class_name, NULL };
  *
  */
 const char *const natt_type_bitnames[] = {
-  "draft-ietf-ipsec-nat-t-ike-00/01",    /* 0 */
-  "draft-ietf-ipsec-nat-t-ike-02/03",
-  "RFC 3947",
-  "3",                                   /* 3 */
-  "4",   "5",   "6",   "7",
-  "8",   "9",   "10",  "11",
-  "12",  "13",  "14",  "15",
-  "16",  "17",  "18",  "19", 
-  "20",  "21",  "22",  "23",
-  "24",  "25",  "26",  "27",
-  "28",  "29",
-  "nat is behind me",
-  "nat is behind peer"
+       "draft-ietf-ipsec-nat-t-ike-00/01",    /* 0 */
+       "draft-ietf-ipsec-nat-t-ike-02/03",
+       "RFC 3947",
+       "3",                                   /* 3 */
+       "4",   "5",   "6",   "7",
+       "8",   "9",   "10",  "11",
+       "12",  "13",  "14",  "15",
+       "16",  "17",  "18",  "19", 
+       "20",  "21",  "22",  "23",
+       "24",  "25",  "26",  "27",
+       "28",  "29",
+       "nat is behind me",
+       "nat is behind peer"
 };
 
 /* look up enum names in an enum_names */
index f069402..75e2d10 100644 (file)
@@ -320,7 +320,7 @@ typedef enum {
 
 /* RFC 2459 CRL reason codes */
 
-extern enum_namecrl_reason_names;
+extern enum_name_t *crl_reason_names;
 
 typedef enum {
        REASON_UNSPECIFIED =                0,
@@ -335,7 +335,7 @@ typedef enum {
 
 /* RFC 3706 Dead Peer Detection */
 
-extern enum_namedpd_action_names;
+extern enum_name_t *dpd_action_names;
 
 typedef enum {
        DPD_ACTION_NONE =    0,
@@ -347,7 +347,7 @@ typedef enum {
 
 /* Timer events */
 
-extern enum_nametimer_event_names;
+extern enum_name_t *timer_event_names;
 
 enum event_type {
        EVENT_NULL, /* non-event */
@@ -798,15 +798,16 @@ typedef u_int16_t cpi_t;
 
 extern enum_names ident_names;
 extern enum_names cert_type_names;
-extern enum_names cert_policy_names;
+
+extern enum_name_t *cert_policy_names;
 
 typedef enum certpolicy {
-  CERT_ALWAYS_SEND   = 0,       /* the default */
-  CERT_SEND_IF_ASKED = 1,
-  CERT_NEVER_SEND    = 2,
+       CERT_ALWAYS_SEND   = 0,       /* the default */
+       CERT_SEND_IF_ASKED = 1,
+       CERT_NEVER_SEND    = 2,
 
-  CERT_YES_SEND      = 3,       /* synonym for CERT_ALWAYS_SEND */
-  CERT_NO_SEND       = 4        /* synonym for CERT_NEVER_SEND  */
+       CERT_YES_SEND      = 3,       /* synonym for CERT_ALWAYS_SEND */
+       CERT_NO_SEND       = 4        /* synonym for CERT_NEVER_SEND  */
 } certpolicy_t;
 
 /* Policies for establishing an SA
index 21ea8e0..d186aba 100644 (file)
@@ -391,7 +391,7 @@ parse_crl_reasonCode(chunk_t object)
        }
 
        DBG(DBG_PARSING,
-               DBG_log("  '%s'", enum_name(&crl_reason_names, reason))
+               DBG_log("  '%N'", crl_reason_names, reason)
        )
        return reason;
 }
index c345fb7..2f3de9c 100644 (file)
@@ -3573,8 +3573,7 @@ main_inR2_outI3(struct msg_digest *md)
        if (RSA_auth)
        {
                DBG(DBG_CONTROL,
-                       DBG_log("our certificate policy is %s"
-                               , enum_name(&cert_policy_names, cert_policy))
+                       DBG_log("our certificate policy is %N", cert_policy_names, cert_policy)
                )
                if (mycert.type != CERT_NONE)
                {
@@ -3988,8 +3987,7 @@ main_inI3_outR3_tail(struct msg_digest *md
        if (RSA_auth)
        {
                DBG(DBG_CONTROL,
-                       DBG_log("our certificate policy is %s"
-                               , enum_name(&cert_policy_names, cert_policy))
+                       DBG_log("our certificate policy is %N", cert_policy_names, cert_policy)
                )
                if (mycert.type != CERT_NONE)
                {
index 29e57e1..e2fee60 100644 (file)
@@ -94,6 +94,9 @@ void library_init(char *settings)
                                         PRINTF_HOOK_ARGTYPE_END);
        pfh->add_handler(pfh, 'B', chunk_printf_hook,
                                         PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_END);
+       pfh->add_handler(pfh, 'N', enum_printf_hook,
+                                        PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
+                                        PRINTF_HOOK_ARGTYPE_END);
        pfh->add_handler(pfh, 'T', time_printf_hook,
                                         PRINTF_HOOK_ARGTYPE_POINTER, PRINTF_HOOK_ARGTYPE_INT,
                                         PRINTF_HOOK_ARGTYPE_END);
index b55407d..b54a54c 100644 (file)
@@ -746,12 +746,12 @@ void fmt_state(bool all, struct state *st, time_t n
        fmt_conn_instance(c, inst);
 
        snprintf(state_buf, state_buf_len
-               , "#%lu: \"%s\"%s %s (%s); %s in %lds%s%s%s%s"
+               , "#%lu: \"%s\"%s %s (%s); %N in %lds%s%s%s%s"
                , st->st_serialno
                , c->name, inst
                , enum_name(&state_names, st->st_state)
                , state_story[st->st_state - STATE_MAIN_R0]
-               , enum_name(&timer_event_names, st->st_event->ev_type)
+               , timer_event_names, st->st_event->ev_type
                , delta
                , np1, np2, eo, dpd);
 
index 12b9db1..c5b0803 100644 (file)
@@ -98,11 +98,11 @@ event_schedule(enum event_type type, time_t tm, struct state *st)
 
        DBG(DBG_CONTROL,
                if (st == NULL)
-                       DBG_log("inserting event %s, timeout in %lu seconds"
-                               , enum_show(&timer_event_names, type), (unsigned long)tm);
+                       DBG_log("inserting event %N, timeout in %lu seconds"
+                               , timer_event_names, type, (unsigned long)tm);
                else
-                       DBG_log("inserting event %s, timeout in %lu seconds for #%lu"
-                               , enum_show(&timer_event_names, type), (unsigned long)tm
+                       DBG_log("inserting event %N, timeout in %lu seconds for #%lu"
+                               , timer_event_names, type, (unsigned long)tm
                                , ev->ev_state->st_serialno));
 
        if (evlist == (struct event *) NULL
@@ -122,11 +122,11 @@ event_schedule(enum event_type type, time_t tm, struct state *st)
 #ifdef NEVER    /* this seems to be overkill */
                DBG(DBG_CONTROL,
                        if (evt->ev_state == NULL)
-                               DBG_log("event added after event %s"
-                                       , enum_show(&timer_event_names, evt->ev_type));
+                               DBG_log("event added after event %N"
+                                       , timer_event_names, evt->ev_type);
                        else
-                               DBG_log("event added after event %s for #%lu"
-                                       , enum_show(&timer_event_names, evt->ev_type)
+                               DBG_log("event added after event %N for #%lu"
+                                       , timer_event_names, evt->ev_type,
                                        , evt->ev_state->st_serialno));
 #endif /* NEVER */
 
@@ -161,9 +161,9 @@ handle_timer_event(void)
 
        if (tm < ev->ev_time)
        {
-               DBG(DBG_CONTROL, DBG_log("called while no event expired (%lu/%lu, %s)"
+               DBG(DBG_CONTROL, DBG_log("called while no event expired (%lu/%lu, %N)"
                        , (unsigned long)tm, (unsigned long)ev->ev_time
-                       , enum_show(&timer_event_names, type)));
+                       , timer_event_names, type));
 
                /* This will happen if the most close-to-expire event was
                 * a retransmission or cleanup, and we received a packet
@@ -178,8 +178,8 @@ handle_timer_event(void)
 
        DBG(DBG_CONTROL,
                if (evlist != (struct event *) NULL)
-                       DBG_log("event after this is %s in %ld seconds"
-                               , enum_show(&timer_event_names, evlist->ev_type)
+                       DBG_log("event after this is %N in %ld seconds"
+                               , timer_event_names, evlist->ev_type
                                , (long) (evlist->ev_time - tm)));
 
        /* for state-associated events, pick up the state pointer
@@ -428,8 +428,8 @@ handle_timer_event(void)
                        nat_traversal_ka_event();
                        break;
                default:
-                       loglog(RC_LOG_SERIOUS, "INTERNAL ERROR: ignoring unknown expiring event %s"
-                               , enum_show(&timer_event_names, type));
+                       loglog(RC_LOG_SERIOUS, "INTERNAL ERROR: ignoring unknown expiring event %N"
+                               , timer_event_names, type);
        }
 
        free(ev);
@@ -452,12 +452,12 @@ next_event(void)
 
        DBG(DBG_CONTROL,
                if (evlist->ev_state == NULL)
-                       DBG_log("next event %s in %ld seconds"
-                               , enum_show(&timer_event_names, evlist->ev_type)
+                       DBG_log("next event %N in %ld seconds"
+                               , timer_event_names, evlist->ev_type
                                , (long)evlist->ev_time - (long)tm);
                else
-                       DBG_log("next event %s in %ld seconds for #%lu"
-                               , enum_show(&timer_event_names, evlist->ev_type)
+                       DBG_log("next event %N in %ld seconds for #%lu"
+                               , timer_event_names, evlist->ev_type
                                , (long)evlist->ev_time - (long)tm
                                , evlist->ev_state->st_serialno));
 
@@ -481,8 +481,8 @@ delete_event(struct state *st)
                {
                        if (*ev == NULL)
                        {
-                               DBG(DBG_CONTROL, DBG_log("event %s to be deleted not found",
-                                       enum_show(&timer_event_names, st->st_event->ev_type)));
+                               DBG(DBG_CONTROL, DBG_log("event %N to be deleted not found",
+                                       timer_event_names, st->st_event->ev_type));
                                break;
                        }
                        if ((*ev) == st->st_event)
@@ -516,8 +516,8 @@ delete_dpd_event(struct state *st)
                {
                        if (*ev == NULL)
                        {
-                               DBG(DBG_CONTROL, DBG_log("event %s to be deleted not found",
-                                       enum_show(&timer_event_names, st->st_dpd_event->ev_type)));
+                               DBG(DBG_CONTROL, DBG_log("event %N to be deleted not found",
+                                       timer_event_names, st->st_dpd_event->ev_type));
                                break;
                        }
                        if ((*ev) == st->st_dpd_event)
index 988fc4d..5d308eb 100644 (file)
@@ -2245,9 +2245,9 @@ verify_x509cert(const x509cert_t *cert, bool strict, time_t *until)
                                }
                                break;
                        case CERT_REVOKED:
-                               plog("certificate was revoked on %T, reason: %s"
+                               plog("certificate was revoked on %T, reason: %N"
                                        , &revocationDate, TRUE
-                                       , enum_name(&crl_reason_names, revocationReason));
+                                       , crl_reason_names, revocationReason);
                                remove_x509_public_key(cert);
                                return FALSE;
                        case CERT_UNKNOWN: