mirror of https://github.com/Cisco-Talos/clamav
You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
55 lines
1.7 KiB
55 lines
1.7 KiB
![]()
11 years ago
|
/*
|
||
|
* Support for PCRE regex variant
|
||
|
*
|
||
|
* Copyright (C) 2007-2013 Sourcefire, Inc.
|
||
|
* Copyright (C) 2014 Cisco Systems, Inc.
|
||
|
* All Rights Reserved.
|
||
|
*
|
||
|
* Authors: Kevin Lin
|
||
|
*
|
||
|
* This program is free software; you can redistribute it and/or modify
|
||
|
* it 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
|
||
|
* along with this program; if not, write to the Free Software
|
||
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston,
|
||
|
* MA 02110-1301, USA.
|
||
|
*/
|
||
|
|
||
|
#ifndef _REGEX_PCRE_H_
|
||
|
#define _REGEX_PCRE_H_
|
||
|
|
||
|
#if HAVE_CONFIG_H
|
||
|
#include "clamav-config.h"
|
||
|
#endif
|
||
|
|
||
|
#include <pcre.h>
|
||
|
|
||
|
#include "cltypes.h"
|
||
|
#include "mpool.h"
|
||
|
|
||
|
/* temporary macros to be replaced with engine options */
|
||
|
#define CLAMAV_PCRE_MATCH_LIMIT 10000
|
||
|
/* pointless unless less than CLAMAV_PCRE_MATCH_LIMIT by significant margin */
|
||
|
#define CLAMAV_PCRE_REC_MATCH_LIMIT 10000
|
||
|
|
||
|
struct cli_pcre_data {
|
||
|
pcre *re; /* compiled pcre regex */
|
||
|
pcre_extra *ex; /* pcre extra data - limits */
|
||
|
int options; /* pcre options */
|
||
|
char *expression; /* copied regular expression */
|
||
|
uint32_t search_offset; /* start offset to search at for pcre_exec */
|
||
|
};
|
||
|
|
||
|
int cli_pcre_parse(struct cli_pcre_data *pd, const char *pattern, unsigned int options);
|
||
|
int cli_pcre_match();
|
||
|
void cli_pcre_free_single(struct cli_pcre_data *pd);
|
||
|
|
||
|
#endif /*_REGEX_PCRE_H_*/
|