From 925aac854e687683d3b3c88cb6f5243a0fad8c50 Mon Sep 17 00:00:00 2001 From: Victor Julien Date: Mon, 15 Jun 2015 11:44:24 +0200 Subject: [PATCH] alproto: improve AppProtoToString Make AppProtoToString compilation fail on missing 'case's. --- src/app-layer-protos.c | 3 ++- src/app-layer-protos.h | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) 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; /**