1238106Sdes/*
2238106Sdes * iterator/iter_scrub.h - scrubbing, normalization, sanitization of DNS msgs.
3238106Sdes *
4238106Sdes * Copyright (c) 2007, NLnet Labs. All rights reserved.
5238106Sdes *
6238106Sdes * This software is open source.
7238106Sdes *
8238106Sdes * Redistribution and use in source and binary forms, with or without
9238106Sdes * modification, are permitted provided that the following conditions
10238106Sdes * are met:
11238106Sdes *
12238106Sdes * Redistributions of source code must retain the above copyright notice,
13238106Sdes * this list of conditions and the following disclaimer.
14238106Sdes *
15238106Sdes * Redistributions in binary form must reproduce the above copyright notice,
16238106Sdes * this list of conditions and the following disclaimer in the documentation
17238106Sdes * and/or other materials provided with the distribution.
18238106Sdes *
19238106Sdes * Neither the name of the NLNET LABS nor the names of its contributors may
20238106Sdes * be used to endorse or promote products derived from this software without
21238106Sdes * specific prior written permission.
22238106Sdes *
23238106Sdes * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
24269257Sdes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
25269257Sdes * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
26269257Sdes * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
27269257Sdes * HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
28269257Sdes * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED
29269257Sdes * TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
30269257Sdes * PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
31269257Sdes * LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
32269257Sdes * NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
33269257Sdes * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
34238106Sdes */
35238106Sdes
36238106Sdes/**
37238106Sdes * \file
38238106Sdes *
39238106Sdes * This file has routine(s) for cleaning up incoming DNS messages from
40238106Sdes * possible useless or malicious junk in it.
41238106Sdes */
42238106Sdes
43238106Sdes#ifndef ITERATOR_ITER_SCRUB_H
44238106Sdes#define ITERATOR_ITER_SCRUB_H
45269257Sdesstruct sldns_buffer;
46238106Sdesstruct msg_parse;
47238106Sdesstruct query_info;
48238106Sdesstruct regional;
49238106Sdesstruct module_env;
50238106Sdesstruct iter_env;
51238106Sdes
52238106Sdes/**
53238106Sdes * Cleanup the passed dns message.
54238106Sdes * @param pkt: the packet itself, for resolving name compression pointers.
55238106Sdes *	the packet buffer is unaltered.
56238106Sdes * @param msg: the parsed packet, this structure is cleaned up.
57238106Sdes * @param qinfo: the query info that was sent to the server. Checked.
58238106Sdes * @param zonename: the name of the last delegation point.
59238106Sdes *	Used to determine out of bailiwick information.
60238106Sdes * @param regional: where to allocate (new) parts of the message.
61238106Sdes * @param env: module environment with config settings and cache.
62238106Sdes * @param ie: iterator module environment data.
63238106Sdes * @return: false if the message is total waste. true if scrubbed with success.
64238106Sdes */
65269257Sdesint scrub_message(struct sldns_buffer* pkt, struct msg_parse* msg,
66238106Sdes	struct query_info* qinfo, uint8_t* zonename, struct regional* regional,
67238106Sdes	struct module_env* env, struct iter_env* ie);
68238106Sdes
69238106Sdes#endif /* ITERATOR_ITER_SCRUB_H */
70