Source-Changes-HG archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

[src/trunk]: src/sys/net Define some convenience information and tables relat...



details:   https://anonhg.NetBSD.org/src/rev/a663d340619b
branches:  trunk
changeset: 481218:a663d340619b
user:      thorpej <thorpej%NetBSD.org@localhost>
date:      Tue Jan 25 00:58:59 2000 +0000

description:
Define some convenience information and tables related to ifmedia status
bits for ifconfig(8).

diffstat:

 sys/net/if_media.h |  43 +++++++++++++++++++++++++++++++++++++++++--
 1 files changed, 41 insertions(+), 2 deletions(-)

diffs (64 lines):

diff -r dc994dc2f320 -r a663d340619b sys/net/if_media.h
--- a/sys/net/if_media.h        Tue Jan 25 00:19:30 2000 +0000
+++ b/sys/net/if_media.h        Tue Jan 25 00:58:59 2000 +0000
@@ -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 @@
 #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 @@
        { 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_ */



Home | Main Index | Thread Index | Old Index