Annotation of libwww/Library/src/HTDNS.html, revision 2.12

2.1       frystyk     1: <HTML>
                      2: <HEAD>
2.10      frystyk     3: <TITLE>W3C Reference Library libwww Domain Name Service</TITLE>
2.12    ! frystyk     4: <!-- Changed by: Henrik Frystyk Nielsen,  2-Apr-1996 -->
2.1       frystyk     5: </HEAD>
                      6: <BODY>
                      7: 
                      8: <H1>Domain Name Service Manager</H1>
                      9: 
                     10: <PRE>
                     11: /*
                     12: **     (c) COPYRIGHT MIT 1995.
                     13: **     Please first read the full copyright statement in the file COPYRIGH.
                     14: */
                     15: </PRE>
                     16: 
                     17: This module has the common code for handling DNS access. It maintains
                     18: a cache of all visited hosts so that subsequent connects to the same
                     19: host doesn't imply a new request to the DNS every time. <P>
                     20: 
                     21: Multihomed hosts are treated specially in that the time spend on every
                     22: connect is measured and kept in the cache. On the next request to the
                     23: same host, the IP-address with the lowest average connect time is
                     24: chosen. If one IP-address fails completely, e.g. <EM>connection
                     25: refused</EM> then it disabled and HTDoConnect tries one of the other
                     26: IP-addresses to the same host.<P>
                     27: 
                     28: If the connect fails in the case of at single-homed host then the
                     29: entry is removed from the cache and HTDoConnect tries again asking the
                     30: DNS. <P>
                     31: 
                     32: This module is implemented by <A HREF="HTDNS.c">HTDNS.c</A>, and it is
                     33: a part of the <A HREF="http://www.w3.org/pub/WWW/Library/"> W3C
                     34: Reference Library</A>.
                     35: 
                     36: <PRE>
                     37: #ifndef HTDNS_H
                     38: #define HTDNS_H
                     39: </PRE>
                     40: 
                     41: <H2>The DNS Object</H2>
                     42: 
                     43: The DNS object contains information obtained from the DNS system but
                     44: in addition it stores known information about the remote server, for
                     45: example the type (HTTP/1.0, HTTP/1.1, FT etc.) along with information
                     46: on how the connections can be used (if it supports persistent TCP
                     47: connections, interleaved access etc.)
                     48: 
                     49: <PRE>
                     50: typedef struct _HTdns HTdns;
                     51: </PRE>
                     52: 
2.12    ! frystyk    53: <H3>Cache Timeouts</H3>
2.1       frystyk    54: 
2.12    ! frystyk    55: When to remove an entry in the cache. The default value is 12h.
2.1       frystyk    56: 
                     57: <PRE>
                     58: extern void HTDNS_setTimeout (time_t timeout);
                     59: extern time_t HTDNS_timeout  (time_t timeout);
                     60: </PRE>
                     61: 
                     62: <H3>Recalculating the Time-Weights on Multihomed Hosts</H3>
                     63: 
                     64: On every connect to a multihomed host, the average connect time is updated
                     65: exponentially for all the entries.
                     66: 
                     67: <PRE>
                     68: extern BOOL HTDNS_updateWeigths (HTdns *dns, int cur, time_t deltatime);
                     69: </PRE>
                     70: 
                     71: <H3>Delete a host element from Cache</H3>
                     72: 
                     73: This function deletes a single cache entry.
                     74: 
                     75: <PRE>
2.9       frystyk    76: extern BOOL HTDNS_delete (const char * host);
2.1       frystyk    77: </PRE>
                     78: 
                     79: <H3>Delete ALL host elements from Cache</H3>
                     80: 
                     81: This function is called from <A HREF="HTAccess.html#Library">
                     82: HTLibTerminate</A>. It can be called at any point in time if the DNS
                     83: cache is going to be flushed.
                     84: 
                     85: <PRE>
                     86: extern BOOL HTDNS_deleteAll (void);
                     87: </PRE>
                     88: 
                     89: <H2>Resolver Functions</H2>
                     90: 
                     91: These are the functions that resolve a host name 
                     92: 
                     93: <H3>Get Host By Socket</H3>
                     94: 
                     95: This function should have been called HTGetHostByAddr but for
                     96: historical reasons this is not the case. <P>
                     97: 
                     98: <PRE>
2.7       frystyk    99: extern char * HTGetHostBySock (int soc);
2.1       frystyk   100: </PRE>
                    101: 
                    102: <H3>Get Host By Name</H3>
                    103: 
                    104: This function gets the address of the host and puts it in to the
                    105: socket structure. It maintains its own cache of connections so that
                    106: the communication to the Domain Name Server is minimized. Returns the
                    107: number of homes or -1 if error.
                    108: 
                    109: <PRE>
                    110: extern int HTGetHostByName (struct _HTNet *net, char *host);
                    111: </PRE>
                    112: 
                    113: <PRE>
                    114: #endif
                    115: </PRE>
                    116: 
2.12    ! frystyk   117: <HR>
        !           118: <ADDRESS>
        !           119: @(#) $Id: Date Author State $
        !           120: </ADDRESS>
2.1       frystyk   121: </BODY>
                    122: </HTML>

Webmaster