diff src/set_dscp_prio.c @ 35:c0ce22777694

add helper functions for DSCP and socket priority
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 09 Jul 2024 01:56:26 +0000
parents
children
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/set_dscp_prio.c	Tue Jul 09 01:56:26 2024 +0000
@@ -0,0 +1,30 @@
+/*
+ * 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);
+}