do
local p_SMGP = Proto("SMGP","SMGP","SMGP Protocol")
local f_Length = ProtoField.uint32("SMGP.length","Packet Length",base.DEC)
local f_CommandId = ProtoField.uint32("SMGP.RequestId","Request ID",base.HEX,{
[1]="Login", [0x80000001]="LoginResp",
[2]="Submit", [0x80000002]="SubmitResp",
[3]="Deliver", [0x80000003]="DeliverResp",
[4]="ActiveTest", [0x80000004]="ActiveTestResp",
[5]="Forward", [0x80000005]="ForwardResp",
[6]="Exit", [0x80000006]="ExitResp",
[7]="Query", [0x80000007]="QueryResp"})
local f_SequenceId = ProtoField.uint32("SMGP.sequenceId","Sequence ID",base.DEC);
local f_ClientID = ProtoField.string("SMGP.ClientID","ClientID")
local f_Authenticator = ProtoField.bytes("SMGP.Authenticator","Authenticator")
local f_LoginMode = ProtoField.uint8("SMGP.LoginMode","Login Mode",base.DEC)
local f_TimeStamp = ProtoField.uint32("SMGP.TimeStamp","TimeStamp",base.DEC)
local f_Version = ProtoField.uint8("SMGP.Version","Version",base.HEX)
local f_Status = ProtoField.uint32("SMGP.Status","Status",base.DEC,{[0]="OK"})
local f_MsgType = ProtoField.uint32("SMGP.MsgType","MsgType",base.DEC,{[0]="MO",[6]="MT",[7]="P2P"})
local f_NeedReport = ProtoField.uint32("SMGP.NeedReport","NeedReport",base.DEC,{[0]="N",[1]="Y"})
local f_Priority = ProtoField.uint32("SMGP.Priority","Priority",base.DEC)
local f_ServiceID = ProtoField.string("SMGP.ServiceID","ServiceID")
local f_FeeType = ProtoField.string("SMGP.FeeType","FeeType")
local f_FeeCode = ProtoField.string("SMGP.FeeCode","FeeCode")
local f_FixedFee = ProtoField.string("SMGP.FixedFee","FixedFee")
local f_MsgFormat = ProtoField.uint32("SMGP.MsgFormat","MsgFormat",base.DEC,{
[0]="ASCII",[3]="Card",[4]="Binary",[8]="UCS2",[15]="GB18030",[246]="SIM"})
local f_ValidTime = ProtoField.string("SMGP.ValidTime","ValidTime")
local f_AtTime = ProtoField.string("SMGP.AtTime","AtTime")
local f_SrcTermID = ProtoField.string("SMGP.SrcTermID","SrcTermID")
local f_ChargeTermID = ProtoField.string("SMGP.ChargeTermID","ChargeTermID")
local f_DestTermIDCount = ProtoField.uint32("SMGP.DestTermIDCount","DestTermIDCount",base.DEC)
local f_DestTermID = ProtoField.string("SMGP.DestTermID","DestTermID")
local f_MsgLength = ProtoField.uint8("SMGP.MsgLength","MsgLength",base.DEC)
local f_MsgContent = ProtoField.string("SMGP.MsgContent","MsgContent")
local f_MsgID = ProtoField.bytes("SMGP.MsgID","MsgID")
local f_IsReport = ProtoField.uint8("SMGP.IsReport","IsReport",base.DEC)
local f_RecvTime = ProtoField.string("SMGP.RecvTime","RecvTime")
local f_Reserve = ProtoField.uint32("SMGP.Reserve","Reserve",base.HEX,{
[0x0001]="TP_pid",[0x0002]="TP_udhi"
})
local f_ReserveValue = ProtoField.uint32("SMGP.ReserveValue","ReserveValue",base.HEX)
p_SMGP.fields = {f_Length,f_CommandId,f_SequenceId,f_ClientID,f_Authenticator,
f_LoginMode,f_TimeStamp,f_Version,f_Status,f_MsgType,f_NeedReport,f_Priority,
f_ServiceID,f_FeeType,f_FeeCode,f_FixedFee,f_MsgFormat,f_ValidTime,f_AtTime,
f_SrcTermID,f_ChargeTermID,f_DestTermIDCount,f_DestTermID,f_MsgLength,f_MsgContent,
f_MsgID,f_IsReport,f_RecvTime,f_Reserve,f_ReserveValue}
local data_dis = Dissector.get("data")
local function SMGP_Login(buf,pkt,t)
t:add(f_ClientID,buf(12,8))
t:add(f_Authenticator,buf(20,16))
t:add(f_LoginMode,buf(36,1))
t:add(f_TimeStamp,buf(37,4))
t:add(f_Version,buf(41,1))
pkt.cols.info:prepend("SMGP_Login;" .. " ")
end
local function SMGP_LoginResp(buf,pkt,t)
t:add(f_Status,buf(12,4))
t:add(f_Authenticator,buf(16,16))
t:add(f_Version,buf(32,1))
pkt.cols.info:prepend("SMGP_LoginResp;" .. " ")
end
local function SMGP_Submit(buf,pkt,t)
t:add(f_MsgType,buf(12,1))
t:add(f_NeedReport,buf(13,1))
t:add(f_Priority,buf(14,1))
t:add(f_ServiceID,buf(15,10))
pkt.cols.info:prepend("SMGP_Submit" .. " ")
t:add(f_FeeType,buf(25,2))
t:add(f_FeeCode,buf(27,6))
t:add(f_FixedFee,buf(33,6))
t:add(f_MsgFormat,buf(39,1))
t:add(f_ValidTime,buf(40,17))
t:add(f_AtTime,buf(57,17))
t:add(f_SrcTermID,buf(74,21))
t:add(f_ChargeTermID,buf(95,21))
t:add(f_DestTermIDCount,buf(116,1))
t:add(f_DestTermID,buf(117,21))
local v_msgLen = buf(138,1)
t:add(f_MsgLength,v_msgLen)
v_msgLen = v_msgLen:uint()
t:add(f_MsgContent,buf(139,v_msgLen))
t:add(f_Reserve,buf(139+v_msgLen,2))
t:add(f_ReserveValue,buf(141+v_msgLen,6))
end
local function SMGP_SubmitResp(buf,pkt,t)
t:add(f_MsgID,buf(12,10))
t:add(f_Status,buf(22,4))
pkt.cols.info:prepend("SMGP_SubmitResp;" .. " ")
end
local function SMGP_DelvResp(buf,pkt,t)
t:add(f_MsgID,buf(12,10))
t:add(f_Status,buf(22,4))
pkt.cols.info:prepend("SMGP_DelvResp;" .. " ")
end
local function SMGP_Deliver(buf,pkt,t)
t:add(f_MsgID,buf(12,10))
版权声明: 本博客所有文章除特别声明外,均采用 null 许可协议。转载请注明来自 安全书!