Define some convenience information and tables related to ifmedia status

bits for ifconfig(8).
This commit is contained in:
thorpej 2000-01-25 00:58:59 +00:00
parent d3657aebd3
commit fe58a40561

View File

@ -1,7 +1,7 @@
/* $NetBSD: if_media.h,v 1.17 2000/01/24 01:20:21 augustss Exp $ */
/* $NetBSD: if_media.h,v 1.18 2000/01/25 00:58:59 thorpej Exp $ */
/*-
* Copyright (c) 1998 The NetBSD Foundation, Inc.
* Copyright (c) 1998, 2000 The NetBSD Foundation, Inc.
* All rights reserved.
*
* This code is derived from software contributed to The NetBSD Foundation
@ -241,6 +241,15 @@ struct ifmedia_entry *ifmedia_match __P((struct ifmedia *ifm, int flags,
#define IFM_AVALID 0x00000001 /* Active bit valid */
#define IFM_ACTIVE 0x00000002 /* Interface attached to working net */
/* Mask of "status valid" bits, for ifconfig(8). */
#define IFM_STATUS_VALID IFM_AVALID
/* List of "status valid" bits, for ifconfig(8). */
#define IFM_STATUS_VALID_LIST { \
IFM_AVALID, \
0, \
}
/*
* Macros to extract various bits of information from the media word.
*/
@ -386,4 +395,34 @@ struct ifmedia_description {
{ 0, NULL }, \
}
/*
* Status bit descriptions for the various media types.
*/
struct ifmedia_status_description {
int ifms_type;
int ifms_valid;
int ifms_bit;
const char *ifms_string[2];
};
#define IFM_STATUS_DESC(ifms, bit) \
(ifms)->ifms_string[((ifms)->ifms_bit & (bit)) ? 1 : 0]
#define IFM_STATUS_DESCRIPTIONS { \
{ IFM_ETHER, IFM_AVALID, IFM_ACTIVE, \
{ "no carrier", "active" } }, \
\
{ IFM_FDDI, IFM_AVALID, IFM_ACTIVE, \
{ "no ring", "inserted" } }, \
\
{ IFM_TOKEN, IFM_AVALID, IFM_ACTIVE, \
{ "no ring", "inserted" } }, \
\
{ IFM_IEEE80211, IFM_AVALID, IFM_ACTIVE, \
{ "no network", "active" } }, \
\
{ 0, 0, 0, \
{ NULL, NULL } }, \
}
#endif /* _NET_IF_MEDIA_H_ */