From 9597555a362cd28c02e9bbfe4f55c4b90ecdfa34 Mon Sep 17 00:00:00 2001 From: Andreas Eversberg Date: Thu, 8 Aug 2013 12:38:53 +0200 Subject: Add special 7-bit encoding and decoding functions for USSD coding Handling 7-bit coding is a little different for USSD, as TS 03.38 states: To avoid the situation where the receiving entity confuses 7 binary zero pad bits as the @ character, the carriage return or character shall be used for padding in this situation [...]. If is intended to be the last character and the message (including the wanted ) ends on an octet boundary, then another must be added together with a padding bit 0. The receiving entity will perform the carriage return function twice, but this will not result in misoperation as the definition of [...] is identical to the definition of . The receiving entity shall remove the final character where the message ends on an octet boundary with as the last character. Jacob has verified the fix with fakeBTS and the wireshark dissector. Fixes: OW#947 Reviewed-by: Jacob Erlbeck --- include/osmocom/gsm/gsm_utils.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'include') diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h index a572f504..6cd46e45 100644 --- a/include/osmocom/gsm/gsm_utils.h +++ b/include/osmocom/gsm/gsm_utils.h @@ -57,8 +57,10 @@ const char *gsm_band_name(enum gsm_band band); enum gsm_band gsm_band_parse(const char *mhz); int gsm_7bit_decode(char *decoded, const uint8_t *user_data, uint8_t length); +int gsm_7bit_decode_ussd(char *decoded, const uint8_t *user_data, uint8_t length); int gsm_7bit_decode_hdr(char *decoded, const uint8_t *user_data, uint8_t length, uint8_t ud_hdr_ind); int gsm_7bit_encode(uint8_t *result, const char *data); +int gsm_7bit_encode_ussd(uint8_t *result, const char *data, int *octets_written); int gsm_7bit_encode_oct(uint8_t *result, const char *data, int *octets_written); /* the three functions below are helper functions and here for the unit test */ -- cgit v1.2.3