rcapi.lua: More decoding

This commit is contained in:
Harald Welte 2022-10-23 20:20:00 +02:00
parent ac048d5dde
commit 550ec99a5d
1 changed files with 121 additions and 1 deletions

View File

@ -79,6 +79,17 @@ local command_ids = {
[0x4181] = "CAPI_SELECT_B_PROTOCOL_CONF",
}
local reject_vals = {
[0x0000] = "Accept call",
[0x0001] = "Ignore call",
[0x0002] = "Reject call, normal call clearing",
[0x0003] = "Reject call, user busy",
[0x0004] = "Reject call, requested circuit/channel not available",
[0x0005] = "Reject call, facility rejected",
[0x0006] = "Reject call, incompatible destination",
[0x0007] = "Reject call, channel unacceptable",
[0x0008] = "Reject call, destination out of order",
}
local f_total_length = ProtoField.uint16("rcapi.total_length", "Total Length", base.DEC)
local f_datapart = ProtoField.bytes("rcapi.datapart", "Data Block")
@ -93,6 +104,14 @@ local f_data_handle = ProtoField.uint16("rcapi.data_handle", "Data Handle", base
local f_data_len = ProtoField.uint16("rcapi.data_len", "Data Length", base.DEC)
local f_info = ProtoField.uint16("rcapi.info", "Info", base.HEX)
local f_flags = ProtoField.uint16("rcapi.flags", "Flags", base.HEX)
local f_info_mask = ProtoField.uint32("rcapi.info_mask", "Info Mask", base.HEX)
local f_cip_mask = ProtoField.uint32("rcapi.cip_mask", "CIP Mask", base.HEX)
local f_cip_mask2 = ProtoField.uint32("rcapi.cip_mask2", "CIP Mask 2", base.HEX)
local f_controller = ProtoField.uint32("rcapi.controller", "Controller ID", base.HEX)
local f_plci = ProtoField.uint32("rcapi.plci", "Physical Link Connection ID", base.HEX)
local f_cip_value = ProtoField.uint16("rcapi.cip", "Compatibility Information Profile", base.HEX)
local f_reject = ProtoField.uint16("rcapi.reject", "Reject/Accept call", base.HEX, reject_vals)
local f_info_number = ProtoField.uint16("rcapi.info_number", "Inf number", base.HEX)
local f_Buffer = ProtoField.uint32("rcapi.Buffer", "Buffer pointer", base.HEX)
local f_messageBufferSize = ProtoField.uint16("rcapi.messageBufferSize", "Size of message buffers", base.DEC)
@ -104,7 +123,8 @@ local f_capiVersion = ProtoField.uint8("rcapi.capiVersion", "CAPI VErsion to reg
rcapi_protocol.fields = {
f_total_length, f_datapart,
f_capi_len, f_app_id, f_command_id, f_message_number,
f_ncci, f_data_handle, f_data_len, f_info, f_flags,
f_ncci, f_data_handle, f_data_len, f_info, f_flags, f_info_mask, f_cip_mask, f_cip_mask2,
f_controller, f_plci, f_cip_value, f_reject, f_info_number,
f_Buffer, f_messageBufferSize, f_maxLogicalConnections, f_maxBDataBlocks, f_maxBDataLen,
f_capiVersion,
}
@ -124,6 +144,53 @@ local function dissect_register_conf(tvb, pinfo, tree)
tree:add_le(f_info, tvb(0, 2))
end
-- Section 5.5
local function dissect_connect_ind(tvb, pinfo, tree)
tree:add_le(f_plci, tvb(0, 4))
tree:add_le(f_cip_value, tvb(4, 2))
-- FIXME: structs
end
-- Section 5.6
local function dissect_connect_resp(tvb, pinfo, tree)
tree:add_le(f_plci, tvb(0, 4))
tree:add_le(f_reject, tvb(4, 2))
-- FIXME: structs
end
-- Section 5.7
local function dissect_connect_active_ind(tvb, pinfo, tree)
tree:add_le(f_plci, tvb(0, 4))
-- FIXME: structs
end
-- Section 5.8
local function dissect_connect_active_resp(tvb, pinfo, tree)
tree:add_le(f_plci, tvb(0, 4))
end
-- Section 5.9
local function dissect_connect_b3_active_ind(tvb, pinfo, tree)
tree:add_le(f_ncci, tvb(0, 4))
-- FIXME: structs
end
-- Section 5.10
local function dissect_connect_b3_active_resp(tvb, pinfo, tree)
tree:add_le(f_ncci, tvb(0, 4))
end
-- Section 5.13
local function dissect_connect_b3_ind(tvb, pinfo, tree)
tree:add_le(f_ncci, tvb(0, 4))
-- FIXME: structs
end
-- Section 5.14
local function dissect_connect_b3_resp(tvb, pinfo, tree)
tree:add_le(f_ncci, tvb(0, 4))
end
-- Section 5.17
local function dissect_data_b3_req(tvb, pinfo, tree)
tree:add_le(f_ncci, tvb(0, 4))
@ -157,6 +224,35 @@ local function dissect_data_b3_resp(tvb, pinfo, tree)
tree:add_le(f_data_handle, tvb(4, 2))
end
-- Section 5.35
local function dissect_info_ind(tvb, pinfo, tree)
tree:add_le(f_plci, tvb(0, 4))
tree:add_le(f_info_number, tvb(4, 2))
-- FIXME: structs
end
-- Section 5.36
local function dissect_info_resp(tvb, pinfo, tree)
tree:add_le(f_plci, tvb(0, 4))
end
-- Section 5.37
local function dissect_listen_req(tvb, pinfo, tree)
tree:add_le(f_controller, tvb(0, 4))
tree:add_le(f_info_mask, tvb(4, 4))
tree:add_le(f_cip_mask, tvb(8, 4))
tree:add_le(f_cip_mask2, tvb(12, 4))
-- Calling party number
-- Calling party subaddress
end
-- Section 5.38
local function dissect_listen_conf(tvb, pinfo, tree)
tree:add_le(f_controller, tvb(0, 4))
tree:add_le(f_info, tvb(4, 2))
end
-- CAPI common header, Seet Section 3.3 Message Structure
local function capi_dissect_pdu(tvb, pinfo, tree)
tree:add_le(f_capi_len, tvb(0, 2))
@ -180,6 +276,30 @@ local function capi_dissect_pdu(tvb, pinfo, tree)
dissect_data_b3_ind(capi_data(), pinfo, tree)
elseif (command_id == 0x8683) then
dissect_data_b3_resp(capi_data(), pinfo, tree)
elseif (command_id == 0x0580) then
dissect_listen_req(capi_data(), pinfo, tree)
elseif (command_id == 0x0581) then
dissect_listen_conf(capi_data(), pinfo, tree)
elseif (command_id == 0x0282) then
dissect_connect_ind(capi_data(), pinfo, tree)
elseif (command_id == 0x0283) then
dissect_connect_resp(capi_data(), pinfo, tree)
elseif (command_id == 0x0382) then
dissect_connect_active_ind(capi_data(), pinfo, tree)
elseif (command_id == 0x0383) then
dissect_connect_active_resp(capi_data(), pinfo, tree)
elseif (command_id == 0x8382) then
dissect_connect_active_b3_ind(capi_data(), pinfo, tree)
elseif (command_id == 0x8383) then
dissect_connect_active_b3_resp(capi_data(), pinfo, tree)
elseif (command_id == 0x8282) then
dissect_connect_b3_ind(capi_data(), pinfo, tree)
elseif (command_id == 0x8283) then
dissect_connect_b3_resp(capi_data(), pinfo, tree)
elseif (command_id == 0x0882) then
dissect_info_ind(capi_data(), pinfo, tree)
elseif (command_id == 0x0883) then
dissect_info_resp(capi_data(), pinfo, tree)
end
pinfo.cols.info = string.format("%s", command_ids[command_id])