diff --git a/epan/dissectors/file-elf.c b/epan/dissectors/file-elf.c index 229bcdebb3..6abc4ea0fd 100644 --- a/epan/dissectors/file-elf.c +++ b/epan/dissectors/file-elf.c @@ -1869,12 +1869,12 @@ proto_register_elf(void) { &hf_elf_entry, { "Entry", "elf.entry", FT_UINT32, BASE_HEX, NULL, 0x00, - "This member gives the virtual address to which the system first transfers control, thus starting the process. If the file has no associated entry point, this member holds zero. ", HFILL } + "This member gives the virtual address to which the system first transfers control, thus starting the process. If the file has no associated entry point, this member holds zero.", HFILL } }, { &hf_elf64_entry, { "Entry", "elf.entry64", FT_UINT64, BASE_HEX, NULL, 0x00, - "This member gives the virtual address to which the system first transfers control, thus starting the process. If the file has no associated entry point, this member holds zero. ", HFILL } + "This member gives the virtual address to which the system first transfers control, thus starting the process. If the file has no associated entry point, this member holds zero.", HFILL } }, { &hf_elf_phoff, { "Program Header Table File Offset", "elf.phoff", diff --git a/epan/dissectors/packet-aprs.c b/epan/dissectors/packet-aprs.c index 2063cc2be5..1efaa8fffe 100644 --- a/epan/dissectors/packet-aprs.c +++ b/epan/dissectors/packet-aprs.c @@ -1440,7 +1440,7 @@ proto_register_aprs( void ) { &hf_aprs_map_feature, { "Map Feature", "aprs.map_feature", FT_BYTES, BASE_NONE, NULL, 0x0, - "[Reserved - Map Feature", HFILL } + "Reserved - Map Feature", HFILL } }, { &hf_aprs_shelter_data, { "Shelter data", "aprs.shelter_data", diff --git a/epan/dissectors/packet-icmp.c b/epan/dissectors/packet-icmp.c index 857dccbba0..37d1d1e86f 100644 --- a/epan/dissectors/packet-icmp.c +++ b/epan/dissectors/packet-icmp.c @@ -2249,7 +2249,7 @@ void proto_register_icmp(void) {&hf_icmp_int_info_ifindex, {"ifIndex", "icmp.int_info.ifindex", FT_BOOLEAN, 8, NULL, INT_INFO_IFINDEX, - "True: ifIndex of the interface included; False: ifIndex of the interface not included ", + "True: ifIndex of the interface included; False: ifIndex of the interface not included", HFILL}}, {&hf_icmp_int_info_ipaddr, {"IP Address", "icmp.int_info.ipaddr", FT_BOOLEAN, 8, diff --git a/epan/dissectors/packet-idrp.c b/epan/dissectors/packet-idrp.c index 57c83ccdd9..87241b7368 100644 --- a/epan/dissectors/packet-idrp.c +++ b/epan/dissectors/packet-idrp.c @@ -1229,7 +1229,7 @@ void proto_register_idrp(void) VALS(idrp_pdu_types), 0x0, NULL, HFILL}}, {&hf_idrp_sequence, {"Sequence Number", "idrp.seq", FT_UINT32, BASE_DEC, NULL, 0x0, - "Sequence number, Sequence number of current BISPDU ", HFILL}}, + "Sequence number, Sequence number of current BISPDU", HFILL}}, {&hf_idrp_ack, {"Acknowledgment number", "idrp.ack", FT_UINT32, BASE_DEC, NULL, 0x0, "Acknowledgment number, Sequence number of the PDU that the sender last received correctly and in sequence number order", diff --git a/epan/dissectors/packet-ndp.c b/epan/dissectors/packet-ndp.c index 7e573d0d9e..dff04c41fa 100644 --- a/epan/dissectors/packet-ndp.c +++ b/epan/dissectors/packet-ndp.c @@ -320,7 +320,7 @@ proto_register_ndp(void) static hf_register_info hf[] = { { &hf_ndp_ip_address, { "IP address", "ndp.ipaddress", FT_IPv4, BASE_NONE, NULL, 0x0, - "IP address of the Network Management Module (NMM))", HFILL }}, + "IP address of the Network Management Module (NMM)", HFILL }}, { &hf_ndp_segment_identifier, { "Segment Identifier", "ndp.segmentident", FT_UINT24, BASE_HEX, NULL, 0x0, diff --git a/epan/dissectors/packet-nfapi.c b/epan/dissectors/packet-nfapi.c index e6b0e2af62..936a11ba76 100644 --- a/epan/dissectors/packet-nfapi.c +++ b/epan/dissectors/packet-nfapi.c @@ -9102,7 +9102,7 @@ void proto_register_nfapi(void) { &hf_nfapi_multi_carrier_type, { "Multi carrier type", "nfapi.multi.carrier.type", FT_UINT16, BASE_DEC, VALS(nfapi_laa_carrier_type_vals), 0x0, - "Indicates multi carrier type configuration of L1 (according to L1 capabilities and L2 scheduler requirements", HFILL } + "Indicates multi carrier type configuration of L1 (according to L1 capabilities and L2 scheduler requirements)", HFILL } }, { &hf_nfapi_multi_carrier_tx, { "Multi carrier TX", "nfapi.multi.carrier.tx", @@ -11426,7 +11426,7 @@ void proto_register_nfapi(void) { &hf_nfapi_si_index, { "SI Index", "nfapi.si.index", FT_UINT8, BASE_DEC, NULL, 0x0, - "The Index of this SIB in the SIB1 SchedulingInfoList:", HFILL } + "The Index of this SIB in the SIB1 SchedulingInfoList", HFILL } }, { &hf_nfapi_number_of_si_periodicity, { "Number of SI Periodicity", "nfapi.number.of.si.periodicity", diff --git a/epan/dissectors/packet-oran.c b/epan/dissectors/packet-oran.c index 04453cc751..e9ffcec707 100644 --- a/epan/dissectors/packet-oran.c +++ b/epan/dissectors/packet-oran.c @@ -3158,7 +3158,7 @@ proto_register_oran(void) FT_BOOLEAN, 8, NULL, 0x80, "Used to indicate if this section will contain " - "both beamforming index and any ex(tension information (ef=1) or " + "both beamforming index and any extension information (ef=1) or " "just a beamforming index (ewf=0)", HFILL} }, diff --git a/epan/dissectors/packet-ppp.c b/epan/dissectors/packet-ppp.c index 170ee34ef9..53e73d78c8 100644 --- a/epan/dissectors/packet-ppp.c +++ b/epan/dissectors/packet-ppp.c @@ -8277,7 +8277,7 @@ proto_register_iphc_crtp(void) "The invalid bit of the context state packet.", HFILL }}, { &hf_iphc_crtp_ip_id, { "IP-ID", "crtp.ip-id", FT_UINT16, BASE_HEX_DEC, NULL, 0x0, - "The IPv4 Identification Field is RANDOM and thus included in a compressed Non TCP packet (RFC 2507 6a), 7.13a). Only IPv4 is supported in this dissector.", HFILL }}, + "The IPv4 Identification Field is RANDOM and thus included in a compressed Non TCP packet (RFC 2507 6a, 7.13a). Only IPv4 is supported in this dissector.", HFILL }}, { &hf_iphc_crtp_data, { "Data", "crtp.data", FT_BYTES, BASE_NONE, NULL, 0x0, NULL, HFILL }}, diff --git a/epan/dissectors/packet-s7comm.c b/epan/dissectors/packet-s7comm.c index 2488f23635..de55b83b7b 100644 --- a/epan/dissectors/packet-s7comm.c +++ b/epan/dissectors/packet-s7comm.c @@ -7652,10 +7652,10 @@ proto_register_s7comm (void) /* Organization block local data */ { &hf_s7comm_ob_ev_class, { "OB Event class", "s7comm.ob.ev_class", FT_UINT8, BASE_HEX, NULL, 0x0, - "OB Event class (Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1)", HFILL }}, + "OB Event class (Bits 0-3 = 1 (Coming event), Bits 4-7 = 1 (Event class 1))", HFILL }}, { &hf_s7comm_ob_scan_1, { "OB Scan 1", "s7comm.ob.scan_1", FT_UINT8, BASE_HEX, NULL, 0x0, - "OB Scan 1 (1=Cold restart scan 1 of OB 1), 3=Scan 2-n of OB 1)", HFILL }}, + "OB Scan 1 (1=Cold restart scan 1 of OB 1), (3=Scan 2-n of OB 1)", HFILL }}, { &hf_s7comm_ob_strt_inf, { "OB Start info", "s7comm.ob.strt_info", FT_UINT8, BASE_HEX, NULL, 0x0, "OB Start info (OB n has started)", HFILL }}, diff --git a/epan/dissectors/packet-s7comm_szl_ids.c b/epan/dissectors/packet-s7comm_szl_ids.c index 857f20d81a..9c5fc05b05 100644 --- a/epan/dissectors/packet-s7comm_szl_ids.c +++ b/epan/dissectors/packet-s7comm_szl_ids.c @@ -5158,13 +5158,13 @@ s7comm_szl_xy91_0000_register(int proto) NULL, HFILL }}, { &hf_s7comm_szl_0091_0000_logadr, { "Logadr", "s7comm.szl.0091.0000.logadr", FT_UINT16, BASE_DEC, NULL, 0x0, - "Logadr (First assigned logical I/O address (base address)", HFILL }}, + "Logadr (First assigned logical I/O address (base address))", HFILL }}, { &hf_s7comm_szl_0091_0000_solltyp, { "Expected type", "s7comm.szl.0091.0000.exptype", FT_UINT16, BASE_HEX, NULL, 0x0, - "Solltyp (PROFINET IO: expected (configured) type, otherwise reserved", HFILL }}, + "Solltyp (PROFINET IO: expected (configured) type, otherwise reserved)", HFILL }}, { &hf_s7comm_szl_0091_0000_isttyp, { "Actual type", "s7comm.szl.0091.0000.acttype", FT_UINT16, BASE_HEX, NULL, 0x0, - "Isttyp (PROFINET IO: actual type, otherwise reserved", HFILL }}, + "Isttyp (PROFINET IO: actual type, otherwise reserved)", HFILL }}, /* Field depends on the first byte of the SZL-ID */ { &hf_s7comm_szl_0091_0000_res1, { "Reserved", "s7comm.szl.0091.0000.res1", FT_UINT16, BASE_HEX, NULL, 0x0, @@ -5685,7 +5685,7 @@ s7comm_szl_0424_0000_register(int proto) "ae (B#16#FF)", HFILL }}, { &hf_s7comm_szl_0424_0000_bzu_id, { "bzu-id", "s7comm.szl.0424.0000.bzu_id", FT_UINT8, BASE_HEX, NULL, 0x0, - "bzu-id (ID of the mode change divided into 4 bits, Bit 0 to 3: Requested mode, Bit 4 to 7: Previous mode", HFILL }}, + "bzu-id (ID of the mode change divided into 4 bits, Bit 0 to 3: Requested mode, Bit 4 to 7: Previous mode)", HFILL }}, { &hf_s7comm_szl_0424_0000_bzu_id_req, { "Requested mode", "s7comm.szl.0424.0000.bzu_id.req", FT_UINT8, BASE_HEX, VALS(szl_0424_0000_bzu_id_names), 0x0f, "bzu-id Requested mode", HFILL }}, diff --git a/epan/dissectors/packet-vnc.c b/epan/dissectors/packet-vnc.c index 4c538605d0..d0e12b86ee 100644 --- a/epan/dissectors/packet-vnc.c +++ b/epan/dissectors/packet-vnc.c @@ -3587,7 +3587,7 @@ proto_register_vnc(void) { &hf_vnc_security_type, { "Security type", "vnc.security_type", FT_UINT8, BASE_DEC, VALS(vnc_security_types_vs), 0x0, - "Security types offered by the server (VNC versions => 3.007", HFILL } + "Security types offered by the server (VNC versions => 3.007)", HFILL } }, { &hf_vnc_server_security_type, { "Security type", "vnc.server_security_type", @@ -3757,12 +3757,12 @@ proto_register_vnc(void) { &hf_vnc_auth_error_length, { "Length of authentication error", "vnc.auth_error_len", FT_UINT32, BASE_DEC, NULL, 0x0, - "Authentication error length (present only if the authentication result is fail", HFILL } + "Authentication error length (present only if the authentication result is fail)", HFILL } }, { &hf_vnc_auth_error, { "Authentication error", "vnc.auth_error", FT_STRING, BASE_NONE, NULL, 0x0, - "Authentication error (present only if the authentication result is fail", HFILL } + "Authentication error (present only if the authentication result is fail)", HFILL } }, { &hf_vnc_ard_auth_generator, { "Generator", "vnc.ard_auth_generator", diff --git a/tools/check_typed_item_calls.py b/tools/check_typed_item_calls.py index 7254e6a4cc..5ff861cae5 100755 --- a/tools/check_typed_item_calls.py +++ b/tools/check_typed_item_calls.py @@ -635,12 +635,11 @@ class Item: previousItem = None def __init__(self, filename, hf, filter, label, item_type, display, strings, macros, mask=None, - check_mask=False, mask_exact_width=False, check_label=False, check_consecutive=False): + check_mask=False, mask_exact_width=False, check_label=False, check_consecutive=False, blurb=''): self.filename = filename self.hf = hf self.filter = filter self.label = label - self.mask = mask self.mask_exact_width = mask_exact_width @@ -658,27 +657,14 @@ class Item: Item.previousItem = self - - # Optionally check label. - if check_label: - if label.startswith(' ') or label.endswith(' '): - print('Warning: ' + filename, hf, 'filter "' + filter + '" label' + label + '" begins or ends with a space') - warnings_found += 1 - - if (label.count('(') != label.count(')') or - label.count('[') != label.count(']') or - label.count('{') != label.count('}')): - # Ignore if includes quotes, as may be unbalanced. - if label.find("'") == -1: - print('Warning: ' + filename, hf, 'filter "' + filter + '" label', '"' + label + '"', 'has unbalanced parens/braces/brackets') - warnings_found += 1 - if item_type != 'FT_NONE' and label.endswith(':'): - print('Warning: ' + filename, hf, 'filter "' + filter + '" label', '"' + label + '"', 'ends with an unnecessary colon') - warnings_found += 1 - self.item_type = item_type self.display = display + # Optionally check label (short and long). + if check_label: + self.check_label(label, 'label') + #self.check_label(blurb, 'blurb') + # Optionally check that mask bits are contiguous if check_mask: if self.mask_read and not mask in { 'NULL', '0x0', '0', '0x00'}: @@ -700,6 +686,27 @@ class Item: def __str__(self): return 'Item ({0} "{1}" {2} type={3}:{4} {5} mask={6})'.format(self.filename, self.label, self.filter, self.item_type, self.display, self.strings, self.mask) + def check_label(self, label, label_name): + global warnings_found + + # TODO: this is masking a bug where the re for the item can't cope with macro for containing ',' for mask arg.. + if label.count('"') == 1: + return + + if label.startswith(' ') or label.endswith(' '): + print('Warning: ' + self.filename, self.hf, 'filter "' + self.filter, label_name, '"' + label + '" begins or ends with a space') + warnings_found += 1 + + if (label.count('(') != label.count(')') or + label.count('[') != label.count(']') or + label.count('{') != label.count('}')): + # Ignore if includes quotes, as may be unbalanced. + if label.find("'") == -1: + print('Warning: ' + self.filename, self.hf, 'filter "' + self.filter + '"', label_name, '"' + label + '"', 'has unbalanced parens/braces/brackets') + warnings_found += 1 + if self.item_type != 'FT_NONE' and label.endswith(':'): + print('Warning: ' + self.filename, self.hf, 'filter "' + self.filter + '"', label_name, '"' + label + '"', 'ends with an unnecessary colon') + warnings_found += 1 def set_mask_value(self, macros): @@ -1144,15 +1151,23 @@ def find_items(filename, macros, check_mask=False, mask_exact_width=False, check contents = removeComments(contents) # N.B. re extends all the way to HFILL to avoid greedy matching + # TODO: fix a problem where re can't cope with mask that involve a macro with commas in it... matches = re.finditer( r'.*\{\s*\&(hf_[a-z_A-Z0-9]*)\s*,\s*{\s*\"(.*?)\"\s*,\s*\"(.*?)\"\s*,\s*(.*?)\s*,\s*([0-9A-Z_\|\s]*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*([a-zA-Z0-9\W\s_\u00f6\u00e4]*?)\s*,\s*HFILL', contents) + #matches = re.finditer( r'.*\{\s*\&(hf_[a-z_A-Z0-9]*)\s*,\s*{\s*\"(.*?)\"\s*,\s*\"(.*?)\"\s*,\s*(.*?)\s*,\s*([0-9A-Z_\|\s]*?)\s*,\s*(.*?)\s*,\s*(.*?)\s*,\s*(NULL|"[a-zA-Z0-9\W\s_/\u00f6\u00e4]*?")\s*,\s*HFILL', contents) for m in matches: # Store this item. hf = m.group(1) + + blurb = m.group(8) + if blurb.startswith('"'): + blurb = blurb[1:-1] + items[hf] = Item(filename, hf, filter=m.group(3), label=m.group(2), item_type=m.group(4), display=m.group(5), strings=m.group(6), macros=macros, mask=m.group(7), + blurb=blurb, check_mask=check_mask, mask_exact_width=mask_exact_width, check_label=check_label, @@ -1385,6 +1400,7 @@ if args.all_checks: args.mask_exact_width = True args.consecutive = True args.check_bitmask_fields = True + #args.label = True args.label_vs_filter = True args.extra_value_string_checks