Neels Hofmeyr | 3243c7c | 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 | |
Neels Hofmeyr | 3243c7c | 2018-09-30 05:01:20 +0200 | [diff] [blame] | 13 | #pragma once |
| 14 | |
| 15 | struct osmo_iuup_cn; |
| 16 | struct msgb; |
| 17 | |
Neels Hofmeyr | 85f9401 | 2018-10-08 03:36:45 +0200 | [diff] [blame] | 18 | typedef int (*osmo_iuup_data_cb_t)(struct msgb *msg, void *node_priv); |
Neels Hofmeyr | 3243c7c | 2018-09-30 05:01:20 +0200 | [diff] [blame] | 19 | |
| 20 | struct osmo_iuup_cn_cfg { |
| 21 | void *node_priv; |
| 22 | |
Neels Hofmeyr | 85f9401 | 2018-10-08 03:36:45 +0200 | [diff] [blame] | 23 | /* When the IuUP peer sent a voice packet, the clean RTP without the IuUP header is fed to this |
| 24 | * callback. */ |
Neels Hofmeyr | 3243c7c | 2018-09-30 05:01:20 +0200 | [diff] [blame] | 25 | osmo_iuup_data_cb_t rx_payload; |
| 26 | |
Neels Hofmeyr | 85f9401 | 2018-10-08 03:36:45 +0200 | [diff] [blame] | 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. */ |
Neels Hofmeyr | 3243c7c | 2018-09-30 05:01:20 +0200 | [diff] [blame] | 30 | osmo_iuup_data_cb_t tx_msg; |
| 31 | }; |
| 32 | |
| 33 | bool osmo_iuup_cn_is_iuup_init(struct msgb *msg); |
| 34 | |
| 35 | struct osmo_iuup_cn *osmo_iuup_cn_init(void *ctx, struct osmo_iuup_cn_cfg *cfg, |
| 36 | const char *name_fmt, ...); |
| 37 | void osmo_iuup_cn_free(struct osmo_iuup_cn *cn); |
| 38 | |
Neels Hofmeyr | 85f9401 | 2018-10-08 03:36:45 +0200 | [diff] [blame] | 39 | int osmo_iuup_cn_tx_payload(struct osmo_iuup_cn *cn, struct msgb *payload); |
Neels Hofmeyr | 3243c7c | 2018-09-30 05:01:20 +0200 | [diff] [blame] | 40 | |
Neels Hofmeyr | 85f9401 | 2018-10-08 03:36:45 +0200 | [diff] [blame] | 41 | int osmo_iuup_cn_rx_pdu(struct osmo_iuup_cn *cn, struct msgb *pdu); |