T.70: Add dissection of parameters
This commit is contained in:
parent
ec466b0efa
commit
8bf48b6fda
54
t70.lua
54
t70.lua
|
@ -45,12 +45,20 @@ local block_types_long = {
|
|||
local hf_block_type = ProtoField.uint8("t70.block_type", "Block Type", base.HEX, block_types, 0xff)
|
||||
local hf_data = ProtoField.bytes("t70.data", "Data")
|
||||
|
||||
local param_names = {
|
||||
local tcr_tca_param_names = {
|
||||
[0xc0] = "Transport data block size", -- Figure 11/T.70
|
||||
[0xc1] = "Calling address", -- Figure 10/T.70 (but also Figure 16/T.70: Rejected block)
|
||||
[0xc1] = "Calling address", -- Figure 10/T.70
|
||||
[0xc2] = "Called address", -- Fiure 10/T.70
|
||||
}
|
||||
|
||||
local tcc_param_names = {
|
||||
[0xc0] = "Additional clearing information",
|
||||
}
|
||||
|
||||
local tbr_param_names = {
|
||||
[0xc1] = "Rejected block",
|
||||
}
|
||||
|
||||
-- Figure 13/T.70
|
||||
local clearing_cause_names = {
|
||||
[0x00] = "Reason not specified",
|
||||
|
@ -62,11 +70,29 @@ local hf_clearing_cause = ProtoField.uint8("t70.clearing_cause", "Clearing Cause
|
|||
|
||||
local hf_tsdu_end_mark = ProtoField.bool("t70.tsdu_end_mark", "TSDU end mark", base.HEX, nil, 0x80)
|
||||
|
||||
local hf_param = ProtoField.none("t70.param", "Parameter")
|
||||
local hf_param_type = ProtoField.uint8("t70.param.type", "Parameter Type", base.HEX)
|
||||
local hf_param_len = ProtoField.uint8("t70.param.len", "Parameter Length", base.DEC)
|
||||
local hf_param_data = ProtoField.bytes("t70.param.data", "Parameter Data")
|
||||
|
||||
t70_protocol.fields = {
|
||||
hf_net_block_hdr_len, hf_net_block_hdr, hf_net_block_hdr_m, hf_net_block_hdr_q, hf_tsdu_end_mark,
|
||||
hf_src_ref, hf_dst_ref, hf_rej_cause, hf_block_len, hf_block_type, hf_data, hf_clearing_cause,
|
||||
hf_param, hf_param_type, hf_param_len, hf_param_data,
|
||||
}
|
||||
|
||||
function decode_one_param(buffer, offset, pinfo, tree, names)
|
||||
local pt = buffer(offset+0, 1):uint()
|
||||
local pl = buffer(offset+1, 1):uint()
|
||||
local subtree = tree:add(hf_param, buffer(offset+2, pl))
|
||||
subtree:append_text(string.format(": 0x%02x %s (len=%u)", pt, names[pt], pl))
|
||||
local ti = subtree:add(hf_param_type, buffer(offset+0, 1))
|
||||
ti:append_text(string.format(": %s", names[pt]))
|
||||
subtree:add(hf_param_len, buffer(offset+1, 1))
|
||||
subtree:add(hf_param_data, buffer(offset+2, pl))
|
||||
return 2 + pl
|
||||
end
|
||||
|
||||
function dissect_block(buffer, pinfo, tree, maintree)
|
||||
local blen = buffer(0, 1):uint()
|
||||
local btype = buffer(1, 1):uint()
|
||||
|
@ -79,20 +105,36 @@ function dissect_block(buffer, pinfo, tree, maintree)
|
|||
|
||||
if (btype == 0xe0) then -- TCR (Section 5.5.4)
|
||||
tree:add(hf_src_ref, buffer(4, 2))
|
||||
-- TODO: parameters (calling, called, block size)
|
||||
-- parameters (calling, called, block size)
|
||||
local offset = 7
|
||||
while (offset < buffer:len()) do
|
||||
offset = offset + decode_one_param(buffer, offset, pinfo, tree, tcr_tca_param_names)
|
||||
end
|
||||
elseif (btype == 0xd0) then -- TCA (Section 5.5.5)
|
||||
tree:add(hf_dst_ref, buffer(2, 2))
|
||||
tree:add(hf_src_ref, buffer(4, 2))
|
||||
-- TODO: parameters (calling, called, block size)
|
||||
-- parameters (calling, called, block size)
|
||||
local offset = 7
|
||||
while (offset < buffer:len()) do
|
||||
offset = offset + decode_one_param(buffer, offset, pinfo, tree, tcr_tca_param_names)
|
||||
end
|
||||
elseif (btype == 0x80) then -- TCC (Section 5.5.6)
|
||||
tree:add(hf_dst_ref, buffer(2, 2))
|
||||
tree:add(hf_src_ref, buffer(4, 2))
|
||||
tree:add(hf_clearing_cause, buffer(6, 1))
|
||||
-- TODO: parameters (addl clearing info)
|
||||
-- parameters (addl clearing info)
|
||||
local offset = 7
|
||||
while (offset < buffer:len()) do
|
||||
offset = offset + decode_one_param(buffer, offset, pinfo, tree, tcc_param_names)
|
||||
end
|
||||
elseif (btype == 0x70) then -- TBR (Section 5.5.7)
|
||||
tree:add(hf_dst_ref, buffer(2, 2))
|
||||
tree:add(hf_rej_cause, buffer(4, 1))
|
||||
-- TODO: parameters (rejected block [mandatory])
|
||||
-- parameters (rejected block [mandatory])
|
||||
local offset = 5
|
||||
while (offset < buffer:len()) do
|
||||
offset = offset + decode_one_param(buffer, offset, pinfo, tree, tbr_param_names)
|
||||
end
|
||||
elseif (btype == 0xf0) then -- TDT (Section 5.5.8)
|
||||
-- TSDU end mark
|
||||
tree:add(hf_tsdu_end_mark, buffer(2, 1))
|
||||
|
|
Loading…
Reference in New Issue