Commit eba7dc5c authored by laurent's avatar laurent Committed by Robert Schmidt

Print asn1c encoding logs using OAI logging system

parent 7f910a2e
......@@ -334,13 +334,9 @@ add_definitions("-DPACKAGE_BUGREPORT=\"openair4g-devel@lists.eurecom.fr\"")
# Debug related options
#########################################
add_boolean_option(ASN_EMIT_DEBUG False "ASN1 coder/decoder Debug")
add_boolean_option(ASN_THREAD_SAFE True "ASN1 coder/decoder Debug")
add_boolean_option(MSG_PRINT True "print debug messages")
add_boolean_option(DEBUG_ASN1C False "ASN1 coder/decoder Debug traces, see common/utils/config.h, the logs are regular OAI logs, in the log group 'ASN'")
add_boolean_option(DISABLE_XER_PRINT False "print XER Format")
add_boolean_option(XER_PRINT False "print XER Format")
add_boolean_option(RRC_MSG_PRINT False "print RRC messages")
add_boolean_option(PDCP_MSG_PRINT False "print PDCP messages to /tmp/pdcp.log")
add_boolean_option(DEBUG_PDCP_PAYLOAD False "print PDCP PDU to stdout") # if true, make sure that global and PDCP log levels are trace
add_boolean_option(DEBUG_MAC_INTERFACE False "print MAC-RLC PDU exchange to stdout") # if true, make sure that global and PDCP log levels are trace
add_boolean_option(TRACE_RLC_PAYLOAD False "print RLC PDU to stdout") # if true, make sure that global and PDCP log levels are trace
......@@ -358,6 +354,12 @@ add_library(ITTI
)
add_dependencies(ITTI rrc_flag)
# asn1c skeletons have hardcoded this flag to make customized debug logs
# OAI uses this feature to re-use OAI LOG_I(ASN, ...)
if (DEBUG_ASN1C)
add_definitions(-DHAVE_CONFIG_H)
endif()
##################################################
# ASN.1 grammar C code generation & dependencies #
##################################################
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (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.openairinterface.org/?page_id=698
*
* 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.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef UTILS_CONFIG_H_ASN1
#define UTILS_CONFIG_H_ASN1
// This is hard coded file name "config.h" and HAVE_CONFIG_H_ in asn1c skeletons
/*
* This file "config.h" will be used by asn1c if HAVE_CONFIG_H_ is defined and
* included. This logs asn1c encoder and decoder traces at execution time using
* the regular OAI logging system, i.e., LOG_I(ASN...);
*
* As it is very verbose, note that you can change the log level per module in
* source or in gdb, e.g., to only activate it for a short time.
*
* In code:
* ```
* set_log(ASN, OAI_INFO); // enable logging
* // do your encoding here
* set_log(ASN, OAI_ERR); // disable logging
* ```
*
* in gdb:
* ```
* gdb> p set_log(ASN, 1) // disable log, 1 == OAI_ERR
* gdb> p set_log(ASN, 5) // enable log, 5 == OAI_INFO
* ```
*/
#include "common/utils/LOG/log.h"
#if DEBUG_ASN1C
#define ASN_DEBUG(x...) do{ LOG_I(ASN,x);LOG_I(ASN,"\n"); } while(false)
#else
#define ASN_DEBUG(x...)
#endif
#endif /* UTILS_CONFIG_H_ASN1 */
......@@ -35,27 +35,6 @@
static f1ap_cudu_inst_t *f1_du_inst[NUMBER_OF_eNB_MAX]= {0};
static f1ap_cudu_inst_t *f1_cu_inst[NUMBER_OF_eNB_MAX]= {0};
#if defined(EMIT_ASN_DEBUG_EXTERN)
int asn_debug = 0;
int asn1_xer_print = 0;
inline void ASN_DEBUG(const char *fmt, ...) {
if (asn_debug) {
int adi = asn_debug_indent;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "[ASN1]");
while(adi--)
fprintf(stderr, " ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
}
#endif
uint8_t F1AP_get_next_transaction_identifier(instance_t enb_mod_idP, instance_t cu_mod_idP) {
static uint8_t transaction_identifier[NUMBER_OF_eNB_MAX];
transaction_identifier[enb_mod_idP+cu_mod_idP] =
......
......@@ -29,11 +29,6 @@
* \note
* \warning
*/
#if HAVE_CONFIG_H_
#include "config.h"
#endif
#ifndef F1AP_COMMON_H_
#define F1AP_COMMON_H_
......@@ -43,10 +38,6 @@
#define F1AP_UE_IDENTIFIER_NUMBER 3
#define F1AP_TRANSACTION_IDENTIFIER_NUMBER 3
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline void ASN_DEBUG(const char *fmt, ...);
#endif
#include "F1AP_RAT-FrequencyPriorityInformation.h"
#include "F1AP_DLUPTNLInformation-ToBeSetup-Item.h"
#include "F1AP_PrivateMessage.h"
......
......@@ -31,27 +31,6 @@
#include "m2ap_common.h"
#include "M2AP_M2AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline void ASN_DEBUG(const char *fmt, ...)
{
if (asn_debug) {
int adi = asn_debug_indent;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "[ASN1]");
while(adi--) fprintf(stderr, " ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
}
#endif
ssize_t m2ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
......
......@@ -18,10 +18,8 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#if HAVE_CONFIG_H_
# include "config.h"
#endif
#ifndef M2AP_COMMON_H_
#define M2AP_COMMON_H_
#include "M2AP_ProtocolIE-Field.h"
#include "M2AP_M2AP-PDU.h"
......@@ -38,9 +36,6 @@
#include "common/ran_context.h"
#ifndef M2AP_COMMON_H_
#define M2AP_COMMON_H_
/** @defgroup _m2ap_impl_ M2AP Layer Reference Implementation
* @ingroup _ref_implementation_
* @{
......
......@@ -31,27 +31,6 @@
#include "x2ap_common.h"
#include "X2AP_X2AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline void ASN_DEBUG(const char *fmt, ...)
{
if (asn_debug) {
int adi = asn_debug_indent;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "[ASN1]");
while(adi--) fprintf(stderr, " ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
}
#endif
ssize_t x2ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
......
......@@ -18,10 +18,8 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#if HAVE_CONFIG_H_
# include "config.h"
#endif
#ifndef X2AP_COMMON_H_
#define X2AP_COMMON_H_
#include "X2AP_ProtocolIE-Field.h"
#include "X2AP_X2AP-PDU.h"
......@@ -35,9 +33,6 @@
#include "X2AP_asn_constant.h"
#include "intertask_interface.h"
#ifndef X2AP_COMMON_H_
#define X2AP_COMMON_H_
/** @defgroup _x2ap_impl_ X2AP Layer Reference Implementation
* @ingroup _ref_implementation_
* @{
......
......@@ -18,10 +18,8 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#if HAVE_CONFIG_H
# include "config.h"
#endif
#ifndef SECURITY_TYPES_H_
#define SECURITY_TYPES_H_
#if !defined(HAVE_UINT128_T)
# include <gmp.h>
......@@ -31,8 +29,6 @@
#include <stdint.h>
#include <inttypes.h>
#ifndef SECURITY_TYPES_H_
#define SECURITY_TYPES_H_
#define RAND_LENGTH_BITS (128)
#define RAND_LENGTH_OCTETS (RAND_LENGTH_BITS/8)
......
......@@ -31,27 +31,6 @@
#include "m3ap_common.h"
#include "M3AP_M3AP-PDU.h"
int asn_debug = 0;
int asn1_xer_print = 0;
#if defined(EMIT_ASN_DEBUG_EXTERN)
inline void ASN_DEBUG(const char *fmt, ...)
{
if (asn_debug) {
int adi = asn_debug_indent;
va_list ap;
va_start(ap, fmt);
fprintf(stderr, "[ASN1]");
while(adi--) fprintf(stderr, " ");
vfprintf(stderr, fmt, ap);
fprintf(stderr, "\n");
va_end(ap);
}
}
#endif
ssize_t m3ap_generate_initiating_message(
uint8_t **buffer,
uint32_t *length,
......
......@@ -18,10 +18,8 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#if HAVE_CONFIG_H_
# include "config.h"
#endif
#ifndef M3AP_COMMON_H_
#define M3AP_COMMON_H_
#include "M3AP_ProtocolIE-Field.h"
#include "M3AP_M3AP-PDU.h"
......@@ -35,8 +33,6 @@
#include "M3AP_asn_constant.h"
#include "intertask_interface.h"
#ifndef M3AP_COMMON_H_
#define M3AP_COMMON_H_
/** @defgroup _m3ap_impl_ M3AP Layer Reference Implementation
* @ingroup _ref_implementation_
......
......@@ -33,23 +33,11 @@
*/
#if HAVE_CONFIG_H_
# include "config.h"
#endif
#ifndef NGAP_COMMON_H_
#define NGAP_COMMON_H_
#include "common/utils/LOG/log.h"
/* replace ASN_DEBUG defined in asn_internal.h by oai tracing system
Would be cleaner to modify asn_internal.h but it seems to come
from non oai source, with BSD license, so prefer to do that here..
*/
#ifdef ASN_DEBUG
# undef ASN_DEBUG
#endif
#define ASN_DEBUG( x... ) LOG_I(ASN, x)
#include "NGAP_ProtocolIE-Field.h"
#include "NGAP_NGAP-PDU.h"
......
......@@ -23,24 +23,10 @@
* @ingroup _ref_implementation_
* @{
*/
#if HAVE_CONFIG_H_
# include "config.h"
#endif
#ifndef S1AP_COMMON_H_
#define S1AP_COMMON_H_
#include "common/utils/LOG/log.h"
/* replace ASN_DEBUG defined in asn_internal.h by oai tracing system
Would be cleaner to modify asn_internal.h but it seems to come
from non oai source, with BSD license, so prefer to do that here..
*/
#ifdef ASN_DEBUG
# undef ASN_DEBUG
#endif
#define ASN_DEBUG( x... ) LOG_I(ASN, x)
#include "S1AP_ProtocolIE-Field.h"
#include "S1AP_S1AP-PDU.h"
......@@ -63,7 +49,6 @@
#define S1AP_UE_ID_FMT "0x%06"PRIX32
extern int asn_debug;
extern int asn1_xer_print;
#if defined(ENB_MODE)
......
......@@ -24,10 +24,6 @@
#include <unistd.h>
#include <string.h>
#if HAVE_CONFIG_H
# include "config.h"
#endif
#include "test_util.h"
#include "secu_defs.h"
......
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