hm_dissector.lua 2.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. function HM_dissector(buffer, pinfo, tree, TC_TM_PROTOCOL, offset)
  2. local f_sub_mod_id = ProtoField.uint8("TC_TM_PROTOCOL.sub_mod_id", "SUB MODULE ID", base.DEC)
  3. local f_Queue_id = ProtoField.uint8("TC_TM_PROTOCOL.Queue_id", "QUEUE ID", base.DEC)
  4. local f_priority = ProtoField.uint8("TC_TM_PROTOCOL.priority", "PRIORITY", base.DEC)
  5. local f_opt_sel_sin_mul_que = ProtoField.uint8("TC_TM_PROTOCOL.opt_sel_sin_mul_que", "Option To Select Single Or Multiple Queue", base.DEC)
  6. -- Add the fields to the protocol
  7. TC_TM_PROTOCOL.fields = { f_sub_mod_id, f_Queue_id, f_priority, f_opt_sel_sin_mul_que }
  8. --local info_display
  9. local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "HEALTH_METRIC_DATA")
  10. --dissect submodule_id
  11. local data1 = buffer(offset,1):le_uint()
  12. subtree:add(f_sub_mod_id , data1)
  13. offset = offset + 1
  14. --dissect queue_id
  15. local data2 = buffer(offset,1):le_uint()
  16. subtree:add(f_Queue_id, data2)
  17. offset = offset + 1
  18. --dissect f_priority
  19. local data3 = buffer(offset,1):le_uint()
  20. subtree:add(f_priority, data3)
  21. offset = offset + 1
  22. --dissect option to select_single or multiple queue
  23. local data4 = buffer(offset,1):le_uint()
  24. subtree:add(f_opt_sel_sin_mul_que, data4)
  25. --info_display= {data1} --- for info display in wireshark
  26. --pinfo.cols.info ="sub_mod_id" ..info_display[1]
  27. return data1
  28. end
  29. function HM_TM_dissector(buffer, pinfo, tree, TC_TM_PROTOCOL, offset, len)
  30. local f_sub_mod_id = ProtoField.uint8("TC_TM_PROTOCOL.sub_mod_id", "SUB MODULE ID", base.DEC)
  31. local f_Queue_id = ProtoField.uint8("TC_TM_PROTOCOL.Queue_id", "QUEUE ID", base.DEC)
  32. local f_num_of_instance = ProtoField.uint8("TC_TM_PROTOCOL.num_of_instance", "Number of Instance", base.DEC)
  33. local f_Health_Data = ProtoField.uint8("TC_TM_PROTOCOL.Health_Data", "Health Data", base.DEC)
  34. -- Add the fields to the protocol
  35. TC_TM_PROTOCOL.fields = { f_sub_mod_id, f_Queue_id, f_num_of_instance, f_Health_Data }
  36. --local info_display
  37. local subtree = tree:add(TC_TM_PROTOCOL, buffer(), "HEALTH_METRIC_DATA")
  38. --dissect submodule_id
  39. local data1 = buffer(offset,1):le_uint()
  40. subtree:add(f_sub_mod_id , data1)
  41. offset = offset + 1
  42. --dissect queue_id
  43. local data2 = buffer(offset,1):le_uint()
  44. subtree:add(f_Queue_id, data2)
  45. offset = offset + 1
  46. --dissect f_num_of_instance
  47. local data3 = buffer(offset,1):le_uint()
  48. subtree:add(f_num_of_instance, data3)
  49. offset = offset + 1
  50. --dissect Health_Data
  51. len =len - 3
  52. for i=0, len-1 do
  53. local data4 = buffer(offset,1):le_uint()
  54. subtree:add(f_Health_Data, data4)
  55. offset = offset + 1
  56. end
  57. end