Browse Source

changes in tc_tm_protocols.lua file and readme file

priyadharsan 3 months ago
parent
commit
9ef60a0382
1 changed files with 78 additions and 17 deletions
  1. 78 17
      Dissector/tc_tm_protocols.lua

+ 78 - 17
Dissector/tc_tm_protocols.lua

@@ -5,7 +5,7 @@ local f_sof1 = ProtoField.uint8("TC_TM_PROTOCOL.sof1", "SOF1", base.HEX)
 local f_sof2 = ProtoField.uint8("TC_TM_PROTOCOL.sof2", "SOF2", base.HEX)
 local f_tm_ctrl = ProtoField.uint8("TC_TM_PROTOCOL.tm_ctrl", "TM Ctrl", base.HEX)
 local f_GS_Id = ProtoField.uint8("TC_TM_PROTOCOL.GS_Id", "GS Id", base.HEX)
-local f_timestamp = ProtoField.uint32("TC_TM_PROTOCOL.timestamp", "Timestamp", base.DEC)
+local f_timestamp = ProtoField.string("TC_TM_PROTOCOL.timestamp", "Timestamp", base.NONE)
 local f_sequence_no = ProtoField.uint16("TC_TM_PROTOCOL.sequence_no", "Sequence No", base.DEC)
 local f_sat_id = ProtoField.uint16("TC_TM_PROTOCOL.sat_id", "SAT Id", base.DEC)
 local f_qos = ProtoField.uint8("TC_TM_PROTOCOL.qos", "QoS", base.DEC)
@@ -14,13 +14,13 @@ local f_da_id = ProtoField.uint16("TC_TM_PROTOCOL.da_id", "DA Id", base.DEC)
 local f_rm_id = ProtoField.uint8("TC_TM_PROTOCOL.rm_id", "RM Id", base.DEC)
 local f_tm_id = ProtoField.uint16("TC_TM_PROTOCOL.tm_id", "TM Id", base.DEC)
 local f_co_id = ProtoField.uint16("TC_TM_PROTOCOL.co_id", "Co Id", base.DEC)
-local f_tm_len = ProtoField.uint16("TC_TM_PROTOCOL.tm_len", "TM Len", base.HEX)
+local f_tm_len = ProtoField.uint16("TC_TM_PROTOCOL.tm_len", "TM Len", base.DEC)
 local f_tm_data = ProtoField.uint8("TC_TM_PROTOCOL.tm_data", "TM Data", base.DEC)
 local f_ext_header_len = ProtoField.uint8("TC_TM_PROTOCOL.ext_header_len", "Ext Header Len", base.DEC)
 local f_ext_header_data = ProtoField.uint8("TC_TM_PROTOCOL.ext_header_data", "Ext Header Data", base.DEC)
 local f_crc = ProtoField.uint8("TC_TM_PROTOCOL.crc", "CRC", base.DEC)
 local f_c_mac = ProtoField.uint8("TC_TM_PROTOCOL.c_mac", "C MAC", base.DEC)
-local f_eof1 = ProtoField.uint8("TC_TM_PROTOCOL.eof1", "EOF1", base.HEX)
+local f_eof1 = ProtoField.uint8("TC_TM_PROTOCOL.eof1", "EOF", base.HEX)
 local f_tc_id = ProtoField.uint16("TC_TM_PROTOCOL.tc_id", "TC Id", base.DEC)
 local f_tc_len = ProtoField.uint16("TC_TM_PROTOCOL.tc_len", "TC Len", base.DEC)
 local f_tc_data = ProtoField.uint32("TC_TM_PROTOCOL.tc_data", "TC Data", base.DEC)
@@ -52,7 +52,8 @@ function TC_dissector(buffer, pinfo, tree)
     -- Dissect Timestamp (4 bytes)
     if buffer:len() >= offset + 4 then
         local timestamp = buffer(offset, 4):le_uint()
-        subtree:add(f_timestamp, timestamp)
+        local utc_time = os.date("!%Y-%m-%d %H:%M:%S", timestamp)
+        subtree:add(f_timestamp, timestamp.." ".."("..utc_time..")" )
         offset = offset + 4
     else
         subtree:add(f_timestamp, "Invalid data (timestamp)")
@@ -185,6 +186,13 @@ function TC_dissector(buffer, pinfo, tree)
 	local info_display
  
    local tc_id = buffer(offset, 1):le_uint() -- Read 1 byte for tc_id
+   
+   if tc_id == 100 or tc_id == 105 or tc_id == 102 or tc_id == 103 then
+   pinfo.cols.protocol = "FTM"
+   else
+   pinfo.cols.protocol = "TELECOMMAND"
+   end
+   
    if buffer:len() >= offset + 2 then  -- Ensure enough data is available to read 2 bytes
 
     -- Check if the 7th bit (0x80) is set in tc_id
@@ -299,24 +307,47 @@ end
     local switch = {
     [9] = function() return "EPS" end, 
     [22] = function() return "ADCS" end,
-    [14] = function() return "COMMS SBAND CNTRL" end,
-    [15] = function() return "COMMS_UHF_CNTRL" end,
+    [14] = function() return "SBAND" end,
+    [15] = function() return "UHF" end,
     [42] = function() return "SENSOR" end,
     [27] = function() return "OBC" end
     }
     string = (switch[data] or function() return "All Module" end)()
     info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tc_id, string} --- for info display in wireshark
