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

add license header/format to prepare for release

parent bfdf5757
......@@ -19,7 +19,6 @@
* contact@openairinterface.org
*/
#ifndef FILE_MM_DATA_H_SEEN
#define FILE_MM_DATA_H_SEEN
......@@ -35,35 +34,35 @@ 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 */
ksi_t ksi; /* NAS key set identifier for E-UTRAN */
#define FIVEGMM_SECURITY_VECTOR_INDEX_INVALID (-1)
int vector_index; /* Pointer on vector */
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 */
struct count_s{
uint32_t spare:8;
uint32_t overflow:16;
uint32_t seq_num:8;
} dl_count, ul_count; /* Downlink and uplink count parameters */
struct count_s {
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 */
uint8_t fivegs_integrity; /* algorithm used for integrity protection */
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;
} capability; /* UE network capability */
uint8_t fivegs_encryption; /* algorithm used for ciphering */
uint8_t fivegs_integrity; /* algorithm used for integrity protection */
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;
} capability; /* UE network capability */
struct {
uint8_t encryption:4; /* algorithm used for ciphering */
uint8_t integrity:4; /* algorithm used for integrity protection */
} selected_algorithms; /* AMF selected algorithms */
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;
uint8_t activated;
} fivegmm_security_context_t;
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,65 +27,59 @@
#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_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;
decoded += decoded_result;
/*
* Decoding optional fields
*/
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
if(ieiDecoded ==0)
break;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
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)
return decoded_result;
else{
decoded += decoded_result;
authentication_failure->presence |= AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT;
}
break;
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)
return decoded_result;
else {
decoded += decoded_result;
authentication_failure->presence |= AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT;
}
break;
}
}
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_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;
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;
}
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef AUTHENTICATION_FAILURE_H_
#define AUTHENTICATION_FAILURE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -6,7 +30,6 @@
#include "_5GMMCause.h"
#include "AuthenticationFailureParameter.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_FAILURE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -28,16 +51,16 @@
#define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1<<0)
#define AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_IEI 0x21
typedef struct authentication_failure_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GMMCause _5gmmcause;
uint32_t presence;
AuthenticationFailureParameter authenticationfailureparameter;
}authentication_failure_msg;
typedef struct authentication_failure_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GMMCause _5gmmcause;
uint32_t presence;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,50 +27,43 @@
#include "TLVDecoder.h"
#include "AuthenticationReject.h"
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);
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);
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
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) {
return decoded_result;
} else {
while(len-decoded>0){
uint8_t ieiDecoded = *(buffer+decoded);
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)
{
return decoded_result;
}
else{
decoded+=decoded_result;
authentication_reject->presence |= AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT;
}
decoded += decoded_result;
authentication_reject->presence |= AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT;
}
}
return decoded;
}
return decoded;
}
int encode_authentication_reject(authentication_reject_msg *authentication_reject, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
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);
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;
}
return encoded;
// 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)
return encoded_result;
else
encoded += encoded_result;
}
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef AUTHENTICATION_REJECT_H_
#define AUTHENTICATION_REJECT_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -5,7 +29,6 @@
#include "MessageType.h"
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_REJECT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -25,14 +48,15 @@
#define AUTHENTICATION_REJECT_EAP_MESSAGE_IEI 0x78
#define AUTHENTICATION_REJECT_EAP_MESSAGE_PRESENT (1<<0)
typedef struct authentication_reject_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
uint8_t presence;
EAPMessage eapmessage;
}authentication_reject_msg;
typedef struct authentication_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
uint8_t presence;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -7,107 +28,94 @@
#include "AuthenticationRequest.h"
#include "3gpp_24.501.h"
int decode_authentication_request( authentication_request_msg *authentication_request, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
int decode_authentication_request(authentication_request_msg *authentication_request, uint8_t *buffer, uint32_t len) {
uint32_t decoded = 0;
int decoded_result = 0;
//printf("decode_authentication_request len:%d\n", 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);
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;
//printf("naskeysetidentifier decoded_result:%d,tsc:%d\n", decoded_result, authentication_request->naskeysetidentifier.tsc);
decoded++;
if ((decoded_result = decode_abba (&authentication_request->abba,0 , buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
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) {
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
uint8_t ieiDecoded = *(buffer+decoded);
//printf("ieiDecoded(%x)\n",ieiDecoded);
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)
return decoded_result;
else{
decoded += decoded_result;
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)
return decoded_result;
else{
decoded += decoded_result;
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)
return decoded_result;
else{
decoded += decoded_result;
authentication_request->presence |= AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT;
}
uint8_t ieiDecoded = *(buffer + decoded);
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)
return decoded_result;
else {
decoded += decoded_result;
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)
return decoded_result;
else {
decoded += decoded_result;
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)
return decoded_result;
else {
decoded += decoded_result;
authentication_request->presence |= AUTHENTICATION_REQUEST_EAP_MESSAGE_PRESENT;
}
break;
}
}
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_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;
encoded ++;
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;
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;
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;
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;
encoded += encoded_result;
}
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef AUTHENTICATION_REQUEST_H_
#define AUTHENTICATION_REQUEST_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -9,7 +33,6 @@
#include "AuthenticationParameterAUTN.h"
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -19,12 +42,11 @@
NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH + \
0)
/*
AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH + \
AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH + \
EAP_MESSAGE_MINIMUM_LENGTH + \
0)
*/
EAP_MESSAGE_MINIMUM_LENGTH +
0)
*/
/* Maximum length macro. Formed by maximum length of each field */
#define AUTHENTICATION_REQUEST_MAXIMUM_LENGTH ( \
......@@ -45,18 +67,19 @@
#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;
SecurityHeaderType securityheadertype;
MessageType messagetype;
NASKeySetIdentifier naskeysetidentifier;
ABBA abba;
uint8_t presence;
AuthenticationParameterRAND authenticationparameterrand;
AuthenticationParameterAUTN authenticationparameterautn;
EAPMessage eapmessage;
}authentication_request_msg;
typedef struct authentication_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
NASKeySetIdentifier naskeysetidentifier;
ABBA abba;
uint8_t presence;
AuthenticationParameterRAND authenticationparameterrand;
AuthenticationParameterAUTN authenticationparameterautn;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,76 +27,64 @@
#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);
// uint8_t ieiDecoded = *(buffer+decoded);
// printf("ieiDecoded(%x)\n",ieiDecoded);
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, AUTHENTICATION_RESPONSE_MINIMUM_LENGTH, len);
while (len - decoded > 0) {
//printf("encoding ies left(%d)\n",len-decoded);
//printf("decoded(%d)\n",decoded);
uint8_t ieiDecoded = *(buffer+decoded);
printf("ieiDecoded(%x)\n",ieiDecoded);
if(ieiDecoded != AUTHENTICATION_RESPONSE_AUTHENTICATION_RESPONSE_PARAMETER_IEI && ieiDecoded != AUTHENTICATION_RESPONSE_EAP_MESSAGE_IEI)
uint8_t ieiDecoded = *(buffer + decoded);
printf("ieiDecoded(%x)\n", ieiDecoded);
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)
return decoded_result;
else{
decoded+=decoded_result;
printf("decoded(%d)\n",decoded);
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)
return decoded_result;
else{
decoded+=decoded_result;
authentication_response->presence |= AUTHENTICATION_RESPONSE_EAP_MESSAGE_PRESENT;
}
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)
return decoded_result;
else {
decoded += decoded_result;
printf("decoded(%d)\n", decoded);
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)
return decoded_result;
else {
decoded += decoded_result;
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_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;
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;
encoded += encoded_result;
}
printf("encoded encode_authentication_response\n");
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef AUTHENTICATION_RESPONSE_H_
#define AUTHENTICATION_RESPONSE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -6,7 +30,6 @@
#include "AuthenticationResponseParameter.h"
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define AUTHENTICATION_RESPONSE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -31,15 +54,16 @@
#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;
SecurityHeaderType securityheadertype;
MessageType messagetype;
uint8_t presence;
AuthenticationResponseParameter authenticationresponseparameter;
EAPMessage eapmessage;
}authentication_response_msg;
typedef struct authentication_response_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
uint8_t presence;
AuthenticationResponseParameter authenticationresponseparameter;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,76 +27,72 @@
#include "TLVDecoder.h"
#include "AuthenticationResult.h"
int decode_authentication_result( authentication_result_msg *authentication_result, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
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);
if ((decoded_result = decode_u8_nas_key_set_identifier (&authentication_result->naskeysetidentifier, 0, *(buffer + decoded) >> 4, len - decoded)) < 0)
return decoded_result;
decoded++;
// 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_eap_message (&authentication_result->eapmessage, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
while(len-decoded>0){
uint8_t ieiDecoded = *(buffer+decoded);
printf("ieiDecoded:0x%x\n", ieiDecoded);
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)
return decoded_result;
else{
decoded+=decoded_result;
authentication_result->presence |= AUTHENTICATION_RESULT_ABBA_PRESENT;
}
}
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)
return decoded_result;
else
decoded += decoded_result;
while (len - decoded > 0) {
uint8_t ieiDecoded = *(buffer + decoded);
printf("ieiDecoded:0x%x\n", ieiDecoded);
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)
return decoded_result;
else {
decoded += decoded_result;
authentication_result->presence |= AUTHENTICATION_RESULT_ABBA_PRESENT;
}
}
/*
if ((decoded_result = decode_abba (&authentication_result->abba,0 , buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
*/
return decoded;
}
/*
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) {
uint32_t encoded = 0;
int encoded_result = 0;
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;
encoded ++;
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)
return encoded_result;
else
encoded+=encoded_result;
}
/*
if((encoded_result = encode_abba (authentication_result->abba,0, buffer+encoded,len-encoded))<0)
return encoded_result;
*(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)
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)
return encoded_result;
else
encoded+=encoded_result;
*/
return encoded;
encoded += encoded_result;
}
/*
if((encoded_result = encode_abba (authentication_result->abba,0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
*/
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef AUTHENTICATION_RESULT_H_
#define AUTHENTICATION_RESULT_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -29,16 +53,17 @@
#define AUTHENTICATION_RESULT_ABBA_IEI 0x38
#define AUTHENTICATION_RESULT_ABBA_PRESENT (1<<0)
typedef struct authentication_result_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
NASKeySetIdentifier naskeysetidentifier;
EAPMessage eapmessage;
uint8_t presence;
ABBA abba;
}authentication_result_msg;
typedef struct authentication_result_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
NASKeySetIdentifier naskeysetidentifier;
EAPMessage eapmessage;
uint8_t presence;
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);
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef CONFIGURATION_UPDATE_COMMAND_H_
#define CONFIGURATION_UPDATE_COMMAND_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -19,7 +43,6 @@
#include "OperatorDefinedAccessCategoryDefinitions.h"
#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 + \
......@@ -64,27 +87,28 @@
SMS_INDICATION_MAXIMUM_LENGTH + \
0)
typedef struct configuration_update_command_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
ConfigurationUpdateIndication configurationupdateindication;
_5GSMobileIdentity _5gsmobileidentity;
_5GSTrackingAreaIdentityList _5gstrackingareaidentitylist;
NSSAI nssai;
ServiceAreaList servicearealist;
NetworkName networkname;
TimeZone timezone;
TimeZoneAndTime timezoneandtime;
DaylightSavingTime daylightsavingtime;
LADNInformation ladninformation;
MICOIndication micoindication;
NetworkSlicingIndication networkslicingindication;
RejectedNSSAI rejectednssai;
OperatorDefinedAccessCategoryDefinitions operatordefinedaccesscategorydefinitions;
SMSIndication smsindication;
}configuration_update_command_msg;
typedef struct configuration_update_command_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
ConfigurationUpdateIndication configurationupdateindication;
_5GSMobileIdentity _5gsmobileidentity;
_5GSTrackingAreaIdentityList _5gstrackingareaidentitylist;
NSSAI nssai;
ServiceAreaList servicearealist;
NetworkName networkname;
TimeZone timezone;
TimeZoneAndTime timezoneandtime;
DaylightSavingTime daylightsavingtime;
LADNInformation ladninformation;
MICOIndication micoindication;
NetworkSlicingIndication networkslicingindication;
RejectedNSSAI rejectednssai;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,57 +27,52 @@
#include "TLVDecoder.h"
#include "ConfigurationUpdateComplete.h"
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);
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;
if((decoded_result = decode_extended_protocol_discriminator (&configuration_update_complete->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
// 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_security_header_type (&configuration_update_complete->securityheadertype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
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_message_type (&configuration_update_complete->messagetype, 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)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_message_type(&configuration_update_complete->messagetype, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
return decoded;
}
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;
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);
if((encoded_result = encode_extended_protocol_discriminator (configuration_update_complete->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CONFIGURATION_UPDATE_COMPLETE_MINIMUM_LENGTH, len);
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_extended_protocol_discriminator(configuration_update_complete->extendedprotocoldiscriminator, 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)
return encoded_result;
else
encoded+=encoded_result;
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)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef CONFIGURATION_UPDATE_COMPLETE_H_
#define CONFIGURATION_UPDATE_COMPLETE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#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 + \
......@@ -19,12 +42,13 @@
MESSAGE_TYPE_MAXIMUM_LENGTH + \
0)
typedef struct configuration_update_complete_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
}configuration_update_complete_msg;
typedef struct configuration_update_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,117 +27,112 @@
#include "TLVDecoder.h"
#include "DLNASTransport.h"
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);
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)
return decoded_result;
else
decoded+=decoded_result;
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)
return decoded_result;
else
decoded+=decoded_result;
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)
return decoded_result;
else
decoded+=decoded_result;
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)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode_gprs_timer3 (&dlnas_transport->gprstimer3, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
return decoded;
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);
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)
return decoded_result;
else
decoded += decoded_result;
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)
return decoded_result;
else
decoded += decoded_result;
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)
return decoded_result;
else
decoded += decoded_result;
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)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_gprs_timer3(&dlnas_transport->gprstimer3, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
}
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);
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)
return encoded_result;
else
encoded+=encoded_result;
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)
return encoded_result;
else
encoded+=encoded_result;
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)
return encoded_result;
else
encoded+=encoded_result;
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)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode_gprs_timer3 (dlnas_transport->gprstimer3, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
return encoded;
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);
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)
return encoded_result;
else
encoded += encoded_result;
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)
return encoded_result;
else
encoded += encoded_result;
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)
return encoded_result;
else
encoded += encoded_result;
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)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_gprs_timer3(dlnas_transport->gprstimer3, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef DLNAS_TRANSPORT_H_
#define DLNAS_TRANSPORT_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -10,7 +34,6 @@
#include "_5GMMCause.h"
#include "GPRSTimer3.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DLNAS_TRANSPORT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -37,18 +60,19 @@
GPRS_TIMER3_MAXIMUM_LENGTH + \
0)
typedef struct dlnas_transport_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
PayloadContainerType payloadcontainertype;
PayloadContainer payloadcontainer;
PDUSessionIdentity2 pdusessionidentity2;
AdditionalInformation additionalinformation;
_5GMMCause _5gmmcause;
GPRSTimer3 gprstimer3;
}dlnas_transport_msg;
typedef struct dlnas_transport_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
PayloadContainerType payloadcontainertype;
PayloadContainer payloadcontainer;
PDUSessionIdentity2 pdusessionidentity2;
AdditionalInformation additionalinformation;
_5GMMCause _5gmmcause;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,57 +27,52 @@
#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_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;
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;
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;
decoded += decoded_result;
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_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;
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;
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;
encoded += encoded_result;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef DEREGISTRATION_ACCEPT_H_
#define DEREGISTRATION_ACCEPT_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
#include "SecurityHeaderType.h"
#include "MessageType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DEREGISTRATION_ACCEPT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -19,12 +42,13 @@
MESSAGE_TYPE_MAXIMUM_LENGTH + \
0)
typedef struct deregistration_accept_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
}deregistration_accept_msg;
typedef struct deregistration_accept_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,86 +27,84 @@
#include "TLVDecoder.h"
#include "DeregistrationRequest.h"
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;
// 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
decoded+=decoded_result;
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)
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
decoded+=decoded_result;
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
decoded+=decoded_result;
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
decoded+=decoded_result;
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
decoded+=decoded_result;
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
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;
// 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
encoded+=encoded_result;
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)
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
encoded+=encoded_result;
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
encoded+=encoded_result;
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
encoded+=encoded_result;
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
encoded+=encoded_result;
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
encoded+=encoded_result;
*/
return encoded;
......
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef DEREGISTRATION_REQUEST_H_
#define DEREGISTRATION_REQUEST_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -7,7 +31,6 @@
#include "NASKeySetIdentifier.h"
#include "_5GSMobileIdentity.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define DEREGISTRATION_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -28,15 +51,16 @@
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
0)
typedef struct deregistration_request_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
DeregistrationType deregistrationtype;
NASKeySetIdentifier naskeysetidentifier;
_5GSMobileIdentity _5gsmobileidentity;
}deregistration_request_msg;
typedef struct deregistration_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
DeregistrationType deregistrationtype;
NASKeySetIdentifier naskeysetidentifier;
_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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,37 +27,32 @@
#include "TLVDecoder.h"
#include "IdentityRequest.h"
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);
int decode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len) {
uint32_t decoded = 0;
int decoded_result = 0;
if((decoded_result = decode__5gs_identity_type (&identity_request->_5gsidentitytype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
// 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)
return decoded_result;
else
decoded += decoded_result;
return decoded;
return decoded;
}
int encode_identity_request(identity_request_msg *identity_request, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
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);
if((encoded_result = encode__5gs_identity_type (identity_request->_5gsidentitytype, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IDENTITY_REQUEST_MINIMUM_LENGTH, len);
if ((encoded_result = encode__5gs_identity_type(identity_request->_5gsidentitytype, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef IDENTITY_REQUEST_H_
#define IDENTITY_REQUEST_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -5,7 +29,6 @@
#include "MessageType.h"
#include "_5GSIdentityType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define IDENTITY_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -22,13 +45,14 @@
_5GS_IDENTITY_TYPE_MAXIMUM_LENGTH + \
0)
typedef struct identity_request_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GSIdentityType _5gsidentitytype;
}identity_request_msg;
typedef struct identity_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,69 +27,62 @@
#include "TLVDecoder.h"
#include "IdentityResponse.h"
int decode_identity_response( identity_response_msg *identity_response, uint8_t* buffer, uint32_t len)
{
uint32_t decoded = 0;
int decoded_result = 0;
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)
return decoded_result;
else
decoded+=decoded_result;
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)
return decoded_result;
else
decoded+=decoded_result;
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)
return decoded_result;
else
decoded+=decoded_result;
if((decoded_result = decode__5gs_mobile_identity (&identity_response->_5gsmobileidentity, 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)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode__5gs_mobile_identity(&identity_response->_5gsmobileidentity, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
return decoded;
}
int encode_identity_response(identity_response_msg *identity_response, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
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)
return encoded_result;
else
encoded+=encoded_result;
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)
return encoded_result;
else
encoded+=encoded_result;
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)
return encoded_result;
else
encoded+=encoded_result;
if((encoded_result = encode__5gs_mobile_identity (identity_response->_5gsmobileidentity, 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)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode__5gs_mobile_identity(identity_response->_5gsmobileidentity, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef IDENTITY_RESPONSE_H_
#define IDENTITY_RESPONSE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -5,7 +29,6 @@
#include "MessageType.h"
#include "_5GSMobileIdentity.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define IDENTITY_RESPONSE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -22,13 +45,14 @@
_5GS_MOBILE_IDENTITY_MAXIMUM_LENGTH + \
0)
typedef struct identity_response_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GSMobileIdentity _5gsmobileidentity;
}identity_response_msg;
typedef struct identity_response_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,67 +27,62 @@
#include "TLVDecoder.h"
#include "Notification.h"
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);
int decode_notification(notification_msg *notification, uint8_t *buffer, uint32_t len) {
uint32_t decoded = 0;
int decoded_result = 0;
if((decoded_result = decode_extended_protocol_discriminator (&notification->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
// 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_security_header_type (&notification->securityheadertype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
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_message_type (&notification->messagetype, 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)
return decoded_result;
else
decoded += decoded_result;
if((decoded_result = decode__access_type (&notification->_accesstype, 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)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode__access_type(&notification->_accesstype, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
return decoded;
}
int encode_notification(notification_msg *notification, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
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);
if((encoded_result = encode_extended_protocol_discriminator (notification->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NOTIFICATION_MINIMUM_LENGTH, len);
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_extended_protocol_discriminator(notification->extendedprotocoldiscriminator, 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)
return encoded_result;
else
encoded+=encoded_result;
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__access_type (notification->_accesstype, 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)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode__access_type(notification->_accesstype, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NOTIFICATION_H_
#define NOTIFICATION_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -5,7 +29,6 @@
#include "MessageType.h"
#include "_AccessType.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define NOTIFICATION_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -22,13 +45,14 @@
_ACCESS_TYPE_MAXIMUM_LENGTH + \
0)
typedef struct notification_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_AccessType _accesstype;
}notification_msg;
typedef struct notification_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,67 +27,62 @@
#include "TLVDecoder.h"
#include "NotificationResponse.h"
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);
int decode_notification_response(notification_response_msg *notification_response, uint8_t *buffer, uint32_t len) {
uint32_t decoded = 0;
int decoded_result = 0;
if((decoded_result = decode_extended_protocol_discriminator (&notification_response->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
// 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_security_header_type (&notification_response->securityheadertype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
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_message_type (&notification_response->messagetype, 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)
return decoded_result;
else
decoded += decoded_result;
if((decoded_result = decode_pdu_session_status (&notification_response->pdusessionstatus, 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)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_pdu_session_status(&notification_response->pdusessionstatus, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
return decoded;
}
int encode_notification_response(notification_response_msg *notification_response, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
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);
if((encoded_result = encode_extended_protocol_discriminator (notification_response->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NOTIFICATION_RESPONSE_MINIMUM_LENGTH, len);
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_extended_protocol_discriminator(notification_response->extendedprotocoldiscriminator, 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)
return encoded_result;
else
encoded+=encoded_result;
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_pdu_session_status (notification_response->pdusessionstatus, 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)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_pdu_session_status(notification_response->pdusessionstatus, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef NOTIFICATION_RESPONSE_H_
#define NOTIFICATION_RESPONSE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -5,7 +29,6 @@
#include "MessageType.h"
#include "PDUSessionStatus.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define NOTIFICATION_RESPONSE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -22,13 +45,14 @@
PDU_SESSION_STATUS_MAXIMUM_LENGTH + \
0)
typedef struct notification_response_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
PDUSessionStatus pdusessionstatus;
}notification_response_msg;
typedef struct notification_response_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
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);
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef REGISTRATION_ACCEPT_H_
#define REGISTRATION_ACCEPT_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -27,7 +51,6 @@
#include "OperatorDefinedAccessCategoryDefinitions.h"
#include "_5GSDRXParameters.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_ACCEPT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -88,7 +111,6 @@
_5GSDRX_PARAMETERS_MAXIMUM_LENGTH + \
0)
#define REGISTRATION_ACCEPT_5GS_MOBILE_IDENTITY_IEI 0x77
#define REGISTRATION_ACCEPT_5GS_MOBILE_IDENTITY_PRESENT (uint32_t)(1<<0)
......@@ -161,40 +183,40 @@
#define REGISTRATION_ACCEPT_5GS_DRX_PARAMETERS_IEI 0x51
#define REGISTRATION_ACCEPT_5GS_DRX_PARAMETERS_PRESENT (uint32_t)(1<<23)
typedef struct registration_accept_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GSRegistrationResult _5gsregistrationresult;
uint32_t presence;
//_5GSMobileIdentity _5gsmobileidentity;
PLMNList plmnlist;
_5GSTrackingAreaIdentityList _5gstrackingareaidentitylist;
//NSSAI allowednssai;
//RejectedNSSAI rejectednssai;
//NSSAI configurednssai;
_5GSNetworkFeatureSupport _5gsnetworkfeaturesupport;
PDUSessionStatus pdusessionstatus;
PDUSessionReactivationResult pdusessionreactivationresult;
PDUSessionReactivationResultErrorCause pdusessionreactivationresulterrorcause;
//LADNInformation ladninformation;
MICOIndication micoindication;
NetworkSlicingIndication networkslicingindication;
ServiceAreaList servicearealist;
GPRSTimer3 t3512;
GPRSTimer2 non_3gpp_deregistration_timer;
GPRSTimer2 t3502;
//EmergencyNumberList emergencynumberlist;
//ExtendedEmergencyNumberList extendedemergencynumberlist;
//SORTransparentContainer sortransparentcontainer;
EAPMessage eapmessage;
NSSAIInclusionMode nssaiinclusionmode;
//OperatorDefinedAccessCategoryDefinitions operatordefinedaccesscategorydefinitions;
_5GSDRXParameters _5gsdrxparameters;
//Non_3GPP_NW_Provided_Policies non_3gpp_nw_policies;
}registration_accept_msg;
typedef struct registration_accept_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GSRegistrationResult _5gsregistrationresult;
uint32_t presence;
//_5GSMobileIdentity _5gsmobileidentity;
PLMNList plmnlist;
_5GSTrackingAreaIdentityList _5gstrackingareaidentitylist;
//NSSAI allowednssai;
//RejectedNSSAI rejectednssai;
//NSSAI configurednssai;
_5GSNetworkFeatureSupport _5gsnetworkfeaturesupport;
PDUSessionStatus pdusessionstatus;
PDUSessionReactivationResult pdusessionreactivationresult;
PDUSessionReactivationResultErrorCause pdusessionreactivationresulterrorcause;
//LADNInformation ladninformation;
MICOIndication micoindication;
NetworkSlicingIndication networkslicingindication;
ServiceAreaList servicearealist;
GPRSTimer3 t3512;
GPRSTimer2 non_3gpp_deregistration_timer;
GPRSTimer2 t3502;
//EmergencyNumberList emergencynumberlist;
//ExtendedEmergencyNumberList extendedemergencynumberlist;
//SORTransparentContainer sortransparentcontainer;
EAPMessage eapmessage;
NSSAIInclusionMode nssaiinclusionmode;
//OperatorDefinedAccessCategoryDefinitions operatordefinedaccesscategorydefinitions;
_5GSDRXParameters _5gsdrxparameters;
//Non_3GPP_NW_Provided_Policies non_3gpp_nw_policies;
} registration_accept_msg;
int decode_registration_accept(registration_accept_msg *registrationaccept, uint8_t *buffer, uint32_t len);
int encode_registration_accept(registration_accept_msg *registrationaccept, uint8_t *buffer, uint32_t len);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,67 +27,62 @@
#include "TLVDecoder.h"
#include "RegistrationComplete.h"
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);
int decode_registration_complete(registration_complete_msg *registration_complete, uint8_t *buffer, uint32_t len) {
uint32_t decoded = 0;
int decoded_result = 0;
if((decoded_result = decode_extended_protocol_discriminator (&registration_complete->extendedprotocoldiscriminator, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
// 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_security_header_type (&registration_complete->securityheadertype, 0, buffer+decoded,len-decoded))<0)
return decoded_result;
else
decoded+=decoded_result;
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_message_type (&registration_complete->messagetype, 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)
return decoded_result;
else
decoded += decoded_result;
if((decoded_result = decode_sor_transparent_container (&registration_complete->sortransparentcontainer, 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)
return decoded_result;
else
decoded += decoded_result;
if ((decoded_result = decode_sor_transparent_container(&registration_complete->sortransparentcontainer, 0, buffer + decoded, len - decoded)) < 0)
return decoded_result;
else
decoded += decoded_result;
return decoded;
return decoded;
}
int encode_registration_complete(registration_complete_msg *registration_complete, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encoded_result = 0;
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);
if((encoded_result = encode_extended_protocol_discriminator (registration_complete->extendedprotocoldiscriminator, 0, buffer+encoded,len-encoded))<0)
return encoded_result;
else
encoded+=encoded_result;
// Check if we got a NULL pointer and if buffer length is >= minimum length expected for the message.
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, REGISTRATION_COMPLETE_MINIMUM_LENGTH, len);
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_extended_protocol_discriminator(registration_complete->extendedprotocoldiscriminator, 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)
return encoded_result;
else
encoded+=encoded_result;
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_sor_transparent_container (registration_complete->sortransparentcontainer, 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)
return encoded_result;
else
encoded += encoded_result;
if ((encoded_result = encode_sor_transparent_container(registration_complete->sortransparentcontainer, 0, buffer + encoded, len - encoded)) < 0)
return encoded_result;
else
encoded += encoded_result;
return encoded;
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef REGISTRATION_COMPLETE_H_
#define REGISTRATION_COMPLETE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -5,7 +29,6 @@
#include "MessageType.h"
#include "SORTransparentContainer.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_COMPLETE_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -22,13 +45,14 @@
SOR_TRANSPARENT_CONTAINER_MAXIMUM_LENGTH + \
0)
typedef struct registration_complete_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
SORTransparentContainer sortransparentcontainer;
}registration_complete_msg;
typedef struct registration_complete_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
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);
#endif
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
......@@ -6,92 +27,85 @@
#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_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;
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))
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)
return decoded_result;
else{
decoded+=decoded_result;
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)
return decoded_result;
else{
decoded+=decoded_result;
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)
return decoded_result;
else{
decoded+=decoded_result;
registration_reject->presence |= REGISTRATION_REJECT_EAP_MESSAGE_PRESENT;
}
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))
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)
return decoded_result;
else {
decoded += decoded_result;
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)
return decoded_result;
else {
decoded += decoded_result;
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)
return decoded_result;
else {
decoded += decoded_result;
registration_reject->presence |= REGISTRATION_REJECT_EAP_MESSAGE_PRESENT;
}
break;
}
}
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_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;
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;
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;
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;
encoded += encoded_result;
}
return encoded;
}
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef REGISTRATION_REJECT_H_
#define REGISTRATION_REJECT_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -7,7 +31,6 @@
#include "GPRSTimer2.h"
#include "EAPMessage.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_REJECT_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -37,18 +60,19 @@
#define REGISTRATION_REJECT_EAP_MESSAGE_IEI 0x78
#define REGISTRATION_REJECT_EAP_MESSAGE_PRESENT (1<<2)
typedef struct registration_reject_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GMMCause _5gmmcause;
uint8_t presence;
GPRSTimer2 t3346;
GPRSTimer2 t3502;
EAPMessage eapmessage;
}registration_reject_msg;
typedef struct registration_reject_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GMMCause _5gmmcause;
uint8_t presence;
GPRSTimer2 t3346;
GPRSTimer2 t3502;
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);
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef REGISTRATION_REQUEST_H_
#define REGISTRATION_REQUEST_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -26,7 +50,6 @@
#include "_5GSUpdateType.h"
#include "NASMessageContainer.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define REGISTRATION_REQUEST_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -127,37 +150,38 @@
#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;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GSRegistrationType _5gsregistrationtype;
NASKeySetIdentifier naskeysetidentifier;
//_5GSMobileIdentity _5gsmobileidentity;
uint32_t presence;
NASKeySetIdentifier non_current_native_nas_key_set_identifier;
_5GMMCapability _5gmmcapability;
UESecurityCapability uesecuritycapability;
//NSSAI nssai;
_5GSTrackingAreaIdentity _5gstrackingareaidentity;
S1UENetworkCapability s1uenetworkcapability;
UplinkDataStatus uplinkdatastatus;
PDUSessionStatus pdusessionstatus;
MICOIndication micoindication;
UEStatus uestatus;
//_5GSMobileIdentity AdditionalGUTI;
AllowedPDUSessionStatus allowedpdusessionstatus;
UESUsageSetting uesusagesetting;
_5GSDRXParameters _5gsdrxparameters;
EPSNASMessageContainer epsnasmessagecontainer;
//LADNIndication ladnindication;
PayloadContainerType payloadcontainertype;
PayloadContainer payloadcontainer;
NetworkSlicingIndication networkslicingindication;
_5GSUpdateType _5gsupdatetype;
NASMessageContainer nasmessagecontainer;
}registration_request_msg;
typedef struct registration_request_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
_5GSRegistrationType _5gsregistrationtype;
NASKeySetIdentifier naskeysetidentifier;
//_5GSMobileIdentity _5gsmobileidentity;
uint32_t presence;
NASKeySetIdentifier non_current_native_nas_key_set_identifier;
_5GMMCapability _5gmmcapability;
UESecurityCapability uesecuritycapability;
//NSSAI nssai;
_5GSTrackingAreaIdentity _5gstrackingareaidentity;
S1UENetworkCapability s1uenetworkcapability;
UplinkDataStatus uplinkdatastatus;
PDUSessionStatus pdusessionstatus;
MICOIndication micoindication;
UEStatus uestatus;
//_5GSMobileIdentity AdditionalGUTI;
AllowedPDUSessionStatus allowedpdusessionstatus;
UESUsageSetting uesusagesetting;
_5GSDRXParameters _5gsdrxparameters;
EPSNASMessageContainer epsnasmessagecontainer;
//LADNIndication ladnindication;
PayloadContainerType payloadcontainertype;
PayloadContainer payloadcontainer;
NetworkSlicingIndication networkslicingindication;
_5GSUpdateType _5gsupdatetype;
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);
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef SECURITY_MODE_COMMAND_H_
#define SECURITY_MODE_COMMAND_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -13,7 +37,6 @@
#include "ABBA.h"
#include "S1UESecurityCapability.h"
/* Minimum length macro. Formed by minimum length of each mandatory field */
#define SECURITY_MODE_COMMAND_MINIMUM_LENGTH ( \
EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH + \
......@@ -46,7 +69,6 @@
S1_UE_SECURITY_CAPABILITY_MAXIMUM_LENGTH + \
0)
#define SECURITY_MODE_COMMAND_IMEISV_REQUEST_IEI 0xE0
#define SECURITY_MODE_COMMAND_IMEISV_REQUEST_PRESENT (1<<0)
#define SECURITY_MODE_COMMAND_EPS_NAS_SECURITY_ALGORITHMS_IEI 0x57
......@@ -60,26 +82,23 @@
#define SECURITY_MODE_COMMAND_S1_UE_SECURITY_CAPABILITY_IEI 0x19
#define SECURITY_MODE_COMMAND_S1_UE_SECURITY_CAPABILITY_PRESENT (1<<5)
typedef struct security_mode_command_msg_tag{
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
NASSecurityAlgorithms nassecurityalgorithms;
NASKeySetIdentifier naskeysetidentifier;
UESecurityCapability uesecuritycapability;
uint8_t presence;
IMEISVRequest imeisvrequest;
EPSNASSecurityAlgorithms epsnassecurityalgorithms;
Additional5GSecurityInformation additional5gsecurityinformation;
EAPMessage eapmessage;
ABBA abba;
//S1UESecurityCapability s1uesecuritycapability;
}security_mode_command_msg;
typedef struct security_mode_command_msg_tag {
ExtendedProtocolDiscriminator extendedprotocoldiscriminator;
SecurityHeaderType securityheadertype;
MessageType messagetype;
NASSecurityAlgorithms nassecurityalgorithms;
NASKeySetIdentifier naskeysetidentifier;
UESecurityCapability uesecuritycapability;
uint8_t presence;
IMEISVRequest imeisvrequest;
EPSNASSecurityAlgorithms epsnassecurityalgorithms;
Additional5GSecurityInformation additional5gsecurityinformation;
EAPMessage eapmessage;
ABBA abba;
//S1UESecurityCapability s1uesecuritycapability;
} security_mode_command_msg;
int decode_security_mode_command(security_mode_command_msg *securitymodecommand, uint8_t *buffer, uint32_t len);
int encode_security_mode_command(security_mode_command_msg *securitymodecommand, uint8_t *buffer, uint32_t len);
#endif
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* 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
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef SECURITY_MODE_COMPLETE_H_
#define SECURITY_MODE_COMPLETE_H_
#include <stdint.h>
#include "ExtendedProtocolDiscriminator.h"
......@@ -6,7 +30,6 @@
#include "_5GSMobileIdentity.h"
#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 + \
......@@ -30,16 +53,16 @@
#define SECURITY_MODE_COMPLETE_NAS_MESSAGE_CONTAINER_IEI 0x71
#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;
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);
#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.
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.
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