blob: a190dc6a7871553dfd469ef9b49734aff5191686 [file] [log] [blame]
Vadim Yanitskiy83df3492018-07-31 01:17:25 +07001#pragma once
2
Vadim Yanitskiy7c5e9302018-07-31 01:38:40 +07003#include <stdbool.h>
4
Harald Welte4956ae12018-06-15 22:04:28 +02005#include <osmocom/core/linuxlist.h>
Harald Weltebb779392018-06-16 20:21:10 +02006#include <osmocom/gsm/gsup.h>
7#include "gsup_server.h"
8
9struct osmo_gsup_conn;
Harald Welte4956ae12018-06-15 22:04:28 +020010
Harald Weltedab544e2018-07-29 16:14:48 +020011struct hlr_ussd_route {
12 /* g_hlr.routes */
Harald Welte4956ae12018-06-15 22:04:28 +020013 struct llist_head list;
Harald Welte4956ae12018-06-15 22:04:28 +020014 const char *prefix;
Harald Weltedab544e2018-07-29 16:14:48 +020015 bool is_external;
16 union {
17 struct hlr_euse *euse;
18 const struct hlr_iuse *iuse;
19 } u;
Harald Welte4956ae12018-06-15 22:04:28 +020020};
21
22struct hlr_euse {
23 /* list in the per-hlr list of EUSEs */
24 struct llist_head list;
25 struct hlr *hlr;
26 /* name (must match the IPA ID tag) */
27 const char *name;
28 /* human-readable description */
29 const char *description;
Harald Weltebb779392018-06-16 20:21:10 +020030
31 /* GSUP connection to the EUSE, if any */
32 struct osmo_gsup_conn *conn;
Harald Welte4956ae12018-06-15 22:04:28 +020033};
34
Harald Welte4956ae12018-06-15 22:04:28 +020035struct hlr_euse *euse_find(struct hlr *hlr, const char *name);
36struct hlr_euse *euse_alloc(struct hlr *hlr, const char *name);
37void euse_del(struct hlr_euse *euse);
38
Harald Weltedab544e2018-07-29 16:14:48 +020039const struct hlr_iuse *iuse_find(const char *name);
40
41struct hlr_ussd_route *ussd_route_find_prefix(struct hlr *hlr, const char *prefix);
42struct hlr_ussd_route *ussd_route_prefix_alloc_int(struct hlr *hlr, const char *prefix,
43 const struct hlr_iuse *iuse);
44struct hlr_ussd_route *ussd_route_prefix_alloc_ext(struct hlr *hlr, const char *prefix,
45 struct hlr_euse *euse);
46void ussd_route_del(struct hlr_ussd_route *rt);
Harald Weltebb779392018-06-16 20:21:10 +020047
48int rx_proc_ss_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
49int rx_proc_ss_error(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
Harald Weltedab544e2018-07-29 16:14:48 +020050
51struct ss_session;
52struct ss_request;
53
54/* Internal USSD Handler */
55struct hlr_iuse {
56 const char *name;
57 /* call-back to be called for any incoming USSD messages for this IUSE */
58 int (*handle_ussd)(struct osmo_gsup_conn *conn, struct ss_session *ss,
59 const struct osmo_gsup_message *gsup, const struct ss_request *req);
60};