1 //-------------------------------------------------------------------------- 2 // Copyright (C) 2014-2021 Cisco and/or its affiliates. All rights reserved. 3 // 4 // This program is free software; you can redistribute it and/or modify it 5 // under the terms of the GNU General Public License Version 2 as published 6 // by the Free Software Foundation. You may not use, modify or distribute 7 // this program under any other version of the GNU General Public License. 8 // 9 // This program is distributed in the hope that it will be useful, but 10 // WITHOUT ANY WARRANTY; without even the implied warranty of 11 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 12 // General Public License for more details. 13 // 14 // You should have received a copy of the GNU General Public License along 15 // with this program; if not, write to the Free Software Foundation, Inc., 16 // 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 17 //-------------------------------------------------------------------------- 18 19 // tcp_defs.h author davis mcpherson <davmcphe@cisco.com> 20 // Created on: Jul 31, 2015 21 22 #ifndef TCP_DEFS_H 23 #define TCP_DEFS_H 24 25 #include "main/thread.h" 26 27 namespace snort 28 { 29 struct Packet; 30 } 31 32 /* actions */ 33 #define ACTION_NOTHING 0x00000000 34 #define ACTION_RST 0x00000001 35 #define ACTION_BAD_PKT 0x00000002 36 #define ACTION_LWSSN_CLOSED 0x00000004 37 #define ACTION_DISABLE_INSPECTION 0x00000008 38 39 #define TF_NONE 0x0000 40 #define TF_WSCALE 0x0001 41 #define TF_TSTAMP 0x0002 42 #define TF_TSTAMP_ZERO 0x0004 43 #define TF_MSS 0x0008 44 #define TF_FORCE_FLUSH 0x0010 45 #define TF_PKT_MISSED 0x0020 // sticky 46 #define TF_MISSING_PKT 0x0040 // used internally 47 #define TF_MISSING_PREV_PKT 0x0080 // reset for each reassembled 48 49 #define PAWS_WINDOW 60 50 #define PAWS_24DAYS 2073600 /* 24 days in seconds */ 51 52 #define STREAM_UNALIGNED 0 53 #define STREAM_ALIGNED 1 54 55 #define MQ_NONE 0 56 #define MQ_BYTES 1 57 #define MQ_SEGS 2 58 59 #define STREAM_DEFAULT_MAX_SMALL_SEG_SIZE 0 /* disabled */ 60 #define STREAM_DEFAULT_CONSEC_SMALL_SEGS 0 /* disabled */ 61 62 #define SLAM_MAX 4 63 64 // target-based policy types - changes to this enum require changes to stream.h::TCP_POLICIES 65 enum StreamPolicy : uint8_t 66 { 67 OS_FIRST = 0, 68 OS_LAST, 69 OS_LINUX, 70 OS_OLD_LINUX, 71 OS_BSD, 72 OS_MACOS, 73 OS_SOLARIS, 74 OS_IRIX, 75 OS_HPUX11, 76 OS_HPUX10, 77 OS_WINDOWS, 78 OS_WINDOWS2K3, 79 OS_VISTA, 80 OS_PROXY, 81 OS_END_OF_LIST, 82 OS_DEFAULT = OS_BSD 83 }; 84 85 // increment operator... 86 inline StreamPolicy& operator++(StreamPolicy& c, int) 87 { 88 if ( c < StreamPolicy::OS_END_OF_LIST ) 89 c = static_cast<StreamPolicy>( static_cast<int>(c) + 1 ); 90 else 91 c = StreamPolicy::OS_END_OF_LIST; 92 93 return c; 94 } 95 96 enum FlushPolicy 97 { 98 STREAM_FLPOLICY_IGNORE, /* ignore this traffic */ 99 STREAM_FLPOLICY_ON_ACK, /* protocol aware flushing (PAF) */ 100 STREAM_FLPOLICY_ON_DATA, /* protocol aware ips */ 101 }; 102 103 #endif 104 105