summaryrefslogtreecommitdiffstats
path: root/include/osmocom/gsm/gsm0411_smr.h
blob: 75102f8f65e91dc62ad922ea9442420ad6fe3c19 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
/*! \addtogroup sms
 *  @{
 * \file gsm0411_smr.h */

#pragma once

#include <osmocom/gsm/protocol/gsm_04_11.h>

#define GSM411_SM_RL_DATA_REQ		0x401
#define GSM411_SM_RL_DATA_IND		0x402
#define GSM411_SM_RL_MEM_AVAIL_REQ	0x403
#define GSM411_SM_RL_MEM_AVAIL_IND	0x404
#define GSM411_SM_RL_REPORT_REQ		0x405
#define GSM411_SM_RL_REPORT_IND		0x406

struct gsm411_smr_inst {
	uint64_t id;		/* a unique id for the SMS */
	int network;		/* is this a MO (0) or MT (1) transfer */
	int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type,
			struct msgb *msg);
	int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type,
			struct msgb *msg);

	enum gsm411_rp_state rp_state;
	struct osmo_timer_list rp_timer;
};

extern const struct value_string gsm411_rp_cause_strs[];

/* init a new instance */
void gsm411_smr_init(struct gsm411_smr_inst *inst, uint64_t id, int network,
	int (*rl_recv) (struct gsm411_smr_inst *inst, int msg_type,
			struct msgb *msg),
	int (*mn_send) (struct gsm411_smr_inst *inst, int msg_type,
			struct msgb *msg));

/* clear instance */
void gsm411_smr_clear(struct gsm411_smr_inst *inst);

/* message from upper layer */
int gsm411_smr_send(struct gsm411_smr_inst *inst, int msg_type,
	struct msgb *msg);

/* message from lower layer */
int gsm411_smr_recv(struct gsm411_smr_inst *inst, int msg_type,
	struct msgb *msg);

extern const struct value_string gsm411_rp_state_names[];

static inline const char *gsm411_rp_state_name(enum gsm411_rp_state rp_state) {
	return get_value_string(gsm411_rp_state_names, rp_state);
}

/*! @} */