When decoding a third party traffic packet, decode the payload.

This commit is contained in:
wb2osz 2020-11-13 20:46:57 -05:00
parent e272ff87c8
commit 48b9bac872
2 changed files with 25 additions and 31 deletions

View File

@ -116,7 +116,6 @@ static void aprs_morse_code (decode_aprs_t *A, char *, int);
static void aprs_positionless_weather_report (decode_aprs_t *A, unsigned char *, int); static void aprs_positionless_weather_report (decode_aprs_t *A, unsigned char *, int);
static void weather_data (decode_aprs_t *A, char *wdata, int wind_prefix); static void weather_data (decode_aprs_t *A, char *wdata, int wind_prefix);
static void aprs_ultimeter (decode_aprs_t *A, char *, int); static void aprs_ultimeter (decode_aprs_t *A, char *, int);
static void third_party_header (decode_aprs_t *A, char *, int);
static void decode_position (decode_aprs_t *A, position_t *ppos); static void decode_position (decode_aprs_t *A, position_t *ppos);
static void decode_compressed_position (decode_aprs_t *A, compressed_position_t *ppos); static void decode_compressed_position (decode_aprs_t *A, compressed_position_t *ppos);
static double get_latitude_8 (char *p, int quiet); static double get_latitude_8 (char *p, int quiet);
@ -197,7 +196,22 @@ void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet)
A->g_footprint_lon = G_UNKNOWN; A->g_footprint_lon = G_UNKNOWN;
A->g_footprint_radius = G_UNKNOWN; A->g_footprint_radius = G_UNKNOWN;
// If third-party header, try to decode just the payload.
if (*pinfo == '}') {
packet_t pp_payload = ax25_from_text ((char*)pinfo+1, 0);
if (pp_payload != NULL) {
decode_aprs (A, pp_payload, quiet);
ax25_delete (pp_payload);
return;
}
else {
strlcpy (A->g_msg_type, "Third Party Header: Unable to parse payload.", sizeof(A->g_msg_type));
ax25_get_addr_with_ssid (pp, AX25_SOURCE, A->g_src);
ax25_get_addr_with_ssid (pp, AX25_DESTINATION, dest);
}
}
/* /*
* Extract source and destination including the SSID. * Extract source and destination including the SSID.
@ -362,11 +376,9 @@ void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet)
aprs_morse_code (A, (char*)pinfo, info_len); aprs_morse_code (A, (char*)pinfo, info_len);
break; break;
case '}': /* third party header */ //case '}': /* third party header */
third_party_header (A, (char*)pinfo, info_len);
break;
// was already caught earlier.
//case '\r': /* CR or LF? */ //case '\r': /* CR or LF? */
//case '\n': //case '\n':
@ -380,7 +392,12 @@ void decode_aprs (decode_aprs_t *A, packet_t pp, int quiet)
/* /*
* Look in other locations if not found in information field. * Priority order for determining the symbol is:
* - Information part, where appropriate. Already done above.
* - Destination field starting with GPS, SPC, or SYM.
* - Source SSID - Confusing to most people. Even I forgot about it when
* someone questioned where the symbol came from. It's in the APRS
* protocol spec, end of Chapter 20.
*/ */
if (A->g_symbol_table == ' ' || A->g_symbol_code == ' ') { if (A->g_symbol_table == ' ' || A->g_symbol_code == ' ') {
@ -2934,31 +2951,6 @@ static void aprs_ultimeter (decode_aprs_t *A, char *info, int ilen)
} /* end aprs_ultimeter */ } /* end aprs_ultimeter */
/*------------------------------------------------------------------
*
* Function: third_party_header
*
* Purpose: Decode packet from a third party network.
*
* Inputs: info - Pointer to Information field.
* ilen - Information field length.
*
* Outputs: A->g_comment
*
* Description:
*
*------------------------------------------------------------------*/
static void third_party_header (decode_aprs_t *A, char *info, int ilen)
{
strlcpy (A->g_msg_type, "Third Party Header", sizeof(A->g_msg_type));
/* more later? */
} /* end third_party_header */
/*------------------------------------------------------------------ /*------------------------------------------------------------------
* *

View File

@ -659,6 +659,8 @@ void symbols_from_dest_or_src (char dti, char *src, char *dest, char *symtab, ch
/* /*
* When all else fails, use source SSID. * When all else fails, use source SSID.
* This is totally non-obvious and confusing, but it is in the APRS protocol spec.
* Chapter 20, "Symbol in the Source Address SSID"
*/ */
p = strchr (src, '-'); p = strchr (src, '-');