From: Eric Leblond Date: Wed, 29 Apr 2015 16:24:09 +0000 (+0200) Subject: decode-mime: add function to get status X-Git-Tag: suricata-3.0RC1~124 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=a233a982ea1495b0d473c8affecac5dbb4f66b20;p=thirdparty%2Fsuricata.git decode-mime: add function to get status This new function return the textual status of MIME parsing. --- diff --git a/src/util-decode-mime.c b/src/util-decode-mime.c index 312a9af493..718cdeb64b 100644 --- a/src/util-decode-mime.c +++ b/src/util-decode-mime.c @@ -81,7 +81,6 @@ /* Globally hold configuration data */ static MimeDecConfig mime_dec_config = { 1, 1, 1, 0, MAX_HEADER_VALUE }; -#ifdef DEBUG /* Mime Parser String translation */ static const char *StateFlags[] = { "NONE", "HEADER_READY", @@ -93,7 +92,6 @@ static const char *StateFlags[] = { "NONE", "PARSE_DONE", "PARSE_ERROR", NULL }; -#endif /* URL executable file extensions */ static const char *UrlExeExts[] = { ".exe", @@ -2265,6 +2263,11 @@ static int ProcessMimeBody(const uint8_t *buf, uint32_t len, return ret; } +const char *MimeDecParseStateGetStatus(MimeDecParseState *state) +{ + return StateFlags[state->state_flag]; +} + /** * \brief Processes the MIME Entity based on the input line and current state of * the parser diff --git a/src/util-decode-mime.h b/src/util-decode-mime.h index 020a1f1665..50d67a92a3 100644 --- a/src/util-decode-mime.h +++ b/src/util-decode-mime.h @@ -238,6 +238,7 @@ int MimeDecParseComplete(MimeDecParseState *state); int MimeDecParseLine(const uint8_t *line, const uint32_t len, MimeDecParseState *state); MimeDecEntity * MimeDecParseFullMsg(const uint8_t *buf, uint32_t blen, void *data, int (*DataChunkProcessorFunc)(const uint8_t *chunk, uint32_t len, MimeDecParseState *state)); +const char *MimeDecParseStateGetStatus(MimeDecParseState *state); /* Test functions */ void MimeDecRegisterTests(void);