From: Victor Julien Date: Mon, 15 Jun 2015 09:44:24 +0000 (+0200) Subject: alproto: improve AppProtoToString X-Git-Tag: suricata-3.0RC1~320 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=refs%2Fpull%2F1549%2Fhead;p=thirdparty%2Fsuricata.git alproto: improve AppProtoToString Make AppProtoToString compilation fail on missing 'case's. --- diff --git a/src/app-layer-protos.c b/src/app-layer-protos.c index 1abf295e18..0b8ed17bee 100644 --- a/src/app-layer-protos.c +++ b/src/app-layer-protos.c @@ -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; diff --git a/src/app-layer-protos.h b/src/app-layer-protos.h index ecfc4569e8..79973661ef 100644 --- a/src/app-layer-protos.h +++ b/src/app-layer-protos.h @@ -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; /**