OpenDNSSEC-signer 1.2.1
|
00001 /* 00002 * $Id: zone_fetcher.h 4294 2011-01-13 19:58:29Z jakob $ 00003 * 00004 * Copyright (c) 2009 NLnet Labs. All rights reserved. 00005 * 00006 * Redistribution and use in source and binary forms, with or without 00007 * modification, are permitted provided that the following conditions 00008 * are met: 00009 * 1. Redistributions of source code must retain the above copyright 00010 * notice, this list of conditions and the following disclaimer. 00011 * 2. Redistributions in binary form must reproduce the above copyright 00012 * notice, this list of conditions and the following disclaimer in the 00013 * documentation and/or other materials provided with the distribution. 00014 * 00015 * THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR 00016 * IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED 00017 * WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE 00018 * ARE DISCLAIMED. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY 00019 * DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 00020 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE 00021 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS 00022 * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER 00023 * IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR 00024 * OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN 00025 * IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 00026 */ 00027 00028 #include <arpa/inet.h> 00029 #include <netdb.h> 00030 #include <netinet/in.h> 00031 #include <stdio.h> 00032 #include <stdint.h> 00033 #include <string.h> 00034 #include <sys/time.h> 00035 #include <sys/types.h> 00036 #include <sys/param.h> 00037 #include <sys/select.h> 00038 #include <sys/socket.h> 00039 #include <unistd.h> 00040 00041 #include "config.h" 00042 00043 #define DNS_PORT_STRING "53" 00044 #define INBUF_SIZE 4096 /* max size for incoming queries */ 00045 #define MAX_INTERFACES 128 00046 00050 union acl_addr_storage { 00051 struct in_addr addr; 00052 struct in6_addr addr6; 00053 }; 00054 00058 typedef struct serverlist_struct serverlist_type; 00059 struct serverlist_struct 00060 { 00061 int family; 00062 const char* port; /* 0 == no port */ 00063 const char* ipaddr; 00064 union acl_addr_storage addr; 00065 serverlist_type* next; 00066 }; 00067 00071 typedef struct zfzonelist_struct zfzonelist_type; 00072 struct zfzonelist_struct 00073 { 00074 const char* name; 00075 ldns_rdf* dname; 00076 char* input_file; 00077 zfzonelist_type* next; 00078 }; 00079 00083 typedef struct config_struct config_type; 00084 struct config_struct 00085 { 00086 int use_tsig; 00087 char* tsig_name; 00088 char* tsig_algo; 00089 char* tsig_secret; 00090 char* pidfile; 00091 const char* zonelist_file; 00092 zfzonelist_type* zonelist; 00093 serverlist_type* serverlist; 00094 serverlist_type* notifylist; 00095 }; 00096 00100 struct odd_socket 00101 { 00102 struct addrinfo* addr; 00103 int s; 00104 }; 00105 00106 typedef struct sockets_struct sockets_type; 00107 struct sockets_struct 00108 { 00109 struct odd_socket tcp[MAX_INTERFACES]; 00110 struct odd_socket udp[MAX_INTERFACES]; 00111 }; 00112 00116 struct handle_udp_userdata { 00117 int udp_sock; 00118 struct sockaddr_storage addr_him; 00119 socklen_t hislen; 00120 }; 00121 00122 struct handle_tcp_userdata { 00123 int s; 00124 }; 00125 00126 00131 int 00132 tools_zone_fetcher(const char* config_file, const char* zonelist_file, 00133 const char* group, const char* user, const char* chroot, const char* log_file, 00134 int use_syslog, int verbosity); 00135