blob: e1508a2dfa57b2fb1db7fed5c778e415e0ea8600 [file] [log] [blame]
Andreas Eversbergbbf90342011-10-28 03:55:37 +02001#ifndef _GSM0411_SMC_H
2#define _GSM0411_SMC_H
3
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
25struct gsm411_smc_inst {
26 int network; /* is this a MO (0) or MT (1) transfer */
27 int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type,
28 struct msgb *msg);
29 int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type,
30 struct msgb *msg, int cp_msg_type);
31
32 enum gsm411_cp_state cp_state;
33 struct osmo_timer_list cp_timer;
34 struct msgb *cp_msg; /* store pending message */
35 int cp_rel; /* store pending release */
36 int cp_retx; /* retry counter */
37 int cp_max_retr; /* maximum retry */
38 int cp_tc1; /* timer value TC1* */
39
40};
41
42extern const struct value_string gsm411_cp_cause_strs[];
43
44/* init a new instance */
45void gsm411_smc_init(struct gsm411_smc_inst *inst, int network,
46 int (*mn_recv) (struct gsm411_smc_inst *inst, int msg_type,
47 struct msgb *msg),
48 int (*mm_send) (struct gsm411_smc_inst *inst, int msg_type,
49 struct msgb *msg, int cp_msg_type));
50
51/* clear instance */
52void gsm411_smc_clear(struct gsm411_smc_inst *inst);
53
54/* message from upper layer */
55int gsm411_smc_send(struct gsm411_smc_inst *inst, int msg_type,
56 struct msgb *msg);
57
58/* message from lower layer */
59int gsm411_smc_recv(struct gsm411_smc_inst *inst, int msg_type,
60 struct msgb *msg, int cp_msg_type);
61
62#endif /* _GSM0411_SMC_H */