[Oisf-devel] [PATCH 6/8] convert action_type to enum

Eric Leblond eleblond at edenwall.com
Mon Jan 11 10:11:36 UTC 2010


This patch converts packet action type to an enum. This will
provide some facilities and ease bad value detection by gcc.
---
 src/action-globals.h |   14 ++++++++------
 src/decode.h         |    2 +-
 2 files changed, 9 insertions(+), 7 deletions(-)

diff --git a/src/action-globals.h b/src/action-globals.h
index be52791..6d2f6b7 100644
--- a/src/action-globals.h
+++ b/src/action-globals.h
@@ -2,11 +2,13 @@
 #ifndef __ACTION_GLOBALS_H__
 #define __ACTION_GLOBALS_H__
 
-#define ACTION_ALERT           0
-#define ACTION_DROP            1
-#define ACTION_REJECT          2
-#define ACTION_REJECT_DST      3
-#define ACTION_REJECT_BOTH     4
-#define ACTION_PASS            5
+enum action_type_t {
+    ACTION_ALERT,
+    ACTION_DROP,
+    ACTION_REJECT,
+    ACTION_REJECT_DST,
+    ACTION_REJECT_BOTH,
+    ACTION_PASS
+};
 
 #endif /* __ACTION_GLOBALS_H__ */
diff --git a/src/decode.h b/src/decode.h
index bead427..8f9d1e0 100644
--- a/src/decode.h
+++ b/src/decode.h
@@ -285,7 +285,7 @@ typedef struct Packet_
     PacketAlerts alerts;
 
     /* IPS action to take */
-    int action;
+    enum action_type_t action;
 
     /* double linked list ptrs */
     struct Packet_ *next;
-- 
1.6.6




More information about the Oisf-devel mailing list