TCP/IP Programming Manual

STRUCT if_nameindex_tal (*);
BEGIN
INT(32) if_index;
STRING .EXT if_name;
END;
if_index
specifies the index to be mapped to an interface name.
if_name
specifies the buffer to receive the mapped name. The buffer must be at least IF_NAMESIZE
bytes long; IF_NAMESIZE is defined in the header file in.h.
ifreq
The interface request structure is used for socket I/O control operations. All interface control
operations must have parameter definitions that begin with ifr_name. The remaining definitions
can be interface-specific. This structure is defined in the if.h header file. Use this structure if you
are writing a transport protocol such as TCP.
C Declaration
#include <if.h>
struct ifreq {
#if defined(_GUARDIAN_TARGET) \\ defined (_GUARDIAN_SOCKETS)
unsigned long ifr_filler;
#endif
#define IFNAMSIZ 16
char ifr_name[IFNAMSIZ];
union {
struct sockaddr ifru_addr;
struct sockaddr ifru_dstaddr;
struct sockaddr ifru_broadaddr;
short ifru_flags;
int ifru_metric;
caddr_t ifru_data;
int ifru_value;
u_long ifru_index;
} ifr_ifru;
#define ifr_addr ifr_ifru.ifru_addr
#define ifr_dstaddr ifr_ifru.ifru_dstaddr
#define ifr_broadaddr ifr_ifru.ifru_broadaddr
#define ifr_flags ifr_ifru.ifru_flags
#define ifr_metric ifr_ifru.ifru_metric
#define ifr_data ifr_ifru.ifru_data
};
TAL Declaration
?NOLIST, SOURCE SOCKDEFT
STRUCT ifreq (*);
BEGIN
INT(32) ifr_filler;
STRING ifr_name [0:IFNAMESIZ-1];
STRUCT ifr_addr (sockaddr);
STRUCT ifr_dstaddr (sockaddr) = if_addr;
STRUCT ifr_broadaddr (sockaddr) = if_addr;
INT(32) ifr_flags = if_addr;
STRING .EXT ifr_metric = if_addr;
END;
68 Data Structures