WvStreams
wvresolver.h
1 /* -*- Mode: C++ -*-
2  * Worldvisions Weaver Software:
3  * Copyright (C) 1997-2002 Net Integration Technologies, Inc.
4  *
5  * DNS name resolver with support for background lookups.
6  */
7 #ifndef __WVRESOLVER_H
8 #define __WVRESOLVER_H
9 
10 #include "wvaddr.h"
11 #include "wvstream.h"
12 #include "wvlinklist.h"
13 #include "wvhashtable.h"
14 
15 class WvResolverHost;
16 class WvResolverAddr;
17 
18 DeclareWvDict(WvResolverHost, WvString, name);
19 DeclareWvDict(WvResolverAddr, WvIPAddr, addr[0]);
20 
21 DeclareWvList(WvIPAddr);
22 
25 {
26  static int numresolvers;
27  static WvResolverHostDict *hostmap;
28  static WvResolverAddrDict *addrmap;
29 public:
30  WvResolver();
31  ~WvResolver();
32 
39  int findaddr(int msec_timeout, WvStringParm name,
40  WvIPAddr const **addr, WvIPAddrList *addrlist = NULL);
41  int findname(int msec_timeout, WvIPAddr *ipaddr, char **name);
42 
43  void clearhost(WvStringParm hostname);
44 
46  void pre_select(WvStringParm hostname, WvStream::SelectInfo &si);
47 
49  bool post_select(WvStringParm hostname, WvStream::SelectInfo &si);
50 };
51 
52 #endif // __WVRESOLVER_H
WvResolver::pre_select
void pre_select(WvStringParm hostname, WvStream::SelectInfo &si)
add all of our waiting fds to an fd_set for use with select().
Definition: wvresolver.cc:316
WvResolver
ASynchronous DNS resolver functions, so that we can do non-blocking lookups.
Definition: wvresolver.h:24
WvResolver::post_select
bool post_select(WvStringParm hostname, WvStream::SelectInfo &si)
determines whether the resolving process is complete.
Definition: wvresolver.cc:331
WvString
WvString is an implementation of a simple and efficient printable-string class.
Definition: wvstring.h:329
WvResolverAddr
Definition: wvresolver.cc:65
IWvStream::SelectInfo
the data structure used by pre_select()/post_select() and internally by select().
Definition: iwvstream.h:50
WvResolver::findaddr
int findaddr(int msec_timeout, WvStringParm name, WvIPAddr const **addr, WvIPAddrList *addrlist=NULL)
Return -1 on timeout, or the number of addresses found, which may be 0 if the address does not exist.
Definition: wvresolver.cc:149
WvIPAddr
An IP address is made up of a "dotted quad" – four decimal numbers in the form www....
Definition: wvaddr.h:249
hostname
WvString hostname()
Do gethostname() without a fixed-length buffer.
Definition: strutils.cc:870
WvResolverHost
Definition: wvresolver.cc:29