aboutsummaryrefslogtreecommitdiffstats
path: root/epan/proto.h
diff options
context:
space:
mode:
authorGuy Harris <guy@alum.mit.edu>2019-05-24 13:53:39 -0700
committerGuy Harris <guy@alum.mit.edu>2019-05-24 21:26:16 +0000
commit1fd3003a6d445047e99d13f6804b5b84425a7a46 (patch)
tree2fd8f5b2b79740accc35d136c7a151639f0d7c5a /epan/proto.h
parentdd4c9877560774c9f07c454028027539a562fe1a (diff)
"Zigbee" encoding is not a character encoding or an integer encoding.
It's a rule for interpretation of the length field of counted-string and counted-octet-string fields. This means it's 1) not a general rule for interpreting integers and 2) not a character encoding, as it also applies to octet strings and, even for character strings, it's *orthogonal* to the character encoding. Therefore, it should *not* be one of the character encoding values; it should be a bit flag. Make it so. This means that 1) a character encoding can be specified for Zigbee Cluster Library strings (they appear to have multiple character encodings possible); 2) the test of it that tested it as if it were a flag will no longer get confused by character encodings that set one or more of the bits in the old encoding value; 3) you don't have to special-case the encoding value passed to get_uint_value(). Put in a comment emphasizing that values that aren't character encodings should *not* be placed in the set of character encodings. Change-Id: I8f50aaee8ca60b0781044287e9b38111de38c81f Reviewed-on: https://code.wireshark.org/review/33341 Petri-Dish: Guy Harris <guy@alum.mit.edu> Tested-by: Petri Dish Buildbot Reviewed-by: Guy Harris <guy@alum.mit.edu>
Diffstat (limited to 'epan/proto.h')
-rw-r--r--epan/proto.h16
1 files changed, 14 insertions, 2 deletions
diff --git a/epan/proto.h b/epan/proto.h
index 60a82de6ae..5974df9b32 100644
--- a/epan/proto.h
+++ b/epan/proto.h
@@ -415,6 +415,16 @@ void proto_report_dissector_bug(const char *format, ...)
#define ENC_TIME_MSEC_NTP 0x00000022
/*
+ * This is a modifier for FT_UINT_STRING and FT_UINT_BYTES values;
+ * it indicates that the length field should be interpreted as per
+ * sections 2.5.2.11 Octet String through 2.5.2.14 Long Character
+ * String of the ZigBee Cluster Library Specification, where if all
+ * bits are set in the length field, the string has an invalid value,
+ * and the number of octets in the value is 0.
+ */
+#define ENC_ZIGBEE 0x40000000
+
+/*
* Historically, the only place the representation mattered for strings
* was with FT_UINT_STRINGs, where we had FALSE for the string length
* being big-endian and TRUE for it being little-endian.
@@ -440,8 +450,10 @@ void proto_report_dissector_bug(const char *format, ...)
* For display, perhaps we should also map control characters to the
* Unicode glyphs showing the name of the control character in small
* caps, diagonally. (Unfortunately, those only exist for C0, not C1.)
+ *
+ * *DO NOT* add anything to this set that is not a character encoding!
*/
-#define ENC_CHARENCODING_MASK 0x7FFFFFFE /* mask out byte-order bits */
+#define ENC_CHARENCODING_MASK 0x3FFFFFFE /* mask out byte-order bits and Zigbee bits */
#define ENC_ASCII 0x00000000
#define ENC_UTF_8 0x00000002
#define ENC_UTF_16 0x00000004
@@ -471,7 +483,7 @@ void proto_report_dissector_bug(const char *format, ...)
#define ENC_ASCII_7BITS 0x00000034
#define ENC_T61 0x00000036
#define ENC_EBCDIC_CP037 0x00000038
-#define ENC_ZIGBEE 0x0000003A
+/* reserved 0x0000003A */
#define ENC_WINDOWS_1251 0x0000003C
#define ENC_CP855 0x0000003E
#define ENC_CP866 0x00000040