aboutsummaryrefslogtreecommitdiffstats
path: root/tools
diff options
context:
space:
mode:
authorJaap Keuter <jaap.keuter@xs4all.nl>2018-02-27 08:22:25 +0100
committerAnders Broman <a.broman58@gmail.com>2018-02-28 12:04:29 +0000
commit0fb38879af867b147d2ad73616f0c0ec08a0fc92 (patch)
tree66a61e72d013ac7acd4245ea96d870076eacea16 /tools
parentb405a9f0d2af056dd0c0e4d15271ff7dfdd5c928 (diff)
L16_mono: Add L16 monaural codec plugin as functional example
This codec plugin serves a dual purpose. First it is to add L16 codec suppport to Wireshark. Second it is an illustration of a basic codec plugin module. Change-Id: I64394dab3257ae49dece0257b16cd969503918e2 Reviewed-on: https://code.wireshark.org/review/26131 Reviewed-by: Jaap Keuter <jaap.keuter@xs4all.nl> Petri-Dish: Jaap Keuter <jaap.keuter@xs4all.nl> Tested-by: Petri Dish Buildbot Reviewed-by: Anders Broman <a.broman58@gmail.com>
Diffstat (limited to 'tools')
-rwxr-xr-xtools/make-plugin-reg.py28
1 files changed, 21 insertions, 7 deletions
diff --git a/tools/make-plugin-reg.py b/tools/make-plugin-reg.py
index 12bf86ae01..1aed42ddef 100755
--- a/tools/make-plugin-reg.py
+++ b/tools/make-plugin-reg.py
@@ -1,6 +1,6 @@
#!/usr/bin/env python
#
-# Looks for registration routines in the plugin dissectors,
+# Looks for registration routines in the plugins
# and assembles C code to call all the routines.
#
@@ -13,7 +13,7 @@ import re
#
srcdir = sys.argv[1]
#
-# The second argument is either "plugin" or "plugin_wtap".
+# The second argument is either "plugin", "plugin_wtap" or "plugin_codec".
#
registertype = sys.argv[2]
#
@@ -50,6 +50,7 @@ regs = {
'proto_reg': set(),
'handoff_reg': set(),
'wtap_register': set(),
+ 'codec_register': set(),
}
# For those that don't know Python, r"" indicates a raw string,
@@ -60,11 +61,14 @@ handoff_regex = r"\bproto_reg_handoff_(?P<symbol>[_A-Za-z0-9]+)\s*\(\s*void\s*\)
wtap_reg_regex = r"\bwtap_register_(?P<symbol>[_A-Za-z0-9]+)\s*\([^;]+$"
+codec_reg_regex = r"\bcodec_register_(?P<symbol>[_A-Za-z0-9]+)\s*\([^;]+$"
+
# This table drives the pattern-matching and symbol-harvesting
patterns = [
( 'proto_reg', re.compile(proto_regex, re.MULTILINE) ),
( 'handoff_reg', re.compile(handoff_regex, re.MULTILINE) ),
( 'wtap_register', re.compile(wtap_reg_regex, re.MULTILINE) ),
+ ( 'codec_register', re.compile(codec_reg_regex, re.MULTILINE) ),
]
# Grep
@@ -83,14 +87,15 @@ for filename in filenames:
file.close()
# Make sure we actually processed something
-if len(regs['proto_reg']) < 1 and len(regs['wtap_register']) < 1:
- print("No protocol registrations found")
+if (len(regs['proto_reg']) < 1 and len(regs['wtap_register']) < 1 and len(regs['codec_register']) < 1):
+ print("No plugin registrations found")
sys.exit(1)
# Convert the sets into sorted lists to make the output pretty
regs['proto_reg'] = sorted(regs['proto_reg'])
regs['handoff_reg'] = sorted(regs['handoff_reg'])
regs['wtap_register'] = sorted(regs['wtap_register'])
+regs['codec_register'] = sorted(regs['codec_register'])
reg_code = ""
@@ -108,9 +113,11 @@ reg_code += """
"""
if registertype == "plugin":
- reg_code += "#include <epan/proto.h>\n\n"
+ reg_code += "#include \"epan/proto.h\"\n\n"
if registertype == "plugin_wtap":
- reg_code += "#include <wiretap/wtap.h>\n\n"
+ reg_code += "#include \"wiretap/wtap.h\"\n\n"
+if registertype == "plugin_codec":
+ reg_code += "#include \"codecs/codecs.h\"\n\n"
for symbol in regs['proto_reg']:
reg_code += "void proto_register_%s(void);\n" % (symbol)
@@ -118,6 +125,8 @@ for symbol in regs['handoff_reg']:
reg_code += "void proto_reg_handoff_%s(void);\n" % (symbol)
for symbol in regs['wtap_register']:
reg_code += "void wtap_register_%s(void);\n" % (symbol)
+for symbol in regs['codec_register']:
+ reg_code += "void codec_register_%s(void);\n" % (symbol)
reg_code += """
WS_DLL_PUBLIC_DEF const gchar plugin_version[] = PLUGIN_VERSION;
@@ -138,11 +147,16 @@ if registertype == "plugin":
else:
reg_code +=" plug_%s.register_handoff = NULL;\n" % (symbol)
reg_code += " proto_register_plugin(&plug_%s);\n" % (symbol)
-else:
+if registertype == "plugin_wtap":
for symbol in regs['wtap_register']:
reg_code += " static wtap_plugin plug_%s;\n\n" % (symbol)
reg_code += " plug_%s.register_wtap_module = wtap_register_%s;\n" % (symbol, symbol)
reg_code += " wtap_register_plugin(&plug_%s);\n" % (symbol)
+if registertype == "plugin_codec":
+ for symbol in regs['codec_register']:
+ reg_code += " static codecs_plugin plug_%s;\n\n" % (symbol)
+ reg_code += " plug_%s.register_codec_module = codec_register_%s;\n" % (symbol, symbol)
+ reg_code += " codecs_register_plugin(&plug_%s);\n" % (symbol)
reg_code += "}\n"