osmux: Rename field osmux usage policy and define it with proper type
Change-Id: I7f41a443f488b75df792597ec3cec8f7e97a7411
This commit is contained in:
parent
b9022497d8
commit
928a20b540
|
@ -29,6 +29,7 @@
|
||||||
#include <osmocom/core/logging.h>
|
#include <osmocom/core/logging.h>
|
||||||
|
|
||||||
#include <osmocom/mgcp/mgcp_common.h>
|
#include <osmocom/mgcp/mgcp_common.h>
|
||||||
|
#include <osmocom/mgcp/osmux.h>
|
||||||
|
|
||||||
#include <arpa/inet.h>
|
#include <arpa/inet.h>
|
||||||
#include <sys/types.h>
|
#include <sys/types.h>
|
||||||
|
@ -156,8 +157,8 @@ struct mgcp_config {
|
||||||
|
|
||||||
enum mgcp_role role;
|
enum mgcp_role role;
|
||||||
|
|
||||||
/* osmux translator: 0 means disabled, 1 means enabled */
|
/* Osmux usage policy: */
|
||||||
int osmux;
|
enum osmux_usage osmux_use;
|
||||||
/* addr to bind the server to */
|
/* addr to bind the server to */
|
||||||
char osmux_addr[INET6_ADDRSTRLEN];
|
char osmux_addr[INET6_ADDRSTRLEN];
|
||||||
/* The BSC-NAT may ask for enabling osmux on demand. This tells us if
|
/* The BSC-NAT may ask for enabling osmux on demand. This tells us if
|
||||||
|
|
|
@ -9,6 +9,10 @@ enum {
|
||||||
OSMUX_ROLE_BSC_NAT,
|
OSMUX_ROLE_BSC_NAT,
|
||||||
};
|
};
|
||||||
|
|
||||||
|
struct mgcp_trunk;
|
||||||
|
struct mgcp_endpoint;
|
||||||
|
struct mgcp_conn_rtp;
|
||||||
|
|
||||||
int osmux_init(int role, struct mgcp_trunk *trunk);
|
int osmux_init(int role, struct mgcp_trunk *trunk);
|
||||||
int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn,
|
int osmux_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn,
|
||||||
const struct osmo_sockaddr *addr);
|
const struct osmo_sockaddr *addr);
|
||||||
|
|
|
@ -394,7 +394,7 @@ static int osmux_read_fd_cb(struct osmo_fd *ofd, unsigned int what)
|
||||||
|
|
||||||
rate_ctr_inc(rate_ctr_group_get_ctr(all_rtp_stats, OSMUX_PACKETS_RX_CTR));
|
rate_ctr_inc(rate_ctr_group_get_ctr(all_rtp_stats, OSMUX_PACKETS_RX_CTR));
|
||||||
|
|
||||||
if (!trunk->cfg->osmux) {
|
if (trunk->cfg->osmux_use == OSMUX_USAGE_OFF) {
|
||||||
LOGP(DOSMUX, LOGL_ERROR,
|
LOGP(DOSMUX, LOGL_ERROR,
|
||||||
"bsc-nat wants to use Osmux but bsc did not request it\n");
|
"bsc-nat wants to use Osmux but bsc did not request it\n");
|
||||||
goto out;
|
goto out;
|
||||||
|
|
|
@ -893,7 +893,7 @@ static struct msgb *handle_create_con(struct mgcp_request_data *rq)
|
||||||
case 'X':
|
case 'X':
|
||||||
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
|
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
|
||||||
/* If osmux is disabled, just skip setting it up */
|
/* If osmux is disabled, just skip setting it up */
|
||||||
if (!rq->endp->trunk->cfg->osmux)
|
if (rq->endp->trunk->cfg->osmux_use == OSMUX_USAGE_OFF)
|
||||||
break;
|
break;
|
||||||
osmux_cid = mgcp_osmux_setup(endp, line);
|
osmux_cid = mgcp_osmux_setup(endp, line);
|
||||||
break;
|
break;
|
||||||
|
@ -1007,7 +1007,7 @@ mgcp_header_done:
|
||||||
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
|
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
|
||||||
goto error2;
|
goto error2;
|
||||||
}
|
}
|
||||||
} else if (endp->trunk->cfg->osmux == OSMUX_USAGE_ONLY) {
|
} else if (endp->trunk->cfg->osmux_use == OSMUX_USAGE_ONLY) {
|
||||||
LOGPCONN(_conn, DLMGCP, LOGL_ERROR,
|
LOGPCONN(_conn, DLMGCP, LOGL_ERROR,
|
||||||
"CRCX: osmux only and no osmux offered\n");
|
"CRCX: osmux only and no osmux offered\n");
|
||||||
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
|
rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, MGCP_CRCX_FAIL_NO_OSMUX));
|
||||||
|
@ -1174,7 +1174,7 @@ static struct msgb *handle_modify_con(struct mgcp_request_data *rq)
|
||||||
case 'X':
|
case 'X':
|
||||||
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
|
if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) == 0) {
|
||||||
/* If osmux is disabled, just skip setting it up */
|
/* If osmux is disabled, just skip setting it up */
|
||||||
if (!endp->trunk->cfg->osmux)
|
if (endp->trunk->cfg->osmux_use == OSMUX_USAGE_OFF)
|
||||||
break;
|
break;
|
||||||
osmux_cid = mgcp_osmux_setup(endp, line);
|
osmux_cid = mgcp_osmux_setup(endp, line);
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -99,7 +99,7 @@ static void mgcp_format_stats_rtp(char *str, size_t str_len,
|
||||||
str += nchars;
|
str += nchars;
|
||||||
str_len -= nchars;
|
str_len -= nchars;
|
||||||
|
|
||||||
if (conn->conn->endp->trunk->cfg->osmux != OSMUX_USAGE_OFF) {
|
if (conn->conn->endp->trunk->cfg->osmux_use != OSMUX_USAGE_OFF) {
|
||||||
/* Error Counter */
|
/* Error Counter */
|
||||||
nchars = snprintf(str, str_len,
|
nchars = snprintf(str, str_len,
|
||||||
"\r\nX-Osmo-CP: EC TI=%" PRIu64 ", TO=%" PRIu64,
|
"\r\nX-Osmo-CP: EC TI=%" PRIu64 ", TO=%" PRIu64,
|
||||||
|
|
|
@ -129,7 +129,7 @@ static int config_write_mgcp(struct vty *vty)
|
||||||
vty_out(vty, " rtp force-ptime %d%s", g_cfg->force_ptime,
|
vty_out(vty, " rtp force-ptime %d%s", g_cfg->force_ptime,
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
|
|
||||||
switch (g_cfg->osmux) {
|
switch (g_cfg->osmux_use) {
|
||||||
case OSMUX_USAGE_ON:
|
case OSMUX_USAGE_ON:
|
||||||
vty_out(vty, " osmux on%s", VTY_NEWLINE);
|
vty_out(vty, " osmux on%s", VTY_NEWLINE);
|
||||||
break;
|
break;
|
||||||
|
@ -141,7 +141,7 @@ static int config_write_mgcp(struct vty *vty)
|
||||||
vty_out(vty, " osmux off%s", VTY_NEWLINE);
|
vty_out(vty, " osmux off%s", VTY_NEWLINE);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
if (g_cfg->osmux) {
|
if (g_cfg->osmux_use != OSMUX_USAGE_OFF) {
|
||||||
vty_out(vty, " osmux bind-ip %s%s",
|
vty_out(vty, " osmux bind-ip %s%s",
|
||||||
g_cfg->osmux_addr, VTY_NEWLINE);
|
g_cfg->osmux_addr, VTY_NEWLINE);
|
||||||
vty_out(vty, " osmux batch-factor %d%s",
|
vty_out(vty, " osmux batch-factor %d%s",
|
||||||
|
@ -350,7 +350,7 @@ static int mgcp_show(struct vty *vty, int argc, const char **argv,
|
||||||
llist_for_each_entry(trunk, &g_cfg->trunks, entry)
|
llist_for_each_entry(trunk, &g_cfg->trunks, entry)
|
||||||
dump_trunk(vty, trunk, show_stats, active_only);
|
dump_trunk(vty, trunk, show_stats, active_only);
|
||||||
|
|
||||||
if (g_cfg->osmux)
|
if (g_cfg->osmux_use != OSMUX_USAGE_OFF)
|
||||||
vty_out(vty, "Osmux used CID: %d%s", osmux_cid_pool_count_used(),
|
vty_out(vty, "Osmux used CID: %d%s", osmux_cid_pool_count_used(),
|
||||||
VTY_NEWLINE);
|
VTY_NEWLINE);
|
||||||
|
|
||||||
|
@ -1547,12 +1547,12 @@ DEFUN(cfg_mgcp_osmux,
|
||||||
OSMO_ASSERT(trunk);
|
OSMO_ASSERT(trunk);
|
||||||
|
|
||||||
if (strcmp(argv[0], "off") == 0) {
|
if (strcmp(argv[0], "off") == 0) {
|
||||||
g_cfg->osmux = OSMUX_USAGE_OFF;
|
g_cfg->osmux_use = OSMUX_USAGE_OFF;
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
} else if (strcmp(argv[0], "on") == 0)
|
} else if (strcmp(argv[0], "on") == 0)
|
||||||
g_cfg->osmux = OSMUX_USAGE_ON;
|
g_cfg->osmux_use = OSMUX_USAGE_ON;
|
||||||
else if (strcmp(argv[0], "only") == 0)
|
else if (strcmp(argv[0], "only") == 0)
|
||||||
g_cfg->osmux = OSMUX_USAGE_ONLY;
|
g_cfg->osmux_use = OSMUX_USAGE_ONLY;
|
||||||
|
|
||||||
return CMD_SUCCESS;
|
return CMD_SUCCESS;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue