Commit cf56f0fe authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Clean NAS for SM-related IEs/messages

parent 2aa22ddb
......@@ -60,10 +60,4 @@ typedef struct dnn_configuration_s {
//staticIpAddresses
} dnn_configuration_t;
#endif
......@@ -278,7 +278,6 @@
#include "Ngap_ServedGUAMIItem.h"
#include "Ngap_GNB-ID.h"
#include "Ngap_NGAP-PDU.h"
#include "as_message.h"
#endif
#include "assertions.h"
......
......@@ -135,7 +135,8 @@ int decode_qos_flow_descriptions ( QOSFlowDescriptions * qosflowdescriptions, ui
decoded_tmp = decoded_tmp + *(buffer + decoded_tmp) + 1;
}
}
qosflowdescriptionsnumber ++;
qosflowdescriptionsnumber
++;
}
qosflowdescriptions->qosflowdescriptionsnumber = qosflowdescriptionsnumber;
......@@ -208,4 +209,3 @@ void free_decode_qos_flow_descriptions(QOSFlowDescriptions * qosflowdescriptions
qosflowdescriptions->qosflowdescriptionscontents = NULL;
}
......@@ -96,6 +96,4 @@ int encode_qos_rules ( QOSRules qosrules, uint8_t iei, uint8_t * buffer, uint32_
int decode_qos_rules ( QOSRules * qosrules, uint8_t iei, uint8_t * buffer, uint32_t len);
void free_decode_qos_rules(QOSRules * qosrules);
void free_decode_qos_rules(QOSRules * qosrules);
#endif
This diff is collapsed.
......@@ -34,7 +34,7 @@
#define TEST_MAC_ENCRYPT_DECRYPT__ 0
#define NAS_MESSAGE_SECURITY_HEADER_SIZE 7
#define NAS_MESSAGE_SECURITY_HEADER_SIZE 7
/*********************************************************/
/************************* 9.1 24501**********************/
......
/*****************************************************************************
Source as_message.h
Version 0.1
Date 2019/08/05
Product NAS stack
Subsystem include
Author BUPT
Description Contains network's global definitions
*****************************************************************************/
#ifndef __AS_MESSAGE_H__
#define __AS_MESSAGE_H__
#include "networkDef.h"
/*
* --------------------------------------------------------------------------
* NAS signalling connection establishment
* --------------------------------------------------------------------------
*/
/* Cause of RRC connection establishment, origin from typedef enum Ngap_RRCEstablishmentCause*/
typedef enum as_cause_s {
AS_CAUSE_EMERGENCY = NGAP_RRC_ESTABLISHMENT_CAUSE_EMERGENCY,
AS_CAUSE_HIGH_PRIORITY_ACCESS = NGAP_RRC_ESTABLISHMENT_CAUSE_HIGH_PRIORITY_ACCESS,
AS_CAUSE_MT_ACCESS = NGAP_RRC_ESTABLISHMENT_CAUSE_MT_ACCESS,
AS_CAUSE_MO_SIGNALLING = NGAP_RRC_ESTABLISHMENT_CAUSE_MO_SIGNALLING,
AS_CAUSE_MO_DATA = NGAP_RRC_ESTABLISHMENT_CAUSE_MO_DATA,
AS_CAUSE_MO_VOICECALL = NGAP_RRC_ESTABLISHMENT_CAUSE_MO_VOICECALL ,
AS_CAUSE_MO_VIDEOCALL = NGAP_RRC_ESTABLISHMENT_CAUSE_MO_VIDEOCALL,
AS_CAUSE_MO_SMS = NGAP_RRC_ESTABLISHMENT_CAUSE_MO_SMS,
AS_CAUSE_MPS_PRIORITY_ACCESS = NGAP_RRC_ESTABLISHMENT_CAUSE_MPS_PRIORITY_ACCESS,
AS_CAUSE_MCS_PRIORITY_ACCESS = NGAP_RRC_ESTABLISHMENT_CAUSE_MCS_PRIORITY_ACCESS
} as_cause_t;
#endif
......@@ -37,15 +37,15 @@ Description Contains network's global definitions
* --------------------------------------
*/
#define NGAP_RRC_ESTABLISHMENT_CAUSE_EMERGENCY 0
#define NGAP_RRC_ESTABLISHMENT_CAUSE_HIGH_PRIORITY_ACCESS 1
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MT_ACCESS 2
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_SIGNALLING 3
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_DATA 4
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_VOICECALL 5
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_VIDEOCALL 6
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_SMS 7
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MPS_PRIORITY_ACCESS 8
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MCS_PRIORITY_ACCESS 9
#define NGAP_RRC_ESTABLISHMENT_CAUSE_EMERGENCY 0
#define NGAP_RRC_ESTABLISHMENT_CAUSE_HIGH_PRIORITY_ACCESS 1
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MT_ACCESS 2
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_SIGNALLING 3
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_DATA 4
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_VOICECALL 5
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_VIDEOCALL 6
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MO_SMS 7
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MPS_PRIORITY_ACCESS 8
#define NGAP_RRC_ESTABLISHMENT_CAUSE_MCS_PRIORITY_ACCESS 9
#endif
......@@ -38,10 +38,6 @@ Description Contains global security definitions
#ifndef FILE_SECURITYDEF_SEEN
#define FILE_SECURITYDEF_SEEN
/****************************************************************************/
/********************* G L O B A L C O N S T A N T S *******************/
/****************************************************************************/
/*
* Index of the first byte of each fields of the AUTN parameter
*/
......@@ -73,10 +69,6 @@ Description Contains global security definitions
/* "Separation bit" of AMF field */
#define AUTH_AMF_SEPARATION_BIT(a) ((a) & 0x80)
/****************************************************************************/
/************************ G L O B A L T Y P E S ************************/
/****************************************************************************/
/*
* EPS authentication vector
*/
......
......@@ -14,52 +14,25 @@ int decode_pdu_session_authentication_command( pdu_session_authentication_comman
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_AUTHENTICATION_COMMAND_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_authentication_command->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_pdu_session_identity (&pdu_session_authentication_command->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_authentication_command->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_authentication_command->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
if((decoded_result = decode_eap_message (&pdu_session_authentication_command->eapmessage, 0, buffer+decoded,len-decoded))<0)
{
if ((decoded_result = decode_eap_message (&pdu_session_authentication_command->eapmessage, 0, buffer + decoded, len - decoded)) < 0) {
return decoded_result;
}
else
{
decoded+=decoded_result;
} else {
decoded += decoded_result;
}
while(len - decoded > 0)
{
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer+decoded);
if(ieiDecoded == 0)
if (ieiDecoded == 0)
break;
switch(ieiDecoded)
{
case PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_authentication_command->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
switch (ieiDecoded) {
case PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_authentication_command->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_authentication_command->presence |= PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_PRESENCE;
else {
decoded += decoded_result;
pdu_session_authentication_command->presence |= PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_PRESENCE;
}
break;
}
......@@ -77,45 +50,18 @@ int encode_pdu_session_authentication_command( pdu_session_authentication_comman
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_AUTHENTICATION_COMMAND_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_authentication_command->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
if ((encoded_result = encode_eap_message (pdu_session_authentication_command->eapmessage, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded+=encoded_result;
encoded += encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_authentication_command->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_authentication_command->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_authentication_command->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((encoded_result = encode_eap_message (pdu_session_authentication_command->eapmessage, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((pdu_session_authentication_command->presence & PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_command->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
{
if ((pdu_session_authentication_command->presence & PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_PRESENCE) {
if ((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_command->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_IEI, buffer + encoded, len - encoded)) < 0) {
return encoded_result;
}
else
{
encoded+=encoded_result;
} else {
encoded += encoded_result;
}
}
return encoded;
}
......@@ -41,10 +41,10 @@
0)
#define PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_IEI 0x7B
#define PDU_SESSION_AUTHENTICATION_COMMAND_E_P_C_O_PRESENCE (1<<0)
#define PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_IEI 0x7B
#define PDU_SESSION_AUTHENTICATION_COMMAND_EPCO_PRESENCE (1<<0)
typedef struct pdu_session_authentication_command_msg_tag{
typedef struct pdu_session_authentication_command_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -52,7 +52,7 @@ typedef struct pdu_session_authentication_command_msg_tag{
EAPMessage eapmessage;
uint8_t presence;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_authentication_command_msg;
} pdu_session_authentication_command_msg;
int decode_pdu_session_authentication_command(pdu_session_authentication_command_msg *pdusessionauthenticationcommand, uint8_t *buffer, uint32_t len);
......
......@@ -14,59 +14,31 @@ int decode_pdu_session_authentication_complete( pdu_session_authentication_compl
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_AUTHENTICATION_COMPLETE_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_authentication_complete->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
if ((decoded_result = decode_eap_message (&pdu_session_authentication_complete->eapmessage, 0, buffer + decoded, len - decoded)) < 0) {
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_pdu_session_identity (&pdu_session_authentication_complete->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_authentication_complete->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_authentication_complete->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
if((decoded_result = decode_eap_message (&pdu_session_authentication_complete->eapmessage, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
}
else
{
decoded+=decoded_result;
}
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
if(ieiDecoded == 0)
break;
} else {
decoded += decoded_result;
}
switch(ieiDecoded)
{
case PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_authentication_complete->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_authentication_complete->presence |= PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if (ieiDecoded == 0)
break;
switch (ieiDecoded) {
case PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_authentication_complete->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_authentication_complete->presence |= PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_PRESENCE;
}
break;
}
break;
}
}
return decoded;
return decoded;
}
......@@ -78,45 +50,18 @@ int encode_pdu_session_authentication_complete( pdu_session_authentication_compl
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_AUTHENTICATION_COMPLETE_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_authentication_complete->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_authentication_complete->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_authentication_complete->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_authentication_complete->messagetype, 0, buffer+encoded,len-encoded))<0)
if ((encoded_result = encode_eap_message (pdu_session_authentication_complete->eapmessage, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((encoded_result = encode_eap_message (pdu_session_authentication_complete->eapmessage, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
encoded += encoded_result;
if((pdu_session_authentication_complete->presence & PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_complete->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
{
return encoded_result;
}
else
{
encoded+=encoded_result;
if ((pdu_session_authentication_complete->presence & PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_PRESENCE) == PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_PRESENCE) {
if ((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_complete->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_IEI, buffer + encoded, len - encoded)) < 0) {
return encoded_result;
} else {
encoded += encoded_result;
}
}
}
return encoded;
return encoded;
}
......@@ -38,10 +38,10 @@
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH_TLVE + \
0)
#define PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_IEI 0x7B
#define PDU_SESSION_AUTHENTICATION_COMPLETE_E_P_C_O_PRESENCE (1<<0)
#define PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_IEI 0x7B
#define PDU_SESSION_AUTHENTICATION_COMPLETE_EPCO_PRESENCE (1<<0)
typedef struct pdu_session_authentication_complete_msg_tag{
typedef struct pdu_session_authentication_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -49,7 +49,7 @@ typedef struct pdu_session_authentication_complete_msg_tag{
EAPMessage eapmessage;
uint8_t presence;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_authentication_complete_msg;
} pdu_session_authentication_complete_msg;
int decode_pdu_session_authentication_complete(pdu_session_authentication_complete_msg *pdusessionauthenticationcomplete, uint8_t *buffer, uint32_t len);
......
......@@ -8,118 +8,63 @@
int decode_pdu_session_authentication_result( pdu_session_authentication_result_msg *pdu_session_authentication_result, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_AUTHENTICATION_RESULT_MINIMUM_LENGTH, len);
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_AUTHENTICATION_RESULT_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_authentication_result->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
while(len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if((decoded_result = decode_pdu_session_identity (&pdu_session_authentication_result->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if (ieiDecoded == 0)
break;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_authentication_result->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
switch (ieiDecoded) {
case PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI:
if ((decoded_result = decode_eap_message (&pdu_session_authentication_result->eapmessage, PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_authentication_result->messagetype, 0, buffer+decoded,len-decoded))<0)
else {
decoded += decoded_result;
pdu_session_authentication_result->presence |= PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE;
}
break;
case PDU_SESSION_AUTHENTICATION_RESULT_EPCO_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_authentication_result->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_RESULT_EPCO_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
while(len - decoded > 0)
{
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded = 0x%x\n",ieiDecoded);
//sleep(1);
if(ieiDecoded == 0)
break;
switch(ieiDecoded)
{
case PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI:
if((decoded_result = decode_eap_message (&pdu_session_authentication_result->eapmessage, PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_authentication_result->presence |= PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE;
}
break;
case PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_authentication_result->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_authentication_result->presence |= PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_PRESENCE;
}
break;
}
}
return decoded;
else {
decoded += decoded_result;
pdu_session_authentication_result->presence |= PDU_SESSION_AUTHENTICATION_RESULT_EPCO_PRESENCE;
}
break;
}
}
return decoded;
}
int encode_pdu_session_authentication_result( pdu_session_authentication_result_msg *pdu_session_authentication_result, uint8_t* buffer, uint32_t len)
{
uint32_t encoded = 0;
int encoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_AUTHENTICATION_RESULT_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_authentication_result->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
uint32_t encoded = 0;
int encoded_result = 0;
if((encoded_result = encode_pdu_session_identity (pdu_session_authentication_result->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_AUTHENTICATION_RESULT_MINIMUM_LENGTH, len);
if((encoded_result = encode_procedure_transaction_identity (pdu_session_authentication_result->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
if ((pdu_session_authentication_result->presence & PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE) == PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE) {
if((encoded_result = encode_eap_message (pdu_session_authentication_result->eapmessage, PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded+=encoded_result;
encoded += encoded_result;
}
if((encoded_result = encode_message_type (pdu_session_authentication_result->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
if((pdu_session_authentication_result->presence & PDU_SESSION_AUTHENTICATION_RESULT_EPCO_PRESENCE) == PDU_SESSION_AUTHENTICATION_RESULT_EPCO_PRESENCE) {
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_result->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_RESULT_EPCO_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((pdu_session_authentication_result->presence & PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE) == PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE)
{
if((encoded_result = encode_eap_message (pdu_session_authentication_result->eapmessage, PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if((pdu_session_authentication_result->presence & PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_PRESENCE) == PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_authentication_result->extendedprotocolconfigurationoptions, PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -38,12 +38,12 @@
0)
#define PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_AUTHENTICATION_RESULT_EPCO_IEI 0x7B
#define PDU_SESSION_AUTHENTICATION_RESULT_EAP_MESSAGE_PRESENCE (1<<0)
#define PDU_SESSION_AUTHENTICATION_RESULT_E_P_C_O_PRESENCE (1<<1)
#define PDU_SESSION_AUTHENTICATION_RESULT_EPCO_PRESENCE (1<<1)
typedef struct pdu_session_authentication_result_msg_tag{
typedef struct pdu_session_authentication_result_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -51,7 +51,7 @@ typedef struct pdu_session_authentication_result_msg_tag{
uint8_t presence;
EAPMessage eapmessage;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_authentication_result_msg;
} pdu_session_authentication_result_msg;
int decode_pdu_session_authentication_result(pdu_session_authentication_result_msg *pdusessionauthenticationresult, uint8_t *buffer, uint32_t len);
......
......@@ -79,29 +79,29 @@
0)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_IEI 0x29
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_GPRS_TIMER_IEI 0x56
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_SNSSAI_IEI 0x22
#define PDU_SESSION_ESTABLISHMENT_ACCEPT__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_IEI 0x29
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_GPRS_TIMER_IEI 0x56
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_SNSSAI_IEI 0x22
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYSON_PDU_SESSION_INDICATION_IEI 0x80
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_IEI 0x75
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_QOS_FLOW_DESCRIPTIONS_IEI 0x79
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_IEI 0x25
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_IEI 0x75
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_QOS_FLOW_DESCRIPTIONS_IEI 0x79
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_EPCO_IEI 0x7B
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_IEI 0x25
#define PDU_SESSION_ESTABLISHMENT_ACCEPT__5GSM_CAUSE_PRESENCE (1<<0)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENCE (1<<1)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_GPRS_TIMER_PRESENCE (1<<2)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_SNSSAI_PRESENCE (1<<3)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT__5GSM_CAUSE_PRESENCE (1<<0)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_PDU_ADDRESS_PRESENCE (1<<1)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_GPRS_TIMER_PRESENCE (1<<2)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_SNSSAI_PRESENCE (1<<3)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_ALWAYSON_PDU_SESSION_INDICATION_PRESENCE (1<<4)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_PRESENCE (1<<5)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_PRESENCE (1<<6)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_QOS_FLOW_DESCRIPTIONS_PRESENCE (1<<7)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_E_P_C_O_PRESENCE (1<<8)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_PRESENCE (1<<9)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_MAPPED_EPS_BEARER_CONTEXTS_PRESENCE (1<<5)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_EAP_MESSAGE_PRESENCE (1<<6)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_QOS_FLOW_DESCRIPTIONS_PRESENCE (1<<7)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_EPCO_PRESENCE (1<<8)
#define PDU_SESSION_ESTABLISHMENT_ACCEPT_DNN_PRESENCE (1<<9)
typedef struct pdu_session_establishment_accept_msg_tag{
typedef struct pdu_session_establishment_accept_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -121,7 +121,7 @@ typedef struct pdu_session_establishment_accept_msg_tag{
QOSFlowDescriptions qosflowdescriptions;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
DNN dnn;
}pdu_session_establishment_accept_msg;
} pdu_session_establishment_accept_msg;
int decode_pdu_session_establishment_accept(pdu_session_establishment_accept_msg *pdusessionestablishmentaccept, uint8_t *buffer, uint32_t len);
......
......@@ -52,19 +52,19 @@
0)
#define PDU_SESSION_ESTABLISHMENT_REJECT_GPRS_TIMER3_IEI 0x37
#define PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_IEI 0xF0
#define PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_ESTABLISHMENT_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_ESTABLISHMENT_REJECT_GPRS_TIMER3_IEI 0x37
#define PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_IEI 0xF0
#define PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_ESTABLISHMENT_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_ESTABLISHMENT_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI 0x61
#define PDU_SESSION_ESTABLISHMENT_REJECT_GPRS_TIMER3_PRESENCE (1<<0)
#define PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENCE (1<<1)
#define PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_PRESENCE (1<<2)
#define PDU_SESSION_ESTABLISHMENT_REJECT_E_P_C_O_PRESENCE (1<<3)
#define PDU_SESSION_ESTABLISHMENT_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE (1<<4)
#define PDU_SESSION_ESTABLISHMENT_REJECT_GPRS_TIMER3_PRESENCE (1<<0)
#define PDU_SESSION_ESTABLISHMENT_REJECT_ALLOWED_SSC_MODE_PRESENCE (1<<1)
#define PDU_SESSION_ESTABLISHMENT_REJECT_EAP_MESSAGE_PRESENCE (1<<2)
#define PDU_SESSION_ESTABLISHMENT_REJECT_E_P_C_O_PRESENCE (1<<3)
#define PDU_SESSION_ESTABLISHMENT_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE (1<<4)
typedef struct pdu_session_establishment_reject_msg_tag{
typedef struct pdu_session_establishment_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -76,7 +76,7 @@ typedef struct pdu_session_establishment_reject_msg_tag{
EAPMessage eapmessage;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
_5GSMCongestionReattemptIndicator _5gsmcongestionreattemptindicator;
}pdu_session_establishment_reject_msg;
} pdu_session_establishment_reject_msg;
int decode_pdu_session_establishment_reject(pdu_session_establishment_reject_msg *pdusessionestablishmentreject, uint8_t *buffer, uint32_t len);
......
......@@ -59,24 +59,24 @@
#define PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_IEI 0x90
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_IEI 0xA0
#define PDU_SESSION_ESTABLISHMENT_REQUEST__5GSM_CAPABILITY_IEI 0x28
#define PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_IEI 0x55
#define PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_IEI 0xB0
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SMPDUDN_REQUEST_CONTAINER_INFORMATION_IEI 0x39
#define PDU_SESSION_ESTABLISHMENT_REQUEST_E_P_C_O_IEI 0x7B
#define PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_IEI 0x90
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_IEI 0xA0
#define PDU_SESSION_ESTABLISHMENT_REQUEST__5GSM_CAPABILITY_IEI 0x28
#define PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_IEI 0x55
#define PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_IEI 0xB0
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SMPDUDN_REQUEST_CONTAINER_INFORMATION_IEI 0x39
#define PDU_SESSION_ESTABLISHMENT_REQUEST_EPCO_IEI 0x7B
#define PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT (1<<0)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT (1<<1)
#define PDU_SESSION_ESTABLISHMENT_REQUEST__5GSM_CAPABILITY_PRESENT (1<<2)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PRESENT (1<<3)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_PRESENT (1<<4)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SMPDUDN_REQUEST_CONTAINER_INFORMATION_PRESENT (1<<5)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_E_P_C_O_PRESENT (1<<6)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_PDU_SESSION_TYPE_PRESENT (1<<0)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SSC_MODE_PRESENT (1<<1)
#define PDU_SESSION_ESTABLISHMENT_REQUEST__5GSM_CAPABILITY_PRESENT (1<<2)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PRESENT (1<<3)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_PRESENT (1<<4)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_SMPDUDN_REQUEST_CONTAINER_INFORMATION_PRESENT (1<<5)
#define PDU_SESSION_ESTABLISHMENT_REQUEST_EPCO_PRESENT (1<<6)
typedef struct pdu_session_establishment_request_msg_tag{
typedef struct pdu_session_establishment_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -90,7 +90,7 @@ typedef struct pdu_session_establishment_request_msg_tag{
AlwaysonPDUSessionRequested alwaysonpdusessionrequested;
SMPDUDNRequestContainer smpdudnrequestcontainer;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_establishment_request_msg;
} pdu_session_establishment_request_msg;
int decode_pdu_session_establishment_request(pdu_session_establishment_request_msg *pdusessionestablishmentrequest, uint8_t *buffer, uint32_t len);
int encode_pdu_session_establishment_request(pdu_session_establishment_request_msg *pdusessionestablishmentrequest, uint8_t *buffer, uint32_t len);
......
......@@ -20,19 +20,19 @@
#if 0
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define PDU_SESSION_MODIFICATION_COMMAND_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
PDU_SESSION_IDENTITY_MINIMUM_LENGTH + \
PROCEDURE_TRANSACTION_IDENTITY_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GSM_CAUSE_MINIMUM_LENGTH + \
SESSION_AMBR_MINIMUM_LENGTH + \
GPRS_TIMER_MINIMUM_LENGTH + \
ALWAYSON_PDU_SESSION_INDICATION_MINIMUM_LENGTH + \
QOS_RULES_MINIMUM_LENGTH + \
MAPPED_EPS_BEARER_CONTEXTS_MINIMUM_LENGTH + \
QOS_FLOW_DESCRIPTIONS_MINIMUM_LENGTH + \
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH + \
0)
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
PDU_SESSION_IDENTITY_MINIMUM_LENGTH + \
PROCEDURE_TRANSACTION_IDENTITY_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GSM_CAUSE_MINIMUM_LENGTH + \
SESSION_AMBR_MINIMUM_LENGTH + \
GPRS_TIMER_MINIMUM_LENGTH + \
ALWAYSON_PDU_SESSION_INDICATION_MINIMUM_LENGTH + \
QOS_RULES_MINIMUM_LENGTH + \
MAPPED_EPS_BEARER_CONTEXTS_MINIMUM_LENGTH + \
QOS_FLOW_DESCRIPTIONS_MINIMUM_LENGTH + \
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH + \
0)
#endif
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define PDU_SESSION_MODIFICATION_COMMAND_MINIMUM_LENGTH 0
......@@ -40,55 +40,55 @@
/* Maximum length macro. Formed by maximum length of each field */
#define PDU_SESSION_MODIFICATION_COMMAND_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
PDU_SESSION_IDENTITY_MAXIMUM_LENGTH + \
PROCEDURE_TRANSACTION_IDENTITY_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GSM_CAUSE_MAXIMUM_LENGTH_TV + \
SESSION_AMBR_MAXIMUM_LENGTH_TLV + \
GPRS_TIMER_MAXIMUM_LENGTH_TV + \
ALWAYSON_PDU_SESSION_INDICATION_MAXIMUM_LENGTH + \
QOS_RULES_MAXIMUM_LENGTH_TLVE + \
MAPPED_EPS_BEARER_CONTEXTS_MAXIMUM_LENGTH + \
QOS_FLOW_DESCRIPTIONS_MAXIMUM_LENGTH_TLVE + \
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH_TLVE + \
0)
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
PDU_SESSION_IDENTITY_MAXIMUM_LENGTH + \
PROCEDURE_TRANSACTION_IDENTITY_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GSM_CAUSE_MAXIMUM_LENGTH_TV + \
SESSION_AMBR_MAXIMUM_LENGTH_TLV + \
GPRS_TIMER_MAXIMUM_LENGTH_TV + \
ALWAYSON_PDU_SESSION_INDICATION_MAXIMUM_LENGTH + \
QOS_RULES_MAXIMUM_LENGTH_TLVE + \
MAPPED_EPS_BEARER_CONTEXTS_MAXIMUM_LENGTH + \
QOS_FLOW_DESCRIPTIONS_MAXIMUM_LENGTH_TLVE + \
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MAXIMUM_LENGTH_TLVE + \
0)
#define PDU_SESSION_MODIFICATION_COMMAND__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_IEI 0x2A
#define PDU_SESSION_MODIFICATION_COMMAND_GPRS_TIMER_IEI 0x56
#define PDU_SESSION_MODIFICATION_COMMAND__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_IEI 0x2A
#define PDU_SESSION_MODIFICATION_COMMAND_GPRS_TIMER_IEI 0x56
#define PDU_SESSION_MODIFICATION_COMMAND_ALWAYSON_PDU_SESSION_INDICATION_IEI 0x80
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_RULES_IEI 0x7A
#define PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_IEI 0x75
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_FLOW_DESCRIPTIONS_IEI 0x79
#define PDU_SESSION_MODIFICATION_COMMAND_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_RULES_IEI 0x7A
#define PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_IEI 0x75
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_FLOW_DESCRIPTIONS_IEI 0x79
#define PDU_SESSION_MODIFICATION_COMMAND_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_COMMAND__5GSM_CAUSE_PRESENCE (1<<0)
#define PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_PRESENCE (1<<1)
#define PDU_SESSION_MODIFICATION_COMMAND_GPRS_TIMER_PRESENCE (1<<2)
#define PDU_SESSION_MODIFICATION_COMMAND__5GSM_CAUSE_PRESENCE (1<<0)
#define PDU_SESSION_MODIFICATION_COMMAND_SESSION_AMBR_PRESENCE (1<<1)
#define PDU_SESSION_MODIFICATION_COMMAND_GPRS_TIMER_PRESENCE (1<<2)
#define PDU_SESSION_MODIFICATION_COMMAND_ALWAYSON_PDU_SESSION_INDICATION_PRESENCE (1<<3)
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_RULES_PRESENCE (1<<4)
#define PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_PRESENCE (1<<5)
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_FLOW_DESCRIPTIONS_PRESENCE (1<<6)
#define PDU_SESSION_MODIFICATION_COMMAND_E_P_C_O_PRESENCE (1<<7)
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_RULES_PRESENCE (1<<4)
#define PDU_SESSION_MODIFICATION_COMMAND_MAPPED_EPS_BEARER_CONTEXTS_PRESENCE (1<<5)
#define PDU_SESSION_MODIFICATION_COMMAND_QOS_FLOW_DESCRIPTIONS_PRESENCE (1<<6)
#define PDU_SESSION_MODIFICATION_COMMAND_E_P_C_O_PRESENCE (1<<7)
typedef struct pdu_session_modification_command_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
uint8_t presence;
_5GSMCause _5gsmcause;
SessionAMBR sessionambr;
GPRSTimer gprstimer;
AlwaysonPDUSessionIndication alwaysonpdusessionindication;
QOSRules qosrules;
MappedEPSBearerContexts mappedepsbearercontexts;
QOSFlowDescriptions qosflowdescriptions;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_modification_command_msg;
typedef struct pdu_session_modification_command_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
uint8_t presence;
_5GSMCause _5gsmcause;
SessionAMBR sessionambr;
GPRSTimer gprstimer;
AlwaysonPDUSessionIndication alwaysonpdusessionindication;
QOSRules qosrules;
MappedEPSBearerContexts mappedepsbearercontexts;
QOSFlowDescriptions qosflowdescriptions;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
} pdu_session_modification_command_msg;
int decode_pdu_session_modification_command(pdu_session_modification_command_msg *pdusessionmodificationcommand, uint8_t *buffer, uint32_t len);
......
......@@ -14,59 +14,31 @@ int decode_pdu_session_modification_command_reject( pdu_session_modification_com
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_MODIFICATION_COMMAND_REJECT_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_modification_command_reject->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
if ((decoded_result = decode__5gsm_cause (&pdu_session_modification_command_reject->_5gsmcause, 0, buffer + decoded, len - decoded)) < 0) {
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_pdu_session_identity (&pdu_session_modification_command_reject->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_modification_command_reject->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_modification_command_reject->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
if((decoded_result = decode__5gsm_cause (&pdu_session_modification_command_reject->_5gsmcause, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
}
else
{
decoded+=decoded_result;
}
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
if(ieiDecoded == 0)
break;
} else {
decoded += decoded_result;
}
switch(ieiDecoded)
{
case PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_modification_command_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_modification_command_reject->presence |= PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if (ieiDecoded == 0)
break;
switch (ieiDecoded) {
case PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_modification_command_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_modification_command_reject->presence |= PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE;
}
break;
}
break;
}
}
return decoded;
return decoded;
}
......@@ -78,44 +50,18 @@ int encode_pdu_session_modification_command_reject( pdu_session_modification_com
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_MODIFICATION_COMMAND_REJECT_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_modification_command_reject->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
if((encoded_result = encode__5gsm_cause (pdu_session_modification_command_reject->_5gsmcause, 0, buffer + encoded, len - encoded)) < 0) {
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_modification_command_reject->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_modification_command_reject->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_modification_command_reject->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((encoded_result = encode__5gsm_cause (pdu_session_modification_command_reject->_5gsmcause, 0, buffer+encoded,len-encoded))<0)
{
return encoded_result;
}
else
{
encoded+=encoded_result;
}
} else {
encoded += encoded_result;
}
if((pdu_session_modification_command_reject->presence & PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE) == PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_modification_command_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_modification_command_reject->presence & PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE) == PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE) {
if ((encoded_result = encode_extended_protocol_configuration_options (pdu_session_modification_command_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -39,10 +39,10 @@
0)
#define PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_COMMAND_REJECT_E_P_C_O_PRESENCE (1<<0)
typedef struct pdu_session_modification_command_reject_msg_tag{
typedef struct pdu_session_modification_command_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -50,7 +50,7 @@ typedef struct pdu_session_modification_command_reject_msg_tag{
_5GSMCause _5gsmcause;
uint8_t presence;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_modification_command_reject_msg;
} pdu_session_modification_command_reject_msg;
int decode_pdu_session_modification_command_reject(pdu_session_modification_command_reject_msg *pdusessionmodificationcommandreject, uint8_t *buffer, uint32_t len);
......
......@@ -8,100 +8,48 @@
int decode_pdu_session_modification_complete( pdu_session_modification_complete_msg *pdu_session_modification_complete, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_MODIFICATION_COMPLETE_MINIMUM_LENGTH, len);
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_MODIFICATION_COMPLETE_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_modification_complete->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer+decoded);
if((decoded_result = decode_pdu_session_identity (&pdu_session_modification_complete->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if (ieiDecoded == 0)
break;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_modification_complete->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
switch (ieiDecoded) {
case PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_modification_complete->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_modification_complete->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
while(len - decoded > 0)
{
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded = 0x%x\n",ieiDecoded);
//sleep(1);
if(ieiDecoded == 0)
break;
switch(ieiDecoded)
{
case PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_modification_complete->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_modification_complete->presence |= PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE;
}
break;
}
}
return decoded;
else {
decoded += decoded_result;
pdu_session_modification_complete->presence |= PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE;
}
break;
}
}
return decoded;
}
int encode_pdu_session_modification_complete( pdu_session_modification_complete_msg *pdu_session_modification_complete, uint8_t* buffer, uint32_t len)
{
uint32_t encoded = 0;
int encoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_MODIFICATION_COMPLETE_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_modification_complete->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_modification_complete->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
uint32_t encoded = 0;
int encoded_result = 0;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_modification_complete->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_MODIFICATION_COMPLETE_MINIMUM_LENGTH, len);
if((encoded_result = encode_message_type (pdu_session_modification_complete->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((pdu_session_modification_complete->presence & PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_modification_complete->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_modification_complete->presence & PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE) {
if ((encoded_result = encode_extended_protocol_configuration_options (pdu_session_modification_complete->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -34,17 +34,17 @@
0)
#define PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_COMPLETE_E_P_C_O_PRESENCE (1<<0)
typedef struct pdu_session_modification_complete_msg_tag{
typedef struct pdu_session_modification_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
uint8_t presence;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_modification_complete_msg;
} pdu_session_modification_complete_msg;
int decode_pdu_session_modification_complete(pdu_session_modification_complete_msg *pdusessionmodificationcomplete, uint8_t *buffer, uint32_t len);
......
......@@ -14,77 +14,47 @@ int decode_pdu_session_modification_reject( pdu_session_modification_reject_msg
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_MODIFICATION_REJECT_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_modification_reject->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
if ((decoded_result = decode__5gsm_cause (&pdu_session_modification_reject->_5gsmcause, 0, buffer + decoded, len - decoded)) < 0) {
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_pdu_session_identity (&pdu_session_modification_reject->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_modification_reject->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_modification_reject->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
if((decoded_result = decode__5gsm_cause (&pdu_session_modification_reject->_5gsmcause, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
}
else
{
decoded+=decoded_result;
}
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
if(ieiDecoded == 0)
break;
} else {
decoded += decoded_result;
}
switch(ieiDecoded)
{
case PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI:
if((decoded_result = decode_gprs_timer3 (&pdu_session_modification_reject->gprstimer3, PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_modification_reject->presence |= PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE;
}
break;
case PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_modification_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_modification_reject->presence |= PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if (ieiDecoded == 0)
break;
switch (ieiDecoded) {
case PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI:
if ((decoded_result = decode_gprs_timer3 (&pdu_session_modification_reject->gprstimer3, PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_modification_reject->presence |= PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE;
}
break;
case PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_modification_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_modification_reject->presence |= PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE;
}
break;
case PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI:
if ((decoded_result = decode__5gsm_congestion_reattempt_indicator (&pdu_session_modification_reject->_5gsmcongestionreattemptindicator, PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_modification_reject->presence |= PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE;
}
break;
}
break;
case PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI:
if((decoded_result = decode__5gsm_congestion_reattempt_indicator (&pdu_session_modification_reject->_5gsmcongestionreattemptindicator, PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_modification_reject->presence |= PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE;
}
break;
}
}
return decoded;
return decoded;
}
......@@ -96,60 +66,32 @@ int encode_pdu_session_modification_reject( pdu_session_modification_reject_msg
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_MODIFICATION_REJECT_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_modification_reject->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_modification_reject->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_modification_reject->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_modification_reject->messagetype, 0, buffer+encoded,len-encoded))<0)
if ((encoded_result = encode__5gsm_cause (pdu_session_modification_reject->_5gsmcause, 0, buffer + encoded, len - encoded)) < 0) {
return encoded_result;
else
encoded+=encoded_result;
#endif
if((encoded_result = encode__5gsm_cause (pdu_session_modification_reject->_5gsmcause, 0, buffer+encoded,len-encoded))<0)
{
return encoded_result;
}
else
{
encoded+=encoded_result;
}
} else {
encoded += encoded_result;
}
if((pdu_session_modification_reject->presence & PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE) == PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE)
{
if((encoded_result = encode_gprs_timer3 (pdu_session_modification_reject->gprstimer3, PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_modification_reject->presence & PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE) == PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE) {
if ((encoded_result = encode_gprs_timer3 (pdu_session_modification_reject->gprstimer3, PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded+=encoded_result;
}
if((pdu_session_modification_reject->presence & PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE) == PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_modification_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_modification_reject->presence & PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE) == PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE) {
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_modification_reject->extendedprotocolconfigurationoptions, PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if((pdu_session_modification_reject->presence & PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE) == PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE)
{
if((encoded_result = encode__5gsm_congestion_reattempt_indicator (pdu_session_modification_reject->_5gsmcongestionreattemptindicator, PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_modification_reject->presence & PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE) == PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE) {
if ((encoded_result = encode__5gsm_congestion_reattempt_indicator (pdu_session_modification_reject->_5gsmcongestionreattemptindicator, PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -45,15 +45,15 @@
0)
#define PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI 0x37
#define PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_IEI 0x37
#define PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI 0x61
#define PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE (1<<0)
#define PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE (1<<1)
#define PDU_SESSION_MODIFICATION_REJECT_GPRS_TIMER3_PRESENCE (1<<0)
#define PDU_SESSION_MODIFICATION_REJECT_E_P_C_O_PRESENCE (1<<1)
#define PDU_SESSION_MODIFICATION_REJECT__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE (1<<2)
typedef struct pdu_session_modification_reject_msg_tag{
typedef struct pdu_session_modification_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -63,7 +63,7 @@ typedef struct pdu_session_modification_reject_msg_tag{
GPRSTimer3 gprstimer3;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
_5GSMCongestionReattemptIndicator _5gsmcongestionreattemptindicator;
}pdu_session_modification_reject_msg;
} pdu_session_modification_reject_msg;
int decode_pdu_session_modification_reject(pdu_session_modification_reject_msg *pdusessionmodificationreject, uint8_t *buffer, uint32_t len);
......
......@@ -58,29 +58,29 @@
0)
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAPABILITY_IEI 0x28
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_IEI 0x55
#define PDU_SESSION_MODIFICATION_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_IEI 0xB0
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAPABILITY_IEI 0x28
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_IEI 0x55
#define PDU_SESSION_MODIFICATION_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_IEI 0xB0
#define PDU_SESSION_MODIFICATION_REQUEST_INTGRITY_PROTECTION_MAXIMUM_DATA_RATE_IEI 0x13
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_RULES_IEI 0x7A
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_FLOW_DESCRIPTIONS_IEI 0x79
#define PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_IEI 0x75
#define PDU_SESSION_MODIFICATION_REQUEST_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_RULES_IEI 0x7A
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_FLOW_DESCRIPTIONS_IEI 0x79
#define PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_IEI 0x75
#define PDU_SESSION_MODIFICATION_REQUEST_E_P_C_O_IEI 0x7B
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAPABILITY_PRESENCE (1<<0)
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAUSE_PRESENCE (1<<1)
#define PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PRESENCE (1<<2)
#define PDU_SESSION_MODIFICATION_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_PRESENCE (1<<3)
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAPABILITY_PRESENCE (1<<0)
#define PDU_SESSION_MODIFICATION_REQUEST__5GSM_CAUSE_PRESENCE (1<<1)
#define PDU_SESSION_MODIFICATION_REQUEST_MAXIMUM_NUMBER_OF_SUPPORTED_PRESENCE (1<<2)
#define PDU_SESSION_MODIFICATION_REQUEST_ALWAYSON_PDU_SESSION_REQUESTED_PRESENCE (1<<3)
#define PDU_SESSION_MODIFICATION_REQUEST_INTGRITY_PROTECTION_MAXIMUM_DATA_RATE_PRESENCE (1<<4)
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_RULES_PRESENCE (1<<5)
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_FLOW_DESCRIPTIONS_PRESENCE (1<<6)
#define PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_PRESENCE (1<<7)
#define PDU_SESSION_MODIFICATION_REQUEST_E_P_C_O_PRESENCE (1<<8)
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_RULES_PRESENCE (1<<5)
#define PDU_SESSION_MODIFICATION_REQUEST_QOS_FLOW_DESCRIPTIONS_PRESENCE (1<<6)
#define PDU_SESSION_MODIFICATION_REQUEST_MAPPED_EPS_BEARER_CONTEXTS_PRESENCE (1<<7)
#define PDU_SESSION_MODIFICATION_REQUEST_E_P_C_O_PRESENCE (1<<8)
typedef struct pdu_session_modification_request_msg_tag{
typedef struct pdu_session_modification_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -95,7 +95,7 @@ typedef struct pdu_session_modification_request_msg_tag{
QOSFlowDescriptions qosflowdescriptions;
MappedEPSBearerContexts mappedepsbearercontexts;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_modification_request_msg;
} pdu_session_modification_request_msg;
int decode_pdu_session_modification_request(pdu_session_modification_request_msg *pdusessionmodificationrequest, uint8_t *buffer, uint32_t len);
......
This diff is collapsed.
......@@ -47,17 +47,17 @@
0)
#define PDU_SESSION_RELEASE_COMMAND_GPRS_TIMER3_IEI 0x37
#define PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_RELEASE_COMMAND_GPRS_TIMER3_IEI 0x37
#define PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_IEI 0x78
#define PDU_SESSION_RELEASE_COMMAND__5GSM_CONGESTION_REATTEMPT_INDICATOR_IEI 0x61
#define PDU_SESSION_RELEASE_COMMAND_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_COMMAND_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_COMMAND_GPRS_TIMER3_PRESENCE (1<<0)
#define PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_PRESENCE (1<<1)
#define PDU_SESSION_RELEASE_COMMAND_GPRS_TIMER3_PRESENCE (1<<0)
#define PDU_SESSION_RELEASE_COMMAND_EAP_MESSAGE_PRESENCE (1<<1)
#define PDU_SESSION_RELEASE_COMMAND__5GSM_CONGESTION_REATTEMPT_INDICATOR_PRESENCE (1<<2)
#define PDU_SESSION_RELEASE_COMMAND_E_P_C_O_PRESENCE (1<<3)
#define PDU_SESSION_RELEASE_COMMAND_E_P_C_O_PRESENCE (1<<3)
typedef struct pdu_session_release_command_msg_tag{
typedef struct pdu_session_release_command_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -68,8 +68,7 @@ typedef struct pdu_session_release_command_msg_tag{
EAPMessage eapmessage;
_5GSMCongestionReattemptIndicator _5gsmcongestionreattemptindicator;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_release_command_msg;
} pdu_session_release_command_msg;
int decode_pdu_session_release_command(pdu_session_release_command_msg *pdusessionreleasecommand, uint8_t *buffer, uint32_t len);
int encode_pdu_session_release_command(pdu_session_release_command_msg *pdusessionreleasecommand, uint8_t *buffer, uint32_t len);
......
......@@ -8,118 +8,63 @@
int decode_pdu_session_release_complete( pdu_session_release_complete_msg *pdu_session_release_complete, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_RELEASE_COMPLETE_MINIMUM_LENGTH, len);
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_RELEASE_COMPLETE_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_release_complete->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if((decoded_result = decode_pdu_session_identity (&pdu_session_release_complete->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if (ieiDecoded == 0)
break;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_release_complete->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
switch (ieiDecoded) {
case PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI:
if ((decoded_result = decode__5gsm_cause (&pdu_session_release_complete->_5gsmcause, PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_release_complete->messagetype, 0, buffer+decoded,len-decoded))<0)
else {
decoded += decoded_result;
pdu_session_release_complete->presence |= PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE;
}
break;
case PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_release_complete->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded+=decoded_result;
#endif
while(len - decoded > 0)
{
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded = 0x%x\n",ieiDecoded);
//sleep(1);
if(ieiDecoded == 0)
break;
switch(ieiDecoded)
{
case PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI:
if((decoded_result = decode__5gsm_cause (&pdu_session_release_complete->_5gsmcause, PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_release_complete->presence |= PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE;
}
break;
case PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_release_complete->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_release_complete->presence |= PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE;
}
break;
}
}
return decoded;
else {
decoded += decoded_result;
pdu_session_release_complete->presence |= PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE;
}
break;
}
}
return decoded;
}
int encode_pdu_session_release_complete( pdu_session_release_complete_msg *pdu_session_release_complete, uint8_t* buffer, uint32_t len)
{
uint32_t encoded = 0;
int encoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_RELEASE_COMPLETE_MINIMUM_LENGTH, len);
uint32_t encoded = 0;
int encoded_result = 0;
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_release_complete->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_RELEASE_COMPLETE_MINIMUM_LENGTH, len);
if((encoded_result = encode_pdu_session_identity (pdu_session_release_complete->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_release_complete->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_release_complete->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((pdu_session_release_complete->presence & PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE) == PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE)
{
if((encoded_result = encode__5gsm_cause (pdu_session_release_complete->_5gsmcause, PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if((pdu_session_release_complete->presence & PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_release_complete->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_release_complete->presence & PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE) == PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE) {
if ((encoded_result = encode__5gsm_cause (pdu_session_release_complete->_5gsmcause, PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((pdu_session_release_complete->presence & PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE) == PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE) {
if ((encoded_result = encode_extended_protocol_configuration_options (pdu_session_release_complete->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -38,12 +38,12 @@
#define PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_COMPLETE__5GSM_CAUSE_PRESENCE (1<<0)
#define PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE (1<<1)
#define PDU_SESSION_RELEASE_COMPLETE_E_P_C_O_PRESENCE (1<<1)
typedef struct pdu_session_release_complete_msg_tag{
typedef struct pdu_session_release_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -51,8 +51,7 @@ typedef struct pdu_session_release_complete_msg_tag{
uint8_t presence;
_5GSMCause _5gsmcause;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_release_complete_msg;
} pdu_session_release_complete_msg;
int decode_pdu_session_release_complete(pdu_session_release_complete_msg *pdusessionreleasecomplete, uint8_t *buffer, uint32_t len);
int encode_pdu_session_release_complete(pdu_session_release_complete_msg *pdusessionreleasecomplete, uint8_t *buffer, uint32_t len);
......
......@@ -14,59 +14,31 @@ int decode_pdu_session_release_reject( pdu_session_release_reject_msg *pdu_sessi
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_RELEASE_REJECT_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_release_reject->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode__5gsm_cause (&pdu_session_release_reject->_5gsmcause, 0, buffer + decoded, len - decoded)) < 0) {
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_pdu_session_identity (&pdu_session_release_reject->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_release_reject->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_release_reject->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
if((decoded_result = decode__5gsm_cause (&pdu_session_release_reject->_5gsmcause, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
}
else
{
decoded += decoded_result;
}
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
if(ieiDecoded == 0)
break;
} else {
decoded += decoded_result;
}
switch(ieiDecoded)
{
case PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_release_reject->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_release_reject->presence |= PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if (ieiDecoded == 0)
break;
switch (ieiDecoded) {
case PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_release_reject->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_release_reject->presence |= PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE;
}
break;
}
break;
}
}
return decoded;
return decoded;
}
......@@ -78,45 +50,18 @@ int encode_pdu_session_release_reject( pdu_session_release_reject_msg *pdu_sessi
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_RELEASE_REJECT_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_release_reject->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
if ((encoded_result = encode__5gsm_cause (pdu_session_release_reject->_5gsmcause, 0, buffer + encoded, len - encoded)) < 0) {
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_release_reject->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_release_reject->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_release_reject->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((encoded_result = encode__5gsm_cause (pdu_session_release_reject->_5gsmcause, 0, buffer+encoded,len-encoded))<0)
{
return encoded_result;
}
else
{
encoded += encoded_result;
}
if((pdu_session_release_reject->presence & PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE) == PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_release_reject->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
} else {
encoded += encoded_result;
}
if ((pdu_session_release_reject->presence & PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE) == PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE) {
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_release_reject->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -39,10 +39,10 @@
0)
#define PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_REJECT_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_REJECT_E_P_C_O_PRESENCE (1<<0)
typedef struct pdu_session_release_reject_msg_tag{
typedef struct pdu_session_release_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -50,8 +50,7 @@ typedef struct pdu_session_release_reject_msg_tag{
_5GSMCause _5gsmcause;
uint8_t presence;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_release_reject_msg;
} pdu_session_release_reject_msg;
int decode_pdu_session_release_reject(pdu_session_release_reject_msg *pdusessionreleasereject, uint8_t *buffer, uint32_t len);
int encode_pdu_session_release_reject(pdu_session_release_reject_msg *pdusessionreleasereject, uint8_t *buffer, uint32_t len);
......
......@@ -14,61 +14,31 @@ int decode_pdu_session_release_request( pdu_session_release_request_msg *pdu_ses
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, PDU_SESSION_RELEASE_REQUEST_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&pdu_session_release_request->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_pdu_session_identity (&pdu_session_release_request->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&pdu_session_release_request->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&pdu_session_release_request->messagetype, 0, buffer+decoded,len-decoded))<0)
{
return decoded_result;
}
else
{
decoded += decoded_result;
}
#endif
while(len - decoded > 0)
{
uint8_t ieiDecoded = *(buffer+decoded);
if(ieiDecoded == 0)
break;
switch(ieiDecoded)
{
case PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI:
if((decoded_result = decode__5gsm_cause (&pdu_session_release_request->_5gsmcause, PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI, buffer+decoded,len-decoded))<0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_release_request->presence |= PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if( ieiDecoded == 0)
break;
switch (ieiDecoded) {
case PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI:
if ((decoded_result = decode__5gsm_cause (&pdu_session_release_request->_5gsmcause, PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_release_request->presence |= PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE;
}
break;
case PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI:
if ((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_release_request->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
pdu_session_release_request->presence |= PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE;
}
break;
}
break;
case PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI:
if((decoded_result = decode_extended_protocol_configuration_options (&pdu_session_release_request->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI, buffer+decoded,len-decoded)) < 0)
return decoded_result;
else
{
decoded+=decoded_result;
pdu_session_release_request->presence |= PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE;
}
break;
}
}
return decoded;
}
......@@ -82,44 +52,19 @@ int encode_pdu_session_release_request( pdu_session_release_request_msg *pdu_ses
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, PDU_SESSION_RELEASE_REQUEST_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (pdu_session_release_request->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (pdu_session_release_request->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (pdu_session_release_request->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_message_type (pdu_session_release_request->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((pdu_session_release_request->presence & PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE) == PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE)
{
if((encoded_result = encode__5gsm_cause (pdu_session_release_request->_5gsmcause, PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if((pdu_session_release_request->presence & PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE) == PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE)
{
if((encoded_result = encode_extended_protocol_configuration_options (pdu_session_release_request->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
}
if ((pdu_session_release_request->presence & PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE) == PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE) {
if ((encoded_result = encode__5gsm_cause (pdu_session_release_request->_5gsmcause, PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI, buffer + encoded,len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((pdu_session_release_request->presence & PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE) == PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE) {
if ((encoded_result = encode_extended_protocol_configuration_options (pdu_session_release_request->extendedprotocolconfigurationoptions, PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
return encoded;
}
......@@ -37,13 +37,13 @@
#define PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_IEI 0x59
#define PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_REQUEST_E_P_C_O_IEI 0x7B
#define PDU_SESSION_RELEASE_REQUEST__5GSM_CAUSE_PRESENCE (1<<0)
#define PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE (1<<1)
#define PDU_SESSION_RELEASE_REQUEST_E_P_C_O_PRESENCE (1<<1)
typedef struct pdu_session_release_request_msg_tag{
typedef struct pdu_session_release_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
......@@ -51,7 +51,7 @@ typedef struct pdu_session_release_request_msg_tag{
uint8_t presence;
_5GSMCause _5gsmcause;
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions;
}pdu_session_release_request_msg;
} pdu_session_release_request_msg;
int decode_pdu_session_release_request(pdu_session_release_request_msg *pdusessionreleaserequest, uint8_t *buffer, uint32_t len);
......
......@@ -8,79 +8,33 @@
int decode__5gsm_status( _5gsm_status_msg *_5gsm_status, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
uint32_t decoded = 0;
int decoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, _5GSM_STATUS_MINIMUM_LENGTH, len);
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_DECODER (buffer, _5GSM_STATUS_MINIMUM_LENGTH, len);
#if 0
if((decoded_result = decode_extended_protocol_discriminator (&_5gsm_status->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode__5gsm_cause (&_5gsm_status->_5gsmcause, 0, buffer + decoded, len-decoded))<0)
return decoded_result;
else
decoded += decoded_result;
if((decoded_result = decode_pdu_session_identity (&_5gsm_status->pdusessionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_procedure_transaction_identity (&_5gsm_status->proceduretransactionidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&_5gsm_status->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
#endif
if((decoded_result = decode__5gsm_cause (&_5gsm_status->_5gsmcause, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
return decoded;
return decoded;
}
int encode__5gsm_status( _5gsm_status_msg *_5gsm_status, uint8_t* buffer, uint32_t len)
{
uint32_t encoded = 0;
int encoded_result = 0;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, _5GSM_STATUS_MINIMUM_LENGTH, len);
#if 0
if((encoded_result = encode_extended_protocol_discriminator (_5gsm_status->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_pdu_session_identity (_5gsm_status->pdusessionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_procedure_transaction_identity (_5gsm_status->proceduretransactionidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
uint32_t encoded = 0;
int encoded_result = 0;
if((encoded_result = encode_message_type (_5gsm_status->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
#endif
if((encoded_result = encode__5gsm_cause (_5gsm_status->_5gsmcause, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer, _5GSM_STATUS_MINIMUM_LENGTH, len);
if((encoded_result = encode__5gsm_cause (_5gsm_status->_5gsmcause, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
......@@ -36,13 +36,13 @@
0)
typedef struct _5gsm_status_msg_tag{
typedef struct _5gsm_status_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
PDUSessionIdentity pdusessionidentity;
ProcedureTransactionIdentity proceduretransactionidentity;
MessageType messagetype;
_5GSMCause _5gsmcause;
}_5gsm_status_msg;
} _5gsm_status_msg;
int decode__5gsm_status(_5gsm_status_msg *_5gsmstatus, uint8_t *buffer, uint32_t len);
......
This diff is collapsed.
......@@ -66,15 +66,15 @@ typedef union {
pdu_session_release_complete_msg pdu_session_release_complete;
_5gsm_status_msg _5gsm_status;
}SM_msg;
} SM_msg;
int sm_msg_decode (
SM_msg * msg,
uint8_t * buffer,
uint32_t len);
SM_msg * msg,
uint8_t * buffer,
uint32_t len);
int fivegsm_msg_encode (
SM_msg * msg,
uint8_t * buffer,
uint32_t len);
SM_msg * msg,
uint8_t * buffer,
uint32_t len);
#endif
......@@ -435,11 +435,11 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
{
Logger::smf_app().info("Handle a PDU Session Create SM Context Request from an AMF");
//handle PDU Session Create SM Context Request as specified in section 4.3.2 3GPP TS 23.502
oai::smf_server::model::SmContextCreateError smContextCreateError;
oai::smf_server::model::ProblemDetails problem_details;
oai::smf_server::model::SmContextCreateError smContextCreateError = {};
oai::smf_server::model::ProblemDetails problem_details = {};
std::string n1_sm_message, n1_sm_message_hex; //N1 SM container
smf_n1_n2 smf_n1_n2_inst;
nas_message_t decoded_nas_msg;
smf_n1_n2 smf_n1_n2_inst = {};
nas_message_t decoded_nas_msg = {};
//Step 1. Decode NAS and get the necessary information
std::string n1_sm_msg = smreq->req.get_n1_sm_message();
......@@ -561,7 +561,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
}
//Step 4. create a context for this supi if not existed, otherwise update
std::shared_ptr<smf_context> sc;
std::shared_ptr<smf_context> sc = {};
if (is_supi_2_smf_context(supi64)) {
Logger::smf_app().debug("Update SMF context with SUPI " SUPI_64_FMT "", supi64);
sc = supi_2_smf_context(supi64);
......@@ -574,7 +574,7 @@ void smf_app::handle_pdu_session_create_sm_context_request(std::shared_ptr<itti_
}
//Step 5. Create/update context with dnn information
std::shared_ptr<dnn_context> sd;
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(snssai, dnn, sd)) {
if (nullptr == sd.get()){
......@@ -642,14 +642,14 @@ void smf_app::handle_pdu_session_update_sm_context_request (std::shared_ptr<itti
{
//handle PDU Session Update SM Context Request as specified in section 4.3.2 3GPP TS 23.502
Logger::smf_app().info("Handle a PDU Session Update SM Context Request from an AMF");
oai::smf_server::model::SmContextUpdateError smContextUpdateError;
oai::smf_server::model::ProblemDetails problem_details;
oai::smf_server::model::SmContextUpdateError smContextUpdateError = {};
oai::smf_server::model::ProblemDetails problem_details = {};
std::string n1_sm_message, n1_sm_message_hex; //N1 SM container
smf_n1_n2 smf_n1_n2_inst; //to encode Ngap IE
smf_n1_n2 smf_n1_n2_inst = {}; //to encode Ngap IE
//Step 1. get supi, dnn, nssai, pdu_session id from sm_context
//SM Context ID - uint32_t in our case
scid_t scid;
scid_t scid = {};
try {
scid = std::stoi(smreq->scid);
}
......@@ -671,7 +671,7 @@ void smf_app::handle_pdu_session_update_sm_context_request (std::shared_ptr<itti
return;
}
std::shared_ptr<smf_context_ref> scf;
std::shared_ptr<smf_context_ref> scf = {};
if (is_scid_2_smf_context(scid)) {
scf = scid_2_smf_context(scid);
......@@ -695,7 +695,7 @@ void smf_app::handle_pdu_session_update_sm_context_request (std::shared_ptr<itti
pdu_session_update_sm_context_request context_req_msg = smreq->req;
//Step 2. find the smf context
std::shared_ptr<smf_context> sc;
std::shared_ptr<smf_context> sc = {};
if (is_supi_2_smf_context(supi64)) {
sc = supi_2_smf_context(supi64);
......@@ -713,7 +713,7 @@ void smf_app::handle_pdu_session_update_sm_context_request (std::shared_ptr<itti
}
//get dnn context
std::shared_ptr<dnn_context> sd;
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(scf.get()->nssai, dnn, sd)) {
if (nullptr == sd.get()){
......@@ -743,15 +743,15 @@ void smf_app::handle_network_requested_pdu_session_modification()
{
std::shared_ptr<itti_nx_modify_pdu_session_request_network_requested> itti_msg = std::make_shared<itti_nx_modify_pdu_session_request_network_requested>(TASK_SMF_N11, TASK_SMF_APP);
supi_t supi;
supi_t supi = {};
std::string dnn;
pdu_session_id_t pdu_session_id ;
snssai_t nssai ;
pdu_session_id_t pdu_session_id = {0};
snssai_t nssai = {};
supi64_t supi64 = smf_supi_to_u64(supi);
//Step 2. find the smf context
std::shared_ptr<smf_context> sc;
std::shared_ptr<smf_context> sc = {};
if (is_supi_2_smf_context(supi64)) {
sc = supi_2_smf_context(supi64);
......@@ -761,7 +761,7 @@ void smf_app::handle_network_requested_pdu_session_modification()
}
//get dnn context
std::shared_ptr<dnn_context> sd;
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(nssai, dnn, sd)) {
if (nullptr == sd.get()){
......@@ -843,90 +843,44 @@ void smf_app::convert_string_2_hex(std::string& input_str, std::string& output_s
Logger::smf_app().debug("Convert string to Hex");
unsigned char *data = (unsigned char *) malloc (input_str.length() + 1);
memset(data, 0, input_str.length() + 1);
memset(data, 0, input_str.length() + 1);
memcpy ((void *)data, (void *)input_str.c_str(), input_str.length());
Logger::smf_app().debug("Input string:");
Logger::smf_app().debug("Input: ");
for(int i = 0; i < input_str.length(); i++) {
printf("%02x ", data[i]);
}
printf("\n");
char *datahex = (char *) malloc (input_str.length() * 2 + 1);
memset(datahex, 0, input_str.length() *2 + 1);
memset(datahex, 0, input_str.length() *2 + 1);
for(int i = 0; i < input_str.length(); i++)
sprintf(datahex + i*2, "%02x", data[i]);
output_str = reinterpret_cast<char*> (datahex);
Logger::smf_app().debug("Output str: \n %s ", output_str.c_str());
Logger::smf_app().debug("Output: \n %s ", output_str.c_str());
}
//---------------------------------------------------------------------------------------------
unsigned char * smf_app::format_string_as_hex(std::string str){
unsigned int str_len = str.length();
unsigned char * datavalue = (unsigned char *)malloc(str_len/2 + 1);
unsigned char *data = (unsigned char *)malloc(str_len + 1);
memset(data,0,str_len + 1);
unsigned int str_len = str.length();
char *data = (char *)malloc(str_len + 1);
memset(data, 0, str_len + 1);
memcpy ((void *)data, (void *)str.c_str(), str_len);
memcpy ((void *)data, (void *)str.c_str(),str_len);
unsigned char *data_hex = (uint8_t *)malloc(str_len/2 + 1);
conv::ascii_to_hex (data_hex, (const char *) data);
std::cout << "[Format string as Hex] Input string (" << str_len <<" bytes): \n" << str.c_str() <<std::endl;
/* for(int i = 0;i < str_len; i++)
{
printf("%02x ", data[i]);
}
*/
std::cout <<"Data (formatted): \n";
for(int i=0; i < str_len; i++)
{
//printf("%02x ", data[i]);
char datatmp[3] = {0};
memcpy(datatmp,&data[i],2);
// Ensure both characters are hexadecimal
bool bBothDigits = true;
for(int j = 0; j < 2; ++j)
{
if(!isxdigit(datatmp[j]))
bBothDigits = false;
}
//if(!bBothDigits)
// break;
// Convert two hexadecimal characters into one character
unsigned int nAsciiCharacter;
sscanf(datatmp, "%x", &nAsciiCharacter);
printf("%x ",nAsciiCharacter);
// Concatenate this character onto the output
datavalue[i/2] = (unsigned char)nAsciiCharacter;
// Skip the next character
i++;
}
printf("\n");
Logger::smf_app().debug("[Format string as Hex] Input string (%d bytes): %s ", str_len, str.c_str());
Logger::smf_app().debug("Data (formatted):");
free(data);
data = nullptr;
for(int i = 0; i < str_len/2; i++)
printf(" %02x ",data_hex[i]);
printf("\n");
return datavalue;
}
return data_hex;
//---------------------------------------------------------------------------------------------
void smf_app::print_string_as_hex(std::string str){
Logger::smf_app().debug("print_string_as_hex, input %s", str.c_str());
unsigned int str_len = str.length();
unsigned char *data = (unsigned char *)malloc(str_len + 1);
memset(data,0,str_len + 1);
memcpy ((void *)data, (void *)str.c_str(),str_len);
printf ("\nData as Hex: ");
for(int i=0;i<str_len;i++)
{
printf("%02x ",data[i]);
}
printf (" (%d bytes) \n", str_len);
free(data);
data = nullptr;
}
//---------------------------------------------------------------------------------------------
......@@ -935,7 +889,7 @@ void smf_app::update_pdu_session_status(const scid_t scid, const pdu_session_sta
Logger::smf_app().info("Update PDU Session Status");
//get the smf context
std::shared_ptr<smf_context_ref> scf;
std::shared_ptr<smf_context_ref> scf = {};
if (is_scid_2_smf_context(scid)) {
scf = scid_2_smf_context(scid);
......@@ -947,7 +901,7 @@ void smf_app::update_pdu_session_status(const scid_t scid, const pdu_session_sta
supi64_t supi64 = smf_supi_to_u64(supi);
pdu_session_id_t pdu_session_id = scf.get()->pdu_session_id;
std::shared_ptr<smf_context> sc;
std::shared_ptr<smf_context> sc = {};
if (is_supi_2_smf_context(supi64)) {
sc = supi_2_smf_context(supi64);
......@@ -958,7 +912,7 @@ void smf_app::update_pdu_session_status(const scid_t scid, const pdu_session_sta
}
//get dnn context
std::shared_ptr<dnn_context> sd;
std::shared_ptr<dnn_context> sd = {};
if (!sc.get()->find_dnn_context(scf.get()->nssai, scf.get()->dnn, sd)) {
if (nullptr == sd.get()){
......@@ -967,7 +921,7 @@ void smf_app::update_pdu_session_status(const scid_t scid, const pdu_session_sta
}
}
//get smd_pdu_session
std::shared_ptr<smf_pdu_session> sp;
std::shared_ptr<smf_pdu_session> sp = {};
bool find_pdn = sd.get()->find_pdu_session(pdu_session_id, sp);
if (nullptr == sp.get()){
......
......@@ -253,8 +253,6 @@ public:
unsigned char * format_string_as_hex(std::string str);
void print_string_as_hex(std::string str);
void start_upf_association(const pfcp::node_id_t& node_id);
/*
......
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