"Fossies" - the Fresh Open Source Software Archive

Member "snort-2.9.17/src/preprocessors/Stream6/snort_stream_tcp.h" (16 Oct 2020, 6004 Bytes) of package /linux/misc/snort-2.9.17.tar.gz:


As a special service "Fossies" has tried to format the requested source page into HTML format using (guessed) C and C++ source code syntax highlighting (style: standard) with prefixed line numbers and code folding option. Alternatively you can here view or download the uninterpreted source code file. For more information about "snort_stream_tcp.h" see the Fossies "Dox" file reference documentation and the latest Fossies "Diffs" side-by-side code changes report: 2.9.16.1_vs_2.9.17.

    1 /****************************************************************************
    2  *
    3  * Copyright (C) 2014-2020 Cisco and/or its affiliates. All rights reserved.
    4  * Copyright (C) 2004-2013 Sourcefire, Inc.
    5  *
    6  * This program is free software; you can redistribute it and/or modify
    7  * it under the terms of the GNU General Public License Version 2 as
    8  * published by the Free Software Foundation.  You may not use, modify or
    9  * distribute this program under any other version of the GNU General
   10  * Public License.
   11  *
   12  * This program is distributed in the hope that it will be useful,
   13  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   14  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   15  * GNU General Public License for more details.
   16  *
   17  * You should have received a copy of the GNU General Public License
   18  * along with this program; if not, write to the Free Software
   19  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   20  *
   21  ****************************************************************************/
   22 
   23 #ifndef _STREAM_TCP_H_
   24 #define _STREAM_TCP_H_
   25 
   26 #include "session_common.h"
   27 #include "stream_common.h"
   28 #include "sfPolicy.h"
   29 
   30 extern uint32_t xtradata_func_count;
   31 extern LogFunction xtradata_map[LOG_FUNC_MAX];
   32 extern LogExtraData extra_data_log;
   33 extern void *extra_data_config;
   34 
   35 void StreamCleanTcp(void);
   36 void StreamResetTcp(void);
   37 void StreamInitTcp(void);
   38 void StreamTcpRegisterPreprocProfiles(void);
   39 void StreamTcpRegisterRuleOptions(struct _SnortConfig *);
   40 void StreamTcpInitFlushPoints(void);
   41 int StreamVerifyTcpConfig(struct _SnortConfig *, StreamTcpConfig *, tSfPolicyId);
   42 void StreamTcpPolicyInit(struct _SnortConfig *, StreamTcpConfig *, char *);
   43 int StreamProcessTcp(Packet *, SessionControlBlock *,
   44         StreamTcpPolicy *, SessionKey *);
   45 int StreamFlushListener(Packet *p, SessionControlBlock *scb);
   46 int StreamFlushTalker(Packet *p, SessionControlBlock *scb);
   47 int StreamFlushClient(Packet *p, SessionControlBlock *scb);
   48 int StreamFlushServer(Packet *p, SessionControlBlock *scb);
   49 void TcpUpdateDirection(SessionControlBlock *ssn, char dir,
   50         sfaddr_t* ip, uint16_t port);
   51 void StreamTcpSessionClear(Packet *p);
   52 SessionControlBlock *GetLWTcpSession(const SessionKey *key);
   53 int GetTcpRebuiltPackets(Packet *p, SessionControlBlock *ssn,
   54         PacketIterator callback, void *userdata);
   55 int GetTcpStreamSegments(Packet *p, SessionControlBlock *ssn,
   56         StreamSegmentIterator callback, void *userdata);
   57 int StreamAddSessionAlertTcp(SessionControlBlock *scb, Packet *p, uint32_t gid, uint32_t sid);
   58 int StreamCheckSessionAlertTcp(SessionControlBlock *scb, Packet *p, uint32_t gid, uint32_t sid);
   59 int StreamUpdateSessionAlertTcp(SessionControlBlock *scb, Packet *p, uint32_t gid, uint32_t sid, uint32_t event_id, uint32_t event_second);
   60 void StreamSetExtraDataTcp(SessionControlBlock*, Packet*, uint32_t flag);
   61 void StreamClearExtraDataTcp(SessionControlBlock*, Packet*, uint32_t flag);
   62 char StreamGetReassemblyDirectionTcp(SessionControlBlock *scb);
   63 uint32_t StreamGetFlushPointTcp(SessionControlBlock *scb, char dir);
   64 void StreamSetFlushPointTcp(SessionControlBlock *scb, char dir, uint32_t flush_point);
   65 char StreamSetReassemblyTcp(SessionControlBlock *scb, uint8_t flush_policy, char dir, char flags);
   66 char StreamGetReassemblyFlushPolicyTcp(SessionControlBlock *scb, char dir);
   67 char StreamIsStreamSequencedTcp(SessionControlBlock *scb, char dir);
   68 int StreamMissingInReassembledTcp(SessionControlBlock *scb, char dir);
   69 char StreamPacketsMissingTcp(SessionControlBlock *scb, char dir);
   70 void s5TcpSetPortFilterStatus(struct _SnortConfig *sc,
   71         unsigned short port, uint16_t status, tSfPolicyId policyId, int parsing );
   72 void s5TcpUnsetPortFilterStatus( struct _SnortConfig *sc, unsigned short port, uint16_t status,
   73         tSfPolicyId policyId, int parsing );
   74 int s5TcpGetPortFilterStatus( struct _SnortConfig *sc, unsigned short port, tSfPolicyId policyId, int parsing );
   75 void s5TcpSetSynSessionStatus(struct _SnortConfig *sc, uint16_t status, tSfPolicyId policyId, int parsing);
   76 void s5TcpUnsetSynSessionStatus(struct _SnortConfig *sc, uint16_t status, tSfPolicyId policyId, int parsing);
   77 void StreamTcpConfigFree(StreamTcpConfig *);
   78 void **StreamGetPAFUserDataTcp(SessionControlBlock*, bool to_server, uint8_t id);
   79 bool StreamIsPafActiveTcp(SessionControlBlock*, bool to_server);
   80 bool StreamActivatePafTcp (SessionControlBlock *scb, int dir, int16_t service_port, uint8_t type);
   81 void StreamResetPolicyTcp(SessionControlBlock*, int dir, uint16_t policy, uint16_t mss);
   82 void StreamSetSessionDecryptedTcp( SessionControlBlock *scb, bool enable);
   83 bool StreamIsSessionDecryptedTcp( SessionControlBlock *scb );
   84 
   85 uint32_t StreamGetTcpPrunes(void);
   86 void StreamResetTcpPrunes(void);
   87 void enableRegisteredPortsForReassembly( struct _SnortConfig *sc );
   88 uint32_t StreamGetPreprocFlagsTcp(SessionControlBlock *scb);
   89 
   90 #ifdef NORMALIZER
   91 void Stream_PrintNormalizationStats(void);
   92 void Stream_ResetNormalizationStats(void);
   93 #endif
   94 
   95 void StreamPostConfigTcp(struct _SnortConfig *sc, void*);
   96 
   97 void registerPortForReassembly( char *network, uint16_t port, int reassembly_direction );
   98 void unregisterPortForReassembly( char *network, uint16_t port, int reassembly_direction );
   99 Packet* getWirePacketTcp();
  100 uint8_t getFlushPolicyDirTcp();
  101 bool StreamIsSessionHttp2Tcp( SessionControlBlock *scb );
  102 void StreamSetSessionHttp2Tcp( SessionControlBlock *scb );
  103 bool StreamIsSessionHttp2UpgTcp( SessionControlBlock *scb );
  104 void StreamSetSessionHttp2UpgTcp( SessionControlBlock *scb );
  105 
  106 void SessionTCPReload(uint32_t max_sessions, uint16_t pruningTimeout, uint16_t nominalTimeout);
  107 unsigned SessionTCPReloadAdjust(unsigned maxWork);
  108 
  109 void SetFTPFileLocation(void *scbptr ,bool flush);
  110 
  111 void set_service_based_flush_policy(SessionControlBlock *scb);
  112 
  113 #ifdef HAVE_DAQ_DECRYPTED_SSL
  114 int StreamSimulatePeerTcpAckp( SessionControlBlock *scb, uint8_t dir, uint32_t tcp_payload_len );
  115 #endif
  116 
  117 size_t get_tcp_used_mempool();
  118 
  119 #endif /* STREAM_TCP_H_ */