Main Page | Alphabetical List | Data Structures | File List | Data Fields | Globals | Related Pages

netdb.h File Reference

#include "lwip/ip_addr.h"

Include dependency graph for netdb.h:

This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Data Structures

struct  hostent
struct  protoent
struct  servent

Defines

#define HOST_NOT_FOUND   ENSRNXDOMAIN
#define NO_ADDRESS   ENSRNODATA
#define NO_DATA   ENSRNODATA
#define TRY_AGAIN   ENSRTIMEOUT
#define h_addr   h_addr_list[0]

Functions

protoentgetprotobyname (const char *name)
protoentgetprotobynumber (int proto)
hostentgethostbyname (const char *name)
hostentgethostbyaddr (const char *addr, int len, int type)
void setnameservers (const struct in_addr *ns1, const struct in_addr *ns2)
void getnameservers (struct in_addr *ns1, struct in_addr *ns2)

Variables

int h_errno


Define Documentation

#define h_addr   h_addr_list[0]
 

Definition at line 36 of file netdb.h.

#define HOST_NOT_FOUND   ENSRNXDOMAIN
 

Definition at line 31 of file netdb.h.

#define NO_ADDRESS   ENSRNODATA
 

Definition at line 32 of file netdb.h.

#define NO_DATA   ENSRNODATA
 

Definition at line 33 of file netdb.h.

#define TRY_AGAIN   ENSRTIMEOUT
 

Definition at line 34 of file netdb.h.


Function Documentation

struct hostent* gethostbyaddr const char *  addr,
int  len,
int  type
 

Definition at line 238 of file netdb.c.

References AF_INET, array_free, free, gethostbynameaddr(), hostent::h_addr_list, hostent::h_aliases, hostent::h_name, gethost_result::host, and len.

00239 {
00240     static struct gethost_result r;
00241     static int init = 0;
00242     if (!init) {
00243         init = 1;
00244         memset (&r, 0, sizeof (r));
00245     }
00246     if (len != sizeof (struct in_addr) || type != AF_INET) {
00247         errno = EINVAL;
00248         return 0;
00249     }
00250     if (r.host.h_aliases)
00251         array_free (r.host.h_aliases);
00252     if (r.host.h_addr_list)
00253         array_free (r.host.h_addr_list);
00254     if (r.host.h_name)
00255         free (r.host.h_name);
00256     return gethostbynameaddr (0, *((struct in_addr *) addr), &r);
00257 }

Here is the call graph for this function:

struct hostent* gethostbyname const char *  name  ) 
 

Definition at line 219 of file netdb.c.

References array_free, free, gethostbynameaddr(), hostent::h_addr_list, hostent::h_aliases, hostent::h_name, gethost_result::host, name, and in_addr::s_addr.

Referenced by main().

00220 {
00221     struct in_addr addr;
00222     static struct gethost_result r;
00223     static int init = 0;
00224     if (!init) {
00225         init = 1;
00226         memset (&r, 0, sizeof (r));
00227     }
00228     addr.s_addr = 0;
00229     if (r.host.h_aliases)
00230         array_free (r.host.h_aliases);
00231     if (r.host.h_addr_list)
00232         array_free (r.host.h_addr_list);
00233     if (r.host.h_name)
00234         free (r.host.h_name);
00235     return gethostbynameaddr (name, addr, &r);
00236 }

Here is the call graph for this function:

void getnameservers struct in_addr ns1,
struct in_addr ns2
 

Definition at line 135 of file netdb.c.

References __nameservers, and in_addr::s_addr.

00136 {
00137      ns1->s_addr = __nameservers[0].s_addr;
00138      ns2->s_addr = __nameservers[1].s_addr;
00139 }

struct protoent* getprotobyname const char *  name  ) 
 

struct protoent* getprotobynumber int  proto  ) 
 

void setnameservers const struct in_addr ns1,
const struct in_addr ns2
 

Definition at line 129 of file netdb.c.

References __nameservers, and in_addr::s_addr.

00130 {
00131     __nameservers[0].s_addr = ns1->s_addr;
00132     __nameservers[1].s_addr = ns2->s_addr;
00133 }


Variable Documentation

int h_errno
 

Definition at line 45 of file netdb.h.


Generated on Wed Jan 14 12:59:07 2004 for RTL-lwIP-0.4 by doxygen 1.3.4