Commit 6937f31e authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Code cleanup NAS IEs

parent eecbab92
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,16 +19,16 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ABBA.h"
int encode_abba(ABBA abba, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_abba(ABBA abba, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ABBA_MINIMUM_LENGTH, len);
......@@ -38,13 +38,11 @@ int encode_abba(ABBA abba, uint8_t iei, uint8_t *buffer, uint32_t len) {
encoded++;
}
// *buffer = iei;
// encoded++;
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(abba, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(abba, buffer + encoded, len - encoded)) <
0)
return encode_result;
else
encoded += encode_result;
......@@ -53,8 +51,8 @@ int encode_abba(ABBA abba, uint8_t iei, uint8_t *buffer, uint32_t len) {
return encoded;
}
int decode_abba(ABBA *abba, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_abba(ABBA* abba, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -67,10 +65,10 @@ int decode_abba(ABBA *abba, uint8_t iei, uint8_t *buffer, uint32_t len) {
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(abba, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result =
decode_bstring(abba, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,7 +29,7 @@
typedef bstring ABBA;
int encode_abba(ABBA abba, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_abba(ABBA *abba, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_abba(ABBA abba, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_abba(ABBA* abba, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "Additional5GSecurityInformation.h"
int encode_additional_5g_security_information(Additional5GSecurityInformation additional5gsecurityinformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
uint32_t encoded = 0;
int encode_additional_5g_security_information(
Additional5GSecurityInformation additional5gsecurityinformation,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ADDITIONAL_5G_SECURITY_INFORMATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ADDITIONAL_5G_SECURITY_INFORMATION_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,10 +44,8 @@ int encode_additional_5g_security_information(Additional5GSecurityInformation ad
lenPtr = (buffer + encoded);
encoded++;
if (additional5gsecurityinformation.rinmr)
bitStream |= 0x02;
if (additional5gsecurityinformation.hdp)
bitStream |= 0x01;
if (additional5gsecurityinformation.rinmr) bitStream |= 0x02;
if (additional5gsecurityinformation.hdp) bitStream |= 0x01;
ENCODE_U8(buffer + encoded, bitStream, encoded);
......@@ -52,9 +53,11 @@ int encode_additional_5g_security_information(Additional5GSecurityInformation ad
return encoded;
}
int decode_additional_5g_security_information(Additional5GSecurityInformation *additional5gsecurityinformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_additional_5g_security_information(
Additional5GSecurityInformation* additional5gsecurityinformation,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
uint8_t bitStream = 0x0;
if (iei > 0) {
......@@ -79,4 +82,3 @@ int decode_additional_5g_security_information(Additional5GSecurityInformation *a
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -40,7 +40,11 @@ typedef struct {
bool rinmr;
} Additional5GSecurityInformation;
int encode_additional_5g_security_information(Additional5GSecurityInformation additional5gsecurityinformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_additional_5g_security_information(Additional5GSecurityInformation *additional5gsecurityinformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_additional_5g_security_information(
Additional5GSecurityInformation additional5gsecurityinformation,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_additional_5g_security_information(
Additional5GSecurityInformation* additional5gsecurityinformation,
uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AdditionalInformation.h"
int encode_additional_information(AdditionalInformation additionalinformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_additional_information(
AdditionalInformation additionalinformation, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ADDITIONAL_INFORMATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ADDITIONAL_INFORMATION_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,7 +44,8 @@ int encode_additional_information(AdditionalInformation additionalinformation, u
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(additionalinformation, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
additionalinformation, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -50,8 +54,10 @@ int encode_additional_information(AdditionalInformation additionalinformation, u
return encoded;
}
int decode_additional_information(AdditionalInformation *additionalinformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_additional_information(
AdditionalInformation* additionalinformation, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -64,10 +70,10 @@ int decode_additional_information(AdditionalInformation *additionalinformation,
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(additionalinformation, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
additionalinformation, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring AdditionalInformation;
int encode_additional_information(AdditionalInformation additionalinformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_additional_information(AdditionalInformation *additionalinformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_additional_information(
AdditionalInformation additionalinformation, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_additional_information(
AdditionalInformation* additionalinformation, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,18 +19,21 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AllowedPDUSessionStatus.h"
int encode_allowed_pdu_session_status(AllowedPDUSessionStatus allowedpdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_allowed_pdu_session_status(
AllowedPDUSessionStatus allowedpdusessionstatus, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ALLOWED_PDU_SESSION_STATUS_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ALLOWED_PDU_SESSION_STATUS_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -46,8 +49,10 @@ int encode_allowed_pdu_session_status(AllowedPDUSessionStatus allowedpdusessions
return encoded;
}
int decode_allowed_pdu_session_status(AllowedPDUSessionStatus *allowedpdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_allowed_pdu_session_status(
AllowedPDUSessionStatus* allowedpdusessionstatus, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
if (iei > 0) {
......@@ -63,4 +68,3 @@ int decode_allowed_pdu_session_status(AllowedPDUSessionStatus *allowedpdusession
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef uint8_t AllowedPDUSessionStatus;
int encode_allowed_pdu_session_status(AllowedPDUSessionStatus allowedpdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_allowed_pdu_session_status(AllowedPDUSessionStatus *allowedpdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_allowed_pdu_session_status(
AllowedPDUSessionStatus allowedpdusessionstatus, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_allowed_pdu_session_status(
AllowedPDUSessionStatus* allowedpdusessionstatus, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,18 +19,20 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AllowedSSCMode.h"
int encode_allowed_ssc_mode(AllowedSSCMode allowedsscmode, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_allowed_ssc_mode(
AllowedSSCMode allowedsscmode, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0x00;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ALLOWED_SSC_MODE_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ALLOWED_SSC_MODE_MINIMUM_LENGTH, len);
if (iei > 0) {
bitStream |= (iei & 0xf0);
......@@ -51,8 +53,10 @@ int encode_allowed_ssc_mode(AllowedSSCMode allowedsscmode, uint8_t iei, uint8_t
return encoded;
}
int decode_allowed_ssc_mode(AllowedSSCMode *allowedsscmode, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_allowed_ssc_mode(
AllowedSSCMode* allowedsscmode, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t bitStream = 0x00;
DECODE_U8(buffer + decoded, bitStream, decoded);
......@@ -82,4 +86,3 @@ int decode_allowed_ssc_mode(AllowedSSCMode *allowedsscmode, uint8_t iei, uint8_t
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,21 +29,23 @@
#define ALLOWED_SSC_MODE_MINIMUM_LENGTH 1
#define ALLOWED_SSC_MODE_MAXIMUM_LENGTH 1
#define SSC_MODE1_NOT_ALLOWED 0
#define SSC_MODE1_ALLOWED 1
#define SSC_MODE2_NOT_ALLOWED 0
#define SSC_MODE2_ALLOWED 1
#define SSC_MODE3_NOT_ALLOWED 0
#define SSC_MODE3_ALLOWED 1
#define SSC_MODE1_NOT_ALLOWED 0
#define SSC_MODE1_ALLOWED 1
#define SSC_MODE2_NOT_ALLOWED 0
#define SSC_MODE2_ALLOWED 1
#define SSC_MODE3_NOT_ALLOWED 0
#define SSC_MODE3_ALLOWED 1
//typedef bstring AllowedSSCMode;
// typedef bstring AllowedSSCMode;
typedef struct {
bool is_ssc1_allowed;
bool is_ssc2_allowed;
bool is_ssc3_allowed;
} AllowedSSCMode;
int encode_allowed_ssc_mode(AllowedSSCMode allowedsscmode, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_allowed_ssc_mode(AllowedSSCMode *allowedsscmode, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_allowed_ssc_mode(
AllowedSSCMode allowedsscmode, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_allowed_ssc_mode(
AllowedSSCMode* allowedsscmode, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,34 +19,38 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AlwaysonPDUSessionIndication.h"
int encode_alwayson_pdu_session_indication(AlwaysonPDUSessionIndication alwaysonpdusessionindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_alwayson_pdu_session_indication(
AlwaysonPDUSessionIndication alwaysonpdusessionindication, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ALWAYSON_PDU_SESSION_INDICATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ALWAYSON_PDU_SESSION_INDICATION_MINIMUM_LENGTH, len);
if (iei > 0) {
bitStream = iei & 0xf0;
}
if (alwaysonpdusessionindication.apsi_indication)
bitStream |= 0x01;
if (alwaysonpdusessionindication.apsi_indication) bitStream |= 0x01;
ENCODE_U8(buffer + encoded, bitStream, encoded);
return encoded;
}
int decode_alwayson_pdu_session_indication(AlwaysonPDUSessionIndication *alwaysonpdusessionindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_alwayson_pdu_session_indication(
AlwaysonPDUSessionIndication* alwaysonpdusessionindication, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t bitStream = 0;
DECODE_U8(buffer + decoded, bitStream, decoded);
......@@ -66,4 +70,3 @@ int decode_alwayson_pdu_session_indication(AlwaysonPDUSessionIndication *alwayso
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,14 +29,18 @@
#define ALWAYSON_PDU_SESSION_INDICATION_MINIMUM_LENGTH 1
#define ALWAYSON_PDU_SESSION_INDICATION_MAXIMUM_LENGTH 1
#define ALWAYSON_PDU_SESSION_NOT_ALLOWED 0
#define ALWAYSON_PDU_SESSION_REQUIRED 1
#define ALWAYSON_PDU_SESSION_NOT_ALLOWED 0
#define ALWAYSON_PDU_SESSION_REQUIRED 1
typedef struct {
bool apsi_indication;
} AlwaysonPDUSessionIndication;
int encode_alwayson_pdu_session_indication(AlwaysonPDUSessionIndication alwaysonpdusessionindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_alwayson_pdu_session_indication(AlwaysonPDUSessionIndication *alwaysonpdusessionindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_alwayson_pdu_session_indication(
AlwaysonPDUSessionIndication alwaysonpdusessionindication, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_alwayson_pdu_session_indication(
AlwaysonPDUSessionIndication* alwaysonpdusessionindication, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,34 +19,38 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AlwaysonPDUSessionRequested.h"
int encode_alwayson_pdu_session_requested(AlwaysonPDUSessionRequested alwaysonpdusessionrequested, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_alwayson_pdu_session_requested(
AlwaysonPDUSessionRequested alwaysonpdusessionrequested, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ALWAYSON_PDU_SESSION_REQUESTED_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ALWAYSON_PDU_SESSION_REQUESTED_MINIMUM_LENGTH, len);
if (iei > 0) {
bitStream |= (iei & 0xf0);
}
if (alwaysonpdusessionrequested.apsr_requested)
bitStream |= 0x01;
if (alwaysonpdusessionrequested.apsr_requested) bitStream |= 0x01;
ENCODE_U8(buffer + encoded, bitStream, encoded);
return encoded;
}
int decode_alwayson_pdu_session_requested(AlwaysonPDUSessionRequested *alwaysonpdusessionrequested, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_alwayson_pdu_session_requested(
AlwaysonPDUSessionRequested* alwaysonpdusessionrequested, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t bitStream = 0;
DECODE_U8(buffer + decoded, bitStream, decoded);
......@@ -66,4 +70,3 @@ int decode_alwayson_pdu_session_requested(AlwaysonPDUSessionRequested *alwaysonp
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,14 +29,18 @@
#define ALWAYSON_PDU_SESSION_REQUESTED_MINIMUM_LENGTH 1
#define ALWAYSON_PDU_SESSION_REQUESTED_MAXIMUM_LENGTH 1
#define ALWAYSON_PDU_SESSION_NOT_REQUESTED 0
#define ALWAYSON_PDU_SESSION_REQUESTED 1
#define ALWAYSON_PDU_SESSION_NOT_REQUESTED 0
#define ALWAYSON_PDU_SESSION_REQUESTED 1
typedef struct {
bool apsr_requested;
} AlwaysonPDUSessionRequested;
int encode_alwayson_pdu_session_requested(AlwaysonPDUSessionRequested alwaysonpdusessionrequested, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_alwayson_pdu_session_requested(AlwaysonPDUSessionRequested *alwaysonpdusessionrequested, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_alwayson_pdu_session_requested(
AlwaysonPDUSessionRequested alwaysonpdusessionrequested, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_alwayson_pdu_session_requested(
AlwaysonPDUSessionRequested* alwaysonpdusessionrequested, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationFailureParameter.h"
int encode_authentication_failure_parameter(AuthenticationFailureParameter authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_authentication_failure_parameter(
AuthenticationFailureParameter authenticationfailureparameter, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_FAILURE_PARAMETER_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, AUTHENTICATION_FAILURE_PARAMETER_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,7 +44,9 @@ int encode_authentication_failure_parameter(AuthenticationFailureParameter authe
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(authenticationfailureparameter, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
authenticationfailureparameter, buffer + encoded, len - encoded)) <
0)
return encode_result;
else
encoded += encode_result;
......@@ -50,8 +55,10 @@ int encode_authentication_failure_parameter(AuthenticationFailureParameter authe
return encoded;
}
int decode_authentication_failure_parameter(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_authentication_failure_parameter(
AuthenticationFailureParameter* authenticationfailureparameter, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -64,10 +71,11 @@ int decode_authentication_failure_parameter(AuthenticationFailureParameter *auth
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(authenticationfailureparameter, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
authenticationfailureparameter, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring AuthenticationFailureParameter;
int encode_authentication_failure_parameter(AuthenticationFailureParameter authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_authentication_failure_parameter(AuthenticationFailureParameter *authenticationfailureparameter, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_authentication_failure_parameter(
AuthenticationFailureParameter authenticationfailureparameter, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_authentication_failure_parameter(
AuthenticationFailureParameter* authenticationfailureparameter, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,23 +19,26 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationParameterAUTN.h"
int encode_authentication_parameter_autn(AuthenticationParameterAUTN authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_authentication_parameter_autn(
AuthenticationParameterAUTN authenticationparameterautn, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
int encode_result;
uint32_t encoded = 0;
/*
* Checking IEI and pointer
*/
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, AUTHENTICATION_PARAMETER_AUTN_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -46,7 +49,8 @@ int encode_authentication_parameter_autn(AuthenticationParameterAUTN authenticat
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(authenticationparameterautn, buffer + encoded, len - encoded)) < 0)
if ((encode_result = encode_bstring(
authenticationparameterautn, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -55,8 +59,10 @@ int encode_authentication_parameter_autn(AuthenticationParameterAUTN authenticat
return encoded;
}
int decode_authentication_parameter_autn(AuthenticationParameterAUTN *authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_authentication_parameter_autn(
AuthenticationParameterAUTN* authenticationparameterautn, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -69,11 +75,12 @@ int decode_authentication_parameter_autn(AuthenticationParameterAUTN *authentica
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(authenticationparameterautn, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
authenticationparameterautn, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring AuthenticationParameterAUTN;
int encode_authentication_parameter_autn(AuthenticationParameterAUTN authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_authentication_parameter_autn(AuthenticationParameterAUTN *authenticationparameterautn, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_authentication_parameter_autn(
AuthenticationParameterAUTN authenticationparameterautn, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_authentication_parameter_autn(
AuthenticationParameterAUTN* authenticationparameterautn, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,22 +19,25 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationParameterRAND.h"
int encode_authentication_parameter_rand(AuthenticationParameterRAND authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_authentication_parameter_rand(
AuthenticationParameterRAND authenticationparameterrand, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encode_result;
uint32_t encoded = 0;
/*
* Checking IEI and pointer
*/
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, AUTHENTICATION_PARAMETER_RAND_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,10 +45,11 @@ int encode_authentication_parameter_rand(AuthenticationParameterRAND authenticat
encoded++;
}
// *buffer = iei;
// encoded++;
// *buffer = iei;
// encoded++;
if ((encode_result = encode_bstring(authenticationparameterrand, buffer + encoded, len - encoded)) < 0) {
if ((encode_result = encode_bstring(
authenticationparameterrand, buffer + encoded, len - encoded)) < 0) {
return encode_result;
} else {
encoded += encode_result;
......@@ -54,8 +58,10 @@ int encode_authentication_parameter_rand(AuthenticationParameterRAND authenticat
return encoded;
}
int decode_authentication_parameter_rand(AuthenticationParameterRAND *authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_authentication_parameter_rand(
AuthenticationParameterRAND* authenticationparameterrand, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 16;
int decode_result;
......@@ -64,11 +70,12 @@ int decode_authentication_parameter_rand(AuthenticationParameterRAND *authentica
decoded++;
}
if ((decode_result = decode_bstring(authenticationparameterrand, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
authenticationparameterrand, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring AuthenticationParameterRAND;
int encode_authentication_parameter_rand(AuthenticationParameterRAND authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_authentication_parameter_rand(AuthenticationParameterRAND *authenticationparameterrand, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_authentication_parameter_rand(
AuthenticationParameterRAND authenticationparameterrand, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_authentication_parameter_rand(
AuthenticationParameterRAND* authenticationparameterrand, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "AuthenticationResponseParameter.h"
int encode_authentication_response_parameter(AuthenticationResponseParameter authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_authentication_response_parameter(
AuthenticationResponseParameter authenticationresponseparameter,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, AUTHENTICATION_RESPONSE_PARAMETER_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,7 +45,9 @@ int encode_authentication_response_parameter(AuthenticationResponseParameter aut
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(authenticationresponseparameter, buffer + encoded, len - encoded)) < 0)
if ((encode_result = encode_bstring(
authenticationresponseparameter, buffer + encoded, len - encoded)) <
0)
return encode_result;
else
encoded += encode_result;
......@@ -51,8 +56,10 @@ int encode_authentication_response_parameter(AuthenticationResponseParameter aut
return encoded;
}
int decode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_authentication_response_parameter(
AuthenticationResponseParameter* authenticationresponseparameter,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -65,10 +72,11 @@ int decode_authentication_response_parameter(AuthenticationResponseParameter *au
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(authenticationresponseparameter, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
authenticationresponseparameter, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring AuthenticationResponseParameter;
int encode_authentication_response_parameter(AuthenticationResponseParameter authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_authentication_response_parameter(AuthenticationResponseParameter *authenticationresponseparameter, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_authentication_response_parameter(
AuthenticationResponseParameter authenticationresponseparameter,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_authentication_response_parameter(
AuthenticationResponseParameter* authenticationresponseparameter,
uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,20 +19,24 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ConfigurationUpdateIndication.h"
int encode_configuration_update_indication(ConfigurationUpdateIndication configurationupdateindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_configuration_update_indication(
ConfigurationUpdateIndication configurationupdateindication, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, CONFIGURATION_UPDATE_INDICATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, CONFIGURATION_UPDATE_INDICATION_MINIMUM_LENGTH, len);
if ((encode_result = encode_bstring(configurationupdateindication, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
configurationupdateindication, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -40,15 +44,18 @@ int encode_configuration_update_indication(ConfigurationUpdateIndication configu
return encoded;
}
int decode_configuration_update_indication(ConfigurationUpdateIndication *configurationupdateindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_configuration_update_indication(
ConfigurationUpdateIndication* configurationupdateindication, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
if ((decode_result = decode_bstring(configurationupdateindication, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
configurationupdateindication, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring ConfigurationUpdateIndication;
int encode_configuration_update_indication(ConfigurationUpdateIndication configurationupdateindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_configuration_update_indication(ConfigurationUpdateIndication *configurationupdateindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_configuration_update_indication(
ConfigurationUpdateIndication configurationupdateindication, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_configuration_update_indication(
ConfigurationUpdateIndication* configurationupdateindication, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,20 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "DNN.h"
int encode_dnn(DNN dnn, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr = NULL;
uint8_t len_pos = 0;
uint32_t encoded = 0;
int encode_dnn(DNN dnn, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint8_t len_pos = 0;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? DNN_MINIMUM_LENGTH_TLV : DNN_MINIMUM_LENGTH_TLV-1), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, ((iei > 0) ? DNN_MINIMUM_LENGTH_TLV : DNN_MINIMUM_LENGTH_TLV - 1),
len);
if (iei > 0) {
*buffer = iei;
......@@ -40,23 +42,24 @@ int encode_dnn(DNN dnn, uint8_t iei, uint8_t *buffer, uint32_t len) {
}
lenPtr = (buffer + encoded);
encoded++; //ENCODE_U8(buffer + encoded, dnn.length, encoded);
encoded++; // ENCODE_U8(buffer + encoded, dnn.length, encoded);
len_pos = encoded;
if ((encode_result = encode_bstring(dnn, buffer + encoded, len - encoded)) < 0)
if ((encode_result = encode_bstring(dnn, buffer + encoded, len - encoded)) <
0)
return encode_result;
else
encoded += encode_result;
//set length
// set length
*(uint8_t*) (lenPtr) = encoded - len_pos;
return encoded;
}
int decode_dnn(DNN *dnn, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_dnn(DNN* dnn, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result = 0;
if (iei > 0) {
......@@ -68,11 +71,11 @@ int decode_dnn(DNN *dnn, uint8_t iei, uint8_t *buffer, uint32_t len) {
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(dnn, ielen, buffer + decoded, len - decoded)) < 0) {
if ((decode_result =
decode_bstring(dnn, ielen, buffer + decoded, len - decoded)) < 0) {
return decode_result;
} else {
decoded += decode_result;
}
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -33,7 +33,7 @@
typedef bstring DNN;
int encode_dnn(DNN dnn, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_dnn(DNN *dnn, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_dnn(DNN dnn, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_dnn(DNN* dnn, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "DaylightSavingTime.h"
int encode_daylight_saving_time(DaylightSavingTime daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_daylight_saving_time(
DaylightSavingTime daylightsavingtime, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DAYLIGHT_SAVING_TIME_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, DAYLIGHT_SAVING_TIME_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,7 +44,8 @@ int encode_daylight_saving_time(DaylightSavingTime daylightsavingtime, uint8_t i
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(daylightsavingtime, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
daylightsavingtime, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -50,8 +54,10 @@ int encode_daylight_saving_time(DaylightSavingTime daylightsavingtime, uint8_t i
return encoded;
}
int decode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_daylight_saving_time(
DaylightSavingTime* daylightsavingtime, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -64,10 +70,10 @@ int decode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(daylightsavingtime, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
daylightsavingtime, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring DaylightSavingTime;
int encode_daylight_saving_time(DaylightSavingTime daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_daylight_saving_time(DaylightSavingTime *daylightsavingtime, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_daylight_saving_time(
DaylightSavingTime daylightsavingtime, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_daylight_saving_time(
DaylightSavingTime* daylightsavingtime, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,20 +19,24 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "DeregistrationType.h"
int encode_deregistration_type(DeregistrationType deregistrationtype, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_deregistration_type(
DeregistrationType deregistrationtype, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, DEREGISTRATION_TYPE_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, DEREGISTRATION_TYPE_MINIMUM_LENGTH, len);
if ((encode_result = encode_bstring(deregistrationtype, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
deregistrationtype, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -40,15 +44,17 @@ int encode_deregistration_type(DeregistrationType deregistrationtype, uint8_t ie
return encoded;
}
int decode_deregistration_type(DeregistrationType *deregistrationtype, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_deregistration_type(
DeregistrationType* deregistrationtype, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
if ((decode_result = decode_bstring(deregistrationtype, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
deregistrationtype, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring DeregistrationType;
int encode_deregistration_type(DeregistrationType deregistrationtype, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_deregistration_type(DeregistrationType *deregistrationtype, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_deregistration_type(
DeregistrationType deregistrationtype, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_deregistration_type(
DeregistrationType* deregistrationtype, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,24 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "EAPMessage.h"
int encode_eap_message(EAPMessage eapmessage, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_eap_message(
EAPMessage eapmessage, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? EAP_MESSAGE_MINIMUM_LENGTH_TLVE : EAP_MESSAGE_MINIMUM_LENGTH_LVE), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ? EAP_MESSAGE_MINIMUM_LENGTH_TLVE :
EAP_MESSAGE_MINIMUM_LENGTH_LVE),
len);
if (iei > 0) {
*buffer = iei;
......@@ -42,22 +47,24 @@ int encode_eap_message(EAPMessage eapmessage, uint8_t iei, uint8_t *buffer, uint
encoded++;
encoded++;
if ((encode_result = encode_bstring(eapmessage, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result =
encode_bstring(eapmessage, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 2 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_eap_message(EAPMessage *eapmessage, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_eap_message(
EAPMessage* eapmessage, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result = 0;
if (iei > 0) {
......@@ -71,11 +78,11 @@ int decode_eap_message(EAPMessage *eapmessage, uint8_t iei, uint8_t *buffer, uin
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(eapmessage, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
eapmessage, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -35,7 +35,9 @@
typedef bstring EAPMessage;
int encode_eap_message(EAPMessage eapmessage, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_eap_message(EAPMessage *eapmessage, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_eap_message(
EAPMessage eapmessage, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_eap_message(
EAPMessage* eapmessage, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "EPSNASMessageContainer.h"
int encode_epsnas_message_container(EPSNASMessageContainer epsnasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_epsnas_message_container(
EPSNASMessageContainer epsnasmessagecontainer, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPSNAS_MESSAGE_CONTAINER_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, EPSNAS_MESSAGE_CONTAINER_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +45,24 @@ int encode_epsnas_message_container(EPSNASMessageContainer epsnasmessagecontaine
encoded++;
encoded++;
if ((encode_result = encode_bstring(epsnasmessagecontainer, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
epsnasmessagecontainer, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 2 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_epsnas_message_container(EPSNASMessageContainer *epsnasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_epsnas_message_container(
EPSNASMessageContainer* epsnasmessagecontainer, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -71,10 +77,10 @@ int decode_epsnas_message_container(EPSNASMessageContainer *epsnasmessagecontain
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(epsnasmessagecontainer, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
epsnasmessagecontainer, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring EPSNASMessageContainer;
int encode_epsnas_message_container(EPSNASMessageContainer epsnasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_epsnas_message_container(EPSNASMessageContainer *epsnasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_epsnas_message_container(
EPSNASMessageContainer epsnasmessagecontainer, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_epsnas_message_container(
EPSNASMessageContainer* epsnasmessagecontainer, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,32 +19,39 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "EPSNASSecurityAlgorithms.h"
int encode_epsnas_security_algorithms(EPSNASSecurityAlgorithms epsnassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_epsnas_security_algorithms(
EPSNASSecurityAlgorithms epsnassecurityalgorithms, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t securityAlgorithm = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EPSNAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, EPSNAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
encoded++;
}
securityAlgorithm = ((epsnassecurityalgorithms.typeOfCipheringAlgoithm) << 4) | (epsnassecurityalgorithms.typeOfIntegrityProtectionAlgoithm);
securityAlgorithm =
((epsnassecurityalgorithms.typeOfCipheringAlgoithm) << 4) |
(epsnassecurityalgorithms.typeOfIntegrityProtectionAlgoithm);
ENCODE_U8(buffer + encoded, securityAlgorithm, encoded);
return encoded;
}
int decode_epsnas_security_algorithms(EPSNASSecurityAlgorithms *epsnassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_epsnas_security_algorithms(
EPSNASSecurityAlgorithms* epsnassecurityalgorithms, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t securityAlgorithm = 0x0;
;
......@@ -54,9 +61,10 @@ int decode_epsnas_security_algorithms(EPSNASSecurityAlgorithms *epsnassecurityal
}
DECODE_U8(buffer + decoded, securityAlgorithm, decoded);
epsnassecurityalgorithms->typeOfCipheringAlgoithm = ((securityAlgorithm & 0x70) >> 4);
epsnassecurityalgorithms->typeOfIntegrityProtectionAlgoithm = (securityAlgorithm & 0x07);
epsnassecurityalgorithms->typeOfCipheringAlgoithm =
((securityAlgorithm & 0x70) >> 4);
epsnassecurityalgorithms->typeOfIntegrityProtectionAlgoithm =
(securityAlgorithm & 0x07);
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -47,11 +47,15 @@
#define NAS_SECURITY_ALGORITHMS_EIA7 0b111
typedef struct {
uint8_t typeOfCipheringAlgoithm :3;
uint8_t typeOfIntegrityProtectionAlgoithm :3;
uint8_t typeOfCipheringAlgoithm : 3;
uint8_t typeOfIntegrityProtectionAlgoithm : 3;
} EPSNASSecurityAlgorithms;
int encode_epsnas_security_algorithms(EPSNASSecurityAlgorithms epsnassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_epsnas_security_algorithms(EPSNASSecurityAlgorithms *epsnassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_epsnas_security_algorithms(
EPSNASSecurityAlgorithms epsnassecurityalgorithms, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_epsnas_security_algorithms(
EPSNASSecurityAlgorithms* epsnassecurityalgorithms, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "EmergencyNumberList.h"
int encode_emergency_number_list(EmergencyNumberList emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_emergency_number_list(
EmergencyNumberList emergencynumberlist, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,7 +44,8 @@ int encode_emergency_number_list(EmergencyNumberList emergencynumberlist, uint8_
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(emergencynumberlist, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
emergencynumberlist, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -50,8 +54,10 @@ int encode_emergency_number_list(EmergencyNumberList emergencynumberlist, uint8_
return encoded;
}
int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_emergency_number_list(
EmergencyNumberList* emergencynumberlist, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -64,10 +70,10 @@ int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(emergencynumberlist, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
emergencynumberlist, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring EmergencyNumberList;
int encode_emergency_number_list(EmergencyNumberList emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_emergency_number_list(EmergencyNumberList *emergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_emergency_number_list(
EmergencyNumberList emergencynumberlist, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_emergency_number_list(
EmergencyNumberList* emergencynumberlist, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ExtendedEmergencyNumberList.h"
int encode_extended_emergency_number_list(ExtendedEmergencyNumberList extendedemergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_extended_emergency_number_list(
ExtendedEmergencyNumberList extendedemergencynumberlist, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, EXTENDED_EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, EXTENDED_EMERGENCY_NUMBER_LIST_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +45,24 @@ int encode_extended_emergency_number_list(ExtendedEmergencyNumberList extendedem
encoded++;
encoded++;
if ((encode_result = encode_bstring(extendedemergencynumberlist, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
extendedemergencynumberlist, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 1 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_extended_emergency_number_list(ExtendedEmergencyNumberList *extendedemergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_extended_emergency_number_list(
ExtendedEmergencyNumberList* extendedemergencynumberlist, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -71,10 +77,11 @@ int decode_extended_emergency_number_list(ExtendedEmergencyNumberList *extendede
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(extendedemergencynumberlist, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
extendedemergencynumberlist, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring ExtendedEmergencyNumberList;
int encode_extended_emergency_number_list(ExtendedEmergencyNumberList extendedemergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_extended_emergency_number_list(ExtendedEmergencyNumberList *extendedemergencynumberlist, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_extended_emergency_number_list(
ExtendedEmergencyNumberList extendedemergencynumberlist, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_extended_emergency_number_list(
ExtendedEmergencyNumberList* extendedemergencynumberlist, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,26 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ExtendedProtocolConfigurationOptions.h"
int encode_extended_protocol_configuration_options(ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_extended_protocol_configuration_options(
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE : EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE-1), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ?
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE :
EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_MINIMUM_LENGTH_TLVE - 1),
len);
if (iei > 0) {
*buffer = iei;
......@@ -42,22 +49,26 @@ int encode_extended_protocol_configuration_options(ExtendedProtocolConfiguration
encoded++;
encoded++;
if ((encode_result = encode_bstring(extendedprotocolconfigurationoptions, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
extendedprotocolconfigurationoptions, buffer + encoded,
len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 2 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_extended_protocol_configuration_options(ExtendedProtocolConfigurationOptions *extendedprotocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint32_t ielen = 0;
int decode_extended_protocol_configuration_options(
ExtendedProtocolConfigurationOptions* extendedprotocolconfigurationoptions,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint32_t ielen = 0;
int decode_result = 0;
if (iei > 0) {
......@@ -71,7 +82,9 @@ int decode_extended_protocol_configuration_options(ExtendedProtocolConfiguration
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(extendedprotocolconfigurationoptions, ielen, buffer + decoded, len - decoded)) < 0) {
if ((decode_result = decode_bstring(
extendedprotocolconfigurationoptions, ielen, buffer + decoded,
len - decoded)) < 0) {
return decode_result;
} else {
decoded += decode_result;
......@@ -79,4 +92,3 @@ int decode_extended_protocol_configuration_options(ExtendedProtocolConfiguration
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -33,7 +33,11 @@
typedef bstring ExtendedProtocolConfigurationOptions;
int encode_extended_protocol_configuration_options(ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_extended_protocol_configuration_options(ExtendedProtocolConfigurationOptions *extendedprotocolconfigurationoptions, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_extended_protocol_configuration_options(
ExtendedProtocolConfigurationOptions extendedprotocolconfigurationoptions,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_extended_protocol_configuration_options(
ExtendedProtocolConfigurationOptions* extendedprotocolconfigurationoptions,
uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,24 +19,27 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "ExtendedProtocolDiscriminator.h"
int encode_extended_protocol_discriminator(ExtendedProtocolDiscriminator extendedprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_extended_protocol_discriminator(
ExtendedProtocolDiscriminator extendedprotocoldiscriminator, uint8_t iei,
uint8_t* buffer, uint32_t len) {
/*
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH , len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER
(buffer,EXTENDED_PROTOCOL_DISCRIMINATOR_MINIMUM_LENGTH , len);
ENCODE8
if ((encode_result = encode_bstring (extendedprotocoldiscriminator, buffer + encoded, len - encoded)) < 0)//加密,实体,首地址,长度
return encode_result;
if ((encode_result = encode_bstring (extendedprotocoldiscriminator, buffer +
encoded, len - encoded)) < 0)//加密,实体,首地址,长度 return encode_result;
else
encoded += encode_result;
......@@ -46,18 +49,17 @@ int encode_extended_protocol_discriminator(ExtendedProtocolDiscriminator extende
return 0;
}
int decode_extended_protocol_discriminator(ExtendedProtocolDiscriminator *extendedprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decode_extended_protocol_discriminator(
ExtendedProtocolDiscriminator* extendedprotocoldiscriminator, uint8_t iei,
uint8_t* buffer, uint32_t len) {
/*
int decoded=0;
uint8_t ielen=0;
int decode_result;
if((decode_result = decode_bstring (extendedprotocoldiscriminator, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
if((decode_result = decode_bstring (extendedprotocoldiscriminator, ielen,
buffer + decoded, len - decoded)) < 0) return decode_result; else decoded +=
decode_result; return decoded;
*/
return 0;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef uint8_t ExtendedProtocolDiscriminator;
int encode_extended_protocol_discriminator(ExtendedProtocolDiscriminator extendedprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_extended_protocol_discriminator(ExtendedProtocolDiscriminator *extendedprotocoldiscriminator, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_extended_protocol_discriminator(
ExtendedProtocolDiscriminator extendedprotocoldiscriminator, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_extended_protocol_discriminator(
ExtendedProtocolDiscriminator* extendedprotocoldiscriminator, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,18 +19,23 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "GPRSTimer.h"
int encode_gprs_timer(GPRSTimer gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_gprs_timer(
GPRSTimer gprstimer, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t timeValue = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? GPRS_TIMER_MINIMUM_LENGTH_TV : GPRS_TIMER_MINIMUM_LENGTH_TV-1), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ? GPRS_TIMER_MINIMUM_LENGTH_TV :
GPRS_TIMER_MINIMUM_LENGTH_TV - 1),
len);
if (iei > 0) {
*buffer = iei;
......@@ -43,8 +48,9 @@ int encode_gprs_timer(GPRSTimer gprstimer, uint8_t iei, uint8_t *buffer, uint32_
return encoded;
}
int decode_gprs_timer(GPRSTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_gprs_timer(
GPRSTimer* gprstimer, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t timeValue = 0;
if (iei > 0) {
......@@ -53,9 +59,8 @@ int decode_gprs_timer(GPRSTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32
}
DECODE_U8(buffer + decoded, timeValue, decoded);
gprstimer->unit = (uint8_t)((timeValue & 0xe0) >> 5);
gprstimer->unit = (uint8_t)((timeValue & 0xe0) >> 5);
gprstimer->timeValue = (uint8_t)(timeValue & 0x1f);
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,17 +31,19 @@
#define GPRS_TIMER_MINIMUM_LENGTH_TV 2
#define GPRS_TIMER_MAXIMUM_LENGTH_TV 2
#define GPRSTIMER_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_2_SECONDS 0b000
#define GPRSTIMER_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1_MINUTE 0b001
#define GPRSTIMER_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_DECIHOURS 0b010
#define GPRSTIMER_VALUE_INDICATES_THAT_THE_TIMER_IS_DEACTIVATED 0b111
#define GPRSTIMER_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_2_SECONDS 0b000
#define GPRSTIMER_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1_MINUTE 0b001
#define GPRSTIMER_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_DECIHOURS 0b010
#define GPRSTIMER_VALUE_INDICATES_THAT_THE_TIMER_IS_DEACTIVATED 0b111
typedef struct {
uint8_t unit :3;
uint8_t timeValue :5;
uint8_t unit : 3;
uint8_t timeValue : 5;
} GPRSTimer;
int encode_gprs_timer(GPRSTimer gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_gprs_timer(GPRSTimer *gprstimer, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_gprs_timer(
GPRSTimer gprstimer, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_gprs_timer(
GPRSTimer* gprstimer, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,16 +19,17 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "GPRSTimer2.h"
int encode_gprs_timer2(GPRSTimer2 gprstimer2, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_gprs_timer2(
GPRSTimer2 gprstimer2, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, GPRS_TIMER2_MINIMUM_LENGTH, len);
......@@ -46,8 +47,9 @@ int encode_gprs_timer2(GPRSTimer2 gprstimer2, uint8_t iei, uint8_t *buffer, uint
return encoded;
}
int decode_gprs_timer2(GPRSTimer2 *gprstimer2, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_gprs_timer2(
GPRSTimer2* gprstimer2, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
if (iei > 0) {
......@@ -63,4 +65,3 @@ int decode_gprs_timer2(GPRSTimer2 *gprstimer2, uint8_t iei, uint8_t *buffer, uin
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,9 @@
typedef uint8_t GPRSTimer2;
int encode_gprs_timer2(GPRSTimer2 gprstimer2, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_gprs_timer2(GPRSTimer2 *gprstimer2, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_gprs_timer2(
GPRSTimer2 gprstimer2, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_gprs_timer2(
GPRSTimer2* gprstimer2, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,20 +19,25 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "GPRSTimer3.h"
int encode_gprs_timer3(GPRSTimer3 gprstimer3, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_gprs_timer3(
GPRSTimer3 gprstimer3, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
uint8_t timeValue = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? GPRS_TIMER3_MINIMUM_LENGTH_TLV : GPRS_TIMER3_MINIMUM_LENGTH_TLV-1), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ? GPRS_TIMER3_MINIMUM_LENGTH_TLV :
GPRS_TIMER3_MINIMUM_LENGTH_TLV - 1),
len);
if (iei > 0) {
*buffer = iei;
......@@ -49,9 +54,10 @@ int encode_gprs_timer3(GPRSTimer3 gprstimer3, uint8_t iei, uint8_t *buffer, uint
return encoded;
}
int decode_gprs_timer3(GPRSTimer3 *gprstimer3, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_gprs_timer3(
GPRSTimer3* gprstimer3, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
uint8_t timeValue = 0;
if (iei > 0) {
......@@ -64,9 +70,8 @@ int decode_gprs_timer3(GPRSTimer3 *gprstimer3, uint8_t iei, uint8_t *buffer, uin
CHECK_LENGTH_DECODER(len - decoded, ielen);
DECODE_U8(buffer + decoded, timeValue, decoded);
gprstimer3->unit = (uint8_t)((timeValue & 0xe0) >> 5);
gprstimer3->unit = (uint8_t)((timeValue & 0xe0) >> 5);
gprstimer3->timeValue = (uint8_t)(timeValue & 0x1f);
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,21 +31,23 @@
#define GPRS_TIMER3_MINIMUM_LENGTH_TLV 3
#define GPRS_TIMER3_MAXIMUM_LENGTH_TLV 3
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_10_MINUTES 0b000
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1_HOUR 0b001
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_10_HOURS 0b010
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_2_SECONDS 0b011
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_30_SECONDS 0b100
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1_MINUTE 0b101
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_320_HOURS 0b110
#define GPRSTIMER3_VALUE_INDICATES_THAT_THE_TIMER_IS_DEACTIVATED 0b111
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_10_MINUTES 0b000
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1_HOUR 0b001
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_10_HOURS 0b010
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_2_SECONDS 0b011
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_30_SECONDS 0b100
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1_MINUTE 0b101
#define GPRSTIMER3_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_320_HOURS 0b110
#define GPRSTIMER3_VALUE_INDICATES_THAT_THE_TIMER_IS_DEACTIVATED 0b111
typedef struct {
uint8_t unit :3;
uint8_t timeValue :5;
uint8_t unit : 3;
uint8_t timeValue : 5;
} GPRSTimer3;
int encode_gprs_timer3(GPRSTimer3 gprstimer3, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_gprs_timer3(GPRSTimer3 *gprstimer3, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_gprs_timer3(
GPRSTimer3 gprstimer3, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_gprs_timer3(
GPRSTimer3* gprstimer3, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,18 +19,20 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "IMEISVRequest.h"
int encode_imeisv_request(IMEISVRequest imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_imeisv_request(
IMEISVRequest imeisvrequest, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, IMEISV_REQUEST_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, IMEISV_REQUEST_MINIMUM_LENGTH, len);
bitStream = (iei & 0xf0) | imeisvrequest;
ENCODE_U8(buffer + encoded, bitStream, encoded);
......@@ -38,16 +40,15 @@ int encode_imeisv_request(IMEISVRequest imeisvrequest, uint8_t iei, uint8_t *buf
return encoded;
}
int decode_imeisv_request(IMEISVRequest *imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decode_imeisv_request(
IMEISVRequest* imeisvrequest, uint8_t iei, uint8_t* buffer, uint32_t len) {
printf("decode_imeisv_request\n");
int decoded = 0;
int decoded = 0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer + decoded, bitStream, decoded);
if (iei != (bitStream & 0xf0))
return -1;
if (iei != (bitStream & 0xf0)) return -1;
*imeisvrequest = bitStream & 0x07;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -33,7 +33,9 @@
typedef uint8_t IMEISVRequest;
int encode_imeisv_request(IMEISVRequest imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_imeisv_request(IMEISVRequest *imeisvrequest, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_imeisv_request(
IMEISVRequest imeisvrequest, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_imeisv_request(
IMEISVRequest* imeisvrequest, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,25 +19,33 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "IntergrityProtectionMaximumDataRate.h"
int encode_intergrity_protection_maximum_data_rate(IntergrityProtectionMaximumDataRate intergrityprotectionmaximumdatarate, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_intergrity_protection_maximum_data_rate(
IntergrityProtectionMaximumDataRate intergrityprotectionmaximumdatarate,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_TV : INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_V), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ? INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_TV :
INTERGRITY_PROTECTION_MAXIMUM_DATA_RATE_MINIMUM_LENGTH_V),
len);
if (iei > 0) {
*buffer = iei;
encoded++;
}
if ((encode_result = encode_bstring(intergrityprotectionmaximumdatarate, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
intergrityprotectionmaximumdatarate, buffer + encoded,
len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -45,9 +53,11 @@ int encode_intergrity_protection_maximum_data_rate(IntergrityProtectionMaximumDa
return encoded;
}
int decode_intergrity_protection_maximum_data_rate(IntergrityProtectionMaximumDataRate *intergrityprotectionmaximumdatarate, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 2;
int decode_intergrity_protection_maximum_data_rate(
IntergrityProtectionMaximumDataRate* intergrityprotectionmaximumdatarate,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 2;
int decode_result = 0;
if (iei > 0) {
......@@ -55,10 +65,11 @@ int decode_intergrity_protection_maximum_data_rate(IntergrityProtectionMaximumDa
decoded++;
}
if ((decode_result = decode_bstring(intergrityprotectionmaximumdatarate, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
intergrityprotectionmaximumdatarate, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -35,7 +35,11 @@
typedef bstring IntergrityProtectionMaximumDataRate;
int encode_intergrity_protection_maximum_data_rate(IntergrityProtectionMaximumDataRate intergrityprotectionmaximumdatarate, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_intergrity_protection_maximum_data_rate(IntergrityProtectionMaximumDataRate *intergrityprotectionmaximumdatarate, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_intergrity_protection_maximum_data_rate(
IntergrityProtectionMaximumDataRate intergrityprotectionmaximumdatarate,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_intergrity_protection_maximum_data_rate(
IntergrityProtectionMaximumDataRate* intergrityprotectionmaximumdatarate,
uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,21 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "LADNIndication.h"
int encode_ladn_indication(LADNIndication ladnindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_ladn_indication(
LADNIndication ladnindication, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LADN_INDICATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, LADN_INDICATION_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +44,24 @@ int encode_ladn_indication(LADNIndication ladnindication, uint8_t iei, uint8_t *
encoded++;
encoded++;
if ((encode_result = encode_bstring(ladnindication, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result =
encode_bstring(ladnindication, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 1 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_ladn_indication(LADNIndication *ladnindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_ladn_indication(
LADNIndication* ladnindication, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -71,10 +76,10 @@ int decode_ladn_indication(LADNIndication *ladnindication, uint8_t iei, uint8_t
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(ladnindication, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
ladnindication, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,9 @@
typedef bstring LADNIndication;
int encode_ladn_indication(LADNIndication ladnindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_ladn_indication(LADNIndication *ladnindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_ladn_indication(
LADNIndication ladnindication, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_ladn_indication(
LADNIndication* ladnindication, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "LADNInformation.h"
int encode_ladn_information(LADNInformation ladninformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_ladn_information(
LADNInformation ladninformation, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, LADN_INFORMATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, LADN_INFORMATION_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +45,24 @@ int encode_ladn_information(LADNInformation ladninformation, uint8_t iei, uint8_
encoded++;
encoded++;
if ((encode_result = encode_bstring(ladninformation, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
ladninformation, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 1 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_ladn_information(LADNInformation *ladninformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_ladn_information(
LADNInformation* ladninformation, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -71,10 +77,10 @@ int decode_ladn_information(LADNInformation *ladninformation, uint8_t iei, uint8
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(ladninformation, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
ladninformation, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring LADNInformation;
int encode_ladn_information(LADNInformation ladninformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_ladn_information(LADNInformation *ladninformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_ladn_information(
LADNInformation ladninformation, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_ladn_information(
LADNInformation* ladninformation, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,20 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "MICOIndication.h"
int encode_mico_indication(MICOIndication micoindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_mico_indication(
MICOIndication micoindication, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MICO_INDICATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, MICO_INDICATION_MINIMUM_LENGTH, len);
if (iei > 0) {
bitStream |= (iei & 0xf0);
......@@ -44,15 +45,14 @@ int encode_mico_indication(MICOIndication micoindication, uint8_t iei, uint8_t *
return encoded;
}
int decode_mico_indication(MICOIndication *micoindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decode_mico_indication(
MICOIndication* micoindication, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t bitStream;
DECODE_U8(buffer + decoded, bitStream, decoded);
if (iei != (bitStream & 0xf0))
return -1;
if (bitStream & 0x01)
micoindication->raai = true;
if (iei != (bitStream & 0xf0)) return -1;
if (bitStream & 0x01) micoindication->raai = true;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,10 +30,12 @@
#define MICO_INDICATION_MAXIMUM_LENGTH 1
typedef struct {
bool raai; //registration area allocation indication
bool raai; // registration area allocation indication
} MICOIndication;
int encode_mico_indication(MICOIndication micoindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_mico_indication(MICOIndication *micoindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_mico_indication(
MICOIndication micoindication, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_mico_indication(
MICOIndication* micoindication, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "MappedEPSBearerContexts.h"
int encode_mapped_eps_bearer_contexts(MappedEPSBearerContexts mappedepsbearercontexts, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_mapped_eps_bearer_contexts(
MappedEPSBearerContexts mappedepsbearercontexts, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MAPPED_EPS_BEARER_CONTEXTS_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, MAPPED_EPS_BEARER_CONTEXTS_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +45,24 @@ int encode_mapped_eps_bearer_contexts(MappedEPSBearerContexts mappedepsbearercon
encoded++;
encoded++;
if ((encode_result = encode_bstring(mappedepsbearercontexts, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
mappedepsbearercontexts, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 1 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_mapped_eps_bearer_contexts(MappedEPSBearerContexts *mappedepsbearercontexts, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_mapped_eps_bearer_contexts(
MappedEPSBearerContexts* mappedepsbearercontexts, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -71,10 +77,11 @@ int decode_mapped_eps_bearer_contexts(MappedEPSBearerContexts *mappedepsbearerco
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(mappedepsbearercontexts, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
mappedepsbearercontexts, ielen, buffer + decoded, len - decoded)) <
0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,27 +30,27 @@
#if 0
//MappedExtendedEPSQoSParameters
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_200KBPS 0b00000001
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1MBPS 0b00000010
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4MBPS 0b00000011
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16MBPS 0b00000100
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64MBPS 0b00000101
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256MBPS 0b00000110
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1GBPS 0b00000111
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4GBPS 0b00001000
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16GBPS 0b00001001
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64GBPS 0b00001010
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256GBPS 0b00001011
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1TBPS 0b00001100
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4TBPS 0b00001101
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16TBPS 0b00001110
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64TBPS 0b00001111
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256TBPS 0b00010000
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1PBPS 0b00010001
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4PBPS 0b00010010
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16PBPS 0b00010011
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64PBPS 0b00010100
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256PBPS 0b00010101
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_200KBPS 0b00000001
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1MBPS 0b00000010
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4MBPS 0b00000011
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16MBPS 0b00000100
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64MBPS 0b00000101
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256MBPS 0b00000110
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1GBPS 0b00000111
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4GBPS 0b00001000
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16GBPS 0b00001001
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64GBPS 0b00001010
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256GBPS 0b00001011
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1TBPS 0b00001100
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4TBPS 0b00001101
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16TBPS 0b00001110
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64TBPS 0b00001111
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256TBPS 0b00010000
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_1PBPS 0b00010001
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_4PBPS 0b00010010
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_16PBPS 0b00010011
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_64PBPS 0b00010100
#define MAPPED_EPS_VALUE_IS_INCREMENTED_IN_MULTIPLES_OF_256PBPS 0b00010101
typedef struct{
......@@ -90,26 +90,26 @@ typedef struct{
//Packet filter component type identifier
#define TFT_IPV4_REMOTE_ADDRESS_TYPE 0b00010000
#define TFT_IPV4_LOCAL_ADDRESS_TYPE 0b00010001
#define TFT_IPV6_REMOTE_ADDRESS_TYPE 0b00100000
#define TFT_IPV6_REMOTE_ADDRESSORPREFIX_LENGTH_TYPE 0b00100001
#define TFT_IPV6_LOCAL_ADDRESSORPREFIX_LENGTH_TYPE 0b00100011
#define TFT_PROTOCOL_IDENTIFIERORNEXT_HEADER_TYPE 0b00110000
#define TFT_SINGLE_LOCAL_PORT_TYPE 0b01000000
#define TFT_LOCAL_PORT_RANGE_TYPE 0b01000001
#define TFT_SINGLE_REMOTE_PORT_TYPE 0b01010000
#define TFT_REMOTE_PORT_RANGE_TYPE 0b01010001
#define TFT_SECURITY_PARAMETER_INDEX_TYPE 0b01100000
#define TFT_TYPE_OF_SERVICEORTRAFFIC_CLASS_TYPE 0b01110000
#define TFT_FLOW_LABEL_TYPE 0b10000000
#define TFT_DESTINATION_MAC_ADDRESS_TYPE 0b10000001
#define TFT_SOURCE_MAC_ADDRESS_TYPE 0b10000010
#define TFT_8021Q_CTAG_VID_TYPE 0b10000011
#define TFT_8021Q_STAG_VID_TYPE 0b10000100
#define TFT_8021Q_CTAG_PCPORDEI_TYPE 0b10000101
#define TFT_8021Q_STAG_PCPORDEI_TYPE 0b10000110
#define TFT_ETHERTYPE_TYPE 0b10000111
#define TFT_IPV4_REMOTE_ADDRESS_TYPE 0b00010000
#define TFT_IPV4_LOCAL_ADDRESS_TYPE 0b00010001
#define TFT_IPV6_REMOTE_ADDRESS_TYPE 0b00100000
#define TFT_IPV6_REMOTE_ADDRESSORPREFIX_LENGTH_TYPE 0b00100001
#define TFT_IPV6_LOCAL_ADDRESSORPREFIX_LENGTH_TYPE 0b00100011
#define TFT_PROTOCOL_IDENTIFIERORNEXT_HEADER_TYPE 0b00110000
#define TFT_SINGLE_LOCAL_PORT_TYPE 0b01000000
#define TFT_LOCAL_PORT_RANGE_TYPE 0b01000001
#define TFT_SINGLE_REMOTE_PORT_TYPE 0b01010000
#define TFT_REMOTE_PORT_RANGE_TYPE 0b01010001
#define TFT_SECURITY_PARAMETER_INDEX_TYPE 0b01100000
#define TFT_TYPE_OF_SERVICEORTRAFFIC_CLASS_TYPE 0b01110000
#define TFT_FLOW_LABEL_TYPE 0b10000000
#define TFT_DESTINATION_MAC_ADDRESS_TYPE 0b10000001
#define TFT_SOURCE_MAC_ADDRESS_TYPE 0b10000010
#define TFT_8021Q_CTAG_VID_TYPE 0b10000011
#define TFT_8021Q_STAG_VID_TYPE 0b10000100
#define TFT_8021Q_CTAG_PCPORDEI_TYPE 0b10000101
#define TFT_8021Q_STAG_PCPORDEI_TYPE 0b10000110
#define TFT_ETHERTYPE_TYPE 0b10000111
typedef struct{
uint8_t packetfilteridentifier:4;
......@@ -176,7 +176,11 @@ typedef struct{
typedef bstring MappedEPSBearerContexts;
int encode_mapped_eps_bearer_contexts(MappedEPSBearerContexts mappedepsbearercontexts, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_mapped_eps_bearer_contexts(MappedEPSBearerContexts *mappedepsbearercontexts, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_mapped_eps_bearer_contexts(
MappedEPSBearerContexts mappedepsbearercontexts, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_mapped_eps_bearer_contexts(
MappedEPSBearerContexts* mappedepsbearercontexts, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,33 +19,47 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "MaximumNumberOfSupportedPacketFilters.h"
int encode_maximum_number_of_supported_packet_filters(MaximumNumberOfSupportedPacketFilters maximumnumberofsupportedpacketfilters, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_maximum_number_of_supported_packet_filters(
MaximumNumberOfSupportedPacketFilters maximumnumberofsupportedpacketfilters,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_MINIMUM_LENGTH_TV : MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_MINIMUM_LENGTH_TV-1), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ?
MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_MINIMUM_LENGTH_TV :
MAXIMUM_NUMBER_OF_SUPPORTED_PACKET_FILTERS_MINIMUM_LENGTH_TV - 1),
len);
if (iei > 0) {
*buffer = iei;
encoded++;
}
ENCODE_U8(buffer + encoded, (uint8_t)(maximumnumberofsupportedpacketfilters & 0x00ff), encoded);
ENCODE_U8(buffer + encoded, (uint8_t)((maximumnumberofsupportedpacketfilters & 0x700) >> 3), encoded);
ENCODE_U8(
buffer + encoded,
(uint8_t)(maximumnumberofsupportedpacketfilters & 0x00ff), encoded);
ENCODE_U8(
buffer + encoded,
(uint8_t)((maximumnumberofsupportedpacketfilters & 0x700) >> 3), encoded);
return encoded;
}
int decode_maximum_number_of_supported_packet_filters(MaximumNumberOfSupportedPacketFilters *maximumnumberofsupportedpacketfilters, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t bit8Stream = 0;
int decode_maximum_number_of_supported_packet_filters(
MaximumNumberOfSupportedPacketFilters*
maximumnumberofsupportedpacketfilters,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t bit8Stream = 0;
uint16_t bit16Stream = 0;
if (iei > 0) {
......@@ -62,4 +76,3 @@ int decode_maximum_number_of_supported_packet_filters(MaximumNumberOfSupportedPa
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -33,7 +33,12 @@
typedef uint16_t MaximumNumberOfSupportedPacketFilters;
int encode_maximum_number_of_supported_packet_filters(MaximumNumberOfSupportedPacketFilters maximumnumberofsupportedpacketfilters, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_maximum_number_of_supported_packet_filters(MaximumNumberOfSupportedPacketFilters *maximumnumberofsupportedpacketfilters, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_maximum_number_of_supported_packet_filters(
MaximumNumberOfSupportedPacketFilters maximumnumberofsupportedpacketfilters,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_maximum_number_of_supported_packet_filters(
MaximumNumberOfSupportedPacketFilters*
maximumnumberofsupportedpacketfilters,
uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,20 +19,24 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "MessageAuthenticationCode.h"
int encode_message_authentication_code(MessageAuthenticationCode messageauthenticationcode, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_message_authentication_code(
MessageAuthenticationCode messageauthenticationcode, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, MESSAGE_AUTHENTICATION_CODE_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, MESSAGE_AUTHENTICATION_CODE_MINIMUM_LENGTH, len);
if ((encode_result = encode_bstring(messageauthenticationcode, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
messageauthenticationcode, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -40,15 +44,18 @@ int encode_message_authentication_code(MessageAuthenticationCode messageauthenti
return encoded;
}
int decode_message_authentication_code(MessageAuthenticationCode *messageauthenticationcode, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_message_authentication_code(
MessageAuthenticationCode* messageauthenticationcode, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
if ((decode_result = decode_bstring(messageauthenticationcode, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
messageauthenticationcode, ielen, buffer + decoded, len - decoded)) <
0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring MessageAuthenticationCode;
int encode_message_authentication_code(MessageAuthenticationCode messageauthenticationcode, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_message_authentication_code(MessageAuthenticationCode *messageauthenticationcode, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_message_authentication_code(
MessageAuthenticationCode messageauthenticationcode, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_message_authentication_code(
MessageAuthenticationCode* messageauthenticationcode, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,21 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "MessageType.h"
int encode_message_type(MessageType messagetype, uint8_t iei, uint8_t *buffer, uint32_t len) {
//we don't need this since it's done in encode header ENCODE_U8
int encode_message_type(
MessageType messagetype, uint8_t iei, uint8_t* buffer, uint32_t len) {
// we don't need this since it's done in encode header ENCODE_U8
return 0;
}
int decode_message_type(MessageType *messagetype, uint8_t iei, uint8_t *buffer, uint32_t len) {
//we don't need this since it's done in decode header (DECODE_U8)
int decode_message_type(
MessageType* messagetype, uint8_t iei, uint8_t* buffer, uint32_t len) {
// we don't need this since it's done in decode header (DECODE_U8)
return 0;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,9 @@
typedef uint8_t MessageType;
int encode_message_type(MessageType messagetype, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_message_type(MessageType *messagetype, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_message_type(
MessageType messagetype, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_message_type(
MessageType* messagetype, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,62 +19,70 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NASKeySetIdentifier.h"
int encode_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_nas_key_set_identifier(
NASKeySetIdentifier* naskeysetidentifier, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t encoded = 0;
/*
* Checking length and pointer
*/
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len);
*(buffer + encoded) = 0x00 | (iei & 0xf0) | ((naskeysetidentifier->tsc & 0x1) << 3) | (naskeysetidentifier->naskeysetidentifier & 0x7);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len);
*(buffer + encoded) = 0x00 | (iei & 0xf0) |
((naskeysetidentifier->tsc & 0x1) << 3) |
(naskeysetidentifier->naskeysetidentifier & 0x7);
encoded++;
return encoded;
}
int encode_u8_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier) {
int encode_u8_nas_key_set_identifier(NASKeySetIdentifier* naskeysetidentifier) {
uint8_t bufferReturn;
uint8_t *buffer = &bufferReturn;
uint8_t* buffer = &bufferReturn;
uint8_t encoded = 0;
uint8_t iei = 0;
uint8_t iei = 0;
*(buffer + encoded) = 0x00 | (iei & 0xf0) | ((naskeysetidentifier->tsc & 0x1) << 3) | (naskeysetidentifier->naskeysetidentifier & 0x7);
*(buffer + encoded) = 0x00 | (iei & 0xf0) |
((naskeysetidentifier->tsc & 0x1) << 3) |
(naskeysetidentifier->naskeysetidentifier & 0x7);
encoded++;
return bufferReturn;
}
int decode_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decode_nas_key_set_identifier(
NASKeySetIdentifier* naskeysetidentifier, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_DECODER(buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_DECODER(
buffer, NAS_KEY_SET_IDENTIFIER_MINIMUM_LENGTH, len);
if (iei > 0) {
CHECK_IEI_DECODER((*buffer & 0xf0), iei);
}
naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1;
naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1;
naskeysetidentifier->naskeysetidentifier = *(buffer + decoded) & 0x7;
decoded++;
return decoded;
}
int decode_u8_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value, uint32_t len) {
int decoded = 0;
uint8_t *buffer = &value;
int decode_u8_nas_key_set_identifier(
NASKeySetIdentifier* naskeysetidentifier, uint8_t iei, uint8_t value,
uint32_t len) {
int decoded = 0;
uint8_t* buffer = &value;
naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1;
naskeysetidentifier->tsc = (*(buffer + decoded) >> 3) & 0x1;
naskeysetidentifier->naskeysetidentifier = *(buffer + decoded) & 0x7;
decoded++;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,15 +30,21 @@
typedef struct nasKeySetIdentifier {
#define NAS_KEY_SET_IDENTIFIER_NATIVE 0
#define NAS_KEY_SET_IDENTIFIER_MAPPED 1
uint8_t tsc :1; //type of security context flag
#define NAS_KEY_SET_IDENTIFIER_MAPPED 1
uint8_t tsc : 1; // type of security context flag
#define NAS_KEY_SET_IDENTIFIER_NOT_AVAILABLE 0b111
uint8_t naskeysetidentifier :3;
uint8_t naskeysetidentifier : 3;
} NASKeySetIdentifier;
int encode_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_u8_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier);
int decode_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_u8_nas_key_set_identifier(NASKeySetIdentifier *naskeysetidentifier, uint8_t iei, uint8_t value, uint32_t len);
int encode_nas_key_set_identifier(
NASKeySetIdentifier* naskeysetidentifier, uint8_t iei, uint8_t* buffer,
uint32_t len);
int encode_u8_nas_key_set_identifier(NASKeySetIdentifier* naskeysetidentifier);
int decode_nas_key_set_identifier(
NASKeySetIdentifier* naskeysetidentifier, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_u8_nas_key_set_identifier(
NASKeySetIdentifier* naskeysetidentifier, uint8_t iei, uint8_t value,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NASMessageContainer.h"
int encode_nas_message_container(NASMessageContainer nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_nas_message_container(
NASMessageContainer nasmessagecontainer, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NAS_MESSAGE_CONTAINER_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +45,24 @@ int encode_nas_message_container(NASMessageContainer nasmessagecontainer, uint8_
encoded++;
encoded++;
if ((encode_result = encode_bstring(nasmessagecontainer, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
nasmessagecontainer, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 2 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_nas_message_container(NASMessageContainer *nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_nas_message_container(
NASMessageContainer* nasmessagecontainer, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -70,10 +76,10 @@ int decode_nas_message_container(NASMessageContainer *nasmessagecontainer, uint8
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(nasmessagecontainer, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
nasmessagecontainer, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring NASMessageContainer;
int encode_nas_message_container(NASMessageContainer nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_nas_message_container(NASMessageContainer *nasmessagecontainer, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_nas_message_container(
NASMessageContainer nasmessagecontainer, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_nas_message_container(
NASMessageContainer* nasmessagecontainer, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,32 +19,39 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NASSecurityAlgorithms.h"
int encode_nas_security_algorithms(NASSecurityAlgorithms nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t encoded = 0;
int encode_nas_security_algorithms(
NASSecurityAlgorithms nassecurityalgorithms, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint8_t encoded = 0;
uint8_t selectedAlgorithm = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NAS_SECURITY_ALGORITHMS_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
encoded++;
}
selectedAlgorithm = (nassecurityalgorithms.typeOfCipheringAlgorithm << 4) | (nassecurityalgorithms.typeOfIntegrityProtectionAlgorithm);
selectedAlgorithm =
(nassecurityalgorithms.typeOfCipheringAlgorithm << 4) |
(nassecurityalgorithms.typeOfIntegrityProtectionAlgorithm);
ENCODE_U8(buffer + encoded, selectedAlgorithm, encoded);
return encoded;
}
int decode_nas_security_algorithms(NASSecurityAlgorithms *nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_nas_security_algorithms(
NASSecurityAlgorithms* nassecurityalgorithms, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t selectedAlgorithm = 0x0;
if (iei > 0) {
......@@ -53,9 +60,10 @@ int decode_nas_security_algorithms(NASSecurityAlgorithms *nassecurityalgorithms,
}
DECODE_U8(buffer + decoded, selectedAlgorithm, decoded);
nassecurityalgorithms->typeOfCipheringAlgorithm = ((selectedAlgorithm & 0xf0) >> 4);
nassecurityalgorithms->typeOfIntegrityProtectionAlgorithm = (selectedAlgorithm & 0x0f);
nassecurityalgorithms->typeOfCipheringAlgorithm =
((selectedAlgorithm & 0xf0) >> 4);
nassecurityalgorithms->typeOfIntegrityProtectionAlgorithm =
(selectedAlgorithm & 0x0f);
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -47,11 +47,15 @@
#define NAS_SECURITY_ALGORITHMS_NIA7 0b0111
typedef struct {
uint8_t typeOfCipheringAlgorithm :4;
uint8_t typeOfIntegrityProtectionAlgorithm :4;
uint8_t typeOfCipheringAlgorithm : 4;
uint8_t typeOfIntegrityProtectionAlgorithm : 4;
} NASSecurityAlgorithms;
int encode_nas_security_algorithms(NASSecurityAlgorithms nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_nas_security_algorithms(NASSecurityAlgorithms *nassecurityalgorithms, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_nas_security_algorithms(
NASSecurityAlgorithms nassecurityalgorithms, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_nas_security_algorithms(
NASSecurityAlgorithms* nassecurityalgorithms, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,16 +19,16 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NSSAI.h"
int encode_nssai(NSSAI nssai, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_nssai(NSSAI nssai, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NSSAI_MINIMUM_LENGTH, len);
......@@ -40,21 +40,19 @@ int encode_nssai(NSSAI nssai, uint8_t iei, uint8_t *buffer, uint32_t len) {
lenPtr = (buffer + encoded);
encoded++;
//TODO: fix it for MM
// TODO: fix it for MM
/*
if ((encode_result = encode_bstring (nssai, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
if ((encode_result = encode_bstring (nssai, buffer + encoded, len - encoded))
< 0) return encode_result; else encoded += encode_result;
*/
*lenPtr = encoded - 1 - ((iei > 0) ? 1 : 0);
return encoded;
}
int decode_nssai(NSSAI *nssai, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_nssai(NSSAI* nssai, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
// int decode_result;
// int decode_result;
if (iei > 0) {
CHECK_IEI_DECODER(iei, *buffer);
......@@ -64,13 +62,10 @@ int decode_nssai(NSSAI *nssai, uint8_t iei, uint8_t *buffer, uint32_t len) {
ielen = *(buffer + decoded);
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
//TODO: fix it for MM
// TODO: fix it for MM
/*
if((decode_result = decode_bstring (nssai, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
if((decode_result = decode_bstring (nssai, ielen, buffer + decoded, len -
decoded)) < 0) return decode_result; else decoded += decode_result;
*/
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,10 +30,10 @@
#define NSSAI_MAXIMUM_LENGTH 146
typedef struct {
SNSSAI *value;
SNSSAI* value;
} NSSAI;
int encode_nssai(NSSAI nssai, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_nssai(NSSAI *nssai, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_nssai(NSSAI nssai, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_nssai(NSSAI* nssai, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,21 +19,23 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NSSAIInclusionMode.h"
int encode_nssai_inclusion_mode(NSSAIInclusionMode nssaiinclusionmode, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_nssai_inclusion_mode(
NSSAIInclusionMode nssaiinclusionmode, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NSSAI_INCLUSION_MODE_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NSSAI_INCLUSION_MODE_MINIMUM_LENGTH, len);
if (iei > 0)
bitStream |= (iei & 0xf0);
if (iei > 0) bitStream |= (iei & 0xf0);
bitStream |= (nssaiinclusionmode & 0x0f);
ENCODE_U8(buffer + encoded, bitStream, encoded);
......@@ -43,22 +45,20 @@ int encode_nssai_inclusion_mode(NSSAIInclusionMode nssaiinclusionmode, uint8_t i
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER (buffer,NSSAI_INCLUSION_MODE_MINIMUM_LENGTH , len);
ENCODE_U8(buffer+encoded,((iei&0x0f)<<4)|0x00|(nssaiinclusionmode&0x03),encoded);
//ENCODE_U8(buffer+encoded,((iei&0x0f)<<4)|0x00|(nssaiinclusionmode&0x03),encoded);
printf("encode_nssai_inclusion_mode-------------buffer:0x%x,bitStream:0x%x\n", *buffer,((iei&0x0f)<<4)|0x00|(nssaiinclusionmode&0x03));
return encoded;
#endif
#endif
}
int decode_nssai_inclusion_mode(NSSAIInclusionMode *nssaiinclusionmode, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_nssai_inclusion_mode(
NSSAIInclusionMode* nssaiinclusionmode, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer + decoded, bitStream, decoded);
if (iei != (bitStream & 0xf0))
return -1;
if (iei != (bitStream & 0xf0)) return -1;
*nssaiinclusionmode = bitStream & 0x0f;
return decoded;
#if 0
......@@ -66,12 +66,10 @@ int decode_nssai_inclusion_mode(NSSAIInclusionMode *nssaiinclusionmode, uint8_t
uint8_t bitStream = 0;
DECODE_U8(buffer+decoded,bitStream,decoded);
printf("decode_nssai_inclusion_mode-------------buffer:0x%x,bitStream:0x%x\n", *buffer,bitStream);
if(iei != ((bitStream&0xf0)>>4))
return -1;
*nssaiinclusionmode = bitStream&0x03;
return decoded;
#endif
#endif
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -35,7 +35,11 @@
typedef uint8_t NSSAIInclusionMode;
int encode_nssai_inclusion_mode(NSSAIInclusionMode nssaiinclusionmode, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_nssai_inclusion_mode(NSSAIInclusionMode *nssaiinclusionmode, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_nssai_inclusion_mode(
NSSAIInclusionMode nssaiinclusionmode, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_nssai_inclusion_mode(
NSSAIInclusionMode* nssaiinclusionmode, uint8_t iei, uint8_t* buffer,
uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,21 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NetworkName.h"
int encode_network_name(NetworkName networkname, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_network_name(
NetworkName networkname, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NETWORK_NAME_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NETWORK_NAME_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,7 +43,8 @@ int encode_network_name(NetworkName networkname, uint8_t iei, uint8_t *buffer, u
lenPtr = (buffer + encoded);
encoded++;
if ((encode_result = encode_bstring(networkname, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result =
encode_bstring(networkname, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -50,8 +53,9 @@ int encode_network_name(NetworkName networkname, uint8_t iei, uint8_t *buffer, u
return encoded;
}
int decode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_network_name(
NetworkName* networkname, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -64,10 +68,10 @@ int decode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer,
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(networkname, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
networkname, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,9 @@
typedef bstring NetworkName;
int encode_network_name(NetworkName networkname, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_network_name(NetworkName *networkname, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_network_name(
NetworkName networkname, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_network_name(
NetworkName* networkname, uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,18 +19,21 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NetworkSlicingIndication.h"
int encode_network_slicing_indication(NetworkSlicingIndication networkslicingindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_network_slicing_indication(
NetworkSlicingIndication networkslicingindication, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NETWORK_SLICING_INDICATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NETWORK_SLICING_INDICATION_MINIMUM_LENGTH, len);
if (iei > 0) {
bitStream |= (iei & 0xf0);
......@@ -43,8 +46,10 @@ int encode_network_slicing_indication(NetworkSlicingIndication networkslicingind
return encoded;
}
int decode_network_slicing_indication(NetworkSlicingIndication *networkslicingindication, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_network_slicing_indication(
NetworkSlicingIndication* networkslicingindication, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer + decoded, bitStream, decoded);
......@@ -57,10 +62,8 @@ int decode_network_slicing_indication(NetworkSlicingIndication *networkslicingin
bitStream = (bitStream & 0x0f);
}
//networkslicingindication->dcni = bitStream&0x02;
networkslicingindication->dcni = (bitStream & 0x02) >> 1;
networkslicingindication->dcni = (bitStream & 0x02) >> 1;
networkslicingindication->nssci = bitStream & 0x01;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -29,12 +29,15 @@
#define NETWORK_SLICING_INDICATION_MAXIMUM_LENGTH 1
typedef struct {
uint8_t dcni :1;
uint8_t nssci :1;
uint8_t dcni : 1;
uint8_t nssci : 1;
} NetworkSlicingIndication;
int encode_network_slicing_indication(NetworkSlicingIndication networkslicingindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_network_slicing_indication(NetworkSlicingIndication *networkslicingindication, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_network_slicing_indication(
NetworkSlicingIndication networkslicingindication, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_network_slicing_indication(
NetworkSlicingIndication* networkslicingindication, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,20 +19,24 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "NetworkSlicingInformation.h"
int encode_network_slicing_information(NetworkSlicingInformation networkslicinginformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_network_slicing_information(
NetworkSlicingInformation networkslicinginformation, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, NETWORK_SLICING_INFORMATION_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, NETWORK_SLICING_INFORMATION_MINIMUM_LENGTH, len);
if ((encode_result = encode_bstring(networkslicinginformation, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
networkslicinginformation, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -40,15 +44,18 @@ int encode_network_slicing_information(NetworkSlicingInformation networkslicingi
return encoded;
}
int decode_network_slicing_information(NetworkSlicingInformation *networkslicinginformation, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_network_slicing_information(
NetworkSlicingInformation* networkslicinginformation, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
if ((decode_result = decode_bstring(networkslicinginformation, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
networkslicinginformation, ielen, buffer + decoded, len - decoded)) <
0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -30,7 +30,11 @@
typedef bstring NetworkSlicingInformation;
int encode_network_slicing_information(NetworkSlicingInformation networkslicinginformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_network_slicing_information(NetworkSlicingInformation *networkslicinginformation, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_network_slicing_information(
NetworkSlicingInformation networkslicinginformation, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_network_slicing_information(
NetworkSlicingInformation* networkslicinginformation, uint8_t iei,
uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,23 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "OperatorDefinedAccessCategoryDefinitions.h"
int encode_operator_defined_access_category_definitions(OperatorDefinedAccessCategoryDefinitions operatordefinedaccesscategorydefinitions, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_operator_defined_access_category_definitions(
OperatorDefinedAccessCategoryDefinitions
operatordefinedaccesscategorydefinitions,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, OPERATOR_DEFINED_ACCESS_CATEGORY_DEFINITIONS_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, OPERATOR_DEFINED_ACCESS_CATEGORY_DEFINITIONS_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -42,21 +46,26 @@ int encode_operator_defined_access_category_definitions(OperatorDefinedAccessCat
encoded++;
encoded++;
if ((encode_result = encode_bstring(operatordefinedaccesscategorydefinitions, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
operatordefinedaccesscategorydefinitions, buffer + encoded,
len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
uint32_t res = encoded - 1 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_operator_defined_access_category_definitions(OperatorDefinedAccessCategoryDefinitions *operatordefinedaccesscategorydefinitions, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_operator_defined_access_category_definitions(
OperatorDefinedAccessCategoryDefinitions*
operatordefinedaccesscategorydefinitions,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -71,10 +80,11 @@ int decode_operator_defined_access_category_definitions(OperatorDefinedAccessCat
decoded++;
CHECK_LENGTH_DECODER(len - decoded, ielen);
if ((decode_result = decode_bstring(operatordefinedaccesscategorydefinitions, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
operatordefinedaccesscategorydefinitions, ielen, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,6 +27,11 @@
typedef bstring OperatorDefinedAccessCategoryDefinitions;
int encode_operator_defined_access_category_definitions(OperatorDefinedAccessCategoryDefinitions operatordefinedaccesscategorydefinitions, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_operator_defined_access_category_definitions(OperatorDefinedAccessCategoryDefinitions *operatordefinedaccesscategorydefinitions, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_operator_defined_access_category_definitions(
OperatorDefinedAccessCategoryDefinitions
operatordefinedaccesscategorydefinitions,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_operator_defined_access_category_definitions(
OperatorDefinedAccessCategoryDefinitions*
operatordefinedaccesscategorydefinitions,
uint8_t iei, uint8_t* buffer, uint32_t len);
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,24 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "PDUAddress.h"
int encode_pdu_address(PDUAddress pduaddress, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr = NULL;
uint32_t encoded = 0;
int encode_pdu_address(
PDUAddress pduaddress, uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr = NULL;
uint32_t encoded = 0;
int encode_result = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, ((iei > 0) ? PDU_ADDRESS_MINIMUM_LENGTH_TLV : PDU_ADDRESS_MINIMUM_LENGTH_TLV-1), len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer,
((iei > 0) ? PDU_ADDRESS_MINIMUM_LENGTH_TLV :
PDU_ADDRESS_MINIMUM_LENGTH_TLV - 1),
len);
if (iei > 0) {
*buffer = iei;
......@@ -39,25 +44,30 @@ int encode_pdu_address(PDUAddress pduaddress, uint8_t iei, uint8_t *buffer, uint
}
lenPtr = buffer + encoded;
encoded++; //ENCODE_U8(buffer+encoded,pduaddress.length, encoded);
encoded++; // ENCODE_U8(buffer+encoded,pduaddress.length, encoded);
uint8_t len_pos = encoded;
ENCODE_U8(buffer + encoded, (uint8_t)(pduaddress.pdu_session_type_value & 0x07), encoded);
ENCODE_U8(
buffer + encoded, (uint8_t)(pduaddress.pdu_session_type_value & 0x07),
encoded);
if ((encode_result = encode_bstring(pduaddress.pdu_address_information, buffer + encoded, len - encoded)) < 0)
if ((encode_result = encode_bstring(
pduaddress.pdu_address_information, buffer + encoded,
len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
//set length
// set length
*(uint8_t*) (lenPtr) = encoded - len_pos;
return encoded;
}
int decode_pdu_address(PDUAddress *pduaddress, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_pdu_address(
PDUAddress* pduaddress, uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result = 0;
uint8_t bitStream = 0x00;
......@@ -73,11 +83,12 @@ int decode_pdu_address(PDUAddress *pduaddress, uint8_t iei, uint8_t *buffer, uin
DECODE_U8(buffer + decoded, bitStream, decoded);
pduaddress->pdu_session_type_value = bitStream & 0x07;
if ((decode_result = decode_bstring(&pduaddress->pdu_address_information, ielen - 1, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
&pduaddress->pdu_address_information, ielen - 1, buffer + decoded,
len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -28,17 +28,18 @@
#define PDU_ADDRESS_MINIMUM_LENGTH_TLV 7
#define PDU_ADDRESS_MAXIMUM_LENGTH_TLV 15
#define PDU_ADDRESS_IPV4 0x01
#define PDU_ADDRESS_IPV6 0x02
#define PDU_ADDRESS_IPV4V6 0x03
#define PDU_ADDRESS_IPV4 0x01
#define PDU_ADDRESS_IPV6 0x02
#define PDU_ADDRESS_IPV4V6 0x03
typedef struct {
uint8_t length;
uint8_t spare:5;
uint8_t pdu_session_type_value:3;
uint8_t spare : 5;
uint8_t pdu_session_type_value : 3;
bstring pdu_address_information;
}__attribute__((__packed__)) PDUAddress;
int encode_pdu_address(PDUAddress pduaddress, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_pdu_address(PDUAddress *pduaddress, uint8_t iei, uint8_t *buffer, uint32_t len);
} __attribute__((__packed__)) PDUAddress;
int encode_pdu_address(
PDUAddress pduaddress, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_pdu_address(
PDUAddress* pduaddress, uint8_t iei, uint8_t* buffer, uint32_t len);
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,35 +19,37 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "PDUSessionIdentity.h"
int encode_pdu_session_identity(PDUSessionIdentity pdusessionidentity, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint32_t encoded = 0;
int encode_pdu_session_identity(
PDUSessionIdentity pdusessionidentity, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint32_t encoded = 0;
uint8_t bitStream = 0x0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDU_SESSION_IDENTITY_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_IDENTITY_MINIMUM_LENGTH, len);
if (iei > 0) {
bitStream = 0x00 | (iei & 0xf0) | (pdusessionidentity & 0x0f);
}
ENCODE_U8(buffer + encoded, bitStream, encoded);
return encoded;
}
int decode_pdu_session_identity(PDUSessionIdentity *pdusessionidentity, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_pdu_session_identity(
PDUSessionIdentity* pdusessionidentity, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t bitStream = 0x0;
DECODE_U8(buffer + decoded, bitStream, decoded);
if (iei != (bitStream & 0xf0))
return -1;
if (iei != (bitStream & 0xf0)) return -1;
*pdusessionidentity = bitStream & 0x0f;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,6 +27,9 @@
typedef uint8_t PDUSessionIdentity;
int encode_pdu_session_identity(PDUSessionIdentity pdusessionidentity, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_pdu_session_identity(PDUSessionIdentity *pdusessionidentity, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_pdu_session_identity(
PDUSessionIdentity pdusessionidentity, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_pdu_session_identity(
PDUSessionIdentity* pdusessionidentity, uint8_t iei, uint8_t* buffer,
uint32_t len);
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,24 +19,28 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "PDUSessionIdentity2.h"
int encode_pdu_session_identity2(PDUSessionIdentity2 pdusessionidentity2, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_pdu_session_identity2(
PDUSessionIdentity2 pdusessionidentity2, uint8_t iei, uint8_t* buffer,
uint32_t len) {
uint32_t encoded = 0;
int encode_result;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDU_SESSION_IDENTITY2_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_IDENTITY2_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
encoded++;
}
if ((encode_result = encode_bstring(pdusessionidentity2, buffer + encoded, len - encoded)) < 0) //加密,实体,首地址,长度
if ((encode_result = encode_bstring(
pdusessionidentity2, buffer + encoded, len - encoded)) < 0)
return encode_result;
else
encoded += encode_result;
......@@ -44,8 +48,10 @@ int encode_pdu_session_identity2(PDUSessionIdentity2 pdusessionidentity2, uint8_
return encoded;
}
int decode_pdu_session_identity2(PDUSessionIdentity2 *pdusessionidentity2, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_pdu_session_identity2(
PDUSessionIdentity2* pdusessionidentity2, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
int decode_result;
......@@ -54,10 +60,10 @@ int decode_pdu_session_identity2(PDUSessionIdentity2 *pdusessionidentity2, uint8
decoded++;
}
if ((decode_result = decode_bstring(pdusessionidentity2, ielen, buffer + decoded, len - decoded)) < 0)
if ((decode_result = decode_bstring(
pdusessionidentity2, ielen, buffer + decoded, len - decoded)) < 0)
return decode_result;
else
decoded += decode_result;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,6 +27,9 @@
typedef bstring PDUSessionIdentity2;
int encode_pdu_session_identity2(PDUSessionIdentity2 pdusessionidentity2, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_pdu_session_identity2(PDUSessionIdentity2 *pdusessionidentity2, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_pdu_session_identity2(
PDUSessionIdentity2 pdusessionidentity2, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_pdu_session_identity2(
PDUSessionIdentity2* pdusessionidentity2, uint8_t iei, uint8_t* buffer,
uint32_t len);
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,18 +19,21 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "PDUSessionReactivationResult.h"
int encode_pdu_session_reactivation_result(PDUSessionReactivationResult pdusessionreactivationresult, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_pdu_session_reactivation_result(
PDUSessionReactivationResult pdusessionreactivationresult, uint8_t iei,
uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDU_SESSION_REACTIVATION_RESULT_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_REACTIVATION_RESULT_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -46,8 +49,10 @@ int encode_pdu_session_reactivation_result(PDUSessionReactivationResult pdusessi
return encoded;
}
int decode_pdu_session_reactivation_result(PDUSessionReactivationResult *pdusessionreactivationresult, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_pdu_session_reactivation_result(
PDUSessionReactivationResult* pdusessionreactivationresult, uint8_t iei,
uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
if (iei > 0) {
......@@ -63,4 +68,3 @@ int decode_pdu_session_reactivation_result(PDUSessionReactivationResult *pdusess
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,6 +27,9 @@
typedef uint16_t PDUSessionReactivationResult;
int encode_pdu_session_reactivation_result(PDUSessionReactivationResult pdusessionreactivationresult, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_pdu_session_reactivation_result(PDUSessionReactivationResult *pdusessionreactivationresult, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_pdu_session_reactivation_result(
PDUSessionReactivationResult pdusessionreactivationresult, uint8_t iei,
uint8_t* buffer, uint32_t len);
int decode_pdu_session_reactivation_result(
PDUSessionReactivationResult* pdusessionreactivationresult, uint8_t iei,
uint8_t* buffer, uint32_t len);
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,23 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "PDUSessionReactivationResultErrorCause.h"
int encode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationResultErrorCause pdusessionreactivationresulterrorcause, uint8_t iei, uint8_t *buffer, uint32_t len) {
uint8_t *lenPtr;
int encode_pdu_session_reactivation_result_error_cause(
PDUSessionReactivationResultErrorCause
pdusessionreactivationresulterrorcause,
uint8_t iei, uint8_t* buffer, uint32_t len) {
uint8_t* lenPtr;
uint32_t encoded = 0;
int elementIndex = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDU_SESSION_REACTIVATION_RESULT_ERROR_CAUSE_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_REACTIVATION_RESULT_ERROR_CAUSE_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -41,29 +45,33 @@ int encode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationRes
lenPtr = (buffer + encoded);
encoded++;
encoded++;
struct PduSessionID_CauseValue *ptr = pdusessionreactivationresulterrorcause.element;
if (!ptr)
return encoded;
ENCODE_U16(buffer + encoded, pdusessionreactivationresulterrorcause.size, encoded);
for (; elementIndex < pdusessionreactivationresulterrorcause.size; elementIndex++) {
if (!ptr)
break;
struct PduSessionID_CauseValue* ptr =
pdusessionreactivationresulterrorcause.element;
if (!ptr) return encoded;
ENCODE_U16(
buffer + encoded, pdusessionreactivationresulterrorcause.size, encoded);
for (; elementIndex < pdusessionreactivationresulterrorcause.size;
elementIndex++) {
if (!ptr) break;
ENCODE_U8(buffer + encoded, ptr->pduSessionID, encoded);
ENCODE_U8(buffer + encoded, ptr->causeValue, encoded);
ptr = ptr->next;
}
uint32_t res = encoded - 1 - ((iei > 0) ? 1 : 0);
*lenPtr = res / (1 << 8);
*lenPtr = res / (1 << 8);
lenPtr++;
*lenPtr = res % (1 << 8);
return encoded;
}
int decode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationResultErrorCause *pdusessionreactivationresulterrorcause, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
uint16_t ielen = 0;
int decode_pdu_session_reactivation_result_error_cause(
PDUSessionReactivationResultErrorCause*
pdusessionreactivationresulterrorcause,
uint8_t iei, uint8_t* buffer, uint32_t len) {
int decoded = 0;
uint16_t ielen = 0;
int elementIndex = 0;
if (iei > 0) {
......@@ -71,8 +79,6 @@ int decode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationRes
decoded++;
}
//encode ����decoded;
decoded++;
decoded++;
DECODE_U16(buffer + decoded, ielen, decoded);
......@@ -80,10 +86,12 @@ int decode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationRes
CHECK_LENGTH_DECODER(len - decoded, ielen);
pdusessionreactivationresulterrorcause->size = ielen;
struct PduSessionID_CauseValue *lastPtr = NULL;
//for(;elementIndex<ielen/2;elementIndex++){
struct PduSessionID_CauseValue* lastPtr = NULL;
// for(;elementIndex<ielen/2;elementIndex++){
for (; elementIndex < ielen; elementIndex++) {
struct PduSessionID_CauseValue *ptr = (struct PduSessionID_CauseValue*) calloc(1, sizeof(struct PduSessionID_CauseValue));
struct PduSessionID_CauseValue* ptr =
(struct PduSessionID_CauseValue*) calloc(
1, sizeof(struct PduSessionID_CauseValue));
DECODE_U8(buffer + decoded, ptr->pduSessionID, decoded);
DECODE_U8(buffer + decoded, ptr->causeValue, decoded);
if (lastPtr)
......@@ -92,9 +100,7 @@ int decode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationRes
pdusessionreactivationresulterrorcause->element = ptr;
lastPtr = ptr;
}
if (lastPtr)
lastPtr->next = NULL;
if (lastPtr) lastPtr->next = NULL;
return decoded;
}
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,14 +31,20 @@
struct PduSessionID_CauseValue {
uint8_t pduSessionID;
uint8_t causeValue;
struct PduSessionID_CauseValue *next;
struct PduSessionID_CauseValue* next;
};
typedef struct {
uint16_t size;
struct PduSessionID_CauseValue *element;
struct PduSessionID_CauseValue* element;
} PDUSessionReactivationResultErrorCause;
int encode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationResultErrorCause pdusessionreactivationresulterrorcause, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_pdu_session_reactivation_result_error_cause(PDUSessionReactivationResultErrorCause *pdusessionreactivationresulterrorcause, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_pdu_session_reactivation_result_error_cause(
PDUSessionReactivationResultErrorCause
pdusessionreactivationresulterrorcause,
uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_pdu_session_reactivation_result_error_cause(
PDUSessionReactivationResultErrorCause*
pdusessionreactivationresulterrorcause,
uint8_t iei, uint8_t* buffer, uint32_t len);
#endif
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -19,19 +19,22 @@
* contact@openairinterface.org
*/
#include<stdio.h>
#include<stdlib.h>
#include<stdint.h>
#include <stdio.h>
#include <stdlib.h>
#include <stdint.h>
#include "TLVEncoder.h"
#include "TLVDecoder.h"
#include "PDUSessionStatus.h"
int encode_pdu_session_status(PDUSessionStatus pdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len) {
int encode_pdu_session_status(
PDUSessionStatus pdusessionstatus, uint8_t iei, uint8_t* buffer,
uint32_t len) {
printf("encode_pdu_session_status\n");
uint8_t *lenPtr;
uint8_t* lenPtr;
uint32_t encoded = 0;
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(buffer, PDU_SESSION_STATUS_MINIMUM_LENGTH, len);
CHECK_PDU_POINTER_AND_LENGTH_ENCODER(
buffer, PDU_SESSION_STATUS_MINIMUM_LENGTH, len);
if (iei > 0) {
*buffer = iei;
......@@ -47,8 +50,10 @@ int encode_pdu_session_status(PDUSessionStatus pdusessionstatus, uint8_t iei, ui
return encoded;
}
int decode_pdu_session_status(PDUSessionStatus *pdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len) {
int decoded = 0;
int decode_pdu_session_status(
PDUSessionStatus* pdusessionstatus, uint8_t iei, uint8_t* buffer,
uint32_t len) {
int decoded = 0;
uint8_t ielen = 0;
if (iei > 0) {
......
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -27,6 +27,9 @@
typedef uint16_t PDUSessionStatus;
int encode_pdu_session_status(PDUSessionStatus pdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_pdu_session_status(PDUSessionStatus *pdusessionstatus, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_pdu_session_status(
PDUSessionStatus pdusessionstatus, uint8_t iei, uint8_t* buffer,
uint32_t len);
int decode_pdu_session_status(
PDUSessionStatus* pdusessionstatus, uint8_t iei, uint8_t* buffer,
uint32_t len);
This diff is collapsed.
......@@ -3,9 +3,9 @@
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
* the OAI Public License, Version 1.1 (the "License"); you may not use this
* file except in compliance with the License. You may obtain a copy of the
* License at
*
* http://www.openairinterface.org/?page_id=698
*
......@@ -31,6 +31,7 @@ typedef struct {
} PLMN;
typedef PLMN PLMNList[15];
int encode_plmn_list(PLMNList plmnlist, uint8_t iei, uint8_t *buffer, uint32_t len);
int decode_plmn_list(PLMNList plmnlist, uint8_t iei, uint8_t *buffer, uint32_t len);
int encode_plmn_list(
PLMNList plmnlist, uint8_t iei, uint8_t* buffer, uint32_t len);
int decode_plmn_list(
PLMNList plmnlist, uint8_t iei, uint8_t* buffer, uint32_t len);
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.
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.
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