Some minor refactoring/cleanup, including renaming functions.
-/* Copyright (C) 2007-2011 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* \file
*
* \author Victor Julien <victor@inliniac.net>
+ * \author Anoop Saldanha <anoopsaldanha@gmail.com>
*/
#include "suricata-common.h"
+#include "app-layer-protos.h"
#define CASE_CODE(E) case E: return #E
/**
- * \brief Maps the ALPROTO_*, to its string equivalent
+ * \brief Maps the ALPROTO_*, to its string equivalent.
*
- * \param proto app layer protocol id
+ * \param alproto App layer protocol id.
*
- * \retval string equivalent for the alproto
+ * \retval String equivalent for the alproto.
*/
-const char *TmModuleAlprotoToString(enum AppProto proto)
+const char *AppProtoToString(AppProto alproto)
{
const char *proto_name = NULL;
- switch (proto) {
+ switch (alproto) {
case ALPROTO_HTTP:
proto_name = "http";
break;
return proto_name;
}
-
-/* Copyright (C) 2007-2010 Open Information Security Foundation
+/* Copyright (C) 2007-2013 Open Information Security Foundation
*
* You can copy, redistribute or modify this Program under the terms of
* the GNU General Public License version 2 as published by the Free
* \file
*
* \author Victor Julien <victor@inliniac.net>
+ * \author Anoop Saldanha <anoopsaldanha@gmail.com>
*/
-#ifndef __APP_LAYER_PROTOS_H__
-#define __APP_LAYER_PROTOS_H__
+#ifndef __APP_LAYER_PROTOS__H__
+#define __APP_LAYER_PROTOS__H__
-enum AppProto {
+enum {
ALPROTO_UNKNOWN = 0,
ALPROTO_HTTP,
ALPROTO_FTP,
ALPROTO_MAX,
};
-const char *TmModuleAlprotoToString(enum AppProto proto);
+typedef uint16_t AppProto;
-#endif /* __APP_LAYER_PROTOS_H__ */
+const char *AppProtoToString(AppProto alproto);
+
+#endif /* __APP_LAYER_PROTOS__H__ */
if (http_stat_code_buf) fprintf(rule_engine_analysis_FD, " Rule matches on http stat code buffer.\n");
if (http_ua_buf) fprintf(rule_engine_analysis_FD, " Rule matches on http user agent buffer.\n");
if (s->alproto != ALPROTO_UNKNOWN) {
- fprintf(rule_engine_analysis_FD, " App layer protocol is %s.\n", TmModuleAlprotoToString(s->alproto));
+ fprintf(rule_engine_analysis_FD, " App layer protocol is %s.\n", AppProtoToString(s->alproto));
}
if (rule_content || rule_content_http || rule_pcre || rule_pcre_http) {
fprintf(rule_engine_analysis_FD, " Rule contains %d content options, %d http content options, %d pcre options, and %d pcre options with http modifiers.\n", rule_content, rule_content_http, rule_pcre, rule_pcre_http);
} else {
if (al_proto_table[s->alproto].to_server == 0 ||
al_proto_table[s->alproto].to_client == 0) {
- const char *proto_name = TmModuleAlprotoToString(s->alproto);
+ const char *proto_name = AppProtoToString(s->alproto);
SCLogInfo("Signature uses options that need the app layer "
"parser for \"%s\", but the parser's disabled "
"for the protocol. Please check if you have "
}
fprintf(packet_profile_csv_fp, "threading,");
for (i = 0; i < ALPROTO_MAX; i++) {
- fprintf(packet_profile_csv_fp, "%s,", TmModuleAlprotoToString(i));
+ fprintf(packet_profile_csv_fp, "%s,", AppProtoToString(i));
}
fprintf(packet_profile_csv_fp, "STREAM (no app),proto detect,");
for (i = 0; i < PROF_DETECT_SIZE; i++) {
(long double)total * 100;
fprintf(fp, "%-20s IPv4 %3d %12"PRIu64" %12"PRIu64" %12"PRIu64" %12"PRIu64" %12s %-6.2f\n",
- TmModuleAlprotoToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent);
+ AppProtoToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent);
}
}
(long double)total * 100;
fprintf(fp, "%-20s IPv6 %3d %12"PRIu64" %12"PRIu64" %12"PRIu64" %12"PRIu64" %12s %-6.2f\n",
- TmModuleAlprotoToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent);
+ AppProtoToString(m), p, pd->cnt, pd->min, pd->max, (uint64_t)(pd->tot / pd->cnt), totalstr, percent);
}
}