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

Code cleanup NAS

parent 885a66eb
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -34,19 +34,20 @@ typedef enum {
} fivegmm_sc_type_t;
typedef struct fivegmm_security_context_s {
fivegmm_sc_type_t sc_type; /* Type of security context */ //33401
/* state of security context is implicit due to its storage location (current/non-current)*/
fivegmm_sc_type_t sc_type; /* Type of security context */ // 33401
/* state of security context is implicit due to its storage location
* (current/non-current)*/
#define EKSI_MAX_VALUE 6
ksi_t ksi; /* NAS key set identifier for E-UTRAN */
#define FIVEGMM_SECURITY_VECTOR_INDEX_INVALID (-1)
int vector_index; /* Pointer on vector */
uint8_t knas_enc[AUTH_KNAS_ENC_SIZE];/* NAS cyphering key */
uint8_t knas_int[AUTH_KNAS_INT_SIZE];/* NAS integrity key */
uint8_t knas_enc[AUTH_KNAS_ENC_SIZE]; /* NAS cyphering key */
uint8_t knas_int[AUTH_KNAS_INT_SIZE]; /* NAS integrity key */
struct count_s {
uint32_t spare :8;
uint32_t overflow :16;
uint32_t seq_num :8;
uint32_t spare : 8;
uint32_t overflow : 16;
uint32_t seq_num : 8;
} dl_count, ul_count; /* Downlink and uplink count parameters */
struct {
uint8_t fivegs_encryption; /* algorithm used for ciphering */
......@@ -54,12 +55,12 @@ typedef struct fivegmm_security_context_s {
uint8_t umts_encryption; /* algorithm used for ciphering */
uint8_t umts_integrity; /* algorithm used for integrity protection */
uint8_t gprs_encryption; /* algorithm used for ciphering */
bool umts_present :1;
bool gprs_present :1;
bool umts_present : 1;
bool gprs_present : 1;
} capability; /* UE network capability */
struct {
uint8_t encryption :4; /* algorithm used for ciphering */
uint8_t integrity :4; /* algorithm used for integrity protection */
uint8_t encryption : 4; /* algorithm used for ciphering */
uint8_t integrity : 4; /* algorithm used for integrity protection */
} selected_algorithms; /* AMF selected algorithms */
uint8_t activated;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,14 +27,20 @@
#include "TLVDecoder.h"
#include "AuthenticationFailure.h"
int decode_authentication_failure(authentication_failure_msg *authentication_failure, uint8_t *buffer, uint32_t len) {
int decode_authentication_failure(
authentication_failure_msg* authentication_failure, uint8_t* buffer,
uint32_t len) {
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, AUTHENTICATION_FAILURE_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, AUTHENTICATION_FAILURE_MINIMUM_LENGTH, len);
if ((decoded_result = decode__5gmm_cause(&authentication_failure->_5gmmcause, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode__5gmm_cause(
&authentication_failure->_5gmmcause, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -44,16 +50,19 @@ int decode_authentication_failure(authentication_failure_msg *authentication_fai
*/
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if (ieiDecoded == 0)
break;
if (ieiDecoded == 0) break;
switch (ieiDecoded) {
case AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI:
if ((decoded_result = decode_authentication_failure_parameter(&authentication_failure->authenticationfailureparameter, AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI, buffer + decoded, len - decoded)) <= 0)
if ((decoded_result = decode_authentication_failure_parameter(
&authentication_failure->authenticationfailureparameter,
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI,
buffer + decoded, len - decoded)) <= 0)
return decoded_result;
else {
decoded += decoded_result;
authentication_failure->presence |= AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT;
authentication_failure->presence |=
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT;
}
break;
}
......@@ -62,20 +71,31 @@ int decode_authentication_failure(authentication_failure_msg *authentication_fai
return decoded;
}
int encode_authentication_failure(authentication_failure_msg *authentication_failure, uint8_t *buffer, uint32_t len) {
int encode_authentication_failure(
authentication_failure_msg* authentication_failure, 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, AUTHENTICATION_FAILURE_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_ENCODER(
buffer, AUTHENTICATION_FAILURE_MINIMUM_LENGTH, len);
if ((encoded_result = encode__5gmm_cause(authentication_failure->_5gmmcause, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode__5gmm_cause(
authentication_failure->_5gmmcause, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((authentication_failure->presence & AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) == AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) {
if ((encoded_result = encode_authentication_failure_parameter(authentication_failure->authenticationfailureparameter, AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_failure->presence &
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) ==
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT) {
if ((encoded_result = encode_authentication_failure_parameter(
authentication_failure->authenticationfailureparameter,
AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,24 +31,20 @@
#include "AuthenticationFailureParameter.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_FAILURE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
#define AUTHENTICATION_FAILURE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GMM_CAUSE_MINIMUM_LENGTH + \
AUTHENTICATION_FAILURE_PARAMETER_MINIMUM_LENGTH + \
0)
AUTHENTICATION_FAILURE_PARAMETER_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_FAILURE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define AUTHENTICATION_FAILURE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GMM_CAUSE_MAXIMUM_LENGTH + \
AUTHENTICATION_FAILURE_PARAMETER_MAXIMUM_LENGTH + \
0)
AUTHENTICATION_FAILURE_PARAMETER_MAXIMUM_LENGTH + 0)
#define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1<<0)
#define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1 << 0)
#define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI 0x21
typedef struct authentication_failure_msg_tag {
......@@ -60,7 +56,11 @@ typedef struct authentication_failure_msg_tag {
AuthenticationFailureParameter authenticationfailureparameter;
} authentication_failure_msg;
int decode_authentication_failure(authentication_failure_msg *authenticationfailure, uint8_t *buffer, uint32_t len);
int encode_authentication_failure(authentication_failure_msg *authenticationfailure, uint8_t *buffer, uint32_t len);
int decode_authentication_failure(
authentication_failure_msg* authenticationfailure, uint8_t* buffer,
uint32_t len);
int encode_authentication_failure(
authentication_failure_msg* authenticationfailure, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,40 +27,57 @@
#include "TLVDecoder.h"
#include "AuthenticationReject.h"
int decode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len) {
int decode_authentication_reject(
authentication_reject_msg* authentication_reject, uint8_t* buffer,
uint32_t len) {
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, AUTHENTICATION_REJECT_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, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len);
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if (ieiDecoded == 0)
break;
if (ieiDecoded == 0) break;
switch (ieiDecoded) {
case AUTHENTICATION_REJECT_EAP_MESSAGE_IEI:
//if((decoded_result = decode_message_type (&authentication_reject->messagetype, AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer+decoded,len-decoded))<0)
if ((decoded_result = decode_eap_message(&authentication_reject->eapmessage, AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer + decoded, len - decoded)) < 0) {
// if((decoded_result = decode_message_type
// (&authentication_reject->messagetype,
// AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer+decoded,len-decoded))<0)
if ((decoded_result = decode_eap_message(
&authentication_reject->eapmessage,
AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer + decoded,
len - decoded)) < 0) {
return decoded_result;
} else {
decoded += decoded_result;
authentication_reject->presence |= AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT;
authentication_reject->presence |=
AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT;
}
}
}
return decoded;
}
int encode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len) {
int encode_authentication_reject(
authentication_reject_msg* authentication_reject, 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, AUTHENTICATION_REJECT_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_ENCODER(
buffer, AUTHENTICATION_REJECT_MINIMUM_LENGTH, len);
if ((authentication_reject->presence & AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT) == AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(authentication_reject->eapmessage, AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_reject->presence &
AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT) ==
AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(
authentication_reject->eapmessage,
AUTHENTICATION_REJECT_EAP_MESSAGE_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,23 +30,19 @@
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_REJECT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + \
0)
#define AUTHENTICATION_REJECT_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_REJECT_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH +\
0)
#define AUTHENTICATION_REJECT_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH + 0)
#define AUTHENTICATION_REJECT_EAP_MESSAGE_IEI 0x78
#define AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT (1<<0)
#define AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT (1 << 0)
typedef struct authentication_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -56,7 +52,11 @@ typedef struct authentication_reject_msg_tag {
EAPMessage eapmessage;
} authentication_reject_msg;
int decode_authentication_reject(authentication_reject_msg *authenticationreject, uint8_t *buffer, uint32_t len);
int encode_authentication_reject(authentication_reject_msg *authenticationreject, uint8_t *buffer, uint32_t len);
int decode_authentication_reject(
authentication_reject_msg* authenticationreject, uint8_t* buffer,
uint32_t len);
int encode_authentication_reject(
authentication_reject_msg* authenticationreject, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -28,54 +28,72 @@
#include "AuthenticationRequest.h"
#include "3gpp_24.501.h"
int decode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len) {
int decode_authentication_request(
authentication_request_msg* authentication_request, uint8_t* buffer,
uint32_t len) {
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, AUTHENTICATION_REQUEST_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, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
/*
* Decoding mandatory fields
*/
if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
if ((decoded_result = decode_u8_nas_key_set_identifier(
&authentication_request->naskeysetidentifier, 0,
*(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_abba(&authentication_request->abba, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_abba(
&authentication_request->abba, 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;
if (ieiDecoded == 0) break;
switch (ieiDecoded) {
case AUTHENTICATION_PARAMETER_RAND_IEI:
if ((decoded_result = decode_authentication_parameter_rand(&authentication_request->authenticationparameterrand, AUTHENTICATION_PARAMETER_RAND_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_authentication_parameter_rand(
&authentication_request->authenticationparameterrand,
AUTHENTICATION_PARAMETER_RAND_IEI, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
authentication_request->presence |= AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT;
authentication_request->presence |=
AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT;
}
break;
case AUTHENTICATION_PARAMETER_AUTN_IEI:
if ((decoded_result = decode_authentication_parameter_autn(&authentication_request->authenticationparameterautn, AUTHENTICATION_PARAMETER_AUTN_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_authentication_parameter_autn(
&authentication_request->authenticationparameterautn,
AUTHENTICATION_PARAMETER_AUTN_IEI, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
authentication_request->presence |= AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT;
authentication_request->presence |=
AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT;
}
break;
case EAP_MESSAGE_IEI:
if ((decoded_result = decode_eap_message(&authentication_request->eapmessage, EAP_MESSAGE_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_eap_message(
&authentication_request->eapmessage, EAP_MESSAGE_IEI,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
authentication_request->presence |= AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT;
authentication_request->presence |=
AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT;
}
break;
}
......@@ -84,35 +102,59 @@ int decode_authentication_request(authentication_request_msg *authentication_req
return decoded;
}
int encode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len) {
int encode_authentication_request(
authentication_request_msg* authentication_request, 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, AUTHENTICATION_REQUEST_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_ENCODER(
buffer, AUTHENTICATION_REQUEST_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&authentication_request->naskeysetidentifier) & 0x0f) << 4) | 0x00;
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(
&authentication_request->naskeysetidentifier) &
0x0f)
<< 4) |
0x00;
encoded++;
if ((encoded_result = encode_abba(authentication_request->abba, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_abba(
authentication_request->abba, 0, buffer + encoded, len - encoded)) <
0)
return encoded_result;
else
encoded += encoded_result;
if ((authentication_request->presence & AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT) == AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT) {
if ((encoded_result = encode_authentication_parameter_rand(authentication_request->authenticationparameterrand, AUTHENTICATION_PARAMETER_RAND_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_request->presence &
AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT) ==
AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT) {
if ((encoded_result = encode_authentication_parameter_rand(
authentication_request->authenticationparameterrand,
AUTHENTICATION_PARAMETER_RAND_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((authentication_request->presence & AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT) == AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT) {
if ((encoded_result = encode_authentication_parameter_autn(authentication_request->authenticationparameterautn, AUTHENTICATION_PARAMETER_AUTN_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_request->presence &
AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT) ==
AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT) {
if ((encoded_result = encode_authentication_parameter_autn(
authentication_request->authenticationparameterautn,
AUTHENTICATION_PARAMETER_AUTN_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((authentication_request->presence & AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT) == AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(authentication_request->eapmessage, EAP_MESSAGE_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_request->presence &
AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT) ==
AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(
authentication_request->eapmessage, EAP_MESSAGE_IEI,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -34,13 +34,10 @@
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
ABBA_MINIMUM_LENGTH +\
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
0)
#define AUTHENTICATION_REQUEST_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
ABBA_MINIMUM_LENGTH + NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + 0)
/*
AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH + \
......@@ -49,23 +46,21 @@
*/
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_REQUEST_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define AUTHENTICATION_REQUEST_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_RAND_MAXIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH + \
0)
AUTHENTICATION_PARAMETER_AUTN_MAXIMUM_LENGTH + EAP_MESSAGE_MAXIMUM_LENGTH + \
0)
#define AUTHENTICATION_PARAMETER_RAND_IEI 0x21
#define AUTHENTICATION_PARAMETER_AUTN_IEI 0x20
#define EAP_MESSAGE_IEI 0x78
#define AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT (1<<0)
#define AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT (1<<1)
#define AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT (1<<2)
#define AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_RAND_PRESENT (1 << 0)
#define AUTHENTICATION_REQUEST_AUTHENTICATION_PARAMETER_AUTN_PRESENT (1 << 1)
#define AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT (1 << 2)
typedef struct authentication_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -79,7 +74,11 @@ typedef struct authentication_request_msg_tag {
EAPMessage eapmessage;
} authentication_request_msg;
int decode_authentication_request(authentication_request_msg *authenticationrequest, uint8_t *buffer, uint32_t len);
int encode_authentication_request(authentication_request_msg *authenticationrequest, uint8_t *buffer, uint32_t len);
int decode_authentication_request(
authentication_request_msg* authenticationrequest, uint8_t* buffer,
uint32_t len);
int encode_authentication_request(
authentication_request_msg* authenticationrequest, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,61 +27,90 @@
#include "TLVDecoder.h"
#include "AuthenticationResponse.h"
int decode_authentication_response(authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len) {
int decode_authentication_response(
authentication_response_msg* authentication_response, uint8_t* buffer,
uint32_t len) {
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, AUTHENTICATION_RESPONSE_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, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len);
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
printf("ieiDecoded(%x)\n", ieiDecoded);
if (ieiDecoded != AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI && ieiDecoded != AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI)
if (ieiDecoded !=
AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI &&
ieiDecoded != AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI)
break;
switch (ieiDecoded) {
case AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI:
printf("decoding AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI\n");
if ((decoded_result = decode_authentication_response_parameter(&authentication_response->authenticationresponseparameter, AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI, buffer + decoded, len - decoded)) < 0)
printf(
"decoding "
"AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI\n");
if ((decoded_result = decode_authentication_response_parameter(
&authentication_response->authenticationresponseparameter,
AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
printf("decoded(%d)\n", decoded);
authentication_response->presence |= AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT;
authentication_response->presence |=
AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT;
}
break;
case AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI:
if ((decoded_result = decode_eap_message(&authentication_response->eapmessage, AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_eap_message(
&authentication_response->eapmessage,
AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
authentication_response->presence |= AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT;
authentication_response->presence |=
AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT;
}
break;
}
}
return decoded;
}
int encode_authentication_response(authentication_response_msg *authentication_response, uint8_t *buffer, uint32_t len) {
int encode_authentication_response(
authentication_response_msg* authentication_response, 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, AUTHENTICATION_RESPONSE_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_ENCODER(
buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len);
if ((authentication_response->presence & AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT) == AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT) {
if ((encoded_result = encode_authentication_response_parameter(authentication_response->authenticationresponseparameter, AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_response->presence &
AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT) ==
AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT) {
if ((encoded_result = encode_authentication_response_parameter(
authentication_response->authenticationresponseparameter,
AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((authentication_response->presence & AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT) == AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(authentication_response->eapmessage, AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_response->presence &
AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT) ==
AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(
authentication_response->eapmessage,
AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,28 +31,25 @@
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_RESPONSE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
#define AUTHENTICATION_RESPONSE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + \
0)
EAP_MESSAGE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_RESPONSE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define AUTHENTICATION_RESPONSE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
AUTHENTICATION_RESPONSE_PARAMETER_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH + \
0)
EAP_MESSAGE_MAXIMUM_LENGTH + 0)
#define AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI 0x2d
#define AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI 0x78
#define AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT (1<<0)
#define AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT (1<<1)
#define AUTHENTICATION_RESPONSE_AUTNENTICATION_RESPONSE_PARAMETER_PRESENT \
(1 << 0)
#define AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT (1 << 1)
typedef struct authentication_response_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -63,7 +60,11 @@ typedef struct authentication_response_msg_tag {
EAPMessage eapmessage;
} authentication_response_msg;
int decode_authentication_response(authentication_response_msg *authenticationresponse, uint8_t *buffer, uint32_t len);
int encode_authentication_response(authentication_response_msg *authenticationresponse, uint8_t *buffer, uint32_t len);
int decode_authentication_response(
authentication_response_msg* authenticationresponse, uint8_t* buffer,
uint32_t len);
int encode_authentication_response(
authentication_response_msg* authenticationresponse, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,18 +27,26 @@
#include "TLVDecoder.h"
#include "AuthenticationResult.h"
int decode_authentication_result(authentication_result_msg *authentication_result, uint8_t *buffer, uint32_t len) {
int decode_authentication_result(
authentication_result_msg* authentication_result, uint8_t* buffer,
uint32_t len) {
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, 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, AUTHENTICATION_RESULT_MINIMUM_LENGTH, len);
if ((decoded_result = decode_u8_nas_key_set_identifier(&authentication_result->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
if ((decoded_result = decode_u8_nas_key_set_identifier(
&authentication_result->naskeysetidentifier, 0,
*(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
if ((decoded_result = decode_eap_message(&authentication_result->eapmessage, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_eap_message(
&authentication_result->eapmessage, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -46,11 +54,12 @@ int decode_authentication_result(authentication_result_msg *authentication_resul
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
printf("ieiDecoded:0x%x\n", ieiDecoded);
if (ieiDecoded == 0)
break;
if (ieiDecoded == 0) break;
switch (ieiDecoded) {
case AUTHENTICATION_RESULT_ABBA_IEI:
if ((decoded_result = decode_abba(&authentication_result->abba, AUTHENTICATION_RESULT_ABBA_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_abba(
&authentication_result->abba, AUTHENTICATION_RESULT_ABBA_IEI,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
......@@ -59,39 +68,50 @@ int decode_authentication_result(authentication_result_msg *authentication_resul
}
}
/*
if ((decoded_result = decode_abba (&authentication_result->abba,0 , buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_abba (&authentication_result->abba,0 , buffer +
decoded, len - decoded)) < 0) return decoded_result; else decoded +=
decoded_result;
*/
return decoded;
}
int encode_authentication_result(authentication_result_msg *authentication_result, uint8_t *buffer, uint32_t len) {
int encode_authentication_result(
authentication_result_msg* 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, 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_ENCODER(
buffer, AUTHENTICATION_RESULT_MINIMUM_LENGTH, len);
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(&authentication_result->naskeysetidentifier) & 0x0f) << 4) | 0x00;
*(buffer + encoded) = ((encode_u8_nas_key_set_identifier(
&authentication_result->naskeysetidentifier) &
0x0f)
<< 4) |
0x00;
encoded++;
if ((encoded_result = encode_eap_message(authentication_result->eapmessage, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_eap_message(
authentication_result->eapmessage, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((authentication_result->presence & AUTHENTICATION_RESULT_ABBA_PRESENT) == AUTHENTICATION_RESULT_ABBA_PRESENT) {
if ((encoded_result = encode_abba(authentication_result->abba, AUTHENTICATION_RESULT_ABBA_IEI, buffer + encoded, len - encoded)) < 0)
if ((authentication_result->presence & AUTHENTICATION_RESULT_ABBA_PRESENT) ==
AUTHENTICATION_RESULT_ABBA_PRESENT) {
if ((encoded_result = encode_abba(
authentication_result->abba, AUTHENTICATION_RESULT_ABBA_IEI,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
/*
if((encoded_result = encode_abba (authentication_result->abba,0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
if((encoded_result = encode_abba (authentication_result->abba,0,
buffer+encoded,len-encoded))<0) return encoded_result; else
encoded+=encoded_result;
*/
return encoded;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -32,26 +32,20 @@
#include "ABBA.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_RESULT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + \
ABBA_MINIMUM_LENGTH + \
0)
#define AUTHENTICATION_RESULT_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + EAP_MESSAGE_MINIMUM_LENGTH + \
ABBA_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_RESULT_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH + \
0)
#define AUTHENTICATION_RESULT_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + EAP_MESSAGE_MAXIMUM_LENGTH + 0)
#define AUTHENTICATION_RESULT_ABBA_IEI 0x38
#define AUTHENTICATION_RESULT_ABBA_PRESENT (1<<0)
#define AUTHENTICATION_RESULT_ABBA_PRESENT (1 << 0)
typedef struct authentication_result_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -63,7 +57,11 @@ typedef struct authentication_result_msg_tag {
ABBA abba;
} authentication_result_msg;
int decode_authentication_result(authentication_result_msg *authenticationresult, uint8_t *buffer, uint32_t len);
int encode_authentication_result(authentication_result_msg *authenticationresult, uint8_t *buffer, uint32_t len);
int decode_authentication_result(
authentication_result_msg* authenticationresult, uint8_t* buffer,
uint32_t len);
int encode_authentication_result(
authentication_result_msg* authenticationresult, uint8_t* buffer,
uint32_t len);
#endif
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -44,48 +44,34 @@
#include "SMSIndication.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define CONFIGURATION_UPDATE_COMMAND_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
#define CONFIGURATION_UPDATE_COMMAND_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
CONFIGURATION_UPDATE_INDICATION_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + \
_5GS_TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH + \
NSSAI_MINIMUM_LENGTH + \
SERVICE_AREA_LIST_MINIMUM_LENGTH + \
NETWORK_NAME_MINIMUM_LENGTH + \
TIME_ZONE_MINIMUM_LENGTH + \
TIME_ZONE_AND_TIME_MINIMUM_LENGTH + \
DAYLIGHT_SAVING_TIME_MINIMUM_LENGTH + \
LADN_INFORMATION_MINIMUM_LENGTH + \
_5GS_TRACKING_AREA_IDENTITY_LIST_MINIMUM_LENGTH + NSSAI_MINIMUM_LENGTH + \
SERVICE_AREA_LIST_MINIMUM_LENGTH + NETWORK_NAME_MINIMUM_LENGTH + \
TIME_ZONE_MINIMUM_LENGTH + TIME_ZONE_AND_TIME_MINIMUM_LENGTH + \
DAYLIGHT_SAVING_TIME_MINIMUM_LENGTH + LADN_INFORMATION_MINIMUM_LENGTH + \
MICO_INDICATION_MINIMUM_LENGTH + \
NETWORK_SLICING_INDICATION_MINIMUM_LENGTH + \
REJECTED_NSSAI_MINIMUM_LENGTH + \
NETWORK_SLICING_INDICATION_MINIMUM_LENGTH + REJECTED_NSSAI_MINIMUM_LENGTH + \
OPERATOR_DEFINED_ACCESS_CATEGORY_DEFINITIONS_MINIMUM_LENGTH + \
SMS_INDICATION_MINIMUM_LENGTH + \
0)
SMS_INDICATION_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define CONFIGURATION_UPDATE_COMMAND_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define CONFIGURATION_UPDATE_COMMAND_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
CONFIGURATION_UPDATE_INDICATION_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
_5GS_TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH + \
NSSAI_MAXIMUM_LENGTH + \
SERVICE_AREA_LIST_MAXIMUM_LENGTH + \
NETWORK_NAME_MAXIMUM_LENGTH + \
TIME_ZONE_MAXIMUM_LENGTH + \
TIME_ZONE_AND_TIME_MAXIMUM_LENGTH + \
DAYLIGHT_SAVING_TIME_MAXIMUM_LENGTH + \
LADN_INFORMATION_MAXIMUM_LENGTH + \
_5GS_TRACKING_AREA_IDENTITY_LIST_MAXIMUM_LENGTH + NSSAI_MAXIMUM_LENGTH + \
SERVICE_AREA_LIST_MAXIMUM_LENGTH + NETWORK_NAME_MAXIMUM_LENGTH + \
TIME_ZONE_MAXIMUM_LENGTH + TIME_ZONE_AND_TIME_MAXIMUM_LENGTH + \
DAYLIGHT_SAVING_TIME_MAXIMUM_LENGTH + LADN_INFORMATION_MAXIMUM_LENGTH + \
MICO_INDICATION_MAXIMUM_LENGTH + \
NETWORK_SLICING_INDICATION_MAXIMUM_LENGTH + \
REJECTED_NSSAI_MAXIMUM_LENGTH + \
NETWORK_SLICING_INDICATION_MAXIMUM_LENGTH + REJECTED_NSSAI_MAXIMUM_LENGTH + \
OPERATOR_DEFINED_ACCESS_CATEGORY_DEFINITIONS_MAXIMUM_LENGTH + \
SMS_INDICATION_MAXIMUM_LENGTH + \
0)
SMS_INDICATION_MAXIMUM_LENGTH + 0)
typedef struct configuration_update_command_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -104,11 +90,16 @@ typedef struct configuration_update_command_msg_tag {
MICOIndication micoindication;
NetworkSlicingIndication networkslicingindication;
RejectedNSSAI rejectednssai;
OperatorDefinedAccessCategoryDefinitions operatordefinedaccesscategorydefinitions;
OperatorDefinedAccessCategoryDefinitions
operatordefinedaccesscategorydefinitions;
SMSIndication smsindication;
} configuration_update_command_msg;
int decode_configuration_update_command(configuration_update_command_msg *configurationupdatecommand, uint8_t *buffer, uint32_t len);
int encode_configuration_update_command(configuration_update_command_msg *configurationupdatecommand, uint8_t *buffer, uint32_t len);
int decode_configuration_update_command(
configuration_update_command_msg* configurationupdatecommand,
uint8_t* buffer, uint32_t len);
int encode_configuration_update_command(
configuration_update_command_msg* configurationupdatecommand,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,24 +27,34 @@
#include "TLVDecoder.h"
#include "ConfigurationUpdateComplete.h"
int decode_configuration_update_complete(configuration_update_complete_msg *configuration_update_complete, uint8_t *buffer, uint32_t len) {
int decode_configuration_update_complete(
configuration_update_complete_msg* configuration_update_complete,
uint8_t* buffer, uint32_t len) {
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, CONFIGURATION_UPDATE_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, CONFIGURATION_UPDATE_COMPLETE_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&configuration_update_complete->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&configuration_update_complete->extendedprotocoldiscriminator, 0,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&configuration_update_complete->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&configuration_update_complete->securityheadertype, 0,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&configuration_update_complete->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&configuration_update_complete->messagetype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -52,24 +62,34 @@ int decode_configuration_update_complete(configuration_update_complete_msg *conf
return decoded;
}
int encode_configuration_update_complete(configuration_update_complete_msg *configuration_update_complete, uint8_t *buffer, uint32_t len) {
int encode_configuration_update_complete(
configuration_update_complete_msg* configuration_update_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, CONFIGURATION_UPDATE_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_ENCODER(
buffer, CONFIGURATION_UPDATE_COMPLETE_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(configuration_update_complete->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
configuration_update_complete->extendedprotocoldiscriminator, 0,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(configuration_update_complete->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
configuration_update_complete->securityheadertype, 0,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(configuration_update_complete->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
configuration_update_complete->messagetype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,18 +29,14 @@
#include "MessageType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define CONFIGURATION_UPDATE_COMPLETE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
0)
#define CONFIGURATION_UPDATE_COMPLETE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define CONFIGURATION_UPDATE_COMPLETE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
0)
#define CONFIGURATION_UPDATE_COMPLETE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + 0)
typedef struct configuration_update_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -48,7 +44,11 @@ typedef struct configuration_update_complete_msg_tag {
MessageType messagetype;
} configuration_update_complete_msg;
int decode_configuration_update_complete(configuration_update_complete_msg *configurationupdatecomplete, uint8_t *buffer, uint32_t len);
int encode_configuration_update_complete(configuration_update_complete_msg *configurationupdatecomplete, uint8_t *buffer, uint32_t len);
int decode_configuration_update_complete(
configuration_update_complete_msg* configurationupdatecomplete,
uint8_t* buffer, uint32_t len);
int encode_configuration_update_complete(
configuration_update_complete_msg* configurationupdatecomplete,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,54 +27,75 @@
#include "TLVDecoder.h"
#include "DLNASTransport.h"
int decode_dlnas_transport(dlnas_transport_msg *dlnas_transport, uint8_t *buffer, uint32_t len) {
int decode_dlnas_transport(
dlnas_transport_msg* dlnas_transport, uint8_t* buffer, uint32_t len) {
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, DLNAS_TRANSPORT_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, DLNAS_TRANSPORT_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&dlnas_transport->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&dlnas_transport->extendedprotocoldiscriminator, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&dlnas_transport->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&dlnas_transport->securityheadertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&dlnas_transport->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&dlnas_transport->messagetype, 0, buffer + decoded, len - decoded)) <
0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_payload_container_type(&dlnas_transport->payloadcontainertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_payload_container_type(
&dlnas_transport->payloadcontainertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_payload_container(&dlnas_transport->payloadcontainer, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_payload_container(
&dlnas_transport->payloadcontainer, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_pdu_session_identity2(&dlnas_transport->pdusessionidentity2, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_pdu_session_identity2(
&dlnas_transport->pdusessionidentity2, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_additional_information(&dlnas_transport->additionalinformation, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_additional_information(
&dlnas_transport->additionalinformation, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode__5gmm_cause(&dlnas_transport->_5gmmcause, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode__5gmm_cause(
&dlnas_transport->_5gmmcause, 0, buffer + decoded, len - decoded)) <
0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_gprs_timer3(&dlnas_transport->gprstimer3, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_gprs_timer3(
&dlnas_transport->gprstimer3, 0, buffer + decoded, len - decoded)) <
0)
return decoded_result;
else
decoded += decoded_result;
......@@ -82,54 +103,75 @@ int decode_dlnas_transport(dlnas_transport_msg *dlnas_transport, uint8_t *buffer
return decoded;
}
int encode_dlnas_transport(dlnas_transport_msg *dlnas_transport, uint8_t *buffer, uint32_t len) {
int encode_dlnas_transport(
dlnas_transport_msg* dlnas_transport, 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, DLNAS_TRANSPORT_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_ENCODER(
buffer, DLNAS_TRANSPORT_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(dlnas_transport->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
dlnas_transport->extendedprotocoldiscriminator, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(dlnas_transport->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
dlnas_transport->securityheadertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(dlnas_transport->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
dlnas_transport->messagetype, 0, buffer + encoded, len - encoded)) <
0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_payload_container_type(dlnas_transport->payloadcontainertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_payload_container_type(
dlnas_transport->payloadcontainertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_payload_container(dlnas_transport->payloadcontainer, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_payload_container(
dlnas_transport->payloadcontainer, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_pdu_session_identity2(dlnas_transport->pdusessionidentity2, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_pdu_session_identity2(
dlnas_transport->pdusessionidentity2, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_additional_information(dlnas_transport->additionalinformation, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_additional_information(
dlnas_transport->additionalinformation, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode__5gmm_cause(dlnas_transport->_5gmmcause, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode__5gmm_cause(
dlnas_transport->_5gmmcause, 0, buffer + encoded, len - encoded)) <
0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_gprs_timer3(dlnas_transport->gprstimer3, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_gprs_timer3(
dlnas_transport->gprstimer3, 0, buffer + encoded, len - encoded)) <
0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -35,30 +35,22 @@
#include "GPRSTimer3.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DLNAS_TRANSPORT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
PAYLOAD_CONTAINER_TYPE_MINIMUM_LENGTH + \
PAYLOAD_CONTAINER_MINIMUM_LENGTH + \
#define DLNAS_TRANSPORT_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
PAYLOAD_CONTAINER_TYPE_MINIMUM_LENGTH + PAYLOAD_CONTAINER_MINIMUM_LENGTH + \
PDU_SESSION_IDENTITY2_MINIMUM_LENGTH + \
ADDITIONAL_INFORMATION_MINIMUM_LENGTH + \
_5GMM_CAUSE_MINIMUM_LENGTH + \
GPRS_TIMER3_MINIMUM_LENGTH + \
0)
ADDITIONAL_INFORMATION_MINIMUM_LENGTH + _5GMM_CAUSE_MINIMUM_LENGTH + \
GPRS_TIMER3_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define DLNAS_TRANSPORT_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
PAYLOAD_CONTAINER_TYPE_MAXIMUM_LENGTH + \
PAYLOAD_CONTAINER_MAXIMUM_LENGTH + \
#define DLNAS_TRANSPORT_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
PAYLOAD_CONTAINER_TYPE_MAXIMUM_LENGTH + PAYLOAD_CONTAINER_MAXIMUM_LENGTH + \
PDU_SESSION_IDENTITY2_MAXIMUM_LENGTH + \
ADDITIONAL_INFORMATION_MAXIMUM_LENGTH + \
_5GMM_CAUSE_MAXIMUM_LENGTH + \
GPRS_TIMER3_MAXIMUM_LENGTH + \
0)
ADDITIONAL_INFORMATION_MAXIMUM_LENGTH + _5GMM_CAUSE_MAXIMUM_LENGTH + \
GPRS_TIMER3_MAXIMUM_LENGTH + 0)
typedef struct dlnas_transport_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -72,7 +64,9 @@ typedef struct dlnas_transport_msg_tag {
GPRSTimer3 gprstimer3;
} dlnas_transport_msg;
int decode_dlnas_transport(dlnas_transport_msg *dlnastransport, uint8_t *buffer, uint32_t len);
int encode_dlnas_transport(dlnas_transport_msg *dlnastransport, uint8_t *buffer, uint32_t len);
int decode_dlnas_transport(
dlnas_transport_msg* dlnastransport, uint8_t* buffer, uint32_t len);
int encode_dlnas_transport(
dlnas_transport_msg* dlnastransport, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,24 +27,34 @@
#include "TLVDecoder.h"
#include "DeregistrationAccept.h"
int decode_deregistration_accept(deregistration_accept_msg *deregistration_accept, uint8_t *buffer, uint32_t len) {
int decode_deregistration_accept(
deregistration_accept_msg* deregistration_accept, uint8_t* buffer,
uint32_t len) {
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, DEREGISTRATION_ACCEPT_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, DEREGISTRATION_ACCEPT_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&deregistration_accept->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&deregistration_accept->extendedprotocoldiscriminator, 0,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&deregistration_accept->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&deregistration_accept->securityheadertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&deregistration_accept->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&deregistration_accept->messagetype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -52,24 +62,34 @@ int decode_deregistration_accept(deregistration_accept_msg *deregistration_accep
return decoded;
}
int encode_deregistration_accept(deregistration_accept_msg *deregistration_accept, uint8_t *buffer, uint32_t len) {
int encode_deregistration_accept(
deregistration_accept_msg* deregistration_accept, 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, DEREGISTRATION_ACCEPT_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_ENCODER(
buffer, DEREGISTRATION_ACCEPT_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(deregistration_accept->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
deregistration_accept->extendedprotocoldiscriminator, 0,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(deregistration_accept->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
deregistration_accept->securityheadertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(deregistration_accept->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
deregistration_accept->messagetype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,18 +29,14 @@
#include "MessageType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DEREGISTRATION_ACCEPT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
0)
#define DEREGISTRATION_ACCEPT_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define DEREGISTRATION_ACCEPT_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
0)
#define DEREGISTRATION_ACCEPT_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + 0)
typedef struct deregistration_accept_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -48,7 +44,11 @@ typedef struct deregistration_accept_msg_tag {
MessageType messagetype;
} deregistration_accept_msg;
int decode_deregistration_accept(deregistration_accept_msg *deregistrationaccept, uint8_t *buffer, uint32_t len);
int encode_deregistration_accept(deregistration_accept_msg *deregistrationaccept, uint8_t *buffer, uint32_t len);
int decode_deregistration_accept(
deregistration_accept_msg* deregistrationaccept, uint8_t* buffer,
uint32_t len);
int encode_deregistration_accept(
deregistration_accept_msg* deregistrationaccept, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,83 +27,93 @@
#include "TLVDecoder.h"
#include "DeregistrationRequest.h"
//TODO: to be implemeted
int decode_deregistration_request(deregistration_request_msg *deregistration_request, uint8_t *buffer, uint32_t len) {
// TODO: to be implemeted
int decode_deregistration_request(
deregistration_request_msg* deregistration_request, uint8_t* buffer,
uint32_t len) {
uint32_t decoded = 0;
// int decoded_result = 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, DEREGISTRATION_REQUEST_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, DEREGISTRATION_REQUEST_MINIMUM_LENGTH, len);
/*
if((decoded_result = decode_extended_protocol_discriminator (&deregistration_request->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
if((decoded_result = decode_extended_protocol_discriminator
(&deregistration_request->extendedprotocoldiscriminator, 0,
buffer+decoded,len-decoded))<0) return decoded_result; else
decoded+=decoded_result;
if((decoded_result = decode_security_header_type (&deregistration_request->securityheadertype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
if((decoded_result = decode_security_header_type
(&deregistration_request->securityheadertype, 0,
buffer+decoded,len-decoded))<0) return decoded_result; else
decoded+=decoded_result;
if((decoded_result = decode_message_type (&deregistration_request->messagetype, 0, buffer+decoded,len-decoded))<0)
if((decoded_result = decode_message_type
(&deregistration_request->messagetype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_deregistration_type (&deregistration_request->deregistrationtype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
if((decoded_result = decode_deregistration_type
(&deregistration_request->deregistrationtype, 0,
buffer+decoded,len-decoded))<0) return decoded_result; else
decoded+=decoded_result;
if((decoded_result = decode_nas_key_set_identifier (&deregistration_request->naskeysetidentifier, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
if((decoded_result = decode_nas_key_set_identifier
(&deregistration_request->naskeysetidentifier, 0,
buffer+decoded,len-decoded))<0) return decoded_result; else
decoded+=decoded_result;
if((decoded_result = decode__5gs_mobile_identity (&deregistration_request->_5gsmobileidentity, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
if((decoded_result = decode__5gs_mobile_identity
(&deregistration_request->_5gsmobileidentity, 0,
buffer+decoded,len-decoded))<0) return decoded_result; else
decoded+=decoded_result;
*/
return decoded;
}
int encode_deregistration_request(deregistration_request_msg *deregistration_request, uint8_t *buffer, uint32_t len) {
int encode_deregistration_request(
deregistration_request_msg* deregistration_request, uint8_t* buffer,
uint32_t len) {
uint32_t encoded = 0;
// int encoded_result = 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, DEREGISTRATION_REQUEST_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_ENCODER(
buffer, DEREGISTRATION_REQUEST_MINIMUM_LENGTH, len);
/*
if((encoded_result = encode_extended_protocol_discriminator (deregistration_request->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
if((encoded_result = encode_extended_protocol_discriminator
(deregistration_request->extendedprotocoldiscriminator, 0,
buffer+encoded,len-encoded))<0) return encoded_result; else
encoded+=encoded_result;
if((encoded_result = encode_security_header_type (deregistration_request->securityheadertype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
if((encoded_result = encode_security_header_type
(deregistration_request->securityheadertype, 0,
buffer+encoded,len-encoded))<0) return encoded_result; else
encoded+=encoded_result;
if((encoded_result = encode_message_type (deregistration_request->messagetype, 0, buffer+encoded,len-encoded))<0)
if((encoded_result = encode_message_type
(deregistration_request->messagetype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_deregistration_type (deregistration_request->deregistrationtype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
if((encoded_result = encode_deregistration_type
(deregistration_request->deregistrationtype, 0,
buffer+encoded,len-encoded))<0) return encoded_result; else
encoded+=encoded_result;
if((encoded_result = encode_nas_key_set_identifier (deregistration_request->naskeysetidentifier, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
if((encoded_result = encode_nas_key_set_identifier
(deregistration_request->naskeysetidentifier, 0,
buffer+encoded,len-encoded))<0) return encoded_result; else
encoded+=encoded_result;
if((encoded_result = encode__5gs_mobile_identity (deregistration_request->_5gsmobileidentity, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
if((encoded_result = encode__5gs_mobile_identity
(deregistration_request->_5gsmobileidentity, 0,
buffer+encoded,len-encoded))<0) return encoded_result; else
encoded+=encoded_result;
*/
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -32,24 +32,20 @@
#include "_5GSMobileIdentity.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DEREGISTRATION_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
#define DEREGISTRATION_REQUEST_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
DEREGISTRATION_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + \
0)
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define DEREGISTRATION_REQUEST_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define DEREGISTRATION_REQUEST_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
DEREGISTRATION_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
0)
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + 0)
typedef struct deregistration_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -60,7 +56,11 @@ typedef struct deregistration_request_msg_tag {
_5GSMobileIdentity _5gsmobileidentity;
} deregistration_request_msg;
int decode_deregistration_request(deregistration_request_msg *deregistrationrequest, uint8_t *buffer, uint32_t len);
int encode_deregistration_request(deregistration_request_msg *deregistrationrequest, uint8_t *buffer, uint32_t len);
int decode_deregistration_request(
deregistration_request_msg* deregistrationrequest, uint8_t* buffer,
uint32_t len);
int encode_deregistration_request(
deregistration_request_msg* deregistrationrequest, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,14 +27,19 @@
#include "TLVDecoder.h"
#include "IdentityRequest.h"
int decode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len) {
int decode_identity_request(
identity_request_msg* identity_request, uint8_t* buffer, uint32_t len) {
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, IDENTITY_REQUEST_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, IDENTITY_REQUEST_MINIMUM_LENGTH, len);
if ((decoded_result = decode__5gs_identity_type(&identity_request->_5gsidentitytype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode__5gs_identity_type(
&identity_request->_5gsidentitytype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -42,14 +47,19 @@ int decode_identity_request(identity_request_msg *identity_request, uint8_t *buf
return decoded;
}
int encode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len) {
int encode_identity_request(
identity_request_msg* identity_request, 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, IDENTITY_REQUEST_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_ENCODER(
buffer, IDENTITY_REQUEST_MINIMUM_LENGTH, len);
if ((encoded_result = encode__5gs_identity_type(identity_request->_5gsidentitytype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode__5gs_identity_type(
identity_request->_5gsidentitytype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,20 +30,16 @@
#include "_5GSIdentityType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define IDENTITY_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GS_IDENTITY_TYPE_MINIMUM_LENGTH + \
0)
#define IDENTITY_REQUEST_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GS_IDENTITY_TYPE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define IDENTITY_REQUEST_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GS_IDENTITY_TYPE_MAXIMUM_LENGTH + \
0)
#define IDENTITY_REQUEST_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GS_IDENTITY_TYPE_MAXIMUM_LENGTH + 0)
typedef struct identity_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -52,7 +48,9 @@ typedef struct identity_request_msg_tag {
_5GSIdentityType _5gsidentitytype;
} identity_request_msg;
int decode_identity_request(identity_request_msg *identityrequest, uint8_t *buffer, uint32_t len);
int encode_identity_request(identity_request_msg *identityrequest, uint8_t *buffer, uint32_t len);
int decode_identity_request(
identity_request_msg* identityrequest, uint8_t* buffer, uint32_t len);
int encode_identity_request(
identity_request_msg* identityrequest, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,29 +27,40 @@
#include "TLVDecoder.h"
#include "IdentityResponse.h"
int decode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len) {
int decode_identity_response(
identity_response_msg* identity_response, uint8_t* buffer, uint32_t len) {
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, IDENTITY_RESPONSE_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, IDENTITY_RESPONSE_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&identity_response->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&identity_response->extendedprotocoldiscriminator, 0,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&identity_response->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&identity_response->securityheadertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&identity_response->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&identity_response->messagetype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode__5gs_mobile_identity(&identity_response->_5gsmobileidentity, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode__5gs_mobile_identity(
&identity_response->_5gsmobileidentity, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -57,29 +68,40 @@ int decode_identity_response(identity_response_msg *identity_response, uint8_t *
return decoded;
}
int encode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len) {
int encode_identity_response(
identity_response_msg* identity_response, 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, IDENTITY_RESPONSE_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_ENCODER(
buffer, IDENTITY_RESPONSE_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(identity_response->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
identity_response->extendedprotocoldiscriminator, 0,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(identity_response->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
identity_response->securityheadertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(identity_response->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
identity_response->messagetype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode__5gs_mobile_identity(identity_response->_5gsmobileidentity, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode__5gs_mobile_identity(
identity_response->_5gsmobileidentity, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,20 +30,16 @@
#include "_5GSMobileIdentity.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define IDENTITY_RESPONSE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + \
0)
#define IDENTITY_RESPONSE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define IDENTITY_RESPONSE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
0)
#define IDENTITY_RESPONSE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + 0)
typedef struct identity_response_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -52,7 +48,9 @@ typedef struct identity_response_msg_tag {
_5GSMobileIdentity _5gsmobileidentity;
} identity_response_msg;
int decode_identity_response(identity_response_msg *identityresponse, uint8_t *buffer, uint32_t len);
int encode_identity_response(identity_response_msg *identityresponse, uint8_t *buffer, uint32_t len);
int decode_identity_response(
identity_response_msg* identityresponse, uint8_t* buffer, uint32_t len);
int encode_identity_response(
identity_response_msg* identityresponse, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,29 +27,38 @@
#include "TLVDecoder.h"
#include "Notification.h"
int decode_notification(notification_msg *notification, uint8_t *buffer, uint32_t len) {
int decode_notification(
notification_msg* notification, uint8_t* buffer, uint32_t len) {
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, NOTIFICATION_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, NOTIFICATION_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&notification->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&notification->extendedprotocoldiscriminator, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&notification->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&notification->securityheadertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&notification->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&notification->messagetype, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode__access_type(&notification->_accesstype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode__access_type(
&notification->_accesstype, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -57,29 +66,38 @@ int decode_notification(notification_msg *notification, uint8_t *buffer, uint32_
return decoded;
}
int encode_notification(notification_msg *notification, uint8_t *buffer, uint32_t len) {
int encode_notification(
notification_msg* notification, 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, NOTIFICATION_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_ENCODER(
buffer, NOTIFICATION_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(notification->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
notification->extendedprotocoldiscriminator, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(notification->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
notification->securityheadertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(notification->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
notification->messagetype, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode__access_type(notification->_accesstype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode__access_type(
notification->_accesstype, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,20 +30,16 @@
#include "_AccessType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define NOTIFICATION_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
_ACCESS_TYPE_MINIMUM_LENGTH + \
0)
#define NOTIFICATION_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_ACCESS_TYPE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define NOTIFICATION_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
_ACCESS_TYPE_MAXIMUM_LENGTH + \
0)
#define NOTIFICATION_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_ACCESS_TYPE_MAXIMUM_LENGTH + 0)
typedef struct notification_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -52,7 +48,9 @@ typedef struct notification_msg_tag {
_AccessType _accesstype;
} notification_msg;
int decode_notification(notification_msg *notification, uint8_t *buffer, uint32_t len);
int encode_notification(notification_msg *notification, uint8_t *buffer, uint32_t len);
int decode_notification(
notification_msg* notification, uint8_t* buffer, uint32_t len);
int encode_notification(
notification_msg* notification, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,29 +27,41 @@
#include "TLVDecoder.h"
#include "NotificationResponse.h"
int decode_notification_response(notification_response_msg *notification_response, uint8_t *buffer, uint32_t len) {
int decode_notification_response(
notification_response_msg* notification_response, uint8_t* buffer,
uint32_t len) {
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, NOTIFICATION_RESPONSE_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, NOTIFICATION_RESPONSE_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&notification_response->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&notification_response->extendedprotocoldiscriminator, 0,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&notification_response->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&notification_response->securityheadertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&notification_response->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&notification_response->messagetype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_pdu_session_status(&notification_response->pdusessionstatus, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_pdu_session_status(
&notification_response->pdusessionstatus, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -57,29 +69,41 @@ int decode_notification_response(notification_response_msg *notification_respons
return decoded;
}
int encode_notification_response(notification_response_msg *notification_response, uint8_t *buffer, uint32_t len) {
int encode_notification_response(
notification_response_msg* notification_response, 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, NOTIFICATION_RESPONSE_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_ENCODER(
buffer, NOTIFICATION_RESPONSE_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(notification_response->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
notification_response->extendedprotocoldiscriminator, 0,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(notification_response->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
notification_response->securityheadertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(notification_response->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
notification_response->messagetype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_pdu_session_status(notification_response->pdusessionstatus, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_pdu_session_status(
notification_response->pdusessionstatus, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,20 +30,16 @@
#include "PDUSessionStatus.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define NOTIFICATION_RESPONSE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
PDU_SESSION_STATUS_MINIMUM_LENGTH + \
0)
#define NOTIFICATION_RESPONSE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
PDU_SESSION_STATUS_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define NOTIFICATION_RESPONSE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
PDU_SESSION_STATUS_MAXIMUM_LENGTH + \
0)
#define NOTIFICATION_RESPONSE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
PDU_SESSION_STATUS_MAXIMUM_LENGTH + 0)
typedef struct notification_response_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -52,7 +48,11 @@ typedef struct notification_response_msg_tag {
PDUSessionStatus pdusessionstatus;
} notification_response_msg;
int decode_notification_response(notification_response_msg *notificationresponse, uint8_t *buffer, uint32_t len);
int encode_notification_response(notification_response_msg *notificationresponse, uint8_t *buffer, uint32_t len);
int decode_notification_response(
notification_response_msg* notificationresponse, uint8_t* buffer,
uint32_t len);
int encode_notification_response(
notification_response_msg* notificationresponse, uint8_t* buffer,
uint32_t len);
#endif
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,29 +27,41 @@
#include "TLVDecoder.h"
#include "RegistrationComplete.h"
int decode_registration_complete(registration_complete_msg *registration_complete, uint8_t *buffer, uint32_t len) {
int decode_registration_complete(
registration_complete_msg* registration_complete, uint8_t* buffer,
uint32_t len) {
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, REGISTRATION_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, REGISTRATION_COMPLETE_MINIMUM_LENGTH, len);
if ((decoded_result = decode_extended_protocol_discriminator(&registration_complete->extendedprotocoldiscriminator, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_extended_protocol_discriminator(
&registration_complete->extendedprotocoldiscriminator, 0,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_security_header_type(&registration_complete->securityheadertype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_security_header_type(
&registration_complete->securityheadertype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&registration_complete->messagetype, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_message_type(
&registration_complete->messagetype, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_sor_transparent_container(&registration_complete->sortransparentcontainer, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_sor_transparent_container(
&registration_complete->sortransparentcontainer, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
......@@ -57,29 +69,41 @@ int decode_registration_complete(registration_complete_msg *registration_complet
return decoded;
}
int encode_registration_complete(registration_complete_msg *registration_complete, uint8_t *buffer, uint32_t len) {
int encode_registration_complete(
registration_complete_msg* registration_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, REGISTRATION_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_ENCODER(
buffer, REGISTRATION_COMPLETE_MINIMUM_LENGTH, len);
if ((encoded_result = encode_extended_protocol_discriminator(registration_complete->extendedprotocoldiscriminator, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_extended_protocol_discriminator(
registration_complete->extendedprotocoldiscriminator, 0,
buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_security_header_type(registration_complete->securityheadertype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_security_header_type(
registration_complete->securityheadertype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_message_type(registration_complete->messagetype, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_message_type(
registration_complete->messagetype, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_sor_transparent_container(registration_complete->sortransparentcontainer, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode_sor_transparent_container(
registration_complete->sortransparentcontainer, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,20 +30,16 @@
#include "SORTransparentContainer.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_COMPLETE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH + \
0)
#define REGISTRATION_COMPLETE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
SOR_TRANSPARENT_CONTAINER_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define REGISTRATION_COMPLETE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
SOR_TRANSPARENT_CONTAINER_MAXIMUM_LENGTH + \
0)
#define REGISTRATION_COMPLETE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
SOR_TRANSPARENT_CONTAINER_MAXIMUM_LENGTH + 0)
typedef struct registration_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -52,7 +48,11 @@ typedef struct registration_complete_msg_tag {
SORTransparentContainer sortransparentcontainer;
} registration_complete_msg;
int decode_registration_complete(registration_complete_msg *registrationcomplete, uint8_t *buffer, uint32_t len);
int encode_registration_complete(registration_complete_msg *registrationcomplete, uint8_t *buffer, uint32_t len);
int decode_registration_complete(
registration_complete_msg* registrationcomplete, uint8_t* buffer,
uint32_t len);
int encode_registration_complete(
registration_complete_msg* registrationcomplete, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,45 +27,65 @@
#include "TLVDecoder.h"
#include "RegistrationReject.h"
int decode_registration_reject(registration_reject_msg *registration_reject, uint8_t *buffer, uint32_t len) {
int decode_registration_reject(
registration_reject_msg* registration_reject, uint8_t* buffer,
uint32_t len) {
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, REGISTRATION_REJECT_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, REGISTRATION_REJECT_MINIMUM_LENGTH, len);
if ((decoded_result = decode__5gmm_cause(&registration_reject->_5gmmcause, 0, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode__5gmm_cause(
&registration_reject->_5gmmcause, 0, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if ((ieiDecoded != REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI) && (ieiDecoded != REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI) && (ieiDecoded != REGISTRATION_REJECT_EAP_MESSAGE_IEI))
if ((ieiDecoded != REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI) &&
(ieiDecoded != REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI) &&
(ieiDecoded != REGISTRATION_REJECT_EAP_MESSAGE_IEI))
break;
switch (ieiDecoded) {
case REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI:
if ((decoded_result = decode_gprs_timer2(&registration_reject->t3346, REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_gprs_timer2(
&registration_reject->t3346,
REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
registration_reject->presence |= REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT;
registration_reject->presence |=
REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT;
}
break;
case REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI:
if ((decoded_result = decode_gprs_timer2(&registration_reject->t3502, REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_gprs_timer2(
&registration_reject->t3502,
REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI,
buffer + decoded, len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
registration_reject->presence |= REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT;
registration_reject->presence |=
REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT;
}
break;
case REGISTRATION_REJECT_EAP_MESSAGE_IEI:
if ((decoded_result = decode_eap_message(&registration_reject->eapmessage, REGISTRATION_REJECT_EAP_MESSAGE_IEI, buffer + decoded, len - decoded)) < 0)
if ((decoded_result = decode_eap_message(
&registration_reject->eapmessage,
REGISTRATION_REJECT_EAP_MESSAGE_IEI, buffer + decoded,
len - decoded)) < 0)
return decoded_result;
else {
decoded += decoded_result;
registration_reject->presence |= REGISTRATION_REJECT_EAP_MESSAGE_PRESENT;
registration_reject->presence |=
REGISTRATION_REJECT_EAP_MESSAGE_PRESENT;
}
break;
}
......@@ -74,34 +94,55 @@ int decode_registration_reject(registration_reject_msg *registration_reject, uin
return decoded;
}
int encode_registration_reject(registration_reject_msg *registration_reject, uint8_t *buffer, uint32_t len) {
int encode_registration_reject(
registration_reject_msg* registration_reject, 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, REGISTRATION_REJECT_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_ENCODER(
buffer, REGISTRATION_REJECT_MINIMUM_LENGTH, len);
if ((encoded_result = encode__5gmm_cause(registration_reject->_5gmmcause, 0, buffer + encoded, len - encoded)) < 0)
if ((encoded_result = encode__5gmm_cause(
registration_reject->_5gmmcause, 0, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
if ((registration_reject->presence & REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT) == REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT) {
if ((encoded_result = encode_gprs_timer2(registration_reject->t3346, REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI, buffer + encoded, len - encoded)) < 0)
if ((registration_reject->presence &
REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT) ==
REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT) {
if ((encoded_result = encode_gprs_timer2(
registration_reject->t3346,
REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((registration_reject->presence & REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT) == REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT) {
if ((encoded_result = encode_gprs_timer2(registration_reject->t3502, REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI, buffer + encoded, len - encoded)) < 0)
if ((registration_reject->presence &
REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT) ==
REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT) {
if ((encoded_result = encode_gprs_timer2(
registration_reject->t3502,
REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
}
if ((registration_reject->presence & REGISTRATION_REJECT_EAP_MESSAGE_PRESENT) == REGISTRATION_REJECT_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(registration_reject->eapmessage, REGISTRATION_REJECT_EAP_MESSAGE_IEI, buffer + encoded, len - encoded)) < 0)
if ((registration_reject->presence &
REGISTRATION_REJECT_EAP_MESSAGE_PRESENT) ==
REGISTRATION_REJECT_EAP_MESSAGE_PRESENT) {
if ((encoded_result = encode_eap_message(
registration_reject->eapmessage,
REGISTRATION_REJECT_EAP_MESSAGE_IEI, buffer + encoded,
len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -32,33 +32,27 @@
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_REJECT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GMM_CAUSE_MINIMUM_LENGTH + \
GPRS_TIMER2_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + \
0)
#define REGISTRATION_REJECT_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GMM_CAUSE_MINIMUM_LENGTH + GPRS_TIMER2_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define REGISTRATION_REJECT_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GMM_CAUSE_MAXIMUM_LENGTH + \
GPRS_TIMER2_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH + \
0)
#define REGISTRATION_REJECT_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GMM_CAUSE_MAXIMUM_LENGTH + GPRS_TIMER2_MAXIMUM_LENGTH + \
EAP_MESSAGE_MAXIMUM_LENGTH + 0)
#define REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_IEI 0x5f
#define REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT (1<<0)
#define REGISTRATION_REJECT_GPRSTIMER2_T3346_VALUE_PRESENT (1 << 0)
#define REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_IEI 0x16
#define REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT (1<<1)
#define REGISTRATION_REJECT_GPRSTIMER2_T3502_VALUE_PRESENT (1 << 1)
#define REGISTRATION_REJECT_EAP_MESSAGE_IEI 0x78
#define REGISTRATION_REJECT_EAP_MESSAGE_PRESENT (1<<2)
#define REGISTRATION_REJECT_EAP_MESSAGE_PRESENT (1 << 2)
typedef struct registration_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -72,7 +66,9 @@ typedef struct registration_reject_msg_tag {
EAPMessage eapmessage;
} registration_reject_msg;
int decode_registration_reject(registration_reject_msg *registrationreject, uint8_t *buffer, uint32_t len);
int encode_registration_reject(registration_reject_msg *registrationreject, uint8_t *buffer, uint32_t len);
int decode_registration_reject(
registration_reject_msg* registrationreject, uint8_t* buffer, uint32_t len);
int encode_registration_reject(
registration_reject_msg* registrationreject, uint8_t* buffer, uint32_t len);
#endif
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -51,60 +51,42 @@
#include "NASMessageContainer.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
#define REGISTRATION_REQUEST_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GS_REGISTRATION_TYPE_MINIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + \
_5GMM_CAPABILITY_MINIMUM_LENGTH + \
UE_SECURITY_CAPABILITY_MINIMUM_LENGTH + \
NSSAI_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + _5GMM_CAPABILITY_MINIMUM_LENGTH + \
UE_SECURITY_CAPABILITY_MINIMUM_LENGTH + NSSAI_MINIMUM_LENGTH + \
_5GS_TRACKING_AREA_IDENTITY_MINIMUM_LENGTH + \
S1_UE_NETWORK_CAPABILITY_MINIMUM_LENGTH + \
UPLINK_DATA_STATUS_MINIMUM_LENGTH + \
PDU_SESSION_STATUS_MINIMUM_LENGTH + \
MICO_INDICATION_MINIMUM_LENGTH + \
UE_STATUS_MINIMUM_LENGTH + \
UPLINK_DATA_STATUS_MINIMUM_LENGTH + PDU_SESSION_STATUS_MINIMUM_LENGTH + \
MICO_INDICATION_MINIMUM_LENGTH + UE_STATUS_MINIMUM_LENGTH + \
ALLOWED_PDU_SESSION_STATUS_MINIMUM_LENGTH + \
UES_USAGE_SETTING_MINIMUM_LENGTH + \
_5GSDRX_PARAMETERS_MINIMUM_LENGTH + \
EPSNAS_MESSAGE_CONTAINER_MINIMUM_LENGTH + \
LADN_INDICATION_MINIMUM_LENGTH + \
UES_USAGE_SETTING_MINIMUM_LENGTH + _5GSDRX_PARAMETERS_MINIMUM_LENGTH + \
EPSNAS_MESSAGE_CONTAINER_MINIMUM_LENGTH + LADN_INDICATION_MINIMUM_LENGTH + \
PAYLOAD_CONTAINER_MINIMUM_LENGTH + \
NETWORK_SLICING_INDICATION_MINIMUM_LENGTH + \
_5GS_UPDATE_TYPE_MINIMUM_LENGTH + \
NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH + \
0)
_5GS_UPDATE_TYPE_MINIMUM_LENGTH + NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define REGISTRATION_REQUEST_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define REGISTRATION_REQUEST_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GS_REGISTRATION_TYPE_MAXIMUM_LENGTH + \
NAS_KEY_SET_IDENTIFIER_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
_5GMM_CAPABILITY_MAXIMUM_LENGTH + \
UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH + \
NSSAI_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + _5GMM_CAPABILITY_MAXIMUM_LENGTH + \
UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH + NSSAI_MAXIMUM_LENGTH + \
_5GS_TRACKING_AREA_IDENTITY_MAXIMUM_LENGTH + \
S1_UE_NETWORK_CAPABILITY_MAXIMUM_LENGTH + \
UPLINK_DATA_STATUS_MAXIMUM_LENGTH + \
PDU_SESSION_STATUS_MAXIMUM_LENGTH + \
MICO_INDICATION_MAXIMUM_LENGTH + \
UE_STATUS_MAXIMUM_LENGTH + \
UPLINK_DATA_STATUS_MAXIMUM_LENGTH + PDU_SESSION_STATUS_MAXIMUM_LENGTH + \
MICO_INDICATION_MAXIMUM_LENGTH + UE_STATUS_MAXIMUM_LENGTH + \
ALLOWED_PDU_SESSION_STATUS_MAXIMUM_LENGTH + \
UES_USAGE_SETTING_MAXIMUM_LENGTH + \
_5GSDRX_PARAMETERS_MAXIMUM_LENGTH + \
EPSNAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \
LADN_INDICATION_MAXIMUM_LENGTH + \
UES_USAGE_SETTING_MAXIMUM_LENGTH + _5GSDRX_PARAMETERS_MAXIMUM_LENGTH + \
EPSNAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH + LADN_INDICATION_MAXIMUM_LENGTH + \
PAYLOAD_CONTAINER_MAXIMUM_LENGTH + \
NETWORK_SLICING_INDICATION_MAXIMUM_LENGTH + \
_5GS_UPDATE_TYPE_MAXIMUM_LENGTH + \
NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \
0)
_5GS_UPDATE_TYPE_MAXIMUM_LENGTH + NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH + 0)
#define REGISTRATION_REQUEST_NAS_KEY_SET_IDENTIFIER_IEI 0xC0
#define REGISTRATION_REQUEST_5GMM_CAPABILITY_IEI 0x10
......@@ -128,27 +110,27 @@
#define REGISTRATION_REQUEST_5GS_UPDATE_TYPE_IEI 0x53
#define REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_IEI 0x71
#define REGISTRATION_REQUEST_NAS_KEY_SET_IDENTIFIER_PRESENT (1<<0)
#define REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT (1<<1)
#define REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT (1<<2)
#define REGISTRATION_REQUEST_NSSAI_PRESENT (1<<3)
#define REGISTRATION_REQUEST_5GS_TRACKING_AREA_IDENTITY_PRESENT (1<<4)
#define REGISTRATION_REQUEST_S1_UE_NETWORK_CAPABILITY_PRESENT (1<<5)
#define REGISTRATION_REQUEST_UPLINK_DATA_STATUS_PRESENT (1<<6)
#define REGISTRATION_REQUEST_PDU_SESSION_STATUS_PRESENT (1<<8)
#define REGISTRATION_REQUEST_MICO_IDICATION_PRESENT (1<<9)
#define REGISTRATION_REQUEST_UE_STATUS_PRESENT (1<<10)
#define REGISTRATION_REQUEST_5GS_MOBILE_IDENTITY_PRESENT (1<<11)
#define REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT (1<<12)
#define REGISTRATION_REQUEST_UE_USAGE_SETTING_PRESENT (1<<13)
#define REGISTRATION_REQUEST_5GS_DRX_PARAMETERS_PRESENT (1<<14)
#define REGISTRATION_REQUEST_EPS_NAS_MESSAGE_CONTAINER_PRESENT (1<<15)
#define REGISTRATION_REQUEST_LADN_INDICATION_PRESENT (1<<16)
#define REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT (1<<17)
#define REGISTRATION_REQUEST_PAYLOAD_CONTAINER_PRESENT (1<<18)
#define REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_PRESENT (1<<19)
#define REGISTRATION_REQUEST_5GS_UPDATE_TYPE_PRESENT (1<<20)
#define REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT (1<<21)
#define REGISTRATION_REQUEST_NAS_KEY_SET_IDENTIFIER_PRESENT (1 << 0)
#define REGISTRATION_REQUEST_5GMM_CAPABILITY_PRESENT (1 << 1)
#define REGISTRATION_REQUEST_UE_SECURITY_CAPABILITY_PRESENT (1 << 2)
#define REGISTRATION_REQUEST_NSSAI_PRESENT (1 << 3)
#define REGISTRATION_REQUEST_5GS_TRACKING_AREA_IDENTITY_PRESENT (1 << 4)
#define REGISTRATION_REQUEST_S1_UE_NETWORK_CAPABILITY_PRESENT (1 << 5)
#define REGISTRATION_REQUEST_UPLINK_DATA_STATUS_PRESENT (1 << 6)
#define REGISTRATION_REQUEST_PDU_SESSION_STATUS_PRESENT (1 << 8)
#define REGISTRATION_REQUEST_MICO_IDICATION_PRESENT (1 << 9)
#define REGISTRATION_REQUEST_UE_STATUS_PRESENT (1 << 10)
#define REGISTRATION_REQUEST_5GS_MOBILE_IDENTITY_PRESENT (1 << 11)
#define REGISTRATION_REQUEST_ALLOWED_PDU_SESSION_STATUS_PRESENT (1 << 12)
#define REGISTRATION_REQUEST_UE_USAGE_SETTING_PRESENT (1 << 13)
#define REGISTRATION_REQUEST_5GS_DRX_PARAMETERS_PRESENT (1 << 14)
#define REGISTRATION_REQUEST_EPS_NAS_MESSAGE_CONTAINER_PRESENT (1 << 15)
#define REGISTRATION_REQUEST_LADN_INDICATION_PRESENT (1 << 16)
#define REGISTRATION_REQUEST_PAYLOAD_CONTAINER_TYPE_PRESENT (1 << 17)
#define REGISTRATION_REQUEST_PAYLOAD_CONTAINER_PRESENT (1 << 18)
#define REGISTRATION_REQUEST_NETWORK_SLICING_INDICATION_PRESENT (1 << 19)
#define REGISTRATION_REQUEST_5GS_UPDATE_TYPE_PRESENT (1 << 20)
#define REGISTRATION_REQUEST_NAS_MESSAGE_CONTAINER_PRESENT (1 << 21)
typedef struct registration_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
......@@ -161,7 +143,7 @@ typedef struct registration_request_msg_tag {
NASKeySetIdentifier non_current_native_nas_key_set_identifier;
_5GMMCapability _5gmmcapability;
UESecurityCapability uesecuritycapability;
//NSSAI nssai;
// NSSAI nssai;
_5GSTrackingAreaIdentity _5gstrackingareaidentity;
S1UENetworkCapability s1uenetworkcapability;
UplinkDataStatus uplinkdatastatus;
......@@ -173,7 +155,7 @@ typedef struct registration_request_msg_tag {
UESUsageSetting uesusagesetting;
_5GSDRXParameters _5gsdrxparameters;
EPSNASMessageContainer epsnasmessagecontainer;
//LADNIndication ladnindication;
// LADNIndication ladnindication;
PayloadContainerType payloadcontainertype;
PayloadContainer payloadcontainer;
NetworkSlicingIndication networkslicingindication;
......@@ -181,7 +163,11 @@ typedef struct registration_request_msg_tag {
NASMessageContainer nasmessagecontainer;
} registration_request_msg;
int decode_registration_request(registration_request_msg *registrationrequest, uint8_t *buffer, uint32_t len);
int encode_registration_request(registration_request_msg *registrationrequest, uint8_t *buffer, uint32_t len);
int decode_registration_request(
registration_request_msg* registrationrequest, uint8_t* buffer,
uint32_t len);
int encode_registration_request(
registration_request_msg* registrationrequest, uint8_t* buffer,
uint32_t len);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,38 +31,37 @@
#include "NASMessageContainer.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SECURITY_MODE_COMPLETE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + \
MESSAGE_TYPE_MINIMUM_LENGTH + \
#define SECURITY_MODE_COMPLETE_MINIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MINIMUM_LENGTH + MESSAGE_TYPE_MINIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MINIMUM_LENGTH + \
NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH + \
0)
NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH + 0)
/* Maximum length macro. Formed by maximum length of each field */
#define SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + \
MESSAGE_TYPE_MAXIMUM_LENGTH + \
#define SECURITY_MODE_COMPLETE_MAXIMUM_LENGTH \
(EXTENDED_PROTOCOL_DISCRIMINATOR_MAXIMUM_LENGTH + \
SECURITY_HEADER_TYPE_MAXIMUM_LENGTH + MESSAGE_TYPE_MAXIMUM_LENGTH + \
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH + \
0)
NAS_MESSAGE_CONTAINER_MAXIMUM_LENGTH + 0)
#define SECURITY_MODE_COMPLETE_5G_MOBILE_IDENTITY_IEI 0x77
#define SECURITY_MODE_COMPLETE_5G_MOBILE_IDENTITY_PRESENT (1<<0)
#define SECURITY_MODE_COMPLETE_5G_MOBILE_IDENTITY_PRESENT (1 << 0)
#define SECURITY_MODE_COMPLETE_NAS_MESSAGE_CONTAINER_IEI 0x71
#define SECURITY_MODE_COMPLETE_NAS_MESSAGE_CONTAINER_PRESENT (1<<1)
#define SECURITY_MODE_COMPLETE_NAS_MESSAGE_CONTAINER_PRESENT (1 << 1)
typedef struct security_mode_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
uint8_t presence;
//_5GSMobileIdentity _5gsmobileidentity;
NASMessageContainer nasmessagecontainer;
} security_mode_complete_msg;
int decode_security_mode_complete(security_mode_complete_msg *securitymodecomplete, uint8_t *buffer, uint32_t len);
int encode_security_mode_complete(security_mode_complete_msg *securitymodecomplete, uint8_t *buffer, uint32_t len);
int decode_security_mode_complete(
security_mode_complete_msg* securitymodecomplete, uint8_t* buffer,
uint32_t len);
int encode_security_mode_complete(
security_mode_complete_msg* securitymodecomplete, uint8_t* buffer,
uint32_t len);
#endif
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......
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