2 * include/ircd_res.h for referencing functions in ircd/ircd_res.c
10 #ifndef INCLUDED_config_h
14 #ifndef INCLUDED_sys_types_h
15 #include <sys/types.h>
16 #define INCLUDED_sys_types_h
19 #ifndef INCLUDED_sys_socket_h
20 #include <sys/socket.h>
21 #define INCLUDED_sys_socket_h
26 #ifndef INCLUDED_netinet_in_h
27 #include <netinet/in.h>
28 #define INCLUDED_netinet_in_h
32 #ifndef INCLUDED_stdint_h
34 #define INCLUDED_stdint_h
41 /* Here we define some values lifted from nameser.h */
42 #define NS_NOTIFY_OP 4
44 #define NS_IN6ADDRSZ 16
47 #define NS_CMPRSFLGS 0xc0
48 #define NS_MAXCDNAME 255
65 unsigned short in6_16[8];
70 struct irc_in_addr addr;
78 struct irc_in_addr addr;
83 void *vptr; /* pointer used by callback to identify request */
84 void (*callback)(void* vptr, struct DNSReply *reply); /* callback to call */
89 unsigned id :16; /* query identification number */
90 #ifdef WORDS_BIGENDIAN
91 /* fields in third byte */
92 unsigned qr: 1; /* response flag */
93 unsigned opcode: 4; /* purpose of message */
94 unsigned aa: 1; /* authoritive answer */
95 unsigned tc: 1; /* truncated message */
96 unsigned rd: 1; /* recursion desired */
97 /* fields in fourth byte */
98 unsigned ra: 1; /* recursion available */
99 unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
100 unsigned ad: 1; /* authentic data from named */
101 unsigned cd: 1; /* checking disabled by resolver */
102 unsigned rcode :4; /* response code */
104 /* fields in third byte */
105 unsigned rd :1; /* recursion desired */
106 unsigned tc :1; /* truncated message */
107 unsigned aa :1; /* authoritive answer */
108 unsigned opcode :4; /* purpose of message */
109 unsigned qr :1; /* response flag */
110 /* fields in fourth byte */
111 unsigned rcode :4; /* response code */
112 unsigned cd: 1; /* checking disabled by resolver */
113 unsigned ad: 1; /* authentic data from named */
114 unsigned unused :1; /* unused bits (MBZ as of 4.9.3a3) */
115 unsigned ra :1; /* recursion available */
117 /* remaining bytes */
118 unsigned qdcount :16; /* number of question entries */
119 unsigned ancount :16; /* number of answer entries */
120 unsigned nscount :16; /* number of authority entries */
121 unsigned arcount :16; /* number of resource entries */
124 extern int init_resolver(void);
125 extern void restart_resolver(void);
126 extern void add_local_domain(char *hname, size_t size);
127 extern size_t cres_mem(struct Client* cptr);
128 extern void delete_resolver_queries(const void *vptr);
129 extern void report_dns_servers(struct Client *source_p, const struct StatDesc *sd, char *param);
130 extern void gethost_byname(const char *name, const struct DNSQuery *query);
131 extern void gethost_byaddr(const struct irc_in_addr *addr, const struct DNSQuery *query);
133 extern int irc_in_addr_valid(const struct irc_in_addr *addr);
134 extern int irc_in_addr_cmp(const struct irc_in_addr *a, const struct irc_in_addr *b);
135 extern int irc_in_addr_is_ipv4(const struct irc_in_addr *addr);
136 extern int irc_in_addr_is_loopback(const struct irc_in_addr *addr);