You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
92 lines
3.4 KiB
92 lines
3.4 KiB
do
|
|
local proto_upvoice = Proto("upvoice", "上行话音(端口8310)")
|
|
|
|
-- fields
|
|
local field_header = ProtoField.uint16("upvoice.Header", "消息头", base.HEX)
|
|
local field_station_type = ProtoField.uint8("upvoice.StationType", "地面站类型", base.HEX)
|
|
local field_station_number = ProtoField.uint8("upvoice.StationNumber", "地面站编号", base.HEX)
|
|
local field_reserved = ProtoField.uint16("upvoice.Reserved", "备用", base.HEX)
|
|
local field_msgpos_src = ProtoField.uint8("upvoice.MsgPosSRC", "消息源席位标识", base.HEX)
|
|
local field_msgsw_src = ProtoField.uint8("upvoice.MsgSwSRC", "消息源软件标识", base.HEX)
|
|
local field_msgpos_dst = ProtoField.uint8("upvoice.MsgPosDST", "消息目标席位标识", base.HEX)
|
|
local field_msgsw_dst = ProtoField.uint8("upvoice.MsgSwDST", "消息目标软件标识", base.HEX)
|
|
local field_init_pos = ProtoField.uint8("upvoice.InitFlag", "初始席位标识", base.HEX)
|
|
local field_frame_len = ProtoField.uint16("upvoice.FrameLen", "帧长度", base.DEC)
|
|
local field_identifier = ProtoField.uint8("upvoice.Identifier", "帧标识", base.HEX)
|
|
local field_plane_type = ProtoField.uint8("upvoice.PlaneType", "飞机类型", base.HEX)
|
|
local field_plane_number = ProtoField.uint8("upvoice.PlaneNumber", "飞机编号", base.HEX)
|
|
local field_voice = ProtoField.bytes("upvoice.Voice", "话音", base.HEX)
|
|
local field_reserved2 = ProtoField.bytes("upvoice.Reserved2", "备用", base.HEX)
|
|
local field_time = ProtoField.uint32("upvoice.Time", "年月日时分秒", base.DEC)
|
|
local field_seq = ProtoField.uint32("upvoice.Seq", "计数", base.DEC)
|
|
local field_check = ProtoField.uint8("upvoice.Check", "和校验", base.HEX)
|
|
local field_tail = ProtoField.uint8("upvoice.Tail", "消息包尾", base.HEX)
|
|
proto_upvoice.fields = {
|
|
field_header,
|
|
field_station_type,
|
|
field_station_number,
|
|
field_reserved,
|
|
field_msgpos_src,
|
|
field_msgsw_src,
|
|
field_msgpos_dst,
|
|
field_msgsw_dst,
|
|
field_init_pos,
|
|
field_frame_len,
|
|
field_identifier,
|
|
field_plane_type,
|
|
field_plane_number,
|
|
field_voice,
|
|
field_reserved2,
|
|
field_time,
|
|
field_seq,
|
|
field_check,
|
|
field_tail
|
|
}
|
|
|
|
local data_dis = Dissector.get("data")
|
|
|
|
local function upvoice_dissector(buf, pkt, root)
|
|
local buf_len = buf:len()
|
|
|
|
if buf_len < 64
|
|
then
|
|
return false
|
|
end
|
|
pkt.cols.protocol = "上行话音数据"
|
|
pkt.cols.info = "端口8310, 上行话音数据"
|
|
local t = root:add(proto_upvoice, buf(0, 64))
|
|
t:add(field_header,buf(0,2))
|
|
t:add(field_station_type, buf(2, 1))
|
|
t:add(field_station_number, buf(3, 1))
|
|
t:add(field_reserved, buf(4, 2))
|
|
t:add(field_msgpos_src, buf(6, 1))
|
|
t:add(field_msgsw_src, buf(7, 1))
|
|
t:add(field_msgpos_dst, buf(8, 1))
|
|
t:add(field_msgsw_dst, buf(9, 1))
|
|
t:add(field_init_pos, buf(10, 1))
|
|
t:add_le(field_frame_len, buf(11, 2))
|
|
t:add(field_identifier, buf(13, 1))
|
|
t:add(field_plane_type, buf(14, 1))
|
|
t:add(field_plane_number, buf(15, 1))
|
|
t:add(field_voice, buf(16, 6))
|
|
t:add(field_reserved2, buf(22, 32))
|
|
t:add_le(field_time, buf(54, 4))
|
|
t:add_le(field_seq, buf(58, 4))
|
|
t:add(field_check, buf(62, 1))
|
|
t:add(field_tail, buf(63, 1))
|
|
return true
|
|
end
|
|
|
|
function proto_upvoice.dissector(buf, pkt, root)
|
|
if upvoice_dissector(buf, pkt, root)
|
|
then
|
|
-- valid upvoice diagram
|
|
else
|
|
data_dis:call(buf, pkt, root)
|
|
end
|
|
end
|
|
|
|
local udp_encap_table = DissectorTable.get("udp.port")
|
|
udp_encap_table:add(8310, proto_upvoice)
|
|
end
|
|
|
|
|