MME2 changes - Propped commits from openmme/paging branch. Added scripts
for code gen
Change-Id: Ie55032217232214ac8544ca76ea34335205329e4
diff --git a/src/s11/handlers/ddn_ack_handler.c b/src/s11/handlers/ddn_ack_handler.c
new file mode 100644
index 0000000..73a459a
--- /dev/null
+++ b/src/s11/handlers/ddn_ack_handler.c
@@ -0,0 +1,95 @@
+/*
+ * Copyright (c) 2003-2018, Great Software Laboratory Pvt. Ltd.
+ * Copyright (c) 2017 Intel Corporation
+ * Copyright (c) 2019, Infosys Ltd.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <arpa/inet.h>
+#include <unistd.h>
+#include <string.h>
+#include <pthread.h>
+
+#include "log.h"
+#include "err_codes.h"
+#include "message_queues.h"
+#include "ipc_api.h"
+#include "gtpv2c.h"
+#include "gtpv2c_ie.h"
+#include "msgType.h"
+#include "../../gtpV2Codec/gtpV2StackWrappers.h"
+
+
+/****Globals and externs ***/
+
+/*S11 CP communication parameters*/
+extern int g_s11_fd;
+extern struct sockaddr_in g_s11_cp_addr;
+extern socklen_t g_s11_serv_size;
+extern volatile uint32_t g_s11_sequence;
+static char buf[S11_DDN_ACK_BUF_SIZE];
+
+struct thread_pool *g_tpool;
+
+extern struct GtpV2Stack* gtpStack_gp;
+extern volatile uint32_t g_s11_sequence;
+
+struct MsgBuffer* ddnAckMsgBuf_p = NULL;
+/****Global and externs end***/
+
+/**
+* Stage specific message processing.
+*/
+static int
+ddn_ack_processing(struct DDN_ACK_Q_msg *ddn_ack_msg)
+{
+ GtpV2MessageHeader gtpHeader;
+ gtpHeader.msgType = 177;
+ gtpHeader.sequenceNumber = ddn_ack_msg->seq_no;
+ gtpHeader.teidPresent = true;
+ gtpHeader.teid = ddn_ack_msg->ue_idx;
+
+ DownlinkDataNotificationAcknowledgeMsgData msgData;
+ memset(&msgData, 0, sizeof(DownlinkDataNotificationAcknowledgeMsgData));
+
+ msgData.cause.causeValue = ddn_ack_msg->cause;
+
+
+ GtpV2Stack_buildGtpV2Message(gtpStack_gp, ddnAckMsgBuf_p, >pHeader, &msgData);
+ g_s11_sequence++;
+
+ sendto(g_s11_fd,
+ MsgBuffer_getDataPointer(ddnAckMsgBuf_p),
+ MsgBuffer_getBufLen(ddnAckMsgBuf_p), 0,
+ (struct sockaddr*)&g_s11_cp_addr, g_s11_serv_size);
+
+ log_msg(LOG_INFO, "DDN Ack Sent, len - %d bytes.\n", MsgBuffer_getBufLen(ddnAckMsgBuf_p));
+ MsgBuffer_reset(ddnAckMsgBuf_p);
+ return SUCCESS;
+}
+
+
+/**
+* Thread function for stage.
+*/
+void*
+ddn_ack_handler(void *data)
+{
+ log_msg(LOG_INFO, "DDN Ack handler initialized\n");
+ ddn_ack_processing((struct DDN_ACK_Q_msg *)data);
+ return NULL;
+}
+