refactor: use msgb to receive, pass and send RTP packets
Instead of numerous arguments (buf, len and context data), use a msgb, like
most other osmo programs do, with a msb->cb pointing at a context data struct.
This opens the future for adding/stripping IuUP header data from the msgb
easily.
(Checked to pass current ttcn3-mgw-tests.)
Change-Id: I3af40b63bc49f8636d4e7ea2f8f83bb67f6619ee
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index ceae087..85e33e0 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -236,13 +236,15 @@
{
struct mgcp_conn_rtp *conn = data;
struct mgcp_endpoint *endp = conn->conn->endp;
- struct sockaddr_in addr = {
- .sin_addr = conn->end.addr,
- .sin_port = conn->end.rtp_port,
- }; /* FIXME: not set/used in cb */
+ struct sockaddr_in addr = { /* FIXME: do we know the source address?? */ };
+ struct osmo_rtp_msg_ctx *mc = OSMO_RTP_MSG_CTX(msg);
+ *mc = (struct osmo_rtp_msg_ctx){
+ .proto = MGCP_PROTO_RTP,
+ .conn_src = conn,
+ .from_addr = &addr,
+ };
-
- endp->type->dispatch_rtp_cb(MGCP_PROTO_RTP, &addr, (char *)msg->data, msg->len, conn->conn);
+ endp->type->dispatch_rtp_cb(msg);
msgb_free(msg);
}