1 #ifndef _NET_IF_DL_H_
    2 #define _NET_IF_DL_H_
    3 /*
    4  * The Link-Level Socket Interface
    5  *
    6  * Copyright © 1994-2000 AmiTCP/IP Group,
    7  * Network Solutions Development, Inc.
    8  * All rights reserved.
    9  *
   10  * $Id: if_dl.h,v 1.3 2019/02/04 19:00:23 jacadcaps Exp $
   11  */
   12 
   13 #pragma pack(2)
   14 
   15 /* 
   16  * A Link-Level Sockaddr may specify the interface in one of two
   17  * ways: either by means of a system-provided index number (computed
   18  * anew and possibly differently on every reboot), or by a human-readable
   19  * string such as "il0" (for managerial convenience).
   20  * 
   21  * Census taking actions, such as something akin to SIOCGCONF would return
   22  * both the index and the human name.
   23  * 
   24  * High volume transactions (such as giving a link-level ``from'' address
   25  * in a recvfrom or recvmsg call) may be likely only to provide the indexed
   26  * form, (which requires fewer copy operations and less space).
   27  * 
   28  * The form and interpretation  of the link-level address is purely a matter
   29  * of convention between the device driver and its consumers; however, it is
   30  * expected that all drivers for an interface of a given if_type will agree.
   31  */
   32 
   33 /*
   34  * Structure of a Link-Level sockaddr:
   35  */
   36 struct sockaddr_dl {
   37 	u_char	sdl_len;	/* Total length of sockaddr */
   38 	u_char	sdl_family;	/* AF_DLI */
   39 	u_short	sdl_index;	/* if != 0, system given index for interface */
   40 	u_char	sdl_type;	/* interface type */
   41 	u_char	sdl_nlen;	/* interface name length, no trailing 0 reqd. */
   42 	u_char	sdl_alen;	/* link level address length */
   43 	u_char	sdl_slen;	/* link layer selector length */
   44 	char	sdl_data[IFNAMSIZ + 12];	
   45 				/* minimum work area, can be larger;
   46 				   contains both if name and ll address */
   47 };
   48 
   49 #define LLADDR(s) ((caddr_t)((s)->sdl_data + (s)->sdl_nlen))
   50 
   51 #ifndef KERNEL
   52 
   53 #include <sys/cdefs.h>
   54 
   55 __BEGIN_DECLS
   56 void	link_addr __P((const char *, struct sockaddr_dl *));
   57 char	*link_ntoa __P((const struct sockaddr_dl *));
   58 __END_DECLS
   59 
   60 #endif /* !KERNEL */
   61 
   62 
   63 #pragma pack()
   64 
   65 #endif /* !_NET_IF_DL_H_ */