mirror of
https://github.com/lwvmobile/dsd-fme.git
synced 2026-11-12 16:57:23 -05:00
Event History Setup; #287
Fix NXDN site_code and sys_code order in event_history; Reset correct call type string on TX_REL, TX_REL_EXT, and DISC messages when stale; Have P25p1 PDUs write to event_history, regardless of decoded state; Include Enc info if available and not decrypted or decoded; Event History and Log RSP Packets; Tweak and Add DMR RSP Packets to Event History and Log Fix Event History Log File Display on Startup; Add UDP Port 4069 for TRBOnet SCADA; (no decode of data);
This commit is contained in:
@@ -260,25 +260,33 @@ void dmr_dheader (dsd_opts * opts, dsd_state * state, uint8_t dheader[], uint8_t
|
||||
|
||||
}
|
||||
|
||||
if (dpf == 1) //response data packet header
|
||||
if (dpf == 1) //response data packet header //TODO: Convert to something more similar to P25 variant
|
||||
{
|
||||
//mostly fleshed out response packet info
|
||||
fprintf (stderr, "\n SAP %02d [%s] - Class %d - Type %0d - ", sap, sap_string, r_class, r_type);
|
||||
if (r_class == 0 && r_type == 1) fprintf (stderr, "ACK - Success");
|
||||
char rsp_string[200]; memset(rsp_string, 0, sizeof(rsp_string));
|
||||
sprintf (rsp_string, "DATA RESP TGT: %d; SRC: %d; ", target, source);
|
||||
if (r_class == 0 && r_type == 1) strcat (rsp_string, "ACK - Success");
|
||||
if (r_class == 1)
|
||||
{
|
||||
fprintf (stderr, "NACK - ");
|
||||
if (r_type == 0) fprintf (stderr, "Illegal Format");
|
||||
if (r_type == 1) fprintf (stderr, "Illegal Format");
|
||||
if (r_type == 2) fprintf (stderr, "Packet CRC ERR");
|
||||
if (r_type == 3) fprintf (stderr, "Memory Full");
|
||||
if (r_type == 4) fprintf (stderr, "FSN Out of Seq");
|
||||
if (r_type == 5) fprintf (stderr, "Undeliverable");
|
||||
if (r_type == 6) fprintf (stderr, "PKT Out of Seq");
|
||||
if (r_type == 7) fprintf (stderr, "Invalid User");
|
||||
strcat (rsp_string, "NACK - ");
|
||||
if (r_type == 0) strcat (rsp_string, "Illegal Format");
|
||||
if (r_type == 1) strcat (rsp_string, "Illegal Format");
|
||||
if (r_type == 2) strcat (rsp_string, "Packet CRC ERR");
|
||||
if (r_type == 3) strcat (rsp_string, "Memory Full");
|
||||
if (r_type == 4) strcat (rsp_string, "FSN Out of Seq");
|
||||
if (r_type == 5) strcat (rsp_string, "Undeliverable");
|
||||
if (r_type == 6) strcat (rsp_string, "PKT Out of Seq");
|
||||
if (r_type == 7) strcat (rsp_string, "Invalid User");
|
||||
}
|
||||
if (r_class == 2) fprintf (stderr, "SACK - Retry");
|
||||
if (r_status) fprintf (stderr, " - %d", r_status); //the object/value of the ack/nack/sack
|
||||
if (r_class == 2) strcat (rsp_string, "SACK - Retry");
|
||||
// if (r_status) strcat (rsp_string, " - %d", r_status);
|
||||
UNUSED(r_status);
|
||||
|
||||
fprintf (stderr, "\n %s", rsp_string);
|
||||
|
||||
//REMUS, enable (or disable) next two lines is you want to
|
||||
sprintf (state->dmr_lrrp_gps[slot], "%s; ", rsp_string);
|
||||
watchdog_event_datacall (opts, state, source, target, state->dmr_lrrp_gps[slot], slot);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -462,6 +462,12 @@ void decode_ip_pdu (dsd_opts * opts, dsd_state * state, uint16_t len, uint8_t *
|
||||
fprintf (stderr, "Job Ticket Server;");
|
||||
sprintf (state->dmr_lrrp_gps[slot], "JTS SRC: %d; DST: %d;", src24, dst24);
|
||||
}
|
||||
else if (port1 == 4069 && port2 == 4069)
|
||||
{
|
||||
//https://trbonet.com/kb/how-to-configure-dt500-and-mobile-radio-to-work-with-scada-sensors/
|
||||
fprintf (stderr, "TRBOnet SCADA;");
|
||||
sprintf (state->dmr_lrrp_gps[slot], "SCADA SRC: %d; DST: %d;", src24, dst24);
|
||||
}
|
||||
//ETSI specific -- unknown entry value, assuming +28
|
||||
else if (port1 == 5016 && port2 == 5016)
|
||||
{
|
||||
|
||||
@@ -2196,7 +2196,7 @@
|
||||
case 'J': //Event output to file (J for Journal)
|
||||
strncpy(opts.event_out_file, optarg, 1023);
|
||||
opts.event_out_file[1023] = '\0';
|
||||
fprintf (stderr,"Writing + Appending Event History to file %s\n", opts.lrrp_out_file);
|
||||
fprintf (stderr,"Writing + Appending Event History to file %s\n", opts.event_out_file);
|
||||
break;
|
||||
|
||||
case '7': //make a custom wav file directory in the current working directory -- use this before -P
|
||||
|
||||
@@ -5093,7 +5093,7 @@ void watchdog_event_current (dsd_opts * opts, dsd_state * state, uint8_t slot)
|
||||
else if (state->lastsynctype == 28 || state->lastsynctype == 29)
|
||||
{
|
||||
if (sys_id1)
|
||||
sprintf (event_string, "%s %s %s TGT: %08d; SRC: %08d; RAN: %02d; SYS: %d.%d; ", datestr, timestr, sys_string, target_id, source_id, sys_id3, sys_id1, sys_id2);
|
||||
sprintf (event_string, "%s %s %s TGT: %08d; SRC: %08d; RAN: %02d; SYS: %d.%d; ", datestr, timestr, sys_string, target_id, source_id, sys_id3, sys_id2, sys_id1);
|
||||
else
|
||||
sprintf (event_string, "%s %s %s TGT: %08d; SRC: %08d; RAN: %02d; ", datestr, timestr, sys_string, target_id, source_id, sys_id3);
|
||||
if (enc)
|
||||
|
||||
@@ -142,6 +142,7 @@ void NXDN_Elements_Content_decode(dsd_opts * opts, dsd_state * state,
|
||||
case 0x07: //TX_REL_EXT
|
||||
case 0x08: //TX_REL
|
||||
sprintf (state->call_string[0], "%s", "");
|
||||
sprintf (state->nxdn_call_type, "%s", "");
|
||||
case 0x01: //VCALL
|
||||
NXDN_decode_VCALL(opts, state, ElementsContent);
|
||||
break;
|
||||
@@ -151,6 +152,7 @@ void NXDN_Elements_Content_decode(dsd_opts * opts, dsd_state * state,
|
||||
NXDN_decode_VCALL(opts, state, ElementsContent);
|
||||
memset (state->nxdn_alias_block_segment, 0, sizeof(state->nxdn_alias_block_segment));
|
||||
sprintf (state->call_string[0], "%s", "");
|
||||
sprintf (state->nxdn_call_type, "%s", "");
|
||||
|
||||
// #ifdef LIMAZULUTWEAKS
|
||||
// ; //do nothing -- testing errors on CAC messages when returning quickly from RTCH
|
||||
|
||||
@@ -374,6 +374,11 @@ void processMPDU(dsd_opts * opts, dsd_state * state)
|
||||
fprintf (stderr, "%s ", KNRM);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
//clear these, regardless of if PDU was deocded, or attempted,
|
||||
//so we don't create phantom voice calls in the event history
|
||||
state->lasttg = 0;
|
||||
state->lastsrc = 0;
|
||||
|
||||
} //end r34
|
||||
|
||||
else if (r34 == 0) //12 rate unconfirmed data //err[0] == 0
|
||||
@@ -416,7 +421,12 @@ void processMPDU(dsd_opts * opts, dsd_state * state)
|
||||
fprintf (stderr, "%s",KNRM);
|
||||
fprintf (stderr, "\n");
|
||||
|
||||
}
|
||||
//clear these, regardless of if PDU was deocded, or attempted,
|
||||
//so we don't create phantom voice calls in the event history
|
||||
state->lasttg = 0;
|
||||
state->lastsrc = 0;
|
||||
|
||||
} //end r12
|
||||
else //crc header failure or other
|
||||
{
|
||||
fprintf (stderr, "%s",KNRM);
|
||||
|
||||
@@ -288,6 +288,14 @@ uint8_t p25_decode_es_header(dsd_opts * opts, dsd_state * state, uint8_t * input
|
||||
*sap = aux_sap;
|
||||
*ptr += 13;
|
||||
|
||||
//append enc at this point
|
||||
if (encrypted)
|
||||
{
|
||||
char ess_str[200]; memset(ess_str, 0, sizeof(ess_str));
|
||||
sprintf (ess_str, "ALG: %02X; KID: %04X; SAP:%02X;%s", alg_id, key_id, aux_sap, aux_sap_string);
|
||||
strcat (state->dmr_lrrp_gps[0], ess_str);
|
||||
}
|
||||
|
||||
return encrypted;
|
||||
|
||||
}
|
||||
@@ -342,7 +350,10 @@ void p25_decode_extended_address(dsd_opts * opts, dsd_state * state, uint8_t * i
|
||||
UNUSED(ea_sap_string);
|
||||
|
||||
//Print to Data Call String for Ncurses Terminal
|
||||
sprintf (state->dmr_lrrp_gps[0], "Data Call:%s SAP:%02X; LLID: %d; ", ea_sap_string, ea_sap, ea_llid);
|
||||
state->lastsrc = ea_llid;
|
||||
char ea_str[200]; memset(ea_str, 0, sizeof(ea_str));
|
||||
sprintf (ea_str, "EXT ADD SRC: %d; SAP:%02X;%s", ea_llid, ea_sap, ea_sap_string);
|
||||
strcat (state->dmr_lrrp_gps[0], ea_str);
|
||||
|
||||
*sap = ea_sap;
|
||||
*ptr += 12;
|
||||
@@ -389,6 +400,20 @@ void p25_decode_pdu_header(dsd_opts * opts, dsd_state * state, uint8_t * input)
|
||||
//Print to Data Call String for Ncurses Terminal
|
||||
if (sap != 61 && sap != 63 && fmt != 3)
|
||||
sprintf (state->dmr_lrrp_gps[0], "Data Call:%s SAP:%02X; LLID: %d; ", sap_string, sap, address);
|
||||
else if (sap != 61 && sap != 63 && fmt == 3)
|
||||
{
|
||||
//watchdog the data call and make it push to event history
|
||||
sprintf (state->dmr_lrrp_gps[0], "Data Call Response:%s LLID: %d; ", rsp_string, address);
|
||||
state->lastsrc = 0xFFFFFF;
|
||||
watchdog_event_datacall (opts, state, state->lastsrc, state->lasttg, state->dmr_lrrp_gps[0], 0);
|
||||
state->lastsrc = 0;
|
||||
state->lasttg = 0;
|
||||
watchdog_event_history(opts, state, 0);
|
||||
watchdog_event_current(opts, state, 0);
|
||||
}
|
||||
|
||||
state->lasttg = address;
|
||||
state->lastsrc = 0xFFFFFF; //none given, unless extended, so put any here for now
|
||||
}
|
||||
|
||||
//user or other data delivered via PDU format
|
||||
@@ -442,4 +467,11 @@ void p25_decode_pdu_data(dsd_opts * opts, dsd_state * state, uint8_t * input, in
|
||||
fprintf (stderr, " Encrypted PDU;");
|
||||
}
|
||||
|
||||
//watchdog the data call and make it push to event history
|
||||
watchdog_event_datacall (opts, state, state->lastsrc, state->lasttg, state->dmr_lrrp_gps[0], 0);
|
||||
state->lastsrc = 0;
|
||||
state->lasttg = 0;
|
||||
watchdog_event_history(opts, state, 0);
|
||||
watchdog_event_current(opts, state, 0);
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user