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