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 24238106Sdes * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED 25238106Sdes * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR 26238106Sdes * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE 27238106Sdes * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR 28238106Sdes * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF 29238106Sdes * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 30238106Sdes * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN 31238106Sdes * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) 32238106Sdes * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE 33238106Sdes * 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 45238106Sdes#include <ldns/buffer.h> 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 */ 65238106Sdesint scrub_message(ldns_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