Harald Welte | 55d724a | 2017-10-16 18:25:45 +0200 | [diff] [blame] | 1 | /*! \addtogroup sms |
| 2 | * @{ |
| 3 | * \file gsm0411_utils.h */ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 4 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 5 | #pragma once |
Andreas.Eversberg | d84f47a | 2011-11-06 20:22:12 +0100 | [diff] [blame] | 6 | |
Holger Hans Peter Freyther | 6145a25 | 2013-09-04 12:12:58 +0200 | [diff] [blame] | 7 | #include <time.h> |
| 8 | |
Harald Welte | ad633b0 | 2011-12-01 21:08:19 +0100 | [diff] [blame] | 9 | /* Turn int into semi-octet representation: 98 => 0x89 */ |
| 10 | uint8_t gsm411_bcdify(uint8_t value); |
| 11 | |
| 12 | /* Turn semi-octet representation into int: 0x89 => 98 */ |
| 13 | uint8_t gsm411_unbcdify(uint8_t value); |
| 14 | |
Andreas.Eversberg | d84f47a | 2011-11-06 20:22:12 +0100 | [diff] [blame] | 15 | struct msgb *gsm411_msgb_alloc(void); |
| 16 | |
| 17 | /* Generate 03.40 TP-SCTS */ |
| 18 | void gsm340_gen_scts(uint8_t *scts, time_t time); |
| 19 | |
| 20 | /* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */ |
| 21 | time_t gsm340_scts(uint8_t *scts); |
| 22 | |
| 23 | /* decode validity period. return minutes */ |
| 24 | unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp); |
| 25 | |
| 26 | /* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */ |
| 27 | enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs); |
| 28 | |
| 29 | /* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */ |
| 30 | int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type, |
| 31 | uint8_t plan, const char *number); |
| 32 | |
| 33 | /* Prefix msg with a RP header */ |
| 34 | int gsm411_push_rp_header(struct msgb *msg, uint8_t rp_msg_type, |
| 35 | uint8_t rp_msg_ref); |
| 36 | |
| 37 | /* Prefix msg with a 04.08/04.11 CP header */ |
| 38 | int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans, |
| 39 | uint8_t msg_type); |
Harald Welte | 55d724a | 2017-10-16 18:25:45 +0200 | [diff] [blame] | 40 | |
| 41 | /*! @} */ |