mirror of https://github.com/OISF/suricata
dns: cleanup: move event callbacks into Rust
Remove app-layer-dns-common.c as its no longer needed.pull/4679/head
parent
ca5a3f0f04
commit
1b44f839e6
@ -1,80 +0,0 @@
|
|||||||
/* Copyright (C) 2013-2014 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>
|
|
||||||
*/
|
|
||||||
|
|
||||||
#include "suricata-common.h"
|
|
||||||
#include "app-layer-dns-common.h"
|
|
||||||
|
|
||||||
SCEnumCharMap dns_decoder_event_table[ ] = {
|
|
||||||
{ "MALFORMED_DATA", DNS_DECODER_EVENT_MALFORMED_DATA, },
|
|
||||||
{ "NOT_A_REQUEST", DNS_DECODER_EVENT_NOT_A_REQUEST, },
|
|
||||||
{ "NOT_A_RESPONSE", DNS_DECODER_EVENT_NOT_A_RESPONSE, },
|
|
||||||
{ "Z_FLAG_SET", DNS_DECODER_EVENT_Z_FLAG_SET, },
|
|
||||||
|
|
||||||
{ NULL, -1 },
|
|
||||||
};
|
|
||||||
|
|
||||||
int DNSStateGetEventInfo(const char *event_name,
|
|
||||||
int *event_id, AppLayerEventType *event_type)
|
|
||||||
{
|
|
||||||
*event_id = SCMapEnumNameToValue(event_name, dns_decoder_event_table);
|
|
||||||
if (*event_id == -1) {
|
|
||||||
SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%s\" not present in "
|
|
||||||
"dns's enum map table.", event_name);
|
|
||||||
/* this should be treated as fatal */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*event_type = APP_LAYER_EVENT_TYPE_TRANSACTION;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
int DNSStateGetEventInfoById(int event_id, const char **event_name,
|
|
||||||
AppLayerEventType *event_type)
|
|
||||||
{
|
|
||||||
*event_name = SCMapEnumValueToName(event_id, dns_decoder_event_table);
|
|
||||||
if (*event_name == NULL) {
|
|
||||||
SCLogError(SC_ERR_INVALID_ENUM_MAP, "event \"%d\" not present in "
|
|
||||||
"dns's enum map table.", event_id);
|
|
||||||
/* this should be treated as fatal */
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
|
|
||||||
*event_type = APP_LAYER_EVENT_TYPE_TRANSACTION;
|
|
||||||
|
|
||||||
return 0;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DNSAppLayerRegisterGetEventInfo(uint8_t ipproto, AppProto alproto)
|
|
||||||
{
|
|
||||||
AppLayerParserRegisterGetEventInfo(ipproto, alproto, DNSStateGetEventInfo);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
void DNSAppLayerRegisterGetEventInfoById(uint8_t ipproto, AppProto alproto)
|
|
||||||
{
|
|
||||||
AppLayerParserRegisterGetEventInfoById(ipproto, alproto, DNSStateGetEventInfoById);
|
|
||||||
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
Loading…
Reference in New Issue