From d181365e3e085d2a39e56da73d3469ef4a867330 Mon Sep 17 00:00:00 2001 From: ccremers Date: Thu, 29 Jul 2004 11:26:59 +0000 Subject: [PATCH] - Removed some old-fashioned defines, replacing them with enum constants. --- src/role.h | 4 +--- src/symbol.h | 6 +----- src/tac.h | 42 ++++++++++++++++++++++-------------------- src/tracebuf.h | 11 ++++++----- 4 files changed, 30 insertions(+), 33 deletions(-) diff --git a/src/role.h b/src/role.h index 28a49ba..5244c25 100644 --- a/src/role.h +++ b/src/role.h @@ -8,9 +8,7 @@ #include "constraint.h" #include "states.h" -#define READ 1 -#define SEND 2 -#define CLAIM 3 +enum eventtype { READ, SEND, CLAIM }; //! The container for the claim info list struct claimlist diff --git a/src/symbol.h b/src/symbol.h index 2edf306..0194295 100644 --- a/src/symbol.h +++ b/src/symbol.h @@ -6,11 +6,7 @@ */ #define HASHSIZE 997 -#define T_UNDEF -1 -#define T_PROTOCOL 0 -#define T_CONST 1 -#define T_VAR 2 -#define T_SYSCONST 3 +enum symboltypes { T_UNDEF = -1, T_PROTOCOL, T_CONST, T_VAR, T_SYSCONST }; #define EOS 0 diff --git a/src/tac.h b/src/tac.h index a8cf871..d9f3a36 100644 --- a/src/tac.h +++ b/src/tac.h @@ -7,26 +7,28 @@ * TAC instructions */ -#define TAC_UNDEF 0 -#define TAC_SYM 1 -#define TAC_TUPLE 3 -#define TAC_ENCRYPT 4 -#define TAC_VAR 7 -#define TAC_CONST 8 -#define TAC_READ 9 -#define TAC_SEND 10 -#define TAC_CLAIM 11 -#define TAC_FUNC 12 -#define TAC_STRING 13 -#define TAC_ROLE 14 -#define TAC_PROTOCOL 15 -#define TAC_RUN 16 -#define TAC_ROLEREF 17 -#define TAC_SECRET 18 -#define TAC_INVERSEKEYS 19 -#define TAC_UNTRUSTED 20 -#define TAC_COMPROMISED 21 -#define TAC_USERTYPE 22 +enum tactypes { + TAC_UNDEF, + TAC_SYM, + TAC_TUPLE, + TAC_ENCRYPT, + TAC_VAR, + TAC_CONST, + TAC_READ, + TAC_SEND, + TAC_CLAIM, + TAC_FUNC, + TAC_STRING, + TAC_ROLE, + TAC_PROTOCOL, + TAC_RUN, + TAC_ROLEREF, + TAC_SECRET, + TAC_INVERSEKEYS, + TAC_UNTRUSTED, + TAC_COMPROMISED, + TAC_USERTYPE +}; struct tacnode { diff --git a/src/tracebuf.h b/src/tracebuf.h index 435634d..f7aa71e 100644 --- a/src/tracebuf.h +++ b/src/tracebuf.h @@ -7,11 +7,12 @@ #include "system.h" /* STATUS symbols */ -#define S_UNK 0 // UNKnown : unprocessed. -#define S_OKE 1 // OKE : done, but required for the attack. -#define S_RED 2 // REDundant : is not needed for attack, we're sure. -#define S_TOD 3 // TODo : The previous suggestion REQ was too similar to RED. - // This is reserved for reads. +enum statussymbols { + S_UNK, // UNKnown : unprocessed. + S_OKE, // OKE : done, but required for the attack. + S_RED, // REDundant : is not needed for attack, we're sure. + S_TOD // TODo : The previous suggestion REQ was too similar to RED. This is reserved for reads. +}; /*