libosmogsm  0.6.3
Osmocom GSM library
gsm0411_utils.h
1 #ifndef _GSM0411_UTILS_H
2 #define _GSM0411_UTILS_H
3 
4 /* Turn int into semi-octet representation: 98 => 0x89 */
5 uint8_t gsm411_bcdify(uint8_t value);
6 
7 /* Turn semi-octet representation into int: 0x89 => 98 */
8 uint8_t gsm411_unbcdify(uint8_t value);
9 
10 struct msgb *gsm411_msgb_alloc(void);
11 
12 /* Generate 03.40 TP-SCTS */
13 void gsm340_gen_scts(uint8_t *scts, time_t time);
14 
15 /* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */
16 time_t gsm340_scts(uint8_t *scts);
17 
18 /* decode validity period. return minutes */
19 unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp);
20 
21 /* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */
22 enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs);
23 
24 /* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */
25 int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type,
26  uint8_t plan, const char *number);
27 
28 /* Prefix msg with a RP header */
29 int gsm411_push_rp_header(struct msgb *msg, uint8_t rp_msg_type,
30  uint8_t rp_msg_ref);
31 
32 /* Prefix msg with a 04.08/04.11 CP header */
33 int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans,
34  uint8_t msg_type);
35 
36 #endif /* _GSM0411_UTILS_H */