summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBrandon Bayer <bbayer@multitech.com>2016-02-05 16:09:26 -0600
committerBrandon Bayer <bbayer@multitech.com>2016-02-08 16:46:46 -0600
commit568c7e7196537397c99eb1547f61788b4d95b0f7 (patch)
treeb86266c6559235e7bb8c4d91b2174ce7060eec7a
parentc75545e97a0d29de082b9ae7a65ec152416753b6 (diff)
downloadsms-utils-0.0.14.tar.gz
sms-utils-0.0.14.tar.bz2
sms-utils-0.0.14.zip
refactor: encoding/decoding alphabet logging0.0.14
-rw-r--r--configure.in2
-rw-r--r--src/pdu_decode.c34
-rw-r--r--src/pdu_encode.c6
3 files changed, 21 insertions, 21 deletions
diff --git a/configure.in b/configure.in
index c804b06..993eb32 100644
--- a/configure.in
+++ b/configure.in
@@ -1,5 +1,5 @@
AC_INIT([src/sms_main.c])
-AM_INIT_AUTOMAKE([sms-utils], [0.0.13])
+AM_INIT_AUTOMAKE([sms-utils], [0.0.14])
AM_CONFIG_HEADER([config.h])
AC_PROG_CC
diff --git a/src/pdu_decode.c b/src/pdu_decode.c
index ae235e0..d7def28 100644
--- a/src/pdu_decode.c
+++ b/src/pdu_decode.c
@@ -194,19 +194,27 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe
}
+ if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) {
+ log_debug("data coding alphabet is default (7-bit)");
+ } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI) {
+ log_debug("data coding alphabet is default (7-bit) multi-part");
+ } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_DEFAULT) {
+ log_debug("data coding alphabet is CDMA default (7-bit)");
+ } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_EIGHT) {
+ log_debug("data coding alphabet is eight");
+ } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_EIGHT) {
+ log_debug("data coding alphabet is CDMA eight");
+ } else {
+ log_debug("data coding alphabet 0x%02X not implemented",
+ pdu->data_coding.general.alphabet);
+ return -1;
+ }
+
// -----------------------------------------------------------------------------
// VERIFY DATA LENGTH AND GET NUMBER OF OCTETS (ACTUAL DATA BYTES IN PDU STRING)
// -----------------------------------------------------------------------------
if ((pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) ||
(pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI)) {
- if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT_MULTI) {
- //GSM style 7-bit encoding but with UDH multi-part header (LE910-SVG)
- log_debug("data coding alphabet is nine");
- } else {
- //GSM 7-bit encoding
- log_debug("data coding alphabet is default");
- }
-
if (pdu->user_data_len > PDU_UD_7BIT_MAX) {
log_warning("pdu contains invalid user-data-len: 0x%02X",
pdu->user_data_len);
@@ -219,8 +227,6 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe
// CDMA 7-BIT ENCODING
} else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_DEFAULT) {
- log_debug("data coding alphabet is cdma default");
-
// LE910-SVG stores data length as # of septets
if (!strcmp(Global.core.model, "LE910-SVG")) {
*nr_octets = octets_from_septets(pdu->user_data_len);
@@ -239,8 +245,6 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe
// GSM & CDMA 8-BIT ENCODING
} else if ((pdu->data_coding.general.alphabet == PDU_ALPHABET_EIGHT) ||
(pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_EIGHT)) {
- log_debug("data coding alphabet is eight");
-
if (pdu->user_data_len > PDU_UD_8BIT_MAX) {
log_warning("pdu contains invalid user-data-len: 0x%02X",
pdu->user_data_len);
@@ -250,12 +254,6 @@ int pdu_decode_user_data(const char *pdu_str, struct pdu_info *pdu, int *nr_octe
//Original data is octets (all 8 bits could contain data)
//Therefore, octets = user_data_len
*nr_octets = pdu->user_data_len;
-
- // UNSUPPORTED
- } else {
- log_debug("data coding alphabet 0x%02X not implemented",
- pdu->data_coding.general.alphabet);
- return -1;
}
STRLEN_CHECK(pdu_str, *nr_octets * 2, -1);
diff --git a/src/pdu_encode.c b/src/pdu_encode.c
index db8c475..65d2316 100644
--- a/src/pdu_encode.c
+++ b/src/pdu_encode.c
@@ -172,10 +172,12 @@ int pdu_encode_user_data(char *pdu_str, size_t len, struct pdu_info *pdu, int *n
if (pdu->data_coding.general.alphabet == PDU_ALPHABET_DEFAULT) {
log_debug("data coding alphabet is default (7-bit)");
- } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_EIGHT) {
- log_debug("data coding alphabet is eight");
} else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_DEFAULT) {
log_debug("data coding alphabet is CDMA default (7-bit)");
+ } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_EIGHT) {
+ log_debug("data coding alphabet is eight");
+ } else if (pdu->data_coding.general.alphabet == PDU_ALPHABET_CDMA_EIGHT) {
+ log_debug("data coding alphabet is CDMA eight");
} else {
log_debug("data coding alphabet 0x%02X not implemented",
pdu->data_coding.general.alphabet);