aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm/gsm_utils.h
diff options
context:
space:
mode:
authorAndreas Eversberg <jolly@eversberg.eu>2013-07-07 14:26:32 +0200
committerAndreas Eversberg <jolly@eversberg.eu>2013-07-13 09:15:49 +0200
commitb91cfa4cf9cb7af626abffd8cbd52c80b8eda2cc (patch)
tree13f53200522a08d085ffc900e04dd0f2f12301a3 /include/osmocom/gsm/gsm_utils.h
parentc7223231b5398a00496d01609ff92875bf6a7b1b (diff)
Add special 7-bit encoding and decoding functions for USSD codingjolly/7bit_ussd
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 <CR> character shall be used for padding in this situation [...]. If <CR> is intended to be the last character and the message (including the wanted <CR>) ends on an octet boundary, then another <CR> 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 <CR> [...] is identical to the definition of <CR><CR>. The receiving entity shall remove the final <CR> character where the message ends on an octet boundary with <CR> as the last character.
Diffstat (limited to 'include/osmocom/gsm/gsm_utils.h')
-rw-r--r--include/osmocom/gsm/gsm_utils.h2
1 files changed, 2 insertions, 0 deletions
diff --git a/include/osmocom/gsm/gsm_utils.h b/include/osmocom/gsm/gsm_utils.h
index b736de9c..db9b3b28 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);
int gsm_septets2octets(uint8_t *result, const uint8_t *rdata, uint8_t septet_len, uint8_t padding);