Author: Bleep <tomh@inxpress.net>
[ircu2.10.12-pk.git] / include / res.h
1 /*
2  * irc2.7.2/ircd/res.h (C)opyright 1992 Darren Reed.
3  *
4  * $Id$
5  */
6 #ifndef INCLUDED_res_h
7 #define INCLUDED_res_h
8
9 #ifndef INCLUDED_sys_types_h
10 #include <sys/types.h>       /* time_t */
11 #define INCLUDED_sys_types_h
12 #endif
13
14 struct Client;
15 struct hostent;
16
17 struct DNSReply {
18   struct hostent* hp;        /* hostent struct  */
19   int             ref_count; /* reference count */
20 };
21
22 struct DNSQuery {
23   void* vptr;               /* pointer used by callback to identify request */
24   void (*callback)(void* vptr, struct DNSReply* reply); /* callback to call */
25 };
26
27 extern int ResolverFileDescriptor;  /* GLOBAL - file descriptor (s_bsd.c) */
28
29 extern void get_res(void);
30 extern struct DNSReply* gethost_byname(const char* name, 
31                                        const struct DNSQuery* req);
32 extern struct DNSReply* gethost_byaddr(const char* name, 
33                                        const struct DNSQuery* req);
34 extern int             init_resolver(void);
35 extern void            restart_resolver(void);
36 extern time_t          timeout_resolver(time_t now);
37 /*
38  * delete_resolver_queries - delete all outstanding queries for the
39  * pointer arg, DO NOT call this from a resolver callback function the
40  * resolver will delete the query itself for the affected client.
41  */
42 extern void            delete_resolver_queries(const void* vptr);
43 extern unsigned long   cres_mem(struct Client* cptr);
44 extern int             m_dns(struct Client* cptr, struct Client* sptr,
45                              int parc, char* parv[]);
46 extern int             resolver_read(void);
47 extern void            resolver_read_multiple(int count);
48 extern void            flush_resolver_cache(void);
49
50 /*
51  * add_local_domain - append local domain suffix to hostnames that 
52  * don't contain a dot '.'
53  * name - string to append to
54  * len  - total length of the buffer
55  * name is modified only if there is enough space in the buffer to hold
56  * the suffix
57  */
58 extern void add_local_domain(char* name, size_t len);
59
60 #endif /* INCLUDED_res_h */
61