Neels Hofmeyr | c4628a3 | 2018-12-07 14:47:34 +0100 | [diff] [blame] | 1 | #pragma once |
| 2 | |
| 3 | #include <osmocom/gsm/gsup.h> |
| 4 | #include <osmocom/msc/gsup_client_mux.h> |
| 5 | |
| 6 | struct gsup_client_mux; |
| 7 | struct ipaccess_unit; |
| 8 | |
| 9 | struct gsup_client_mux_rx_cb { |
| 10 | int (* func )(struct gsup_client_mux *gcm, void *data, const struct osmo_gsup_message *gsup_msg); |
| 11 | void *data; |
| 12 | }; |
| 13 | |
| 14 | /* A GSUP client shared between code paths for various GSUP Message Classes. |
| 15 | * The main task is to dispatch GSUP messages to code paths corresponding to the respective Message Class, i.e. |
| 16 | * subscriber management, SMS, SS/USSD and inter-MSC messaging. |
| 17 | * If a GSUP Message Class IE is present in the message, the received message is dispatched directly to the rx_cb entry |
| 18 | * for that Message Class. Otherwise, the Message Class is determined by a switch() on the Message Type.*/ |
| 19 | struct gsup_client_mux { |
| 20 | struct osmo_gsup_client *gsup_client; |
| 21 | |
| 22 | /* Target clients by enum osmo_gsup_message_class */ |
| 23 | struct gsup_client_mux_rx_cb rx_cb[OSMO_GSUP_MESSAGE_CLASS_ARRAYSIZE]; |
| 24 | }; |
| 25 | |
| 26 | struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx); |
| 27 | int gsup_client_mux_start(struct gsup_client_mux *gcm, const char *gsup_server_addr_str, uint16_t gsup_server_port, |
| 28 | struct ipaccess_unit *ipa_dev); |
| 29 | |
| 30 | int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg); |
| 31 | void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig, |
| 32 | enum gsm48_gmm_cause cause); |
| 33 | |
| 34 | int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg); |