Fix corrupted LOGs in L1L2simulator, introducing two new components NFAPI_VNF and NFAPI_pnf. Integrate Fujitsu fix for up to 50 UEs. Apply astyle to all modified files in the branch

This commit is contained in:
frtabu
2019-02-25 16:50:03 +01:00
parent f3dc8d446d
commit fb46545526
37 changed files with 4092 additions and 4729 deletions
+219 -235
View File
@@ -82,23 +82,18 @@ static int _emm_msg_encode_header(const emm_msg_header_t *header,
** Others: None **
** **
***************************************************************************/
int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
{
int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len) {
LOG_FUNC_IN;
int header_result;
int decode_result;
uint8_t *buffer_log = buffer;
uint32_t len_log = len;
int down_link;
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 0;
# else
down_link = 1;
# endif
/* First decode the EMM message header */
header_result = _emm_msg_decode_header(&msg->header, buffer, len);
@@ -110,144 +105,143 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
buffer += header_result;
len -= header_result;
LOG_TRACE(INFO, "EMM-MSG - Message Type 0x%02x", msg->header.message_type);
switch(msg->header.message_type) {
case EMM_INFORMATION:
decode_result = decode_emm_information(&msg->emm_information, buffer, len);
break;
case EMM_INFORMATION:
decode_result = decode_emm_information(&msg->emm_information, buffer, len);
break;
case UPLINK_NAS_TRANSPORT:
decode_result = decode_uplink_nas_transport(&msg->uplink_nas_transport, buffer,
len);
break;
case UPLINK_NAS_TRANSPORT:
decode_result = decode_uplink_nas_transport(&msg->uplink_nas_transport, buffer,
len);
break;
case AUTHENTICATION_REJECT:
decode_result = decode_authentication_reject(&msg->authentication_reject,
buffer, len);
break;
case AUTHENTICATION_REJECT:
decode_result = decode_authentication_reject(&msg->authentication_reject,
buffer, len);
break;
case AUTHENTICATION_FAILURE:
decode_result = decode_authentication_failure(&msg->authentication_failure,
buffer, len);
break;
case AUTHENTICATION_FAILURE:
decode_result = decode_authentication_failure(&msg->authentication_failure,
buffer, len);
break;
case DETACH_ACCEPT:
decode_result = decode_detach_accept(&msg->detach_accept, buffer, len);
break;
case DETACH_ACCEPT:
decode_result = decode_detach_accept(&msg->detach_accept, buffer, len);
break;
case SERVICE_REJECT:
decode_result = decode_service_reject(&msg->service_reject, buffer, len);
break;
case SERVICE_REJECT:
decode_result = decode_service_reject(&msg->service_reject, buffer, len);
break;
case AUTHENTICATION_REQUEST:
decode_result = decode_authentication_request(&msg->authentication_request,
buffer, len);
break;
case AUTHENTICATION_REQUEST:
decode_result = decode_authentication_request(&msg->authentication_request,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REQUEST:
decode_result = decode_tracking_area_update_request(
&msg->tracking_area_update_request, buffer, len);
break;
case TRACKING_AREA_UPDATE_REQUEST:
decode_result = decode_tracking_area_update_request(
&msg->tracking_area_update_request, buffer, len);
break;
case ATTACH_REQUEST:
decode_result = decode_attach_request(&msg->attach_request, buffer, len);
break;
case ATTACH_REQUEST:
decode_result = decode_attach_request(&msg->attach_request, buffer, len);
break;
case EMM_STATUS:
decode_result = decode_emm_status(&msg->emm_status, buffer, len);
break;
case EMM_STATUS:
decode_result = decode_emm_status(&msg->emm_status, buffer, len);
break;
case IDENTITY_RESPONSE:
decode_result = decode_identity_response(&msg->identity_response, buffer, len);
break;
case IDENTITY_RESPONSE:
decode_result = decode_identity_response(&msg->identity_response, buffer, len);
break;
case IDENTITY_REQUEST:
decode_result = decode_identity_request(&msg->identity_request, buffer, len);
break;
case IDENTITY_REQUEST:
decode_result = decode_identity_request(&msg->identity_request, buffer, len);
break;
case GUTI_REALLOCATION_COMMAND:
decode_result = decode_guti_reallocation_command(&msg->guti_reallocation_command,
buffer, len);
break;
case GUTI_REALLOCATION_COMMAND:
decode_result = decode_guti_reallocation_command(&msg->guti_reallocation_command,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REJECT:
decode_result = decode_tracking_area_update_reject(
&msg->tracking_area_update_reject, buffer, len);
break;
case TRACKING_AREA_UPDATE_REJECT:
decode_result = decode_tracking_area_update_reject(
&msg->tracking_area_update_reject, buffer, len);
break;
case ATTACH_ACCEPT:
decode_result = decode_attach_accept(&msg->attach_accept, buffer, len);
break;
case ATTACH_ACCEPT:
decode_result = decode_attach_accept(&msg->attach_accept, buffer, len);
break;
case SECURITY_MODE_COMPLETE:
decode_result = decode_security_mode_complete(&msg->security_mode_complete,
buffer, len);
break;
case SECURITY_MODE_COMPLETE:
decode_result = decode_security_mode_complete(&msg->security_mode_complete,
buffer, len);
break;
case TRACKING_AREA_UPDATE_ACCEPT:
decode_result = decode_tracking_area_update_accept(
&msg->tracking_area_update_accept, buffer, len);
break;
case TRACKING_AREA_UPDATE_ACCEPT:
decode_result = decode_tracking_area_update_accept(
&msg->tracking_area_update_accept, buffer, len);
break;
case ATTACH_REJECT:
decode_result = decode_attach_reject(&msg->attach_reject, buffer, len);
break;
case ATTACH_REJECT:
decode_result = decode_attach_reject(&msg->attach_reject, buffer, len);
break;
case ATTACH_COMPLETE:
decode_result = decode_attach_complete(&msg->attach_complete, buffer, len);
break;
case ATTACH_COMPLETE:
decode_result = decode_attach_complete(&msg->attach_complete, buffer, len);
break;
case TRACKING_AREA_UPDATE_COMPLETE:
decode_result = decode_tracking_area_update_complete(
&msg->tracking_area_update_complete, buffer, len);
break;
case TRACKING_AREA_UPDATE_COMPLETE:
decode_result = decode_tracking_area_update_complete(
&msg->tracking_area_update_complete, buffer, len);
break;
case CS_SERVICE_NOTIFICATION:
decode_result = decode_cs_service_notification(&msg->cs_service_notification,
buffer, len);
break;
case CS_SERVICE_NOTIFICATION:
decode_result = decode_cs_service_notification(&msg->cs_service_notification,
buffer, len);
break;
case SECURITY_MODE_REJECT:
decode_result = decode_security_mode_reject(&msg->security_mode_reject, buffer,
len);
break;
case SECURITY_MODE_REJECT:
decode_result = decode_security_mode_reject(&msg->security_mode_reject, buffer,
len);
break;
case DETACH_REQUEST:
decode_result = decode_detach_request(&msg->detach_request, buffer, len);
break;
case DETACH_REQUEST:
decode_result = decode_detach_request(&msg->detach_request, buffer, len);
break;
case GUTI_REALLOCATION_COMPLETE:
decode_result = decode_guti_reallocation_complete(
&msg->guti_reallocation_complete, buffer, len);
break;
case GUTI_REALLOCATION_COMPLETE:
decode_result = decode_guti_reallocation_complete(
&msg->guti_reallocation_complete, buffer, len);
break;
case SECURITY_MODE_COMMAND:
decode_result = decode_security_mode_command(&msg->security_mode_command,
buffer, len);
break;
case SECURITY_MODE_COMMAND:
decode_result = decode_security_mode_command(&msg->security_mode_command,
buffer, len);
break;
case DOWNLINK_NAS_TRANSPORT:
decode_result = decode_downlink_nas_transport(&msg->downlink_nas_transport,
buffer, len);
break;
case DOWNLINK_NAS_TRANSPORT:
decode_result = decode_downlink_nas_transport(&msg->downlink_nas_transport,
buffer, len);
break;
case EXTENDED_SERVICE_REQUEST:
decode_result = decode_extended_service_request(&msg->extended_service_request,
buffer, len);
break;
case EXTENDED_SERVICE_REQUEST:
decode_result = decode_extended_service_request(&msg->extended_service_request,
buffer, len);
break;
case AUTHENTICATION_RESPONSE:
decode_result = decode_authentication_response(&msg->authentication_response,
buffer, len);
break;
case AUTHENTICATION_RESPONSE:
decode_result = decode_authentication_response(&msg->authentication_response,
buffer, len);
break;
default:
LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
decode_result = TLV_DECODE_WRONG_MESSAGE_TYPE;
/* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */
default:
LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
decode_result = TLV_DECODE_WRONG_MESSAGE_TYPE;
/* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */
}
if (decode_result < 0) {
@@ -281,24 +275,17 @@ int emm_msg_decode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
** Others: None **
** **
***************************************************************************/
int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
{
int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len) {
LOG_FUNC_IN;
int header_result;
int encode_result;
uint8_t *buffer_log = buffer;
int down_link;
# if ((defined(NAS_BUILT_IN_EPC) && defined(NAS_MME)))
down_link = 1;
# else
down_link = 0;
# endif
/* First encode the EMM message header */
header_result = _emm_msg_encode_header(&msg->header, buffer, len);
@@ -312,144 +299,144 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
len -= header_result;
switch(msg->header.message_type) {
case EMM_INFORMATION:
encode_result = encode_emm_information(&msg->emm_information, buffer, len);
break;
case EMM_INFORMATION:
encode_result = encode_emm_information(&msg->emm_information, buffer, len);
break;
case UPLINK_NAS_TRANSPORT:
encode_result = encode_uplink_nas_transport(&msg->uplink_nas_transport, buffer,
len);
break;
case UPLINK_NAS_TRANSPORT:
encode_result = encode_uplink_nas_transport(&msg->uplink_nas_transport, buffer,
len);
break;
case AUTHENTICATION_REJECT:
encode_result = encode_authentication_reject(&msg->authentication_reject,
buffer, len);
break;
case AUTHENTICATION_REJECT:
encode_result = encode_authentication_reject(&msg->authentication_reject,
buffer, len);
break;
case AUTHENTICATION_FAILURE:
encode_result = encode_authentication_failure(&msg->authentication_failure,
buffer, len);
break;
case AUTHENTICATION_FAILURE:
encode_result = encode_authentication_failure(&msg->authentication_failure,
buffer, len);
break;
case DETACH_ACCEPT:
encode_result = encode_detach_accept(&msg->detach_accept, buffer, len);
break;
case DETACH_ACCEPT:
encode_result = encode_detach_accept(&msg->detach_accept, buffer, len);
break;
case SERVICE_REJECT:
encode_result = encode_service_reject(&msg->service_reject, buffer, len);
break;
case SERVICE_REJECT:
encode_result = encode_service_reject(&msg->service_reject, buffer, len);
break;
case AUTHENTICATION_REQUEST:
encode_result = encode_authentication_request(&msg->authentication_request,
buffer, len);
break;
case AUTHENTICATION_REQUEST:
encode_result = encode_authentication_request(&msg->authentication_request,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REQUEST:
encode_result = encode_tracking_area_update_request(
&msg->tracking_area_update_request, buffer, len);
break;
case TRACKING_AREA_UPDATE_REQUEST:
encode_result = encode_tracking_area_update_request(
&msg->tracking_area_update_request, buffer, len);
break;
case ATTACH_REQUEST:
encode_result = encode_attach_request(&msg->attach_request, buffer, len);
break;
case ATTACH_REQUEST:
encode_result = encode_attach_request(&msg->attach_request, buffer, len);
break;
case EMM_STATUS:
encode_result = encode_emm_status(&msg->emm_status, buffer, len);
break;
case EMM_STATUS:
encode_result = encode_emm_status(&msg->emm_status, buffer, len);
break;
case IDENTITY_RESPONSE:
encode_result = encode_identity_response(&msg->identity_response, buffer, len);
break;
case IDENTITY_RESPONSE:
encode_result = encode_identity_response(&msg->identity_response, buffer, len);
break;
case IDENTITY_REQUEST:
encode_result = encode_identity_request(&msg->identity_request, buffer, len);
break;
case IDENTITY_REQUEST:
encode_result = encode_identity_request(&msg->identity_request, buffer, len);
break;
case GUTI_REALLOCATION_COMMAND:
encode_result = encode_guti_reallocation_command(&msg->guti_reallocation_command,
buffer, len);
break;
case GUTI_REALLOCATION_COMMAND:
encode_result = encode_guti_reallocation_command(&msg->guti_reallocation_command,
buffer, len);
break;
case TRACKING_AREA_UPDATE_REJECT:
encode_result = encode_tracking_area_update_reject(
&msg->tracking_area_update_reject, buffer, len);
break;
case TRACKING_AREA_UPDATE_REJECT:
encode_result = encode_tracking_area_update_reject(
&msg->tracking_area_update_reject, buffer, len);
break;
case ATTACH_ACCEPT:
encode_result = encode_attach_accept(&msg->attach_accept, buffer, len);
break;
case ATTACH_ACCEPT:
encode_result = encode_attach_accept(&msg->attach_accept, buffer, len);
break;
case SECURITY_MODE_COMPLETE:
encode_result = encode_security_mode_complete(&msg->security_mode_complete,
buffer, len);
break;
case SECURITY_MODE_COMPLETE:
encode_result = encode_security_mode_complete(&msg->security_mode_complete,
buffer, len);
break;
case TRACKING_AREA_UPDATE_ACCEPT:
encode_result = encode_tracking_area_update_accept(
&msg->tracking_area_update_accept, buffer, len);
break;
case TRACKING_AREA_UPDATE_ACCEPT:
encode_result = encode_tracking_area_update_accept(
&msg->tracking_area_update_accept, buffer, len);
break;
case ATTACH_REJECT:
encode_result = encode_attach_reject(&msg->attach_reject, buffer, len);
break;
case ATTACH_REJECT:
encode_result = encode_attach_reject(&msg->attach_reject, buffer, len);
break;
case ATTACH_COMPLETE:
encode_result = encode_attach_complete(&msg->attach_complete, buffer, len);
break;
case ATTACH_COMPLETE:
encode_result = encode_attach_complete(&msg->attach_complete, buffer, len);
break;
case TRACKING_AREA_UPDATE_COMPLETE:
encode_result = encode_tracking_area_update_complete(
&msg->tracking_area_update_complete, buffer, len);
break;
case TRACKING_AREA_UPDATE_COMPLETE:
encode_result = encode_tracking_area_update_complete(
&msg->tracking_area_update_complete, buffer, len);
break;
case CS_SERVICE_NOTIFICATION:
encode_result = encode_cs_service_notification(&msg->cs_service_notification,
buffer, len);
break;
case CS_SERVICE_NOTIFICATION:
encode_result = encode_cs_service_notification(&msg->cs_service_notification,
buffer, len);
break;
case SECURITY_MODE_REJECT:
encode_result = encode_security_mode_reject(&msg->security_mode_reject, buffer,
len);
break;
case SECURITY_MODE_REJECT:
encode_result = encode_security_mode_reject(&msg->security_mode_reject, buffer,
len);
break;
case DETACH_REQUEST:
encode_result = encode_detach_request(&msg->detach_request, buffer, len);
break;
case DETACH_REQUEST:
encode_result = encode_detach_request(&msg->detach_request, buffer, len);
break;
case GUTI_REALLOCATION_COMPLETE:
encode_result = encode_guti_reallocation_complete(
&msg->guti_reallocation_complete, buffer, len);
break;
case GUTI_REALLOCATION_COMPLETE:
encode_result = encode_guti_reallocation_complete(
&msg->guti_reallocation_complete, buffer, len);
break;
case SECURITY_MODE_COMMAND:
encode_result = encode_security_mode_command(&msg->security_mode_command,
buffer, len);
break;
case SECURITY_MODE_COMMAND:
encode_result = encode_security_mode_command(&msg->security_mode_command,
buffer, len);
break;
case DOWNLINK_NAS_TRANSPORT:
encode_result = encode_downlink_nas_transport(&msg->downlink_nas_transport,
buffer, len);
break;
case DOWNLINK_NAS_TRANSPORT:
encode_result = encode_downlink_nas_transport(&msg->downlink_nas_transport,
buffer, len);
break;
case EXTENDED_SERVICE_REQUEST:
encode_result = encode_extended_service_request(&msg->extended_service_request,
buffer, len);
break;
case EXTENDED_SERVICE_REQUEST:
encode_result = encode_extended_service_request(&msg->extended_service_request,
buffer, len);
break;
case AUTHENTICATION_RESPONSE:
encode_result = encode_authentication_response(&msg->authentication_response,
buffer, len);
break;
case AUTHENTICATION_RESPONSE:
encode_result = encode_authentication_response(&msg->authentication_response,
buffer, len);
break;
case SERVICE_REQUEST:
encode_result = encode_service_request(&msg->service_request, buffer, len);
break;
case SERVICE_REQUEST:
encode_result = encode_service_request(&msg->service_request, buffer, len);
break;
default:
LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
encode_result = TLV_ENCODE_WRONG_MESSAGE_TYPE;
/* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */
default:
LOG_TRACE(ERROR, "EMM-MSG - Unexpected message type: 0x%x",
msg->header.message_type);
encode_result = TLV_ENCODE_WRONG_MESSAGE_TYPE;
/* TODO: Handle not standard layer 3 messages: SERVICE_REQUEST */
}
if (encode_result < 0) {
@@ -492,8 +479,7 @@ int emm_msg_encode(EMM_msg *msg, uint8_t *buffer, uint32_t len)
** **
***************************************************************************/
static int _emm_msg_decode_header(emm_msg_header_t *header,
const uint8_t *buffer, uint32_t len)
{
const uint8_t *buffer, uint32_t len) {
int size = 0;
/* Check the buffer length */
@@ -535,8 +521,7 @@ static int _emm_msg_decode_header(emm_msg_header_t *header,
** **
***************************************************************************/
static int _emm_msg_encode_header(const emm_msg_header_t *header,
uint8_t *buffer, uint32_t len)
{
uint8_t *buffer, uint32_t len) {
int size = 0;
/* Check the buffer length */
@@ -555,7 +540,6 @@ static int _emm_msg_encode_header(const emm_msg_header_t *header,
ENCODE_U8(buffer + size, *(uint8_t *)(header), size);
/* Encode the message type */
ENCODE_U8(buffer + size, header->message_type, size);
return (size);
}