annotate src/set_remote.c @ 32:aa97e77e7de6

implement RTCP Tx
author Mychaela Falconia <falcon@freecalypso.org>
date Mon, 08 Jul 2024 07:17:38 +0000
parents 587437b62ed5
children 8f1700a42ca5
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
rev   line source
22
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
1 /*
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
2 * Here we implement functions for setting the remote end on themwi_endp,
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
3 * initially only IPv4, then possibly IPv6 in the future.
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
4 */
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
5
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
6 #include <sys/socket.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
7 #include <netinet/in.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
8 #include <arpa/inet.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
9 #include <stdint.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
10 #include <stdbool.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
11 #include <string.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
12
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
13 #include <themwi/rtp/endp.h>
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
14
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
15 void twrtp_endp_set_remote_ipv4(struct twrtp_endp *endp,
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
16 const struct in_addr *ip, uint16_t port)
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
17 {
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
18 endp->rtp_remote.u.sin.sin_family = AF_INET;
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
19 memcpy(&endp->rtp_remote.u.sin.sin_addr, ip, sizeof(struct in_addr));
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
20 endp->rtp_remote.u.sin.sin_port = htons(port);
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
21
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
22 endp->rtcp_remote.u.sin.sin_family = AF_INET;
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
23 memcpy(&endp->rtcp_remote.u.sin.sin_addr, ip, sizeof(struct in_addr));
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
24 endp->rtcp_remote.u.sin.sin_port = htons(port + 1);
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
25
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
26 endp->remote_set = true;
587437b62ed5 implement twrtp_endp_set_remote_ipv4()
Mychaela Falconia <falcon@freecalypso.org>
parents:
diff changeset
27 }