#undef DEBUG /* because there is a lot of debug code in here :-) */
-#ifndef __GLIBC__
-extern int dn_expand PROTO ((char *, char *, char *, char *, int));
-extern int dn_skipname PROTO ((char *, char *));
-extern int res_mkquery PROTO ((int, char *, int, int, char *, int,
- struct rrec *, char *, int));
-#endif
-
extern int errno, h_errno;
extern int highest_fd;
extern aClient *local[];
static ResRQ *last, *first;
static void rem_cache PROTO ((aCache *));
-static void rem_request PROTO ((ResRQ *));
static int do_query_name PROTO ((Link *, char *, ResRQ *));
static int do_query_number PROTO ((Link *, struct in_addr *, ResRQ *));
static void resend_query PROTO ((ResRQ *));
static aCache *make_cache PROTO ((ResRQ *));
static aCache *find_cache_name PROTO ((char *));
static aCache *find_cache_number PROTO ((ResRQ *, char *));
-static int add_request PROTO ((ResRQ *));
-static ResRQ *make_request PROTO ((Link *));
static int send_res_msg PROTO ((char *, int, int));
static ResRQ *find_id PROTO ((int));
static int hash_number PROTO ((unsigned char *));
return ret;
}
-static int add_request (new)
- ResRQ *new;
+static int add_request (ResRQ *new)
{
if (!new)
return -1;
* remove a request from the list. This must also free any memory that has
* been allocated for temporary storage of DNS results.
*/
-static void rem_request (old)
- ResRQ *old;
+static void rem_request (ResRQ *old)
{
ResRQ **rptr, *r2ptr = NULL;
int i;
/*
* Create a DNS request record for the server.
*/
-static ResRQ *make_request (lp)
- Link *lp;
+static ResRQ *make_request (Link *lp)
{
ResRQ *nreq;
* Remove queries from the list which have been there too long without
* being resolved.
*/
-time_t timeout_query_list (now)
- time_t now;
+time_t timeout_query_list (time_t now)
{
ResRQ *rptr, *r2ptr;
time_t next = 0, tout;
* del_queries - called by the server to cleanup outstanding queries for
* which there no longer exist clients or conf lines.
*/
-void del_queries (cp)
- char *cp;
+void del_queries (char *cp)
{
ResRQ *rptr, *r2ptr;
* isn't present. Returns number of messages successfully sent to
* nameservers or -1 if no successful sends.
*/
-static int send_res_msg (msg, len, rcount)
- char *msg;
- int len, rcount;
+static int send_res_msg (char *msg, int len, int rcount)
{
int i;
int sent = 0, max;
/*
* find a dns request id (id is determined by dn_mkquery)
*/
-static ResRQ *find_id (id)
- int id;
+static ResRQ *find_id (int id)
{
ResRQ *rptr;
return NULL;
}
-struct hostent *gethost_byname (name, lp)
- char *name;
- Link *lp;
+struct hostent *gethost_byname (char *name, Link *lp)
{
aCache *cp;
return NULL;
}
-struct hostent *gethost_byaddr (addr, lp)
- char *addr;
- Link *lp;
+struct hostent *gethost_byaddr (char *addr, Link *lp)
{
aCache *cp;
return NULL;
}
-static int do_query_name (lp, name, rptr)
- Link *lp;
- char *name;
- ResRQ *rptr;
+static int do_query_name (Link *lp, char *name, ResRQ *rptr)
{
char hname[HOSTLEN + 1];
int len;
/*
* Use this to do reverse IP# lookups.
*/
-static int do_query_number (lp, numb, rptr)
- Link *lp;
- struct in_addr *numb;
- ResRQ *rptr;
+static int do_query_number (Link *lp, struct in_addr *numb, ResRQ *rptr)
{
char ipbuf[32];
u_char *cp;
/*
* generate a query based on class, type and name.
*/
-static int query_name (name, class, type, rptr)
- char *name;
- int class, type;
- ResRQ *rptr;
+static int query_name (char *name, int class, int type, ResRQ *rptr)
{
struct timeval tv;
char buf[MAXPACKET];
return 0;
}
-static void resend_query (rptr)
- ResRQ *rptr;
+static void resend_query (ResRQ *rptr)
{
if (rptr->resend == 0)
return;
/*
* process name server reply.
*/
-static int proc_answer (rptr, hptr, buf, eob)
- ResRQ *rptr;
- char *buf, *eob;
- HEADER *hptr;
+static int proc_answer (ResRQ *rptr, HEADER *hptr, char *buf, char *eob)
{
char *cp, **alias;
struct hent *hp;
alias = hp->h_aliases;
while (*alias)
alias++;
-#ifdef SOL20 /* brain damaged compiler (Solaris2) it seems */
- for (; hptr->qdcount > 0; hptr->qdcount--)
-#else
while (hptr->qdcount-- > 0)
-#endif /* SOL20 */
if ((n = dn_skipname (cp, eob)) == -1)
break;
else
/*
* read a dns reply from the nameserver and process it.
*/
-struct hostent *get_res (lp)
- char *lp;
+struct hostent *get_res (char *lp)
{
static char buf[sizeof (HEADER) + MAXPACKET];
HEADER *hptr;
return (struct hostent *) NULL;
}
-static int hash_number (ip)
- unsigned char *ip;
+static int hash_number (unsigned char *ip)
{
u_int hashv = 0;
return (hashv);
}
-static int hash_name (name)
- register char *name;
+static int hash_name (char *name)
{
u_int hashv = 0;
/*
** Add a new cache item to the queue and hash table.
*/
-static aCache *add_to_cache (ocp)
- aCache *ocp;
+static aCache *add_to_cache (aCache *ocp)
{
aCache *cp = NULL;
int hashv;
/*
** update_list does not alter the cache structure passed. It is assumed that
** it already contains the correct expire time, if it is a new entry. Old
- ** entries have the expirey time updated.
+ ** entries have the expiration time updated.
*/
-static void update_list (rptr, cachep)
- ResRQ *rptr;
- aCache *cachep;
+static void update_list (ResRQ *rptr, aCache *cachep)
{
aCache **cpp, *cp = cachep;
char *s, *t, **base;
return;
}
-static aCache *find_cache_name (name)
- char *name;
+static aCache *find_cache_name (char *name)
{
aCache *cp;
char *s;
/*
* find a cache entry by ip# and update its expire time
*/
-static aCache *find_cache_number (rptr, numb)
- ResRQ *rptr;
- char *numb;
+static aCache *find_cache_number (ResRQ *rptr, char *numb)
{
aCache *cp;
int hashv, i;
return NULL;
}
-static aCache *make_cache (rptr)
- ResRQ *rptr;
+static aCache *make_cache (ResRQ *rptr)
{
aCache *cp;
int i, n;
* delete a cache entry from the cache structures and lists and return
* all memory used for the cache back to the memory pool.
*/
-static void rem_cache (ocp)
- aCache *ocp;
+static void rem_cache (aCache *ocp)
{
aCache **cp;
struct hostent *hp = &ocp->he;
}
/*
- * removes entries from the cache which are older than their expirey times.
+ * removes entries from the cache which are older than their expiration time.
* returns the time at which the server should next poll the cache.
*/
-time_t expire_cache (now)
- time_t now;
+time_t expire_cache (time_t now)
{
aCache *cp, *cp2;
time_t next = 0;
rem_cache (cp);
}
-int m_dns (cptr, sptr, parc, parv)
- aClient *cptr, *sptr;
- int parc;
- char *parv[];
+int m_dns (aClient *cptr, aClient *sptr, int parc, char *parv[])
{
aCache *cp;
int i;
return 0;
}
-u_long cres_mem (sptr)
- aClient *sptr;
+u_long cres_mem (aClient *sptr)
{
- register aCache *c = cachetop;
- register struct hostent *h;
- register int i;
+ aCache *c = cachetop;
+ struct hostent *h;
+ int i;
u_long nm = 0, im = 0, sm = 0, ts = 0;
for (; c; c = c->list_next) {