"Fossies" - the Fresh Open Source Software Archive

Member "snort-2.9.17/src/dynamic-preprocessors/s7commplus/s7comm_decode.h" (16 Oct 2020, 2181 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 "s7comm_decode.h" see the Fossies "Dox" file reference documentation.

    1 /*
    2  * This program is free software; you can redistribute it and/or modify
    3  * it under the terms of the GNU General Public License Version 2 as
    4  * published by the Free Software Foundation.  You may not use, modify or
    5  * distribute this program under any other version of the GNU General
    6  * Public License.
    7  *
    8  * This program is distributed in the hope that it will be useful,
    9  * but WITHOUT ANY WARRANTY; without even the implied warranty of
   10  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
   11  * GNU General Public License for more details.
   12  *
   13  * You should have received a copy of the GNU General Public License
   14  * along with this program; if not, write to the Free Software
   15  * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
   16  *
   17  * Copyright (C) 2020-2020 Cisco and/or its affiliates. All rights reserved.
   18  *
   19  * Authors: Jeffrey Gu <jgu@cisco.com>, Pradeep Damodharan <prdamodh@cisco.com>
   20  *
   21  * Dynamic preprocessor for the S7commplus protocol
   22  *
   23  */
   24 
   25 #ifndef S7COMM_DECODE_H
   26 #define S7COMM_DECODE_H
   27 
   28 #include <stdint.h>
   29 #include <string.h>                     /* For memset */
   30 
   31 #include "spp_s7comm.h"
   32 #include "sf_snort_plugin_api.h"
   33 
   34 /* GIDs, SIDs, and Strings */
   35 #define GENERATOR_SPP_S7COMMPLUS 149   /* matches generators.h */
   36 
   37 /* S7Commplus defines */
   38 #define S7COMMPLUS_PROTOCOL_ID 0x72
   39 #define S7COMMPLUS_PDUTYPE_CONNECT                 0x01
   40 #define S7COMMPLUS_PDUTYPE_DATA                    0x02
   41 #define S7COMMPLUS_PDUTYPE_DATAFW1_5               0x03
   42 #define S7COMMPLUS_PDUTYPE_KEEPALIVE               0xFF
   43 
   44 #define COTP_HDR_LEN_FOR_S7COMMPLUS 2
   45 #define COTP_HDR_PDU_TYPE_DATA  0xF0
   46 
   47 #define S7COMMPLUS_BAD_LENGTH 1
   48 #define S7COMMPLUS_BAD_PROTO_ID 2
   49 #define S7COMMPLUS_RESERVED_FUNCTION 3
   50 
   51 #define S7COMMPLUS_BAD_LENGTH_STR "(spp_s7commplus): Length in S7commplus header does not match the length needed for the given S7comm function."
   52 #define S7COMMPLUS_BAD_PROTO_ID_STR "(spp_s7commplus): S7commplus protocol ID is non-zero."
   53 #define S7COMMPLUS_RESERVED_FUNCTION_STR "(spp_s7commplus): Reserved S7commplus function code in use."
   54 
   55 int S7commplusDecode(s7commplus_config_t *config, SFSnortPacket *packet);
   56 
   57 #endif /* S7COMM_DECODE_H */