FreeCalypso > hg > themwi-rtp-lib
annotate src/endp_bind.c @ 43:8cdfef36d9db default tip
twrtp_endp_create: make config argument const
This argument is passed through to twrtp_jibuf_create(). We made it
const in the latter function, now do the same with the wrapper.
author | Mychaela Falconia <falcon@freecalypso.org> |
---|---|
date | Fri, 20 Dec 2024 23:01:06 +0000 |
parents | 2032201bd034 |
children |
rev | line source |
---|---|
21
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
1 /* |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
2 * Here we implement the wrapper function that first obtains a pair of fds |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
3 * bound to IP & port for RTP & RTCP, then registers them with twrtp_endp. |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
4 */ |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
5 |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
6 #include <stdint.h> |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
7 #include <stdbool.h> |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
8 #include <errno.h> |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
9 |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
10 #include <themwi/rtp/endp.h> |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
11 #include <themwi/rtp/fdpair.h> |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
12 |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
13 int twrtp_endp_bind_ip_port(struct twrtp_endp *endp, const char *ip, |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
14 uint16_t port) |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
15 { |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
16 int rc; |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
17 |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
18 if (endp->register_done) |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
19 return -EBUSY; |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
20 |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
21 rc = twrtp_bind_fdpair(ip, port, &endp->rtp_fd, &endp->rtcp_fd); |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
22 if (rc < 0) |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
23 return rc; |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
24 |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
25 return twrtp_endp_register_fds(endp); |
2032201bd034
implement twrtp_endp_bind_ip_port()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff
changeset
|
26 } |