Commit 42a11033 authored by Laurent's avatar Laurent

itti dynamic queue creation, and 64 bits instance id

parent d23a7e83
......@@ -3069,7 +3069,7 @@ target_link_libraries (ocp-gnb
-Wl,--start-group
UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB SCHED_NR_LIB PHY_NR PHY PHY_COMMON PHY_NR_COMMON PHY_RU LFDS NR_GTPV1U SECU_CN SECU_OSA
${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7 ${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} RRC_LIB NR_RRC_LIB
S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
NGAP_LIB NGAP_GNB S1AP_LIB S1AP_ENB L2_LTE_NR L2_NR MAC_NR_COMMON NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
X2AP_LIB X2AP_ENB F1AP_LIB F1AP M2AP_LIB M2AP_ENB M3AP_LIB M3AP_ENB SIMU_COMMON
-Wl,--end-group z dl)
......
This diff is collapsed.
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libresolver \
-I$(top_srcdir)/libbuffers \
-I$(top_srcdir)/libui
SUBDIRS = libparser libresolver libbuffers libui .
itti_analyzer_LDADD = \
$(top_builddir)/libui/libui.la \
$(top_builddir)/libparser/libparser.la \
$(top_builddir)/libresolver/libresolver.la \
$(top_builddir)/libbuffers/libbuffers.la
bin_PROGRAMS = itti_analyzer
To run itti_analyzer, please perform the following actions:
1) apt-get install autotools-dev automake libtool
2) libtoolize
3) ./autogen.sh
4) ./configure
5) make
6) ./itti_analyzer
\ No newline at end of file
#! /bin/sh
aclocal \
&& autoheader \
&& automake --add-missing \
&& autoconf
\ No newline at end of file
/*
* 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
*/
/** @brief Intertask Interface common types
* Contains type definitions used for generating and parsing ITTI messages.
* @author Laurent Winckel <laurent.winckel@eurecom.fr>
*/
#ifndef _ITTI_TYPES_H_
#define _ITTI_TYPES_H_
#include <stdint.h>
#define CHARS_TO_UINT32(c1, c2, c3, c4) (((c4) << 24) | ((c3) << 16) | ((c2) << 8) | (c1))
#define MESSAGE_NUMBER_CHAR_FORMAT "%11u"
/* Intertask message types */
enum itti_message_types_e
{
ITTI_DUMP_XML_DEFINITION = CHARS_TO_UINT32 ('\n', 'I', 'x', 'd'),
ITTI_DUMP_XML_DEFINITION_END = CHARS_TO_UINT32 ('i', 'X', 'D', '\n'),
ITTI_DUMP_MESSAGE_TYPE = CHARS_TO_UINT32 ('\n', 'I', 'm', 's'),
ITTI_DUMP_MESSAGE_TYPE_END = CHARS_TO_UINT32 ('i', 'M', 'S', '\n'),
ITTI_STATISTIC_MESSAGE_TYPE = CHARS_TO_UINT32 ('\n', 'I', 's', 't'),
ITTI_STATISTIC_MESSAGE_TYPE_END = CHARS_TO_UINT32 ('i', 'S', 'T', '\n'),
/* This signal is not meant to be used by remote analyzer */
ITTI_DUMP_EXIT_SIGNAL = CHARS_TO_UINT32 ('e', 'X', 'I', 'T'),
};
typedef uint32_t itti_message_types_t;
/* Message header is the common part that should never change between
* remote process and this one.
*/
typedef struct {
/* The size of this structure */
uint32_t message_size;
itti_message_types_t message_type;
} itti_socket_header_t;
typedef struct {
char message_number_char[12]; /* 9 chars are needed to store an unsigned 32 bits value in decimal, but must be a multiple of 32 bits to avoid alignment issues */
} itti_signal_header_t;
#define INSTANCE_DEFAULT (UINT16_MAX - 1)
#define INSTANCE_ALL (UINT16_MAX)
typedef uint16_t instance_t;
#endif
/*
* 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
*/
/*
* logs.h
*
* Created on: Nov 22, 2013
* Author: Laurent Winckel
*/
#ifndef LOGS_H_
#define LOGS_H_
/* Added definition of the g_info log function to complete the set of log functions from "gmessages.h" */
#include <glib/gmessages.h>
#ifdef G_HAVE_ISO_VARARGS
#define g_info(...) g_log (G_LOG_DOMAIN, \
G_LOG_LEVEL_INFO, \
__VA_ARGS__)
#else
static void
g_info (const gchar *format,
...)
{
va_list args;
va_start (args, format);
g_logv (G_LOG_DOMAIN, G_LOG_LEVEL_INFO, format, args);
va_end (args);
}
#endif
#endif /* LOGS_H_ */
/*
* 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
*/
#include <errno.h>
#include <string.h>
#ifndef RC_H_
#define RC_H_
#define RC_OK 0
#define RC_FAIL -1
#define RC_BAD_PARAM -2
#define RC_NULL_POINTER -3
static const char * const rc_strings[] =
{"Ok", "fail", "bad parameter", "null pointer"};
#define CHECK_FCT(fCT) \
do { \
int rET; \
if ((rET = fCT) != RC_OK) { \
fprintf(stderr, #fCT" has failed (%s:%d)\n", __FILE__, __LINE__); \
return rET; \
} \
} while(0)
#define CHECK_FCT_POSIX(fCT) \
do { \
if (fCT == -1) { \
fprintf(stderr, #fCT" has failed (%d:%s) (%s:%d)\n", errno, \
strerror(errno), __FILE__, __LINE__); \
return RC_FAIL; \
} \
} while(0)
#define CHECK_FCT_DO(fCT, dO) \
do { \
int rET; \
if ((rET = fCT) != RC_OK) { \
fprintf(stderr, #fCT" has returned %d (%s:%d)\n", rET, __FILE__, __LINE__); \
dO; \
} \
} while(0)
#define CHECK_BUFFER(bUFFER) \
do { \
if ((bUFFER) == NULL) { \
fprintf(stderr, #bUFFER" is NULL (%s:%d)\n", __FILE__, __LINE__); \
return RC_NULL_POINTER; \
} \
} while(0)
#endif /* RC_H_ */
AC_PREREQ([2.68])
define([svnversion], esyscmd([sh -c "svnversion ..|tr -d '\n'"]))
AC_DEFINE(SVN_REVISION, "svnversion", [SVN Revision])
AC_INIT([itti_analyzer], [0.2.svnversion], [openair_admin@eurecom.fr])
AC_CANONICAL_BUILD
AC_CANONICAL_TARGET
AM_INIT_AUTOMAKE([1.11 silent-rules])
AC_CONFIG_MACRO_DIR([m4])
AC_CONFIG_HEADERS([config.h])
AM_MAINTAINER_MODE
AM_SILENT_RULES([yes])
AM_PROG_LIBTOOL
AC_PROG_RANLIB
AC_PROG_CXX
AC_FUNC_ALLOCA
AC_FUNC_MALLOC
AC_FUNC_REALLOC
AC_TYPE_SIZE_T
AC_TYPE_SSIZE_T
AC_TYPE_INT8_T
AC_TYPE_INT16_T
AC_TYPE_INT32_T
AC_TYPE_INT64_T
AC_TYPE_UINT8_T
AC_TYPE_UINT16_T
AC_TYPE_UINT32_T
AC_TYPE_UINT64_T
AC_CHECK_FUNCS([memset])
AC_CHECK_FUNCS([socket])
AC_CHECK_FUNCS([strdup])
AC_CHECK_FUNCS([strerror])
AC_CHECK_FUNCS([select])
AC_CHECK_FUNCS([strstr])
AC_CHECK_HEADERS([arpa/inet.h])
AC_CHECK_HEADERS([fcntl.h])
AC_CHECK_HEADERS([libintl.h])
AC_CHECK_HEADERS([malloc.h])
AC_CHECK_HEADERS([stddef.h])
AC_CHECK_HEADERS([netinet/in.h])
AC_CHECK_LIB(m, log10)
PKG_CHECK_MODULES(XML2, [libxml-2.0 >= 2.7.8], [HAVE_XML2=true], [AC_MSG_ERROR(lixml-2.0 not installed)])
CFLAGS="$CFLAGS $XML2_CFLAGS"
LIBS="$LIBS $XML2_LIBS"
AM_PATH_GTK_3_0(3.0.0, [], AC_MSG_ERROR(Requirement not met: gtk >= 3.0.0))
CFLAGS="$CFLAGS $GTK_CFLAGS"
LIBS="$LIBS $GTK_LIBS"
dnl Add these flags
CFLAGS="$CFLAGS -Wall"
CFLAGS="$CFLAGS -Wshadow"
CFLAGS="$CFLAGS -Wcast-align"
CFLAGS="$CFLAGS -Wchar-subscripts"
CFLAGS="$CFLAGS -Wmissing-prototypes"
CFLAGS="$CFLAGS -Wmissing-declarations"
CFLAGS="$CFLAGS -Werror=implicit-function-declaration"
AC_SUBST([AM_CFLAGS])
AC_SUBST(ADD_CFLAGS)
dnl *** Autoconf support ***
AC_ARG_ENABLE(autoconf,
[ --disable-autoconf disable automatic generation of configure script ],
enable_autoconf=$enableval, enable_autoconf=yes
)
AC_PATH_PROG(AUTOCONF, autoconf, @echo autoconf not available)
AC_PATH_PROG(AUTOHEADER, autoheader, @echo autoheader not available)
if test -z "$AUTOCONF"; then enable_autoconf=no ; fi
if test -z "$AUTOHEADER"; then enable_autoconf=no ; fi
if test x$enable_autoconf = xyes; then
CONFIGURE_DEPENDS="configure.in aclocal.m4"
fi
AC_SUBST(CONFIGURE_DEPENDS)
AC_CONFIG_FILES(
libbuffers/Makefile \
libparser/Makefile \
libresolver/Makefile \
libui/Makefile \
Makefile \
)
AC_OUTPUT
<?xml version="1.0" encoding="UTF-8"?>
<filters>
<messages>
<INITIALIZE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<ACTIVATE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<DEACTIVATE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<TERMINATE_MESSAGE enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<MESSAGE_TEST enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<ERROR_LOG enabled="1" foreground_color="#000000" background_color="#ff8080"/>
<WARNING_LOG enabled="1" foreground_color="#303030" background_color="#fff050"/>
<NOTICE_LOG enabled="0" foreground_color="#585858" background_color="#ffffa0"/>
<INFO_LOG enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<DEBUG_LOG enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<GENERIC_LOG enabled="1" foreground_color="#246b24" background_color="#ffffff"/>
<TIMER_HAS_EXPIRED enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<PHY_DEACTIVATE_REQ enabled="1" foreground_color="#000000" background_color="#bef2ff"/>
<PHY_FIND_CELL_REQ enabled="1" foreground_color="#000000" background_color="#bef2ff"/>
<PHY_FIND_NEXT_CELL_REQ enabled="1" foreground_color="#000000" background_color="#bef2ff"/>
<PHY_FIND_CELL_IND enabled="1" foreground_color="#585858" background_color="#bef2ff"/>
<RRC_MAC_IN_SYNC_IND enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_OUT_OF_SYNC_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_BCCH_DATA_REQ enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_BCCH_DATA_IND enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_CCCH_DATA_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_CCCH_DATA_CNF enabled="0" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_CCCH_DATA_IND enabled="1" foreground_color="#585858" background_color="#dfb9fc"/>
<RRC_MAC_MCCH_DATA_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_MAC_MCCH_DATA_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_DCCH_DATA_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_DCCH_DATA_IND enabled="1" foreground_color="#585858" background_color="#a7b1de"/>
<RRC_STATE_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_CONFIGURATION_REQ enabled="1" foreground_color="#ffffff" background_color="#4d2a73"/>
<NAS_CELL_SELECTION_REQ enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_CONN_ESTABLI_REQ enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_UPLINK_DATA_REQ enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_RAB_ESTABLI_RSP enabled="1" foreground_color="#ffffff" background_color="#2d315c"/>
<NAS_CELL_SELECTION_CNF enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_CELL_SELECTION_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_PAGING_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_CONN_ESTABLI_CNF enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_CONN_RELEASE_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_UPLINK_DATA_CNF enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<NAS_DOWNLINK_DATA_IND enabled="1" foreground_color="#e0e0e0" background_color="#2d315c"/>
<S1AP_REGISTER_ENB_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_REGISTER_ENB_CNF enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_DEREGISTERED_ENB_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_NAS_FIRST_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_UPLINK_NAS enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CAPABILITIES_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_INITIAL_CONTEXT_SETUP_RESP enabled="1" foreground_color="#19431e" background_color="#cbffb1"/>
<S1AP_INITIAL_CONTEXT_SETUP_FAIL enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_NAS_NON_DELIVERY_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CONTEXT_RELEASE_RESP enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CTXT_MODIFICATION_RESP enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CTXT_MODIFICATION_FAIL enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_DOWNLINK_NAS enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_INITIAL_CONTEXT_SETUP_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_UE_CTXT_MODIFICATION_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<S1AP_PAGING_IND enabled="1" foreground_color="#585858" background_color="#cbffb1"/>
<S1AP_UE_CONTEXT_RELEASE_REQ enabled="1" foreground_color="#000000" background_color="#cbffb1"/>
<SCTP_NEW_ASSOCIATION_REQ enabled="0" foreground_color="#000000" background_color="#aefeff"/>
<SCTP_NEW_ASSOCIATION_RESP enabled="0" foreground_color="#585858" background_color="#aefeff"/>
<SCTP_NEW_ASSOCIATION_IND enabled="1" foreground_color="#585858" background_color="#aefeff"/>
<SCTP_REGISTER_UPPER_LAYER enabled="1" foreground_color="#585858" background_color="#aefeff"/>
<SCTP_DATA_REQ enabled="1" foreground_color="#000000" background_color="#aefeff"/>
<SCTP_DATA_IND enabled="1" foreground_color="#585858" background_color="#aefeff"/>
<RRC_RAL_SYSTEM_CONFIGURATION_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_SYSTEM_INFORMATION_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_SCAN_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_SCAN_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONFIGURE_THRESHOLD_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONFIGURE_THRESHOLD_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_MEASUREMENT_REPORT_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_ESTABLISHMENT_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_ESTABLISHMENT_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_ESTABLISHMENT_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_REESTABLISHMENT_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RECONFIGURATION_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RECONFIGURATION_HO_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RELEASE_REQ enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RELEASE_CONF enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<RRC_RAL_CONNECTION_RELEASE_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
<NAS_UPLINK_DATA_IND enabled="1" foreground_color="#585858" background_color="#ffffff"/>
</messages>
<origin_tasks>
<TASK_UNKNOWN enabled="1"/>
<TASK_TIMER enabled="1"/>
<TASK_L2L1 enabled="1"/>
<TASK_BM enabled="1"/>
<TASK_PHY_ENB enabled="1"/>
<TASK_MAC_ENB enabled="1"/>
<TASK_RLC_ENB enabled="1"/>
<TASK_PDCP_ENB enabled="1"/>
<TASK_DATA_FORWARDING enabled="1"/>
<TASK_END_MARKER enabled="1"/>
<TASK_RRC_ENB enabled="1"/>
<TASK_RAL_ENB enabled="1"/>
<TASK_S1AP enabled="1"/>
<TASK_X2AP enabled="1"/>
<TASK_SCTP enabled="1"/>
<TASK_ENB_APP enabled="1"/>
<TASK_PHY_UE enabled="1"/>
<TASK_MAC_UE enabled="1"/>
<TASK_RLC_UE enabled="1"/>
<TASK_PDCP_UE enabled="1"/>
<TASK_RRC_UE enabled="1"/>
<TASK_NAS_UE enabled="1"/>
<TASK_RAL_UE enabled="1"/>
</origin_tasks>
<destination_tasks>
<TASK_UNKNOWN enabled="1"/>
<TASK_TIMER enabled="1"/>
<TASK_L2L1 enabled="1"/>
<TASK_BM enabled="1"/>
<TASK_PHY_ENB enabled="1"/>
<TASK_MAC_ENB enabled="1"/>
<TASK_RLC_ENB enabled="1"/>
<TASK_PDCP_ENB enabled="1"/>
<TASK_DATA_FORWARDING enabled="1"/>
<TASK_END_MARKER enabled="1"/>
<TASK_RRC_ENB enabled="1"/>
<TASK_RAL_ENB enabled="1"/>
<TASK_S1AP enabled="1"/>
<TASK_X2AP enabled="1"/>
<TASK_SCTP enabled="1"/>
<TASK_ENB_APP enabled="1"/>
<TASK_PHY_UE enabled="1"/>
<TASK_MAC_UE enabled="1"/>
<TASK_RLC_UE enabled="1"/>
<TASK_PDCP_UE enabled="1"/>
<TASK_RRC_UE enabled="1"/>
<TASK_NAS_UE enabled="1"/>
<TASK_RAL_UE enabled="1"/>
</destination_tasks>
</filters>
This diff is collapsed.
This diff is collapsed.
/*
* 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
*/
#include <stdlib.h>
#include <stdio.h>
#include <errno.h>
#include <string.h>
#include <gtk/gtk.h>
#include <libxml/parser.h>
#include "xml_parse.h"
#include "resolvers.h"
#include "locate_root.h"
#include "file.h"
#include "ui_main_screen.h"
#include "rc.h"
#define G_LOG_LEVELS (G_LOG_LEVEL_ERROR | \
G_LOG_LEVEL_CRITICAL | \
G_LOG_LEVEL_WARNING | \
G_LOG_LEVEL_MESSAGE | \
G_LOG_LEVEL_INFO | \
G_LOG_LEVEL_DEBUG)
int debug_buffers = 1;
int debug_parser = 0;
static void console_log_handler(const char *log_domain, GLogLevelFlags log_level,
const char *message, gpointer user_data)
{
GLogLevelFlags domain_log_level = (GLogLevelFlags) user_data;
time_t curr;
struct tm *today;
const char *level;
if (ui_main_data.log_flags & domain_log_level & log_level)
{
switch (log_level & G_LOG_LEVEL_MASK)
{
case G_LOG_LEVEL_ERROR:
level = "Err ";
break;
case G_LOG_LEVEL_CRITICAL:
level = "Crit";
break;
case G_LOG_LEVEL_WARNING:
level = "Warn";
break;
case G_LOG_LEVEL_MESSAGE:
level = "Msg ";
break;
case G_LOG_LEVEL_INFO:
level = "Info";
break;
case G_LOG_LEVEL_DEBUG:
level = "Dbg ";
break;
default:
fprintf(stderr, "unknown log_level %u\n", log_level);
level = NULL;
g_assert_not_reached();
break;
}
/* create a "timestamp" */
time(&curr);
today = localtime(&curr);
fprintf(stderr, "%02u:%02u:%02u %-9s %s %s\n", today->tm_hour, today->tm_min, today->tm_sec,
log_domain != NULL ? log_domain : "", level, message);
}
}
int main(int argc, char *argv[])
{
int ret = 0;
GLogLevelFlags log_flags;
log_flags = (GLogLevelFlags)
(G_LOG_LEVEL_ERROR |
G_LOG_LEVEL_CRITICAL |
G_LOG_LEVEL_WARNING |
G_LOG_LEVEL_MESSAGE |
G_LOG_LEVEL_INFO |
G_LOG_LEVEL_DEBUG);
/* This initialize the library and check potential ABI mismatches
* between the version it was compiled for and the actual shared
* library used.
*/
LIBXML_TEST_VERSION;
xmlInitParser();
/* Initialize the widget set */
gtk_init(&argc, &argv);
/* Parse command line options */
ui_gtk_parse_arg (argc, argv);
/* Set log handlers:
* Domain, Levels, Handler, Domain enabled levels */
g_log_set_handler( NULL, log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS));
g_log_set_handler("BUFFERS", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("PARSER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("RESOLVER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("UI", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("UI_CB", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS));
g_log_set_handler("UI_FILTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
g_log_set_handler("UI_INTER", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS));
g_log_set_handler("UI_TREE", log_flags, console_log_handler, (gpointer) (G_LOG_LEVELS & (~(G_LOG_LEVEL_DEBUG))));
CHECK_FCT(ui_gtk_initialize(argc, argv));
/* Enter the main event loop, and wait for user interaction */
gtk_main ();
/* Free the global variables that may
* have been allocated by the parser.
*/
xmlCleanupParser ();
return ret;
}
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libui
noinst_LTLIBRARIES = libbuffers.la
libbuffers_la_LDFLAGS = -all-static
libbuffers_la_SOURCES = \
buffers.c buffers.h \
file.c file.h \
socket.c socket.h
/*
* 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
*/
#include <pthread.h>
#include <stdlib.h>
#include <stdio.h>
#include <string.h>
#define G_LOG_DOMAIN ("BUFFERS")
#include <glib.h>
#include "rc.h"
#include "buffers.h"
extern int debug_buffers;
static
int buffer_fetch(buffer_t *buffer, uint32_t offset, int size, void *value);
/* Try to fetch 8 bits unsigned from the buffer */
uint8_t buffer_get_uint8_t(buffer_t *buffer, uint32_t offset)
{
uint8_t value;
buffer_fetch(buffer, offset, 1, &value);
return value;
}
/* Try to fetch 16 bits unsigned from the buffer */
uint16_t buffer_get_uint16_t(buffer_t *buffer, uint32_t offset)
{
uint16_t value;
buffer_fetch(buffer, offset, 2, &value);
return value;
}
/* Try to fetch 32 bits unsigned from the buffer */
uint32_t buffer_get_uint32_t(buffer_t *buffer, uint32_t offset)
{
uint32_t value;
buffer_fetch(buffer, offset, 4, &value);
return value;
}
/* Try to fetch 64 bits unsigned from the buffer */
uint64_t buffer_get_uint64_t(buffer_t *buffer, uint32_t offset)
{
uint64_t value;
buffer_fetch(buffer, offset, 8, &value);
return value;
}
static
int buffer_fetch(buffer_t *buffer, uint32_t offset, int size, void *value)
{
if (buffer == NULL || value == NULL)
return -1;
if (size <= 0)
return -1;
if (buffer->size_bytes < ((offset >> 3) + size)) {
g_warning("Not enough data to fetch");
return -1;
}
memcpy(value, &buffer->data[offset >> 3], size);
buffer->buffer_current = &buffer->data[(offset >> 3) + size];
return 0;
}
int buffer_fetch_nbytes(buffer_t *buffer, uint32_t offset, int n_bytes, uint8_t *value)
{
if (buffer->size_bytes < ((offset >> 3) + n_bytes)) {
g_warning("Not enough data to fetch");
return -1;
}
memcpy(&value[0], &buffer->data[offset >> 3], n_bytes);
return 0;
}
int buffer_fetch_bits(buffer_t *buffer, uint32_t offset, int nbits, uint32_t *value)
{
uint32_t temp = 0;
int i;
if (buffer == NULL || value == NULL)
return RC_BAD_PARAM;
/* We cannot fetch more than 32 bits */
if (nbits > 32)
return RC_BAD_PARAM;
for (i = 0; i < nbits; i++)
{
temp |= ((buffer->data[(offset + i) / 8] >> ((offset + i) % 8)) & 1) << i;
}
*value = temp;
return RC_OK;
}
/**
* @brief Create a new buffer from data
* @param buffer caller reference where created buffer will be stored
* @param data Data to attach to the new buffer
* @param length Length of data buffer
* @param data_static flag that indicates if data pointer has been statically (= 0) or not (!= 0)
*/
int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length,
int data_static)
{
buffer_t *new;
if (!buffer)
return RC_BAD_PARAM;
new = malloc(sizeof(buffer_t));
new->size_bytes = length;
if (data && length > 0) {
if (data_static == 0) {
new->data = malloc(sizeof(uint8_t) * new->size_bytes);
memcpy(new->data, data, new->size_bytes);
} else {
new->data = data;
}
new->buffer_current = &new->data[0];
} else {
new->buffer_current = NULL;
}
*buffer = new;
return 0;
}
#define INDENTED(fILE, x, y) \
do { \
int indentation = x; \
while(indentation--) fprintf(fILE, " "); \
y; \
} while(0)
#define INDENT_BREAK 20
void buffer_dump(buffer_t *buffer, FILE *to)
{
FILE *file = to;
uint32_t i;
if (!buffer)
return;
if (!to)
to = stdout;
fprintf(file, "<Buffer>\n");
INDENTED(file, 4, fprintf(file, "<Length>%u<Length>\n", buffer->size_bytes));
INDENTED(file, 4, fprintf(file, "<Bytes>\n"));
for (i = 0; i < buffer->size_bytes; i++)
{
if ((i % INDENT_BREAK) == 0)
fprintf(file, " ");
fprintf(file, "0x%02x ", buffer->data[i]);
if ((i % INDENT_BREAK) == (INDENT_BREAK - 1))
fprintf(file, "\n");
}
if ((i % INDENT_BREAK) != (INDENT_BREAK - 1))
fprintf(file, "\n");
INDENTED(file, 4, fprintf(file, "</Bytes>\n"));
fprintf(file, "</Buffer>\n");
}
int buffer_append_data(buffer_t *buffer, const uint8_t *data, const uint32_t length)
{
if (!buffer)
return -1;
if (data && length > 0) {
if (!buffer->data) {
buffer->size_bytes = length;
buffer->data = malloc(sizeof(uint8_t) * buffer->size_bytes);
memcpy(buffer->data, data, buffer->size_bytes);
} else {
buffer->data = realloc(buffer->data, sizeof(uint8_t) * (buffer->size_bytes + length));
memcpy(&buffer->data[buffer->size_bytes], data, length);
buffer->size_bytes += length;
}
buffer->buffer_current = &buffer->data[0];
}
return 0;
}
int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get)
{
int underflow;
if (!buffer)
return -1;
underflow = (buffer->size_bytes >= ((offset + to_get) / 8)) ? 0 : -1;
if (underflow && debug_buffers)
g_warning("Detected Underflow offset %u, to_get %u, buffer size %u\n",
offset, to_get, buffer->size_bytes);
return underflow;
}
void *buffer_at_offset(buffer_t *buffer, uint32_t offset)
{
// if (buffer_has_enouch_data(buffer, 0, offset) != 0) {
// return NULL;
// }
return &buffer->data[offset / 8];
}
/*
* 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
*/
#include <stdint.h>
#ifndef BUFFERS_H_
#define BUFFERS_H_
typedef struct buffer_s {
/* The size in bytes as read from socket */
uint32_t size_bytes;
/* Current position */
uint8_t *buffer_current;
/* The complete data */
uint8_t *data;
/* The message number as read from socket */
uint32_t message_number;
uint32_t message_id;
} buffer_t;
uint8_t buffer_get_uint8_t(buffer_t *buffer, uint32_t offset);
uint16_t buffer_get_uint16_t(buffer_t *buffer, uint32_t offset);
uint32_t buffer_get_uint32_t(buffer_t *buffer, uint32_t offset);
uint64_t buffer_get_uint64_t(buffer_t *buffer, uint32_t offset);
int buffer_fetch_bits(buffer_t *buffer, uint32_t offset, int nbits, uint32_t *value);
int buffer_fetch_nbytes(buffer_t *buffer, uint32_t offset, int n_bytes, uint8_t *value);
void buffer_dump(buffer_t *buffer, FILE *to);
int buffer_append_data(buffer_t *buffer, const uint8_t *data, const uint32_t length);
int buffer_new_from_data(buffer_t **buffer, uint8_t *data, const uint32_t length,
int data_static);
int buffer_has_enouch_data(buffer_t *buffer, uint32_t offset, uint32_t to_get);
void *buffer_at_offset(buffer_t *buffer, uint32_t offset);
#endif /* BUFFERS_H_ */
/*
* 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
*/
#include <stdio.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <sys/stat.h>
#include <fcntl.h>
#define G_LOG_DOMAIN ("BUFFERS")
#include <glib.h>
#include "rc.h"
#include "buffers.h"
#include "file.h"
#define READ_BUFFER_SIZE 1024
int file_read_dump(buffer_t **buffer, const char *filename)
{
int fd = -1;
buffer_t *new_buf = NULL;
uint8_t data[READ_BUFFER_SIZE];
ssize_t current_read;
if (!filename)
return RC_BAD_PARAM;
if ((fd = open(filename, O_RDONLY)) == -1) {
g_warning("Cannot open %s for reading, returned %d:%s\n",
filename, errno, strerror(errno));
return RC_FAIL;
}
CHECK_FCT(buffer_new_from_data(&new_buf, NULL, 0, 0));
do {
current_read = read(fd, data, READ_BUFFER_SIZE);
if (current_read == -1)
{
g_warning("Failed to read data from file, returned %d:%s\n",
errno, strerror(errno));
return RC_FAIL;
}
CHECK_FCT(buffer_append_data(new_buf, data, current_read));
} while(current_read == READ_BUFFER_SIZE);
*buffer = new_buf;
buffer_dump(new_buf, stdout);
close(fd);
return RC_OK;
}
/*
* 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 FILE_H_
#define FILE_H_
int file_read_dump(buffer_t **buffer, const char *filename);
#endif /* FILE_H_ */
This diff is collapsed.
/*
* 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
*/
#include <arpa/inet.h>
#include <netinet/in.h>
#ifndef SOCKET_H_
#define SOCKET_H_
typedef struct {
pthread_t thread;
int sd;
char *ip_address;
uint16_t port;
/* The pipe used between main thread (running GTK) and the socket thread */
int pipe_fd;
/* Time used to avoid refreshing UI every time a new signal is incoming */
gint64 last_data_notification;
uint8_t nb_signals_since_last_update;
/* The last signals received which are not yet been updated in GUI */
GList *signal_list;
} socket_data_t;
gboolean socket_abort_connection;
int socket_connect_to_remote_host(const char *remote_ip, const uint16_t port,
int pipe_fd);
int socket_disconnect_from_remote_host(void);
#endif /* SOCKET_H_ */
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libbuffers \
-I$(top_srcdir)/libui
noinst_LTLIBRARIES = libparser.la
libparser_la_LDFLAGS = -all-static
libparser_la_SOURCES = \
xml_parse.c \
array_type.c array_type.h \
enum_type.c enum_type.h \
enum_value_type.c enum_value_type.h \
file_type.c file_type.h \
field_type.c field_type.h \
fundamental_type.c fundamental_type.h \
pointer_type.h pointer_type.c \
reference_type.c reference_type.h \
struct_type.c struct_type.h \
typedef_type.c typedef_type.h \
types.h types.c \
union_type.c union_type.h
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#include <ctype.h>
#include <tgmath.h>
#define G_LOG_DOMAIN ("PARSER")
#include "array_type.h"
#include "fundamental_type.h"
#include "ui_interface.h"
int array_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
types_t *type_child;
int length = 0;
char cbuf[50];
DISPLAY_PARSE_INFO("array", type->name, offset, parent_offset);
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF;
type_child = type_child->child) {
}
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name));
}
if (type->child != NULL) {
int items = type->size / type_child->size;
int i;
int zero_counter = 0;
gboolean is_string = FALSE;
char *string;
int nb_digits = 0;
/* Factorizes trailing 0 */
if ((items > 1) && (type_child->type == TYPE_FUNDAMENTAL))
{
for (i = items - 1; i >= 0; i--)
{
if (fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size) == 0)
{
zero_counter ++;
}
else
{
break;
}
}
/* Check if this is an array of 8 bits items and if at least the firsts ones are not null */
if ((type_child->size == 8) && (zero_counter >= 1) && ((items - zero_counter) >= 2))
{
int end = items - zero_counter;
/* check if this is a printable string */
is_string = TRUE;
string = malloc(end + 1);
for (i = 0; i < end; i++)
{
string[i] = fundamental_read_from_buffer(type_child, buffer, parent_offset, offset + i * type_child->size);
if (isprint(string[i]) == 0)
{
/* This is not a printable string */
is_string = FALSE;
break;
}
}
if (is_string)
{
string[i] = '\0';
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[0 .. %d] \"%s\"\n", end - 1, string));
ui_set_signal_text_cb(user_data, cbuf, length);
}
}
/* Do not factorize if there is only one null item */
if (zero_counter <= 1)
{
zero_counter = 0;
}
}
if (is_string == FALSE)
{
nb_digits = log10(items - zero_counter) + 1;
for (i = 0; i < (items - zero_counter); i++)
{
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%*d] ", nb_digits, i));
ui_set_signal_text_cb(user_data, cbuf, length);
type->child->type_dissect_from_buffer (
type->child, ui_set_signal_text_cb, user_data, buffer, parent_offset,
offset + i * type_child->size, indent,
FALSE);
}
if (zero_counter > 0)
{
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "[%d .. %d] ", i, items -1));
ui_set_signal_text_cb(user_data, cbuf, length);
type->child->type_dissect_from_buffer (
type->child, ui_set_signal_text_cb, user_data,
buffer, parent_offset, offset + i * type_child->size, indent, FALSE);
}
}
}
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "</%s>\n", type->name));
}
return 0;
}
int array_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Array>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Min ........: %d\n", type->min));
INDENTED(file, indent+4, fprintf(file, "Max ........: %d\n", type->max));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
if (type->child != NULL)
type->child->type_file_print (type->child, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Array>\n"));
return 0;
}
int array_type_hr_display(types_t *type, int indent) {
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Array>\n"));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Min ........: %d\n", type->min));
INDENTED(stdout, indent+4, printf("Max ........: %d\n", type->max));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
if (type->child != NULL)
type->child->type_hr_display (type->child, indent + 4);
INDENTED(stdout, indent, printf("</Array>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef ARRAY_TYPE_H_
#define ARRAY_TYPE_H_
int array_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int array_type_hr_display(types_t *type, int indent);
int array_type_file_print(types_t *type, int indent, FILE *file);
#endif /* ARRAY_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "enum_type.h"
#include "ui_interface.h"
char *enum_type_get_name_from_value(types_t *type, uint32_t value)
{
char *enum_name = "UNKNOWN";
types_t *enum_value;
/* Loop on each enumeration values */
for (enum_value = type->child; enum_value; enum_value = enum_value->next) {
if (value == enum_value->init_value) {
enum_name = enum_value->name;
break;
}
}
return enum_name;
}
int enum_type_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
uint32_t value = 0;
types_t *values;
DISPLAY_PARSE_INFO("enum", type->name, offset, parent_offset);
value = buffer_get_uint32_t(buffer, parent_offset + offset);
for (values = type->child; values; values = values->next) {
if (value == values->init_value) {
values->parent = type;
values->type_dissect_from_buffer(
values, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset,
type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, FALSE);
break;
}
}
if (values == NULL) {
int length = 0;
char cbuf[50];
length = sprintf(cbuf, "(0x%08x) UNKNOWN;\n", value);
ui_set_signal_text_cb(user_data, cbuf, length);
}
return 0;
}
int enum_type_file_print(types_t *type, int indent, FILE *file)
{
types_t *values;
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Enumeration>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
/* Call enum values display */
for (values = type->child; values; values = values->next) {
values->type_file_print(values, indent + 4, file);
}
INDENTED(file, indent, fprintf(file, "</Enumeration>\n"));
return 0;
}
int enum_type_hr_display(types_t *type, int indent)
{
types_t *values;
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Enumeration>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
/* Call enum values display */
for (values = type->child; values; values = values->next) {
values->type_hr_display(values, indent + 4);
}
INDENTED(stdout, indent, printf("</Enumeration>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef ENUM_TYPE_H_
#define ENUM_TYPE_H_
char *enum_type_get_name_from_value(types_t *type, uint32_t value);
int enum_type_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int enum_type_file_print(types_t *type, int indent, FILE *file);
int enum_type_hr_display(types_t *type, int indent);
#endif /* ENUM_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "enum_value_type.h"
#include "ui_interface.h"
uint32_t last_enum_value;
int enum_value_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
types_t *type_parent = NULL;
uint32_t value = 0;
DISPLAY_PARSE_INFO("enum_value", type->name, offset, parent_offset);
value = buffer_get_uint32_t(buffer, parent_offset + offset);
if (type->name) {
int length = 0;
char cbuf[50 + strlen(type->name)];
/* Search for enum variable name and check if it is used in association with a union type */
{
if (type->parent != NULL) {
/* Ignore ENUMERATION and TYPEDEF parents */
for (type_parent = type->parent; (type_parent != NULL) && ((type_parent->type == TYPE_ENUMERATION) || (type_parent->type == TYPE_TYPEDEF));
type_parent = type_parent->parent) {
}
}
if ((type_parent != NULL) && (type_parent->name != NULL) && (strcmp(type_parent->name, "present") == 0))
{
/* ASN1 union, keep the "present" member */
last_enum_value = value;
}
else
{
last_enum_value = 0;
}
}
length = sprintf(cbuf, "(0x%08x) %s;\n", value, type->name);
ui_set_signal_text_cb(user_data, cbuf, length);
}
return 0;
}
int enum_value_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Value>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Value ......: %d\n", type->init_value));
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
INDENTED(file, indent, fprintf(file, "</Value>\n"));
return 0;
}
int enum_value_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Value>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Value ......: %d\n", type->init_value));
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
INDENTED(stdout, indent, printf("</Value>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef ENUM_VALUE_TYPE_H_
#define ENUM_VALUE_TYPE_H_
extern uint32_t last_enum_value;
int enum_value_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int enum_value_file_print(types_t *type, int indent, FILE *file);
int enum_value_type_hr_display(types_t *type, int indent);
#endif /* ENUM_VALUE_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "rc.h"
#include "field_type.h"
#include "buffers.h"
#include "ui_interface.h"
int field_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
types_t *type_child;
char array_info[50];
new_line = FALSE;
DISPLAY_PARSE_INFO("field", type->name, offset, parent_offset);
CHECK_FCT(buffer_has_enouch_data(buffer, parent_offset + offset, type->size / 8));
if (type->bits == -1) {
if ((type->name != NULL) && (strcmp(type->name, "_asn_ctx") == 0)) {
/* Hide ASN1 asn_struct_ctx_t struct that hold context for parsing across buffer boundaries */
/*
INDENTED_STRING(cbuf, indent, sprintf(cbuf, ".asn_ctx ...\n"));
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length);
*/
}
else {
if (type->child != NULL) {
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child =
type_child->child) {
}
if (type_child->type == TYPE_ARRAY) {
types_t *type_array_child;
/* Ignore TYPEDEF children */
for (type_array_child = type_child->child;
type_array_child != NULL && type_array_child->type == TYPE_TYPEDEF; type_array_child =
type_array_child->child) {
}
sprintf (array_info, "[%d]", type_child->size / type_array_child->size);
}
else {
array_info[0] = '\0';
}
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, ".%s%s = ", type->name ? type->name : "Field", array_info));
ui_set_signal_text_cb(user_data, cbuf, length);
if (type_child->type == TYPE_ARRAY) {
DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);)
ui_set_signal_text_cb(user_data, "\n", 1);
new_line = TRUE;
}
/*
if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_BRACE(ui_set_signal_text_cb(user_data, "{", 1);)
ui_set_signal_text_cb(user_data, "\n", 1);
new_line = TRUE;
}
*/
type->child->parent = type;
type->child->type_dissect_from_buffer(
type->child, ui_set_signal_text_cb, user_data, buffer,
parent_offset, offset + type->offset, new_line ? indent + DISPLAY_TAB_SIZE : indent, new_line);
DISPLAY_BRACE(
if (type_child->type == TYPE_ARRAY) {
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);
});
/*
DISPLAY_BRACE(
if (type_child->type == TYPE_STRUCT || type_child->type == TYPE_UNION) {
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n"));
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length);
});
*/
}
}
}
else {
/* The field is only composed of bits */
uint32_t value = 0;
CHECK_FCT(buffer_fetch_bits(buffer, offset + type->offset + parent_offset, type->bits, &value));
DISPLAY_TYPE("Fld");
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, ".%s:%d = (0x%0*x) %d;\n", type->name ? type->name : "Field", type->bits, (type->bits + 3) / 4, value, value));
ui_set_signal_text_cb(user_data, cbuf, length);
}
return 0;
}
int field_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Field>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Bits .......: %d\n", type->bits));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Offset .....: %d\n", type->offset));
INDENTED(file, indent+4, fprintf(file, "Context ....: %d\n", type->context));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
if (type->child != NULL)
type->child->type_file_print (type->child, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Field>\n"));
return 0;
}
int field_type_hr_display(types_t *type, int indent) {
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Field>\n"));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Bits .......: %d\n", type->bits));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Offset .....: %d\n", type->offset));
INDENTED(stdout, indent+4, printf("Context ....: %d\n", type->context));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
if (type->child != NULL)
type->child->type_hr_display (type->child, indent + 4);
INDENTED(stdout, indent, printf("</Field>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef FIELD_TYPE_H_
#define FIELD_TYPE_H_
int field_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int field_type_file_print(types_t *type, int indent, FILE *file);
int field_type_hr_display(types_t *type, int indent);
#endif /* FIELD_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "file_type.h"
int file_type_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<File>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent, fprintf(file, "</File>\n"));
return 0;
}
int file_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<File>\n"));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent, printf("</File>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef FILE_TYPE_H_
#define FILE_TYPE_H_
int file_type_file_print(types_t *type, int indent, FILE *file);
int file_type_hr_display(types_t *type, int indent);
#endif /* FILE_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#define G_LOG_DOMAIN ("PARSER")
#include "fundamental_type.h"
#include "ui_interface.h"
uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset) {
uint64_t value;
switch (type->size) {
case 8:
value = buffer_get_uint8_t (buffer, offset + parent_offset);
break;
case 16:
value = buffer_get_uint16_t (buffer, offset + parent_offset);
break;
case 32:
value = buffer_get_uint32_t (buffer, offset + parent_offset);
break;
case 64:
value = buffer_get_uint64_t (buffer, offset + parent_offset);
break;
default:
/* ??? */
value = 0;
break;
}
return value;
}
int fundamental_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[200];
int type_unsigned;
uint8_t value8;
uint16_t value16;
uint32_t value32;
uint64_t value64;
DISPLAY_PARSE_INFO("fundamental", type->name, offset, parent_offset);
memset (cbuf, 0, 200);
type_unsigned = strstr (type->name, "unsigned") == NULL ? 0 : 1;
value64 = fundamental_read_from_buffer(type, buffer, offset, parent_offset);
indent = new_line ? indent : 0;
if (indent > 0)
{
DISPLAY_TYPE("Fun");
}
switch (type->size) {
case 8:
value8 = (uint8_t) value64;
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%02" PRIx8 ") %3" PRIu8 ";\n" : "(0x%02" PRIx8 ") %4" PRId8 ";\n", value8, value8));
break;
case 16:
value16 = (uint16_t) value64;
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%04" PRIx16 ") %5" PRIu16 ";\n" : "(0x%04" PRIx16 ") %6" PRId16 ";\n", value16, value16));
break;
case 32:
value32 = (uint32_t) value64;
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%08" PRIx32 ") %9" PRIu32 ";\n" : "(0x%08" PRIx32 ") %10" PRId32 ";\n", value32, value32));
break;
case 64:
INDENTED_STRING(cbuf, indent,
length = sprintf(cbuf, type_unsigned ? "(0x%016" PRIx64 ") %20" PRIu64 ";\n" : "(0x%016" PRIx64 ") %20" PRId64 ";\n", value64, value64));
break;
default:
/* ??? */
break;
}
ui_set_signal_text_cb(user_data, cbuf, length);
return 0;
}
int fundamental_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Fundamental>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Fundamental>\n"));
return 0;
}
int fundamental_type_hr_display(types_t *type, int indent) {
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Fundamental>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
INDENTED(stdout, indent, printf("</Fundamental>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef FUNDAMENTAL_TYPE_H_
#define FUNDAMENTAL_TYPE_H_
uint64_t fundamental_read_from_buffer(types_t *type, buffer_t *buffer, uint32_t offset, uint32_t parent_offset);
int fundamental_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int fundamental_type_file_print(types_t *type, int indent, FILE *file);
int fundamental_type_hr_display(types_t *type, int indent);
#endif /* FUNDAMENTAL_TYPE_H_ */
/*
* 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
*/
#include "fundamental_type.h"
#include "struct_type.h"
#ifndef INTERTASK_CONTEXTS_H_
#define INTERTASK_CONTEXTS_H_
typedef struct {
/* List of fundamental types that can contruct any other type */
fundamental_type_t *ft_list;
struct_type_t *struct_list;
} intertask_context_t;
#endif /* INTERTASK_CONTEXTS_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "pointer_type.h"
#include "ui_interface.h"
int pointer_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0, i;
char cbuf[200];
DISPLAY_PARSE_INFO("pointer", type->name, offset, parent_offset);
memset (cbuf, 0, 200);
uint8_t value[type->size / 8];
buffer_fetch_nbytes(buffer, parent_offset + offset, type->size / 8, value);
indent = new_line ? indent : 0;
if (indent > 0)
{
DISPLAY_TYPE("Ptr");
}
if (type->child && type->child->name) {
/*
INDENTED(stdout, indent, fprintf(stdout, "<%s>0x%08x</%s>\n",
type->child->name, value, type->child->name));
*/
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(%s *) 0x", type->child->name));
}
else {
/*
INDENTED(stdout, indent, fprintf(stdout, "<Pointer>0x%08x</Pointer>\n",
value));
*/
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "(void *) 0x"));
}
/* Append the value */
for (i = type->size / 8 - 1; i >= 0; i--) {
length += sprintf(&cbuf[length], "%02x", value[i]);
}
length += sprintf(&cbuf[length], ";\n");
ui_set_signal_text_cb(user_data, cbuf, length);
return 0;
}
int pointer_type_file_print(types_t *type, int indent, FILE *file) {
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Pointer>\n"));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
if (type->child != NULL) {
if (type->child->type == TYPE_FUNCTION) {
INDENTED(file, indent+4, fprintf(file, "<Function>\n"));
INDENTED(file, indent+8, fprintf(file, "<Args>To be done</Args>\n"));
INDENTED(file, indent+4, fprintf(file, "</Function>\n"));
} else {
type->child->type_file_print (type->child, indent + 4, file);
}
}
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
INDENTED(file, indent, fprintf(file, "</Pointer>\n"));
return 0;
}
int pointer_type_hr_display(types_t *type, int indent) {
return pointer_type_file_print(type, indent, stdout);
}
/*
* 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
*/
#include "types.h"
#ifndef POINTER_TYPE_H_
#define POINTER_TYPE_H_
int pointer_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int pointer_type_file_print(types_t *type, int indent, FILE *file);
int pointer_type_hr_display(types_t *type, int indent);
#endif /* POINTER_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "reference_type.h"
#include "ui_interface.h"
int reference_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
DISPLAY_PARSE_INFO("reference", type->name, offset, parent_offset);
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "<%s>\n", type->name));
}
if (type->child != NULL)
type->child->type_dissect_from_buffer(type->child, ui_set_signal_text_cb,
user_data, buffer, offset, parent_offset,
type->name == NULL ? indent: indent + DISPLAY_TAB_SIZE, TRUE);
if (type->name) {
INDENTED(stdout, indent, fprintf(stdout, "</%s>\n", type->name));
}
return 0;
}
int reference_type_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Reference>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Context ....: %d\n", type->context));
INDENTED(file, indent+4, fprintf(file, "Offset .....: %d\n", type->offset));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
if (type->child != NULL)
type->child->type_file_print(type->child, indent+4, file);
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
INDENTED(file, indent, fprintf(file, "</Reference>\n"));
return 0;
}
int reference_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Reference>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Context ....: %d\n", type->context));
INDENTED(stdout, indent+4, printf("Offset .....: %d\n", type->offset));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
if (type->child != NULL)
type->child->type_hr_display(type->child, indent+4);
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
INDENTED(stdout, indent, printf("</Reference>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef REFERENCE_TYPE_H_
#define REFERENCE_TYPE_H_
int reference_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int reference_type_file_print(types_t *type, int indent, FILE *file);
int reference_type_hr_display(types_t *type, int indent);
#endif /* REFERENCE_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "rc.h"
#include "struct_type.h"
#include "buffers.h"
#include "ui_callbacks.h"
#include "ui_interface.h"
int struct_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int i;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
int length = 0;
char *name;
memset (cbuf, 0, sizeof(cbuf));
DISPLAY_PARSE_INFO("structure", type->name, offset, parent_offset);
if (new_line) {
DISPLAY_TYPE("Str");
}
if (type->name) {
name = type->name;
}
else {
name = "_anonymous_";
}
if ((strcmp (name, "IttiMsgText_s") == 0) &&
(type->members_child[0] != NULL) && (strcmp (type->members_child[0]->name, "size") == 0) &&
(type->members_child[1] != NULL) && (strcmp (type->members_child[1]->name, "text") == 0)) {
uint8_t *buf;
length = buffer_get_uint32_t (buffer, offset + parent_offset);
buf = malloc (length + 1);
buf[0] = '\n';
buffer_fetch_nbytes(buffer, parent_offset + offset + 32, length, &buf[1]);
length = ui_callback_check_string ((char *) &buf[1], length, 0);
ui_set_signal_text_cb(user_data, (char *) buf, length + 1);
}
else
{
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s :", name));
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_dissect_from_buffer (
type->members_child[i], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
}
}
DISPLAY_BRACE(
DISPLAY_TYPE("Str");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);)
return 0;
}
int struct_type_file_print(types_t *type, int indent, FILE *file) {
int i;
if (type == NULL)
return -1;
if (file == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Struct>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members));
INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled));
INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_file_print (type->members_child[i], indent + 4, file);
}
INDENTED(file, indent, fprintf(file, "</Struct>\n"));
return 0;
}
int struct_type_hr_display(types_t *type, int indent) {
int i;
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Struct>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members));
INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled));
INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_hr_display (type->members_child[i], indent + 4);
}
INDENTED(stdout, indent, printf("</Struct>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef STRUCT_TYPE_H_
#define STRUCT_TYPE_H_
int struct_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int struct_type_hr_display(types_t *type, int indent);
int struct_type_file_print(types_t *type, int indent, FILE *file);
#endif /* STRUCT_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "typedef_type.h"
#include "ui_interface.h"
int typedef_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
types_t *type_child = NULL;
DISPLAY_PARSE_INFO("typedef", type->name, offset, parent_offset);
if (type->child != NULL) {
/* Ignore TYPEDEF children */
for (type_child = type->child; type_child != NULL && type_child->type == TYPE_TYPEDEF; type_child =
type_child->child) {
}
}
if ((type_child == NULL) || (type_child->type != TYPE_FUNDAMENTAL))
{
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf (cbuf, "%s, ", type->name));
ui_set_signal_text_cb(user_data, cbuf, length);
new_line = FALSE;
}
/* Simply call next_type */
if (type->child != NULL) {
type->child->parent = type;
type->child->type_dissect_from_buffer(
type->child, ui_set_signal_text_cb, user_data, buffer, offset, parent_offset, indent, new_line);
}
return 0;
}
int typedef_type_file_print(types_t *type, int indent, FILE *file)
{
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Typedef>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Type .......: %d\n", type->type_xml));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members));
INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled));
INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_file_print(type->file_ref, indent+4, file);
if (type->child != NULL)
type->child->type_file_print(type->child, indent+4, file);
INDENTED(file, indent, fprintf(file, "</Typedef>\n"));
return 0;
}
int typedef_type_hr_display(types_t *type, int indent)
{
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Typedef>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Type .......: %d\n", type->type_xml));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members));
INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled));
INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_hr_display(type->file_ref, indent+4);
if (type->child != NULL)
type->child->type_hr_display(type->child, indent+4);
INDENTED(stdout, indent, printf("</Typedef>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef TYPEDEF_TYPE_H_
#define TYPEDEF_TYPE_H_
int typedef_type_file_print(types_t *type, int indent, FILE *file);
int typedef_type_hr_display(types_t *type, int indent);
int typedef_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
#endif /* TYPEDEF_TYPE_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "types.h"
#include "array_type.h"
#include "enum_type.h"
#include "fundamental_type.h"
#include "struct_type.h"
#include "union_type.h"
#include "typedef_type.h"
#include "enum_value_type.h"
#include "file_type.h"
#include "field_type.h"
#include "reference_type.h"
#include "pointer_type.h"
types_t *type_new(enum type_e type)
{
types_t *new_p;
new_p = calloc(1, sizeof(types_t));
new_p->type = type;
switch(type) {
case TYPE_FUNCTION:
/* Nothing to do for now. Display is done by pointer type */
break;
case TYPE_ENUMERATION:
new_p->type_hr_display = enum_type_hr_display;
new_p->type_file_print = enum_type_file_print;
new_p->type_dissect_from_buffer = enum_type_dissect_from_buffer;
break;
case TYPE_FUNDAMENTAL:
new_p->type_hr_display = fundamental_type_hr_display;
new_p->type_file_print = fundamental_type_file_print;
new_p->type_dissect_from_buffer = fundamental_dissect_from_buffer;
break;
case TYPE_STRUCT:
new_p->type_hr_display = struct_type_hr_display;
new_p->type_file_print = struct_type_file_print;
new_p->type_dissect_from_buffer = struct_dissect_from_buffer;
break;
case TYPE_UNION:
new_p->type_hr_display = union_type_hr_display;
new_p->type_file_print = union_type_file_print;
new_p->type_dissect_from_buffer = union_dissect_from_buffer;
break;
case TYPE_TYPEDEF:
new_p->type_hr_display = typedef_type_hr_display;
new_p->type_file_print = typedef_type_file_print;
new_p->type_dissect_from_buffer = typedef_dissect_from_buffer;
break;
case TYPE_ENUMERATION_VALUE:
new_p->type_hr_display = enum_value_type_hr_display;
new_p->type_file_print = enum_value_file_print;
new_p->type_dissect_from_buffer = enum_value_dissect_from_buffer;
break;
case TYPE_FILE:
new_p->type_hr_display = file_type_hr_display;
new_p->type_file_print = file_type_file_print;
// new_p->type_dissect_from_buffer = file_dissect_from_buffer;
break;
case TYPE_FIELD:
new_p->type_hr_display = field_type_hr_display;
new_p->type_file_print = field_type_file_print;
new_p->type_dissect_from_buffer = field_dissect_from_buffer;
break;
case TYPE_REFERENCE:
new_p->type_hr_display = reference_type_hr_display;
new_p->type_file_print = reference_type_file_print;
new_p->type_dissect_from_buffer = reference_dissect_from_buffer;
break;
case TYPE_ARRAY:
new_p->type_hr_display = array_type_hr_display;
new_p->type_file_print = array_type_file_print;
new_p->type_dissect_from_buffer = array_dissect_from_buffer;
break;
case TYPE_POINTER:
new_p->type_hr_display = pointer_type_hr_display;
new_p->type_file_print = pointer_type_file_print;
new_p->type_dissect_from_buffer = pointer_dissect_from_buffer;
break;
default:
break;
}
return new_p;
}
int types_insert_tail(types_t **head, types_t *to_insert)
{
if (to_insert == NULL || head == NULL)
return -1;
if (*head == NULL) {
*head = to_insert;
} else {
types_t *last = *head;
while(last->next != NULL) {
last = last->next;
}
last->next = to_insert;
to_insert->previous = last;
}
to_insert->head = *head;
return 0;
}
void types_hr_display(types_t *head)
{
types_t *current = head;
if (head == NULL) {
printf("Empty list\n");
/* Empty list */
return;
}
while((current = current->next) != NULL)
{
current->type_hr_display(current, 0);
}
}
/*
* 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
*/
#include <stdio.h>
#include "buffers.h"
#include "ui_main_screen.h"
#include "ui_interface.h"
#ifndef TYPES_H_
#define TYPES_H_
/* Activate to display the type at the beginning of the line (debug option) */
#define ENABLE_DISPLAY_TYPE 0
/* Activate to display the parse information before processing each item (debug option) */
#define ENABLE_DISPLAY_PARSE_INFO 0
/* Activate to show braces, in increase the number of displayed lines (formating option)*/
#define ENABLE_DISPLAY_BRACE 1
#if (ENABLE_DISPLAY_TYPE != 0)
# define DISPLAY_TYPE(tYPE) ui_set_signal_text_cb(user_data, tYPE" ", strlen(tYPE) + 1);
#else
# define DISPLAY_TYPE(tYPE)
#endif
#define DISPLAY_TAB_SIZE (2)
#if (ENABLE_DISPLAY_PARSE_INFO != 0)
# define DISPLAY_PARSE_INFO(tYPE, nAME, oFFSET, pARENToFFSET) \
{ \
char buf[200]; \
sprintf(buf, "/* %s \"%s\" %d %d */\n", tYPE, nAME, oFFSET, pARENToFFSET); \
ui_set_signal_text_cb(user_data, buf, strlen(buf)); \
}
#else
# define DISPLAY_PARSE_INFO(tYPE, nAME, oFFSET, pARENToFFSET)
#endif
#if (ENABLE_DISPLAY_BRACE != 0)
# define DISPLAY_BRACE(cODE) if (ui_main_data.display_brace) {cODE}
#else
# define DISPLAY_BRACE(cODE)
#endif
enum type_e {
TYPE_ENUMERATION,
TYPE_ENUMERATION_VALUE,
TYPE_STRUCT,
TYPE_UNION,
TYPE_FUNDAMENTAL,
TYPE_TYPEDEF,
TYPE_ARRAY,
TYPE_REFERENCE,
TYPE_FIELD,
TYPE_FUNCTION,
TYPE_ARGUMENT,
TYPE_POINTER,
TYPE_FILE,
};
/* Forward declarations */
struct types_s;
typedef int (*type_hr_display_t)(struct types_s *type, int indent);
typedef int (*type_ui_display_t)(struct types_s *type, int indent);
typedef int (*type_file_print_t)(struct types_s *type, int indent, FILE *file);
/**
* type_dissect_from_buffer_t
* @param type The current type
* @param ui_set_signal_text_cb GUI display function
* @param user_data Transparent data to pass to the GUI display function
* @param buffer The buffer containing data to dissect
* @param offset offset of field from the beginning of the parent
* @param parent_offset offset of the parent from begining
**/
typedef int (*type_dissect_from_buffer_t)(
struct types_s *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
typedef struct types_s {
/* The type of the current description */
enum type_e type;
/* Printable name for the current type */
char *name;
int type_xml;
int size;
int align;
int bits;
/* Used only for arrays */
int min;
int max;
int context;
/* Init value for enumerations */
int init_value;
int incomplete;
/* Id of the type as defined in XML file */
int id;
int artificial;
char *mangled;
char *demangled;
/* List of members in constructed types */
char *members;
/* The file containing the definition */
char *file;
/* Line number of the current definition */
int line;
/* offset of the field in the parent type
* -1 means no parent
*/
int offset;
struct types_s *previous;
struct types_s *next;
struct types_s *parent;
struct types_s *child;
struct types_s *file_ref;
/* Reference to the head */
struct types_s *head;
/* For structures or union */
int nb_members;
struct types_s **members_child;
/* Some procedures to display the type on terminal */
type_hr_display_t type_hr_display;
/* Some procedures to display the type on UI */
type_ui_display_t type_ui_display;
/* Procedure to display the type to a file */
type_file_print_t type_file_print;
/* Dissect the type */
type_dissect_from_buffer_t type_dissect_from_buffer;
} types_t;
types_t *type_new(enum type_e type);
int types_insert_tail(types_t **head, types_t *to_insert);
void types_hr_display(types_t *head);
#define INDENTED(fILE, x, y) \
do { \
int indentation = x; \
while(indentation--) fprintf(fILE, " "); \
y; \
} while(0)
#define INDENTED_STRING(sTR, x, y) \
do { \
int indentation = x; \
while(indentation--) ui_set_signal_text_cb(user_data, " ", 1); \
y; \
} while(0)
#endif /* TYPES_H_ */
/*
* 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
*/
#include <stdio.h>
#include <stdlib.h>
#include <assert.h>
#include <string.h>
#define G_LOG_DOMAIN ("PARSER")
#include "rc.h"
#include "enum_value_type.h"
#include "union_type.h"
#include "../libresolver/locate_root.h"
#include "ui_interface.h"
/* There is only one special case of union which is associated to an index: the message id */
int union_msg_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
uint32_t message_id;
int length = 0;
char cbuf[200];
DISPLAY_PARSE_INFO("union_msg", type->name, offset, parent_offset);
CHECK_FCT(get_message_id(type->head, buffer, &message_id));
if (type->name) {
DISPLAY_TYPE("Uni");
length = sprintf(cbuf, "%s |", type->name);
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length);
}
if (type->members_child[message_id] != NULL)
type->members_child[message_id]->type_dissect_from_buffer(
type->members_child[message_id], ui_set_signal_text_cb, user_data,
buffer, offset, parent_offset, type->name == NULL ? indent : indent + DISPLAY_TAB_SIZE, TRUE);
DISPLAY_BRACE(
if (type->name) {
DISPLAY_TYPE("Uni");
INDENTED_STRING(cbuf, indent, length = sprintf(cbuf, "};\n"));
ui_set_signal_text_cb(user_data, cbuf, length);
});
return RC_OK;
}
int union_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line)
{
int length = 0;
char cbuf[50 + (type->name ? strlen (type->name) : 0)];
char *name;
int union_child = 0;
DISPLAY_PARSE_INFO("union", type->name, offset, parent_offset);
memset (cbuf, 0, sizeof(cbuf));
// CHECK_FCT(buffer_has_enouch_data(buffer, offset + parent_offset, type->size / 8));
if (type->name) {
name = type->name;
}
else {
name = "_anonymous_";
}
if (new_line) {
DISPLAY_TYPE("Uni");
}
INDENTED_STRING(cbuf, new_line ? indent : 0, length = sprintf(cbuf, "%s |", name));
DISPLAY_BRACE(length += sprintf(&cbuf[length], " {"););
length += sprintf(&cbuf[length], "\n");
ui_set_signal_text_cb(user_data, cbuf, length);
if (type->name) {
if (type->parent != NULL)
{
if ((type->parent->name != NULL) && (strcmp(type->parent->name, "choice") == 0))
{
/* ASN1 union */
if ((last_enum_value > 0) && (last_enum_value <= type->nb_members))
{
union_child = last_enum_value - 1;
g_debug("ASN1 union \"%s\' detected, use member %d", type->name, union_child);
}
}
}
}
/* Only dissect the first field present in unions */
if (type->members_child[union_child] != NULL)
type->members_child[union_child]->type_dissect_from_buffer(
type->members_child[union_child], ui_set_signal_text_cb, user_data, buffer,
offset, parent_offset, indent + DISPLAY_TAB_SIZE, TRUE);
DISPLAY_BRACE(
DISPLAY_TYPE("Uni");
INDENTED_STRING(cbuf, indent, sprintf(cbuf, "};\n"));
length = strlen (cbuf);
ui_set_signal_text_cb(user_data, cbuf, length););
return 0;
}
int union_type_file_print(types_t *type, int indent, FILE *file) {
int i;
if (type == NULL)
return -1;
INDENTED(file, indent, fprintf(file, "<Union>\n"));
INDENTED(file, indent+4, fprintf(file, "Name .......: %s\n", type->name));
INDENTED(file, indent+4, fprintf(file, "Id .........: %d\n", type->id));
INDENTED(file, indent+4, fprintf(file, "Size .......: %d\n", type->size));
INDENTED(file, indent+4, fprintf(file, "Align ......: %d\n", type->align));
INDENTED(file, indent+4, fprintf(file, "Artificial .: %d\n", type->artificial));
INDENTED(file, indent+4, fprintf(file, "File .......: %s\n", type->file));
INDENTED(file, indent+4, fprintf(file, "Line .......: %d\n", type->line));
INDENTED(file, indent+4, fprintf(file, "Members ....: %s\n", type->members));
INDENTED(file, indent+4, fprintf(file, "Mangled ....: %s\n", type->mangled));
INDENTED(file, indent+4, fprintf(file, "Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_file_print (type->file_ref, indent + 4, file);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_file_print (type->members_child[i], indent + 4, file);
}
INDENTED(file, indent, fprintf(file, "</Union>\n"));
return 0;
}
int union_type_hr_display(types_t *type, int indent) {
int i;
if (type == NULL)
return -1;
INDENTED(stdout, indent, printf("<Union>\n"));
INDENTED(stdout, indent+4, printf("Name .......: %s\n", type->name));
INDENTED(stdout, indent+4, printf("Id .........: %d\n", type->id));
INDENTED(stdout, indent+4, printf("Size .......: %d\n", type->size));
INDENTED(stdout, indent+4, printf("Align ......: %d\n", type->align));
INDENTED(stdout, indent+4, printf("Artificial .: %d\n", type->artificial));
INDENTED(stdout, indent+4, printf("File .......: %s\n", type->file));
INDENTED(stdout, indent+4, printf("Line .......: %d\n", type->line));
INDENTED(stdout, indent+4, printf("Members ....: %s\n", type->members));
INDENTED(stdout, indent+4, printf("Mangled ....: %s\n", type->mangled));
INDENTED(stdout, indent+4, printf("Demangled ..: %s\n", type->demangled));
if (type->file_ref != NULL)
type->file_ref->type_hr_display (type->file_ref, indent + 4);
for (i = 0; i < type->nb_members; i++) {
if (type->members_child[i] != NULL)
type->members_child[i]->type_hr_display (type->members_child[i], indent + 4);
}
INDENTED(stdout, indent, printf("</Union>\n"));
return 0;
}
/*
* 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
*/
#include "types.h"
#ifndef UNION_TYPE_H_
#define UNION_TYPE_H_
int union_msg_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int union_dissect_from_buffer(
types_t *type, ui_set_signal_text_cb_t ui_set_signal_text_cb, gpointer user_data,
buffer_t *buffer, uint32_t offset, uint32_t parent_offset, int indent, gboolean new_line);
int union_type_file_print(types_t *type, int indent, FILE *file);
int union_type_hr_display(types_t *type, int indent);
#endif /* UNION_TYPE_H_ */
This diff is collapsed.
/*
* 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
*/
#include "rc.h"
#include "types.h"
#ifndef XML_PARSE_H_
#define XML_PARSE_H_
extern void *xml_raw_data;
extern uint32_t xml_raw_data_size;
extern types_t *root;
int xml_parse_file(const char *filename);
int xml_parse_buffer(char *xml_buffer, const int size);
int dissect_signal(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
gpointer user_data);
int dissect_signal_header(buffer_t *buffer, ui_set_signal_text_cb_t ui_set_signal_text_cb,
gpointer cb_user_data);
#endif /* XML_PARSE_H_ */
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libui \
-I$(top_srcdir)/libbuffers
noinst_LTLIBRARIES = libresolver.la
libresolver_la_LDFLAGS = -all-static
libresolver_la_SOURCES = \
locate_root.c locate_root.h \
resolvers.c resolvers.h
/*
* 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
*/
#include <stdio.h>
#include <string.h>
#define G_LOG_DOMAIN ("RESOLVER")
#include <glib.h>
#include "logs.h"
#include "rc.h"
#include "types.h"
#include "enum_type.h"
#include "locate_root.h"
#include "xml_parse.h"
types_t *messages_id_enum;
types_t *lte_time_type;
types_t *lte_time_frame_type;
types_t *lte_time_slot_type;
types_t *origin_task_id_type;
types_t *destination_task_id_type;
types_t *instance_type;
types_t *message_header_type;
types_t *message_type;
types_t *message_size_type;
int locate_root(const char *root_name, types_t *head, types_t **root_elm) {
types_t *next_type;
int next_counter = 0;
/* The root element is for example : MessageDef.
* This element is the entry for other sub-types.
*/
if (!root_name || (strlen (root_name) == 0)) {
g_warning("FATAL: no root element name provided");
return -1;
}
if (!head) {
g_warning("Empty list detected");
return -1;
}
if (!root_elm) {
g_warning("NULL root reference");
return -1;
}
for (next_type = head; next_type; next_type = next_type->next) {
if (next_type->name == NULL)
continue;
if (strcmp (root_name, next_type->name) == 0) {
/* Matching reference */
break;
}
next_counter ++;
}
g_info("locate_root: %s %d", root_name, next_counter);
*root_elm = next_type;
return (next_type == NULL) ? -2 : 0;
}
int locate_type(const char *type_name, types_t *head, types_t **type) {
types_t *next_type;
int next_counter = 0;
/* The root element is for example : MessageDef.
* This element is the entry for other sub-types.
*/
if (!type_name) {
g_warning("FATAL: no element name provided");
return RC_BAD_PARAM;
}
if (!head) {
g_warning("Empty list detected");
return RC_BAD_PARAM;
}
for (next_type = head; next_type; next_type = next_type->next) {
if (next_type->name == NULL)
continue;
if (strcmp (type_name, next_type->name) == 0) {
/* Matching reference */
break;
}
next_counter ++;
}
g_info("locate_type: %s %d %p", type_name, next_counter, next_type);
if (type)
*type = next_type;
return (next_type == NULL) ? RC_FAIL : RC_OK;
}
int locate_type_children(const char *type_name, types_t *head, types_t **type) {
types_t *found_type = NULL;
int i;
/* The root element is for example : MessageDef.
* This element is the entry for other sub-types.
*/
if (!type_name) {
g_warning("FATAL: no element name provided");
return RC_BAD_PARAM;
}
if (!head) {
g_warning("Empty list detected");
return RC_BAD_PARAM;
}
for (i = 0; i < head->nb_members; i++) {
if (head->members_child[i]->name == NULL)
continue;
if (strcmp (type_name, head->members_child[i]->name) == 0) {
/* Matching reference */
found_type = head->members_child[i];
break;
}
}
g_info("locate_type: %s %d %p", type_name, i, found_type);
if (type)
*type = found_type;
return (found_type == NULL) ? RC_FAIL : RC_OK;
}
uint32_t get_message_header_type_size(void)
{
/* Typedef */
if (message_header_type->child != NULL) {
/* Struct */
if (message_header_type->child->child != NULL) {
return message_header_type->child->child->size;
}
}
return 0;
}
uint32_t get_message_size(buffer_t *buffer)
{
uint32_t value = 0;
if (message_size_type != NULL)
{
types_t *temp = message_size_type;
while (temp->size == -1) {
temp = temp->child;
}
/* Fetch instance value */
buffer_fetch_bits (buffer, message_size_type->offset, temp->size, &value);
}
return value;
}
uint32_t get_lte_frame(buffer_t *buffer) {
uint32_t value = 0;
if (lte_time_type !=NULL)
{
/* Fetch instance value */
buffer_fetch_bits (buffer, lte_time_type->offset + lte_time_frame_type->offset, lte_time_frame_type->child->child->size, &value);
}
return value;
}
uint32_t get_lte_slot(buffer_t *buffer) {
uint32_t value = 0;
if (lte_time_type !=NULL)
{
/* Fetch instance value */
buffer_fetch_bits (buffer, lte_time_type->offset + lte_time_slot_type->offset, lte_time_slot_type->child->child->size, &value);
}
return value;
}
uint32_t get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id) {
uint32_t value;
g_assert(message_id != NULL);
g_assert(buffer != NULL);
/* MessageId is an offset from start of buffer */
value = buffer_get_uint32_t(buffer, messages_id_enum->offset);
*message_id = value;
return RC_OK;
}
uint32_t get_task_id(buffer_t *buffer, types_t *task_id_type) {
uint32_t task_id_value;
/* Fetch task id value */
if (buffer_fetch_bits (buffer, task_id_type->offset, task_id_type->child->size, &task_id_value) != RC_OK)
{
return ~0;
}
return task_id_value;
}
char *task_id_to_string(uint32_t task_id_value, types_t *task_id_type) {
char *task_id = "UNKNOWN";
if (task_id_value < ((uint32_t) ~0))
{
/* Search task id name */
task_id = enum_type_get_name_from_value (task_id_type->child, task_id_value);
}
return task_id;
}
uint32_t get_instance(buffer_t *buffer) {
uint32_t instance_value;
/* Fetch instance value */
buffer_fetch_bits (buffer, instance_type->offset, instance_type->child->child->child->size, &instance_value);
return instance_value;
}
char *message_id_to_string(uint32_t message_id)
{
return enum_type_get_name_from_value(messages_id_enum, message_id);
}
/*
* 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 LOCATE_ROOT_H_
#define LOCATE_ROOT_H_
#include "types.h"
extern types_t *messages_id_enum;
extern types_t *lte_time_type;
extern types_t *lte_time_frame_type;
extern types_t *lte_time_slot_type;
extern types_t *origin_task_id_type;
extern types_t *destination_task_id_type;
extern types_t *instance_type;
extern types_t *message_header_type;
extern types_t *message_type;
extern types_t *message_size_type;
int locate_root(const char *root_name, types_t *head, types_t **root);
int locate_type(const char *type_name, types_t *head, types_t **type);
int locate_type_children(const char *type_name, types_t *head, types_t **type);
uint32_t get_message_header_type_size(void);
uint32_t get_message_size(buffer_t *buffer);
uint32_t get_lte_frame(buffer_t *buffer);
uint32_t get_lte_slot(buffer_t *buffer);
uint32_t get_message_id(types_t *head, buffer_t *buffer, uint32_t *message_id);
char *message_id_to_string(uint32_t message_id);
uint32_t get_task_id(buffer_t *buffer, types_t *task_id_type);
char *task_id_to_string(uint32_t task_id_value, types_t *task_id_type);
uint32_t get_instance(buffer_t *buffer);
#endif /* LOCATE_ROOT_H_ */
This diff is collapsed.
/*
* 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 RESOLVERS_H_
#define RESOLVERS_H_
int resolve_typedefs(types_t **head);
int resolve_struct(types_t **head);
int resolve_pointer_type(types_t **head);
int resolve_field(types_t **head);
int resolve_array(types_t **head);
int resolve_reference(types_t **head);
int resolve_union(types_t **head);
int resolve_file(types_t **head);
int resolve_function(types_t **head);
int search_file(types_t *head, types_t **found, int id);
#endif /* RESOLVERS_H_ */
AM_CFLAGS = \
@ADD_CFLAGS@ \
-I$(top_srcdir)/common \
-I$(top_srcdir)/libbuffers \
-I$(top_srcdir)/libparser \
-I$(top_srcdir)/libresolver
noinst_LTLIBRARIES = libui.la
libui_la_LDFLAGS = -all-static
libui_la_SOURCES = \
ui_main_screen.c ui_main_screen.h \
ui_menu_bar.c ui_menu_bar.h \
ui_callbacks.c ui_callbacks.h \
ui_tree_view.c ui_tree_view.h \
ui_signal_dissect_view.c ui_signal_dissect_view.h \
ui_notifications.c ui_notifications.h \
ui_notif_dlg.c ui_notif_dlg.h \
ui_interface.c ui_interface.h \
ui_notebook.c ui_notebook.h \
ui_filters.c ui_filters.h
\ No newline at end of file
This diff is collapsed.
/*
* 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 UI_CALLBACKS_H_
#define UI_CALLBACKS_H_
#include <gtk/gtk.h>
gboolean ui_callback_on_open_messages(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_save_messages(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_filters_enabled(GtkToolButton *button,
gpointer data);
gboolean ui_callback_on_open_filters(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_save_filters(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_enable_filters(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_about(GtkWidget *widget,
gpointer data);
gint ui_callback_check_string (const char *string,
const gint lenght,
const guint message_number);
gboolean ui_pipe_callback(gint source, gpointer user_data);
gboolean ui_callback_on_auto_reconnect(GtkWidget *widget,
gpointer data);
void ui_callback_dialogbox_connect_destroy(void);
gboolean ui_callback_on_connect(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_disconnect(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_tree_view_select(GtkWidget *widget,
GdkEvent *event,
gpointer data);
gboolean ui_callback_on_select_signal(GtkTreeSelection *selection,
GtkTreeModel *model,
GtkTreePath *path,
gboolean path_currently_selected,
gpointer userdata);
void ui_signal_add_to_list(gpointer data,
gpointer user_data);
gboolean ui_callback_on_menu_enable (GtkWidget *widget, gpointer data);
gboolean ui_callback_on_menu_color (GtkWidget *widget, gpointer data);
gboolean ui_callback_signal_go_to_first(GtkWidget *widget,
gpointer data);
gboolean ui_callback_signal_go_to(GtkWidget *widget,
gpointer data);
gboolean ui_callback_signal_go_to_entry(GtkWidget *widget,
gpointer data);
gboolean ui_callback_signal_go_to_last(GtkWidget *widget,
gpointer data);
gboolean ui_callback_display_message_header(GtkWidget *widget,
gpointer data);
gboolean ui_callback_display_brace(GtkWidget *widget,
gpointer data);
gboolean ui_callback_signal_clear_list(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_menu_none(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_menu_all(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_menu_item_selected(GtkWidget *widget,
gpointer data);
gboolean ui_callback_on_tree_column_header_click(GtkWidget *widget,
gpointer data);
#endif /* UI_CALLBACKS_H_ */
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -88,7 +88,7 @@ void *msc_task(void *args_p)
if (received_message_p != NULL) {
// msg_name = ITTI_MSG_NAME (received_message_p);
// instance = ITTI_MSG_INSTANCE (received_message_p);
// instance = ITTI_MSG_DESTINATION_INSTANCE (received_message_p);
switch (ITTI_MSG_ID(received_message_p)) {
case TIMER_HAS_EXPIRED: {
msc_flush_messages();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -514,7 +514,7 @@ int main( int argc, char **argv ) {
initTpool(params_dl, Tpool_dl, false);
#endif
cpuf=get_cpu_freq_GHz();
itti_init(TASK_MAX, THREAD_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
itti_init(TASK_MAX, MESSAGES_ID_MAX, tasks_info, messages_info);
init_opt() ;
load_nrLDPClib();
......
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
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