diff options
Diffstat (limited to 'usr.sbin/nsd/util.h')
-rw-r--r-- | usr.sbin/nsd/util.h | 45 |
1 files changed, 7 insertions, 38 deletions
diff --git a/usr.sbin/nsd/util.h b/usr.sbin/nsd/util.h index a84f7ac4c72..69dd72f2c35 100644 --- a/usr.sbin/nsd/util.h +++ b/usr.sbin/nsd/util.h @@ -1,7 +1,7 @@ /* * util.h -- set of various support routines. * - * Copyright (c) 2001-2011, NLnet Labs. All rights reserved. + * Copyright (c) 2001-2006, NLnet Labs. All rights reserved. * * See LICENSE for the license. * @@ -10,7 +10,6 @@ #ifndef _UTIL_H_ #define _UTIL_H_ -#include "config.h" #include <sys/time.h> #include <stdarg.h> #include <stdio.h> @@ -31,26 +30,6 @@ struct rr; #define PADDING(n, alignment) \ (ALIGN_UP((n), (alignment)) - (n)) -/* Counter for statistics */ -typedef unsigned long stc_t; - -/** - * Statistics. - * - */ -struct nsdst { - time_t boot; - int period; /* Produce statistics dump every st_period seconds */ - stc_t qtype[257]; /* Counters per qtype */ - stc_t qclass[4]; /* Class IN or Class CH or other */ - stc_t qudp, qudp6; /* Number of queries udp and udp6 */ - stc_t ctcp, ctcp6; /* Number of tcp and tcp6 connections */ - stc_t rcode[17], opcode[6]; /* Rcodes & opcodes */ - /* Dropped, truncated, queries for nonconfigured zone, tx errors */ - stc_t dropped, truncated, wrongzone, txerr, rxerr; - stc_t edns, ednserr, raxfr, nona; -}; - /* * Initialize the logging system. All messages are logged to stderr * until log_open and log_set_log_function are called. @@ -354,6 +333,8 @@ int compare_serial(uint32_t a, uint32_t b); * Generate a random query ID. */ uint16_t qid_generate(void); +/* value between 0 .. (max-1) inclusive */ +int random_generate(int max); /* * call region_destroy on (region*)data, useful for region_add_cleanup(). @@ -379,24 +360,12 @@ int print_rr(FILE *out, struct state_pretty_rr* state, struct rr *record); */ const char* rcode2str(int rc); -/* - * Stack of pointers. - * Stack is fixed size on start. More elems fall off stack. - */ -struct stack { - void** data; - size_t num, capacity; -}; -typedef struct stack stack_type; -stack_type* stack_create(struct region* region, size_t size); -void stack_push(stack_type* stack, void* elem); -void* stack_pop(stack_type* stack); -int addr2ip( +void addr2str( #ifdef INET6 - struct sockaddr_storage addr + struct sockaddr_storage *addr #else - struct sockaddr_in addr + struct sockaddr_in *addr #endif -, char address[], socklen_t size); + , char* str, size_t len); #endif /* _UTIL_H_ */ |