hm_dissector.lua 4.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. function HM_TC_dissector(buffer, pinfo, subtree, 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. subtree1 = subtree:add(TC_TM_PROTOCOL, buffer(), "HEALTH_METRIC_DATA")
  10. --dissect submodule_id
  11. local data1 = buffer(offset,1):le_uint()
  12. subtree1:add(f_sub_mod_id , data1)
  13. offset = offset + 1
  14. --dissect queue_id
  15. local data2 = buffer(offset,1):le_uint()
  16. subtree1:add(f_Queue_id, data2)
  17. offset = offset + 1
  18. --dissect f_priority
  19. local data3 = buffer(offset,1):le_uint()
  20. subtree1: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. subtree1: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, subtree, 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.uint16("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 subtree1 = subtree:add(TC_TM_PROTOCOL, buffer(), "HEALTH_METRIC_DATA")
  38. --dissect submodule_id
  39. local submodule_id = buffer(offset,1):le_uint()
  40. subtree1:add(f_sub_mod_id , submodule_id)
  41. offset = offset + 1
  42. --dissect queue_id
  43. local queue_id = buffer(offset,1):le_uint()
  44. subtree1:add(f_Queue_id, queue_id)
  45. offset = offset + 1
  46. --dissect f_num_of_instance
  47. local num_of_instance = buffer(offset,2):le_uint()
  48. subtree1:add(f_num_of_instance, num_of_instance)
  49. offset = offset + 2
  50. --dissect Health_Data
  51. len = len - 4
  52. if submodule_id == 0 then
  53. require("eps_dissector")
  54. dissect_power_system_data(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, tm_len, num_of_instance)
  55. elseif submodule_id == 1 then
  56. require("adcs_dissector")
  57. adcs_dissector(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, num_of_instance, queue_id)
  58. elseif submodule_id == 3 then
  59. require("uhf_dissector")
  60. UHF_DISSECTOR(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, tm_len, num_of_instance)
  61. elseif submodule_id == 4 then
  62. require("sensor_dissector")
  63. sensor_dissector(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, num_of_instance, queue_id)
  64. elseif submodule_id == 5 then
  65. require("obc_dissector")
  66. obc_dissector(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, num_of_instance)
  67. elseif submodule_id == 2 then
  68. require("sband_dissector")
  69. sband_dissectors(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, num_of_instance)
  70. elseif submodule_id == 6 then
  71. require("error_handler_dissector")
  72. error_handler_dissectors(buffer, pinfo, subtree, TC_TM_PROTOCOL, offset, num_of_instance)
  73. else
  74. for i = 0, len - 1 do
  75. local data4 = buffer(offset,1):le_uint()
  76. subtree1:add(f_Health_Data, data4)
  77. offset = offset + 1
  78. end
  79. end
  80. local array = {submodule_id, queue_id, num_of_instance}
  81. return array
  82. end