123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566 |
- function sensor_dissector(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance, queue_id)
- if queue_id == 0 then
- require("sensor_dissector")
- sensor_dissector_0(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 1 then
- require("sensor_dissector")
- sensor_dissector_1(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 2 then
- require("sensor_dissector")
- sensor_dissector_2(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 3 then
- require("sensor_dissector")
- sensor_dissector_3(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 4 then
- require("sensor_dissector")
- sensor_dissector_4(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 5 then
- require("sensor_dissector")
- sensor_dissector_5(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 6 then
- require("sensor_dissector")
- sensor_dissector_6(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 7 then
- require("sensor_dissector")
- sensor_dissector_7(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 8 then
- require("sensor_dissector")
- sensor_dissector_8(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 9 then
- require("sensor_dissector")
- sensor_dissector_9(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 10 then
- require("sensor_dissector")
- sensor_dissector_10(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 11 then
- require("sensor_dissector")
- sensor_dissector_11(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 12 then
- require("sensor_dissector")
- sensor_dissector_12(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 13 then
- require("sensor_dissector")
- sensor_dissector_13(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 14 then
- require("sensor_dissector")
- sensor_dissector_14(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- elseif queue_id == 15 then
- require("sensor_dissector")
- sensor_dissector_15(buffer, pinfo, subtree1, sensor_protocol, offset, num_of_instance)
-
- end
- end
- ---------------------------------------------------------------------------------------
- function sensor_dissector_0(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields of the protocol
- local f_vbus_voltage = ProtoField.float("psm.vbus_voltage", "Vbus Voltage")
- local f_vshunt_voltage = ProtoField.float("psm.vshunt_voltage", "Vshunt Voltage")
- local f_current = ProtoField.float("psm.current", "Current")
- local f_power = ProtoField.uint32("psm.power", "Power")
- local f_epoch_time = ProtoField.uint32("psm.epoch_time", "Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_vbus_voltage, f_vshunt_voltage, f_current, f_power, f_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- for i = 0, num_of_instance - 1 do
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
-
- subtree1:add(f_vbus_voltage, buffer(offset, 4):le_float()) -- 4 bytes for float
- offset = offset + 4
-
- subtree1:add(f_vshunt_voltage, buffer(offset, 4):le_float()) -- 4 bytes for float
- offset = offset + 4
-
- subtree1:add(f_current, buffer(offset, 4):le_float()) -- 4 bytes for float
- offset = offset + 4
-
- subtree1:add(f_power, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
- offset = offset + 4
-
- subtree1:add(f_epoch_time, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
- offset = offset + 4
- end
-
- end
- ---------------------------------------------------------------------------------------------------
- function sensor_dissector_1(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields of the protocol
- local f_vbus_voltage = ProtoField.float("psm.vbus_voltage", "Vbus Voltage")
- local f_vshunt_voltage = ProtoField.float("psm.vshunt_voltage", "Vshunt Voltage")
- local f_current = ProtoField.float("psm.current", "Current")
- local f_power = ProtoField.uint32("psm.power", "Power")
- local f_epoch_time = ProtoField.uint32("psm.epoch_time", "Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_vbus_voltage, f_vshunt_voltage, f_current, f_power, f_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- for i = 0, num_of_instance - 1 do
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
-
- subtree1:add(f_vbus_voltage, buffer(offset, 4):le_float()) -- 4 bytes for float
- offset = offset + 4
-
- subtree1:add(f_vshunt_voltage, buffer(offset, 4):le_float()) -- 4 bytes for float
- offset = offset + 4
-
- subtree1:add(f_current, buffer(offset, 4):le_float()) -- 4 bytes for float
- offset = offset + 4
-
- subtree1:add(f_power, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
- offset = offset + 4
-
- subtree1:add(f_epoch_time, buffer(offset, 4):le_uint()) -- 4 bytes for uint32
- offset = offset + 4
- end
-
- end
- -----------------------------------------------------------------------------------------------------------------
- function sensor_dissector_2(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- ------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_3(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_4(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_5(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_6(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_7(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_8(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_9(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_10(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define the fields for the protocol
- local f_temperature = ProtoField.float("sensor_protocol.temperature", "Temperature")
- local f_temp_epoch_time = ProtoField.uint32("sensor_protocol.temp_epoch_time", "Temp Epoch Time")
- -- Add the fields to the protocol
- sensor_protocol.fields = { f_temperature, f_temp_epoch_time }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local temp_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_temp_epoch_time, temp_epoch_time)
- offset = offset + 4
- end
-
- end
- -------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_11(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define ProtoFields for the new structure fields
- local f_voltage = ProtoField.float("SensorData.voltage", "Voltage", base.DEC)
- local f_current = ProtoField.float("SensorData.current", "Current", base.DEC)
- local f_adm_epoch_time = ProtoField.uint32("SensorData.adm_epoch_time", "Epoch Time", base.DEC)
- -- Add the fields to the protocol
- sensor_protocol.fields = {
- f_voltage, f_current, f_adm_epoch_time
- }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect voltage (4 bytes for float)
- local voltage = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_voltage, voltage)
- offset = offset + 4
- -- dissect current (4 bytes for float)
- local current = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_current, current)
- offset = offset + 4
- -- dissect adm_epoch_time (4 bytes for uint32)
- local adm_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_adm_epoch_time, adm_epoch_time)
- offset = offset + 4
- end
- end
- ---------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_12(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define ProtoFields for the new structure fields
- local f_voltage = ProtoField.float("SensorData.voltage", "Voltage", base.DEC)
- local f_current = ProtoField.float("SensorData.current", "Current", base.DEC)
- local f_adm_epoch_time = ProtoField.uint32("SensorData.adm_epoch_time", "Epoch Time", base.DEC)
- -- Add the fields to the protocol
- sensor_protocol.fields = {
- f_voltage, f_current, f_adm_epoch_time
- }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect voltage (4 bytes for float)
- local voltage = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_voltage, voltage)
- offset = offset + 4
- -- dissect current (4 bytes for float)
- local current = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_current, current)
- offset = offset + 4
- -- dissect adm_epoch_time (4 bytes for uint32)
- local adm_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_adm_epoch_time, adm_epoch_time)
- offset = offset + 4
- end
- end
- ---------------------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_13(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define ProtoFields for the new structure fields
- local f_voltage = ProtoField.float("SensorData.voltage", "Voltage", base.DEC)
- local f_current = ProtoField.float("SensorData.current", "Current", base.DEC)
- local f_adm_epoch_time = ProtoField.uint32("SensorData.adm_epoch_time", "Epoch Time", base.DEC)
- -- Add the fields to the protocol
- sensor_protocol.fields = {
- f_voltage, f_current, f_adm_epoch_time
- }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE "..i)
- -- dissect voltage (4 bytes for float)
- local voltage = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_voltage, voltage)
- offset = offset + 4
- -- dissect current (4 bytes for float)
- local current = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_current, current)
- offset = offset + 4
- -- dissect adm_epoch_time (4 bytes for uint32)
- local adm_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_adm_epoch_time, adm_epoch_time)
- offset = offset + 4
- end
- end
- ----------------------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_14(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define ProtoFields for the new structure fields
- local f_temperature = ProtoField.float("TemperatureData.temperature", "Temperature", base.DEC)
- local f_dt_epoch_time = ProtoField.uint32("TemperatureData.dt_epoch_time", "Epoch Time", base.DEC)
- -- Add the fields to the protocol
- sensor_protocol.fields = {
- f_temperature, f_dt_epoch_time
- }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 0, num_of_instance - 1 do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE"..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local dt_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_dt_epoch_time, dt_epoch_time)
- offset = offset + 4
- end
- end
- ---------------------------------------------------------------------------------------------------------------------------------------
- function sensor_dissector_15(buffer, pinfo, tree, sensor_protocol, offset, num_of_instance)
- -- Define ProtoFields for the new structure fields
- local f_temperature = ProtoField.float("TemperatureData.temperature", "Temperature", base.DEC)
- local f_dt_epoch_time = ProtoField.uint32("TemperatureData.dt_epoch_time", "Epoch Time", base.DEC)
- -- Add the fields to the protocol
- sensor_protocol.fields = {
- f_temperature, f_dt_epoch_time
- }
- local subtree = tree:add(sensor_protocol, buffer(), "SENSOR")
- -- Loop through the data (num_of_instance could represent the number of instances or packets to dissect)
- for i = 1, num_of_instance do
- -- Add the new structure data as a subtree
- local subtree1 = subtree:add(sensor_protocol, buffer(), "INSTANCE"..i)
- -- dissect temperature (4 bytes for float)
- local temperature = buffer(offset, 4):le_float() -- Float type is 4 bytes (32 bits)
- subtree1:add(f_temperature, temperature)
- offset = offset + 4
- -- dissect dt_epoch_time (4 bytes for uint32)
- local dt_epoch_time = buffer(offset, 4):le_uint() -- uint32 is 4 bytes
- subtree1:add(f_dt_epoch_time, dt_epoch_time)
- offset = offset + 4
- end
- end
- ------------------------------------------------------------------------------------------------------------------------------------
|