summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/osmocom/gsm/protocol/gsm_08_08.h29
-rw-r--r--src/gsm/gsm0808.c6
-rw-r--r--src/gsm/libosmogsm.map2
3 files changed, 36 insertions, 1 deletions
diff --git a/include/osmocom/gsm/protocol/gsm_08_08.h b/include/osmocom/gsm/protocol/gsm_08_08.h
index a5406095..e791b070 100644
--- a/include/osmocom/gsm/protocol/gsm_08_08.h
+++ b/include/osmocom/gsm/protocol/gsm_08_08.h
@@ -7,6 +7,7 @@
#include <stdint.h>
#include <osmocom/core/linuxlist.h>
#include <osmocom/core/utils.h>
+#include <osmocom/core/endian.h>
/*
* this is from GSM 03.03 CGI but is copied in GSM 08.08
@@ -40,11 +41,37 @@ struct bssmap_header {
} __attribute__((packed));
struct dtap_header {
+#if OSMO_IS_LITTLE_ENDIAN
uint8_t type;
- uint8_t link_id;
+ union {
+ uint8_t link_id; /* Backward compatibility */
+ struct {
+ uint8_t dlci_cc:2,
+ dlci_spare:3,
+ dlci_sapi:3; /* enum gsm0406_dlc_sapi */
+ };
+ };
uint8_t length;
+#elif OSMO_IS_BIG_ENDIAN
+ uint8_t type;
+ union {
+ uint8_t link_id;
+ struct {
+ uint8_t dlci_sapi:3, dlci_spare:3, dlci_cc:2;
+ };
+ };
+ uint8_t length;
+#endif
} __attribute__((packed));
+/* Data Link Control SAPI, GSM 08.06 § 6.3.2, GSM 04.06 § 3.3.3 */
+enum gsm0406_dlci_sapi {
+ DLCI_SAPI_RR_MM_CC = 0x0,
+ DLCI_SAPI_SMS = 0x3,
+};
+extern const struct value_string gsm0406_dlci_sapi_names[];
+static inline const char *gsm0406_dlci_sapi_name(enum gsm0406_dlci_sapi val)
+{ return get_value_string(gsm0406_dlci_sapi_names, val); }
enum BSS_MAP_MSG_TYPE {
BSS_MAP_MSG_RESERVED_0 = 0,
diff --git a/src/gsm/gsm0808.c b/src/gsm/gsm0808.c
index 514d7f22..f9f7b582 100644
--- a/src/gsm/gsm0808.c
+++ b/src/gsm/gsm0808.c
@@ -1399,6 +1399,12 @@ const struct tlv_definition *gsm0808_att_tlvdef(void)
return &bss_att_tlvdef;
}
+const struct value_string gsm0406_dlci_sapi_names[] = {
+ { DLCI_SAPI_RR_MM_CC, "RR/MM/CC" },
+ { DLCI_SAPI_SMS, "SMS" },
+ { 0, NULL }
+};
+
static const struct value_string gsm0808_msgt_names[] = {
{ BSS_MAP_MSG_ASSIGMENT_RQST, "ASSIGNMENT REQ" },
{ BSS_MAP_MSG_ASSIGMENT_COMPLETE, "ASSIGNMENT COMPL" },
diff --git a/src/gsm/libosmogsm.map b/src/gsm/libosmogsm.map
index a0e3b324..efca0a5f 100644
--- a/src/gsm/libosmogsm.map
+++ b/src/gsm/libosmogsm.map
@@ -86,6 +86,8 @@ gprs_service_t_strs;
gsm0341_build_msg;
+gsm0406_dlci_sapi_names;
+
gsm0480_create_notifySS;
gsm0480_create_unstructuredSS_Notify;
gsm0480_create_ussd_resp;