MirBSD manpage: link_addr(3), link_ntoa(3)

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


     link_addr, link_ntoa - elementary address specification routines for link
     level access


     #include <sys/types.h>
     #include <sys/socket.h>
     #include <net/if_dl.h>

     link_addr(const char *addr, struct sockaddr_dl *sdl);

     char *
     link_ntoa(const struct sockaddr_dl *sdl);


     The link_addr() function interprets character strings representing link-
     level addresses, returning binary information suitable for use in system
     calls. link_ntoa() takes a link-level address and returns an ASCII string
     representing some of the information present, including the link level
     address itself, and the interface name or number, if present. This facil-
     ity is experimental and is still subject to change.

     For link_addr(), the string addr may contain an optional network inter-
     face identifier of the form "name unit-number", suitable for the first
     argument to ifconfig(8), followed in all cases by a colon and an inter-
     face address in the form of groups of hexadecimal digits separated by
     periods. Each group represents a byte of address; address bytes are
     filled left to right from low order bytes through high order bytes.

     Thus le0: represents an Ethernet address to be transmitted
     on the first Lance Ethernet interface.


     link_ntoa() always returns a NUL-terminated string. link_addr() has no
     return value. (See BUGS.)




     The link_addr() and link_ntoa() functions appeared in 4.3BSD-Reno.


     The returned values for link_ntoa() reside in a static memory area.

     The function link_addr() should diagnose improperly formed input, and
     there should be an unambiguous way to recognize this.

     If the sdl_len field of the link socket address sdl is 0, link_ntoa()
     will not insert a colon before the interface address bytes. If this
     translated address is given to link_addr() without inserting an initial
     colon, the latter will not interpret it correctly.

MirBSD #10-current              July 28, 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