Vadim Yanitskiy | 83df349 | 2018-07-31 01:17:25 +0700 | [diff] [blame] | 1 | #pragma once |
| 2 | |
Vadim Yanitskiy | 7c5e930 | 2018-07-31 01:38:40 +0700 | [diff] [blame] | 3 | #include <stdbool.h> |
| 4 | |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 5 | #include <osmocom/core/linuxlist.h> |
Harald Welte | bb77939 | 2018-06-16 20:21:10 +0200 | [diff] [blame] | 6 | #include <osmocom/gsm/gsup.h> |
Harald Welte | bb77939 | 2018-06-16 20:21:10 +0200 | [diff] [blame] | 7 | |
Neels Hofmeyr | 2f75803 | 2019-11-20 00:37:07 +0100 | [diff] [blame] | 8 | #include <osmocom/hlr/gsup_server.h> |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 9 | |
Vadim Yanitskiy | d157a56 | 2018-12-01 00:03:39 +0700 | [diff] [blame] | 10 | #define NCSS_GUARD_TIMEOUT_DEFAULT 30 |
| 11 | |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 12 | struct hlr_ussd_route { |
| 13 | /* g_hlr.routes */ |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 14 | struct llist_head list; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 15 | const char *prefix; |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 16 | bool is_external; |
| 17 | union { |
| 18 | struct hlr_euse *euse; |
| 19 | const struct hlr_iuse *iuse; |
| 20 | } u; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 21 | }; |
| 22 | |
| 23 | struct 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 Welte | bb77939 | 2018-06-16 20:21:10 +0200 | [diff] [blame] | 31 | |
| 32 | /* GSUP connection to the EUSE, if any */ |
| 33 | struct osmo_gsup_conn *conn; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 34 | }; |
| 35 | |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 36 | struct hlr_euse *euse_find(struct hlr *hlr, const char *name); |
| 37 | struct hlr_euse *euse_alloc(struct hlr *hlr, const char *name); |
| 38 | void euse_del(struct hlr_euse *euse); |
| 39 | |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 40 | const struct hlr_iuse *iuse_find(const char *name); |
| 41 | |
| 42 | struct hlr_ussd_route *ussd_route_find_prefix(struct hlr *hlr, const char *prefix); |
| 43 | struct hlr_ussd_route *ussd_route_prefix_alloc_int(struct hlr *hlr, const char *prefix, |
| 44 | const struct hlr_iuse *iuse); |
| 45 | struct hlr_ussd_route *ussd_route_prefix_alloc_ext(struct hlr *hlr, const char *prefix, |
| 46 | struct hlr_euse *euse); |
| 47 | void ussd_route_del(struct hlr_ussd_route *rt); |
Harald Welte | bb77939 | 2018-06-16 20:21:10 +0200 | [diff] [blame] | 48 | |
Neels Hofmeyr | f13a8bc | 2019-11-20 02:36:45 +0100 | [diff] [blame^] | 49 | void rx_proc_ss_req(struct osmo_gsup_req *req); |
| 50 | void rx_proc_ss_error(struct osmo_gsup_req *req); |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 51 | |
| 52 | struct ss_session; |
| 53 | struct ss_request; |
| 54 | |
| 55 | /* Internal USSD Handler */ |
| 56 | struct hlr_iuse { |
| 57 | const char *name; |
| 58 | /* call-back to be called for any incoming USSD messages for this IUSE */ |
Neels Hofmeyr | f13a8bc | 2019-11-20 02:36:45 +0100 | [diff] [blame^] | 59 | int (*handle_ussd)(struct ss_session *ss, const struct osmo_gsup_message *gsup, const struct ss_request *req); |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 60 | }; |