Harald Welte | 55d724a | 2017-10-16 18:25:45 +0200 | [diff] [blame] | 1 | /*! \addtogroup sms |
| 2 | * @{ |
| 3 | * \file gsm0411_smr.h */ |
Neels Hofmeyr | 17518fe | 2017-06-20 04:35:06 +0200 | [diff] [blame] | 4 | |
Sylvain Munaut | 12ba778 | 2014-06-16 10:13:40 +0200 | [diff] [blame] | 5 | #pragma once |
Andreas Eversberg | c1a91a8 | 2011-10-28 11:05:37 +0200 | [diff] [blame] | 6 | |
| 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 | |
| 16 | struct gsm411_smr_inst { |
Holger Hans Peter Freyther | bcf125c | 2012-11-14 06:07:47 +0100 | [diff] [blame] | 17 | uint64_t id; /* a unique id for the SMS */ |
Andreas Eversberg | c1a91a8 | 2011-10-28 11:05:37 +0200 | [diff] [blame] | 18 | 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 | |
| 28 | extern const struct value_string gsm411_rp_cause_strs[]; |
| 29 | |
| 30 | /* init a new instance */ |
Holger Hans Peter Freyther | bcf125c | 2012-11-14 06:07:47 +0100 | [diff] [blame] | 31 | void gsm411_smr_init(struct gsm411_smr_inst *inst, uint64_t id, int network, |
Andreas Eversberg | c1a91a8 | 2011-10-28 11:05:37 +0200 | [diff] [blame] | 32 | 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 */ |
| 38 | void gsm411_smr_clear(struct gsm411_smr_inst *inst); |
| 39 | |
| 40 | /* message from upper layer */ |
| 41 | int gsm411_smr_send(struct gsm411_smr_inst *inst, int msg_type, |
| 42 | struct msgb *msg); |
| 43 | |
| 44 | /* message from lower layer */ |
| 45 | int gsm411_smr_recv(struct gsm411_smr_inst *inst, int msg_type, |
| 46 | struct msgb *msg); |
Harald Welte | 55d724a | 2017-10-16 18:25:45 +0200 | [diff] [blame] | 47 | |
Harald Welte | d60e17a | 2018-01-24 16:50:11 +0100 | [diff] [blame] | 48 | extern const struct value_string gsm411_rp_state_names[]; |
| 49 | |
| 50 | static 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 Welte | 55d724a | 2017-10-16 18:25:45 +0200 | [diff] [blame] | 54 | /*! @} */ |