FreeCalypso > hg > themwi-rtp-lib
annotate 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 |
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 } |