blob: ca69b4db72c4408725c2c7bce0bc4a459f272b70 [file] [log] [blame]
Neels Hofmeyr306dc092018-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 msgb;
16
17typedef int (*osmo_iuup_data_cb_t)(struct msgb *msg, void *node_priv);
18
19struct osmo_iuup_cn_cfg {
20 void *node_priv;
21
22 /* When the IuUP peer sent a voice packet, the clean RTP without the IuUP header is fed to this
23 * callback. */
24 osmo_iuup_data_cb_t rx_payload;
25
26 /* IuUP handler requests that a PDU shall be sent to the IuUP peer (e.g. the RNC).
27 * It is guaranteed that the msgb->dst pointer is preserved or copied from the msgb that
28 * originated the request. */
29 osmo_iuup_data_cb_t tx_msg;
30};
31
32struct osmo_iuup_cn {
33 struct osmo_iuup_cn_cfg cfg;
34 char *name;
35 uint8_t next_frame_nr;
36 int rtp_payload_type;
37};
38
39bool osmo_iuup_cn_is_iuup_init(struct msgb *msg);
40
41struct osmo_iuup_cn *osmo_iuup_cn_init(void *ctx, struct osmo_iuup_cn_cfg *cfg,
42 const char *name_fmt, ...);
43void osmo_iuup_cn_free(struct osmo_iuup_cn *cn);
44
45int osmo_iuup_cn_tx_payload(struct osmo_iuup_cn *cn, struct msgb *payload);
46
47int osmo_iuup_cn_rx_pdu(struct osmo_iuup_cn *cn, struct msgb *pdu);