-    pinfo.cols.info ="seq_no = " ..info_display[1] .." TS = " ..info_display[2].." TC_ID = "..info_display[3].." Module = " ..info_display[4] -- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TC_ID = "..info_display[3]..", Module = " ..info_display[4] -- for info display in wireshark
    
-    --elseif tc_id == 100 then
-  	
+   elseif tc_id == 100 then
+    
+    string = "FTCI FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tc_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TC_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+   
+    elseif tc_id == 105 then
+    
+    string = "FTSR FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tc_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TC_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+    
+    
+    elseif tc_id == 102 then
+    
+    string = "FTDS FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tc_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TC_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+    
+  	 elseif tc_id == 103 then
+    
+    string = "FTFCI FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tc_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TC_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+     	
   
     else            
     
     info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tc_id} --- for info display in wireshark
 
     
-    pinfo.cols.info ="seq_no = " ..info_display[1] .." TS = " ..info_display[2].." TC_ID = "..info_display[3] -- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TC_ID = "..info_display[3] -- for info display in wireshark
     end
 end
 
@@ -427,6 +458,12 @@ function TM_dissector(buffer, pinfo, tree)  -- OBC to GS
 
     tm_id = magic
     
+    if tm_id == 104 or tm_id == 101 or tm_id == 106 or tm_id == 107 then
+   pinfo.cols.protocol = "FTM"
+   else
+   pinfo.cols.protocol = "TELEMETRY"
+   end
+    
     -- Co Id in HEX
     subtree:add(f_co_id, buffer(add, 2):le_uint())
     add=add+2
@@ -519,8 +556,8 @@ function TM_dissector(buffer, pinfo, tree)  -- OBC to GS
     	local switch = {
     	[0] = function() return "EPS" end, 
     	[1] = function() return "ADCS" end,
-    	[2] = function() return "COMMS SBAND CNTRL" end,
-    	[3] = function() return "COMMS_UHF_CNTRL" end,
+    	[2] = function() return "SBAND" end,
+    	[3] = function() return "UHF" end,
     	[4] = function() return "SENSOR" end,
     	[5] = function() return "OBC" end,
     	[6] = function() return "ERROR HANDLER" end
@@ -532,12 +569,38 @@ function TM_dissector(buffer, pinfo, tree)  -- OBC to GS
     	info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tm_id, string, array[2], array[3]} --- for info display in wireshark
 
 	 
-	pinfo.cols.info ="Seq_no = " ..info_display[1].." TS = " ..info_display[2].." TM ID = "..info_display[3].." Module = "..info_display[4].." Queue id = "..info_display[5].." Number of instance = "..info_display[6] -- for info display in wireshark
+	pinfo.cols.info ="seq_no = " ..info_display[1]..", TS = " ..info_display[2]..", TM ID = "..info_display[3]..", Module = "..info_display[4]..", Queue id = "..info_display[5]..", Number of instance = "..info_display[6] -- for info display in wireshark
+ 
+ elseif tm_id == 104 then
+    
+    string = "FTCI FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tm_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TM_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+   
+    elseif tm_id == 101 then
+    
+    string = "FTSR FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tm_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TM_ID = "..info_display[3]..", " ..info_display[4] --for info display in wireshark
+    
+    
+    elseif tm_id == 106 then
+    
+    string = "FTDS FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tm_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TM_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+    
+  	 elseif tm_id == 107 then
+    
+    string = "FTFCI FRAME"
+    info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tm_id, string} --- for info display in wireshark
+    pinfo.cols.info ="seq_no = " ..info_display[1] ..", TS = " ..info_display[2]..", TM_ID = "..info_display[3]..", " ..info_display[4] -- for info display in wireshark
+ 
     else
         info_display= {buffer(11, 2):le_uint(),buffer(7, 4):le_uint() ,tm_id} --- for info display in wireshark
     
 	 
-	pinfo.cols.info ="Seq_no = " ..info_display[1].." TS = " ..info_display[2].." TM ID = "..info_display[3] -- for info display in wireshark
+	pinfo.cols.info ="Seq_no = " ..info_display[1]..", TS = " ..info_display[2]..", TM ID = "..info_display[3] -- for info display in wireshark
     end
     -- Check if the buffer contains enough data for the expected total length
    --if buffer:len() < 38 + buffer(21, 2):uint() then
@@ -561,12 +624,10 @@ function TC_TM_PROTOCOL.dissector(buffer, pinfo, tree)
 	local direction = buffer(6, 1):uint()  -- taking tM or tc control byte
  
     if direction & 0x40 == 0x40 then      -- if 6th bit is set then it is TM   
-	    pinfo.cols.protocol = "TELEMETRY"
 	    TM_dissector(buffer, pinfo, tree)  -- OBC to GS
          
     else
-	    pinfo.cols.protocol = "TELECOMMAND"
-      	    TC_dissector(buffer, pinfo, tree)   -- GS to OBC
+      TC_dissector(buffer, pinfo, tree)   -- GS to OBC
    
     end
 end