1 /* Copyright (C) 2007-2011 Open Information Security Foundation 2 * 3 * You can copy, redistribute or modify this Program under the terms of 4 * the GNU General Public License version 2 as published by the Free 5 * Software Foundation. 6 * 7 * This program is distributed in the hope that it will be useful, 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 10 * GNU General Public License for more details. 11 * 12 * You should have received a copy of the GNU General Public License 13 * version 2 along with this program; if not, write to the Free Software 14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 15 * 02110-1301, USA. 16 */ 17 18 /** 19 * \file 20 * 21 * \author Anoop Saldanha <anoopsaldanha@gmail.com> 22 * \author Victor Julien <victor@inliniac.net> 23 */ 24 25 #ifndef __DETECT_ENGINE_CONTENT_INSPECTION_H__ 26 #define __DETECT_ENGINE_CONTENT_INSPECTION_H__ 27 28 /** indication to content engine what type of data 29 * we're inspecting 30 */ 31 enum { 32 DETECT_ENGINE_CONTENT_INSPECTION_MODE_PAYLOAD = 0, /* enables 'replace' logic */ 33 DETECT_ENGINE_CONTENT_INSPECTION_MODE_HEADER, 34 DETECT_ENGINE_CONTENT_INSPECTION_MODE_STREAM, 35 DETECT_ENGINE_CONTENT_INSPECTION_MODE_STATE, 36 }; 37 38 #define DETECT_CI_FLAGS_START BIT_U8(0) /**< unused, reserved for future use */ 39 #define DETECT_CI_FLAGS_END BIT_U8(1) /**< indication that current buffer 40 * is the end of the data */ 41 #define DETECT_CI_FLAGS_DCE_LE BIT_U8(2) /**< DCERPC record in little endian */ 42 #define DETECT_CI_FLAGS_DCE_BE BIT_U8(3) /**< DCERPC record in big endian */ 43 44 /** buffer is a single, non-streaming, buffer. Data sent to the content 45 * inspection function contains both start and end of the data. */ 46 #define DETECT_CI_FLAGS_SINGLE (DETECT_CI_FLAGS_START|DETECT_CI_FLAGS_END) 47 48 int DetectEngineContentInspection(DetectEngineCtx *de_ctx, DetectEngineThreadCtx *det_ctx, 49 const Signature *s, const SigMatchData *smd, 50 Packet *p, Flow *f, 51 const uint8_t *buffer, uint32_t buffer_len, 52 uint32_t stream_start_offset, uint8_t flags, 53 uint8_t inspection_mode); 54 55 void DetectEngineContentInspectionRegisterTests(void); 56 57 #endif /* __DETECT_ENGINE_CONTENT_INSPECTION_H__ */ 58