1/*
2 * Copyright (c) 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
--- 104 unchanged lines hidden (view full) ---
113 * LINKTYPE_* values, either).
114 */
115#define LINKTYPE_NULL DLT_NULL
116#define LINKTYPE_ETHERNET DLT_EN10MB /* also for 100Mb and up */
117#define LINKTYPE_EXP_ETHERNET DLT_EN3MB /* 3Mb experimental Ethernet */
118#define LINKTYPE_AX25 DLT_AX25
119#define LINKTYPE_PRONET DLT_PRONET
120#define LINKTYPE_CHAOS DLT_CHAOS
121#define LINKTYPE_TOKEN_RING DLT_IEEE802 /* DLT_IEEE802 is used for Token Ring */
122#define LINKTYPE_ARCNET_BSD DLT_ARCNET /* BSD-style headers */
123#define LINKTYPE_SLIP DLT_SLIP
124#define LINKTYPE_PPP DLT_PPP
125#define LINKTYPE_FDDI DLT_FDDI
126
127/*
128 * LINKTYPE_PPP is for use when there might, or might not, be an RFC 1662
129 * PPP in HDLC-like framing header (with 0xff 0x03 before the PPP protocol
--- 58 unchanged lines hidden (view full) ---
188
189/*
190 * Reserved for use with OpenBSD ipfilter.
191 */
192#define LINKTYPE_IPFILTER 116
193
194#define LINKTYPE_PFLOG 117 /* OpenBSD DLT_PFLOG */
195#define LINKTYPE_CISCO_IOS 118 /* For Cisco-internal use */
196#define LINKTYPE_PRISM_HEADER 119 /* 802.11+Prism II monitor mode */
197#define LINKTYPE_AIRONET_HEADER 120 /* FreeBSD Aironet driver stuff */
198
199/*
200 * Reserved for Siemens HiPath HDLC.
201 */
202#define LINKTYPE_HHDLC 121
203
204#define LINKTYPE_IP_OVER_FC 122 /* RFC 2625 IP-over-Fibre Channel */
205#define LINKTYPE_SUNATM 123 /* Solaris+SunATM */
206
207/*
208 * Reserved as per request from Kent Dahlgren <kent@praesum.com>
209 * for private use.
210 */
211#define LINKTYPE_RIO 124 /* RapidIO */
212#define LINKTYPE_PCI_EXP 125 /* PCI Express */
213#define LINKTYPE_AURORA 126 /* Xilinx Aurora link layer */
214
215#define LINKTYPE_IEEE802_11_RADIO 127 /* 802.11 plus BSD radio header */
216
217/*
218 * Reserved for the TZSP encapsulation, as per request from
219 * Chris Waters <chris.waters@networkchemistry.com>
220 * TZSP is a generic encapsulation for any other link type,
221 * which includes a means to include meta-information
222 * with the packet, e.g. signal strength and channel
223 * for 802.11 packets.
--- 78 unchanged lines hidden (view full) ---
302#define LINKTYPE_USER15 162
303
304/*
305 * For future use with 802.11 captures - defined by AbsoluteValue
306 * Systems to store a number of bits of link-layer information
307 * including radio information:
308 *
309 * http://www.shaftnet.org/~pizza/software/capturefrm.txt
310 *
311 * but could and arguably should also be used by non-AVS Linux
312 * 802.11 drivers; that may happen in the future.
313 */
314#define LINKTYPE_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */
315
316/*
317 * Juniper-private data link type, as per request from
318 * Hannes Gredler <hannes@juniper.net>. The corresponding
319 * DLT_s are used for passing on chassis-internal
320 * metainformation such as QOS profiles, etc..
321 */
322#define LINKTYPE_JUNIPER_MONITOR 164
323
324/*
325 * Reserved for BACnet MS/TP.
326 */
327#define LINKTYPE_BACNET_MS_TP 165
328
329/*
330 * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
331 *
332 * This is used in some OSes to allow a kernel socket filter to distinguish
333 * between incoming and outgoing packets, on a socket intended to
--- 511 unchanged lines hidden (view full) ---
845
846/*
847 * IP-over-Infiniband, as specified by RFC 4391.
848 *
849 * Requested by Petr Sumbera <petr.sumbera@oracle.com>.
850 */
851#define LINKTYPE_IPOIB 242
852
853#define LINKTYPE_MATCHING_MAX 242 /* highest value in the "matching" range */
854
855static struct linktype_map {
856 int dlt;
857 int linktype;
858} map[] = {
859 /*
860 * These DLT_* codes have LINKTYPE_* codes with values identical
861 * to the values of the corresponding DLT_* code.
862 */
863 { DLT_NULL, LINKTYPE_NULL },
864 { DLT_EN10MB, LINKTYPE_ETHERNET },
865 { DLT_EN3MB, LINKTYPE_EXP_ETHERNET },
866 { DLT_AX25, LINKTYPE_AX25 },
867 { DLT_PRONET, LINKTYPE_PRONET },
868 { DLT_CHAOS, LINKTYPE_CHAOS },
869 { DLT_IEEE802, LINKTYPE_TOKEN_RING },
870 { DLT_ARCNET, LINKTYPE_ARCNET_BSD },
871 { DLT_SLIP, LINKTYPE_SLIP },
872 { DLT_PPP, LINKTYPE_PPP },
873 { DLT_FDDI, LINKTYPE_FDDI },
874
875 /*
876 * These DLT_* codes have different values on different
877 * platforms; we map them to LINKTYPE_* codes that
878 * have values that should never be equal to any DLT_*
879 * code.
880 */
881#ifdef DLT_FR
882 /* BSD/OS Frame Relay */
883 { DLT_FR, LINKTYPE_FRELAY },
884#endif
885
886 { DLT_SYMANTEC_FIREWALL, LINKTYPE_SYMANTEC_FIREWALL },
887 { DLT_ATM_RFC1483, LINKTYPE_ATM_RFC1483 },
888 { DLT_RAW, LINKTYPE_RAW },
889 { DLT_SLIP_BSDOS, LINKTYPE_SLIP_BSDOS },
890 { DLT_PPP_BSDOS, LINKTYPE_PPP_BSDOS },
891
892 /* BSD/OS Cisco HDLC */
893 { DLT_C_HDLC, LINKTYPE_C_HDLC },
894
--- 23 unchanged lines hidden (view full) ---
918};
919
920int
921dlt_to_linktype(int dlt)
922{
923 int i;
924
925 /*
926 * Map the values in the matching range.
927 */
928 if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX)
929 return (dlt);
930
931 /*
932 * Map the values outside that range.
933 */
--- 11 unchanged lines hidden (view full) ---
945}
946
947int
948linktype_to_dlt(int linktype)
949{
950 int i;
951
952 /*
953 * Map the values in the matching range.
954 */
955 if (linktype >= LINKTYPE_MATCHING_MIN &&
956 linktype <= LINKTYPE_MATCHING_MAX)
957 return (linktype);
958
959 /*
960 * Map the values outside that range.
--- 150 unchanged lines hidden ---
2 * Copyright (c) 1993, 1994, 1995, 1996, 1997
3 * The Regents of the University of California. All rights reserved.
4 *
5 * Redistribution and use in source and binary forms, with or without
6 * modification, are permitted provided that: (1) source code distributions
7 * retain the above copyright notice and this paragraph in its entirety, (2)
8 * distributions including binary code include the above copyright notice and
--- 104 unchanged lines hidden (view full) ---
113 * LINKTYPE_* values, either).
114 */
115#define LINKTYPE_NULL DLT_NULL
116#define LINKTYPE_ETHERNET DLT_EN10MB /* also for 100Mb and up */
117#define LINKTYPE_EXP_ETHERNET DLT_EN3MB /* 3Mb experimental Ethernet */
118#define LINKTYPE_AX25 DLT_AX25
119#define LINKTYPE_PRONET DLT_PRONET
120#define LINKTYPE_CHAOS DLT_CHAOS
121#define LINKTYPE_TOKEN_RING DLT_IEEE802 /* DLT_IEEE802 is used for Token Ring */
122#define LINKTYPE_ARCNET_BSD DLT_ARCNET /* BSD-style headers */
123#define LINKTYPE_SLIP DLT_SLIP
124#define LINKTYPE_PPP DLT_PPP
125#define LINKTYPE_FDDI DLT_FDDI
126
127/*
128 * LINKTYPE_PPP is for use when there might, or might not, be an RFC 1662
129 * PPP in HDLC-like framing header (with 0xff 0x03 before the PPP protocol
--- 58 unchanged lines hidden (view full) ---
188
189/*
190 * Reserved for use with OpenBSD ipfilter.
191 */
192#define LINKTYPE_IPFILTER 116
193
194#define LINKTYPE_PFLOG 117 /* OpenBSD DLT_PFLOG */
195#define LINKTYPE_CISCO_IOS 118 /* For Cisco-internal use */
196#define LINKTYPE_PRISM_HEADER 119 /* 802.11+Prism II monitor mode */
197#define LINKTYPE_AIRONET_HEADER 120 /* FreeBSD Aironet driver stuff */
198
199/*
200 * Reserved for Siemens HiPath HDLC.
201 */
202#define LINKTYPE_HHDLC 121
203
204#define LINKTYPE_IP_OVER_FC 122 /* RFC 2625 IP-over-Fibre Channel */
205#define LINKTYPE_SUNATM 123 /* Solaris+SunATM */
206
207/*
208 * Reserved as per request from Kent Dahlgren <kent@praesum.com>
209 * for private use.
210 */
211#define LINKTYPE_RIO 124 /* RapidIO */
212#define LINKTYPE_PCI_EXP 125 /* PCI Express */
213#define LINKTYPE_AURORA 126 /* Xilinx Aurora link layer */
214
215#define LINKTYPE_IEEE802_11_RADIO 127 /* 802.11 plus BSD radio header */
216
217/*
218 * Reserved for the TZSP encapsulation, as per request from
219 * Chris Waters <chris.waters@networkchemistry.com>
220 * TZSP is a generic encapsulation for any other link type,
221 * which includes a means to include meta-information
222 * with the packet, e.g. signal strength and channel
223 * for 802.11 packets.
--- 78 unchanged lines hidden (view full) ---
302#define LINKTYPE_USER15 162
303
304/*
305 * For future use with 802.11 captures - defined by AbsoluteValue
306 * Systems to store a number of bits of link-layer information
307 * including radio information:
308 *
309 * http://www.shaftnet.org/~pizza/software/capturefrm.txt
310 *
311 * but could and arguably should also be used by non-AVS Linux
312 * 802.11 drivers; that may happen in the future.
313 */
314#define LINKTYPE_IEEE802_11_RADIO_AVS 163 /* 802.11 plus AVS radio header */
315
316/*
317 * Juniper-private data link type, as per request from
318 * Hannes Gredler <hannes@juniper.net>. The corresponding
319 * DLT_s are used for passing on chassis-internal
320 * metainformation such as QOS profiles, etc..
321 */
322#define LINKTYPE_JUNIPER_MONITOR 164
323
324/*
325 * Reserved for BACnet MS/TP.
326 */
327#define LINKTYPE_BACNET_MS_TP 165
328
329/*
330 * Another PPP variant as per request from Karsten Keil <kkeil@suse.de>.
331 *
332 * This is used in some OSes to allow a kernel socket filter to distinguish
333 * between incoming and outgoing packets, on a socket intended to
--- 511 unchanged lines hidden (view full) ---
845
846/*
847 * IP-over-Infiniband, as specified by RFC 4391.
848 *
849 * Requested by Petr Sumbera <petr.sumbera@oracle.com>.
850 */
851#define LINKTYPE_IPOIB 242
852
853#define LINKTYPE_MATCHING_MAX 242 /* highest value in the "matching" range */
854
855static struct linktype_map {
856 int dlt;
857 int linktype;
858} map[] = {
859 /*
860 * These DLT_* codes have LINKTYPE_* codes with values identical
861 * to the values of the corresponding DLT_* code.
862 */
863 { DLT_NULL, LINKTYPE_NULL },
864 { DLT_EN10MB, LINKTYPE_ETHERNET },
865 { DLT_EN3MB, LINKTYPE_EXP_ETHERNET },
866 { DLT_AX25, LINKTYPE_AX25 },
867 { DLT_PRONET, LINKTYPE_PRONET },
868 { DLT_CHAOS, LINKTYPE_CHAOS },
869 { DLT_IEEE802, LINKTYPE_TOKEN_RING },
870 { DLT_ARCNET, LINKTYPE_ARCNET_BSD },
871 { DLT_SLIP, LINKTYPE_SLIP },
872 { DLT_PPP, LINKTYPE_PPP },
873 { DLT_FDDI, LINKTYPE_FDDI },
874
875 /*
876 * These DLT_* codes have different values on different
877 * platforms; we map them to LINKTYPE_* codes that
878 * have values that should never be equal to any DLT_*
879 * code.
880 */
881#ifdef DLT_FR
882 /* BSD/OS Frame Relay */
883 { DLT_FR, LINKTYPE_FRELAY },
884#endif
885
886 { DLT_SYMANTEC_FIREWALL, LINKTYPE_SYMANTEC_FIREWALL },
887 { DLT_ATM_RFC1483, LINKTYPE_ATM_RFC1483 },
888 { DLT_RAW, LINKTYPE_RAW },
889 { DLT_SLIP_BSDOS, LINKTYPE_SLIP_BSDOS },
890 { DLT_PPP_BSDOS, LINKTYPE_PPP_BSDOS },
891
892 /* BSD/OS Cisco HDLC */
893 { DLT_C_HDLC, LINKTYPE_C_HDLC },
894
--- 23 unchanged lines hidden (view full) ---
918};
919
920int
921dlt_to_linktype(int dlt)
922{
923 int i;
924
925 /*
926 * Map the values in the matching range.
927 */
928 if (dlt >= DLT_MATCHING_MIN && dlt <= DLT_MATCHING_MAX)
929 return (dlt);
930
931 /*
932 * Map the values outside that range.
933 */
--- 11 unchanged lines hidden (view full) ---
945}
946
947int
948linktype_to_dlt(int linktype)
949{
950 int i;
951
952 /*
953 * Map the values in the matching range.
954 */
955 if (linktype >= LINKTYPE_MATCHING_MIN &&
956 linktype <= LINKTYPE_MATCHING_MAX)
957 return (linktype);
958
959 /*
960 * Map the values outside that range.
--- 150 unchanged lines hidden ---