From 09ea27662cf245be6dc0ab9aada57de2de90011d Mon Sep 17 00:00:00 2001 From: Herwin Weststrate Date: Sun, 6 Jul 2014 12:55:03 +0200 Subject: [PATCH] Use enums instead of define lists in rlm_eap_peap But only for the values that are only used internally. --- src/modules/rlm_eap/types/rlm_eap_peap/eap_peap.h | 35 +++++++++++++---------- 1 file changed, 20 insertions(+), 15 deletions(-) diff --git a/src/modules/rlm_eap/types/rlm_eap_peap/eap_peap.h b/src/modules/rlm_eap/types/rlm_eap_peap/eap_peap.h index d08dee0..24907ff 100644 --- a/src/modules/rlm_eap/types/rlm_eap_peap/eap_peap.h +++ b/src/modules/rlm_eap/types/rlm_eap_peap/eap_peap.h @@ -28,12 +28,29 @@ RCSIDH(eap_peap_h, "$Id$") #include "eap_tls.h" #include +typedef enum { + PEAP_STATUS_INVALID, + PEAP_STATUS_SENT_TLV_SUCCESS, + PEAP_STATUS_SENT_TLV_FAILURE, + PEAP_STATUS_TUNNEL_ESTABLISHED, + PEAP_STATUS_INNER_IDENTITY_REQ_SENT, + PEAP_STATUS_PHASE2_INIT, + PEAP_STATUS_PHASE2, + PEAP_STATUS_WAIT_FOR_SOH_RESPONSE +} peap_status; + +typedef enum { + PEAP_RESUMPTION_NO, + PEAP_RESUMPTION_YES, + PEAP_RESUMPTION_MAYBE +} peap_resumption; + typedef struct peap_tunnel_t { VALUE_PAIR *username; VALUE_PAIR *state; VALUE_PAIR *accept_vps; - int status; - int home_access_accept; + peap_status status; + bool home_access_accept; int default_method; int copy_request_to_tunnel; int use_tunneled_reply; @@ -42,21 +59,9 @@ typedef struct peap_tunnel_t { int soh; char const *soh_virtual_server; VALUE_PAIR *soh_reply_vps; - int session_resumption_state; + peap_resumption session_resumption_state; } peap_tunnel_t; -#define PEAP_STATUS_INVALID 0 -#define PEAP_STATUS_SENT_TLV_SUCCESS 1 -#define PEAP_STATUS_SENT_TLV_FAILURE 2 -#define PEAP_STATUS_TUNNEL_ESTABLISHED 3 -#define PEAP_STATUS_INNER_IDENTITY_REQ_SENT 4 -#define PEAP_STATUS_PHASE2_INIT 5 -#define PEAP_STATUS_PHASE2 6 -#define PEAP_STATUS_WAIT_FOR_SOH_RESPONSE 7 - -#define PEAP_RESUMPTION_NO (0) -#define PEAP_RESUMPTION_YES (1) -#define PEAP_RESUMPTION_MAYBE (2) #define EAP_TLV_SUCCESS (1) #define EAP_TLV_FAILURE (2) -- 2.1.4