added licence header to wireshark lua script
[anytun.git] / wireshark-lua / satp.lua
blobdcf4cdf7b88b10a9494c020a4ae6f3f4d688d5eb
1 -- anytun
2 --
3 -- The secure anycast tunneling protocol (satp) defines a protocol used
4 -- for communication between any combination of unicast and anycast
5 -- tunnel endpoints. It has less protocol overhead than IPSec in Tunnel
6 -- mode and allows tunneling of every ETHER TYPE protocol (e.g.
7 -- ethernet, ip, arp ...). satp directly includes cryptography and
8 -- message authentication based on the methodes used by SRTP. It is
9 -- intended to deliver a generic, scaleable and secure solution for
10 -- tunneling and relaying of packets of any protocol.
13 -- Copyright (C) 2007-2008 Othmar Gsenger, Erwin Nindl,
14 -- Christian Pointner <satp@wirdorange.org>
16 -- This file is part of Anytun.
18 -- Anytun is free software: you can redistribute it and/or modify
19 -- it under the terms of the GNU General Public License version 3 as
20 -- published by the Free Software Foundation.
22 -- Anytun is distributed in the hope that it will be useful,
23 -- but WITHOUT ANY WARRANTY; without even the implied warranty of
24 -- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
25 -- GNU General Public License for more details.
27 -- You should have received a copy of the GNU General Public License
28 -- along with anytun. If not, see <http://www.gnu.org/licenses/>.
32 local proto_satp = Proto("SATP","Secure Anycast Tunneling Protocol")
34 local payload_types = {
35 [0x0800] = "IPv4",
36 [0x6558] = "Ethernet",
37 [0x86DD] = "IPv6"
40 local payload_dissector = {
41 [0x0800] = "ip",
42 [0x6558] = "eth",
43 [0x86DD] = "ipv6"
46 local field_seq = ProtoField.uint32("satp.seq","Sequence Number",base.DEC)
47 local field_sid = ProtoField.uint16("satp.sid","Sender ID",base.DEC)
48 local field_mux = ProtoField.uint16("satp.mux","Mux",base.DEC)
49 local field_ptype = ProtoField.uint16("satp.ptype","Payload Type (plain?)",base.HEX,payload_types)
51 proto_satp.fields = { field_seq, field_sid, field_mux, field_ptype }
54 -- create a function to dissect it
55 function proto_satp.dissector(buffer,pinfo,tree)
56 local info_string = "Sender Id: " .. buffer(4,2):uint() .. ", Mux: " .. buffer(6,2):uint() .. ", SeqNr: " .. buffer(0,4):uint()
57 pinfo.cols.protocol = "SATP"
58 pinfo.cols.info = info_string
60 local subtree = tree:add(proto_satp,buffer(),"SATP, " .. info_string)
62 subtree:add(field_seq, buffer(0,4))
63 subtree:add(field_sid, buffer(4,2))
64 subtree:add(field_mux, buffer(6,2))
66 local payload_type = buffer(8,2):uint()
68 if payload_dissector[payload_type] ~= nil then
69 subtree:add(field_ptype, buffer(8,2))
70 Dissector.get(payload_dissector[payload_type]):call(buffer(10):tvb(),pinfo,tree)
71 else
72 Dissector.get("data"):call(buffer(8):tvb(),pinfo,tree)
73 end
74 end
76 -- load the udp.port table
78 udp_table = DissectorTable.get("udp.port")
80 -- register our protocol to handle udp port 4444
81 udp_table:add(4444,proto_satp)
82 end