Refactor NAS Key Set Identifier enc/dec functions
* simplified the code while keeping same functionality * reduced the number of functions (from 4 to 2) * clang-formatted
This commit is contained in:
@@ -47,7 +47,7 @@ int decode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, u
|
|||||||
LOG_FUNC_RETURN(decoded_result);
|
LOG_FUNC_RETURN(decoded_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(&attach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) {
|
if ((decoded_result = decode_nas_key_set_identifier(&attach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4)) < 0) {
|
||||||
// return decoded_result;
|
// return decoded_result;
|
||||||
LOG_FUNC_RETURN(decoded_result);
|
LOG_FUNC_RETURN(decoded_result);
|
||||||
}
|
}
|
||||||
@@ -299,7 +299,8 @@ int encode_attach_request(attach_request_msg *attach_request, uint8_t *buffer, u
|
|||||||
/* Checking IEI and pointer */
|
/* Checking IEI and pointer */
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_REQUEST_MINIMUM_LENGTH, len);
|
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ATTACH_REQUEST_MINIMUM_LENGTH, len);
|
||||||
|
|
||||||
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&attach_request->naskeysetidentifier) & 0x0f) << 4) | (encode_u8_eps_attach_type(&attach_request->epsattachtype) & 0x0f);
|
*(buffer + encoded) = ((encode_nas_key_set_identifier(&attach_request->naskeysetidentifier, 0) & 0x0f) << 4)
|
||||||
|
| (encode_u8_eps_attach_type(&attach_request->epsattachtype) & 0x0f);
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result =
|
if ((encode_result =
|
||||||
|
|||||||
@@ -38,7 +38,8 @@ int decode_authentication_request(authentication_request_msg *authentication_req
|
|||||||
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
|
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
|
||||||
|
|
||||||
/* Decoding mandatory fields */
|
/* Decoding mandatory fields */
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded), len - decoded)) < 0)
|
if ((decoded_result = decode_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0, *(buffer + decoded)))
|
||||||
|
< 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
decoded++;
|
decoded++;
|
||||||
@@ -64,7 +65,7 @@ int encode_authentication_request(authentication_request_msg *authentication_req
|
|||||||
/* Checking IEI and pointer */
|
/* Checking IEI and pointer */
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
|
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
|
||||||
|
|
||||||
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme) & 0x0f) << 4) | 0x00;
|
*(buffer + encoded) = ((encode_nas_key_set_identifier(&authentication_request->naskeysetidentifierasme, 0) & 0x0f) << 4) | 0x00;
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result =
|
if ((encode_result =
|
||||||
|
|||||||
@@ -41,7 +41,7 @@ int decode_detach_request(detach_request_msg *detach_request, uint8_t *buffer, u
|
|||||||
if ((decoded_result = decode_u8_detach_type(&detach_request->detachtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
|
if ((decoded_result = decode_u8_detach_type(&detach_request->detachtype, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(&detach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
|
if ((decoded_result = decode_nas_key_set_identifier(&detach_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4)) < 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
decoded++;
|
decoded++;
|
||||||
@@ -62,7 +62,8 @@ int encode_detach_request(detach_request_msg *detach_request, uint8_t *buffer, u
|
|||||||
/* Checking IEI and pointer */
|
/* Checking IEI and pointer */
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_REQUEST_MINIMUM_LENGTH, len);
|
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DETACH_REQUEST_MINIMUM_LENGTH, len);
|
||||||
|
|
||||||
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&detach_request->naskeysetidentifier) << 4) | (encode_u8_detach_type(&detach_request->detachtype) & 0x0f));
|
*(buffer + encoded) = ((encode_nas_key_set_identifier(&detach_request->naskeysetidentifier, 0) << 4)
|
||||||
|
| (encode_u8_detach_type(&detach_request->detachtype) & 0x0f));
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result = encode_eps_mobile_identity(&detach_request->gutiorimsi,
|
if ((encode_result = encode_eps_mobile_identity(&detach_request->gutiorimsi,
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ int decode_extended_service_request(extended_service_request_msg *extended_servi
|
|||||||
if ((decoded_result = decode_u8_service_type(&extended_service_request->servicetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
|
if ((decoded_result = decode_u8_service_type(&extended_service_request->servicetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(&extended_service_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
|
if ((decoded_result =
|
||||||
|
decode_nas_key_set_identifier(&extended_service_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f))
|
||||||
|
< 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
decoded++;
|
decoded++;
|
||||||
@@ -62,7 +64,8 @@ int encode_extended_service_request(extended_service_request_msg *extended_servi
|
|||||||
/* Checking IEI and pointer */
|
/* Checking IEI and pointer */
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH, len);
|
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EXTENDED_SERVICE_REQUEST_MINIMUM_LENGTH, len);
|
||||||
|
|
||||||
*(buffer + encoded) = ((encode_u8_service_type(&extended_service_request->servicetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier(&extended_service_request->naskeysetidentifier) & 0x0f);
|
*(buffer + encoded) = ((encode_u8_service_type(&extended_service_request->servicetype) & 0x0f) << 4)
|
||||||
|
| (encode_nas_key_set_identifier(&extended_service_request->naskeysetidentifier, 0) & 0x0f);
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result =
|
if ((encode_result =
|
||||||
|
|||||||
@@ -33,6 +33,7 @@
|
|||||||
#include <stdint.h>
|
#include <stdint.h>
|
||||||
|
|
||||||
#include "FGSDeregistrationRequestUEOriginating.h"
|
#include "FGSDeregistrationRequestUEOriginating.h"
|
||||||
|
#include "NR_NAS_defs.h"
|
||||||
|
|
||||||
int encode_fgs_deregistration_request_ue_originating(fgs_deregistration_request_ue_originating_msg *drr,
|
int encode_fgs_deregistration_request_ue_originating(fgs_deregistration_request_ue_originating_msg *drr,
|
||||||
uint8_t *buffer,
|
uint8_t *buffer,
|
||||||
@@ -45,7 +46,7 @@ int encode_fgs_deregistration_request_ue_originating(fgs_deregistration_request_
|
|||||||
| ((dt->access_type & 0x3) << 4);
|
| ((dt->access_type & 0x3) << 4);
|
||||||
|
|
||||||
int encode_result;
|
int encode_result;
|
||||||
if ((encode_result = encode_nas_key_set_identifier(&drr->naskeysetidentifier, 0, buffer + encoded, len - encoded)) < 0)
|
if ((encode_result = encode_nas_key_set_identifier(&drr->naskeysetidentifier, IEI_NULL)) < 0)
|
||||||
return encode_result;
|
return encode_result;
|
||||||
|
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|||||||
@@ -35,6 +35,7 @@
|
|||||||
#include "nas_log.h"
|
#include "nas_log.h"
|
||||||
|
|
||||||
#include "RegistrationRequest.h"
|
#include "RegistrationRequest.h"
|
||||||
|
#include "NR_NAS_defs.h"
|
||||||
|
|
||||||
int decode_registration_request(registration_request_msg *registration_request, uint8_t *buffer, uint32_t len)
|
int decode_registration_request(registration_request_msg *registration_request, uint8_t *buffer, uint32_t len)
|
||||||
{
|
{
|
||||||
@@ -51,7 +52,8 @@ int decode_registration_request(registration_request_msg *registration_request,
|
|||||||
LOG_FUNC_RETURN(decoded_result);
|
LOG_FUNC_RETURN(decoded_result);
|
||||||
}
|
}
|
||||||
|
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(®istration_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0) {
|
if ((decoded_result = decode_nas_key_set_identifier(®istration_request->naskeysetidentifier, IEI_NULL, *(buffer + decoded) >> 4))
|
||||||
|
< 0) {
|
||||||
// return decoded_result;
|
// return decoded_result;
|
||||||
LOG_FUNC_RETURN(decoded_result);
|
LOG_FUNC_RETURN(decoded_result);
|
||||||
}
|
}
|
||||||
@@ -75,7 +77,8 @@ int encode_registration_request(registration_request_msg *registration_request,
|
|||||||
int encoded = 0;
|
int encoded = 0;
|
||||||
int encode_result = 0;
|
int encode_result = 0;
|
||||||
|
|
||||||
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(®istration_request->naskeysetidentifier) & 0x0f) << 4) | (encode_5gs_registration_type(®istration_request->fgsregistrationtype) & 0x0f);
|
*(buffer + encoded) = ((encode_nas_key_set_identifier(®istration_request->naskeysetidentifier, IEI_NULL) & 0x0f) << 4)
|
||||||
|
| (encode_5gs_registration_type(®istration_request->fgsregistrationtype) & 0x0f);
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result =
|
if ((encode_result =
|
||||||
|
|||||||
@@ -43,7 +43,8 @@ int decode_security_mode_command(security_mode_command_msg *security_mode_comman
|
|||||||
else
|
else
|
||||||
decoded += decoded_result;
|
decoded += decoded_result;
|
||||||
|
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(&security_mode_command->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
|
if ((decoded_result = decode_nas_key_set_identifier(&security_mode_command->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f))
|
||||||
|
< 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
decoded++;
|
decoded++;
|
||||||
@@ -124,7 +125,7 @@ int encode_security_mode_command(security_mode_command_msg *security_mode_comman
|
|||||||
else
|
else
|
||||||
encoded += encode_result;
|
encoded += encode_result;
|
||||||
|
|
||||||
*(buffer + encoded) = (encode_u8_nas_key_set_identifier(&security_mode_command->naskeysetidentifier) & 0x0f);
|
*(buffer + encoded) = (encode_nas_key_set_identifier(&security_mode_command->naskeysetidentifier, 0) & 0x0f);
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result =
|
if ((encode_result =
|
||||||
|
|||||||
@@ -41,7 +41,9 @@ int decode_tracking_area_update_request(tracking_area_update_request_msg *tracki
|
|||||||
if ((decoded_result = decode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
|
if ((decoded_result = decode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
if ((decoded_result = decode_u8_nas_key_set_identifier(&tracking_area_update_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f, len - decoded)) < 0)
|
if ((decoded_result =
|
||||||
|
decode_nas_key_set_identifier(&tracking_area_update_request->naskeysetidentifier, 0, *(buffer + decoded) & 0x0f))
|
||||||
|
< 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
decoded++;
|
decoded++;
|
||||||
@@ -61,10 +63,10 @@ int decode_tracking_area_update_request(tracking_area_update_request_msg *tracki
|
|||||||
|
|
||||||
switch(ieiDecoded) {
|
switch(ieiDecoded) {
|
||||||
case TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI:
|
case TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI:
|
||||||
if ((decoded_result =
|
if ((decoded_result = decode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier,
|
||||||
decode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier,
|
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI,
|
||||||
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI,
|
*(buffer + decoded)))
|
||||||
buffer + decoded, len - decoded)) <= 0)
|
<= 0)
|
||||||
return decoded_result;
|
return decoded_result;
|
||||||
|
|
||||||
decoded += decoded_result;
|
decoded += decoded_result;
|
||||||
@@ -293,8 +295,8 @@ int encode_tracking_area_update_request(tracking_area_update_request_msg *tracki
|
|||||||
/* Checking IEI and pointer */
|
/* Checking IEI and pointer */
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH, len);
|
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, TRACKING_AREA_UPDATE_REQUEST_MINIMUM_LENGTH, len);
|
||||||
|
|
||||||
*(buffer + encoded) = ((encode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype) & 0x0f) << 4) | (encode_u8_nas_key_set_identifier(
|
*(buffer + encoded) = ((encode_u8_eps_update_type(&tracking_area_update_request->epsupdatetype) & 0x0f) << 4)
|
||||||
&tracking_area_update_request->naskeysetidentifier) & 0x0f);
|
| (encode_nas_key_set_identifier(&tracking_area_update_request->naskeysetidentifier, 0) & 0x0f);
|
||||||
encoded++;
|
encoded++;
|
||||||
|
|
||||||
if ((encode_result =
|
if ((encode_result =
|
||||||
@@ -306,10 +308,9 @@ int encode_tracking_area_update_request(tracking_area_update_request_msg *tracki
|
|||||||
|
|
||||||
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT)
|
if ((tracking_area_update_request->presencemask & TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT)
|
||||||
== TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT) {
|
== TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_PRESENT) {
|
||||||
if ((encode_result =
|
if ((encode_result = encode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier,
|
||||||
encode_nas_key_set_identifier(&tracking_area_update_request->noncurrentnativenaskeysetidentifier,
|
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI))
|
||||||
TRACKING_AREA_UPDATE_REQUEST_NONCURRENT_NATIVE_NAS_KEY_SET_IDENTIFIER_IEI,
|
< 0)
|
||||||
buffer + encoded, len - encoded)) < 0)
|
|
||||||
// Return in case of error
|
// Return in case of error
|
||||||
return encode_result;
|
return encode_result;
|
||||||
else
|
else
|
||||||
|
|||||||
@@ -28,67 +28,34 @@
|
|||||||
#include "TLVDecoder.h"
|
#include "TLVDecoder.h"
|
||||||
#include "NasKeySetIdentifier.h"
|
#include "NasKeySetIdentifier.h"
|
||||||
|
|
||||||
int decode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len)
|
/**
|
||||||
|
* @brief Decode the NAS key set identifier from one byte
|
||||||
|
*/
|
||||||
|
int decode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value)
|
||||||
{
|
{
|
||||||
int decoded = 0;
|
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len);
|
|
||||||
|
|
||||||
if (iei > 0) {
|
if (iei > 0) {
|
||||||
CHECK_IEI_DECODER((*buffer & 0xf0), iei);
|
CHECK_IEI_DECODER((value & 0xf0), iei);
|
||||||
}
|
}
|
||||||
|
|
||||||
naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1;
|
naskeysetidentifier->tsc = (value >> 3) & 0x1;
|
||||||
naskeysetidentifier->naskeysetidentifier = *(buffer + decoded) & 0x7;
|
naskeysetidentifier->naskeysetidentifier = value & 0x7;
|
||||||
decoded++;
|
|
||||||
|
#if defined(NAS_DEBUG)
|
||||||
|
dump_nas_key_set_identifier_xml(naskeysetidentifier, iei);
|
||||||
|
#endif
|
||||||
|
|
||||||
|
return 1; // 1 octet
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @brief Encode the NAS key set identifier in one byte
|
||||||
|
*/
|
||||||
|
uint8_t encode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei)
|
||||||
|
{
|
||||||
#if defined (NAS_DEBUG)
|
#if defined (NAS_DEBUG)
|
||||||
dump_nas_key_set_identifier_xml(naskeysetidentifier, iei);
|
dump_nas_key_set_identifier_xml(naskeysetidentifier, iei);
|
||||||
#endif
|
#endif
|
||||||
return decoded;
|
return ((iei & 0xf0) | (naskeysetidentifier->tsc & 0x1) << 3) | (naskeysetidentifier->naskeysetidentifier & 0x7);
|
||||||
}
|
|
||||||
|
|
||||||
int decode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value, uint32_t len)
|
|
||||||
{
|
|
||||||
int decoded = 0;
|
|
||||||
uint8_t *buffer = &value;
|
|
||||||
naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1;
|
|
||||||
naskeysetidentifier->naskeysetidentifier = *(buffer + decoded) & 0x7;
|
|
||||||
decoded++;
|
|
||||||
#if defined (NAS_DEBUG)
|
|
||||||
dump_nas_key_set_identifier_xml(naskeysetidentifier, iei);
|
|
||||||
#endif
|
|
||||||
return decoded;
|
|
||||||
}
|
|
||||||
|
|
||||||
int encode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len)
|
|
||||||
{
|
|
||||||
uint8_t encoded = 0;
|
|
||||||
/* Checking length and pointer */
|
|
||||||
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len);
|
|
||||||
#if defined (NAS_DEBUG)
|
|
||||||
dump_nas_key_set_identifier_xml(naskeysetidentifier, iei);
|
|
||||||
#endif
|
|
||||||
*(buffer + encoded) = 0x00 | (iei & 0xf0) |
|
|
||||||
((naskeysetidentifier->tsc & 0x1) << 3) |
|
|
||||||
(naskeysetidentifier->naskeysetidentifier & 0x7);
|
|
||||||
encoded++;
|
|
||||||
return encoded;
|
|
||||||
}
|
|
||||||
|
|
||||||
uint8_t encode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier)
|
|
||||||
{
|
|
||||||
uint8_t bufferReturn;
|
|
||||||
uint8_t *buffer = &bufferReturn;
|
|
||||||
uint8_t encoded = 0;
|
|
||||||
uint8_t iei = 0;
|
|
||||||
#if defined (NAS_DEBUG)
|
|
||||||
dump_nas_key_set_identifier_xml(naskeysetidentifier, 0);
|
|
||||||
#endif
|
|
||||||
*(buffer + encoded) = 0x00 | (iei & 0xf0) |
|
|
||||||
((naskeysetidentifier->tsc & 0x1) << 3) |
|
|
||||||
(naskeysetidentifier->naskeysetidentifier & 0x7);
|
|
||||||
encoded++;
|
|
||||||
|
|
||||||
return bufferReturn;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void dump_nas_key_set_identifier_xml(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei)
|
void dump_nas_key_set_identifier_xml(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei)
|
||||||
|
|||||||
@@ -39,15 +39,11 @@ typedef struct NasKeySetIdentifier_tag {
|
|||||||
uint8_t naskeysetidentifier:3;
|
uint8_t naskeysetidentifier:3;
|
||||||
} NasKeySetIdentifier;
|
} NasKeySetIdentifier;
|
||||||
|
|
||||||
int encode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len);
|
uint8_t encode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei);
|
||||||
|
|
||||||
void dump_nas_key_set_identifier_xml(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei);
|
void dump_nas_key_set_identifier_xml(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei);
|
||||||
|
|
||||||
uint8_t encode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier);
|
int decode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value);
|
||||||
|
|
||||||
int decode_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len);
|
|
||||||
|
|
||||||
int decode_u8_nas_key_set_identifier(NasKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value, uint32_t len);
|
|
||||||
|
|
||||||
#endif /* NAS KEY SET IDENTIFIER_H_ */
|
#endif /* NAS KEY SET IDENTIFIER_H_ */
|
||||||
|
|
||||||
|
|||||||
@@ -256,6 +256,7 @@ typedef enum {
|
|||||||
} cause_secu_id_t;
|
} cause_secu_id_t;
|
||||||
|
|
||||||
// IEI (information element identifier) are spread in each message definition
|
// IEI (information element identifier) are spread in each message definition
|
||||||
|
#define IEI_NULL 0x00
|
||||||
#define IEI_RAND 0x21
|
#define IEI_RAND 0x21
|
||||||
#define IEI_AUTN 0x20
|
#define IEI_AUTN 0x20
|
||||||
#define IEI_EAP 0x78
|
#define IEI_EAP 0x78
|
||||||
|
|||||||
Reference in New Issue
Block a user