aboutsummaryrefslogtreecommitdiffstats
path: root/openbsc/src/libmsc/mncc_sock.c
diff options
context:
space:
mode:
authorHolger Hans Peter Freyther <zecke@selfish.org>2011-10-21 14:12:46 +0200
committerHolger Hans Peter Freyther <zecke@selfish.org>2011-11-06 21:49:18 +0100
commit347e7ba377d47aa4d585a627f0704055f31975e0 (patch)
tree06dbeae54356c303a9e9b97b0acfef2c3d7d1abf /openbsc/src/libmsc/mncc_sock.c
parent1491f2e7a9df870fb55eac1a229f59331c2242b3 (diff)
mncc: Introduce a hello packet that is sent to the client.
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.
Diffstat (limited to 'openbsc/src/libmsc/mncc_sock.c')
-rw-r--r--openbsc/src/libmsc/mncc_sock.c24
1 files changed, 24 insertions, 0 deletions
diff --git a/openbsc/src/libmsc/mncc_sock.c b/openbsc/src/libmsc/mncc_sock.c
index 7063f20e2..697f9560f 100644
--- a/openbsc/src/libmsc/mncc_sock.c
+++ b/openbsc/src/libmsc/mncc_sock.c
@@ -203,6 +203,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)
{
@@ -243,6 +266,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;
}