summaryrefslogtreecommitdiff
path: root/src/pdu.h
diff options
context:
space:
mode:
Diffstat (limited to 'src/pdu.h')
-rw-r--r--src/pdu.h21
1 files changed, 13 insertions, 8 deletions
diff --git a/src/pdu.h b/src/pdu.h
index 0143f1f..35c43a6 100644
--- a/src/pdu.h
+++ b/src/pdu.h
@@ -49,12 +49,13 @@ enum {
PDU_VPF_ABSOUTE = 3,
};
+//PDU data formats (how the data was represented before encoding)
enum {
- PDU_ALPHABET_DEFAULT = 0, //7-bit
- PDU_ALPHABET_CDMA_DEFAULT = 2, //7-bit
- PDU_ALPHABET_EIGHT = 4,
- PDU_ALPHABET_CDMA_EIGHT = 8,
- PDU_ALPHABET_DEFAULT_MULTI = 9,
+ PDU_ALPHABET_DEFAULT = 0, //GSM 7-bit, (supposedly CDMA 8-bit but haven't seen it)
+ PDU_ALPHABET_CDMA_DEFAULT = 2, //no GSM, CDMA 7-bit
+ PDU_ALPHABET_EIGHT = 4, //GSM 8-bit, CDMA 16-bit unicode
+ PDU_ALPHABET_CDMA_EIGHT = 8, //GSM 16-bit, CDMA 8-bit (what CDMA radios are actually using)
+ PDU_ALPHABET_DEFAULT_MULTI = 9,//no GSM, LVW2 7-bit, multi-part
};
struct pdu_info {
@@ -117,10 +118,14 @@ int pdu_user_data_read(int fd, struct pdu_info *pdu);
#define cycleup(n, mod) ((n) % (mod))
#define cycledown(n, mod) ((mod - 1) - ((n) % (mod)))
-#define octet_align(n) ((((n) * 7) + ((-(n) * 7) & 7)) / 8)
+//Returns the number of octets the given septets (normal ascii) can be encoded to
+#define octets_from_septets(n) ((((n) * 7) + ((-(n) * 7) & 7)) / 8)
-#define septet_idx(n) ((n) * 8 / 7)
-#define octet_align_cdma(n) septet_idx(n)
+//Returns the number of septets the given octets will decode to
+#define septets_from_octets(n) ((n) * 8 / 7)
+
+#define octet_idx(n) octets_from_septets(n)
+#define septet_idx(n) septets_from_octets(n)
#define STRLEN_CHECK(str, len, ret) \