blob: 393ca6ce426492832d5839927ae8c3bae567bbbe [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>
Harald Weltebb779392018-06-16 20:21:10 +02007
Vadim Yanitskiya05efe82018-07-31 01:42:25 +07008#include "gsup_server.h"
Harald Welte4956ae12018-06-15 22:04:28 +02009
Vadim Yanitskiyd157a562018-12-01 00:03:39 +070010#define NCSS_GUARD_TIMEOUT_DEFAULT 30
11
Harald Weltedab544e2018-07-29 16:14:48 +020012struct hlr_ussd_route {
13 /* g_hlr.routes */
Harald Welte4956ae12018-06-15 22:04:28 +020014 struct llist_head list;
Harald Welte4956ae12018-06-15 22:04:28 +020015 const char *prefix;
Harald Weltedab544e2018-07-29 16:14:48 +020016 bool is_external;
17 union {
18 struct hlr_euse *euse;
19 const struct hlr_iuse *iuse;
20 } u;
Harald Welte4956ae12018-06-15 22:04:28 +020021};
22
23struct hlr_euse {
24 /* list in the per-hlr list of EUSEs */
25 struct llist_head list;
26 struct hlr *hlr;
27 /* name (must match the IPA ID tag) */
28 const char *name;
29 /* human-readable description */
30 const char *description;
Harald Weltebb779392018-06-16 20:21:10 +020031
32 /* GSUP connection to the EUSE, if any */
33 struct osmo_gsup_conn *conn;
Harald Welte4956ae12018-06-15 22:04:28 +020034};
35
Harald Welte4956ae12018-06-15 22:04:28 +020036struct hlr_euse *euse_find(struct hlr *hlr, const char *name);
37struct hlr_euse *euse_alloc(struct hlr *hlr, const char *name);
38void euse_del(struct hlr_euse *euse);
39
Harald Weltedab544e2018-07-29 16:14:48 +020040const struct hlr_iuse *iuse_find(const char *name);
41
42struct hlr_ussd_route *ussd_route_find_prefix(struct hlr *hlr, const char *prefix);
43struct hlr_ussd_route *ussd_route_prefix_alloc_int(struct hlr *hlr, const char *prefix,
44 const struct hlr_iuse *iuse);
45struct hlr_ussd_route *ussd_route_prefix_alloc_ext(struct hlr *hlr, const char *prefix,
46 struct hlr_euse *euse);
47void ussd_route_del(struct hlr_ussd_route *rt);
Harald Weltebb779392018-06-16 20:21:10 +020048
49int rx_proc_ss_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
50int rx_proc_ss_error(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup);
Harald Weltedab544e2018-07-29 16:14:48 +020051
52struct ss_session;
53struct ss_request;
54
55/* Internal USSD Handler */
56struct hlr_iuse {
57 const char *name;
58 /* call-back to be called for any incoming USSD messages for this IUSE */
59 int (*handle_ussd)(struct osmo_gsup_conn *conn, struct ss_session *ss,
60 const struct osmo_gsup_message *gsup, const struct ss_request *req);
61};