- ipv6 support (-DUSE_IPV6)
[sip-router] / resolve.h
1 /*
2  * $Id$
3  *
4  * resolver related functions
5  */
6
7
8 #ifndef resolve_h
9 #define resolve_h
10
11 #include <netdb.h>
12
13
14 /* gethostbyname wrappers
15  * use this, someday htey will use a local cache */
16
17
18
19 static inline struct hostent* resolvehost(const char* name)
20 {
21         struct hostent* he;
22         
23 #ifdef DNS_IP_HACK
24 #endif
25
26         he=gethostbyname(name); /*ipv4*/
27
28 #ifdef USE_IPV6
29         if(he==0){
30                 /*try ipv6*/
31                 he=gethostbyname2(name, AF_INET6);
32         }
33 #endif
34         return he;
35 }
36
37
38
39 #define rev_resolvehost(ip) gethostbyaddr((ip)->u.addr, (ip)->len, (ip)->af);
40
41
42 #endif