]>
Commit | Line | Data |
---|---|---|
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 | ||
27 | typedef 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-- */ | |
0468dbd5 | 34 | /** current line extracted by the parser from the call to SMTPGetline() */ |
576ec7da | 35 | uint8_t *current_line; |
0468dbd5 | 36 | /** length of the line in current_line. Doesn't include the delimiter */ |
88115902 AS |
37 | int32_t current_line_len; |
38 | ||
0468dbd5 | 39 | /** used to indicate if the current_line buffer is a malloced buffer. We |
88115902 AS |
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; | |
0468dbd5 | 44 | /** we have see LF for the currently parsed line */ |
88115902 AS |
45 | uint8_t tc_current_line_lf_seen; |
46 | ||
0468dbd5 | 47 | /** used to indicate if the current_line buffer is a malloced buffer. We |
576ec7da | 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; | |
0468dbd5 | 52 | /** we have see LF for the currently parsed line */ |
88115902 AS |
53 | uint8_t ts_current_line_lf_seen; |
54 | ||
0468dbd5 | 55 | /** var to indicate parser state */ |
576ec7da | 56 | uint8_t parser_state; |
0468dbd5 | 57 | /** current command in progress */ |
576ec7da AS |
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 */ | |
bc5c9f4a | 62 | /** the command buffer */ |
576ec7da | 63 | uint8_t *cmds; |
bc5c9f4a VJ |
64 | /** the buffer length */ |
65 | uint16_t cmds_buffer_len; | |
66 | /** no of commands stored in the above buffer */ | |
67 | uint16_t cmds_cnt; | |
68 | /** index of the command in the buffer, currently in inspection by reply | |
69 | * handler */ | |
70 | uint16_t cmds_idx; | |
576ec7da AS |
71 | } SMTPState; |
72 | ||
73 | void RegisterSMTPParsers(void); | |
74 | void SMTPParserRegisterTests(void); | |
75 | ||
76 | #endif /* __APP_LAYER_SMTP_H__ */ |