blob: ad368e67faab59610b37b2c1752e214d49b3b87b [file] [log] [blame]
Andreas.Eversbergd84f47a2011-11-06 20:22:12 +01001#ifndef _GSM0411_UTILS_H
2#define _GSM0411_UTILS_H
3
Holger Hans Peter Freyther6145a252013-09-04 12:12:58 +02004#include <time.h>
5
Harald Weltead633b02011-12-01 21:08:19 +01006/* Turn int into semi-octet representation: 98 => 0x89 */
7uint8_t gsm411_bcdify(uint8_t value);
8
9/* Turn semi-octet representation into int: 0x89 => 98 */
10uint8_t gsm411_unbcdify(uint8_t value);
11
Andreas.Eversbergd84f47a2011-11-06 20:22:12 +010012struct msgb *gsm411_msgb_alloc(void);
13
14/* Generate 03.40 TP-SCTS */
15void gsm340_gen_scts(uint8_t *scts, time_t time);
16
17/* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */
18time_t gsm340_scts(uint8_t *scts);
19
20/* decode validity period. return minutes */
21unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp);
22
23/* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */
24enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs);
25
26/* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */
27int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type,
28 uint8_t plan, const char *number);
29
30/* Prefix msg with a RP header */
31int gsm411_push_rp_header(struct msgb *msg, uint8_t rp_msg_type,
32 uint8_t rp_msg_ref);
33
34/* Prefix msg with a 04.08/04.11 CP header */
35int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans,
36 uint8_t msg_type);
37
38#endif /* _GSM0411_UTILS_H */