Andreas Eversberg | bbf9034 | 2011-10-28 03:55:37 +0200 | [diff] [blame] | 1 | #ifndef _GSM0411_SMC_H |
| 2 | #define _GSM0411_SMC_H |
| 3 | |
Holger Hans Peter Freyther | d38e0ef | 2012-11-13 22:28:05 +0100 | [diff] [blame] | 4 | #include <osmocom/core/timer.h> |
Andreas Eversberg | bbf9034 | 2011-10-28 03:55:37 +0200 | [diff] [blame] | 5 | #include <osmocom/gsm/protocol/gsm_04_11.h> |
| 6 | |
| 7 | #define GSM411_MMSMS_EST_REQ 0x310 |
| 8 | #define GSM411_MMSMS_EST_IND 0x312 |
| 9 | #define GSM411_MMSMS_EST_CNF 0x311 |
| 10 | #define GSM411_MMSMS_REL_REQ 0x320 |
| 11 | #define GSM411_MMSMS_REL_IND 0x322 |
| 12 | #define GSM411_MMSMS_DATA_REQ 0x330 |
| 13 | #define GSM411_MMSMS_DATA_IND 0x332 |
| 14 | #define GSM411_MMSMS_UNIT_DATA_REQ 0x340 |
| 15 | #define GSM411_MMSMS_UNIT_DATA_IND 0x342 |
| 16 | #define GSM411_MMSMS_ERR_IND 0x372 |
| 17 | |
| 18 | #define GSM411_MNSMS_ABORT_REQ 0x101 |
| 19 | #define GSM411_MNSMS_DATA_REQ 0x102 |
| 20 | #define GSM411_MNSMS_DATA_IND 0x103 |
| 21 | #define GSM411_MNSMS_EST_REQ 0x104 |
| 22 | #define GSM411_MNSMS_EST_IND 0x105 |
| 23 | #define GSM411_MNSMS_ERROR_IND 0x106 |
| 24 | #define GSM411_MNSMS_REL_REQ 0x107 |
| 25 | |
| 26 | struct gsm411_smc_inst { |
Holger Hans Peter Freyther | 33e8a87 | 2012-11-14 06:07:47 +0100 | [diff] [blame] | 27 | uint64_t id; /* a unique id for the SMS */ |
Andreas Eversberg | bbf9034 | 2011-10-28 03:55:37 +0200 | [diff] [blame] | 28 | int network; /* is this a MO (0) or MT (1) transfer */ |
| 29 | int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type, |
| 30 | struct msgb *msg); |
| 31 | int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type, |
| 32 | struct msgb *msg, int cp_msg_type); |
| 33 | |
| 34 | enum gsm411_cp_state cp_state; |
| 35 | struct osmo_timer_list cp_timer; |
| 36 | struct msgb *cp_msg; /* store pending message */ |
| 37 | int cp_rel; /* store pending release */ |
| 38 | int cp_retx; /* retry counter */ |
| 39 | int cp_max_retr; /* maximum retry */ |
| 40 | int cp_tc1; /* timer value TC1* */ |
| 41 | |
| 42 | }; |
| 43 | |
| 44 | extern const struct value_string gsm411_cp_cause_strs[]; |
| 45 | |
| 46 | /* init a new instance */ |
Holger Hans Peter Freyther | 33e8a87 | 2012-11-14 06:07:47 +0100 | [diff] [blame] | 47 | void gsm411_smc_init(struct gsm411_smc_inst *inst, uint64_t id, int network, |
Andreas Eversberg | bbf9034 | 2011-10-28 03:55:37 +0200 | [diff] [blame] | 48 | int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type, |
| 49 | struct msgb *msg), |
| 50 | int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type, |
| 51 | struct msgb *msg, int cp_msg_type)); |
| 52 | |
| 53 | /* clear instance */ |
| 54 | void gsm411_smc_clear(struct gsm411_smc_inst *inst); |
| 55 | |
| 56 | /* message from upper layer */ |
| 57 | int gsm411_smc_send(struct gsm411_smc_inst *inst, int msg_type, |
| 58 | struct msgb *msg); |
| 59 | |
| 60 | /* message from lower layer */ |
| 61 | int gsm411_smc_recv(struct gsm411_smc_inst *inst, int msg_type, |
| 62 | struct msgb *msg, int cp_msg_type); |
| 63 | |
| 64 | #endif /* _GSM0411_SMC_H */ |