Watt-32 tcp/ip  2.2 dev-rel.10
Functions
presaddr.c File Reference

Go to the source code of this file.

Functions

static const char * inet_ntop4 (const u_char *src, char *dst, size_t size)
 Format an IPv4 address, more or less like inet_ntoa(). More...
 
static int inet_pton4 (const char *src, u_char *dst)
 Like inet_aton() but without all the hexadecimal and shorthand. More...
 
static const char * inet_ntop6 (const u_char *src, char *dst, size_t size)
 Convert IPv6 binary address into presentation (printable) format. More...
 
static int inet_pton6 (const char *src, u_char *dst)
 Convert presentation level address to network order binary form. More...
 
const char *W32_CALL inet_ntop (int af, const void *src, char *dst, size_t size)
 Convert a network format address to presentation format. More...
 
int W32_CALL inet_pton (int af, const char *src, void *dst)
 Convert from presentation format (which usually means ASCII printable) to network format (which is usually some kind of binary format). More...
 
int main (int argc, char **argv)
 

Detailed Description

Convert network addresses to printable format.

Definition in file presaddr.c.

Function Documentation

const char* W32_CALL inet_ntop ( int  af,
const void src,
char *  dst,
size_t  size 
)

Convert a network format address to presentation format.

Return values
pointerto presentation format address (`dst'),
NULLon error (see errno).
Author
Paul Vixie, 1996.

Definition at line 40 of file presaddr.c.

References inet_ntop4(), and inet_ntop6().

static const char * inet_ntop4 ( const u_char *  src,
char *  dst,
size_t  size 
)
static

Format an IPv4 address, more or less like inet_ntoa().

Return values
`dst'(as a const)
Note
  • uses no statics
  • takes a u_char* not an in_addr as input
Author
Paul Vixie, 1996.

Definition at line 92 of file presaddr.c.

static const char * inet_ntop6 ( const u_char *  src,
char *  dst,
size_t  size 
)
static

Convert IPv6 binary address into presentation (printable) format.

Author
Paul Vixie, 1996.

Definition at line 110 of file presaddr.c.

References inet_ntop4().

int W32_CALL inet_pton ( int  af,
const char *  src,
void dst 
)

Convert from presentation format (which usually means ASCII printable) to network format (which is usually some kind of binary format).

Return values
1the address was valid for the specified address family.
0the address wasn't valid (`dst' is untouched in this case).
-1some other error occurred (`dst' is untouched in this case, too).
Author
Paul Vixie, 1996.

Definition at line 66 of file presaddr.c.

References inet_pton4(), and inet_pton6().

static int inet_pton4 ( const char *  src,
u_char *  dst 
)
static

Like inet_aton() but without all the hexadecimal and shorthand.

Return values
1if `src' is a valid dotted quad
0if `src' is not a valid dotted quad.
Note
does not touch `dst' unless it's returning 1.
Author
Paul Vixie, 1996.

Definition at line 222 of file presaddr.c.

static int inet_pton6 ( const char *  src,
u_char *  dst 
)
static

Convert presentation level address to network order binary form.

Return values
1if `src' is a valid [RFC1884 2.2] address.
0otherwise.
Note
  • does not touch `dst' unless it's returning 1.
  • `::' in a full address is silently ignored.
Author
Paul Vixie, 1996.
credit: inspired by Mark Andrews.

Definition at line 280 of file presaddr.c.

References inet_pton4().