This commit centralizes equality-check behavior and removes duplicated macro implementations across protocol stacks. Major changes: - add `common/utils/eq_check.h` with shared `_EQ_CHECK_*`, `EQ_CHECK_GENERIC`, and optional-IE pointer helpers - replace E1AP/F1AP/NAS local equality macros and call sites with the shared helpers - remove duplicated layer-specific error/equality macro definitions from common headers and switch includes to `eq_check.h` - update CMake test flags to define `ENABLE_TESTS` for `e1ap_lib`, and 5GS NAS libraries; drop `E1AP_LOG_ERRORS` - equality-check/error printing is now consistently controlled by `ENABLE_TESTS`
48 lines
1.6 KiB
C
48 lines
1.6 KiB
C
/*
|
|
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
|
|
* contributor license agreements. See the NOTICE file distributed with
|
|
* this work for additional information regarding copyright ownership.
|
|
* The OpenAirInterface Software Alliance licenses this file to You under
|
|
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
|
|
* except in compliance with the License.
|
|
* You may obtain a copy of the License at
|
|
*
|
|
* http://www.openairinterface.org/?page_id=698
|
|
*
|
|
* Unless required by applicable law or agreed to in writing, software
|
|
* distributed under the License is distributed on an "AS IS" BASIS,
|
|
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
* See the License for the specific language governing permissions and
|
|
* limitations under the License.
|
|
*-------------------------------------------------------------------------------
|
|
* For more information about the OpenAirInterface (OAI) Software Alliance:
|
|
* contact@openairinterface.org
|
|
*/
|
|
|
|
#ifndef FGS_NAS_UTILS_H
|
|
#define FGS_NAS_UTILS_H
|
|
|
|
#include <stdint.h>
|
|
#include <arpa/inet.h>
|
|
#include <string.h> // For memcpy
|
|
#include <stdio.h>
|
|
#include "utils.h" // text_info_t, TO_ENUM, TO_TEXT
|
|
#include "common/utils/eq_check.h"
|
|
|
|
/* Map task id to printable name. */
|
|
typedef struct {
|
|
int id;
|
|
char text[256];
|
|
} text_info_t;
|
|
|
|
#define TO_TEXT(LabEl, nUmID) {nUmID, #LabEl},
|
|
#define TO_ENUM(LabEl, nUmID ) LabEl = nUmID,
|
|
|
|
#define GET_SHORT(input, size) ({ \
|
|
uint16_t tmp16; \
|
|
memcpy(&tmp16, (input), sizeof(tmp16)); \
|
|
size += htons(tmp16); \
|
|
})
|
|
|
|
#endif // FGS_NAS_UTILS_H
|