blob: 239ee13c956ebfb021131d5f582a3cd20eb1fdc1 [file] [log] [blame]
Andreas Eversbergbbf90342011-10-28 03:55:37 +02001#ifndef _GSM0411_SMC_H
2#define _GSM0411_SMC_H
3
Holger Hans Peter Freytherd38e0ef2012-11-13 22:28:05 +01004#include <osmocom/core/timer.h>
Andreas Eversbergbbf90342011-10-28 03:55:37 +02005#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
26struct gsm411_smc_inst {
Holger Hans Peter Freyther33e8a872012-11-14 06:07:47 +010027 uint64_t id; /* a unique id for the SMS */
Andreas Eversbergbbf90342011-10-28 03:55:37 +020028 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
44extern const struct value_string gsm411_cp_cause_strs[];
45
46/* init a new instance */
Holger Hans Peter Freyther33e8a872012-11-14 06:07:47 +010047void gsm411_smc_init(struct gsm411_smc_inst *inst, uint64_t id, int network,
Andreas Eversbergbbf90342011-10-28 03:55:37 +020048 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 */
54void gsm411_smc_clear(struct gsm411_smc_inst *inst);
55
56/* message from upper layer */
57int gsm411_smc_send(struct gsm411_smc_inst *inst, int msg_type,
58 struct msgb *msg);
59
60/* message from lower layer */
61int 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 */