xref: /csrg-svn/lib/libc/net/linkaddr.3 (revision 57741)
1.\" Copyright (c) 1993 The Regents of the University of California.
2.\" All rights reserved.
3.\"
4.\" This code is derived from software contributed to Berkeley by
5.\" Donn Seeley at BSDI.
6.\"
7.\" %sccs.include.redist.man%
8.\"
9.\"     @(#)linkaddr.3	5.1 (Berkeley) 01/29/93
10.\"
11.Dd
12.Dt LINK_ADDR 3
13.Os BSD 4.4
14.Sh NAME
15.Nm link_addr ,
16.Nm link_ntoa
17.Nd elementary address specification routines for link level access
18.Sh SYNOPSIS
19.Fd #include <sys/types.h>
20.Fd #include <sys/socket.h>
21.Fd #include <net/if_dl.h>
22.Ft void
23.Fn link_addr "const char *addr" "struct sockaddr_dl *sdl"
24.Ft char *
25.Fn link_ntoa "const struct sockaddr_dl *sdl"
26.Sh DESCRIPTION
27The routine
28.Fn link_addr
29interprets character strings representing
30link-level addresses, returning binary information suitable
31for use in system calls.
32The routine
33.Fn link_ntoa
34takes
35a link-level
36addresses and returns
37.Tn ASCII
38strings representing some of the information present
39(The link level address itself, and the interface name
40or number, if present.)
41This facility is still experimental, and had there been
42further development of the system would have been subject to change.
43.Pp
44The syntax employed by
45.Fn link_addr
46is an optional network interface identifier (a string of the
47form
48.Dq name\ unit ,
49suitable for the first argument to
50.Xr ifconfig 4 )
51followed by a colon when the interface identifier is present,
52followed in all cases by a sequence of hexadecimal
53.Dq digits
54(optionally separated by periods),
55of the form:
56.Bd -filled -offset indent
57<name unit :> <hex digits>.<hex digits>.<hex digits>
58.Ed
59.Pp
60Each pair of hexadecimal digits represents a byte
61with the leading digit indicating the higher-ordered bits.
62A period following an even number of bytes has no
63effect (but may be used to increase legitibility).
64A period following an odd number of bytes has the
65effective of filling the byte of address being translated
66to have its higher order bits filled with zeros.
67.Pp
68Thus le0:8.0.9.13.d.30 represents an ethernet address
69to be transmitted on the first lance ethernet interface.
70.Sh RETURN VALUES
71.Fn link_ntoa
72always returns a null terminated string.
73.Fn link_addr
74has no return value.
75(See
76.Sx BUGS . )
77.Sh SEE ALSO
78.Xr iso 4 ,
79.Sh HISTORY
80The
81.Fn link_addr
82and
83.Fn link_ntoa
84functions appeared in
85.Bx 4.3 Reno  .
86.Sh BUGS
87The returned values for link_ntoa
88reside in a static memory area.
89The function
90.Fn link_addr
91should diagnose improperly formed input, and there should be an unambiguous
92way to recognize this.
93