[PATCH] mncc: Introduce a hello packet that is sent to the client.

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/OpenBSC@lists.osmocom.org/.

Holger Hans Peter Freyther zecke at selfish.org
Fri Oct 21 12:12:46 UTC 2011


Send a hello packet down to the client with the version number
of the MNCC interface. The hello structure might be extended to
include the endianes, size of each structure, etc.
---
 openbsc/include/openbsc/mncc.h |    8 ++++++++
 openbsc/src/libmsc/mncc_sock.c |   24 ++++++++++++++++++++++++
 2 files changed, 32 insertions(+), 0 deletions(-)

diff --git a/openbsc/include/openbsc/mncc.h b/openbsc/include/openbsc/mncc.h
index 8c59fe2..9153d65 100644
--- a/openbsc/include/openbsc/mncc.h
+++ b/openbsc/include/openbsc/mncc.h
@@ -96,6 +96,8 @@ struct gsm_call {
 #define GSM_TCHF_FRAME		0x0300
 #define GSM_TCHF_FRAME_EFR	0x0301
 
+#define MNCC_SOCKET_HELLO	0x0400
+
 #define GSM_MAX_FACILITY	128
 #define GSM_MAX_SSVERSION	128
 #define GSM_MAX_USERUSER	128
@@ -158,6 +160,12 @@ struct gsm_data_frame {
 	unsigned char	data[0];
 };
 
+#define MNCC_SOCK_VERSION	1
+struct gsm_mncc_hello {
+	uint32_t	msg_type;
+	uint32_t	version;
+};
+
 char *get_mncc_name(int value);
 void mncc_set_cause(struct gsm_mncc *data, int loc, int val);
 void cc_tx_to_mncc(struct gsm_network *net, struct msgb *msg);
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c
index d8caf07..b9ebdb0 100644
--- a/openbsc/src/libmsc/mncc_sock.c
+++ b/openbsc/src/libmsc/mncc_sock.c
@@ -213,6 +213,29 @@ static int mncc_sock_cb(struct osmo_fd *bfd, unsigned int flags)
 	return rc;
 }
 
+/**
+ * Send a version indication to the remote.
+ */
+static void queue_hello(struct mncc_sock_state *mncc)
+{
+	struct gsm_mncc_hello *hello;
+	struct msgb *msg;
+
+	msg = msgb_alloc(512, "mncc hello");
+	if (!msg) {
+		LOGP(DMNCC, LOGL_ERROR, "Failed to allocate hello.\n");
+		mncc_sock_close(mncc);
+		return;
+	}
+
+	hello = (struct gsm_mncc_hello *) msgb_put(msg, sizeof(*hello));
+	hello->msg_type = MNCC_SOCKET_HELLO;
+	hello->version = MNCC_SOCK_VERSION;
+
+	msgb_enqueue(&mncc->net->upqueue, msg);
+	mncc->conn_bfd.when |= BSC_FD_WRITE;
+}
+
 /* accept a new connection */
 static int mncc_sock_accept(struct osmo_fd *bfd, unsigned int flags)
 {
@@ -253,6 +276,7 @@ static int mncc_sock_accept(struct osmo_fd *bfd, unsigned int flags)
 	LOGP(DMNCC, LOGL_NOTICE, "MNCC Socket has connection with external "
 		"call control application\n");
 
+	queue_hello(state);
 	return 0;
 }
 
-- 
1.7.5.4


--------------020402070302030203020301
Content-Type: text/x-patch;
 name="0001-gsm-Verify-the-MNCC_VERSION-of-the-BSC-MS-and-close-.patch"
Content-Transfer-Encoding: 7bit
Content-Disposition: attachment;
 filename*0="0001-gsm-Verify-the-MNCC_VERSION-of-the-BSC-MS-and-close-.pa";
 filename*1="tch"



More information about the OpenBSC mailing list