Commit 1565d717 authored by Bi-Ruei, Chiu's avatar Bi-Ruei, Chiu

Send RRC messages over network interface for Wireshark logging

It is for debugging and learning purpose.
parent 10944d4a
......@@ -272,6 +272,16 @@ if (${ENABLE_ITTI})
set(GTPU_need_ITTI ${OPENAIR3_DIR}/GTPV1-U/gtpv1u_eNB.c)
endif (${ENABLE_ITTI})
add_boolean_option(ENABLE_WSTRACE True "Enable sending Uu interface message to Wireshark")
set (WSTRACE_DIR ${OPENAIR_DIR}/common/utils/wstrace)
if (${ENABLE_WSTRACE})
add_library(WSTRACE
# add .h files if depend on (this one is generated)
${WSTRACE_DIR}/ws_trace.c
)
set(WSTRACE_LIB WSTRACE)
endif (${ENABLE_WSTRACE})
#############################
# ASN.1 grammar C code generation & dependancies
################################
......@@ -774,6 +784,7 @@ include_directories("${OPENAIR2_DIR}/RRC/LTE/MESSAGES")
include_directories("${OPENAIR2_DIR}/RRC/LTE")
include_directories("${OPENAIR_DIR}/common/utils")
include_directories("${OPENAIR_DIR}/common/utils/itti")
include_directories("${OPENAIR_DIR}/common/utils/wstrace")
include_directories("${OPENAIR3_DIR}/NAS/COMMON")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/API/NETWORK")
include_directories("${OPENAIR3_DIR}/NAS/COMMON/EMM/MSG")
......@@ -1930,7 +1941,7 @@ add_executable(lte-softmodem
target_link_libraries (lte-softmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${WSTRACE_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
......@@ -1967,7 +1978,7 @@ add_executable(lte-softmodem-nos1
)
target_link_libraries (lte-softmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_LIB SCHED_RU_LIB PHY_COMMON PHY PHY_RU LFDS L2 ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${WSTRACE_LIB}
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} ${FLEXRAN_AGENT_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_VNF_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl )
......@@ -2006,7 +2017,7 @@ add_executable(lte-uesoftmodem
target_link_libraries (lte-uesoftmodem
-Wl,--start-group
RRC_LIB S1AP_LIB S1AP_ENB GTPV1U SECU_CN SECU_OSA UTIL HASHTABLE SCTP_CLIENT UDP SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
${MSC_LIB} ${RAL_LIB} ${NAS_UE_LIB} ${ITTI_LIB} ${WSTRACE_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl)
......@@ -2043,7 +2054,7 @@ add_executable(lte-uesoftmodem-nos1
target_link_libraries (lte-uesoftmodem-nos1
-Wl,--start-group
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB}
RRC_LIB SECU_CN SECU_OSA UTIL HASHTABLE SCHED_RU_LIB SCHED_UE_LIB PHY_COMMON PHY_UE PHY_RU LFDS L2_UE ${MSC_LIB} ${RAL_LIB} ${ITTI_LIB} ${WSTRACE_LIB}
${MIH_LIB} ${FLPT_MSG_LIB} ${ASYNC_IF_LIB} LFDS7
NFAPI_COMMON_LIB NFAPI_LIB NFAPI_PNF_LIB NFAPI_USER_LIB
-Wl,--end-group z dl )
......@@ -2235,7 +2246,7 @@ add_executable(test_epc_play_scenario
)
target_include_directories(test_epc_play_scenario PUBLIC /usr/local/share/asn1c)
target_link_libraries (test_epc_play_scenario
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
-Wl,--start-group RRC_LIB S1AP_LIB X2AP_LIB GTPV1U LIB_NAS_UE SECU_CN UTIL HASHTABLE SCTP_CLIENT UDP SCHED_LIB PHY_COMMON PHY PHY_UE LFDS ${ITTI_LIB} ${WSTRACE_LIB} ${MSC_LIB} -Wl,--end-group pthread m rt crypt sctp ${LIBXML2_LIBRARIES} ${LIBXSLT_LIBRARIES} ${CRYPTO_LIBRARIES} ${OPENSSL_LIBRARIES} ${NETTLE_LIBRARIES} ${CONFIG_LIBRARIES}
)
......
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <unistd.h>
#include <errno.h>
#include <sys/types.h>
#include <sys/errno.h>
#include <sys/socket.h>
#include <sys/uio.h>
#include <sys/eventfd.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <string.h>
#include <arpa/inet.h>
#include <pthread.h>
#include <arpa/inet.h>
#include "ws_trace.h"
pthread_t pid = -1;
pthread_mutex_t ws_lock = PTHREAD_MUTEX_INITIALIZER;
static int ws_client_socket = 0;
static volatile int ws_thread_disable = 0;
static void *ws_listen_thread(void *data)
{
struct sockaddr_in servaddr; /* the server's full addr */
int ws_server_socket = -1;
int ep_fd = -1;
struct epoll_event read_event;
struct epoll_event events[10];
int i, ret_ev, nbytes;
unsigned char buffer[256];
/* prepare ws server socket and lisener */
if ((ws_server_socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("create ws server socket failed");
goto error_handler;
}
bzero((char *)&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = inet_addr(WS_TRACE_ADDRESS);
servaddr.sin_port = htons(WS_TRACE_PORT);
if (bind(ws_server_socket, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0) {
perror("bind ws_server_socket failed!");
goto error_handler;
}
ep_fd = epoll_create1(0);
if (ep_fd < 0) {
perror("epoll create failed!");
goto error_handler;
}
bzero((char *)&read_event, sizeof(read_event));
read_event.events = EPOLLIN;
read_event.data.fd = ws_server_socket;
epoll_ctl(ep_fd, EPOLL_CTL_ADD, ws_server_socket, &read_event);
bzero((char *)&events, sizeof(events));
while (!ws_thread_disable) {
ret_ev = epoll_wait(ep_fd, &events[0], sizeof(events)/sizeof(events[0]), -1);
for (i = 0; i < ret_ev; i++) {
if ((events[i].events & EPOLLIN) &&
(events[i].data.fd == ws_server_socket)) {
nbytes = recv(ws_server_socket, &buffer, sizeof(buffer), 0);
}
}
}
error_handler:
if (ws_server_socket > 0) {
close(ws_server_socket);
}
if (ep_fd > 0) {
epoll_ctl(ep_fd, EPOLL_CTL_DEL, ws_server_socket, &read_event);
close(ep_fd);
}
return NULL;
}
void start_ws_trace(void)
{
struct sockaddr_in myaddr; /* address that client uses */
struct sockaddr_in servaddr; /* the server's full addr */
if (ws_client_socket) {
return;
}
pthread_mutex_init(&ws_lock, NULL);
pthread_mutex_lock(&ws_lock);
/* prepare ws client socket */
if ((ws_client_socket = socket(AF_INET, SOCK_DGRAM, 0)) < 0) {
perror("create ws client socket failed");
goto error_handler;
}
bzero((char *)&myaddr, sizeof(myaddr));
myaddr.sin_family = AF_INET;
myaddr.sin_addr.s_addr = htonl(INADDR_ANY);
myaddr.sin_port = htons(0);
if (bind(ws_client_socket, (struct sockaddr *)&myaddr, sizeof(myaddr)) < 0) {
perror("bind ws_client_socket failed!");
goto error_handler;
}
bzero((char *)&servaddr, sizeof(servaddr));
servaddr.sin_family = AF_INET;
servaddr.sin_addr.s_addr = inet_addr(WS_TRACE_ADDRESS);
servaddr.sin_port = htons(WS_TRACE_PORT);
if (connect(ws_client_socket, (struct sockaddr *)&servaddr, sizeof(servaddr)) < 0) {
perror("connect to ws server failed");
goto error_handler;
}
if (pthread_create(&pid, NULL, ws_listen_thread, NULL) < 0) {
perror("ws thread create failed!");
goto error_handler;
}
pthread_mutex_unlock(&ws_lock);
return;
error_handler:
if (ws_client_socket > 0) {
close(ws_client_socket);
ws_client_socket = 0;
}
if (pid > 0) {
pthread_join(pid, NULL);
}
pthread_mutex_unlock(&ws_lock);
return;
}
void send_ws_log(unsigned short msg_type, unsigned short rnti, const unsigned char *msg_buf, unsigned short msg_len)
{
struct iovec iov[2];
ssize_t nwritten;
unsigned short header[2];
pthread_mutex_lock(&ws_lock);
if (ws_client_socket == 0) {
pthread_mutex_unlock(&ws_lock);
return;
}
header[0] = msg_type;
header[1] = rnti;
iov[0].iov_base = (void *)&header[0];
iov[0].iov_len = sizeof(header);
iov[1].iov_base = (void *)msg_buf;
iov[1].iov_len = msg_len;
writev(ws_client_socket, iov, 2);
pthread_mutex_unlock(&ws_lock);
return;
}
void stop_ws_trace(void)
{
pthread_mutex_lock(&ws_lock);
close(ws_client_socket);
ws_client_socket = 0;
ws_thread_disable = 1;
if (pid > 0) {
pthread_join(pid, NULL);
pid = -1;
}
pthread_mutex_unlock(&ws_lock);
pthread_mutex_destroy(&ws_lock);
}
#ifdef TEST
int main(int argc, char *argv[])
{
start_ws_trace();
sleep(1);
send_ws_log(LTE_RRC_DL_CCCH, 2, "Hello World !", strlen("Hello World !"));
stop_ws_trace();
return 0;
}
#endif
#ifndef _WS_TRACE_H_
#define _WS_TRACE_H_
#define WS_PROTOCOL_MASK (0xFF00)
#define WS_WCDMA_PROTOCOL (0x0100)
#define WS_LTE_PROTOCOL (0x0200)
#define WS_NR_PROTOCOL (0x0300)
#define LTE_RRC_DL_CCCH (WS_LTE_PROTOCOL | 0x0001)
#define LTE_RRC_DL_DCCH (WS_LTE_PROTOCOL | 0x0002)
#define LTE_RRC_UL_CCCH (WS_LTE_PROTOCOL | 0x0003)
#define LTE_RRC_UL_DCCH (WS_LTE_PROTOCOL | 0x0004)
#define LTE_RRC_BCCH_BCH (WS_LTE_PROTOCOL | 0x0005)
#define LTE_RRC_BCCH_DL_SCH (WS_LTE_PROTOCOL | 0x0006)
#define LTE_RRC_BCCH_DL_SCH_BR (WS_LTE_PROTOCOL | 0x0007)
#define LTE_RRC_PCCH (WS_LTE_PROTOCOL | 0x0008)
#define LTE_RRC_MCCH (WS_LTE_PROTOCOL | 0x0009)
#define LTE_RRC_HANDOVER_PREP_INFO (WS_LTE_PROTOCOL | 0x000A)
#define LTE_RRC_SBCCH_SL_BCH (WS_LTE_PROTOCOL | 0x000B)
#define LTE_RRC_SBCCH_SL_BCH_V2X (WS_LTE_PROTOCOL | 0x000C)
#define LTE_RRC_SC_MCCH (WS_LTE_PROTOCOL | 0x000D)
#define LTE_RRC_DL_CCCH_NB (WS_LTE_PROTOCOL | 0x000E)
#define LTE_RRC_DL_DCCH_NB (WS_LTE_PROTOCOL | 0x000F)
#define LTE_RRC_UL_CCCH_NB (WS_LTE_PROTOCOL | 0x0010)
#define LTE_RRC_UL_DCCH_NB (WS_LTE_PROTOCOL | 0x0011)
#define LTE_RRC_BCCH_BCH_NB (WS_LTE_PROTOCOL | 0x0012)
#define LTE_RRC_BCCH_DL_SCH_NB (WS_LTE_PROTOCOL | 0x0013)
#define LTE_RRC_PCCH_NB (WS_LTE_PROTOCOL | 0x0014)
#define LTE_RRC_SC_MCCH_NB (WS_LTE_PROTOCOL | 0x0015)
#define LTE_RRC_BCCH_BCH_MBMS (WS_LTE_PROTOCOL | 0x0016)
#define LTE_RRC_BCCH_DL_SCH_MBMS (WS_LTE_PROTOCOL | 0x0017)
#define LTE_RRC_UE_RADIO_ACCESS_CAP_INFO (WS_LTE_PROTOCOL | 0x0018)
#define LTE_RRC_UE_RADIO_PAGING_INFO (WS_LTE_PROTOCOL | 0x0019)
#define LTE_RRC_UE_CAP_INFO (WS_LTE_PROTOCOL | 0x0026)
#define LTE_RRC_UE_EUTRA_CAP (WS_LTE_PROTOCOL | 0x0027)
#define LTE_RRC_UE_RADiO_ACCESS_CAP_INFO_NB (WS_LTE_PROTOCOL | 0x002A)
#define LTE_RRC_UE_RADIO_PAGING_INFO_NB (WS_LTE_PROTOCOL | 0x002B)
#define NR_RRC_BCCH_BCH (WS_NR_PROTOCOL | 0x0001)
#define NR_RRC_DL_DCCH (WS_NR_PROTOCOL | 0x0002)
#define NR_RRC_UL_DCCH (WS_NR_PROTOCOL | 0x0003)
#define WS_TRACE_ADDRESS "127.0.0.100"
#define WS_TRACE_PORT (9999)
void start_ws_trace(void);
void send_ws_log(unsigned short msg_type, unsigned short rnti, const unsigned char *msg_buf, unsigned short msg_len);
void stop_ws_trace(void);
#endif /* _WS_TRACE_H_ */
......@@ -86,6 +86,7 @@
#include "common/ran_context.h"
#include "secu_defs.h"
#include "ws_trace.h"
#if !defined (msg)
#define msg printf
......@@ -246,7 +247,7 @@ uint8_t do_MIB(rrc_eNB_carrier_data_t *carrier, uint32_t N_RB_DL, uint32_t phich
24);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_BCCH_BCH, 0, carrier->MIB, (enc_rval.encoded + 7) / 8);
/*
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
......@@ -325,7 +326,7 @@ uint8_t do_MIB_SL(const protocol_ctxt_t* const ctxt_pP, const uint8_t eNB_index,
24);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_SBCCH_SL_BCH, 0, UE_rrc_inst[ctxt_pP->module_id].MIB, (enc_rval.encoded + 7) / 8);
if (enc_rval.encoded==-1) {
return(-1);
......@@ -514,7 +515,7 @@ uint8_t do_SIB1(rrc_eNB_carrier_data_t *carrier,
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_BCCH_DL_SCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -1359,7 +1360,7 @@ uint8_t do_SIB23(uint8_t Mod_id,
900);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_BCCH_DL_SCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
......@@ -1447,7 +1448,7 @@ uint8_t do_RRCConnectionRequest(uint8_t Mod_id, uint8_t *buffer,uint8_t *rv)
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_UL_CCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -1614,7 +1615,7 @@ uint8_t do_SidelinkUEInformation(uint8_t Mod_id, uint8_t *buffer, SL_Destinatio
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_UL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -1698,7 +1699,7 @@ uint8_t do_RRCConnectionSetupComplete(uint8_t Mod_id, uint8_t *buffer, const uin
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_UL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -1758,7 +1759,7 @@ do_RRCConnectionReconfigurationComplete(
100);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_UL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2172,6 +2173,7 @@ do_RRCConnectionSetup(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_CCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2246,6 +2248,7 @@ do_SecurityModeCommand(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2325,6 +2328,7 @@ do_UECapabilityEnquiry(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2529,6 +2533,7 @@ do_RRCConnectionReconfiguration(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_DL_DCCH_Message,(void*)&dl_dcch_msg);
#endif
......@@ -2745,6 +2750,7 @@ do_RRCConnectionReestablishment(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_CCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2806,6 +2812,7 @@ do_RRCConnectionReestablishmentReject(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_CCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2868,6 +2875,7 @@ do_RRCConnectionReject(
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_DL_CCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -2927,7 +2935,7 @@ uint8_t do_RRCConnectionRelease(
(void*)&dl_dcch_msg,
buffer,
RRC_BUF_SIZE);
send_ws_log(LTE_RRC_DL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
return((enc_rval.encoded+7)/8);
}
......@@ -3060,6 +3068,7 @@ uint8_t do_MBSFNAreaConfig(uint8_t Mod_id,
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_MCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -3192,6 +3201,7 @@ uint8_t do_MeasurementReport(uint8_t Mod_id, uint8_t *buffer,int measid,int phy_
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_UL_DCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
{
......@@ -3235,7 +3245,7 @@ uint8_t do_DLInformationTransfer(uint8_t Mod_id, uint8_t **buffer, uint8_t trans
dl_dcch_msg.message.choice.c1.choice.dlInformationTransfer.criticalExtensions.choice.c1.choice.dlInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer;
encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message, NULL, (void*) &dl_dcch_msg, (void **) buffer);
send_ws_log(LTE_RRC_DL_DCCH, 0, *buffer, encoded);
/*
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
......@@ -3323,6 +3333,7 @@ uint8_t do_Paging(uint8_t Mod_id, uint8_t *buffer, ue_paging_identity_t ue_pagin
enc_rval.failed_type->name, enc_rval.encoded);
return -1;
}
send_ws_log(LTE_RRC_PCCH, 0, buffer, (enc_rval.encoded + 7) / 8);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_PCCH_Message, (void*)&pcch_msg);
#endif
......@@ -3348,7 +3359,7 @@ uint8_t do_ULInformationTransfer(uint8_t **buffer, uint32_t pdu_length, uint8_t
ul_dcch_msg.message.choice.c1.choice.ulInformationTransfer.criticalExtensions.choice.c1.choice.ulInformationTransfer_r8.dedicatedInfoType.choice.dedicatedInfoNAS.buf = pdu_buffer;
encoded = uper_encode_to_new_buffer (&asn_DEF_UL_DCCH_Message, NULL, (void*) &ul_dcch_msg, (void **) buffer);
send_ws_log(LTE_RRC_UL_DCCH, 0, *buffer, encoded);
return encoded;
}
......@@ -3497,7 +3508,7 @@ OAI_UECapability_t *fill_ue_capability(char *UE_EUTRA_Capability_xer_fname)
MAX_UE_CAPABILITY_SIZE);
AssertFatal (enc_rval.encoded > 0, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
send_ws_log(LTE_RRC_UE_EUTRA_CAP, 0, &UECapability.sdu[0], (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if defined(DISABLE_XER_SPRINT)
{
......
......@@ -39,7 +39,7 @@
#include <asn_internal.h> /* for _ASN_DEFAULT_STACK_MAX */
#include <per_encoder.h>
#include "asn1_msg.h"
#include "ws_trace.h"
//#include for NB-IoT-------------------
......@@ -138,7 +138,7 @@ uint8_t do_MIB_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_BCCH_BCH_NB, 0, carrier->MIB_NB_IoT, (enc_rval.encoded + 7) / 8);
if (enc_rval.encoded==-1) {
return(-1);
}
......@@ -395,7 +395,7 @@ uint8_t do_SIB1_NB_IoT(uint8_t Mod_id, int CC_id,
LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_BCCH_DL_SCH_NB, 0, carrier->SIB1_NB_IoT, (enc_rval.encoded + 7) / 8);
#ifdef USER_MODE
LOG_D(RRC,"[NB-IoT] SystemInformationBlockType1-NB Encoded %zd bits (%zd bytes)\n",enc_rval.encoded,(enc_rval.encoded+7)/8);
......@@ -686,6 +686,7 @@ uint8_t do_SIB23_NB_IoT(uint8_t Mod_id,
msg("[RRC] ASN1 : SI-NB encoding failed for SIB23_NB_IoT\n");
return(-1);
}
send_ws_log(LTE_RRC_BCCH_DL_SCH_NB, 0, carrier->SIB23_NB_IoT, (enc_rval.encoded + 7) / 8);
carrier->sib2_NB_IoT = sib2_NB_IoT;
carrier->sib3_NB_IoT = sib3_NB_IoT;
......@@ -885,7 +886,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
rrcConnectionSetup_NB_IoT->criticalExtensions.choice.c1.choice.rrcConnectionSetup_r13.radioResourceConfigDedicated_r13.mac_MainConfig_r13 = NULL;
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message, (void*)&dl_ccch_msg);
xer_fprint(stdout, &asn_DEF_DL_CCCH_Message_NB, (void*)&dl_ccch_msg);
#endif
enc_rval = uper_encode_to_buffer(&asn_DEF_DL_CCCH_Message_NB,
(void*)&dl_ccch_msg_NB_IoT,
......@@ -896,6 +897,7 @@ uint8_t do_RRCConnectionSetup_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_CCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
#ifdef USER_MODE
LOG_D(RRC,"RRCConnectionSetup-NB Encoded %zd bits (%zd bytes), ecause %d\n",
......@@ -946,7 +948,7 @@ uint8_t do_SecurityModeCommand_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
//#if defined(ENABLE_ITTI)
//# if !defined(DISABLE_XER_SPRINT)....
......@@ -1007,7 +1009,7 @@ uint8_t do_UECapabilityEnquiry_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
//#if defined(ENABLE_ITTI)
//# if !defined(DISABLE_XER_SPRINT)....
......@@ -1101,7 +1103,7 @@ uint16_t do_RRCConnectionReconfiguration_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed %s, %li\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
//changed only asn_DEF_DL_DCCH_Message_NB
#ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_DL_DCCH_Message_NB,(void*)&dl_dcch_msg_NB_IoT);
......@@ -1147,6 +1149,7 @@ uint8_t do_RRCConnectionReestablishmentReject_NB_IoT(
LOG_F(RRC,"ASN1 message encoding failed (%s, %lu)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_CCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
//Only change in "asn_DEF_DL_CCCH_Message_NB"
#if defined(ENABLE_ITTI)
......@@ -1217,6 +1220,7 @@ uint8_t do_RRCConnectionReject_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed (%s, %ld)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
#if defined(ENABLE_ITTI)
# if !defined(DISABLE_XER_SPRINT)
......@@ -1273,6 +1277,7 @@ uint8_t do_DLInformationTransfer_NB_IoT(
dl_dcch_msg_NB_IoT.message.choice.c1.choice.dlInformationTransfer_r13.criticalExtensions.choice.c1.choice.dlInformationTransfer_r13.dedicatedInfoNAS_r13.buf = pdu_buffer;
encoded = uper_encode_to_new_buffer (&asn_DEF_DL_DCCH_Message_NB, NULL, (void*) &dl_dcch_msg_NB_IoT, (void **) buffer);
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, *buffer, encoded);
//only change in "asn_DEF_DL_DCCH_Message_NB"
#if defined(ENABLE_ITTI)
......@@ -1344,7 +1349,7 @@ uint8_t do_RRCConnectionReestablishment_NB_IoT(
LOG_F(RRC, "ASN1 message encoding failed (%s, %li)!\n",
enc_rval.failed_type->name, enc_rval.encoded);
}
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
#ifdef XER_PRINT
xer_fprint(stdout,&asn_DEF_DL_CCCH_Message_NB,(void*)&dl_ccch_msg_NB_IoT);
#endif
......@@ -1408,6 +1413,7 @@ uint8_t do_RRCConnectionRelease_NB_IoT(
(void*)&dl_dcch_msg_NB_IoT,
buffer,
RRC_BUF_SIZE);//check
send_ws_log(LTE_RRC_DL_DCCH_NB, 0, buffer, (enc_rval.encoded + 7) / 8);
return((enc_rval.encoded+7)/8);
}
......
......@@ -96,6 +96,7 @@
#endif
#include "SIMULATION/TOOLS/sim.h" // for taus
#include "ws_trace.h"
//#define XER_PRINT
......@@ -6048,6 +6049,7 @@ rrc_eNB_decode_ccch(
100,
0,
0);
send_ws_log(LTE_RRC_UL_CCCH, 0, Srb_info->Rx_buffer.Payload, dec_rval.consumed);
/*
#if defined(ENABLE_ITTI)
......@@ -6625,6 +6627,7 @@ rrc_eNB_decode_dcch(
sdu_sizeP,
0,
0);
send_ws_log(LTE_RRC_UL_DCCH, 0, Rx_sdu, sdu_sizeP);
/*
#if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
......@@ -7155,6 +7158,11 @@ if (ue_context_p->ue_context.nb_of_modify_e_rabs > 0) {
ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
array[0]->ueCapabilityRAT_Container.size, 0, 0);
send_ws_log(LTE_RRC_UE_EUTRA_CAP, 0, ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
array[0]->ueCapabilityRAT_Container.buf, ul_dcch_msg->message.choice.c1.choice.ueCapabilityInformation.criticalExtensions.
choice.c1.choice.ueCapabilityInformation_r8.ue_CapabilityRAT_ContainerList.list.
array[0]->ueCapabilityRAT_Container.size);
#ifdef XER_PRINT
xer_fprint(stdout, &asn_DEF_UE_EUTRA_Capability, ue_context_p->ue_context.UE_Capability);
#endif
......@@ -7398,6 +7406,7 @@ rrc_enb_task(
protocol_ctxt_t ctxt;
start_ws_trace();
pthread_mutex_init(&lock_ue_freelist, NULL);
pthread_mutex_init(&rrc_release_freelist, NULL);
memset(&rrc_release_info,0,sizeof(RRC_release_list_t));
......@@ -7414,6 +7423,7 @@ rrc_enb_task(
switch (ITTI_MSG_ID(msg_p)) {
case TERMINATE_MESSAGE:
LOG_W(RRC, " *** Exiting RRC thread\n");
stop_ws_trace();
itti_exit_task();
break;
......
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