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> |
| 7 | #include "gsup_server.h" |
| 8 | |
| 9 | struct osmo_gsup_conn; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 10 | |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 11 | struct hlr_ussd_route { |
| 12 | /* g_hlr.routes */ |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 13 | struct llist_head list; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 14 | const char *prefix; |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 15 | bool is_external; |
| 16 | union { |
| 17 | struct hlr_euse *euse; |
| 18 | const struct hlr_iuse *iuse; |
| 19 | } u; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 20 | }; |
| 21 | |
| 22 | struct 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 Welte | bb77939 | 2018-06-16 20:21:10 +0200 | [diff] [blame] | 30 | |
| 31 | /* GSUP connection to the EUSE, if any */ |
| 32 | struct osmo_gsup_conn *conn; |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 33 | }; |
| 34 | |
Harald Welte | 4956ae1 | 2018-06-15 22:04:28 +0200 | [diff] [blame] | 35 | struct hlr_euse *euse_find(struct hlr *hlr, const char *name); |
| 36 | struct hlr_euse *euse_alloc(struct hlr *hlr, const char *name); |
| 37 | void euse_del(struct hlr_euse *euse); |
| 38 | |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 39 | const struct hlr_iuse *iuse_find(const char *name); |
| 40 | |
| 41 | struct hlr_ussd_route *ussd_route_find_prefix(struct hlr *hlr, const char *prefix); |
| 42 | struct hlr_ussd_route *ussd_route_prefix_alloc_int(struct hlr *hlr, const char *prefix, |
| 43 | const struct hlr_iuse *iuse); |
| 44 | struct hlr_ussd_route *ussd_route_prefix_alloc_ext(struct hlr *hlr, const char *prefix, |
| 45 | struct hlr_euse *euse); |
| 46 | void ussd_route_del(struct hlr_ussd_route *rt); |
Harald Welte | bb77939 | 2018-06-16 20:21:10 +0200 | [diff] [blame] | 47 | |
| 48 | int rx_proc_ss_req(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup); |
| 49 | int rx_proc_ss_error(struct osmo_gsup_conn *conn, const struct osmo_gsup_message *gsup); |
Harald Welte | dab544e | 2018-07-29 16:14:48 +0200 | [diff] [blame] | 50 | |
| 51 | struct ss_session; |
| 52 | struct ss_request; |
| 53 | |
| 54 | /* Internal USSD Handler */ |
| 55 | struct 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 | }; |