aboutsummaryrefslogtreecommitdiffstats
path: root/include/osmocom/mgcp/iuup_cn_node.h
diff options
context:
space:
mode:
Diffstat (limited to 'include/osmocom/mgcp/iuup_cn_node.h')
-rw-r--r--include/osmocom/mgcp/iuup_cn_node.h47
1 files changed, 47 insertions, 0 deletions
diff --git a/include/osmocom/mgcp/iuup_cn_node.h b/include/osmocom/mgcp/iuup_cn_node.h
new file mode 100644
index 000000000..ca69b4db7
--- /dev/null
+++ b/include/osmocom/mgcp/iuup_cn_node.h
@@ -0,0 +1,47 @@
+/* A Media Gateway Control Protocol Media Gateway: RFC 3435 */
+/* IuUP CN node, minimal implementation */
+
+/* _____IuUP_CN_____
+ * | |
+ * UE <--> RNC --PDU-> osmo_iuup_cn_rx_pdu() -+-> ---+-> rx_payload()
+ * | | |
+ * | <-PDU-- tx_msg() <-------------+-- <-+--- osmo_iuup_cn_tx_payload()
+ * | |
+ * -----------------
+ */
+
+#pragma once
+
+struct msgb;
+
+typedef int (*osmo_iuup_data_cb_t)(struct msgb *msg, void *node_priv);
+
+struct osmo_iuup_cn_cfg {
+ void *node_priv;
+
+ /* When the IuUP peer sent a voice packet, the clean RTP without the IuUP header is fed to this
+ * callback. */
+ osmo_iuup_data_cb_t rx_payload;
+
+ /* IuUP handler requests that a PDU shall be sent to the IuUP peer (e.g. the RNC).
+ * It is guaranteed that the msgb->dst pointer is preserved or copied from the msgb that
+ * originated the request. */
+ osmo_iuup_data_cb_t tx_msg;
+};
+
+struct osmo_iuup_cn {
+ struct osmo_iuup_cn_cfg cfg;
+ char *name;
+ uint8_t next_frame_nr;
+ int rtp_payload_type;
+};
+
+bool osmo_iuup_cn_is_iuup_init(struct msgb *msg);
+
+struct osmo_iuup_cn *osmo_iuup_cn_init(void *ctx, struct osmo_iuup_cn_cfg *cfg,
+ const char *name_fmt, ...);
+void osmo_iuup_cn_free(struct osmo_iuup_cn *cn);
+
+int osmo_iuup_cn_tx_payload(struct osmo_iuup_cn *cn, struct msgb *payload);
+
+int osmo_iuup_cn_rx_pdu(struct osmo_iuup_cn *cn, struct msgb *pdu);