blob: 501b81dbe2125592eb5ca6732eff0d530c164374 [file] [log] [blame]
Neels Hofmeyrc4628a32018-12-07 14:47:34 +01001#pragma once
2
3#include <osmocom/gsm/gsup.h>
4#include <osmocom/msc/gsup_client_mux.h>
5
6struct gsup_client_mux;
7struct ipaccess_unit;
8
9struct 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.*/
19struct 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
26struct gsup_client_mux *gsup_client_mux_alloc(void *talloc_ctx);
27int 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
30int gsup_client_mux_tx(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_msg);
Mychaela N. Falconiadbe88892023-09-25 05:20:02 +000031void gsup_client_mux_tx_set_source(const struct gsup_client_mux *gcm, struct osmo_gsup_message *gsup_msg);
Neels Hofmeyrc4628a32018-12-07 14:47:34 +010032void gsup_client_mux_tx_error_reply(struct gsup_client_mux *gcm, const struct osmo_gsup_message *gsup_orig,
33 enum gsm48_gmm_cause cause);
34
35int gsup_client_mux_rx(struct osmo_gsup_client *gsup_client, struct msgb *msg);