From: guy Date: Fri, 13 Oct 2006 08:56:07 +0000 (+0000) Subject: DLT_ value added for the Bluetooth HCI UART transport layer for Paolo X-Git-Tag: libpcap-0.9.6~23 X-Git-Url: https://git.tcpdump.org/libpcap/commitdiff_plain/6467c24c30110177958dbccb9687a3eed76afd51 DLT_ value added for the Bluetooth HCI UART transport layer for Paolo Abeni. Added DLT/DLT name table mappings and linktype values and DLT/linktype mappings for USB and for the Bluetooth NCI UART transport layer. Fix up indentation. Copy some stuff for DLT_JUNIPER_VP and DLT_USB from the top of the main branch. --- diff --git a/gencode.c b/gencode.c index 214a1a05..32474929 100644 --- a/gencode.c +++ b/gencode.c @@ -21,7 +21,7 @@ */ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.43 2006-09-13 07:36:19 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/gencode.c,v 1.221.2.44 2006-10-13 08:56:07 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -1210,6 +1210,12 @@ init_linktype(p) off_nl_nosnap = -1; /* no 802.2 LLC */ return; + case DLT_JUNIPER_VP: + off_linktype = 18; + off_nl = -1; + off_nl_nosnap = -1; + return; + case DLT_MTP2: off_sio = 3; off_opc = 4; @@ -1236,6 +1242,24 @@ init_linktype(p) off_nl = -1; off_nl_nosnap = -1; return; + + case DLT_USB: + /* + * Currently, only raw "link[N:M]" filtering is supported. + */ + off_linktype = -1; + off_nl = -1; + off_nl_nosnap = -1; + return; + + case DLT_BLUETOOTH_HCI_H4: + /* + * Currently, only raw "link[N:M]" filtering is supported. + */ + off_linktype = -1; + off_nl = -1; + off_nl_nosnap = -1; + return; } bpf_error("unknown data link type %d", linktype); /* NOTREACHED */ @@ -2337,6 +2361,7 @@ gen_linktype(proto) case DLT_JUNIPER_PPP: case DLT_JUNIPER_FRELAY: case DLT_JUNIPER_CHDLC: + case DLT_JUNIPER_VP: /* just lets verify the magic number for now - * on ATM we may have up to 6 different encapsulations on the wire * and need a lot of heuristics to figure out that the payload @@ -6173,6 +6198,7 @@ gen_inbound(dir) case DLT_JUNIPER_PPP: case DLT_JUNIPER_FRELAY: case DLT_JUNIPER_CHDLC: + case DLT_JUNIPER_VP: /* juniper flags (including direction) are stored * the byte after the 3-byte magic number */ if (dir) { diff --git a/pcap-bpf.h b/pcap-bpf.h index f1ab1058..5841c356 100644 --- a/pcap-bpf.h +++ b/pcap-bpf.h @@ -37,7 +37,7 @@ * * @(#)bpf.h 7.1 (Berkeley) 5/7/91 * - * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.34.2.12 2006-10-03 00:12:57 guy Exp $ (LBL) + * @(#) $Header: /tcpdump/master/libpcap/pcap-bpf.h,v 1.34.2.13 2006-10-13 08:56:08 guy Exp $ (LBL) */ /* @@ -639,6 +639,12 @@ struct bpf_version { */ #define DLT_USB 186 +/* + * Bluetooth HCI UART transport layer (part H:4); requested by + * Paolo Abeni. + */ +#define DLT_BLUETOOTH_HCI_H4 187 + /* * Controller Area Network (CAN) v. 2.0B packets. * DLT_ requested by Gianluca Varenni . diff --git a/pcap.c b/pcap.c index 412ce40b..791abb38 100644 --- a/pcap.c +++ b/pcap.c @@ -33,7 +33,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.88.2.14 2006-09-25 18:17:26 guy Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/pcap.c,v 1.88.2.15 2006-10-13 08:56:08 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -383,8 +383,10 @@ static struct dlt_choice dlt_choices[] = { DLT_CHOICE(DLT_JUNIPER_VP, "Juniper Voice PIC"), DLT_CHOICE(DLT_MTP2, "SS7 MTP2"), DLT_CHOICE(DLT_A429, "Arinc 429"), - DLT_CHOICE(DLT_CAN20B, "Controller Area Network (CAN) v. 2.0B"), DLT_CHOICE(DLT_A653_ICM, "Arinc 653 Interpartition Communication"), + DLT_CHOICE(DLT_USB, "USB"), + DLT_CHOICE(DLT_BLUETOOTH_HCI_H4, "Bluetooth HCI UART transport layer"), + DLT_CHOICE(DLT_CAN20B, "Controller Area Network (CAN) v. 2.0B"), DLT_CHOICE_SENTINEL }; diff --git a/savefile.c b/savefile.c index 62fea4f3..5b164757 100644 --- a/savefile.c +++ b/savefile.c @@ -30,7 +30,7 @@ #ifndef lint static const char rcsid[] _U_ = - "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.126.2.17 2006-07-27 21:06:18 gianluca Exp $ (LBL)"; + "@(#) $Header: /tcpdump/master/libpcap/savefile.c,v 1.126.2.18 2006-10-13 08:56:08 guy Exp $ (LBL)"; #endif #ifdef HAVE_CONFIG_H @@ -459,6 +459,17 @@ static const char rcsid[] _U_ = */ #define LINKTYPE_A653_ICM 185 +/* + * USB packets; requested by Paolo Abeni . + */ +#define LINKTYPE_USB 186 + +/* + * Bluetooth HCI UART transport layer (part H:4); requested by + * Paolo Abeni. + */ +#define LINKTYPE_BLUETOOTH_HCI_H4 187 + /* * Controller Area Network (CAN) v. 2.0B packets. * DLT_ requested by Gianluca Varenni . @@ -679,14 +690,20 @@ static struct linktype_map { /* Juniper Voice PIC */ { DLT_JUNIPER_VP, LINKTYPE_JUNIPER_VP }, - /* Controller Area Network (CAN) v2.0B */ - { DLT_A429, LINKTYPE_A429 }, + /* Controller Area Network (CAN) v2.0B */ + { DLT_A429, LINKTYPE_A429 }, + + /* Arinc 653 Interpartition Communication messages */ + { DLT_A653_ICM, LINKTYPE_A653_ICM }, + + /* USB */ + { DLT_USB, LINKTYPE_USB }, - /* Controller Area Network (CAN) v2.0B */ - { DLT_CAN20B, LINKTYPE_CAN20B }, + /* Bluetooth HCI UART transport layer */ + { DLT_BLUETOOTH_HCI_H4, LINKTYPE_BLUETOOTH_HCI_H4 }, - /* Arinc 653 Interpartition Communication messages */ - { DLT_A653_ICM, LINKTYPE_A653_ICM }, + /* Controller Area Network (CAN) v2.0B */ + { DLT_CAN20B, LINKTYPE_CAN20B }, { -1, -1 } };