libosmogsm  0.9.3
Osmocom GSM library
include/osmocom/gsm/gsm0411_utils.h
00001 #pragma once
00002 
00003 #include <time.h>
00004 
00005 /* Turn int into semi-octet representation: 98 => 0x89 */
00006 uint8_t gsm411_bcdify(uint8_t value);
00007 
00008 /* Turn semi-octet representation into int: 0x89 => 98 */
00009 uint8_t gsm411_unbcdify(uint8_t value);
00010 
00011 struct msgb *gsm411_msgb_alloc(void);
00012 
00013 /* Generate 03.40 TP-SCTS */
00014 void gsm340_gen_scts(uint8_t *scts, time_t time);
00015 
00016 /* Decode 03.40 TP-SCTS (into utc/gmt timestamp) */
00017 time_t gsm340_scts(uint8_t *scts);
00018 
00019 /* decode validity period. return minutes */
00020 unsigned long gsm340_validity_period(uint8_t sms_vpf, uint8_t *sms_vp);
00021 
00022 /* determine coding alphabet dependent on GSM 03.38 Section 4 DCS */
00023 enum sms_alphabet gsm338_get_sms_alphabet(uint8_t dcs);
00024 
00025 /* generate a TPDU address field compliant with 03.40 sec. 9.1.2.5 */
00026 int gsm340_gen_oa(uint8_t *oa, unsigned int oa_len, uint8_t type,
00027         uint8_t plan, const char *number);
00028 
00029 /* Prefix msg with a RP header */
00030 int gsm411_push_rp_header(struct msgb *msg, uint8_t rp_msg_type,
00031         uint8_t rp_msg_ref);
00032 
00033 /* Prefix msg with a 04.08/04.11 CP header */
00034 int gsm411_push_cp_header(struct msgb *msg, uint8_t proto, uint8_t trans,
00035                              uint8_t msg_type);