MirBSD manpage: ethers(3), ether_addr(3), ether_aton(3), ether_hostton(3), ether_line(3), ether_ntoa(3), ether_ntohost(3)

ETHERS(3)                  BSD Programmer's Manual                   ETHERS(3)


     ether_aton, ether_ntoa, ether_addr, ether_ntohost, ether_hostton,
     ether_line - get ethers entry


     #include <sys/socket.h>
     #include <net/if.h>
     #include <netinet/in.h>
     #include <netinet/if_ether.h>

     char *
     ether_ntoa(struct ether_addr *e);

     struct ether_addr *
     ether_aton(const char *s);

     ether_ntohost(char *hostname, struct ether_addr *e);

     ether_hostton(const char *hostname, struct ether_addr *e);

     ether_line(const char *l, struct ether_addr *e, char *hostname);


     Ethernet addresses are represented by the following structure:

           struct ether_addr {
                   u_int8_t  ether_addr_octet[6];

     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
     separated 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 data-
     base 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() function
     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.

     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.






     The ether_ntoa(), ether_aton(), ether_ntohost(), ether_hostton(), and
     ether_line() functions were adopted from SunOS and appeared in
     NetBSD 0.9b.


     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.

MirBSD #10-current            December 16, 1993                              1

Generated on 2022-12-24 01:00:14 by $MirOS: src/scripts/roff2htm,v 1.113 2022/12/21 23:14:31 tg Exp $ — This product includes material provided by mirabilos.

These manual pages and other documentation are copyrighted by their respective writers; their sources are available at the project’s CVSweb, AnonCVS and other mirrors. The rest is Copyright © 2002–2022 MirBSD.

This manual page’s HTML representation is supposed to be valid XHTML/1.1; if not, please send a bug report — diffs preferred.

Kontakt / Impressum & Datenschutzerklärung