aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/hlr/hlr_ussd.h
blob: 08e810e7756897e6f4b39d186b66cf63b12be3fa (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
55
56
57
58
59
60
61
#pragma once

#include <stdbool.h>

#include <osmocom/core/linuxlist.h>
#include <osmocom/gsm/gsup.h>

#include <osmocom/hlr/gsup_server.h>

#define NCSS_GUARD_TIMEOUT_DEFAULT 30

struct hlr_ussd_route {
	/* g_hlr.routes */
	struct llist_head list;
	const char *prefix;
	bool is_external;
	union {
		struct hlr_euse *euse;
		const struct hlr_iuse *iuse;
	} u;
};

struct hlr_euse {
	/* list in the per-hlr list of EUSEs */
	struct llist_head list;
	struct hlr *hlr;
	/* name (must match the IPA ID tag) */
	const char *name;
	/* human-readable description */
	const char *description;

	/* GSUP connection to the EUSE, if any */
	struct osmo_gsup_conn *conn;
};

struct hlr_euse *euse_find(struct hlr *hlr, const char *name);
struct hlr_euse *euse_alloc(struct hlr *hlr, const char *name);
void euse_del(struct hlr_euse *euse);

const struct hlr_iuse *iuse_find(const char *name);

struct hlr_ussd_route *ussd_route_find_prefix(struct hlr *hlr, const char *prefix);
struct hlr_ussd_route *ussd_route_prefix_alloc_int(struct hlr *hlr, const char *prefix,
						   const struct hlr_iuse *iuse);
struct hlr_ussd_route *ussd_route_prefix_alloc_ext(struct hlr *hlr, const char *prefix,
						   struct hlr_euse *euse);
void ussd_route_del(struct hlr_ussd_route *rt);

int rx_proc_ss_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
int rx_proc_ss_error(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);

struct ss_session;
struct ss_request;

/* Internal USSD Handler */
struct hlr_iuse {
	const char *name;
	/* call-back to be called for any incoming USSD messages for this IUSE */
	int (*handle_ussd)(struct osmo_gsup_conn *conn, struct ss_session *ss,
			   const struct osmo_gsup_message *gsup, const struct ss_request *req);
};