neels has uploaded this change for review. ( 
https://gerrit.osmocom.org/c/osmo-msc/+/15948 )


Change subject: MNCC: add optional SDP to the socket protocol
......................................................................

MNCC: add optional SDP to the socket protocol

Add a char buffer of 1024 characters length as space for SDP to pass to /
receive from MNCC.

Actually support receiving MNCC without such an SDP tail. The main reason for
this is to avoid the need to adjust the ttcn3 implementation of MNCC: it would
stop working for older osmo-msc.

Older or non-SIP MNCC peers could operate the previous MNCC protocol unchanged
(save the protocol number bump) without having to implement SDP.

The SDP part in the MNCC protocol will be used in upcoming patch
I8c3b2de53ffae4ec3a66b9dabf308c290a2c999f.

Change-Id: Ie16f0804c4d99760cd4a0c544d0889b6313eebb7
---
M include/osmocom/msc/mncc.h
M src/libmsc/mncc.c
2 files changed, 11 insertions(+), 3 deletions(-)



  git pull ssh://gerrit.osmocom.org:29418/osmo-msc refs/changes/48/15948/1

diff --git a/include/osmocom/msc/mncc.h b/include/osmocom/msc/mncc.h
index 28ee9b3..2297b54 100644
--- a/include/osmocom/msc/mncc.h
+++ b/include/osmocom/msc/mncc.h
@@ -159,6 +159,9 @@

        unsigned char   lchan_type;
        unsigned char   lchan_mode;
+
+       /* A buffer to contain SDP ('\0' terminated) */
+       char            sdp[1024];
 };

 struct gsm_data_frame {
@@ -167,7 +170,7 @@
        unsigned char   data[0];
 };

-#define MNCC_SOCK_VERSION      5
+#define MNCC_SOCK_VERSION      6
 struct gsm_mncc_hello {
        uint32_t        msg_type;
        uint32_t        version;
@@ -190,6 +193,7 @@
        uint16_t        port;
        uint32_t        payload_type;
        uint32_t        payload_msg_type;
+       char            sdp[1024];
 };

 struct gsm_mncc_bridge {
diff --git a/src/libmsc/mncc.c b/src/libmsc/mncc.c
index d0b2ff2..3d17ab9 100644
--- a/src/libmsc/mncc.c
+++ b/src/libmsc/mncc.c
@@ -262,7 +262,9 @@
        case MNCC_RTP_FREE:
        case MNCC_RTP_CONNECT:
        case MNCC_RTP_CREATE:
-               if (len < sizeof(struct gsm_mncc_rtp)) {
+               /* Should we receive an MNCC message without SDP, the 
zero-initialized msgb will guarantee that the
+                * char sdp[] starts with a '\0'. */
+               if (len < offsetof(struct gsm_mncc_rtp, sdp)) {
                        LOGP(DMNCC, LOGL_ERROR, "Short MNCC RTP\n");
                        return -EINVAL;
                }
@@ -279,7 +281,9 @@
                }
                break;
        default:
-               if (len < sizeof(struct gsm_mncc)) {
+               /* Should we receive an MNCC message without SDP, the 
zero-initialized msgb will guarantee that the
+                * char sdp[] starts with a '\0'. */
+               if (len < offsetof(struct gsm_mncc, sdp)) {
                        LOGP(DMNCC, LOGL_ERROR, "Short MNCC Signalling\n");
                        return -EINVAL;
                }

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

Gerrit-Project: osmo-msc
Gerrit-Branch: master
Gerrit-Change-Id: Ie16f0804c4d99760cd4a0c544d0889b6313eebb7
Gerrit-Change-Number: 15948
Gerrit-PatchSet: 1
Gerrit-Owner: neels <nhofm...@sysmocom.de>
Gerrit-MessageType: newchange

Reply via email to