view src/set_dscp_prio.c @ 37:8f1700a42ca5 default tip

set_remote: add functions for IPv6 and for sockaddr_{in,in6} A convenient way to pass in remote end address as struct sockaddr_in is needed for tw-border-mgw; IPv6 support will be needed in order to bring twrtp_endp into Osmocom mainline.
author Mychaela Falconia <falcon@freecalypso.org>
date Sat, 23 Nov 2024 19:08:28 +0000
parents c0ce22777694
children
line wrap: on
line source

/*
 * Wrapper functions for setting DSCP and socket priority
 * on both RTP and RTCP sockets.
 */

#include <stdint.h>

#include <osmocom/core/socket.h>

#include <themwi/rtp/endp.h>

int twrtp_endp_set_dscp(struct twrtp_endp *endp, uint8_t dscp)
{
	int rc;

	rc = osmo_sock_set_dscp(endp->rtp_fd, dscp);
	if (rc < 0)
		return rc;
	return osmo_sock_set_dscp(endp->rtcp_fd, dscp);
}

int twrtp_endp_set_socket_prio(struct twrtp_endp *endp, int prio)
{
	int rc;

	rc = osmo_sock_set_priority(endp->rtp_fd, prio);
	if (rc < 0)
		return rc;
	return osmo_sock_set_priority(endp->rtcp_fd, prio);
}