1 /* 2 * Copyright 2007-2012 Haiku, Inc. All Rights Reserved. 3 * Distributed under the terms of the MIT License. 4 */ 5 #ifndef _NET_IF_MEDIA_H 6 #define _NET_IF_MEDIA_H 7 8 9 /* bits usage 10 * ---- ----- 11 * 0-4 Media subtype 12 * 5-7 Media type 13 * 8-15 Type specific options 14 * 16-31 General options 15 */ 16 17 /* Media types */ 18 19 #define IFM_ETHER 0x00000020 /* Ethernet */ 20 #define IFM_TOKEN 0x00000040 /* Token Ring */ 21 #define IFM_FDDI 0x00000060 /* Fiber Distributed Data Interface */ 22 #define IFM_IEEE80211 0x00000080 /* Wireless IEEE 802.11 */ 23 #define IFM_ATM 0x000000a0 24 #define IFM_CARP 0x000000c0 /* Common Address Redundancy Protocol */ 25 26 /* Media subtypes */ 27 28 /* Ethernet */ 29 #define IFM_AUTO 0 30 #define IFM_10_T 3 /* 10Base-T - RJ45 */ 31 #define IFM_100_TX 6 /* 100Base-TX - RJ45 */ 32 #define IFM_1000_SX 11 /* 1000Base-SX - Fiber Optic */ 33 #define IFM_1000_T 16 /* 1000Base-T - RJ45 */ 34 #define IFM_10G_LR 18 /* 10GBase-LR - Fiber 1310nm */ 35 #define IFM_10G_SR 19 /* 10GBase-SR - Fiber 850nm */ 36 #define IFM_10G_TWINAX 22 /* 10GBase-CR (DAC) */ 37 #define IFM_10G_LRM 24 /* 10GBase-LRM Fiber Optic */ 38 #define IFM_UNKNOWN 25 /* media types not defined yet */ 39 #define IFM_10G_T 26 /* 10GBase-T - RJ45 */ 40 41 /* General options */ 42 43 #define IFM_FULL_DUPLEX 0x00100000 /* Full duplex */ 44 #define IFM_HALF_DUPLEX 0x00200000 /* Half duplex */ 45 #define IFM_LOOP 0x00400000 /* hardware in loopback */ 46 #define IFM_ACTIVE 0x00800000 /* Media link is active */ 47 48 /* Masks */ 49 50 #define IFM_NMASK 0x000000e0 /* Media type */ 51 #define IFM_TMASK 0x0000001f /* Media subtype */ 52 #define IFM_OMASK 0x0000ff00 /* Type specific options */ 53 #define IFM_GMASK 0x0ff00000 /* Generic options */ 54 55 /* Macros for the masks */ 56 57 #define IFM_TYPE(x) ((x) & IFM_NMASK) 58 #define IFM_SUBTYPE(x) ((x) & IFM_TMASK) 59 #define IFM_TYPE_OPTIONS(x) \ 60 ((x) & IFM_OMASK) 61 #define IFM_OPTIONS(x) ((x) & (IFM_OMASK | IFM_GMASK)) 62 63 #endif /* _NET_IF_MEDIA_H */ 64