Neels Hofmeyr | 306dc09 | 2018-09-30 05:01:20 +0200 | [diff] [blame^] | 1 | /* 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 | |
| 15 | struct msgb; |
| 16 | |
| 17 | typedef int (*osmo_iuup_data_cb_t)(struct msgb *msg, void *node_priv); |
| 18 | |
| 19 | struct 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 | |
| 32 | struct 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 | |
| 39 | bool osmo_iuup_cn_is_iuup_init(struct msgb *msg); |
| 40 | |
| 41 | struct osmo_iuup_cn *osmo_iuup_cn_init(void *ctx, struct osmo_iuup_cn_cfg *cfg, |
| 42 | const char *name_fmt, ...); |
| 43 | void osmo_iuup_cn_free(struct osmo_iuup_cn *cn); |
| 44 | |
| 45 | int osmo_iuup_cn_tx_payload(struct osmo_iuup_cn *cn, struct msgb *payload); |
| 46 | |
| 47 | int osmo_iuup_cn_rx_pdu(struct osmo_iuup_cn *cn, struct msgb *pdu); |