Neels Hofmeyr has submitted this change and it was merged. ( 
https://gerrit.osmocom.org/10751 )

Change subject: mgcp_common: rename to MGCP_CONN_ID_MAXLEN
......................................................................

mgcp_common: rename to MGCP_CONN_ID_MAXLEN

So far, MGCP_CONN_ID_LENGTH was often used as exactly the length of the
Connection Identifier. To indicate this length as a maximum, introduce the
MGCP_CONN_ID_MAXLEN and use it everywhere. Keep the old name as an alias.

Change-Id: I1117003c7614e98535d5c201d002e459c01bdc3f
---
M include/osmocom/mgcp/mgcp_common.h
M include/osmocom/mgcp/mgcp_internal.h
M include/osmocom/mgcp_client/mgcp_client.h
M src/libosmo-mgcp-client/mgcp_client_fsm.c
M src/libosmo-mgcp/mgcp_conn.c
M src/libosmo-mgcp/mgcp_msg.c
6 files changed, 11 insertions(+), 8 deletions(-)

Approvals:
  Jenkins Builder: Verified
  Harald Welte: Looks good to me, approved



diff --git a/include/osmocom/mgcp/mgcp_common.h 
b/include/osmocom/mgcp/mgcp_common.h
index b2c7370..a658f1c 100644
--- a/include/osmocom/mgcp/mgcp_common.h
+++ b/include/osmocom/mgcp/mgcp_common.h
@@ -79,9 +79,12 @@
 /* Maximum length of the comment field */
 #define MGCP_COMMENT_MAXLEN 256

-/* String length of Connection Identifiers
- * (see also RFC3435 2.1.3.2 Names of Connections) */
-#define MGCP_CONN_ID_LENGTH 32+1
+/* Maximum allowed String length of Connection Identifiers as per spec
+ * (see also RFC3435 2.1.3.2 Names of Connections), plus one for '\0'. */
+#define MGCP_CONN_ID_MAXLEN 32+1
+
+/* Deprecated: old name of MGCP_CONN_ID_MAXLEN. */
+#define MGCP_CONN_ID_LENGTH MGCP_CONN_ID_MAXLEN

 /* String length of Endpoint Identifiers.
 /  (see also RFC3435 section 3.2.1.3) */
diff --git a/include/osmocom/mgcp/mgcp_internal.h 
b/include/osmocom/mgcp/mgcp_internal.h
index 06883dd..f75ae8b 100644
--- a/include/osmocom/mgcp/mgcp_internal.h
+++ b/include/osmocom/mgcp/mgcp_internal.h
@@ -226,7 +226,7 @@
        enum mgcp_connection_mode mode_orig;

        /*! connection id to identify the connection */
-       char id[MGCP_CONN_ID_LENGTH];
+       char id[MGCP_CONN_ID_MAXLEN];

        /*! human readable name (vty, logging) */
        char name[256];
diff --git a/include/osmocom/mgcp_client/mgcp_client.h 
b/include/osmocom/mgcp_client/mgcp_client.h
index 6c478e8..79f2078 100644
--- a/include/osmocom/mgcp_client/mgcp_client.h
+++ b/include/osmocom/mgcp_client/mgcp_client.h
@@ -60,7 +60,7 @@
        int response_code;
        mgcp_trans_id_t trans_id;
        char comment[MGCP_COMMENT_MAXLEN];
-       char conn_id[MGCP_CONN_ID_LENGTH];
+       char conn_id[MGCP_CONN_ID_MAXLEN];
        char endpoint[MGCP_ENDPOINT_MAXLEN];
 };

diff --git a/src/libosmo-mgcp-client/mgcp_client_fsm.c 
b/src/libosmo-mgcp-client/mgcp_client_fsm.c
index 5368ec3..da900c5 100644
--- a/src/libosmo-mgcp-client/mgcp_client_fsm.c
+++ b/src/libosmo-mgcp-client/mgcp_client_fsm.c
@@ -41,7 +41,7 @@
        bool mgw_trans_pending;

        /* Connection ID which has been assigned by he MGW */
-       char conn_id[MGCP_CONN_ID_LENGTH];
+       char conn_id[MGCP_CONN_ID_MAXLEN];

        /* Local RTP connection info, the MGW will send outgoing traffic to the
         * ip/port specified here. The Address does not have to be choosen right
diff --git a/src/libosmo-mgcp/mgcp_conn.c b/src/libosmo-mgcp/mgcp_conn.c
index 3a5db0f..2a45b81 100644
--- a/src/libosmo-mgcp/mgcp_conn.c
+++ b/src/libosmo-mgcp/mgcp_conn.c
@@ -78,7 +78,7 @@
                /* ensure that the generated conn_id is unique
                 * for this endpoint */
                if (!mgcp_conn_get_rtp(endp, id_hex)) {
-                       osmo_strlcpy(id, id_hex, MGCP_CONN_ID_LENGTH);
+                       osmo_strlcpy(id, id_hex, MGCP_CONN_ID_MAXLEN);
                        return 0;
                }
        }
diff --git a/src/libosmo-mgcp/mgcp_msg.c b/src/libosmo-mgcp/mgcp_msg.c
index a7c8b47..49d0380 100644
--- a/src/libosmo-mgcp/mgcp_msg.c
+++ b/src/libosmo-mgcp/mgcp_msg.c
@@ -450,7 +450,7 @@
        }

        /* Check for over long connection identifiers */
-       if (strlen(conn_id) > MGCP_CONN_ID_LENGTH) {
+       if (strlen(conn_id) > MGCP_CONN_ID_MAXLEN) {
                LOGP(DLMGCP, LOGL_ERROR,
                     "endpoint:0x%x invalid ConnectionIdentifier (too long) 
0x%s\n",
                     ENDPOINT_NUMBER(endp), conn_id);

--
To view, visit https://gerrit.osmocom.org/10751
To unsubscribe, or for help writing mail filters, visit 
https://gerrit.osmocom.org/settings

Gerrit-Project: osmo-mgw
Gerrit-Branch: master
Gerrit-MessageType: merged
Gerrit-Change-Id: I1117003c7614e98535d5c201d002e459c01bdc3f
Gerrit-Change-Number: 10751
Gerrit-PatchSet: 1
Gerrit-Owner: Neels Hofmeyr <nhofm...@sysmocom.de>
Gerrit-Reviewer: Harald Welte <lafo...@gnumonks.org>
Gerrit-Reviewer: Jenkins Builder (1000002)
Gerrit-Reviewer: Neels Hofmeyr <nhofm...@sysmocom.de>

Reply via email to