inet_pton.c File Reference

#include <config.h>
#include <errno.h>
#include <string.h>
#include <isc/net.h>

Go to the source code of this file.

Defines

#define NS_INT16SZ   2
 INT16 Size.
#define NS_INADDRSZ   4
 IPv4 Address Size.
#define NS_IN6ADDRSZ   16
 IPv6 Address Size.

Functions

static int inet_pton4 (const char *src, unsigned char *dst)
 like inet_aton() but without all the hexadecimal and shorthand.
static int inet_pton6 (const char *src, unsigned char *dst)
 convert presentation level address to network order binary form.
int isc_net_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).


Detailed Description

Definition in file inet_pton.c.


Define Documentation

#define NS_INT16SZ   2

INT16 Size.

Definition at line 33 of file inet_pton.c.

#define NS_INADDRSZ   4

IPv4 Address Size.

Definition at line 35 of file inet_pton.c.

Referenced by add_nameserver(), inet_pton4(), and inet_pton6().

#define NS_IN6ADDRSZ   16

IPv6 Address Size.

Definition at line 37 of file inet_pton.c.


Function Documentation

static int inet_pton4 ( const char *  src,
unsigned char *  dst 
) [static]

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

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

Definition at line 82 of file inet_pton.c.

References digits, and NS_INADDRSZ.

Referenced by inet_pton6(), and isc_net_pton().

static int inet_pton6 ( const char *  src,
unsigned char *  dst 
) [static]

convert presentation level address to network order binary form.

Returns:
1 if `src' is a valid [RFC1884 2.2] address, else 0.
Note:
(1) does not touch `dst' unless it's returning 1.

(2) :: in a full address is silently ignored.

Author:
inspired by Mark Andrews.

Paul Vixie, 1996.

Definition at line 135 of file inet_pton.c.

References inet_pton4(), NS_IN6ADDRSZ, NS_INADDRSZ, and NS_INT16SZ.

Referenced by isc_net_pton().

int isc_net_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).

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

Definition at line 58 of file inet_pton.c.

References AF_INET6, inet_pton4(), and inet_pton6().


Generated on Tue Apr 28 17:41:18 2015 by Doxygen 1.5.4 for BIND9 Internals 9.11.0pre-alpha