From e1e6189314cbd069b34b5e7b93ea59d8a180c112 Mon Sep 17 00:00:00 2001
From: Raymond Knopp <raymond.knopp@eurecom.fr>
Date: Tue, 5 May 2015 16:06:52 +0000
Subject: [PATCH] msc logs, remove inlines or error code functions

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@7368 818b1a75-f10b-46b9-bf7c-635c3b92a50f
---
 openair-cn/S6A/s6a_auth_info.c | 29 ++++++++++++++----
 openair-cn/S6A/s6a_defs.h      | 56 ++--------------------------------
 openair-cn/S6A/s6a_error.c     |  6 ++--
 openair-cn/S6A/s6a_task.c      |  6 ++--
 openair-cn/S6A/s6a_up_loc.c    |  9 ++++++
 5 files changed, 39 insertions(+), 67 deletions(-)

diff --git a/openair-cn/S6A/s6a_auth_info.c b/openair-cn/S6A/s6a_auth_info.c
index 1fbeba8856..499eacb4ee 100644
--- a/openair-cn/S6A/s6a_auth_info.c
+++ b/openair-cn/S6A/s6a_auth_info.c
@@ -234,6 +234,14 @@ int s6a_aia_cb(struct msg **msg, struct avp *paramavp,
     s6a_auth_info_ans_p->result.present = S6A_RESULT_BASE;
     s6a_auth_info_ans_p->result.choice.base = hdr->avp_value->u32;
 
+    MSC_LOG_TX_MESSAGE(
+  	    MSC_S6A_MME,
+    	MSC_MMEAPP_MME,
+    	NULL,0,
+    	"0 S6A_AUTH_INFO_ANS imsi %s %s",
+    	s6a_auth_info_ans_p->imsi,
+    	retcode_2_string(s6a_auth_info_ans_p->result.choice.base));
+
     if (hdr->avp_value->u32 != ER_DIAMETER_SUCCESS) {
       S6A_ERROR("Got error %u:%s\n", hdr->avp_value->u32,
                 retcode_2_string(hdr->avp_value->u32));
@@ -257,11 +265,26 @@ int s6a_aia_cb(struct msg **msg, struct avp *paramavp,
       s6a_auth_info_ans_p->result.present = S6A_RESULT_EXPERIMENTAL;
       s6a_parse_experimental_result(avp, &s6a_auth_info_ans_p->result.choice.experimental);
 
+      MSC_LOG_TX_MESSAGE(
+    	    MSC_S6A_MME,
+      	MSC_MMEAPP_MME,
+      	NULL,0,
+      	"0 S6A_AUTH_INFO_ANS imsi %s %s",
+      	s6a_auth_info_ans_p->imsi,
+      	experimental_retcode_2_string(s6a_auth_info_ans_p->result.choice.experimental));
+
       skip_auth_res = 1;
     } else {
       /* Neither result-code nor experimental-result is present ->
        * totally incorrect behaviour here.
        */
+    	MSC_LOG_TX_MESSAGE_FAILED(
+      	    MSC_S6A_MME,
+        	MSC_MMEAPP_MME,
+        	NULL,0,
+        	"0 S6A_AUTH_INFO_ANS imsi %s",
+        	s6a_auth_info_ans_p->imsi);
+
       S6A_ERROR("Experimental-Result and Result-Code are absent: "
                 "This is not a correct behaviour\n");
       goto err;
@@ -277,12 +300,6 @@ int s6a_aia_cb(struct msg **msg, struct avp *paramavp,
       DevMessage("We requested E-UTRAN vectors with an immediate response...\n");
     }
   }
-  MSC_LOG_TX_MESSAGE(
-	    MSC_S6A_MME,
-  		MSC_MMEAPP_MME,
-  		NULL,0,
-  		"0 S6A_AUTH_INFO_ANS imsi %s",
-  		s6a_auth_info_ans_p->imsi);
   itti_send_msg_to_task(TASK_MME_APP, INSTANCE_DEFAULT, message_p);
 err:
   return 0;
diff --git a/openair-cn/S6A/s6a_defs.h b/openair-cn/S6A/s6a_defs.h
index 03ee45a057..c1a138b23e 100644
--- a/openair-cn/S6A/s6a_defs.h
+++ b/openair-cn/S6A/s6a_defs.h
@@ -196,60 +196,8 @@ int s6a_parse_subscription_data(struct avp *avp_subscription_data,
                                 subscription_data_t *subscription_data);
 
 int s6a_parse_experimental_result(struct avp *avp, s6a_experimental_result_t *ptr);
-#ifndef CMAKER
-inline char *experimental_retcode_2_string(uint32_t ret_code);
-inline char *retcode_2_string(uint32_t ret_code);
-#else
-inline char *experimental_retcode_2_string(uint32_t ret_code)
-{
-  switch(ret_code) {
-    /* Experimental-Result-Codes */
-  case DIAMETER_ERROR_USER_UNKNOWN:
-    return "DIAMETER_ERROR_USER_UNKNOWN";
+char *experimental_retcode_2_string(uint32_t ret_code);
+char *retcode_2_string(uint32_t ret_code);
 
-  case DIAMETER_ERROR_ROAMING_NOT_ALLOWED:
-    return "DIAMETER_ERROR_ROAMING_NOT_ALLOWED";
-
-  case DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION:
-    return "DIAMETER_ERROR_UNKNOWN_EPS_SUBSCRIPTION";
-
-  case DIAMETER_ERROR_RAT_NOT_ALLOWED:
-    return "DIAMETER_ERROR_RAT_NOT_ALLOWED";
-
-  case DIAMETER_ERROR_EQUIPMENT_UNKNOWN:
-    return "DIAMETER_ERROR_EQUIPMENT_UNKNOWN";
-
-  case DIAMETER_ERROR_UNKOWN_SERVING_NODE:
-    return "DIAMETER_ERROR_UNKOWN_SERVING_NODE";
-
-  case DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE:
-    return "DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE";
-
-  default:
-    break;
-  }
-
-  return "DIAMETER_AVP_UNSUPPORTED";
-}
-
-inline char *retcode_2_string(uint32_t ret_code)
-{
-  switch(ret_code) {
-  case ER_DIAMETER_SUCCESS:
-    return "DIAMETER_SUCCESS";
-
-  case ER_DIAMETER_MISSING_AVP:
-    return "DIAMETER_MISSING_AVP";
-
-  case ER_DIAMETER_INVALID_AVP_VALUE:
-    return "DIAMETER_INVALID_AVP_VALUE";
-
-  default:
-    break;
-  }
-
-  return "DIAMETER_AVP_UNSUPPORTED";
-}
-#endif
 
 #endif /* S6A_DEFS_H_ */
diff --git a/openair-cn/S6A/s6a_error.c b/openair-cn/S6A/s6a_error.c
index 1812892c29..28bf5dd4e2 100644
--- a/openair-cn/S6A/s6a_error.c
+++ b/openair-cn/S6A/s6a_error.c
@@ -77,8 +77,7 @@ int s6a_parse_experimental_result(struct avp *avp, s6a_experimental_result_t *pt
   return 0;
 }
 
-#ifndef CMAKER
-inline char *experimental_retcode_2_string(uint32_t ret_code)
+char *experimental_retcode_2_string(uint32_t ret_code)
 {
   switch(ret_code) {
     /* Experimental-Result-Codes */
@@ -110,7 +109,7 @@ inline char *experimental_retcode_2_string(uint32_t ret_code)
   return "DIAMETER_AVP_UNSUPPORTED";
 }
 
-inline char *retcode_2_string(uint32_t ret_code)
+char *retcode_2_string(uint32_t ret_code)
 {
   switch(ret_code) {
   case ER_DIAMETER_SUCCESS:
@@ -128,4 +127,3 @@ inline char *retcode_2_string(uint32_t ret_code)
 
   return "DIAMETER_AVP_UNSUPPORTED";
 }
-#endif
diff --git a/openair-cn/S6A/s6a_task.c b/openair-cn/S6A/s6a_task.c
index 9849b6caba..26bbff899c 100644
--- a/openair-cn/S6A/s6a_task.c
+++ b/openair-cn/S6A/s6a_task.c
@@ -140,9 +140,9 @@ int s6a_init(const mme_config_t *mme_config_p)
 
   /* Set gnutls debug level ? */
   if (gnutls_debug) {
-    gnutls_global_set_log_function((gnutls_log_func)fd_gnutls_debug);
-    gnutls_global_set_log_level (gnutls_debug);
-    S6A_DEBUG("Enabled GNUTLS debug at level %d", gnutls_debug);
+    //gnutls_global_set_log_function((gnutls_log_func)fd_gnutls_debug);
+    //gnutls_global_set_log_level (gnutls_debug);
+    //S6A_DEBUG("Enabled GNUTLS debug at level %d", gnutls_debug);
   }
 
   /* Starting freeDiameter core */
diff --git a/openair-cn/S6A/s6a_up_loc.c b/openair-cn/S6A/s6a_up_loc.c
index 2d57d1bc90..d1d2931d70 100644
--- a/openair-cn/S6A/s6a_up_loc.c
+++ b/openair-cn/S6A/s6a_up_loc.c
@@ -38,6 +38,7 @@
 #include "intertask_interface.h"
 #include "s6a_defs.h"
 #include "s6a_messages.h"
+#include "msc.h"
 
 
 int s6a_ula_cb(
@@ -89,6 +90,14 @@ int s6a_ula_cb(
     s6a_update_location_ans_p->result.present = S6A_RESULT_BASE;
     s6a_update_location_ans_p->result.choice.base = hdr_p->avp_value->u32;
 
+    MSC_LOG_TX_MESSAGE(
+    		MSC_S6A_MME,
+    		MSC_MMEAPP_MME,
+    		NULL,0,
+    		"0 S6A_UPDATE_LOCATION_ANS imsi %SCNu64 %s",
+    		s6a_update_location_ans_p->imsi,
+    		retcode_2_string(hdr_p->avp_value->u32));
+
     if (hdr_p->avp_value->u32 != ER_DIAMETER_SUCCESS) {
       S6A_ERROR("Got error %u:%s\n", hdr_p->avp_value->u32,
                 retcode_2_string(hdr_p->avp_value->u32));
-- 
GitLab