Watt-32 tcp/ip  2.2 dev-rel.10
Functions | Variables
gethost.c File Reference

Go to the source code of this file.

Functions

static BOOL gethostbyname_internal (const char *name, const char **alias, struct _hostent *ret)
 
static BOOL gethostbyaddr_internal (const char *addr_name, int len, int type, struct _hostent *ret)
 
static struct hostentfill_hostent (const struct _hostent *h)
 
static struct _hostentadd_hostent (struct _hostent *h, const char *name, const char *cname, DWORD *alist, DWORD addr, DWORD ttl, BOOL windns)
 
static void _endhostent (void)
 
void W32_CALL ReadHostsFile (const char *fname)
 
const char *W32_CALL GetHostsFile (void)
 Return name of hosts-file. More...
 
void W32_CALL CloseHostFile (void)
 Close hosts-file. More...
 
void W32_CALL ReopenHostFile (void)
 Reopen hosts-file. More...
 
struct hostent *W32_CALL gethostent (void)
 Return the next (non-commented) line from the host-file. More...
 
struct hostent *W32_CALL gethostbyname (const char *name)
 
struct hostent *W32_CALL gethostbyname2 (const char *name, int family)
 
struct hostent *W32_CALL gethostbyaddr (const char *addr_name, int len, int type)
 
void W32_CALL sethostent (int stayopen)
 
void W32_CALL endhostent (void)
 
void uninit_warn (const char *func)
 
int *W32_CALL __h_errno_location (void)
 
static BOOL ReverseHostsList (void)
 
void W32_CALL DumpHostsCache (void)
 
static void print_hosts (void)
 
void do_sleep (int time)
 
int main (void)
 

Variables

int h_errno = 0
 
unsigned netdbCacheLife = MAX_CACHE_LIFE
 
static char * hostFname = NULL
 
static FILE * hostFile = NULL
 
static BOOL hostClose = FALSE
 
static const char * from_where = NULL
 
static struct _hostenthost0 = NULL
 
static BOOL did_lookup = FALSE
 
static BOOL is_addr = FALSE
 

Detailed Description

BSD-like host-entry functions.

Definition in file gethost.c.

Function Documentation

void W32_CALL CloseHostFile ( void  )

Close hosts-file.

To prevent running out of file-handles, one should close the hosts-file before spawning a new shell.

Definition at line 197 of file gethost.c.

static BOOL gethostbyaddr_internal ( const char *  addr_name,
int  len,
int  type,
struct _hostent ret 
)
static
Todo:
Should return all our addresses if we're multihomed.
Todo:
should be the new aliases

Definition at line 512 of file gethost.c.

References gethostid(), netdb_init(), and sin_mask.

static BOOL gethostbyname_internal ( const char *  name,
const char **  alias,
struct _hostent ret 
)
static
Todo:
should be canonical name

Definition at line 306 of file gethost.c.

References called_from_resolve, gethostid(), hostname, netdb_init(), and resolve().

struct hostent* W32_CALL gethostent ( void  )

Return the next (non-commented) line from the host-file.

Format is: ip-address host-name [alias..] {
| # ..}

Definition at line 218 of file gethost.c.

References _strlcpy(), isaddr(), netdb_init(), and strltrim().

const char* W32_CALL GetHostsFile ( void  )

Return name of hosts-file.

Note
Only returns the last 'hosts' file opened.

Definition at line 187 of file gethost.c.

void W32_CALL ReopenHostFile ( void  )

Reopen hosts-file.

Call this after e.g. system() returns.

Definition at line 208 of file gethost.c.