From b900880d47168f652425d7ecfa143b896583e846 Mon Sep 17 00:00:00 2001
From: Cedric Roux <cedric.roux@eurecom.fr>
Date: Thu, 28 Nov 2013 16:45:37 +0000
Subject: [PATCH] - handle TERMINATE_MESSAGE in EPC layers

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4547 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/GTPV1-U/gtpv1u_task.c         | 3 +++
 openair-cn/NAS/nas_main.c                | 3 +++
 openair-cn/S1AP/s1ap_mme.c               | 3 +++
 openair-cn/S6A/s6a_task.c                | 3 +++
 openair-cn/SCTP/sctp_primitives_server.c | 7 +++++--
 openair-cn/SGI/sgi_util.c                | 1 +
 openair-cn/SGW-LITE/sgw_lite_task.c      | 4 ++++
 openair-cn/UDP/udp_primitives_server.c   | 3 +++
 8 files changed, 25 insertions(+), 2 deletions(-)

diff --git a/openair-cn/GTPV1-U/gtpv1u_task.c b/openair-cn/GTPV1-U/gtpv1u_task.c
index c29615813a..66a4bc28c2 100644
--- a/openair-cn/GTPV1-U/gtpv1u_task.c
+++ b/openair-cn/GTPV1-U/gtpv1u_task.c
@@ -449,6 +449,9 @@ static void *gtpv1u_thread(void *args)
                 free(data_req_p->buffer);
             }
             break;
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
+            } break;
             case TIMER_HAS_EXPIRED:
                 nwGtpv1uProcessTimeout(&received_message_p->ittiMsg.timer_has_expired.arg);
                 break;
diff --git a/openair-cn/NAS/nas_main.c b/openair-cn/NAS/nas_main.c
index e0c87d6ec9..1f03ad5f1f 100644
--- a/openair-cn/NAS/nas_main.c
+++ b/openair-cn/NAS/nas_main.c
@@ -79,6 +79,9 @@ next_message:
 
                 itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
             } break;
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
+            } break;
             default: {
                 NAS_DEBUG("Unkwnon message ID %d:%s\n",
                           ITTI_MSG_ID(received_message_p),
diff --git a/openair-cn/S1AP/s1ap_mme.c b/openair-cn/S1AP/s1ap_mme.c
index 1fa2d9aa12..49104b89f3 100644
--- a/openair-cn/S1AP/s1ap_mme.c
+++ b/openair-cn/S1AP/s1ap_mme.c
@@ -144,6 +144,9 @@ void *s1ap_mme_thread(void *args)
             case TIMER_HAS_EXPIRED: {
                 s1ap_handle_timer_expiry(&received_message_p->ittiMsg.timer_has_expired);
             } break;
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
+            } break;
             default: {
                 S1AP_DEBUG("Unkwnon message ID %d:%s\n",
                            ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
diff --git a/openair-cn/S6A/s6a_task.c b/openair-cn/S6A/s6a_task.c
index 88ca771a90..9be11e8f4d 100644
--- a/openair-cn/S6A/s6a_task.c
+++ b/openair-cn/S6A/s6a_task.c
@@ -86,6 +86,9 @@ void *s6a_thread(void *args)
             case S6A_AUTH_INFO_REQ: {
                 s6a_generate_authentication_info_req(&received_message_p->ittiMsg.s6a_auth_info_req);
             } break;
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
+            } break;
             default: {
                 S6A_DEBUG("Unkwnon message ID %d:%s\n",
                           ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
diff --git a/openair-cn/SCTP/sctp_primitives_server.c b/openair-cn/SCTP/sctp_primitives_server.c
index 7ce91c042f..467319803c 100644
--- a/openair-cn/SCTP/sctp_primitives_server.c
+++ b/openair-cn/SCTP/sctp_primitives_server.c
@@ -612,8 +612,11 @@ static void *sctp_intertask_interface(void *args_p)
                 }
             } break;
             case MESSAGE_TEST: {
-                int i = 10000;
-                while(i--);
+//                 int i = 10000;
+//                 while(i--);
+            } break;
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
             } break;
             default: {
                 SCTP_DEBUG("Unkwnon message ID %d:%s\n",
diff --git a/openair-cn/SGI/sgi_util.c b/openair-cn/SGI/sgi_util.c
index 4978be429a..564b281f70 100755
--- a/openair-cn/SGI/sgi_util.c
+++ b/openair-cn/SGI/sgi_util.c
@@ -16,6 +16,7 @@ static char fw_2_print_buffer[FW_2_PRINT_BUFFER_LEN];
 void sgi_print_hex_octets(unsigned char* dataP, unsigned long sizeP)
 //-----------------------------------------------------------------------------
 {
+  return;
   unsigned long octet_index = 0;
   unsigned long buffer_marker = 0;
   unsigned char aindex;
diff --git a/openair-cn/SGW-LITE/sgw_lite_task.c b/openair-cn/SGW-LITE/sgw_lite_task.c
index 42aa5a11fb..840a5942f3 100644
--- a/openair-cn/SGW-LITE/sgw_lite_task.c
+++ b/openair-cn/SGW-LITE/sgw_lite_task.c
@@ -90,6 +90,10 @@ static void *sgw_lite_intertask_interface(void *args_p)
             	sgw_lite_handle_sgi_endpoint_updated(&received_message_p->ittiMsg.sgiUpdateEndpointResp);
             } break;
 
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
+            } break;
+
             default: {
                 SPGW_APP_DEBUG("Unkwnon message ID %d:%s\n",
                                ITTI_MSG_ID(received_message_p), ITTI_MSG_NAME(received_message_p));
diff --git a/openair-cn/UDP/udp_primitives_server.c b/openair-cn/UDP/udp_primitives_server.c
index bd08296731..8002a310bf 100644
--- a/openair-cn/UDP/udp_primitives_server.c
+++ b/openair-cn/UDP/udp_primitives_server.c
@@ -256,6 +256,9 @@ static void *udp_intertask_interface(void *args_p)
                     "(%d:%s)\n", errno, strerror(errno));
                 }
             } break;
+            case TERMINATE_MESSAGE: {
+                itti_exit_task();
+            } break;
             case MESSAGE_TEST: {
             } break;
             default: {
-- 
GitLab