/* $Id: cdns.h 3 2008-02-25 09:49:14Z keaston $ */12/*3* cdns.h: header for cdns.c4*/56#ifndef _CDNS_H_7#define _CDNS_H_89/* We gotta know about the fd_set type, so we gonna inclue this */10#include "irc.h"1112#include "struct.h"13#include "newio.h"14#endif1516#define MAXALIASES 3517#define MAXADDRS 351819typedef struct _hent {20char *h_name; /* official name of host */21char *h_aliases[MAXALIASES]; /* alias list */22int h_addrtype; /* host address type */23int h_length; /* length of address */24/* list of addresses from name server */25struct in_addr h_addr_list[MAXADDRS];26#define h_addr h_addr_list[0] /* address, for backward compatiblity */27} my_hostent;2829typedef struct dns_struct {30/* 'in': This is the string we want to resolve. It can be31* either a host or ip. The string WILL be malloc'ed by32* the "add" function. Do NOT malloc or free this variable!33*/34char *in;3536/* 'out': This is our "resolved" string. It can be37* either a host or ip. The string WILL be malloc'ed by38* the internal resolver. Do NOT malloc or free this variable!39*/40char *out;4142/* alias: this is passed to the alias parser which then interpret's43* the output.44*/45char *alias;4647/* 'callback': This is our callback function. When our 'in' gets48* resolved, we will call this function, with this structure49* as our parameter. Do NOT malloc or free this variable.50*/51void (*callback) (struct dns_struct *); /* Our callback function */5253/* 'callinfo': This allows us to store information that you might54* need for later use when in your 'callback' function. This is55* just a void pointer, so you MUST malloc any of the data you want to56* store here. Once you are done with this variable, you must57* free it!!! BEWARE BEWARE, YOU MUST FREE THIS VARIABLE YOURSELF!58*/59void *callinfo;6061/* 'ip': Internally used, to find out what the 'out' variable is.62* ie, is it a host, or is it ip63*/64int ip;6566/* hostentr: A copy of the hostent structure returned from the67* name server. I am adding it here to extend the ability to68* read multiple IPs. Although this is not generally necessary.69* - Brian Smith70*/71my_hostent *hostentr;7273/* 'next': Internally used. our "next" pointer. */74struct dns_struct *next;75} DNS_QUEUE;7677void start_dns(void);78void stop_dns(void);79void kill_dns(void);80void set_dns_output_fd(fd_set *);81void dns_check(fd_set *);82void check_dns_queue(void);83void add_to_dns_queue(char *, void (*) (DNS_QUEUE *), char *, void *, int);84my_hostent *duphostent(struct hostent *orig);85void freemyhostent(my_hostent *freeme);8687#define DNS_URGENT 188#define DNS_NORMAL 28990#define Q_NEXT(tmp) ((tmp)->next)91#define Q_OPEN(headp, tailp) (*(headp) = *(tailp) = NULL)92939495