diff options
author | Peter Wu <peter@lekensteyn.nl> | 2017-11-07 14:05:28 +0000 |
---|---|---|
committer | Peter Wu <peter@lekensteyn.nl> | 2017-11-07 14:05:28 +0000 |
commit | 2151db542d1fd665d1d8187eea5ceeba9dff8ac2 (patch) | |
tree | 846e96437b456dc552003644deda31e8fdbe8381 | |
parent | 1b25964b5d6abea85c68b75781ad682c3e77c1c7 (diff) | |
download | wireshark-notes-2151db542d1fd665d1d8187eea5ceeba9dff8ac2.tar.gz |
lua/trivial: trivial protocol example
Added in 2015-09-27, contains a minimal dissector that does not use
fields.
-rw-r--r-- | lua/trivial.lua | 23 |
1 files changed, 23 insertions, 0 deletions
diff --git a/lua/trivial.lua b/lua/trivial.lua new file mode 100644 index 0000000..abcb5e6 --- /dev/null +++ b/lua/trivial.lua @@ -0,0 +1,23 @@ +-- trivial protocol example +-- declare our protocol +trivial_proto = Proto("trivial", "Trivial Protocol") + +function dissect_foo(tvb, pinfo, tree) + nothing(); + local subtree = tree:add(trivial_proto, tvb(),"Trivial Protocol Data") + subtree:add(tvb(3,2), "Len: " .. tvb(3,2):uint()) +end + +function get_pdu_len(tvb, pinfo, tree) + return tvb(3, 2):uint() +end + +function trivial_proto.dissector(tvb, pinfo, tree) + pinfo.cols.protocol = "TRIVIAL" + dissect_tcp_pdus(tvb, tree, 5, get_pdu_len, dissect_foo) +end + + +tcp_table = DissectorTable.get("tcp.port") +tcp_table:add(7777, trivial_proto) +tcp_table:add(443, trivial_proto) |