]> git.ipfire.org Git - thirdparty/suricata.git/commitdiff
alproto: improve AppProtoToString 1549/head
authorVictor Julien <victor@inliniac.net>
Mon, 15 Jun 2015 09:44:24 +0000 (11:44 +0200)
committerVictor Julien <victor@inliniac.net>
Mon, 15 Jun 2015 09:44:24 +0000 (11:44 +0200)
Make AppProtoToString compilation fail on missing 'case's.

src/app-layer-protos.c
src/app-layer-protos.h

index 1abf295e18f9be2b6b45a83a29fae3d0f68dab49..0b8ed17bee7d4c518ddbb8ac4959f9d68580f5b3 100644 (file)
@@ -30,8 +30,9 @@
 const char *AppProtoToString(AppProto alproto)
 {
     const char *proto_name = NULL;
+    enum AppProtoEnum proto = alproto;
 
-    switch (alproto) {
+    switch (proto) {
         case ALPROTO_HTTP:
             proto_name = "http";
             break;
index ecfc4569e84b935a47752a4de5cbcb160cc3f787..79973661efc91f707751675b6bad7cabd0cd3342 100644 (file)
@@ -25,7 +25,7 @@
 #ifndef __APP_LAYER_PROTOS_H__
 #define __APP_LAYER_PROTOS_H__
 
-enum {
+enum AppProtoEnum {
     ALPROTO_UNKNOWN = 0,
     ALPROTO_HTTP,
     ALPROTO_FTP,
@@ -53,6 +53,7 @@ enum {
     ALPROTO_MAX,
 };
 
+/* not using the enum as that is a unsigned int, so 4 bytes */
 typedef uint16_t AppProto;
 
 /**