annotate 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
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
35
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Wrapper functions for setting DSCP and socket priority
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * on both RTP and RTCP sockets.
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <stdint.h>
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <osmocom/core/socket.h>
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <themwi/rtp/endp.h>
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12 int twrtp_endp_set_dscp(struct twrtp_endp *endp, uint8_t dscp)
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 {
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14 int rc;
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 rc = osmo_sock_set_dscp(endp->rtp_fd, dscp);
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 if (rc < 0)
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 return rc;
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 return osmo_sock_set_dscp(endp->rtcp_fd, dscp);
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 }
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 int twrtp_endp_set_socket_prio(struct twrtp_endp *endp, int prio)
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 {
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 int rc;
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 rc = osmo_sock_set_priority(endp->rtp_fd, prio);
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 if (rc < 0)
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
28 return rc;
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
29 return osmo_sock_set_priority(endp->rtcp_fd, prio);
c0ce22777694 add helper functions for DSCP and socket priority
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
30 }