3 -- declare our protocol
5 local proto_satp
= Proto("SATP","Secure Anycast Tunneling Protocol")
7 local payload_types
= {
13 local payload_dissector
= {
19 local field_seq
= ProtoField
.uint32("satp.seq","Sequence Number",base
.DEC
)
20 local field_sid
= ProtoField
.uint16("satp.sid","Sender ID",base
.DEC
)
21 local field_mux
= ProtoField
.uint16("satp.mux","Mux",base
.DEC
)
22 local field_ptype
= ProtoField
.uint16("satp.ptype","Payload Type (plain?)",base
.HEX
,payload_types
)
24 proto_satp
.fields
= { field_seq
, field_sid
, field_mux
, field_ptype
}
27 -- create a function to dissect it
28 function proto_satp
.dissector(buffer
,pinfo
,tree
)
29 local info_string
= "Sender Id: " .. buffer(4,2):uint() .. ", Mux: " .. buffer(6,2):uint() .. ", SeqNr: " .. buffer(0,4):uint()
30 pinfo
.cols
.protocol
= "SATP"
31 pinfo
.cols
.info
= info_string
33 local subtree
= tree
:add(proto_satp
,buffer(),"SATP, " .. info_string
)
35 subtree
:add(field_seq
, buffer(0,4))
36 subtree
:add(field_sid
, buffer(4,2))
37 subtree
:add(field_mux
, buffer(6,2))
39 local payload_type
= buffer(8,2):uint()
41 if payload_dissector
[payload_type
] ~= nil then
42 subtree
:add(field_ptype
, buffer(8,2))
43 Dissector
.get(payload_dissector
[payload_type
]):call(buffer(10):tvb(),pinfo
,tree
)
45 Dissector
.get("data"):call(buffer(8):tvb(),pinfo
,tree
)
49 -- load the udp.port table
51 udp_table
= DissectorTable
.get("udp.port")
53 -- register our protocol to handle udp port 4444
54 udp_table
:add(4444,proto_satp
)