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