xref: /titanic_51/usr/src/uts/common/net/if_dl.h (revision bbaa8b60dd95d714741fc474adad3cf710ef4efd)
1 /*
2  * Copyright 1993-2003 Sun Microsystems, Inc.  All rights reserved.
3  * Use is subject to license terms.
4  */
5 /*
6  * Copyright (c) 1990, 1993
7  *	The Regents of the University of California.  All rights reserved.
8  *
9  * Redistribution and use in source and binary forms, with or without
10  * modification, are permitted provided that the following conditions
11  * are met:
12  * 1. Redistributions of source code must retain the above copyright
13  *    notice, this list of conditions and the following disclaimer.
14  * 2. Redistributions in binary form must reproduce the above copyright
15  *    notice, this list of conditions and the following disclaimer in the
16  *    documentation and/or other materials provided with the distribution.
17  * 3. All advertising materials mentioning features or use of this software
18  *    must display the following acknowledgement:
19  *	This product includes software developed by the University of
20  *	California, Berkeley and its contributors.
21  * 4. Neither the name of the University nor the names of its contributors
22  *    may be used to endorse or promote products derived from this software
23  *    without specific prior written permission.
24  *
25  * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
26  * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
27  * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
28  * ARE DISCLAIMED.  IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
29  * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
30  * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
31  * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
32  * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
33  * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
34  * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
35  * SUCH DAMAGE.
36  */
37 
38 #ifndef	_NET_IF_DL_H
39 #define	_NET_IF_DL_H
40 
41 #pragma ident	"%Z%%M%	%I%	%E% SMI"
42 /* from UCB 8.1 (Berkeley) 6/10/93 */
43 
44 #ifdef	__cplusplus
45 extern "C" {
46 #endif
47 
48 /*
49  * A Link-Level Sockaddr may specify the interface in one of two
50  * ways: either by means of a system-provided index number (computed
51  * anew and possibly differently on every reboot), or by a human-readable
52  * string such as "il0" (for managerial convenience).
53  *
54  * Census taking actions, such as something akin to SIOCGCONF would return
55  * both the index and the human name.
56  *
57  * High volume transactions (such as giving a link-level ``from'' address
58  * in a recvfrom or recvmsg call) may be likely only to provide the indexed
59  * form, (which requires fewer copy operations and less space).
60  *
61  * The form and interpretation  of the link-level address is purely a matter
62  * of convention between the device driver and its consumers; however, it is
63  * expected that all drivers for an interface of a given if_type will agree.
64  */
65 
66 /*
67  * Structure of a Link-Level sockaddr:
68  */
69 struct sockaddr_dl {
70 	ushort_t sdl_family;	/* AF_LINK */
71 	ushort_t sdl_index;	/* if != 0, system given index for interface */
72 	uchar_t	sdl_type;	/* interface type */
73 	uchar_t	sdl_nlen;	/* interface name length, no trailing 0 reqd. */
74 	uchar_t	sdl_alen;	/* link level address length */
75 	uchar_t	sdl_slen;	/* link layer selector length */
76 	char	sdl_data[244];	/* contains both if name and ll address */
77 };
78 
79 #define	LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
80 
81 #ifdef	__STDC__
82 extern char *_link_ntoa(const unsigned char *, char *, int, int);
83 extern unsigned char *_link_aton(const char *, int *);
84 #else	/* __STDC__ */
85 extern char *_link_ntoa();
86 extern unsigned char *_link_aton();
87 #endif	/* __STDC__ */
88 
89 #ifdef	__cplusplus
90 }
91 #endif
92 
93 #endif	/* _NET_IF_DL_H */
94