# HG changeset patch # User Mychaela Falconia # Date 1720490186 0 # Node ID c0ce22777694256f0a56cedd63ee26008af65145 # Parent fc77c348208455f02d940da90ceb476af2d722d2 add helper functions for DSCP and socket priority diff -r fc77c3482084 -r c0ce22777694 include/endp.h --- a/include/endp.h Tue Jul 09 01:00:27 2024 +0000 +++ b/include/endp.h Tue Jul 09 01:56:26 2024 +0000 @@ -98,3 +98,6 @@ const char *name, const char *email, const char *phone, const char *loc, const char *tool, const char *note); int twrtp_endp_send_rtcp_rr(struct twrtp_endp *endp); + +int twrtp_endp_set_dscp(struct twrtp_endp *endp, uint8_t dscp); +int twrtp_endp_set_socket_prio(struct twrtp_endp *endp, int prio); diff -r fc77c3482084 -r c0ce22777694 src/Makefile --- a/src/Makefile Tue Jul 09 01:00:27 2024 +0000 +++ b/src/Makefile Tue Jul 09 01:56:26 2024 +0000 @@ -1,6 +1,6 @@ OBJS= bind_fdpair.o endp_bind.o endp_create.o endp_register.o rtcp_rx.o \ - rtcp_tx.o rtp_rx.o rtp_tx.o set_remote.o set_sdes.o twjit.o twjit_in.o \ - twjit_out.o twjit_vty.o + rtcp_tx.o rtp_rx.o rtp_tx.o set_dscp_prio.o set_remote.o set_sdes.o \ + twjit.o twjit_in.o twjit_out.o twjit_vty.o LIB= libtwrtp.a include ../config.defs diff -r fc77c3482084 -r c0ce22777694 src/set_dscp_prio.c --- /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 + +#include + +#include + +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); +}