diff options
author | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:21:41 -0700 |
---|---|---|
committer | Ashlee Young <ashlee@onosfw.com> | 2015-09-09 22:21:41 -0700 |
commit | 8879b125d26e8db1a5633de5a9c692eb2d1c4f83 (patch) | |
tree | c7259d85a991b83dfa85ab2e339360669fc1f58e /framework/src/suricata/src/stream-tcp-reassemble.h | |
parent | 13d05bc8458758ee39cb829098241e89616717ee (diff) |
suricata checkin based on commit id a4bce14770beee46a537eda3c3f6e8e8565d5d0a
Change-Id: I9a214fa0ee95e58fc640e50bd604dac7f42db48f
Diffstat (limited to 'framework/src/suricata/src/stream-tcp-reassemble.h')
-rw-r--r-- | framework/src/suricata/src/stream-tcp-reassemble.h | 110 |
1 files changed, 110 insertions, 0 deletions
diff --git a/framework/src/suricata/src/stream-tcp-reassemble.h b/framework/src/suricata/src/stream-tcp-reassemble.h new file mode 100644 index 00000000..b6e798ce --- /dev/null +++ b/framework/src/suricata/src/stream-tcp-reassemble.h @@ -0,0 +1,110 @@ +/* Copyright (C) 2007-2010 Open Information Security Foundation + * + * You can copy, redistribute or modify this Program under the terms of + * the GNU General Public License version 2 as published by the Free + * Software Foundation. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * version 2 along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA + * 02110-1301, USA. + */ + +/** + * \file + * + * \author Victor Julien <victor@inliniac.net> + * \author Gurvinder Singh <gurvindersinghdahiya@gmail.com> + */ + +#ifndef __STREAM_TCP_REASSEMBLE_H__ +#define __STREAM_TCP_REASSEMBLE_H__ + +#include "stream-tcp-private.h" +#include "stream.h" +#include "app-layer-detect-proto.h" +#include "stream-tcp-private.h" + +/** Supported OS list and default OS policy is BSD */ +enum +{ + OS_POLICY_NONE = 1, + OS_POLICY_BSD, + OS_POLICY_BSD_RIGHT, + OS_POLICY_OLD_LINUX, + OS_POLICY_LINUX, + OS_POLICY_OLD_SOLARIS, + OS_POLICY_SOLARIS, + OS_POLICY_HPUX10, + OS_POLICY_HPUX11, + OS_POLICY_IRIX, + OS_POLICY_MACOS, + OS_POLICY_WINDOWS, + OS_POLICY_VISTA, + OS_POLICY_WINDOWS2K3, + OS_POLICY_FIRST, + OS_POLICY_LAST +}; + +typedef struct TcpReassemblyThreadCtx_ { + void *app_tctx; + /** TCP segments which are not being reassembled due to memcap was reached */ + uint16_t counter_tcp_segment_memcap; + /** number of streams that stop reassembly because their depth is reached */ + uint16_t counter_tcp_stream_depth; + /** count number of streams with a unrecoverable stream gap (missing pkts) */ + uint16_t counter_tcp_reass_gap; +#ifdef DEBUG + uint64_t fp1; + uint64_t fp2; + uint64_t sp; +#endif +} TcpReassemblyThreadCtx; + +#define OS_POLICY_DEFAULT OS_POLICY_BSD + +int StreamTcpReassembleHandleSegment(ThreadVars *, TcpReassemblyThreadCtx *, TcpSession *, TcpStream *, Packet *, PacketQueue *); +int StreamTcpReassembleInit(char); +void StreamTcpReassembleFree(char); +void StreamTcpReassembleRegisterTests(void); +TcpReassemblyThreadCtx *StreamTcpReassembleInitThreadCtx(ThreadVars *tv); +void StreamTcpReassembleFreeThreadCtx(TcpReassemblyThreadCtx *); +int StreamTcpReassembleAppLayer (ThreadVars *tv, TcpReassemblyThreadCtx *ra_ctx, + TcpSession *ssn, TcpStream *stream, + Packet *p); + +void StreamTcpCreateTestPacket(uint8_t *, uint8_t, uint8_t, uint8_t); + +void StreamTcpSetSessionNoReassemblyFlag (TcpSession *, char ); +void StreamTcpSetDisableRawReassemblyFlag (TcpSession *ssn, char direction); + +void StreamTcpSetOSPolicy(TcpStream *, Packet *); +void StreamTcpReassemblePause (TcpSession *, char ); +void StreamTcpReassembleUnPause (TcpSession *, char ); +int StreamTcpCheckStreamContents(uint8_t *, uint16_t , TcpStream *); + +int StreamTcpReassembleInsertSegment(ThreadVars *, TcpReassemblyThreadCtx *, TcpStream *, TcpSegment *, Packet *); +TcpSegment* StreamTcpGetSegment(ThreadVars *, TcpReassemblyThreadCtx *, uint16_t); + +void StreamTcpReturnStreamSegments(TcpStream *); +void StreamTcpSegmentReturntoPool(TcpSegment *); + +void StreamTcpReassembleTriggerRawReassembly(TcpSession *); + +void StreamTcpPruneSession(Flow *, uint8_t); +int StreamTcpReassembleDepthReached(Packet *p); + +void StreamTcpReassembleIncrMemuse(uint64_t size); +void StreamTcpReassembleDecrMemuse(uint64_t size); +int StreamTcpReassembleCheckMemcap(uint32_t size); + +void StreamTcpDisableAppLayer(Flow *f); +int StreamTcpAppLayerIsDisabled(Flow *f); + +#endif /* __STREAM_TCP_REASSEMBLE_H__ */ + |