blob: 75102f8f65e91dc62ad922ea9442420ad6fe3c19 [file] [log] [blame]
Harald Welte55d724a2017-10-16 18:25:45 +02001/*! \addtogroup sms
2 * @{
3 * \file gsm0411_smr.h */
Neels Hofmeyr17518fe2017-06-20 04:35:06 +02004
Sylvain Munaut12ba7782014-06-16 10:13:40 +02005#pragma once
Andreas Eversbergc1a91a82011-10-28 11:05:37 +02006
7#include <osmocom/gsm/protocol/gsm_04_11.h>
8
9#define GSM411_SM_RL_DATA_REQ 0x401
10#define GSM411_SM_RL_DATA_IND 0x402
11#define GSM411_SM_RL_MEM_AVAIL_REQ 0x403
12#define GSM411_SM_RL_MEM_AVAIL_IND 0x404
13#define GSM411_SM_RL_REPORT_REQ 0x405
14#define GSM411_SM_RL_REPORT_IND 0x406
15
16struct gsm411_smr_inst {
Holger Hans Peter Freytherbcf125c2012-11-14 06:07:47 +010017 uint64_t id; /* a unique id for the SMS */
Andreas Eversbergc1a91a82011-10-28 11:05:37 +020018 int network; /* is this a MO (0) or MT (1) transfer */
19 int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type,
20 struct msgb *msg);
21 int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type,
22 struct msgb *msg);
23
24 enum gsm411_rp_state rp_state;
25 struct osmo_timer_list rp_timer;
26};
27
28extern const struct value_string gsm411_rp_cause_strs[];
29
30/* init a new instance */
Holger Hans Peter Freytherbcf125c2012-11-14 06:07:47 +010031void gsm411_smr_init(struct gsm411_smr_inst *inst, uint64_t id, int network,
Andreas Eversbergc1a91a82011-10-28 11:05:37 +020032 int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type,
33 struct msgb *msg),
34 int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type,
35 struct msgb *msg));
36
37/* clear instance */
38void gsm411_smr_clear(struct gsm411_smr_inst *inst);
39
40/* message from upper layer */
41int gsm411_smr_send(struct gsm411_smr_inst *inst, int msg_type,
42 struct msgb *msg);
43
44/* message from lower layer */
45int gsm411_smr_recv(struct gsm411_smr_inst *inst, int msg_type,
46 struct msgb *msg);
Harald Welte55d724a2017-10-16 18:25:45 +020047
Harald Welted60e17a2018-01-24 16:50:11 +010048extern const struct value_string gsm411_rp_state_names[];
49
50static inline const char *gsm411_rp_state_name(enum gsm411_rp_state rp_state) {
51 return get_value_string(gsm411_rp_state_names, rp_state);
52}
53
Harald Welte55d724a2017-10-16 18:25:45 +020054/*! @} */