Getaddrinfo – Comtrol eCos User Manual

Page 512

Advertising
background image

Chapter 38. TCP/IP Library Reference

The ether_ntoa() function converts this structure into an ASCII string of

the form “xx:xx:xx:xx:xx:xx”, consisting of 6 hexadecimal numbers sepa-

rated by colons.

It returns a pointer to a static buffer that is reused

for each call.

The ether_aton() converts an ASCII string of the same

form and to a structure containing the 6 octets of the address.

It

returns a pointer to a static structure that is reused for each call.

The ether_ntohost() and ether_hostton() functions interrogate the

database mapping host names to Ethernet addresses, /etc/ethers.

The

ether_ntohost() function looks up the given Ethernet address and writes

the associated host name into the character buffer passed.

This buffer

should be MAXHOSTNAMELEN characters in size.

The ether_hostton() func-

tion looks up the given host name and writes the associated Ethernet

address into the structure passed.

Both functions return zero if they

find the requested host name or address, and -1 if not.

Each call reads /etc/ethers from the beginning; if a ‘+’ appears alone on

a line in the file, then ether_hostton() will consult the ethers.byname

YP map, and ether_ntohost() will consult the ethers.byaddr YP map.

The ether_line() function parses a line from the /etc/ethers file and

fills in the passed struct ether_addr and character buffer with the Eth-

ernet address and host name on the line.

It returns zero if the line was

successfully parsed and -1 if not.

The character buffer should be

MAXHOSTNAMELEN characters in size.

FILES

/etc/ethers

SEE ALSO

ethers(5)

HISTORY

The ether_ntoa(), ether_aton(), ether_ntohost(), ether_hostton(), and

ether_line() functions were adopted from SunOS and appeared in NetBSD 0.9

b.

BUGS

The data space used by these functions is static; if future use requires

the data, it should be copied before any subsequent calls to these func-

tions overwrite it.

BSD

December 16, 1993

BSD

getaddrinfo

GETADDRINFO(3)

System Library Functions Manual

GETADDRINFO(3)

NAME

getaddrinfo, freeaddrinfo, gai_strerror - nodename-to-address translation

in protocol-independent manner

408

Advertising