OpenDNSSEC-signer
1.3.4
|
00001 /* 00002 * $Id: zone_fetcher.h 5163 2011-05-26 12:40:24Z matthijs $ 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 #ifndef TOOLS_ZONEFETCHER_H 00044 #define TOOLS_ZONEFETCHER_H 00045 00046 #define DNS_PORT_STRING "53" 00047 #define INBUF_SIZE 4096 /* max size for incoming queries */ 00048 #define MAX_INTERFACES 128 00049 00053 union acl_addr_storage { 00054 struct in_addr addr; 00055 struct in6_addr addr6; 00056 }; 00057 00061 typedef struct serverlist_struct serverlist_type; 00062 struct serverlist_struct 00063 { 00064 int family; 00065 const char* port; /* 0 == no port */ 00066 const char* ipaddr; 00067 union acl_addr_storage addr; 00068 serverlist_type* next; 00069 }; 00070 00074 typedef struct zfzonelist_struct zfzonelist_type; 00075 struct zfzonelist_struct 00076 { 00077 const char* name; 00078 ldns_rdf* dname; 00079 char* input_file; 00080 zfzonelist_type* next; 00081 }; 00082 00086 typedef struct config_struct config_type; 00087 struct config_struct 00088 { 00089 int use_tsig; 00090 char* tsig_name; 00091 char* tsig_algo; 00092 char* tsig_secret; 00093 char* pidfile; 00094 const char* zonelist_file; 00095 zfzonelist_type* zonelist; 00096 serverlist_type* serverlist; 00097 serverlist_type* notifylist; 00098 }; 00099 00103 struct odd_socket 00104 { 00105 struct addrinfo* addr; 00106 int s; 00107 }; 00108 00109 typedef struct sockets_struct sockets_type; 00110 struct sockets_struct 00111 { 00112 struct odd_socket tcp[MAX_INTERFACES]; 00113 struct odd_socket udp[MAX_INTERFACES]; 00114 }; 00115 00119 struct handle_udp_userdata { 00120 int udp_sock; 00121 struct sockaddr_storage addr_him; 00122 socklen_t hislen; 00123 }; 00124 00125 struct handle_tcp_userdata { 00126 int s; 00127 }; 00128 00129 00134 int 00135 tools_zone_fetcher(const char* config_file, const char* zonelist_file, 00136 const char* group, const char* user, const char* chroot, 00137 const char* log_file, int use_syslog, int verbosity); 00138 00139 #endif /* TOOLS_ZONEFETCHER_H */