diff --git a/common/utils/msc/msc.c b/common/utils/msc/msc.c index a14e75acf7be13064c44643960976ce59dbfeca3..c0c8071e3667a509e35b9d6c1dcad982f99051a0 100644 --- a/common/utils/msc/msc.c +++ b/common/utils/msc/msc.c @@ -57,14 +57,30 @@ int msc_init(msc_env_t envP) for (i = MIN_MSC_PROTOS; i < MAX_MSC_PROTOS; i++) { msc_fd[i] = NULL; switch (i) { - case MSC_NAS_UE: - rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE"); - if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} - if (envP == MSC_E_UTRAN) { - msc_fd[i] = fopen("/tmp/openair.msc.nas_ue.log","w"); - } + case MSC_IP_UE: + rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_UE"); + if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} + if (envP == MSC_E_UTRAN) { + msc_fd[i] = fopen("/tmp/openair.msc.ip_ue.log","w"); msc_log_declare_proto(i); - break; + } + break; + case MSC_IP_ENB: + rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "IP_ENB"); + if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} + if (envP == MSC_E_UTRAN) { + msc_fd[i] = fopen("/tmp/openair.msc.ip_enb.log","w"); + msc_log_declare_proto(i); + } + break; + case MSC_NAS_UE: + rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "NAS_UE"); + if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} + if (envP == MSC_E_UTRAN) { + msc_fd[i] = fopen("/tmp/openair.msc.nas_ue.log","w"); + } + msc_log_declare_proto(i); + break; case MSC_RRC_UE: rv = snprintf(&msc_proto2str[i][0], MSC_MAX_PROTO_NAME_LENGTH, "RRC_UE"); if (rv >= MSC_MAX_PROTO_NAME_LENGTH) {msc_proto2str[i][MSC_MAX_PROTO_NAME_LENGTH-1] = 0;} @@ -425,4 +441,46 @@ void msc_log_tx_message( } } +//------------------------------------------------------------------------------ +void msc_log_tx_message_failed( + const msc_proto_t senderP, + const msc_proto_t receiverP, + const char* bytesP, + const unsigned int num_bytes, + char *format, ...) +//------------------------------------------------------------------------------ +{ + va_list args; + int rv; + uint64_t mac = 0; + uint64_t local_msc_event_counter = msc_event_counter; + + msc_event_counter++; + + if ((receiverP < MIN_MSC_PROTOS) || (receiverP >= MAX_MSC_PROTOS) || + (senderP < MIN_MSC_PROTOS) || (senderP >= MAX_MSC_PROTOS)) { + return; + } + if (msc_fd[senderP] != NULL) { + rv = fprintf(msc_fd[senderP], "%"PRIu64" [MESSAGE] %d -x %d %"PRIu64" ", + local_msc_event_counter, senderP, receiverP, mac); + if (rv < 0) { + fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]); + } + va_start(args, format); + rv = vfprintf(msc_fd[senderP], format, args); + va_end(args); + if (rv < 0) { + fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]); + } + rv = fprintf(msc_fd[senderP], "\n"); + if (rv < 0) { + fprintf(stderr, "Error while logging MSC TX message : %s", &msc_proto2str[senderP][0]); + } + if ((msc_event_counter & 0x000000000000000F) == 0x000000000000000F) { + fflush(msc_fd[senderP]); + } + } +} + diff --git a/common/utils/msc/msc.h b/common/utils/msc/msc.h index 5f73912a076833df5a38509a00c88199c7908295..c365a19984cf30fe059b30f170f0589a6b24e578 100644 --- a/common/utils/msc/msc.h +++ b/common/utils/msc/msc.h @@ -41,7 +41,8 @@ typedef enum { typedef enum { MIN_MSC_PROTOS = 0, - MSC_NAS_UE = MIN_MSC_PROTOS, + MSC_IP_UE = MIN_MSC_PROTOS, + MSC_NAS_UE, MSC_RRC_UE, MSC_PDCP_UE, MSC_RLC_UE, @@ -52,6 +53,7 @@ typedef enum { MSC_RLC_ENB, MSC_PDCP_ENB, MSC_RRC_ENB, + MSC_IP_ENB, MSC_S1AP_ENB, MSC_GTPU_ENB, MSC_GTPU_SGW, @@ -102,6 +104,7 @@ void msc_log_tx_message( #define MSC_LOG_RX_MESSAGE(mScPaRaMs, fORMAT, aRGS...) msc_log_rx_message(mScPaRaMs, fORMAT, ##aRGS) #define MSC_LOG_RX_DISCARDED_MESSAGE(mScPaRaMs, fORMAT, aRGS...) msc_log_rx_discarded_message(mScPaRaMs, fORMAT, ##aRGS) #define MSC_LOG_TX_MESSAGE(mScPaRaMs, fORMAT, aRGS...) msc_log_tx_message(mScPaRaMs, fORMAT, ##aRGS) +#define MSC_LOG_TX_MESSAGE_FAILED(mScPaRaMs, fORMAT, aRGS...) msc_log_tx_message_failed(mScPaRaMs, fORMAT, ##aRGS) #else #define MSC_INIT(mScPaRaMs) #define MSC_END @@ -109,5 +112,6 @@ void msc_log_tx_message( #define MSC_LOG_RX_MESSAGE(mScPaRaMs, fORMAT, aRGS...) #define MSC_LOG_RX_DISCARDED_MESSAGE(mScPaRaMs, fORMAT, aRGS...) #define MSC_LOG_TX_MESSAGE(mScPaRaMs, fORMAT, aRGS...) +#define MSC_LOG_TX_MESSAGE_FAILED(mScPaRaMs, fORMAT, aRGS...) #endif #endif