pespin has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-mgw/+/29462 )


Change subject: osmux: Rename field osmux usage policy and define it with 
proper type
......................................................................

osmux: Rename field osmux usage policy and define it with proper type

Change-Id: I7f41a443f488b75df792597ec3cec8f7e97a7411
---
M include/osmocom/mgcp/mgcp.h
M include/osmocom/mgcp/osmux.h
M src/libosmo-mgcp/mgcp_osmux.c
M src/libosmo-mgcp/mgcp_protocol.c
M src/libosmo-mgcp/mgcp_stat.c
M src/libosmo-mgcp/mgcp_vty.c
6 files changed, 18 insertions(+), 13 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-mgw refs/changes/62/29462/1

diff --git a/include/osmocom/mgcp/mgcp.h b/include/osmocom/mgcp/mgcp.h
index f1e6460..ee419ef 100644
--- a/include/osmocom/mgcp/mgcp.h
+++ b/include/osmocom/mgcp/mgcp.h
@@ -29,6 +29,7 @@
 #include <osmocom/core/logging.h>

 #include <osmocom/mgcp/mgcp_common.h>
+#include <osmocom/mgcp/osmux.h>

 #include <arpa/inet.h>
 #include <sys/types.h>
@@ -156,8 +157,8 @@

        enum mgcp_role role;

-       /* osmux translator: 0 means disabled, 1 means enabled */
-       int osmux;
+       /* Osmux usage policy: */
+       enum osmux_usage osmux_use;
        /* addr to bind the server to */
        char osmux_addr[INET6_ADDRSTRLEN];
        /* The BSC-NAT may ask for enabling osmux on demand. This tells us if
diff --git a/include/osmocom/mgcp/osmux.h b/include/osmocom/mgcp/osmux.h
index 736025b..26c1bdf 100644
--- a/include/osmocom/mgcp/osmux.h
+++ b/include/osmocom/mgcp/osmux.h
@@ -9,6 +9,10 @@
        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_enable_conn(struct mgcp_endpoint *endp, struct mgcp_conn_rtp *conn,
                      const struct osmo_sockaddr *addr);
diff --git a/src/libosmo-mgcp/mgcp_osmux.c b/src/libosmo-mgcp/mgcp_osmux.c
index 5647348..06dc705 100644
--- a/src/libosmo-mgcp/mgcp_osmux.c
+++ b/src/libosmo-mgcp/mgcp_osmux.c
@@ -394,7 +394,7 @@

        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,
                     "bsc-nat wants to use Osmux but bsc did not request it\n");
                goto out;
diff --git a/src/libosmo-mgcp/mgcp_protocol.c b/src/libosmo-mgcp/mgcp_protocol.c
index 74ed871..7f31cfd 100644
--- a/src/libosmo-mgcp/mgcp_protocol.c
+++ b/src/libosmo-mgcp/mgcp_protocol.c
@@ -893,7 +893,7 @@
                case 'X':
                        if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) 
== 0) {
                                /* 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;
                                osmux_cid = mgcp_osmux_setup(endp, line);
                                break;
@@ -1007,7 +1007,7 @@
                        rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, 
MGCP_CRCX_FAIL_NO_OSMUX));
                        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,
                         "CRCX: osmux only and no osmux offered\n");
                rate_ctr_inc(rate_ctr_group_get_ctr(rate_ctrs, 
MGCP_CRCX_FAIL_NO_OSMUX));
@@ -1174,7 +1174,7 @@
                case 'X':
                        if (strncasecmp("Osmux: ", line + 2, strlen("Osmux: ")) 
== 0) {
                                /* If osmux is disabled, just skip setting it 
up */
-                               if (!endp->trunk->cfg->osmux)
+                               if (endp->trunk->cfg->osmux_use == 
OSMUX_USAGE_OFF)
                                        break;
                                osmux_cid = mgcp_osmux_setup(endp, line);
                                break;
diff --git a/src/libosmo-mgcp/mgcp_stat.c b/src/libosmo-mgcp/mgcp_stat.c
index e63feac..acc9419 100644
--- a/src/libosmo-mgcp/mgcp_stat.c
+++ b/src/libosmo-mgcp/mgcp_stat.c
@@ -99,7 +99,7 @@
        str += 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 */
                nchars = snprintf(str, str_len,
                                  "\r\nX-Osmo-CP: EC TI=%" PRIu64 ", TO=%" 
PRIu64,
diff --git a/src/libosmo-mgcp/mgcp_vty.c b/src/libosmo-mgcp/mgcp_vty.c
index 5abbf0e..34c2d4b 100644
--- a/src/libosmo-mgcp/mgcp_vty.c
+++ b/src/libosmo-mgcp/mgcp_vty.c
@@ -129,7 +129,7 @@
                vty_out(vty, " rtp force-ptime %d%s", g_cfg->force_ptime,
                        VTY_NEWLINE);

-       switch (g_cfg->osmux) {
+       switch (g_cfg->osmux_use) {
        case OSMUX_USAGE_ON:
                vty_out(vty, " osmux on%s", VTY_NEWLINE);
                break;
@@ -141,7 +141,7 @@
                vty_out(vty, " osmux off%s", VTY_NEWLINE);
                break;
        }
-       if (g_cfg->osmux) {
+       if (g_cfg->osmux_use != OSMUX_USAGE_OFF) {
                vty_out(vty, " osmux bind-ip %s%s",
                        g_cfg->osmux_addr, VTY_NEWLINE);
                vty_out(vty, " osmux batch-factor %d%s",
@@ -350,7 +350,7 @@
        llist_for_each_entry(trunk, &g_cfg->trunks, entry)
                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_NEWLINE);

@@ -1547,12 +1547,12 @@
        OSMO_ASSERT(trunk);
 
        if (strcmp(argv[0], "off") == 0) {
-               g_cfg->osmux = OSMUX_USAGE_OFF;
+               g_cfg->osmux_use = OSMUX_USAGE_OFF;
                return CMD_SUCCESS;
        } 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)
-               g_cfg->osmux = OSMUX_USAGE_ONLY;
+               g_cfg->osmux_use = OSMUX_USAGE_ONLY;

        return CMD_SUCCESS;


--
To view, visit https://gerrit.osmocom.org/c/osmo-mgw/+/29462
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-Change-Id: I7f41a443f488b75df792597ec3cec8f7e97a7411
Gerrit-Change-Number: 29462
Gerrit-PatchSet: 1
Gerrit-Owner: pespin <[email protected]>
Gerrit-MessageType: newchange

Reply via email to