?? htdns.h
字號:
/* W3C Sample Code Library libwww DNS Class! Domain Name Service Class!*//*** (c) COPYRIGHT MIT 1995.** Please first read the full copyright statement in the file COPYRIGH.*//*The DNS Class defines generic access to the DNS system. It maintainsa cache of all visited hosts so that subsequent connects to the same hostdoesn't imply a new request to the DNS every time. Multihomed hosts are treatedspecially in that the time spend on every connect is measured and kept inthe cache. On the next request to the same host, the IP-address with thelowest average connect time is chosen. If one IP-address fails completely,e.g. connection refused then it disabled and HTDoConnect tries oneof the other IP-addresses to the same host.Every entry in the cache has its own time to live (TTL) and hence the cachemanages its own automatic garbage collection. Currently the TTL is notbound to the DNS records which should be changed. You can set the DNS objectTTLThis module is implemented by HTDNS.c, and it is apart of the W3C Sample Code Library.*/#ifndef HTDNS_H#define HTDNS_H/**/typedef struct _HTdns HTdns;/*. DNS Cache Expiration Time.When to remove an entry in the DNS cache. We maintain our own DNS cache aswe keep track of the connect time, pick the fastet host on multi-homed hostsetc. However we DO NOT HONOR DNS TTL Records which is thereason for why the expiration must be faily short (the default value is 30mins), so that it doesn't collide with the DNS mechanism for timing out DNSrecords befoew swapping IP addresses around.*/extern void HTDNS_setTimeout (time_t timeout);extern time_t HTDNS_timeout (time_t timeout);/*. Creation and Deletion Methods.( Add a DNS Object)Add an element to the cache of visited hosts. The homes variableindicates the number of IP addresses found when looking up the name. A hostname must NOT contain a port number.*/extern HTdns * HTDNS_add (HTList * list, struct hostent * element, char * host, int * homes);/*( Delete a DNS object)This function flushes the DNS object from the cache and frees up memory*/extern BOOL HTDNS_delete (const char * host);/*( Delete ALL DNS objects)This function is called from HTLibTerminate. Itcan be called at any point in time if the DNS cache is going to be flushed.*/extern BOOL HTDNS_deleteAll (void);/*. DNS Class Methods.( Recalculating the Time Weights on Multihomed Host)On every connect to a multihomed host, the average connect time is updatedexponentially for all the entries.*/extern BOOL HTDNS_updateWeigths (HTdns *dns, int cur, ms_t deltatime);/*. Resolver Functions.These are the functions that resolve a host name( Get Host By Socket)This function should have been called HTGetHostByAddr but for historicalreasons this is not the case.*/extern char * HTGetHostBySock (int soc);/*( Get Host By Name)This function gets the address of the host and puts it in to the socketstructure. It maintains its own cache of connections so that the communicationto the Domain Name Server is minimized. Returns the number of homes or -1if error.*/extern int HTGetHostByName (HTHost * host, char *hostname, HTRequest * request);/**/#endif/* @(#) $Id: HTDNS.html,v 2.19 1999/02/05 17:49:50 frystyk Exp $*/
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -