blob: f792469ff386484c44aef6f382f7a017c6cb7651 [file] [log] [blame]
Neels Hofmeyrf2a65b82018-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
13#pragma once
14
15struct osmo_iuup_cn;
16struct msgb;
17
18typedef int (*osmo_iuup_data_cb_t)(struct msgb *msg, void *node_priv);
19
20struct osmo_iuup_cn_cfg {
21 void *node_priv;
22
23 /* When the IuUP peer sent a voice packet, the clean RTP without the IuUP header is fed to this
24 * callback. */
25 osmo_iuup_data_cb_t rx_payload;
26
27 /* 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. */
30 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
39int osmo_iuup_cn_tx_payload(struct osmo_iuup_cn *cn, struct msgb *payload);
40
41int osmo_iuup_cn_rx_pdu(struct osmo_iuup_cn *cn, struct msgb *pdu);