Commit 36f6b3e5 authored by Tien-Thinh Nguyen's avatar Tien-Thinh Nguyen

Merge branch 'cpp_check' into 'develop'

CPP check

See merge request oai/cn5g/oai-cn5g-smf!18
parents 481e3d88 352409cd
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_29_500_SMF_SEEN
#define FILE_3GPP_29_500_SMF_SEEN
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -96,15 +96,6 @@ void _Logger::trace(const char *format, ...) {
#endif
}
void _Logger::trace(const std::string &format, ...) {
#if TRACE_IS_ON
va_list args;
va_start( args, format );
log( _ltTrace, format.c_str(), args );
va_end( args );
#endif
}
void _Logger::debug(const char *format, ...) {
#if DEBUG_IS_ON
va_list args;
......@@ -114,15 +105,6 @@ void _Logger::debug(const char *format, ...) {
#endif
}
void _Logger::debug(const std::string &format, ...) {
#if DEBUG_IS_ON
va_list args;
va_start( args, format );
log( _ltDebug, format.c_str(), args );
va_end( args );
#endif
}
void _Logger::info(const char *format, ...) {
#if INFO_IS_ON
va_list args;
......@@ -132,15 +114,6 @@ void _Logger::info(const char *format, ...) {
#endif
}
void _Logger::info(const std::string &format, ...) {
#if INFO_IS_ON
va_list args;
va_start( args, format );
log( _ltInfo, format.c_str(), args );
va_end( args );
#endif
}
void _Logger::startup(const char *format, ...) {
va_list args;
va_start(args, format);
......@@ -148,13 +121,6 @@ void _Logger::startup(const char *format, ...) {
va_end(args);
}
void _Logger::startup(const std::string &format, ...) {
va_list args;
va_start(args, format);
log(_ltStartup, format.c_str(), args);
va_end(args);
}
void _Logger::warn(const char *format, ...) {
va_list args;
va_start(args, format);
......@@ -162,13 +128,6 @@ void _Logger::warn(const char *format, ...) {
va_end(args);
}
void _Logger::warn(const std::string &format, ...) {
va_list args;
va_start(args, format);
log(_ltWarn, format.c_str(), args);
va_end(args);
}
void _Logger::error(const char *format, ...) {
va_list args;
va_start(args, format);
......@@ -176,13 +135,6 @@ void _Logger::error(const char *format, ...) {
va_end(args);
}
void _Logger::error(const std::string &format, ...) {
va_list args;
va_start(args, format);
log(_ltError, format.c_str(), args);
va_end(args);
}
void _Logger::log(_LogType lt, const char *format, va_list &args) {
char buffer[2048];
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -18,6 +18,7 @@
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#ifndef FILE_3GPP_24_007_SEEN
#define FILE_3GPP_24_007_SEEN
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
/*! \file 3gpp_36.401.h
\brief
\author Lionel Gauthier
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
#ifndef FILE_COMMON_TYPES_SEEN
#define FILE_COMMON_TYPES_SEEN
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
/*! \file security_types.h
\brief
\author Sebastien ROUX, Lionel Gauthier
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
/*! \file asn1_conversions.h
\brief
\author Sebastien ROUX, Lionel Gauthier
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
#include <pthread.h>
#include <stdio.h>
#include <stdlib.h>
......@@ -42,7 +43,7 @@ display_backtrace (
size = backtrace (array, 10);
strings = backtrace_symbols (array, size);
printf ("Obtained %zd stack frames.\n", size);
printf ("Obtained %zu stack frames.\n", size);
for (i = 0; i < size; i++)
printf ("%s\n", strings[i]);
......
/*
* Copyright (c) 2017 Sprint
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdlib.h>
#include <iostream>
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -19,6 +19,7 @@
* contact@openairinterface.org
*/
/*! \file get_gateway_netlink.h
\brief
\author Lionel Gauthier
......
/* From https://gist.github.com/javiermon/6272065#file-gateway_netlink-c */
/*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include "mime_parser.hpp"
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -106,7 +106,6 @@ int nas_message_encode(unsigned char *buffer, const nas_message_t *const msg,
*/
int size = _nas_message_header_encode(buffer, &msg->header, length);
if (size < 0) {
//OAILOG_FUNC_RETURN (LOG_NAS, TLV_BUFFER_TOO_SHORT);
return TLV_BUFFER_TOO_SHORT;
} else if (size > 2) {
/*
......@@ -196,7 +195,7 @@ int nas_message_encode(unsigned char *buffer, const nas_message_t *const msg,
int nas_message_decode(const unsigned char *const buffer, nas_message_t *msg,
size_t length, void *security,
nas_message_decode_status_t *status) {
//OAILOG_FUNC_IN (LOG_NAS);
fivegmm_security_context_t *fivegmm_security_context =
(fivegmm_security_context_t*) security;
int bytes = 0;
......@@ -212,12 +211,10 @@ int nas_message_decode(const unsigned char *const buffer, nas_message_t *msg,
}
size = _nas_message_header_decode(buffer, &msg->header, length, status,
&is_sr);
//OAILOG_DEBUG(LOG_NAS, "return header size(%d)\n",size);
//OAILOG_DEBUG (LOG_NAS, "_nas_message_header_decode returned size %d\n", size);
if (size < 0) {
return TLV_BUFFER_TOO_SHORT;
//OAILOG_FUNC_RETURN (LOG_NAS, TLV_BUFFER_TOO_SHORT);
}
if (size > 1) {
// found security header
......@@ -288,7 +285,6 @@ int nas_message_decode(const unsigned char *const buffer, nas_message_t *msg,
}
//return bytes;
//OAILOG_FUNC_RETURN (LOG_NAS, bytes);
return RETURNok ;
}
......@@ -325,7 +321,6 @@ static int _nas_message_header_encode(
* Encode the first octet of the header (security header type or EPS bearer
* * * * identity, and protocol discriminator)
*/
//ENCODE_U8 (buffer, *(uint8_t *) (header), size);
ENCODE_U8(buffer, header->extended_protocol_discriminator, size);
//Security header type associated with a spare half octet;
......@@ -347,7 +342,6 @@ static int _nas_message_header_encode(
* The buffer is not big enough to contain security header
*/
//OAILOG_WARNING(LOG_NAS, "NET-API - The size of the header (%u) " "exceeds the buffer length (%lu)\n", NAS_MESSAGE_SECURITY_HEADER_SIZE, length);
//OAILOG_FUNC_RETURN (LOG_NAS, RETURNerror);
return RETURNerror ;
}
......@@ -365,8 +359,6 @@ static int _nas_message_header_encode(
#endif
}
return size;
//OAILOG_STREAM_HEX(OAILOG_LEVEL_DEBUG, LOG_NAS, "encode nas header Incoming NAS message: ", buffer, size)
//OAILOG_FUNC_RETURN (LOG_NAS, size);
}
/****************************************************************************
......@@ -390,7 +382,7 @@ static int _nas_message_header_encode(
static int _nas_message_protected_encode(
unsigned char *buffer, const nas_message_security_protected_t *msg,
size_t length, void *security) {
//OAILOG_FUNC_IN (LOG_NAS);
fivegmm_security_context_t *fivegmm_security_context =
(fivegmm_security_context_t*) security;
int bytes = TLV_BUFFER_TOO_SHORT;
......@@ -424,7 +416,6 @@ static int _nas_message_protected_encode(
free_wrapper((void**) &plain_msg);
}
return bytes;
//OAILOG_FUNC_RETURN (LOG_NAS, bytes);
}
/****************************************************************************
......@@ -448,7 +439,7 @@ static int _nas_message_protected_encode(
static int _nas_message_plain_encode(
unsigned char *buffer, const nas_message_security_header_t *header,
const nas_message_plain_t *msg, size_t length) {
//OAILOG_FUNC_IN (LOG_NAS);
int bytes = TLV_PROTOCOL_NOT_SUPPORTED;
if (header->extended_protocol_discriminator
......@@ -471,7 +462,6 @@ static int _nas_message_plain_encode(
//OAILOG_WARNING(LOG_NAS, "NET-API - Extended Protocol discriminator 0x%x is " "not supported\n", header->extended_protocol_discriminator);
}
return bytes;
//OAILOG_FUNC_RETURN (LOG_NAS, bytes);
}
/****************************************************************************
......@@ -599,7 +589,6 @@ static int _nas_message_encrypt(
}
break;
}
//OAILOG_FUNC_RETURN (LOG_NAS, length);
return length;
}
......@@ -625,11 +614,10 @@ static int _nas_message_encrypt(
static uint32_t _nas_message_get_mac(
const unsigned char *const buffer, size_t const length, int const direction,
fivegmm_security_context_t *const fivegmm_security_context) {
//OAILOG_FUNC_IN (LOG_NAS);
if (!fivegmm_security_context) {
//OAILOG_DEBUG (LOG_NAS, "No security context set for integrity protection algorithm\n");
//OAILOG_FUNC_RETURN (LOG_NAS, 0);
return 0;
}
switch (fivegmm_security_context->selected_algorithms.integrity) {
......@@ -667,7 +655,6 @@ static uint32_t _nas_message_get_mac(
//OAILOG_DEBUG (LOG_NAS, "NAS_SECURITY_ALGORITHMS_EIA1 returned MAC %x.%x.%x.%x(%u) for length %lu direction %d, count %d\n",
// mac[0], mac[1], mac[2], mac[3], *((uint32_t *) & mac), length, direction, count);
mac32 = (uint32_t*) &mac;
//OAILOG_FUNC_RETURN (LOG_NAS, ntohl (*mac32));
return ntohl(*mac32);
}
break;
......@@ -718,7 +705,6 @@ static uint32_t _nas_message_get_mac(
//OAILOG_ERROR(LOG_NAS, "Unknown integrity protection algorithm %d\n", fivegmm_security_context->selected_algorithms.integrity);
break;
}
//OAILOG_FUNC_RETURN (LOG_NAS, 0);
return 0;
}
......@@ -727,7 +713,7 @@ static int _nas_message_header_decode(
nas_message_security_header_t *const header, const size_t length,
nas_message_decode_status_t *const status,
bool *const is_sr) {
//OAILOG_FUNC_IN (LOG_NAS);
int size = 0;
/*
......@@ -735,7 +721,6 @@ static int _nas_message_header_decode(
*/
DECODE_U8(buffer, header->extended_protocol_discriminator, size);
//OAILOG_DEBUG(LOG_NAS,"security header type(%x)\n",header->security_header_type&0x0f);
*is_sr = false;
if (header->extended_protocol_discriminator
== EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES) {
......@@ -770,7 +755,6 @@ static int _nas_message_header_decode(
* The buffer is not big enough to contain security header
*/
//OAILOG_WARNING(LOG_NAS, "NET-API - The size of the header (%u) " "exceeds the buffer length (%lu)\n", NAS_MESSAGE_SECURITY_HEADER_SIZE, length);
//OAILOG_FUNC_RETURN (LOG_NAS, RETURNerror);
return RETURNerror ;
}
// Decode the message authentication code
......@@ -781,7 +765,6 @@ static int _nas_message_header_decode(
}
}
}
//OAILOG_FUNC_RETURN (LOG_NAS, size);
return size;
}
......@@ -790,7 +773,6 @@ static int _nas_message_protected_decode(
nas_message_plain_t *msg, size_t length,
fivegmm_security_context_t *const fivegmm_security_context,
nas_message_decode_status_t *const status) {
//OAILOG_FUNC_IN (LOG_NAS);
int bytes = TLV_BUFFER_TOO_SHORT;
unsigned char *const plain_msg = (unsigned char*) calloc(1, length);
......@@ -809,7 +791,6 @@ static int _nas_message_protected_decode(
free_wrapper((void**) &plain_msg);
}
return bytes;
//OAILOG_FUNC_RETURN (LOG_NAS, bytes);
}
static int _nas_message_decrypt(
......@@ -821,7 +802,6 @@ static int _nas_message_decrypt(
uint32_t count = 0;
uint8_t direction = 0;
//OAILOG_FUNC_IN (LOG_NAS);
int size = 0;
nas_message_security_header_t header = { 0 };
#if TEST_MAC_ENCRYPT_DECRYPT__
......@@ -927,7 +907,6 @@ static int _nas_message_decrypt(
* Decode the first octet (security header type or EPS bearer identity,
* * * * and protocol discriminator)
*/
//DECODE_U8 (dest, *(uint8_t *) (&header), size);
DECODE_U8(dest, header.extended_protocol_discriminator, size);
DECODE_U8(dest + size, header.security_header_type, size);
//OAILOG_FUNC_RETURN (LOG_NAS, header.extended_protocol_discriminator);
......@@ -940,7 +919,6 @@ static int _nas_message_decrypt(
* Decode the first octet (security header type or EPS bearer identity,
* * * * and protocol discriminator)
*/
//DECODE_U8 (dest, *(uint8_t *) (&header), size);
DECODE_U8(dest, header.extended_protocol_discriminator, size)
;
DECODE_U8(dest + size, header.security_header_type, size)
......@@ -955,7 +933,6 @@ static int _nas_message_decrypt(
* Decode the first octet (security header type or EPS bearer identity,
* * * * and protocol discriminator)
*/
//DECODE_U8 (dest, *(uint8_t *) (&header), size);
DECODE_U8(dest, header.extended_protocol_discriminator, size)
;
DECODE_U8(dest + size, header.security_header_type, size)
......@@ -980,7 +957,7 @@ static int _nas_message_decrypt(
static int _nas_message_plain_decode(
const unsigned char *buffer, const nas_message_security_header_t *header,
nas_message_plain_t *msg, size_t length) {
//OAILOG_FUNC_IN (LOG_NAS);
int bytes = TLV_PROTOCOL_NOT_SUPPORTED;
if (header->extended_protocol_discriminator
== EPD_5GS_MOBILITY_MANAGEMENT_MESSAGES) {
......@@ -997,5 +974,4 @@ static int _nas_message_plain_decode(
}
return bytes;
//OAILOG_FUNC_RETURN (LOG_NAS, bytes);
}
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......@@ -187,38 +187,18 @@ nas_stream_encrypt_nia1 (
IV[2] = ((((uint32_t) stream_cipher->bearer) & 0x0000001F) << 27);
IV[1] = (uint32_t) (stream_cipher->count) ^ ((uint32_t) (stream_cipher->direction) << 31);
IV[0] = ((((uint32_t) stream_cipher->bearer) & 0x0000001F) << 27) ^ ((uint32_t) (stream_cipher->direction & 0x00000001) << 15);
//printf ("K:\n");
//hexprint(K, 16);
//printf ("K[0]:%08X\n",K[0]);
//printf ("K[1]:%08X\n",K[1]);
//printf ("K[2]:%08X\n",K[2]);
//printf ("K[3]:%08X\n",K[3]);
//printf ("IV:\n");
//hexprint(IV, 16);
//printf ("IV[0]:%08X\n",IV[0]);
//printf ("IV[1]:%08X\n",IV[1]);
//printf ("IV[2]:%08X\n",IV[2]);
//printf ("IV[3]:%08X\n",IV[3]);
z[0] = z[1] = z[2] = z[3] = z[4] = 0;
/*
* Run SNOW 3G to produce 5 keystream words z_1, z_2, z_3, z_4 and z_5.
*/
snow3g_initialize (K, IV, &snow_3g_context);
snow3g_generate_key_stream (5, z, &snow_3g_context);
//printf ("z[0]:%08X\n",z[0]);
//printf ("z[1]:%08X\n",z[1]);
//printf ("z[2]:%08X\n",z[2]);
//printf ("z[3]:%08X\n",z[3]);
//printf ("z[4]:%08X\n",z[4]);
P = ((uint64_t) z[0] << 32) | (uint64_t) z[1];
Q = ((uint64_t) z[2] << 32) | (uint64_t) z[3];
//printf ("P:%16lX\n",P);
//printf ("Q:%16lX\n",Q);
/*
* Calculation
*/
D = ceil (stream_cipher->blength / 64.0) + 1;
//printf ("D:%d\n",D);
EVAL = 0;
c = 0x1b;
......@@ -228,7 +208,6 @@ nas_stream_encrypt_nia1 (
for (i = 0; i < D - 2; i++) {
V = EVAL ^ ((uint64_t) hton_int32 (message[2 * i]) << 32 | (uint64_t) hton_int32 (message[2 * i + 1]));
EVAL = MUL64 (V, P, c);
//printf ("Mi: %16X %16X\tEVAL: %16lX\n",hton_int32(message[2*i]),hton_int32(message[2*i+1]), EVAL);
}
/*
......@@ -258,7 +237,6 @@ nas_stream_encrypt_nia1 (
*/
EVAL = MUL64 (EVAL, Q, c);
MAC_I = (uint32_t) (EVAL >> 32) ^ z[4];
//printf ("MAC_I:%16X\n",MAC_I);
MAC_I = hton_int32 (MAC_I);
memcpy ((void *)out, &MAC_I, 4);
return 0;
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -171,6 +171,7 @@ int fivegsm_msg_encode(SM_msg *msg, uint8_t *buffer, uint32_t len) {
if (header_result < 0) {
//OAILOG_ERROR (LOG_NAS, "ESM-MSG - Failed to encode ESM message header (%d)\n", header_result);
//OAILOG_FUNC_RETURN (LOG_NAS, header_result);
return header_result;
}
buffer += header_result;
......@@ -251,6 +252,7 @@ int fivegsm_msg_encode(SM_msg *msg, uint8_t *buffer, uint32_t len) {
if (encode_result < 0) {
//OAILOG_ERROR (LOG_NAS, "SM-MSG - Failed to encode L3 ESM message 0x%x ""(%d)\n", msg->header.message_type, encode_result);
return encode_result;
}
// OAILOG_FUNC_RETURN (LOG_NAS, header_result + encode_result);
return header_result + encode_result;
......
......@@ -1191,6 +1191,7 @@ pfcp_msg::pfcp_msg(const pfcp_session_modification_response& pfcp_ies) : pfcp_ms
//------------------------------------------------------------------------------
pfcp_msg::pfcp_msg(const pfcp_session_deletion_request& pfcp_ies) : pfcp_msg_header() {
ies = {};
remote_port = 0;
set_message_type(PFCP_SESSION_DELETION_REQUEST);
// NO IEs !
}
......
......@@ -4009,6 +4009,7 @@ public:
}
//--------
explicit pfcp_urr_id_ie(const pfcp_tlv& t) : pfcp_ie(t) {
urr_id = 0;
};
//--------
void to_core_type(pfcp::urr_id_t& b) {
......@@ -4155,6 +4156,11 @@ public:
}
//--------
explicit pfcp_outer_header_creation_ie(const pfcp_tlv& t) : pfcp_ie(t) {
outer_header_creation_description = {};
teid = {};
ipv4_address = {};
ipv6_address = {};
port_number = {};
};
//--------
void to_core_type(pfcp::outer_header_creation_t& b) {
......@@ -4750,6 +4756,7 @@ public:
}
//--------
explicit pfcp_outer_header_removal_ie(const pfcp_tlv& t) : pfcp_ie(t) {
outer_header_removal_description = 0;
};
//--------
void to_core_type(pfcp::outer_header_removal_t& b) {
......@@ -5335,6 +5342,7 @@ public:
}
//--------
explicit pfcp_far_id_ie(const pfcp_tlv& t) : pfcp_ie(t) {
far_id = 0;
};
//--------
void to_core_type(pfcp::far_id_t& b) {
......@@ -5380,6 +5388,7 @@ public:
}
//--------
explicit pfcp_qer_id_ie(const pfcp_tlv& t) : pfcp_ie(t) {
qer_id = 0;
};
//--------
void to_core_type(pfcp::qer_id_t& b) {
......@@ -5918,6 +5927,7 @@ public:
}
//--------
explicit pfcp_user_plane_inactivity_timer_ie(const pfcp_tlv& t) : pfcp_ie(t) {
user_plane_inactivity_timer = 0;
};
//--------
void to_core_type(pfcp::user_plane_inactivity_timer_t& b) {
......
......@@ -3,11 +3,11 @@
* 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 Apache License, Version 2.0 (the "License"); you may not use this file
* the OAI Public License, Version 1.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.apache.org/licenses/LICENSE-2.0
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
......
......@@ -286,6 +286,12 @@ class smf_config {
local_configuration = false;
num_session_management_subscription = 0;
test_upf_cfg = {};
for (int i = 0; i < SMF_NUM_SESSION_MANAGEMENT_SUBSCRIPTION_MAX; i++) {
session_management_subscription[i] = {};
}
sbi_http2_port = 0;
}
;
......
......@@ -1795,6 +1795,8 @@ void smf_context::handle_pdu_session_update_sm_context_request(
smf_app_inst->trigger_http_response(
http_status_code_e::HTTP_STATUS_CODE_500_INTERNAL_SERVER_ERROR,
smreq->pid, N11_SESSION_UPDATE_SM_CONTEXT_RESPONSE);
free_wrapper((void**) &qos_flow_description);
return;
}
......
......@@ -79,6 +79,7 @@ class smf_qos_flow {
far_id_dl = { };
released = false;
qos_profile = { };
cause_value = 0;
}
/*
......
......@@ -702,6 +702,7 @@ bool smf_n1_n2::create_n2_sm_information(pdu_session_msg &msg,
it->first);
if (qos_flows.empty()) {
free_wrapper((void**) &ngap_IEs);
return false;
}
//TODO: support only 1 qos flow
......
......@@ -85,6 +85,7 @@ class pfcp_association {
num_retries_timer_heartbeat = 0;
trxn_id_heartbeat = 0;
timer_association = ITTI_INVALID_TIMER_ID;
is_restore_sessions_pending = false;
}
pfcp_association(const pfcp::node_id_t &ni, pfcp::recovery_time_stamp_t &rts,
pfcp::up_function_features_s &uff)
......
......@@ -1666,11 +1666,11 @@ int main(int argc, char *argv[]) {
uint8_t context_id = 1;
uint8_t pid = 1;
//test_all_procedures_for_one_session(pid, context_id, smf_ip_address,
// http_version, port);
test_all_procedures_for_one_session(pid, context_id, smf_ip_address,
http_version, port);
//test_session_establishment_multiple_threads(smf_ip_address, http_version, port);
test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
port);
//test_all_procedures_for_multiple_threads(smf_ip_address, http_version,
// port);
return 0;
}
......@@ -21,6 +21,7 @@ namespace model {
AccessType::AccessType()
{
m_value = eAccessType::AccessType_3GPP_ACCESS;
}
AccessType::~AccessType()
......
......@@ -77,6 +77,7 @@ public:
udp_server(const struct in6_addr& address, const uint16_t port_num)
: app_(nullptr), port_(port_num)
{
recv_buffer_[0] = 0;
socket_ = create_socket (address, port_);
if (socket_ > 0) {
Logger::udp().debug( "udp_server::udp_server(%s:%d)", conv::toString(address).c_str(), port_);
......
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