Inet – Comtrol eCos User Manual

Page 534

Advertising
background image

Chapter 38. TCP/IP Library Reference

inet

INET(3)

System Library Functions Manual

INET(3)

NAME

inet_addr, inet_aton, inet_lnaof, inet_makeaddr, inet_netof,

inet_network, inet_ntoa, inet_ntop, inet_pton - Internet address manipu-

lation routines

SYNOPSIS

#include

<

sys/socket.h>

#include

<

netinet/in.h>

#include

<

arpa/inet.h>

in_addr_t

inet_addr(const char *cp);

int

inet_aton(const char *cp, struct in_addr *addr);

in_addr_t

inet_lnaof(struct in_addr in);

struct in_addr

inet_makeaddr(unsigned long net, unsigned long lna);

in_addr_t

inet_netof(struct in_addr in);

in_addr_t

inet_network(const char *cp);

char *

inet_ntoa(struct in_addr in);

const char *

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

int

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

DESCRIPTION

The routines inet_aton(), inet_addr() and inet_network() interpret char-

acter strings representing numbers expressed in the Internet standard ‘.’

notation.

The inet_pton() function converts a presentation format

address (that is, printable form as held in a character string) to net-

work format (usually a struct in_addr or some other internal binary rep-

resentation, in network byte order).

It returns 1 if the address was

valid for the specified address family, or 0 if the address wasn’t

parseable in the specified address family, or -1 if some system error

occurred (in which case errno will have been set).

This function is

presently valid for AF_INET and AF_INET6.

The inet_aton() routine inter-

prets the specified character string as an Internet address, placing the

address into the structure provided.

It returns 1 if the string was suc-

cessfully interpreted, or 0 if the string was invalid.

The inet_addr()

430

Advertising