]> git.ipfire.org Git - people/ms/suricata.git/blame - src/app-layer-smtp.h
smtp parser support
[people/ms/suricata.git] / src / app-layer-smtp.h
CommitLineData
576ec7da
AS
1/* Copyright (C) 2007-2010 Open Information Security Foundation
2 *
3 * You can copy, redistribute or modify this Program under the terms of
4 * the GNU General Public License version 2 as published by the Free
5 * Software Foundation.
6 *
7 * This program is distributed in the hope that it will be useful,
8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * version 2 along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18/**
19 * \file
20 *
21 * \author Anoop Saldanha <poonaatsoc@gmail.com>
22 */
23
24#ifndef __APP_LAYER_SMTP_H__
25#define __APP_LAYER_SMTP_H__
26
27typedef struct SMTPState_ {
28 /* current input that is being parsed */
29 uint8_t *input;
30 uint32_t input_len;
31
32 /* --parser details-- */
33 /* current line extracted by the parser from the call to SMTPGetline() */
34 uint8_t *current_line;
35 /* length of the line in current_line. Doesn't include the delimiter */
36 uint32_t current_line_len;
37 /* used to indicate if the current_line buffer is a malloced buffer. We
38 * use a malloced buffer, if a line is fragmented */
39 uint8_t current_line_buffer_dynamic;
40 /* we have see LF for the currently parsed line */
41 uint8_t current_line_lf_seen;
42 /* var to indicate parser state */
43 uint8_t parser_state;
44 /* current command in progress */
45 uint8_t current_command;
46
47 /* the request commands are store here and the reply handler uses these
48 * stored command in the buffer to match the reply(ies) with the command */
49 /* the command buffer */
50 uint8_t *cmds;
51 /* the buffer length */
52 uint8_t cmds_buffer_len;
53 /* no of commands stored in the above buffer */
54 uint8_t cmds_cnt;
55 /* index of the command in the buffer, currently in inspection by reply
56 * handler */
57 uint8_t cmds_idx;
58 /* padding - you can replace this if you want to. */
59 uint8_t pad;
60} SMTPState;
61
62void RegisterSMTPParsers(void);
63void SMTPParserRegisterTests(void);
64
65#endif /* __APP_LAYER_SMTP_H__ */