sms-part-3gpp: add flag for indicating PDU is transfer-route message

When the message is a transfer-route MT, there is no SMSC address to
parse out. This flag allows indicating when the PDU is one such message.
This commit is contained in:
Clayton Craft
2021-04-16 20:42:15 -07:00
parent 205e9edf3e
commit 43c39d5226
4 changed files with 30 additions and 19 deletions

View File

@@ -5470,6 +5470,7 @@ add_sms_part (MMBroadbandModemMbim *self,
pdu->pdu_data,
pdu->pdu_data_size,
self,
FALSE,
&error);
if (part) {
mm_obj_dbg (self, "correctly parsed PDU (%d)", pdu->message_index);

View File

@@ -5796,6 +5796,7 @@ add_new_read_sms_part (MMIfaceModemMessaging *self,
guint32 index,
QmiWmsMessageTagType tag,
QmiWmsMessageFormat format,
gboolean transfer_route,
GArray *data)
{
MMSmsPart *part = NULL;
@@ -5816,6 +5817,7 @@ add_new_read_sms_part (MMIfaceModemMessaging *self,
(guint8 *)data->data,
data->len,
self,
transfer_route,
&error);
break;
case QMI_WMS_MESSAGE_FORMAT_MWI:
@@ -5882,6 +5884,7 @@ wms_raw_read_ready (QmiClientWms *client,
message->memory_index,
tag,
format,
FALSE,
data);
}
@@ -6232,6 +6235,7 @@ wms_indication_raw_read_ready (QmiClientWms *client,
ctx->memory_index,
tag,
format,
FALSE,
data);
}
@@ -6319,6 +6323,7 @@ messaging_event_report_indication_cb (QmiClientNas *client,
memory_index,
tag,
msg_format,
TRUE,
raw_data);
return;
}

View File

@@ -355,7 +355,7 @@ mm_sms_part_3gpp_new_from_pdu (guint index,
return NULL;
}
return mm_sms_part_3gpp_new_from_binary_pdu (index, pdu, pdu_len, log_object, error);
return mm_sms_part_3gpp_new_from_binary_pdu (index, pdu, pdu_len, log_object, FALSE, error);
}
MMSmsPart *
@@ -363,6 +363,7 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
const guint8 *pdu,
gsize pdu_len,
gpointer log_object,
gboolean transfer_route,
GError **error)
{
MMSmsPart *sms_part;
@@ -404,25 +405,28 @@ mm_sms_part_3gpp_new_from_binary_pdu (guint index,
offset = 0;
/* ---------------------------------------------------------------------- */
/* SMSC, in address format, precedes the TPDU
* First byte represents the number of BYTES for the address value */
PDU_SIZE_CHECK (1, "cannot read SMSC address length");
smsc_addr_size_bytes = pdu[offset++];
if (smsc_addr_size_bytes > 0) {
PDU_SIZE_CHECK (offset + smsc_addr_size_bytes, "cannot read SMSC address");
/* SMSC may not be given in DELIVER PDUs */
address = sms_decode_address (&pdu[1], 2 * (smsc_addr_size_bytes - 1), error);
if (!address) {
g_prefix_error (error, "Couldn't read SMSC address: ");
mm_sms_part_free (sms_part);
return NULL;
}
mm_sms_part_take_smsc (sms_part, g_steal_pointer (&address));
mm_obj_dbg (log_object, " SMSC address parsed: '%s'", mm_sms_part_get_smsc (sms_part));
offset += smsc_addr_size_bytes;
if (!transfer_route) {
/* ---------------------------------------------------------------------- */
/* SMSC, in address format, precedes the TPDU
* First byte represents the number of BYTES for the address value */
PDU_SIZE_CHECK (1, "cannot read SMSC address length");
smsc_addr_size_bytes = pdu[offset++];
if (smsc_addr_size_bytes > 0) {
PDU_SIZE_CHECK (offset + smsc_addr_size_bytes, "cannot read SMSC address");
/* SMSC may not be given in DELIVER PDUs */
address = sms_decode_address (&pdu[1], 2 * (smsc_addr_size_bytes - 1), error);
if (!address) {
g_prefix_error (error, "Couldn't read SMSC address: ");
mm_sms_part_free (sms_part);
return NULL;
}
mm_sms_part_take_smsc (sms_part, g_steal_pointer (&address));
mm_obj_dbg (log_object, " SMSC address parsed: '%s'", mm_sms_part_get_smsc (sms_part));
offset += smsc_addr_size_bytes;
} else
mm_obj_dbg (log_object, " no SMSC address given");
} else
mm_obj_dbg (log_object, " no SMSC address given");
mm_obj_dbg (log_object, " This is a transfer-route message");
/* ---------------------------------------------------------------------- */

View File

@@ -30,6 +30,7 @@ MMSmsPart *mm_sms_part_3gpp_new_from_binary_pdu (guint index,
const guint8 *pdu,
gsize pdu_len,
gpointer log_object,
gboolean transfer_route,
GError **error);
guint8 *mm_sms_part_3gpp_get_submit_pdu (MMSmsPart *part,
guint *out_pdulen,