blob: f792469ff386484c44aef6f382f7a017c6cb7651 [file] [log] [blame]
Neels Hofmeyr3243c7c2018-09-30 05:01:20 +02001/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
2/* IuUP CN node, minimal implementation */
3
4/* _____IuUP_CN_____
5 * | |
6 * UE <--> RNC --PDU-> osmo_iuup_cn_rx_pdu() -+-> ---+-> rx_payload()
7 * | | |
8 * | <-PDU-- tx_msg() <-------------+-- <-+--- osmo_iuup_cn_tx_payload()
9 * | |
10 * -----------------
11 */
12
Neels Hofmeyr3243c7c2018-09-30 05:01:20 +020013#pragma once
14
15struct osmo_iuup_cn;
16struct msgb;
17
Neels Hofmeyr85f94012018-10-08 03:36:45 +020018typedef int (*osmo_iuup_data_cb_t)(struct msgb *msg, void *node_priv);
Neels Hofmeyr3243c7c2018-09-30 05:01:20 +020019
20struct osmo_iuup_cn_cfg {
21 void *node_priv;
22
Neels Hofmeyr85f94012018-10-08 03:36:45 +020023 /* When the IuUP peer sent a voice packet, the clean RTP without the IuUP header is fed to this
24 * callback. */
Neels Hofmeyr3243c7c2018-09-30 05:01:20 +020025 osmo_iuup_data_cb_t rx_payload;
26
Neels Hofmeyr85f94012018-10-08 03:36:45 +020027 /* IuUP handler requests that a PDU shall be sent to the IuUP peer (e.g. the RNC).
28 * It is guaranteed that the msgb->dst pointer is preserved or copied from the msgb that
29 * originated the request. */
Neels Hofmeyr3243c7c2018-09-30 05:01:20 +020030 osmo_iuup_data_cb_t tx_msg;
31};
32
33bool osmo_iuup_cn_is_iuup_init(struct msgb *msg);
34
35struct osmo_iuup_cn *osmo_iuup_cn_init(void *ctx, struct osmo_iuup_cn_cfg *cfg,
36 const char *name_fmt, ...);
37void osmo_iuup_cn_free(struct osmo_iuup_cn *cn);
38
Neels Hofmeyr85f94012018-10-08 03:36:45 +020039int osmo_iuup_cn_tx_payload(struct osmo_iuup_cn *cn, struct msgb *payload);
Neels Hofmeyr3243c7c2018-09-30 05:01:20 +020040
Neels Hofmeyr85f94012018-10-08 03:36:45 +020041int osmo_iuup_cn_rx_pdu(struct osmo_iuup_cn *cn, struct msgb *pdu);