static void mgcp_rtp_end_reset(struct mgcp_rtp_end *end) { if (end->local_alloc == PORT_ALLOC_DYNAMIC) { mgcp_free_rtp_port(end); end->local_port = 0; } end->packets = 0; memset(&end->addr, 0, sizeof(end->addr)); end->rtp_port = end->rtcp_port = 0; end->payload_type = -1; end->local_alloc = -1; }
static int int_bind(const char *port, struct mgcp_rtp_end *end, int (*cb)(struct osmo_fd *, unsigned), struct mgcp_endpoint *_endp, int rtp_port) { if (end->rtp.fd != -1 || end->rtcp.fd != -1) { LOGP(DMGCP, LOGL_ERROR, "Previous %s was still bound on %d\n", port, ENDPOINT_NUMBER(_endp)); mgcp_free_rtp_port(end); } end->local_port = rtp_port; end->rtp.cb = cb; end->rtp.data = _endp; end->rtcp.data = _endp; end->rtcp.cb = cb; return bind_rtp(_endp->cfg, end, ENDPOINT_NUMBER(_endp)); }