]> git.ipfire.org Git - people/ms/suricata.git/blame - src/app-layer-smtp.h
Convert flow memcap to u64. Bug #332.
[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;
88115902
AS
30 int32_t input_len;
31 uint8_t direction;
576ec7da
AS
32
33 /* --parser details-- */
34 /* current line extracted by the parser from the call to SMTPGetline() */
35 uint8_t *current_line;
36 /* length of the line in current_line. Doesn't include the delimiter */
88115902
AS
37 int32_t current_line_len;
38
39 /* used to indicate if the current_line buffer is a malloced buffer. We
40 * use a malloced buffer, if a line is fragmented */
41 uint8_t *tc_db;
42 int32_t tc_db_len;
43 uint8_t tc_current_line_db;
44 /* we have see LF for the currently parsed line */
45 uint8_t tc_current_line_lf_seen;
46
576ec7da
AS
47 /* used to indicate if the current_line buffer is a malloced buffer. We
48 * use a malloced buffer, if a line is fragmented */
88115902
AS
49 uint8_t *ts_db;
50 int32_t ts_db_len;
51 uint8_t ts_current_line_db;
576ec7da 52 /* we have see LF for the currently parsed line */
88115902
AS
53 uint8_t ts_current_line_lf_seen;
54
576ec7da
AS
55 /* var to indicate parser state */
56 uint8_t parser_state;
57 /* current command in progress */
58 uint8_t current_command;
59
60 /* the request commands are store here and the reply handler uses these
61 * stored command in the buffer to match the reply(ies) with the command */
62 /* the command buffer */
63 uint8_t *cmds;
64 /* the buffer length */
65 uint8_t cmds_buffer_len;
66 /* no of commands stored in the above buffer */
67 uint8_t cmds_cnt;
68 /* index of the command in the buffer, currently in inspection by reply
69 * handler */
70 uint8_t cmds_idx;
576ec7da
AS
71} SMTPState;
72
73void RegisterSMTPParsers(void);
74void SMTPParserRegisterTests(void);
75
76#endif /* __APP_LAYER_SMTP_H__ */