spbx_log_proto = Proto("SPBX-LOG", "SPBX LOG Protocol") spbx_ldr_proto = Proto("SPBX-LDR", "SPBX LOADER Protocol") spbx_mon_proto = Proto("SPBX-MON", "SPBX MONITOR Protocol") local pro_type = { [1] = "T_REQIP_UBT", [2] = "T_RSPIP_UBT", [3] = "T_REQIP_LDR", [4] = "T_RSPIP_LDR", [5] = "T_REQIP_MG", [6] = "T_RSPIP_MG", [7] = "T_REQIP_MON", [8] = "T_RSPIP_MON", [9] = "T_REQIP_APP", [10] = "T_RSPIPP", [20] = "T_LOG", [21] = "T_DBG", [22] = "T_WrtLOG", [30] = "T_GetCTRL", [31] = "T_GetLOG", [32] = "T_MON_CSN", [33] = "T_UpdUBT", [34] = "T_UpdDbFPGA", [35] = "T_UpdFPGA", [36] = "T_UpdDSP", [37] = "T_UpdAUTCH", [38] = "T_GetCSM", [39] = "T_RSP_GetCSM", [40] = "T_EVT_GetCSM", [41] = "T_UDP_MSG_MAX", [42] = "T_REQ_CFGSETDATE", [43] = "T_RSP_CFGSETDATE", [44] = "T_UpdDATE", } local log_level = { [76]="L", [108]="L", [87]="W", [119]="W", [69]="E", [101]="E" } local log_src = { [0]="PID_Unknown", [1]="PID_Uboot", [2]="PID_FlashKo", [3]="PID_NcdKo", [4]="PID_iicKo", [5]="PID_MsbKo", [6]="PID_UmbKo", [7]="PID_AmgKo", [8]="PID_MrsKo", [9]="PID_SipKo", [10]="PID_LoaderExe", [11]="PID_MsbExe", [12]="PID_UmbExe", [13]="PID_AmgExe", [14]="PID_MrsExe", [15]="PID_SipExe", [16]="PID_IpasExe", [17]="PID_MgcExe", [18]="PID_MgcApi", [19]="PID_Unknown", } local mbrd_prttn = { [0] = "FLSH_LK", [1] = "FLSH_DTB", [2] = "FLSH_RFS", [3] = "FLSH_NCD", [4] = "FLSH_LDR", [5] = "FLSH_UBT", [6] = "FLSH_UP", [7] = "FLSH_BF", [8] = "FLSH_MGF", [9] = "FLSH_LOG", [10] = "FLSH_FSC", [11] = "FLSH_FSD", [12] = "FLSH_MCD", [13] = "FLSH_MDT" } local mbrd_cat = { [0] = "CAT_MGC", [1] = "CAT_MSB", [2] = "CAT_AMB", [3] = "CAT_AMG", [4] = "CAT_UMB", [5] = "CAT_MRS", [6] = "CAT_MRP", [7] = "CAT_SIP" } local mbrd_board = { [0x07] = "BOARD_MSB2U4", [0x08] = "BOARD_MSB9U4", [0x02] = "BOARD_UMB06", [0x0A] = "BOARD_MRS_1", [0x19] = "BOARD_SIP_1", [0x01] = "BOARD_AMB16", [0x08] = "BOARD_MCU01SG", [0x09] = "BOARD_MCU02SG", } local rsp_type = { [0] = "C_RSPERR", [1] = "C_RSPOK", [2] = "C_RSPPROC" } local mbrd_cpu = { [0] = "CPU_MPC8309", [1] = "CPU_P1010", [2] = "CPU_MV78460"} local f_szTag = ProtoField.string("tag", "Protocol Tag") local f_usType = ProtoField.uint16("type", "Protocol Type", base.DEC,pro_type) local f_ulTime = ProtoField.uint32("times", "Log Time", base.DEC) local f_ulBsn = ProtoField.uint32("bsn", "Board Serial", base.DEC) local f_ucSrc = ProtoField.uint8("src", "Log Source", base.DEC,log_src) local f_uclevel = ProtoField.uint8("class", "Log Level", base.DEC,log_level) local f_szMsg = ProtoField.string("str", "Log Message") local f_ulpos = ProtoField.uint32("pos", "Log possion", base.DEC) local f_ulpara = ProtoField.int32("i32", "Log param", base.DEC) spbx_log_proto.fields = {f_szTag, f_usType, f_ulTime, f_ulBsn, f_ucSrc, f_uclevel, f_szMsg, f_ulpos, f_ulpara} local l_szTag = ProtoField.string("tag", "Protocol Tag") local l_usType = ProtoField.uint16("type", "Protocol Type", base.DEC,pro_type) -- MBRD local l_usCat = ProtoField.uint16("cat", "Catoage Type", base.DEC,mbrd_cat) local l_ucCpu = ProtoField.uint8("cpu", "CPU Type", base.DEC,mbrd_cpu) local l_ucIsLong = ProtoField.uint8("isLong", "Board Solt Type", base.DEC,{[0] = "Short Board", [1] = "Long Board"}) -- Date Time Info local l_usDateTime = ProtoField.string("str_dt", "RTC Date Time") -- Autch Info local l_usLLen = ProtoField.uint16("LLen", "Autch List Items", base.DEC) local l_usAtyp = ProtoField.uint16("aType", "Autch Type", base.DEC) local l_usANCh = ProtoField.uint16("aNumCh", "Number of Authorize Channel", base.DEC) -- Flash Info local l_usisNor = ProtoField.uint16("isNor", "Used Nor Flash", base.DEC,{[1] = "Nor Flash", [0] = "Nand Flash"}) local l_ulBasAdd = ProtoField.uint32("BasAdd", "Flash Base Address", base.HEX) local l_ulSize = ProtoField.uint32("size", "Flash Size", base.DEC) local l_ulBloSize = ProtoField.uint32("BloSiz", "Block Size", base.DEC) local l_ulPagSize = ProtoField.uint32("PagSiz", "Page Size", base.DEC) local l_ulNPrtn = ProtoField.uint32("Nfp", "Partition Number", base.DEC) -- PRTTN local l_ulPAddr = ProtoField.uint32("A0", "Partition Start Address", base.HEX) local l_ulPSize = ProtoField.uint32("Size", "Partition Size", base.DEC) local l_ulPMAddr = ProtoField.uint32("Aio", "Partition Loadto Memory Address", base.HEX) local l_baMac = ProtoField.ether("MAC", "Mac", "NIC Mac Address") local l_ucNicm = ProtoField.uint8("nicm", "Master NIC Index", base.DEC) local l_ucNics = ProtoField.uint8("nics", "Slaver NIC Index", base.DEC) local l_usBtype = ProtoField.uint16("typ", "Mother Board Type", base.DEC,mbrd_board) local l_ulBsn = ProtoField.uint32("bsn", "Board Serial", base.DEC) local l_ulAut = ProtoField.uint32("aut", "Author Serial", base.DEC) local l_ulDate = ProtoField.uint32("date", "Manufacture Date", base.DEC) local l_ulArea = ProtoField.uint32("AreaCode", "Salse Area Code", base.DEC) local l_usMaxCh = ProtoField.uint16("maxch", "Max Channle Number", base.DEC) local l_usAutCh = ProtoField.uint16("autch", "Author Channle Number", base.DEC) local l_ulVPCB = ProtoField.uint32("Vpcb", "PCB Version", base.HEX) local l_usIOBTyp = ProtoField.uint16("iobtyp", "IO Board Type", base.DEC) local l_ulIOBVer = ProtoField.uint32("iobver", "IO Board Version", base.HEX) local l_ulCSN = ProtoField.uint32("csn", "Chassis Number", base.DEC) local l_usSlt = ProtoField.uint16("slt", "Slot Number", base.DEC) local l_ulVUbt = ProtoField.uint32("Vubt", "UBOOT Version", base.HEX) local l_ulVFpga = ProtoField.uint32("Vfpga", "FPGA Version", base.HEX) local l_ipMgIp = ProtoField.ipv4("mgIp", "MG IP Address") -- ------------MBRD -- +++++++++++++IPPOOL local ip_ipMgcIP = ProtoField.ipv4("mgcIp", "Master MGC Server Ip Address") local ip_ipCfgIP = ProtoField.ipv4("cfgIp", "Master Config Server Ip Address") local ip_ipAppIP = ProtoField.ipv4("appIp", "Master Application Ip Address") local ip_ipMacIP = ProtoField.ipv4("macIp", "Master Mac IP Pool Base Ip Address") local ip_ipMgcsIP = ProtoField.ipv4("mgcsIp", "Salver MGC Server Ip Address") local ip_ipCfgsIP = ProtoField.ipv4("cfgsIp", "Salver Config Server Ip Address") local ip_ipAppsIP = ProtoField.ipv4("appsIp", "Salver Application Ip Address") local ip_ipMacsIP = ProtoField.ipv4("macsIp", "Salver Mac IP Pool Base Ip Address") local ip_ipMonIP = ProtoField.ipv4("monIp", "Monitor Server Ip Address") local ip_baMonMac = ProtoField.ether("monMac", "Monitor Server MAC Address") local ip_ucDbg = ProtoField.uint8("enDbg", "Debug", base.DEC,{[0] = "Disable", [1] = "Enable"}) local ip_usIsMaster = ProtoField.uint16("isMaster", "Master Or Slave IP Address Server", base.DEC,{[0] = "Slave IPAS", [1] = "Master IPAS"}) local ip_ulCSN = ProtoField.uint32("csn", "Chassis Number", base.DEC,{[0] = "Unvaluable"}) local ip_ipPoolIP = ProtoField.ipv4("baseIp", "IP Pool Base IP Address") -- -------------IPPOOL -- ++++++++++++RAW_RSPLDR local rl_ipMgcIP = ProtoField.ipv4("mgcIp", "Master MGC Server Ip Address") local rl_ipMgcsIP = ProtoField.ipv4("mgcsIp", "Salver MGC Server Ip Address") local rl_ipMonIP = ProtoField.ipv4("monIp", "Monitor Server Ip Address") local rl_baMonMac = ProtoField.ether("monMac", "Monitor Server MAC Address") local rl_ucDbg = ProtoField.uint8("enDbg", "Debug", base.DEC,{[0] = "Disable", [1] = "Enable"}) local rl_ipMg = ProtoField.ipv4("mgIp", "Mg Ip Address") local rl_ipTc = ProtoField.ipv4("tcIp", "Ip Address") local fl_ulVer = ProtoField.uint32("ver", "File Version", base.HEX) local fl_ulLen = ProtoField.uint32("len", "File Size", base.DEC) local fl_ulCrc = ProtoField.uint32("crc", "File CRC32 Value", base.HEX) local fl_szPath = ProtoField.string("path", "File Path") local fl_szName = ProtoField.string("fn", "File Name") local fl_szIICko = ProtoField.string("iicKo", "IIC Driver File") local fl_szMgko = ProtoField.string("mgKo", "MG Driver File") local fl_szProduct = ProtoField.string("proName", "Product Name") local fl_szCompany = ProtoField.string("compName", "Company Name") local fl_usNfile = ProtoField.uint16("Nfile", "Number Of File To Load") local fl_szLFile = ProtoField.string("File", "File Name") -- ------------RAW_RSPLDR -- ++++++++++++RAW_RSPIPP local ri_uNcsn = ProtoField.uint32("Ncsn", "Number of Registered Chassiss", base.DEC) local ri_uLcsn = ProtoField.uint32("Lcsn", "Chassis Id", base.DEC,{[0] = "Unvaluable"}) -- ------------RAW_RSPIPP spbx_ldr_proto.fields = {l_szTag, l_usType, -- MBRD+++++++ l_usCat, l_ucCpu, l_ucIsLong, l_usisNor, l_ulBasAdd, l_ulSize, l_ulBloSize, l_ulPagSize, l_ulNPrtn, l_ulPAddr, l_ulPSize, l_ulPMAddr, l_baMac, l_ucNicm, l_ucNics, l_usBtype, l_ulBsn, l_ulAut, l_ulDate, l_ulArea, l_usMaxCh, l_usAutCh, l_ulVPCB, l_usIOBTyp, l_ulIOBVer, l_ulCSN, l_usSlt, l_ulVUbt, l_ulVFpga, l_ipMgIp, l_usLLen, l_usAtyp, l_usANCh, -- MBRD------- -- Date time l_usDateTime, -- RAW_RSPXXX++++++++ rl_ipMgcIP, rl_ipMgcsIP, rl_ipMonIP, rl_baMonMac, rl_ucDbg, rl_ipMg, rl_ipTc, fl_ulVer, fl_ulLen, fl_ulCrc, fl_szPath, fl_szName, fl_szIICko, fl_szMgko, fl_szProduct, fl_szCompany, fl_usNfile, fl_szLFile, -- RAW_RSPXXX-------- -- IPPOOL+++++++++++ ip_ipMgcIP, ip_ipCfgIP, ip_ipAppIP, ip_ipMacIP, ip_ipMgcsIP, ip_ipCfgsIP, ip_ipAppsIP, ip_ipMacsIP, ip_ipMonIP, ip_baMonMac, ip_ucDbg, ip_usIsMaster, ip_ulCSN, ip_ipPoolIP, -- IPPOOL----------- ri_uNcsn, ri_uLcsn } local m_szTag = ProtoField.string("tag", "Protocol Tag") local m_usType = ProtoField.uint16("type", "Protocol Type", base.DEC,pro_type) local m_usrsp = ProtoField.uint16("Rsponse", "Rsponse Result", base.DEC,rsp_type) local m_uli32 = ProtoField.uint32("Value", "Rsponse Value", base.DEC) -- LOG_CTRL++++++++++++++ local m_usNblo = ProtoField.uint16("Nblo", "Number Of Block", base.DEC) local m_usNpag = ProtoField.uint16("Npag", "Number Of Page", base.DEC) local m_usNrec = ProtoField.uint16("Nrec", "Number Of Record Per Page", base.DEC) local m_ulAw = ProtoField.uint32("Aw", "Address To Write", base.HEX) local m_ulId = ProtoField.uint32("id", "Current Log Id", base.DEC) local m_usCbad = ProtoField.uint16("Cbad", "Count Of Bad Block", base.DEC) local m_usCblo = ProtoField.uint16("Cblo", "Current Write Block", base.DEC) local m_usCpag = ProtoField.uint16("Cpag", "Current Write Page", base.DEC) local m_ulCe = ProtoField.uint32("Ce", "Total Error", base.DEC) local m_ulCw = ProtoField.uint32("Cw", "Total Write Error", base.DEC) local m_ulCr = ProtoField.uint32("Cr", "Total Read Error", base.DEC) -- LOG_CTRL-------------- spbx_mon_proto.fields = {m_szTag, m_usType, m_usrsp, m_uli32, -- LOG_CTRL+++ m_usNblo, m_usNpag, m_usNrec, m_ulAw, m_ulId, m_usCbad, m_usCblo, m_usCpag, m_ulCe, m_ulCw, m_ulCr -- LOG_CTRL--- } function spbx_mon_proto.dissector(buffer, pinfo, tree) pinfo.cols.protocol:set("MONITOR") local buf_len = buffer:len() local myProtoTree = tree:add(spbx_ldr_proto, buffer(0, 10), "SPBX Protocol Head Information") local offset = 0 myProtoTree:add_le(m_szTag, buffer(offset, 8)) offset = offset + 8 local proType = buffer(offset, 2):uint() myProtoTree:add(m_usType, buffer(offset, 2)) offset = offset + 2 if buf_len == 48 then local rspTree = tree:add(spbx_ldr_proto, buffer(10, 6), "SPBX Protocol Response Information") local rspType = buffer(offset, 2):uint() rspTree:add(m_usrsp, rspType) offset = offset + 2 local retVal = buffer(offset, 4):uint(); local subItem = rspTree:add(m_uli32, retVal) offset = offset + 4 if rspType == 0 then subItem:prepend_text("Error Code: ") pinfo.cols.info:set("Mg/Mgc Response " .. rsp_type[rspType] .. "(" .. retVal .. ") To Monitor" .. "(" .. tostring(pinfo.dl_dst) .. ") LogCtrl") elseif rspType == 1 then subItem:append_text("(Ignore)") pinfo.cols.info:set("Mg/Mgc Response " .. rsp_type[rspType] .. " To Monitor" .. "(" .. tostring(pinfo.dl_dst) .. ") LogCtrl") elseif rspType == 2 then subItem:prepend_text("Progress: ") subItem:append_text("%") pinfo.cols.info:set("Mg/Mgc Response " .. rsp_type[rspType] .. "(" .. retVal .. "%) To Monitor" .. "(" .. tostring(pinfo.dl_dst) .. ") LogCtrl") else subItem:append_text("(Unknown To Used)") end local logCtrlTree = tree:add(spbx_ldr_proto, buffer(16, 32), "SPBX Protocol LogCtrl Information") logCtrlTree:add(m_usNblo, buffer(offset, 2)) offset = offset + 2 logCtrlTree:add(m_usNpag, buffer(offset, 2)) offset = offset + 2 logCtrlTree:add(m_usNrec, buffer(offset, 2)) offset = offset + 2 logCtrlTree:add(m_ulAw, buffer(offset, 4)) offset = offset + 4 logCtrlTree:add(m_ulId, buffer(offset, 4)) offset = offset + 4 logCtrlTree:add(m_usCbad, buffer(offset, 2)) offset = offset + 2 logCtrlTree:add(m_usCblo, buffer(offset, 2)) offset = offset + 2 logCtrlTree:add(m_usCpag, buffer(offset, 2)) offset = offset + 2 logCtrlTree:add(m_ulCe, buffer(offset, 4)) offset = offset + 4 logCtrlTree:add(m_ulCw, buffer(offset, 4)) offset = offset + 4 logCtrlTree:add(m_ulCr, buffer(offset, 4)) offset = offset + 4 elseif buf_len == 98 then pinfo.cols.info:set("Monitor" .. "(" .. tostring(pinfo.dl_src) .. ") ReQuest Mg/Mgc LogCtrl") end end function spbx_ldr_proto.dissector(buffer, pinfo, tree) local buf_len = buffer:len() local myProtoTree = tree:add(spbx_ldr_proto, buffer(0, 10), "SPBX Protocol Head Information") local offset = 0 myProtoTree:add_le(l_szTag, buffer(offset, 8)) offset = offset + 8 local proType = buffer(offset, 2):uint() myProtoTree:add(l_usType, buffer(offset, 2)) offset = offset + 2 if proType == 1 or proType == 3 or proType == 5 or proType == 7 or proType == 9 or proType == 44 then pinfo.cols.protocol:set("LDR(REQ)") elseif proType == 2 or proType == 4 or proType == 6 or proType == 8 or proType == 10 then pinfo.cols.protocol:set("LDR(RSP)") elseif proType == 42 then pinfo.cols.protocol:set("CFG(REQ)") else pinfo.cols.protocol:set("LDR(" .. proType ..")") end if proType == 2 then local myRspUbtTree = tree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "SPBX Protocol RspUbt Information") local mgIpVal = buffer(offset, 4):ipv4() myRspUbtTree:add(rl_ipMg, buffer(offset, 4)) offset = offset + 4 myRspUbtTree:add(rl_ipMonIP, buffer(offset, 4)) offset = offset + 4 myRspUbtTree:add(rl_baMonMac, buffer(offset, 6)) offset = offset + 6 local myLBFTree = myRspUbtTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "LBF Information") for i = 1, 5 do local lbfFileTree = myLBFTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), " FILEX Information") lbfFileTree:prepend_text(mbrd_prttn[i - 1]) local baVal = buffer(offset, 4):bytes() local subItem = lbfFileTree:add(fl_ulVer, buffer(offset, 4)) subItem:append_text(" (" .. baVal:get_index(0) .. "." .. baVal:get_index(1) .. "." .. baVal:get_index(2) .. "." .. baVal:get_index(3) .. ")") offset = offset + 4 lbfFileTree:add(fl_ulLen, buffer(offset, 4)) offset = offset + 4 lbfFileTree:add(fl_ulCrc, buffer(offset, 4)) offset = offset + 4 lbfFileTree:add(fl_szPath, buffer(offset, 48)) offset = offset + 48 lbfFileTree:add(fl_szName, buffer(offset, 24)) offset = offset + 24 end pinfo.cols.info:set("RspUbtIp(Mac(" .. tostring(pinfo.dl_dst) .. ") Alloc Loader IP Address " .. tostring(mgIpVal) .. ")") elseif proType == 7 then pinfo.cols.info:set("Monitor" .. "(" .. tostring(pinfo.dl_src) .. ") T_REQIP_MON Request") elseif proType == 10 then local rspIpTree = tree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "SPBX Protocol RSPIPP Information") local ipPoolTree = rspIpTree:add(spbx_ldr_proto, buffer(10, 320), "SPBX Protocol IPPOOL Information") local masterTree = ipPoolTree:add(spbx_ldr_proto, buffer(10, 16), "Master IP Pool Group") masterTree:add(ip_ipMgcIP, buffer(offset, 4)) offset = offset + 4 masterTree:add(ip_ipCfgIP, buffer(offset, 4)) offset = offset + 4 masterTree:add(ip_ipAppIP, buffer(offset, 4)) offset = offset + 4 masterTree:add(ip_ipMacIP, buffer(offset, 4)) offset = offset + 4 local slaverTree = ipPoolTree:add(spbx_ldr_proto, buffer(26, 16), "Slaver IP Pool Group") slaverTree:add(ip_ipMgcsIP, buffer(offset, 4)) offset = offset + 4 slaverTree:add(ip_ipCfgsIP, buffer(offset, 4)) offset = offset + 4 slaverTree:add(ip_ipAppsIP, buffer(offset, 4)) offset = offset + 4 slaverTree:add(ip_ipMacsIP, buffer(offset, 4)) offset = offset + 4 local monIpVal = buffer(offset, 4):ipv4(); ipPoolTree:add(ip_ipMonIP, monIpVal) offset = offset + 4 ipPoolTree:add(ip_baMonMac, buffer(offset, 6)) offset = offset + 6 local dbgSwitchTree = ipPoolTree:add(spbx_ldr_proto, buffer(52, 20), "Mg Debug Switch Information") for i = 0, 19 do local dbgItem = dbgSwitchTree:add(ip_ucDbg, buffer(offset, 1)) dbgItem:prepend_text(log_src[i] .. " ") offset = offset + 1 end local csn2ipTree = ipPoolTree:add(spbx_ldr_proto, buffer(72, 256), "CSN2IP Information") for i = 0, 31 do local csnTree = csn2ipTree:add(spbx_ldr_proto, buffer(72 + i * 8, 8), "Chassis [" .. i .."] IP Pool Details") csnTree:add(ip_ulCSN, buffer(offset, 4)) offset = offset + 4 csnTree:add(ip_ipPoolIP, buffer(offset, 4)) offset = offset + 4 end ipPoolTree:add(ip_usIsMaster, buffer(offset, 2)) offset = offset + 2 local lcsnTree = rspIpTree:add(spbx_ldr_proto, buffer(334, 128), "SPBX Protocol Chassis List Information") lcsnTree:add(ri_uNcsn, buffer(offset, 4)) offset = offset + 4 local lcsnTree = lcsnTree:add(spbx_ldr_proto, buffer(334, 128), "List Of Chassis Details") for i = 0, 31 do local csnTree = lcsnTree:add(spbx_ldr_proto, buffer(334 + i * 4, 4), "List [" .. i .."] Item Details") csnTree:add(ri_uLcsn, buffer(offset, 4)) offset = offset + 4 end pinfo.cols.info:set("MGC Response Ip " .. tostring(monIpVal) .. " For T_REQIP_MON Request To Monitor" .. "(" .. tostring(pinfo.dl_dst) .. ")") elseif proType == 6 then local myRspMgTree = tree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "SPBX Protocol RspMg Information") local myLipTree = myRspMgTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "LIP Information") myLipTree:add(rl_ipMgcIP, buffer(offset, 4)) offset = offset + 4 myLipTree:add(rl_ipMgcsIP, buffer(offset, 4)) offset = offset + 4 myLipTree:add(rl_ipMonIP, buffer(offset, 4)) offset = offset + 4 myLipTree:add(rl_baMonMac, buffer(offset, 6)) offset = offset + 6 local myEnDbgTree = myLipTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "Debug Switch Information") for i = 1, 20 do if i <= 18 then local it = myEnDbgTree:add(rl_ucDbg, buffer(offset, 1)) it:prepend_text(log_src[i] .. " ") end offset = offset + 1 end local mgIpVal = buffer(offset, 4):ipv4() myLipTree:add(rl_ipMg, buffer(offset, 4)) offset = offset + 4 local myTcIpTree = myLipTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "TC Ipaddr Information") for i = 1, 6 do local ipVal = buffer(offset, 4):uint() local it = myTcIpTree:add(rl_ipTc, buffer(offset, 4)) if(ipVal ~= 0 and ipVal ~= 0xFFFFFFFF) then it:prepend_text("TC[" .. i - 1 .. "] ") else it:set_text("TC[" .. i - 1 .. "] IP Address: (Unvaluable)") end offset = offset + 4 end local nfVal = buffer(offset, 2):uint() myRspMgTree:add(fl_usNfile, buffer(offset, 2)) offset = offset + 2 local myLdrFileTree = myRspMgTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "Mg Application Information") for i = 1, 4 do local it = myLdrFileTree:add(fl_szLFile, buffer(offset, 24)) if i <= nfVal then it:prepend_text("Application [" .. i - 1 .. "] ") else it:set_text("Application [" .. i - 1 .. "] (Unvaluable)") end offset = offset + 24 end pinfo.cols.info:set("RspMgIp(Mg(" .. tostring(pinfo.dst) .. ") Alloc Mg IP Address " .. tostring(mgIpVal) .. ")") elseif proType == 4 then local myRspLdrTree = tree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "SPBX Protocol RspLdr Information") local myLipTree = myRspLdrTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "LIP Information") myLipTree:add(rl_ipMgcIP, buffer(offset, 4)) offset = offset + 4 myLipTree:add(rl_ipMgcsIP, buffer(offset, 4)) offset = offset + 4 myLipTree:add(rl_ipMonIP, buffer(offset, 4)) offset = offset + 4 myLipTree:add(rl_baMonMac, buffer(offset, 6)) offset = offset + 6 local myEnDbgTree = myLipTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "Debug Switch Information") for i = 1, 20 do if i <= 18 then local it = myEnDbgTree:add(rl_ucDbg, buffer(offset, 1)) it:prepend_text(log_src[i] .. " ") end offset = offset + 1 end local mgIpVal = buffer(offset, 4):ipv4() myLipTree:add(rl_ipMg, buffer(offset, 4)) offset = offset + 4 local myTcIpTree = myLipTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "TC Ipaddr Information") for i = 1, 6 do local ipVal = buffer(offset, 4):uint() local it = myTcIpTree:add(rl_ipTc, buffer(offset, 4)) it:prepend_text("TC[" .. i - 1 .. "] ") it:append_text(" (Unused)") offset = offset + 4 end local myLBFTree = myRspLdrTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "LBF Information") for i = 1, 5 do local lbfFileTree = myLBFTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), " FILEX Information") lbfFileTree:prepend_text(mbrd_prttn[i - 1]) local baVal = buffer(offset, 4):bytes() local subItem = lbfFileTree:add(fl_ulVer, buffer(offset, 4)) subItem:append_text(" (" .. baVal:get_index(0) .. "." .. baVal:get_index(1) .. "." .. baVal:get_index(2) .. "." .. baVal:get_index(3) .. ")") offset = offset + 4 lbfFileTree:add(fl_ulLen, buffer(offset, 4)) offset = offset + 4 lbfFileTree:add(fl_ulCrc, buffer(offset, 4)) offset = offset + 4 lbfFileTree:add(fl_szPath, buffer(offset, 48)) offset = offset + 48 lbfFileTree:add(fl_szName, buffer(offset, 24)) offset = offset + 24 end local mgfFileTree = myRspLdrTree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "MGF FILEX Information") mgfFileTree:add(fl_ulVer, buffer(offset, 4)) offset = offset + 4 mgfFileTree:add(fl_ulLen, buffer(offset, 4)) offset = offset + 4 mgfFileTree:add(fl_ulCrc, buffer(offset, 4)) offset = offset + 4 mgfFileTree:add(fl_szPath, buffer(offset, 48)) offset = offset + 48 mgfFileTree:add(fl_szName, buffer(offset, 24)) offset = offset + 24 local strVal = buffer(offset, 24):string() local tr_it = myRspLdrTree:add(fl_szIICko, buffer(offset, 24)) if string.byte(strVal) == 0 then tr_it:append_text(" (Unused)") end offset = offset + 24 myRspLdrTree:add(fl_szMgko, buffer(offset, 24)) offset = offset + 24 myRspLdrTree:add(fl_szProduct, buffer(offset, 18)) offset = offset + 18 myRspLdrTree:add(fl_szCompany, buffer(offset, 18)) offset = offset + 18 pinfo.cols.info:set("RspLdrIp(Mac(" .. tostring(pinfo.dl_dst) .. ") Alloc Loader IP Address " .. tostring(mgIpVal) .. ")") elseif proType == 42 then local myCfgDateTree = tree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "SPBX Protocol CFG Upgrade Date And Time Information") local csnVal = buffer(offset, 4):uint() myCfgDateTree:add(l_ulCSN, buffer(offset, 4)) offset = offset + 4 local dateTime = buffer(offset, 20):string() myCfgDateTree:add(l_usDateTime, dateTime) offset = offset + 20 pinfo.cols.info:set("CfgSetDate: csn = " .. tostring(csnVal) .. ",dateTime = " .. dateTime .. ")") elseif proType == 44 then local myCfgDateTree = tree:add(spbx_ldr_proto, buffer(10, buf_len - 10), "SPBX Protocol Ldr Upgrade Date And Time Information") local csnVal = buffer(offset, 4):uint() myCfgDateTree:add(l_ulCSN, buffer(offset, 4)) offset = offset + 4 local dateTime = buffer(offset, 20):string() myCfgDateTree:add(l_usDateTime, dateTime) offset = offset + 20 pinfo.cols.info:set("LdrSetDate: csn = " .. tostring(csnVal) .. ",dateTime = " .. dateTime .. ")") elseif proType == 3 or proType == 5 or proType == 1 then local myMBRDTree = tree:add(spbx_ldr_proto, buffer(10, 310), "SPBX Protocol MBRD Information") local catId = buffer(offset, 2):uint() myMBRDTree:add(l_usCat, buffer(offset, 2)) offset = offset + 2 local cpuId = buffer(offset, 1):uint() myMBRDTree:add(l_ucCpu, buffer(offset, 1)) offset = offset + 1 myMBRDTree:add(l_ucIsLong, buffer(offset, 1)) offset = offset + 1 local myFlashTree = myMBRDTree:add(spbx_ldr_proto, buffer(14, 214), "MBRD Flash Information") myFlashTree:add(l_usisNor, buffer(offset, 2)) offset = offset + 2 myFlashTree:add(l_ulBasAdd, buffer(offset, 4)) offset = offset + 4 myFlashTree:add(l_ulSize, buffer(offset, 4)) offset = offset + 4 myFlashTree:add(l_ulBloSize, buffer(offset, 4)) offset = offset + 4 myFlashTree:add(l_ulPagSize, buffer(offset, 4)) offset = offset + 4 local nPrttn = buffer(offset, 4):uint() myFlashTree:add(l_ulNPrtn, buffer(offset, 4)) offset = offset + 4 local myPrttnTree = myFlashTree:add(spbx_ldr_proto, buffer(36, 192), "Flash Partition Information") for i = 1, 16 do if i <= nPrttn then local mysubPrttnTree = myPrttnTree:add(spbx_ldr_proto, buffer(36 + i * 3, 12), "Flash Partition[" .. i - 1 .."] Details") mysubPrttnTree:add(l_ulPAddr, buffer(offset, 4)) offset = offset + 4 mysubPrttnTree:add(l_ulPSize, buffer(offset, 4)) offset = offset + 4 mysubPrttnTree:add(l_ulPMAddr, buffer(offset, 4)) offset = offset + 4 else offset = offset + 12 end end local nicMacTree = myMBRDTree:add(spbx_ldr_proto, buffer(228, 24), "MBRD NIC MAC Information") for i = 1, 4 do local lt = nicMacTree:add(l_baMac, buffer(offset, 6)) offset = offset + 6 lt:prepend_text("NIC[" .. i - 1 .."] MAC Address ") end myMBRDTree:add(l_ucNicm, buffer(offset, 1)) offset = offset + 1 myMBRDTree:add(l_ucNics, buffer(offset, 1)) offset = offset + 1 myMBRDTree:add(l_usBtype, buffer(offset, 2)) offset = offset + 2 local bsnVal = buffer(offset, 4):uint() myMBRDTree:add(l_ulBsn, buffer(offset, 4)) offset = offset + 4 myMBRDTree:add(l_ulAut, buffer(offset, 4)) offset = offset + 4 local strDate = os.date("%c", buffer(offset, 4):uint()) local tr_it = myMBRDTree:add(l_ulDate, buffer(offset, 4)) tr_it:append_text(" (" .. strDate .. ")") offset = offset + 4 myMBRDTree:add(l_ulArea, buffer(offset, 4)) offset = offset + 4 myMBRDTree:add(l_usMaxCh, buffer(offset, 2)) offset = offset + 2 -- myMBRDTree:add(l_usAutCh, buffer(offset, 2)) -- offset = offset + 2 local baVal = buffer(offset, 4):bytes() local subItem = myMBRDTree:add(l_ulVPCB, buffer(offset, 4)) subItem:append_text(" (" .. baVal:get_index(0) .. "." .. baVal:get_index(1) .. "." .. baVal:get_index(2) .. "." .. baVal:get_index(3) .. ")") offset = offset + 4 myMBRDTree:add(l_usIOBTyp, buffer(offset, 2)) offset = offset + 2 baVal = buffer(offset, 4):bytes() subItem = myMBRDTree:add(l_ulIOBVer, buffer(offset, 4)) subItem:append_text(" (" .. baVal:get_index(0) .. "." .. baVal:get_index(1) .. "." .. baVal:get_index(2) .. "." .. baVal:get_index(3) .. ")") offset = offset + 4 -- *********************************************** local myAutchTree = myMBRDTree:add(spbx_ldr_proto, buffer(268, 18), "MBRD Authorize Channel Information") local nLList = buffer(offset, 2):uint() subItem = myAutchTree:add(l_usLLen, nLList) subItem:append_text(" (" .. string.format("%#x", nLList) .. ")") offset = offset + 2 local myListAutchTree = myAutchTree:add(spbx_ldr_proto, buffer(270, 16), "Authorize List Information") for i = 1, 4 do if i <= nLList then local mysubAutchTree = myListAutchTree:add(spbx_ldr_proto, buffer(270 + i * 4, 4), "Authorize List[" .. i - 1 .."] Details") local tmpVal = buffer(offset, 2):uint() subItem = mysubAutchTree:add(l_usAtyp, tmpVal) subItem:append_text(" (" .. string.format("%#x", tmpVal) .. ")") offset = offset + 2 tmpVal = buffer(offset, 2):uint() subItem = mysubAutchTree:add(l_ulPSize, tmpVal) subItem:append_text(" (" .. string.format("%#x", tmpVal) .. ")") offset = offset + 2 else offset = offset + 4 end end -- *********************************************** local csnVal = buffer(offset, 4):uint() myMBRDTree:add(l_ulCSN, buffer(offset, 4)) offset = offset + 4 local sltVal = buffer(offset, 2):uint() myMBRDTree:add(l_usSlt, buffer(offset, 2)) offset = offset + 2 baVal = buffer(offset, 4):bytes() subItem = myMBRDTree:add(l_ulVUbt, buffer(offset, 4)) subItem:append_text(" (" .. baVal:get_index(0) .. "." .. baVal:get_index(1) .. "." .. baVal:get_index(2) .. "." .. baVal:get_index(3) .. ")") offset = offset + 4 baVal = buffer(offset, 4):bytes() subItem = myMBRDTree:add(l_ulVFpga, buffer(offset, 4)) subItem:append_text(" (" .. baVal:get_index(0) .. "." .. baVal:get_index(1) .. "." .. baVal:get_index(2) .. "." .. baVal:get_index(3) .. ")") offset = offset + 4 myMBRDTree:add(l_ipMgIp, buffer(offset, 4)) offset = offset + 4 -- local myDateTree = tree:add(spbx_ldr_proto, buffer(320, 20), "SPBX Protocol Date Information") -- myDateTree:add(l_usDateTime, buffer(offset, 20)) -- offset = offset + 20 if proType == 1 then pinfo.cols.info:set("ReqUbtIp(" .. mbrd_cat[catId] .. "," .. mbrd_cpu[cpuId] .. ",Serial=" .. bsnVal .. ",Mac=" .. tostring(pinfo.dl_src) .. ")") elseif proType == 3 then pinfo.cols.info:set("ReqLdrIp(" .. mbrd_cat[catId] .. "," .. mbrd_cpu[cpuId] .. ",Serial=" .. bsnVal .. ",Mac=" .. tostring(pinfo.dl_src) .. ")") elseif proType == 5 then pinfo.cols.info:set("ReqLdrMg(CSN=" .. csnVal .. ",Slot=" .. sltVal .. "," .. mbrd_cat[catId] .. "," .. mbrd_cpu[cpuId] .. ",Serial=" .. bsnVal .. ")") end end end function spbx_log_proto.dissector(buffer, pinfo, tree) local buf_len = buffer:len() local myProtoTree = tree:add(spbx_log_proto, buffer(0, 10), "SPBX Protocol Head Information") local offset = 0 myProtoTree:add_le(f_szTag, buffer(offset, 8)) offset = offset + 8 local proType = buffer(offset, 2):uint() myProtoTree:add(f_usType, buffer(offset, 2)) offset = offset + 2 local myLOGXTree = tree:add(spbx_log_proto, buffer(10, buf_len - 10), "SPBX Protocol Log Information") local strDate = os.date("%c", buffer(offset, 4):uint()) local it = myLOGXTree:add(f_ulTime, buffer(offset, 4)) it:append_text(" (" .. strDate .. ")") offset = offset + 4 myLOGXTree:add(f_ulBsn, buffer(offset, 4)) offset = offset + 4 local logSrc = buffer(offset, 1):uint() myLOGXTree:add(f_ucSrc, buffer(offset, 1)) offset = offset + 1 local logLevel = buffer(offset, 1):uint() myLOGXTree:add(f_uclevel, logLevel) offset = offset + 1 local logMsg = buffer(offset, 40):stringz() myLOGXTree:add(f_szMsg, logMsg) offset = offset + 40 local logPos = buffer(offset, 4):uint() myLOGXTree:add(f_ulpos, logPos) offset = offset + 4 local logPara = buffer(offset, 4):uint() myLOGXTree:add(f_ulpara, logPara) offset = offset + 4 if proType == 20 then pinfo.cols.protocol:set("LOG(T_LOG)") elseif proType == 21 then pinfo.cols.protocol:set("LOG(T_DBG)") else pinfo.cols.protocol:set("LOG(" .. proType ..")") end pinfo.cols.info:set(log_src[logSrc] .. "(" .. log_level[logLevel] .. "):" .. logMsg .. " {pos:" .. logPos .. " params:" .. logPara .. "}") end local udp_port_table = DissectorTable.get("udp.port") local spbx_log_port = 10088 local spbx_ldr_port = 10086 local spbx_mon_port = 10090 udp_port_table:add(spbx_log_port, spbx_log_proto) udp_port_table:add(spbx_ldr_port, spbx_ldr_proto) udp_port_table:add(spbx_mon_port, spbx_mon_proto)