osmux: encapsulate for osmux state information in struct mgcp_endpoint
Just a cleanup, wrap around the osmux state information in a struct.
This commit is contained in:
parent
a4faeb1a79
commit
63650bbc5d
|
@ -173,10 +173,11 @@ struct mgcp_endpoint {
|
||||||
/* tap for the endpoint */
|
/* tap for the endpoint */
|
||||||
struct mgcp_rtp_tap taps[MGCP_TAP_COUNT];
|
struct mgcp_rtp_tap taps[MGCP_TAP_COUNT];
|
||||||
|
|
||||||
/* osmux is enabled/disabled */
|
struct {
|
||||||
int osmux;
|
int enable;
|
||||||
/* osmux internal to unbatch messages for this endpoint */
|
/* handle to unbatch messages */
|
||||||
struct osmux_out_handle osmux_out;
|
struct osmux_out_handle out;
|
||||||
|
} osmux;
|
||||||
};
|
};
|
||||||
|
|
||||||
#define ENDPOINT_NUMBER(endp) abs(endp - endp->tcfg->endpoints)
|
#define ENDPOINT_NUMBER(endp) abs(endp - endp->tcfg->endpoints)
|
||||||
|
|
|
@ -327,7 +327,8 @@ static struct msgb *create_response_with_sdp(struct mgcp_endpoint *endp,
|
||||||
len = snprintf(sdp_record, sizeof(sdp_record),
|
len = snprintf(sdp_record, sizeof(sdp_record),
|
||||||
"I: %u%s\n\n",
|
"I: %u%s\n\n",
|
||||||
endp->ci,
|
endp->ci,
|
||||||
endp->cfg->osmux && endp->osmux ? "\nX-Osmux: On" : "");
|
endp->cfg->osmux && endp->osmux.enable ?
|
||||||
|
"\nX-Osmux: On" : "");
|
||||||
|
|
||||||
if (len < 0)
|
if (len < 0)
|
||||||
return NULL;
|
return NULL;
|
||||||
|
@ -346,7 +347,7 @@ static struct msgb *create_response_with_sdp(struct mgcp_endpoint *endp,
|
||||||
|
|
||||||
static void send_dummy(struct mgcp_endpoint *endp)
|
static void send_dummy(struct mgcp_endpoint *endp)
|
||||||
{
|
{
|
||||||
if (endp->osmux)
|
if (endp->osmux.enable)
|
||||||
osmux_send_dummy(endp);
|
osmux_send_dummy(endp);
|
||||||
else
|
else
|
||||||
mgcp_send_dummy(endp);
|
mgcp_send_dummy(endp);
|
||||||
|
|
|
@ -272,7 +272,7 @@ int osmux_read_from_bsc_nat_cb(struct osmo_fd *ofd, unsigned int what)
|
||||||
"sending extracted RTP from OSMUX to BSC via endpoint=%u "
|
"sending extracted RTP from OSMUX to BSC via endpoint=%u "
|
||||||
"(allocated=%d)\n", ENDPOINT_NUMBER(endp), endp->allocated);
|
"(allocated=%d)\n", ENDPOINT_NUMBER(endp), endp->allocated);
|
||||||
|
|
||||||
osmux_xfrm_output(osmuxh, &endp->osmux_out, &list);
|
osmux_xfrm_output(osmuxh, &endp->osmux.out, &list);
|
||||||
osmux_tx_sched(&list, scheduled_tx_bts_cb, endp);
|
osmux_tx_sched(&list, scheduled_tx_bts_cb, endp);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
@ -360,7 +360,7 @@ int osmux_read_from_bsc_cb(struct osmo_fd *ofd, unsigned int what)
|
||||||
"sending extracted RTP from OSMUX to MSC via endpoint=%u "
|
"sending extracted RTP from OSMUX to MSC via endpoint=%u "
|
||||||
"(allocated=%d)\n", ENDPOINT_NUMBER(endp), endp->allocated);
|
"(allocated=%d)\n", ENDPOINT_NUMBER(endp), endp->allocated);
|
||||||
|
|
||||||
osmux_xfrm_output(osmuxh, &endp->osmux_out, &list);
|
osmux_xfrm_output(osmuxh, &endp->osmux.out, &list);
|
||||||
osmux_tx_sched(&list, scheduled_tx_net_cb, endp);
|
osmux_tx_sched(&list, scheduled_tx_net_cb, endp);
|
||||||
}
|
}
|
||||||
out:
|
out:
|
||||||
|
@ -423,7 +423,7 @@ int osmux_enable_endpoint(struct mgcp_endpoint *endp, int role)
|
||||||
LOGP(DMGCP, LOGL_NOTICE, "OSMUX requested, ENABLING.\n");
|
LOGP(DMGCP, LOGL_NOTICE, "OSMUX requested, ENABLING.\n");
|
||||||
}
|
}
|
||||||
|
|
||||||
osmux_xfrm_output_init(&endp->osmux_out,
|
osmux_xfrm_output_init(&endp->osmux.out,
|
||||||
(endp->ci * rtp_ssrc_winlen) +
|
(endp->ci * rtp_ssrc_winlen) +
|
||||||
(random() % rtp_ssrc_winlen));
|
(random() % rtp_ssrc_winlen));
|
||||||
|
|
||||||
|
@ -435,7 +435,7 @@ int osmux_enable_endpoint(struct mgcp_endpoint *endp, int role)
|
||||||
endp->type = MGCP_OSMUX_BSC;
|
endp->type = MGCP_OSMUX_BSC;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
endp->osmux = 1;
|
endp->osmux.enable = 1;
|
||||||
|
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue