view src/endp_bind.c @ 42:334d883b96ba

twrtp_jibuf_create: make config argument const While this config structure is not a constant in the mathematical sense of the term (it is expected that vty config changes may happen while twjit instance is alive), twjit functions never write to it, only read, hence it is 'const' in the not-quite-mathematical C-standard sense.
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 20 Dec 2024 22:47:20 +0000
parents 2032201bd034
children
line wrap: on
line source

/*
 * Here we implement the wrapper function that first obtains a pair of fds
 * bound to IP & port for RTP & RTCP, then registers them with twrtp_endp.
 */

#include <stdint.h>
#include <stdbool.h>
#include <errno.h>

#include <themwi/rtp/endp.h>
#include <themwi/rtp/fdpair.h>

int twrtp_endp_bind_ip_port(struct twrtp_endp *endp, const char *ip,
			    uint16_t port)
{
	int rc;

	if (endp->register_done)
		return -EBUSY;

	rc = twrtp_bind_fdpair(ip, port, &endp->rtp_fd, &endp->rtcp_fd);
	if (rc < 0)
		return rc;

	return twrtp_endp_register_fds(endp);
}