Commit aeeadaaa authored by winckel's avatar winckel

Moved NAS message log point to get also ESM logs.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4987 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent 33070a41
......@@ -252,21 +252,18 @@ int nas_message_decode(const char* const buffer, nas_message_t* msg, int length)
LOG_FUNC_RETURN (TLV_DECODE_MAC_MISMATCH);
}
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
/* Log message header */
#endif
/* Decode security protected NAS message */
bytes = _nas_message_protected_decode(buffer + size, &msg->header,
&msg->plain, length - size);
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg(buffer, msg, length, down_link);
#endif
}
else {
/* Decode plain NAS message */
bytes = _nas_message_plain_decode(buffer, &msg->header,
&msg->plain, length);
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_plain_msg(buffer, msg, length, down_link);
#endif
}
if (bytes < 0) {
......@@ -332,16 +329,13 @@ int nas_message_encode(char* buffer, const nas_message_t* const msg, int length)
*(UInt32_t*)(buffer + sizeof(UInt8_t)) = mac;
}
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_protected_msg(buffer, msg, length, down_link);
/* Log message header */
#endif
}
else {
/* Encode plain NAS message */
bytes = _nas_message_plain_encode(buffer, &msg->header,
&msg->plain, length);
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_plain_msg(buffer, msg, length, down_link);
#endif
}
if (bytes < 0) {
......
......@@ -25,6 +25,10 @@ Description Defines EPS Mobility Management messages
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
# include "nas_itti_messaging.h"
#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
......@@ -67,6 +71,18 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int decode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
uint32_t len_log = len;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
down_link = 0;
# else
down_link = 1;
# endif
#endif
/* First decode the EMM message header */
header_result = _emm_msg_decode_header(&msg->header, buffer, len);
if (header_result < 0) {
......@@ -193,6 +209,11 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
LOG_TRACE(ERROR, "EMM-MSG - Failed to decode L3 EMM message 0x%x "
"(%d)", msg->header.message_type, decode_result);
LOG_FUNC_RETURN (decode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg(buffer_log, msg, len_log, down_link);
#endif
}
LOG_FUNC_RETURN (header_result + decode_result);
}
......@@ -221,6 +242,17 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int encode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
down_link = 1;
# else
down_link = 0;
# endif
#endif
/* First encode the EMM message header */
header_result = _emm_msg_encode_header(&msg->header, buffer, len);
if (header_result < 0) {
......@@ -347,6 +379,10 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
if (encode_result < 0) {
LOG_TRACE(ERROR, "EMM-MSG - Failed to encode L3 EMM message 0x%x "
"(%d)", msg->header.message_type, encode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_plain_msg(buffer_log, msg, header_result + encode_result, down_link);
#endif
}
LOG_FUNC_RETURN (header_result + encode_result);
}
......
......@@ -25,6 +25,10 @@ Description Defines EPS Session Management messages
#include "TLVDecoder.h"
#include "TLVEncoder.h"
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
# include "nas_itti_messaging.h"
#endif
/****************************************************************************/
/**************** E X T E R N A L D E F I N I T I O N S ****************/
/****************************************************************************/
......@@ -63,6 +67,18 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int decode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
uint32_t len_log = len;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
down_link = 0;
# else
down_link = 1;
# endif
#endif
LOG_FUNC_IN;
/* First decode the ESM message header */
......@@ -155,7 +171,13 @@ int esm_msg_decode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
LOG_TRACE(ERROR, "ESM-MSG - Failed to decode L3 ESM message 0x%x "
"(%u)", msg->header.message_type, decode_result);
LOG_FUNC_RETURN (decode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
/* Message has been decoded and security header removed, handle it has a plain message */
nas_itti_plain_msg(buffer_log, msg, len_log, down_link);
#endif
}
LOG_FUNC_RETURN (header_result + decode_result);
}
......@@ -183,6 +205,17 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
int header_result;
int encode_result;
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
uint8_t *buffer_log = buffer;
int down_link;
# if ((defined(EPC_BUILD) && defined(NAS_MME)))
down_link = 1;
# else
down_link = 0;
# endif
#endif
/* First encode the ESM message header */
header_result = _esm_msg_encode_header(&msg->header, buffer, len);
if (header_result < 0) {
......@@ -271,7 +304,12 @@ int esm_msg_encode(ESM_msg *msg, uint8_t *buffer, uint32_t len)
if (encode_result < 0) {
LOG_TRACE(ERROR, "ESM-MSG - Failed to encode L3 ESM message 0x%x "
"(%d)", msg->header.message_type, encode_result);
} else {
#if ((defined(EPC_BUILD) && defined(NAS_MME)) || (defined(ENABLE_NAS_UE_LOGGING) && defined(UE_BUILD) && defined(NAS_UE)))
nas_itti_plain_msg(buffer_log, msg, header_result + encode_result, down_link);
#endif
}
LOG_FUNC_RETURN (header_result + encode_result);
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment