This is merely a historical archive of years 2008-2021, before the migration to mailman3.
A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.
Vadim Yanitskiy gerrit-no-reply at lists.osmocom.orgVadim Yanitskiy has uploaded this change for review. ( https://gerrit.osmocom.org/13484
Change subject: msc/gsm_data.h: fix and clarify GSM 03.40 TP-UD Length
......................................................................
msc/gsm_data.h: fix and clarify GSM 03.40 TP-UD Length
As per 3GPP TS 03.40, section 9.2.3.16 "TP-User-Data-Length (TP-UDL)",
if the TP-User-Data is coded using the GSM 7-bit default alphabet,
the TP-User-Data-Length field indicates the *number of septets*
within the TP-User-Data field to follow. Otherwise, e.g. in case
of 8-bit or UCS-2 encoded data, the *number of octets* is indicated.
It's a good question from where does this value come from:
#define SMS_TEXT_SIZE 256
Let's replace it with two new definitions:
#define GSM340_UDL_OCT_MAX 140
#define GSM340_UDL_SPT_MAX 160
which correspond to the maximum TP-UD field length indicated
in octets and septets respectively.
Change-Id: I2a49f9d24cd075234190b3b92999256bce01ca77
---
M include/osmocom/msc/gsm_data.h
1 file changed, 14 insertions(+), 4 deletions(-)
git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/84/13484/1
diff --git a/include/osmocom/msc/gsm_data.h b/include/osmocom/msc/gsm_data.h
index 1a0d144..77f76b7 100644
--- a/include/osmocom/msc/gsm_data.h
+++ b/include/osmocom/msc/gsm_data.h
@@ -239,7 +239,9 @@
SMS_SOURCE_SMPP, /* received via SMPP */
};
-#define SMS_TEXT_SIZE 256
+/* TODO: Move these defines to libosmogsm (gsm/protocol/gsm_03_40.h) */
+#define GSM340_UDL_OCT_MAX 140 /*!< Maximum TP-UD length (in octets) for 7-bit encoding */
+#define GSM340_UDL_SPT_MAX 160 /*!< Maximum TP-UD length (in seplets) for 8-bit and UCS-2 encoding */
struct gsm_sms_addr {
uint8_t ton;
@@ -274,10 +276,18 @@
uint8_t protocol_id;
uint8_t data_coding_scheme;
uint8_t msg_ref;
- uint8_t user_data_len;
- uint8_t user_data[SMS_TEXT_SIZE];
- char text[SMS_TEXT_SIZE];
+ /* Depending on DCS value in use, TP-UDL may indicate the length of
+ * TP-UD either in septets, or in octets. See 3GPP TS 03.40,
+ * section 9.2.3.16 "TP-User-Data-Length (TP-UDL)" for details. */
+ uint8_t user_data_len;
+ /* Since we always store TP-UD in octets, even if it does contain
+ * data encoded in septets (i.e. 7-bit default encoding), this
+ * buffer is limited to 140 bytes. */
+ uint8_t user_data[GSM340_UDL_OCT_MAX];
+
+ /* Up to 160 symbols decoded from TP-UD + '\0' */
+ char text[GSM340_UDL_SPT_MAX + 1];
};
/* control interface handling */
--
To view, visit https://gerrit.osmocom.org/13484
To unsubscribe, or for help writing mail filters, visit https://gerrit.osmocom.org/settings
Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-MessageType: newchange
Gerrit-Change-Id: I2a49f9d24cd075234190b3b92999256bce01ca77
Gerrit-Change-Number: 13484
Gerrit-PatchSet: 1
Gerrit-Owner: Vadim Yanitskiy <axilirator at gmail.com>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osmocom.org/pipermail/gerrit-log/attachments/20190402/1ce40045/attachment.htm>