1 //--------------------------------------------------------------------------
2 // Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved.
3 // Copyright (C) 2004-2013 Sourcefire, Inc.
4 //
5 // This program is free software; you can redistribute it and/or modify it
6 // under the terms of the GNU General Public License Version 2 as published
7 // by the Free Software Foundation.  You may not use, modify or distribute
8 // this program under any other version of the GNU General Public License.
9 //
10 // This program is distributed in the hope that it will be useful, but
11 // WITHOUT ANY WARRANTY; without even the implied warranty of
12 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13 // General Public License for more details.
14 //
15 // You should have received a copy of the GNU General Public License along
16 // with this program; if not, write to the Free Software Foundation, Inc.,
17 // 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
18 //--------------------------------------------------------------------------
19 
20 // pp_telnet.h author Steven A. Sturges <ssturges@sourcefire.com>
21 
22 #ifndef PP_TELNET_H
23 #define PP_TELNET_H
24 
25 // declares the telnet checking functions
26 
27 /* RFC 885 defines an End of Record telnet option */
28 #define RFC885
29 /* RFC 1184 defines Abort, Suspend, and End of File telnet options */
30 #define RFC1184
31 
32 #include "ftpp_si.h"
33 
34 /* define the telnet negotiation codes (TNC) that we're interested in */
35 #define TNC_IAC  0xFF
36 #define TNC_DONT 0xFE
37 #define TNC_DO   0xFD
38 #define TNC_WONT 0xFC
39 #define TNC_WILL 0xFB
40 #define TNC_SB   0xFA
41 #define TNC_GA   0xF9
42 #define TNC_EAL  0xF8
43 #define TNC_EAC  0xF7
44 #define TNC_AYT  0xF6
45 #define TNC_AO   0xF5
46 #define TNC_IP   0xF4
47 #define TNC_BRK  0xF3
48 #define TNC_DM   0xF2
49 #define TNC_NOP  0xF1
50 #define TNC_SE   0xF0
51 #ifdef RFC885
52 #define TNC_EOR  0xEF
53 #endif
54 #ifdef RFC1184
55 #define TNC_ABOR 0xEE
56 #define TNC_SUSP 0xED
57 #define TNC_EOF  0xEC
58 #endif
59 
60 #define FTPP_APPLY_TNC_ERASE_CMDS 0
61 #define FTPP_IGNORE_TNC_ERASE_CMDS 1
62 
63 struct DataBuffer;
64 
65 extern int normalize_telnet(
66     TELNET_SESSION*, snort::Packet*, DataBuffer&, int iMode, char ignoreEraseCmd, bool on_ftp_channel);
67 
68 void reset_telnet_buffer(snort::Packet*);
69 const uint8_t* get_telnet_buffer(snort::Packet*, unsigned&);
70 
71 #endif
72 
73