aboutsummaryrefslogtreecommitdiffstats
path: root/epan/dissectors/packet-protobuf.h
diff options
context:
space:
mode:
authorHuang Qiangxiong <qiangxiong.huang@qq.com>2017-07-31 15:26:57 +0000
committerMichael Mann <mmann78@netscape.net>2017-10-10 23:45:15 +0000
commit8fbad3dd56b45874463f9d811b80006314413c0e (patch)
tree4da37950a882ab8c3cc09a881508f4f718cbde1c /epan/dissectors/packet-protobuf.h
parent3444d41fd0d425aca79c9eeaadff1a7f647e7b13 (diff)
Start of adding Protobuf (Protocol Buffers) dissector.
1. Protobuf dissector supports the almost all basic protobuf types of varint, sint, string, and so on. 2. Protobuf messages are not self-described protocol, for example, varint in protobuf may be int32, int64, uint32, uint64, sint32, sint64, bool or enum. Currently dissector will dissect field without detail definition in common way, for numeric field it show uint32 or uint64, for length-delimited field it just show as bytes. But user turn the try_dissect_all_length_delimited_field_as_string or show_all_possible_field_types options on, that dissect will show all possible value for each field according to wire type. (for example, a numeric field will parsed in int32, uint32, sint32, sint64 and so on). Ping-Bug: 13932 Change-Id: Idfe49307b1c84fe461603756f75daeb3e410a905 Reviewed-on: https://code.wireshark.org/review/23814 Petri-Dish: Michael Mann <mmann78@netscape.net> Tested-by: Petri Dish Buildbot <buildbot-no-reply@wireshark.org> Reviewed-by: Michael Mann <mmann78@netscape.net>
Diffstat (limited to 'epan/dissectors/packet-protobuf.h')
-rw-r--r--epan/dissectors/packet-protobuf.h59
1 files changed, 59 insertions, 0 deletions
diff --git a/epan/dissectors/packet-protobuf.h b/epan/dissectors/packet-protobuf.h
new file mode 100644
index 0000000000..052c9eef9b
--- /dev/null
+++ b/epan/dissectors/packet-protobuf.h
@@ -0,0 +1,59 @@
+/* packet-protobuf.h
+ * Routines for Google Protocol Buffers dissection
+ * Copyright 2017, Huang Qiangxiong <qiangxiong.huang@qq.com>
+ *
+ * Wireshark - Network traffic analyzer
+ * By Gerald Combs <gerald@wireshark.org>
+ * Copyright 1998 Gerald Combs
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#ifndef __PACKET_PROTOBUF_H__
+#define __PACKET_PROTOBUF_H__
+
+/* Protobuf wire type. Must be kept in sync with WireType of protobuf wire_format_lite.h
+ 0 used for int32, int64, uint32, uint64, sint32, sint64, bool, enum
+ 1 used for fixed64, sfixed64, double
+ 2 used for string, bytes, embedded messages, packed repeated fields
+ 3 used for groups (deprecated)
+ 4 used for groups (deprecated)
+ 5 used for fixed32, sfixed32, float
+*/
+#define protobuf_wire_type_VALUE_STRING_LIST(XXX) \
+ XXX(PROTOBUF_WIRETYPE_VARINT, 0, "varint") \
+ XXX(PROTOBUF_WIRETYPE_FIXED64, 1, "64-bit") \
+ XXX(PROTOBUF_WIRETYPE_LENGTH_DELIMITED, 2, "Length-delimited") \
+ XXX(PROTOBUF_WIRETYPE_START_GROUP, 3, "Start group (deprecated)") \
+ XXX(PROTOBUF_WIRETYPE_END_GROUP, 4, "End group (deprecated)") \
+ XXX(PROTOBUF_WIRETYPE_FIXED32, 5, "32-bit")
+
+VALUE_STRING_ENUM(protobuf_wire_type);
+VALUE_STRING_ARRAY_GLOBAL_DCL(protobuf_wire_type);
+
+#endif
+
+/*
+ * Editor modelines - http://www.wireshark.org/tools/modelines.html
+ *
+ * Local variables:
+ * c-basic-offset: 4
+ * tab-width: 8
+ * indent-tabs-mode: nil
+ * End:
+ *
+ * vi: set shiftwidth=4 tabstop=8 expandtab:
+ * :indentSize=4:tabSize=8:noTabs=true:
+ */