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