1238106Sdes/* 2238106Sdes * util/module.c - module interface 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 * \file 37238106Sdes * Implementation of module.h. 38238106Sdes */ 39238106Sdes 40238106Sdes#include "config.h" 41238106Sdes#include "util/module.h" 42238106Sdes 43238106Sdesconst char* 44238106Sdesstrextstate(enum module_ext_state s) 45238106Sdes{ 46238106Sdes switch(s) { 47238106Sdes case module_state_initial: return "module_state_initial"; 48238106Sdes case module_wait_reply: return "module_wait_reply"; 49238106Sdes case module_wait_module: return "module_wait_module"; 50238106Sdes case module_restart_next: return "module_restart_next"; 51238106Sdes case module_wait_subquery: return "module_wait_subquery"; 52238106Sdes case module_error: return "module_error"; 53238106Sdes case module_finished: return "module_finished"; 54238106Sdes } 55238106Sdes return "bad_extstate_value"; 56238106Sdes} 57238106Sdes 58238106Sdesconst char* 59238106Sdesstrmodulevent(enum module_ev e) 60238106Sdes{ 61238106Sdes switch(e) { 62238106Sdes case module_event_new: return "module_event_new"; 63238106Sdes case module_event_pass: return "module_event_pass"; 64238106Sdes case module_event_reply: return "module_event_reply"; 65238106Sdes case module_event_noreply: return "module_event_noreply"; 66238106Sdes case module_event_capsfail: return "module_event_capsfail"; 67238106Sdes case module_event_moddone: return "module_event_moddone"; 68238106Sdes case module_event_error: return "module_event_error"; 69238106Sdes } 70238106Sdes return "bad_event_value"; 71238106Sdes} 72