comparison src/endp_bind.c @ 21:2032201bd034

implement twrtp_endp_bind_ip_port()
author Mychaela Falconia <falcon@freecalypso.org>
date Sun, 07 Jul 2024 04:17:18 +0000
parents
children
comparison
equal deleted inserted replaced
20:695fdb670d30 21:2032201bd034
1 /*
2 * Here we implement the wrapper function that first obtains a pair of fds
3 * bound to IP & port for RTP & RTCP, then registers them with twrtp_endp.
4 */
5
6 #include <stdint.h>
7 #include <stdbool.h>
8 #include <errno.h>
9
10 #include <themwi/rtp/endp.h>
11 #include <themwi/rtp/fdpair.h>
12
13 int twrtp_endp_bind_ip_port(struct twrtp_endp *endp, const char *ip,
14 uint16_t port)
15 {
16 int rc;
17
18 if (endp->register_done)
19 return -EBUSY;
20
21 rc = twrtp_bind_fdpair(ip, port, &endp->rtp_fd, &endp->rtcp_fd);
22 if (rc < 0)
23 return rc;
24
25 return twrtp_endp_register_fds(endp);
26 }