libosmogsm
0.9.6.315-40e62
Osmocom GSM library
|
Point-to-Point (PP) Short Message Service (SMS) as per TS 04.11. More...
Data Structures | |
struct | smcdownstate |
struct | smcdatastate |
struct | smrdownstate |
struct | smrdatastate |
Macros | |
#define | MAX_SMS_RETRY 2 |
#define | SMC_LOG_STR "SMC(%" PRIu64 ") " |
#define | SMCDOWNSLLEN (sizeof(smcdownstatelist) / sizeof(struct smcdownstate)) |
#define | SMCDATASLLEN (sizeof(smcdatastatelist) / sizeof(struct smcdatastate)) |
#define | SMRDOWNSLLEN (sizeof(smrdownstatelist) / sizeof(struct smrdownstate)) |
#define | SMRDATASLLEN (sizeof(smrdatastatelist) / sizeof(struct smrdatastate)) |
#define | GSM411_ALLOC_SIZE 1024 |
#define | GSM411_ALLOC_HEADROOM 128 |
Functions | |
struct gsm341_ms_message * | gsm0341_build_msg (void *ctx, uint8_t geo_scope, uint8_t msg_code, uint8_t update, uint16_t msg_id, uint8_t dcs, uint8_t page_total, uint8_t page_cur, uint8_t *data, uint8_t len) |
Encode a 3GPP TS 03.41 SMS-CB message. More... | |
static void | cp_timer_expired (void *data) |
void | gsm411_smc_init (struct gsm411_smc_inst *inst, uint64_t id, int network, int(*mn_recv)(struct gsm411_smc_inst *inst, int msg_type, struct msgb *msg), int(*mm_send)(struct gsm411_smc_inst *inst, int msg_type, struct msgb *msg, int cp_msg_type)) |
void | gsm411_smc_clear (struct gsm411_smc_inst *inst) |
static void | new_cp_state (struct gsm411_smc_inst *inst, enum gsm411_cp_state state) |
static int | gsm411_tx_cp_error (struct gsm411_smc_inst *inst, uint8_t cause) |
static int | gsm411_mnsms_est_req (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mmsms_send_msg (struct gsm411_smc_inst *inst) |
static int | gsm411_mmsms_est_cnf (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mmsms_cp_ack (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mmsms_cp_data (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_data_req (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_rel_req (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mmsms_cp_error (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mmsms_rel_ind (struct gsm411_smc_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_abort_req (struct gsm411_smc_inst *inst, struct msgb *msg) |
int | gsm411_smc_send (struct gsm411_smc_inst *inst, int msg_type, struct msgb *msg) |
int | gsm411_smc_recv (struct gsm411_smc_inst *inst, int msg_type, struct msgb *msg, int cp_msg_type) |
static void | rp_timer_expired (void *data) |
void | gsm411_smr_init (struct gsm411_smr_inst *inst, uint64_t id, int network, int(*rl_recv)(struct gsm411_smr_inst *inst, int msg_type, struct msgb *msg), int(*mn_send)(struct gsm411_smr_inst *inst, int msg_type, struct msgb *msg)) |
void | gsm411_smr_clear (struct gsm411_smr_inst *inst) |
static void | new_rp_state (struct gsm411_smr_inst *inst, enum gsm411_rp_state state) |
static int | gsm411_rp_sendmsg (struct gsm411_smr_inst *inst, struct msgb *msg, uint8_t rp_msg_type, uint8_t rp_msg_ref, int mnsms_msg_type) |
static int | gsm411_send_rp_error (struct gsm411_smr_inst *inst, uint8_t msg_ref, uint8_t cause) |
static int | gsm411_send_release (struct gsm411_smr_inst *inst) |
static int | gsm411_send_abort (struct gsm411_smr_inst *inst) |
static int | gsm411_send_report (struct gsm411_smr_inst *inst) |
static int | gsm411_rl_data_req (struct gsm411_smr_inst *inst, struct msgb *msg) |
static int | gsm411_rl_report_req (struct gsm411_smr_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_est_ind (struct gsm411_smr_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_data_ind_tx (struct gsm411_smr_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_error_ind_tx (struct gsm411_smr_inst *inst, struct msgb *msg) |
static int | gsm411_mnsms_error_ind_rx (struct gsm411_smr_inst *inst, struct msgb *msg) |
int | gsm411_smr_send (struct gsm411_smr_inst *inst, int msg_type, struct msgb *msg) |
int | gsm411_smr_recv (struct gsm411_smr_inst *inst, int msg_type, struct msgb *msg) |
struct msgb * | gsm411_msgb_alloc (void) |
Allocate a message buffer for use as TS 04.11 message. More... | |
uint8_t | gsm411_bcdify (uint8_t value) |
Turn int into semi-octet representation: 98 => 0x89. More... | |
uint8_t | gsm411_unbcdify (uint8_t value) |
Turn semi-octet representation into int: 0x89 => 98. More... | |
void | gsm340_gen_scts (uint8_t *scts, time_t time) |
Generate 03.40 TP-SCTS. More... | |
time_t | gsm340_scts (uint8_t *scts) |
Decode 03.40 TP-SCTS (into utc/gmt timestamp) More... | |
static unsigned long | gsm340_vp_default (void) |
static unsigned long | gsm340_vp_relative (uint8_t *sms_vp) |
static unsigned long | gsm340_vp_absolute (uint8_t *sms_vp) |
static unsigned long | gsm340_vp_relative_integer (uint8_t *sms_vp) |
static unsigned long | gsm340_vp_relative_semioctet (uint8_t *sms_vp) |
unsigned long | gsm340_validity_period (uint8_t sms_vpf, uint8_t *sms_vp) |
decode validity period. More... | |
enum sms_alphabet | gsm338_get_sms_alphabet (uint8_t dcs) |
determine coding alphabet dependent on GSM 03.38 Section 4 DCS More... | |
int | gsm340_gen_oa (uint8_t *oa, unsigned int oa_len, uint8_t type, uint8_t plan, const char *number) |
generate a TPDU address field compliant with 03.40 sec. More... | |
int | gsm411_push_rp_header (struct msgb *msg, uint8_t rp_msg_type, uint8_t rp_msg_ref) |
Prefix msgb with a RP header. More... | |
int | gsm411_push_cp_header (struct msgb *msg, uint8_t proto, uint8_t trans, uint8_t msg_type) |
Prefix msgb with a 04.08/04.11 CP header. More... | |
Variables | |
const char * | smc_state_names [] |
const struct value_string | gsm411_cp_cause_strs [] |
static const struct smcdownstate | smcdownstatelist [] |
static const struct smcdatastate | smcdatastatelist [] |
static const char * | smr_state_names [] |
const struct value_string | gsm411_rp_cause_strs [] |
static const struct smrdownstate | smrdownstatelist [] |
static const struct smrdatastate | smrdatastatelist [] |
Point-to-Point (PP) Short Message Service (SMS) as per TS 04.11.
#define GSM411_ALLOC_HEADROOM 128 |
Referenced by gsm411_msgb_alloc().
#define GSM411_ALLOC_SIZE 1024 |
Referenced by gsm411_msgb_alloc().
#define MAX_SMS_RETRY 2 |
Referenced by gsm411_smc_init().
#define SMC_LOG_STR "SMC(%" PRIu64 ") " |
Referenced by cp_timer_expired(), gsm411_mmsms_cp_ack(), gsm411_mmsms_cp_data(), gsm411_mmsms_cp_error(), gsm411_mmsms_est_cnf(), gsm411_mmsms_rel_ind(), gsm411_mmsms_send_msg(), gsm411_mnsms_data_req(), gsm411_mnsms_est_req(), gsm411_mnsms_rel_req(), gsm411_smc_clear(), gsm411_smc_init(), gsm411_smc_recv(), gsm411_smc_send(), gsm411_tx_cp_error(), and new_cp_state().
#define SMCDATASLLEN (sizeof(smcdatastatelist) / sizeof(struct smcdatastate)) |
Referenced by gsm411_smc_recv().
#define SMCDOWNSLLEN (sizeof(smcdownstatelist) / sizeof(struct smcdownstate)) |
Referenced by gsm411_smc_send().
#define SMRDATASLLEN (sizeof(smrdatastatelist) / sizeof(struct smrdatastate)) |
Referenced by gsm411_smr_recv().
#define SMRDOWNSLLEN (sizeof(smrdownstatelist) / sizeof(struct smrdownstate)) |
Referenced by gsm411_smr_send().
|
static |
References gsm411_smc_inst::cp_max_retr, gsm411_smc_inst::cp_msg, gsm411_smc_inst::cp_retx, gsm411_mmsms_est_cnf(), GSM411_MMSMS_REL_REQ, GSM411_MNSMS_ERROR_IND, gsm411_msgb_alloc(), gsm411_smc_inst::id, gsm411_smc_inst::mm_send, gsm411_smc_inst::mn_recv, new_cp_state(), and SMC_LOG_STR.
Referenced by gsm411_mmsms_send_msg().
struct gsm341_ms_message* gsm0341_build_msg | ( | void * | ctx, |
uint8_t | geo_scope, | ||
uint8_t | msg_code, | ||
uint8_t | update, | ||
uint16_t | msg_id, | ||
uint8_t | dcs, | ||
uint8_t | page_total, | ||
uint8_t | page_cur, | ||
uint8_t * | data, | ||
uint8_t | len | ||
) |
Encode a 3GPP TS 03.41 SMS-CB message.
[in] | ctx | talloc allocation context |
[in] | geo_scope | Geographic Scope |
[in] | msg_code | Message Code |
[in] | update | Is this an update? |
[in] | msg_id | Message ID |
[in] | dcs | Data Coding Scheme |
[in] | page_total | Total number of pages |
[in] | page_cur | Current Page (up to page_total) |
[in] | data | Message data (copied 1:1) |
[in] | len | Length of data in bytes (up to 88) |
enum sms_alphabet gsm338_get_sms_alphabet | ( | uint8_t | dcs | ) |
determine coding alphabet dependent on GSM 03.38 Section 4 DCS
[in] | dcs | Data Coding Scheme in 03.38 encoding |
int gsm340_gen_oa | ( | uint8_t * | oa, |
unsigned int | oa_len, | ||
uint8_t | type, | ||
uint8_t | plan, | ||
const char * | number | ||
) |
generate a TPDU address field compliant with 03.40 sec.
9.1.2.5
[out] | oa | caller-provided output buffer |
[in] | oa_len | caller-specified length of oa in bytes |
[in] | type | GSM340_TYPE_* |
[in] | plan | Numbering Plan |
[in] | number | string containing number number of bytes of oa that have been used |
References gsm48_encode_bcd_number(), and gsm_7bit_encode_n().
void gsm340_gen_scts | ( | uint8_t * | scts, |
time_t | time | ||
) |
Generate 03.40 TP-SCTS.
[out] | scts | Caller-provided buffer to store SCTS (7 octets) |
[in] | time | to encode |
References gsm411_bcdify().
time_t gsm340_scts | ( | uint8_t * | scts | ) |
Decode 03.40 TP-SCTS (into utc/gmt timestamp)
[in] | scts | SMS Center Time Stamp |
References gsm411_unbcdify().
Referenced by gsm340_vp_absolute().
unsigned long gsm340_validity_period | ( | uint8_t | sms_vpf, |
uint8_t * | sms_vp | ||
) |
decode validity period.
return minutes
[in] | sms_vpf | Validity Period Format in 03.40 encoding |
[in] | sms_vp | Validity Period Information Element |
References gsm340_vp_absolute(), gsm340_vp_default(), gsm340_vp_relative(), gsm340_vp_relative_integer(), and gsm340_vp_relative_semioctet().
|
static |
References gsm340_scts().
Referenced by gsm340_validity_period().
|
static |
Referenced by gsm340_validity_period(), and gsm340_vp_relative_integer().
|
static |
Referenced by gsm340_validity_period().
|
static |
References gsm340_vp_default().
Referenced by gsm340_validity_period().
|
static |
References gsm411_unbcdify().
Referenced by gsm340_validity_period().
uint8_t gsm411_bcdify | ( | uint8_t | value | ) |
Turn int into semi-octet representation: 98 => 0x89.
[in] | integer | value representing decimal number 0..99 |
Referenced by gsm340_gen_scts().
|
static |
|
static |
|
static |
|
static |
References gsm411_smc_inst::cp_msg, gsm411_mmsms_send_msg(), gsm411_smc_inst::id, and SMC_LOG_STR.
Referenced by cp_timer_expired().
|
static |
|
static |
References gsm411_smc_inst::cp_msg, gsm411_smc_inst::cp_retx, gsm411_smc_inst::cp_state, gsm411_smc_inst::cp_tc1, gsm411_smc_inst::cp_timer, cp_timer_expired(), GSM411_MMSMS_DATA_REQ, gsm411_msgb_alloc(), gsm411_smc_inst::id, gsm411_smc_inst::mm_send, new_cp_state(), and SMC_LOG_STR.
Referenced by gsm411_mmsms_est_cnf(), and gsm411_mnsms_data_req().
|
static |
|
static |
|
static |
References gsm411_smc_inst::cp_msg, gsm411_mmsms_send_msg(), gsm411_smc_inst::id, and SMC_LOG_STR.
|
static |
References GSM411_SM_RL_REPORT_IND, gsm411_smr_inst::id, new_rp_state(), gsm411_smr_inst::rl_recv, and SMR_LOG_STR.
|
static |
|
static |
|
static |
|
static |
struct msgb* gsm411_msgb_alloc | ( | void | ) |
Allocate a message buffer for use as TS 04.11 message.
References GSM411_ALLOC_HEADROOM, and GSM411_ALLOC_SIZE.
Referenced by cp_timer_expired(), gsm411_mmsms_cp_ack(), gsm411_mmsms_cp_data(), gsm411_mmsms_cp_error(), gsm411_mmsms_rel_ind(), gsm411_mmsms_send_msg(), gsm411_mnsms_abort_req(), gsm411_mnsms_est_req(), gsm411_mnsms_rel_req(), gsm411_send_abort(), gsm411_send_release(), gsm411_send_report(), gsm411_send_rp_error(), gsm411_smc_recv(), and gsm411_tx_cp_error().
int gsm411_push_cp_header | ( | struct msgb * | msg, |
uint8_t | proto, | ||
uint8_t | trans, | ||
uint8_t | msg_type | ||
) |
Prefix msgb with a 04.08/04.11 CP header.
msg | Message Buffer containing message | |
[in] | proto | Protocol |
[in] | trans | Transaction |
[in] | msg_type | Message Type 0 |
References gsm0480_l3hdr_push().
int gsm411_push_rp_header | ( | struct msgb * | msg, |
uint8_t | rp_msg_type, | ||
uint8_t | rp_msg_ref | ||
) |
Prefix msgb with a RP header.
msg | Message Buffer containing message | |
[in] | rp_msg_type | RP Message Type |
[in] | rp_msg_ref | RP Message Reference |
|
static |
|
static |
|
static |
References gsm411_smr_inst::mn_send.
Referenced by gsm411_send_rp_error().
|
static |
References GSM411_MNSMS_ABORT_REQ, gsm411_msgb_alloc(), gsm411_smr_inst::id, gsm411_smr_inst::mn_send, msgb_tv_put(), and SMR_LOG_STR.
Referenced by rp_timer_expired().
|
static |
References GSM411_MNSMS_REL_REQ, gsm411_msgb_alloc(), gsm411_smr_inst::id, gsm411_smr_inst::mn_send, and SMR_LOG_STR.
Referenced by gsm411_mnsms_data_ind_tx(), gsm411_mnsms_error_ind_tx(), gsm411_mnsms_est_ind(), and gsm411_rl_report_req().
|
static |
References gsm411_msgb_alloc(), GSM411_SM_RL_REPORT_IND, gsm411_smr_inst::id, gsm411_smr_inst::rl_recv, and SMR_LOG_STR.
Referenced by rp_timer_expired().
|
static |
References GSM411_MNSMS_DATA_REQ, gsm411_msgb_alloc(), gsm411_rp_sendmsg(), gsm411_smr_inst::id, msgb_tv_put(), gsm411_smr_inst::network, and SMR_LOG_STR.
Referenced by gsm411_mnsms_data_ind_tx(), and gsm411_mnsms_est_ind().
void gsm411_smc_clear | ( | struct gsm411_smc_inst * | inst | ) |
References gsm411_smc_inst::cp_msg, gsm411_smc_inst::cp_timer, gsm411_smc_inst::id, and SMC_LOG_STR.
void gsm411_smc_init | ( | struct gsm411_smc_inst * | inst, |
uint64_t | id, | ||
int | network, | ||
int(*)(struct gsm411_smc_inst *inst, int msg_type, struct msgb *msg) | mn_recv, | ||
int(*)(struct gsm411_smc_inst *inst, int msg_type, struct msgb *msg, int cp_msg_type) | mm_send | ||
) |
int gsm411_smc_recv | ( | struct gsm411_smc_inst * | inst, |
int | msg_type, | ||
struct msgb * | msg, | ||
int | cp_msg_type | ||
) |
References gsm411_smc_inst::cp_state, smcdatastate::cp_type, GSM411_MMSMS_DATA_IND, GSM411_MMSMS_EST_IND, GSM411_MMSMS_REL_REQ, GSM411_MNSMS_ERROR_IND, gsm411_msgb_alloc(), gsm411_tx_cp_error(), gsm411_smc_inst::id, gsm411_smc_inst::mm_send, gsm411_smc_inst::mn_recv, smcdatastate::name, new_cp_state(), smcdatastate::rout, SBIT, SMC_LOG_STR, SMCDATASLLEN, smcdatastatelist, and smcdatastate::states.
int gsm411_smc_send | ( | struct gsm411_smc_inst * | inst, |
int | msg_type, | ||
struct msgb * | msg | ||
) |
void gsm411_smr_clear | ( | struct gsm411_smr_inst * | inst | ) |
References gsm411_smr_inst::id, gsm411_smr_inst::rp_timer, and SMR_LOG_STR.
void gsm411_smr_init | ( | struct gsm411_smr_inst * | inst, |
uint64_t | id, | ||
int | network, | ||
int(*)(struct gsm411_smr_inst *inst, int msg_type, struct msgb *msg) | rl_recv, | ||
int(*)(struct gsm411_smr_inst *inst, int msg_type, struct msgb *msg) | mn_send | ||
) |
int gsm411_smr_recv | ( | struct gsm411_smr_inst * | inst, |
int | msg_type, | ||
struct msgb * | msg | ||
) |
int gsm411_smr_send | ( | struct gsm411_smr_inst * | inst, |
int | msg_type, | ||
struct msgb * | msg | ||
) |
|
static |
References GSM411_MMSMS_DATA_REQ, gsm411_msgb_alloc(), gsm411_smc_inst::id, gsm411_smc_inst::mm_send, and SMC_LOG_STR.
Referenced by gsm411_smc_recv().
uint8_t gsm411_unbcdify | ( | uint8_t | value | ) |
Turn semi-octet representation into int: 0x89 => 98.
[in] | value | byte containing two BCD nibbles in revere order |
Referenced by gsm340_scts(), and gsm340_vp_relative_semioctet().
|
static |
References gsm411_smc_inst::cp_state, gsm411_smc_inst::id, and SMC_LOG_STR.
Referenced by cp_timer_expired(), gsm411_mmsms_cp_ack(), gsm411_mmsms_cp_data(), gsm411_mmsms_cp_error(), gsm411_mmsms_rel_ind(), gsm411_mmsms_send_msg(), gsm411_mnsms_abort_req(), gsm411_mnsms_est_req(), gsm411_mnsms_rel_req(), and gsm411_smc_recv().
|
static |
|
static |
References gsm411_send_abort(), gsm411_send_report(), gsm411_smr_inst::id, gsm411_smr_inst::rp_state, and SMR_LOG_STR.
Referenced by gsm411_smr_init().
const struct value_string gsm411_cp_cause_strs[] |
const struct value_string gsm411_rp_cause_strs[] |
const char* smc_state_names[] |
|
static |
Referenced by gsm411_smc_recv().
|
static |
Referenced by gsm411_smc_send().
|
static |
|
static |
Referenced by gsm411_smr_recv().
|
static |
Referenced by gsm411_smr_send().