Commit c76bcd2e authored by winckel's avatar winckel

Created a "xer_sprintf" to dump asn1 message into a string buffer.

Fixed a build issue in "oaisim.c".
Replaced asn1 struct in ITTI debug message by "xer_sprint" formatted text.

git-svn-id: http://svn.eurecom.fr/openair4G/trunk@4517 818b1a75-f10b-46b9-bf7c-635c3b92a50f
parent c2a39c14
...@@ -7,6 +7,7 @@ ...@@ -7,6 +7,7 @@
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Messages for RRC logging // Messages for RRC logging
#if defined(DISABLE_ITTI_XER_PRINT)
MESSAGE_DEF(RRC_DL_BCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcDlBcchMessage, rrc_dl_bcch_message) MESSAGE_DEF(RRC_DL_BCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcDlBcchMessage, rrc_dl_bcch_message)
MESSAGE_DEF(RRC_DL_CCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcDlCcchMessage, rrc_dl_ccch_message) MESSAGE_DEF(RRC_DL_CCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcDlCcchMessage, rrc_dl_ccch_message)
MESSAGE_DEF(RRC_DL_DCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcDlDcchMessage, rrc_dl_dcch_message) MESSAGE_DEF(RRC_DL_DCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcDlDcchMessage, rrc_dl_dcch_message)
...@@ -15,6 +16,7 @@ MESSAGE_DEF(RRC_UE_EUTRA_CAPABILITY, MESSAGE_PRIORITY_MED_PLUS, RrcUeEutraCa ...@@ -15,6 +16,7 @@ MESSAGE_DEF(RRC_UE_EUTRA_CAPABILITY, MESSAGE_PRIORITY_MED_PLUS, RrcUeEutraCa
MESSAGE_DEF(RRC_UL_CCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcUlCcchMessage, rrc_ul_ccch_message) MESSAGE_DEF(RRC_UL_CCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcUlCcchMessage, rrc_ul_ccch_message)
MESSAGE_DEF(RRC_UL_DCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcUlDcchMessage, rrc_ul_dcch_message) MESSAGE_DEF(RRC_UL_DCCH_MESSAGE, MESSAGE_PRIORITY_MED_PLUS, RrcUlDcchMessage, rrc_ul_dcch_message)
#endif
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Messages between NAS and RRC layers // Messages between NAS and RRC layers
......
...@@ -12,6 +12,7 @@ ...@@ -12,6 +12,7 @@
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Messages for RRC logging // Messages for RRC logging
#if defined(DISABLE_ITTI_XER_PRINT)
#include "BCCH-DL-SCH-Message.h" #include "BCCH-DL-SCH-Message.h"
#include "DL-CCCH-Message.h" #include "DL-CCCH-Message.h"
#include "DL-DCCH-Message.h" #include "DL-DCCH-Message.h"
...@@ -25,6 +26,7 @@ typedef DL_DCCH_Message_t RrcDlDcchMessage; ...@@ -25,6 +26,7 @@ typedef DL_DCCH_Message_t RrcDlDcchMessage;
typedef UE_EUTRA_Capability_t RrcUeEutraCapability; typedef UE_EUTRA_Capability_t RrcUeEutraCapability;
typedef UL_CCCH_Message_t RrcUlCcchMessage; typedef UL_CCCH_Message_t RrcUlCcchMessage;
typedef UL_DCCH_Message_t RrcUlDcchMessage; typedef UL_DCCH_Message_t RrcUlDcchMessage;
#endif
//-------------------------------------------------------------------------------------------// //-------------------------------------------------------------------------------------------//
// Defines to access message fields. // Defines to access message fields.
......
...@@ -114,6 +114,29 @@ uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellI ...@@ -114,6 +114,29 @@ uint16_t two_tier_hexagonal_adjacent_cellIds[7][6] = {{1,2,4,5,7,8}, // CellI
{8,0,5,9,17,12}, // CellId 7 {8,0,5,9,17,12}, // CellId 7
{15,1,0,7,12,10}};// CellId 8 {15,1,0,7,12,10}};// CellId 8
/*
* This is a helper function for xer_sprint, which directs all incoming data
* into the provided string.
*/
static int xer__print2s (const void *buffer, size_t size, void *app_key)
{
char *string = (char *) app_key;
strncat(string, buffer, size);
return 0;
}
int xer_sprint (char *string, asn_TYPE_descriptor_t *td, void *sptr)
{
asn_enc_rval_t er;
er = xer_encode(td, sptr, XER_F_BASIC, xer__print2s, string);
if (er.encoded == -1)
return -1;
return 0;
}
uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index) { uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index) {
return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]); return(two_tier_hexagonal_adjacent_cellIds[Mod_id][index]);
...@@ -1982,7 +2005,7 @@ OAI_UECapability_t *fill_ue_capability() { ...@@ -1982,7 +2005,7 @@ OAI_UECapability_t *fill_ue_capability() {
MAX_UE_CAPABILITY_SIZE); MAX_UE_CAPABILITY_SIZE);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
/* Test code */ # if defined(DISABLE_XER_SPRINT)
{ {
MessageDef *message_p; MessageDef *message_p;
...@@ -1991,6 +2014,27 @@ OAI_UECapability_t *fill_ue_capability() { ...@@ -1991,6 +2014,27 @@ OAI_UECapability_t *fill_ue_capability() {
itti_send_msg_to_task (TASK_UNKNOWN, NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_UNKNOWN, NB_eNB_INST, message_p);
} }
# else
{
char *message_string = NULL;
message_string = calloc(10000, sizeof(char));
if (xer_sprint(message_string, &asn_DEF_UE_EUTRA_Capability, (void *)UE_EUTRA_Capability) >= 0)
{
MessageDef *message_p;
size_t message_string_size;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized (TASK_RRC_UE, GENERIC_LOG, message_string_size);
memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
}
}
# endif
#endif #endif
UECapability.sdu_size = (enc_rval.encoded + 7) / 8; UECapability.sdu_size = (enc_rval.encoded + 7) / 8;
......
...@@ -53,6 +53,16 @@ ...@@ -53,6 +53,16 @@
#include "RRC/LITE/defs.h" #include "RRC/LITE/defs.h"
/*
* The variant of the above function which dumps the BASIC-XER (XER_F_BASIC)
* output into the chosen string buffer.
* RETURN VALUES:
* 0: The structure is printed.
* -1: Problem printing the structure.
* WARNING: No sensible errno value is returned.
*/
int xer_sprint(char *string, struct asn_TYPE_descriptor_s *td, void *sptr);
uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index); uint16_t get_adjacent_cell_id(uint8_t Mod_id,uint8_t index);
u8 get_adjacent_cell_mod_id(uint16_t phyCellId); u8 get_adjacent_cell_mod_id(uint16_t phyCellId);
......
...@@ -332,6 +332,7 @@ int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info, u8 eNB_index){ ...@@ -332,6 +332,7 @@ int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info, u8 eNB_index){
#endif #endif
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{ {
MessageDef *message_p; MessageDef *message_p;
...@@ -340,6 +341,27 @@ int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info, u8 eNB_index){ ...@@ -340,6 +341,27 @@ int rrc_ue_decode_ccch(u8 Mod_id, u32 frame, SRB_INFO *Srb_info, u8 eNB_index){
itti_send_msg_to_task (TASK_UNKNOWN, Mod_id + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_UNKNOWN, Mod_id + NB_eNB_INST, message_p);
} }
# else
{
char *message_string = NULL;
message_string = calloc(10000, sizeof(char));
if (xer_sprint(message_string, &asn_DEF_DL_CCCH_Message, (void *)dl_ccch_msg) >= 0)
{
MessageDef *message_p;
size_t message_string_size;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized (TASK_RRC_ENB, GENERIC_LOG, message_string_size);
memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
}
}
# endif
#endif #endif
if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) { if ((dec_rval.code != RC_OK) && (dec_rval.consumed==0)) {
...@@ -1337,6 +1359,7 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index) ...@@ -1337,6 +1359,7 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index)
#endif #endif
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{ {
MessageDef *message_p; MessageDef *message_p;
...@@ -1345,6 +1368,27 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index) ...@@ -1345,6 +1368,27 @@ void rrc_ue_decode_dcch(u8 Mod_id,u32 frame,u8 Srb_id, u8 *Buffer,u8 eNB_index)
itti_send_msg_to_task (TASK_UNKNOWN, Mod_id + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_UNKNOWN, Mod_id + NB_eNB_INST, message_p);
} }
# else
{
char *message_string = NULL;
message_string = calloc(20000, sizeof(char));
if (xer_sprint(message_string, &asn_DEF_DL_DCCH_Message, (void *)dl_dcch_msg) >= 0)
{
MessageDef *message_p;
size_t message_string_size;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized (TASK_RRC_UE, GENERIC_LOG, message_string_size);
memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
}
}
# endif
#endif #endif
if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) { if (dl_dcch_msg->message.present == DL_DCCH_MessageType_PR_c1) {
...@@ -1506,6 +1550,7 @@ int decode_BCCH_DLSCH_Message(u8 Mod_id,u32 frame,u8 eNB_index,u8 *Sdu,u8 Sdu_le ...@@ -1506,6 +1550,7 @@ int decode_BCCH_DLSCH_Message(u8 Mod_id,u32 frame,u8 eNB_index,u8 *Sdu,u8 Sdu_le
// xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)&bcch_message); // xer_fprint(stdout, &asn_DEF_BCCH_DL_SCH_Message, (void*)&bcch_message);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{ {
MessageDef *message_p; MessageDef *message_p;
...@@ -1514,6 +1559,27 @@ int decode_BCCH_DLSCH_Message(u8 Mod_id,u32 frame,u8 eNB_index,u8 *Sdu,u8 Sdu_le ...@@ -1514,6 +1559,27 @@ int decode_BCCH_DLSCH_Message(u8 Mod_id,u32 frame,u8 eNB_index,u8 *Sdu,u8 Sdu_le
itti_send_msg_to_task (TASK_UNKNOWN, Mod_id + NB_eNB_INST, message_p); itti_send_msg_to_task (TASK_UNKNOWN, Mod_id + NB_eNB_INST, message_p);
} }
# else
{
char *message_string = NULL;
message_string = calloc(10000, sizeof(char));
if (xer_sprint(message_string, &asn_DEF_BCCH_DL_SCH_Message, (void *)bcch_message) >= 0)
{
MessageDef *message_p;
size_t message_string_size;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized (TASK_RRC_UE, GENERIC_LOG, message_string_size);
memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
}
}
# endif
#endif #endif
if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) { if (bcch_message->message.present == BCCH_DL_SCH_MessageType_PR_c1) {
......
...@@ -2504,6 +2504,7 @@ int rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info) ...@@ -2504,6 +2504,7 @@ int rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info)
(uint8_t *) Srb_info->Rx_buffer.Payload, 100, 0, 0); (uint8_t *) Srb_info->Rx_buffer.Payload, 100, 0, 0);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{ {
MessageDef *message_p; MessageDef *message_p;
...@@ -2512,6 +2513,27 @@ int rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info) ...@@ -2512,6 +2513,27 @@ int rrc_eNB_decode_ccch (u8 Mod_id, u32 frame, SRB_INFO * Srb_info)
itti_send_msg_to_task (TASK_UNKNOWN, Mod_id, message_p); itti_send_msg_to_task (TASK_UNKNOWN, Mod_id, message_p);
} }
# else
{
char *message_string = NULL;
message_string = calloc(10000, sizeof(char));
if (xer_sprint(message_string, &asn_DEF_UL_CCCH_Message, (void *)ul_ccch_msg) >= 0)
{
MessageDef *message_p;
size_t message_string_size;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized (TASK_RRC_ENB, GENERIC_LOG, message_string_size);
memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
}
}
# endif
#endif #endif
for (i = 0; i < 8; i++) for (i = 0; i < 8; i++)
...@@ -2699,6 +2721,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, ...@@ -2699,6 +2721,7 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
(void **) &ul_dcch_msg, Rx_sdu, sdu_size, 0, 0); (void **) &ul_dcch_msg, Rx_sdu, sdu_size, 0, 0);
#if defined(ENABLE_ITTI) #if defined(ENABLE_ITTI)
# if defined(DISABLE_ITTI_XER_PRINT)
{ {
MessageDef *message_p; MessageDef *message_p;
...@@ -2707,6 +2730,27 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index, ...@@ -2707,6 +2730,27 @@ int rrc_eNB_decode_dcch (u8 Mod_id, u32 frame, u8 Srb_id, u8 UE_index,
itti_send_msg_to_task (TASK_UNKNOWN, Mod_id, message_p); itti_send_msg_to_task (TASK_UNKNOWN, Mod_id, message_p);
} }
# else
{
char *message_string = NULL;
message_string = calloc(10000, sizeof(char));
if (xer_sprint(message_string, &asn_DEF_UL_DCCH_Message, (void *)ul_dcch_msg) >= 0)
{
MessageDef *message_p;
size_t message_string_size;
message_string_size = strlen(message_string);
message_p = itti_alloc_new_message_sized (TASK_RRC_ENB, GENERIC_LOG, message_string_size);
memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
free(message_string);
}
}
# endif
#endif #endif
for (i = 0; i < sdu_size; i++) for (i = 0; i < sdu_size; i++)
......
...@@ -12,6 +12,8 @@ ...@@ -12,6 +12,8 @@
# if defined(ENABLE_USE_MME) # if defined(ENABLE_USE_MME)
#include "UL-DCCH-Message.h"
/* Up link procedures */ /* Up link procedures */
# if defined(ENABLE_ITTI) # if defined(ENABLE_ITTI)
......
...@@ -403,6 +403,7 @@ int itti_create_task_successful(void){ ...@@ -403,6 +403,7 @@ int itti_create_task_successful(void){
#endif #endif
return 1; return 1;
} }
/* /*
* later, the enb task will be moved from here * later, the enb task will be moved from here
*/ */
...@@ -430,7 +431,7 @@ void *eNB_app_task(void *args_p) { ...@@ -430,7 +431,7 @@ void *eNB_app_task(void *args_p) {
//note: there is an implicit relationship between the data struct and the message name //note: there is an implicit relationship between the data struct and the message name
message_p = itti_alloc_new_message(TASK_ENB_APP, S1AP_REGISTER_ENB); message_p = itti_alloc_new_message(TASK_ENB_APP, S1AP_REGISTER_ENB);
s1ap_register_eNB = &message_p->msg.s1ap_register_eNB; s1ap_register_eNB = &message_p->ittiMsg.s1ap_register_eNB;
hash = s1ap_generate_eNB_id(); hash = s1ap_generate_eNB_id();
...@@ -489,6 +490,7 @@ void *eNB_app_task(void *args_p) { ...@@ -489,6 +490,7 @@ void *eNB_app_task(void *args_p) {
#endif #endif
return NULL; return NULL;
} }
void *l2l1_task(void *args_p) { void *l2l1_task(void *args_p) {
// Framing variables // Framing variables
s32 slot, last_slot, next_slot; s32 slot, last_slot, next_slot;
......
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