From b5036134c27b55e26dec584a8cc7a9ac844b136c Mon Sep 17 00:00:00 2001 From: Guy Harris Date: Wed, 13 Feb 2019 10:42:29 -0800 Subject: Add macros for the pack_flags field. Add macros to extract the direction, reception type, and FCS length fields of the pack_flags field, and add definitions for different directions and reception types. Add a macro to construct a pack_flags field value from subfields; this is for use by non-pcapng file readers (the pack_flags field is just a copy of the EPB flags option, so that's not needed for pcapng). Move some #defines for that field from packet-frame.c to wtap.h, and rename them to match the new macros. Use the macros rather than rolling our own code. Fix a variable name in text2pcap.c that apparently had the wrong name, given the value that was being tested. Change-Id: Ia788ca4e9f5fabd8d24e6ead5ff1817509f54827 Reviewed-on: https://code.wireshark.org/review/32010 Reviewed-by: Guy Harris --- ui/text_import.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) (limited to 'ui/text_import.c') diff --git a/ui/text_import.c b/ui/text_import.c index 191e4547de..6c8c8d2fa6 100644 --- a/ui/text_import.c +++ b/ui/text_import.c @@ -157,7 +157,7 @@ static gboolean hdr_export_pdu = FALSE; static gchar* hdr_export_pdu_payload = NULL; static gboolean has_direction = FALSE; -static guint32 direction = 0; +static guint32 direction = PACK_FLAGS_RECEPTION_TYPE_UNSPECIFIED; /*--- Local data -----------------------------------------------------------------*/ @@ -627,16 +627,16 @@ parse_preamble (void) switch (packet_preamble[0]) { case 'i': case 'I': - direction = 0x00000001; + direction = PACK_FLAGS_DIRECTION_INBOUND; packet_preamble[0] = ' '; break; case 'o': case 'O': - direction = 0x00000002; + direction = PACK_FLAGS_DIRECTION_OUTBOUND; packet_preamble[0] = ' '; break; default: - direction = 0x00000000; + direction = PACK_FLAGS_DIRECTION_UNKNOWN; break; } i = 0; -- cgit v1.2.3