osmux: add 'osmux batch-size NUM' option to mgcp vty

This allows you to specify the osmux batch frame size. If zero, the
library uses the default value.
This commit is contained in:
Pablo Neira Ayuso 2014-08-29 12:30:38 +02:00
parent 308d5f8912
commit 03ab79abac
3 changed files with 16 additions and 0 deletions

View File

@ -217,6 +217,8 @@ struct mgcp_config {
int osmux_init;
/* osmux batch factor: from 1 to 4 maximum */
int osmux_batch;
/* osmux batch size (in bytes) */
int osmux_batch_size;
/* osmux port */
uint16_t osmux_port;
};

View File

@ -121,6 +121,8 @@ osmux_handle_alloc(struct mgcp_config *cfg, struct in_addr *addr, int rem_port)
h->in->osmux_seq = 0; /* sequence number to start OSmux message from */
h->in->batch_factor = cfg->osmux_batch;
/* If batch size is zero, the library defaults to 1470 bytes. */
h->in->batch_size = cfg->osmux_batch_size;
h->in->deliver = osmux_deliver;
osmux_xfrm_input_init(h->in);
h->in->data = h;

View File

@ -135,6 +135,8 @@ static int config_write_mgcp(struct vty *vty)
g_cfg->osmux == 1 ? "on" : "off", VTY_NEWLINE);
vty_out(vty, " osmux batch-factor %d%s",
g_cfg->osmux_batch, VTY_NEWLINE);
vty_out(vty, " osmux batch-size %u%s",
g_cfg->osmux_batch_size, VTY_NEWLINE);
vty_out(vty, " osmux port %u%s",
g_cfg->osmux_port, VTY_NEWLINE);
@ -1134,6 +1136,15 @@ DEFUN(cfg_mgcp_osmux_batch_factor,
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_osmux_batch_size,
cfg_mgcp_osmux_batch_size_cmd,
"osmux batch-size <1-65535>",
OSMUX_STR "batch size\n" "Batch size in bytes\n")
{
g_cfg->osmux_batch_size = atoi(argv[0]);
return CMD_SUCCESS;
}
DEFUN(cfg_mgcp_osmux_port,
cfg_mgcp_osmux_port_cmd,
"osmux port <1-65535>",
@ -1198,6 +1209,7 @@ int mgcp_vty_init(void)
install_element(MGCP_NODE, &cfg_mgcp_no_sdp_payload_send_ptime_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_factor_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_batch_size_cmd);
install_element(MGCP_NODE, &cfg_mgcp_osmux_port_cmd);
install_element(MGCP_NODE, &cfg_mgcp_trunk_cmd);