Refactor (NGAP): adopt TO_ENUM/TO_TEXT pattern for NGAP enums
TO_ENUM/TO_TEXT are already used in NAS, and can be adopted in NGAP. To avoid duplication, the following changes are introduced: * Move text_info_t, TO_ENUM, TO_TEXT to common/utils/utils.h * Include utils.h include to ngap_messages_types.h, fgs_nas_utils.h, and fgmm_lib.h * RRC establishment cause: refactor to FOREACH_RRC_ESTABLISHMENT_CAUSE macro * Cause Group: refactor to FOREACH_CAUSE_GROUP macro * Radio Network Cause: refactor to FOREACH_CAUSE_RADIO_NETWORK macro * Protocol Cause: refactor to FOREACH_CAUSE_PROTOCOL macro This change is preparatory to the introduction the paging lib with unit tests, with the goal of reducing the inter-dependency between concurrent NGAP libs.
This commit is contained in:
@@ -32,6 +32,7 @@
|
||||
#include <stdint.h>
|
||||
#include "OctetString.h"
|
||||
#include "fgs_nas_utils.h"
|
||||
#include "common/utils/utils.h" // text_info_t, TO_ENUM, TO_TEXT
|
||||
|
||||
#ifndef FGS_MOBILE_IDENTITY_H_
|
||||
#define FGS_MOBILE_IDENTITY_H_
|
||||
|
||||
@@ -32,6 +32,7 @@
|
||||
#include <stdbool.h>
|
||||
#include "fgs_nas_utils.h"
|
||||
#include "common/utils/ds/byte_array.h"
|
||||
#include "common/utils/utils.h"
|
||||
|
||||
/* The following defines are valide for
|
||||
both PDU Session Status and PDU session Reactivation Result IEs */
|
||||
|
||||
@@ -23,6 +23,7 @@
|
||||
#include <arpa/inet.h>
|
||||
#include "PduSessionEstablishmentAccept.h"
|
||||
#include "common/utils/LOG/log.h"
|
||||
#include "common/utils/utils.h" // text_info_t, TO_ENUM, TO_TEXT
|
||||
#include "fgs_nas_utils.h"
|
||||
|
||||
/**
|
||||
|
||||
@@ -25,6 +25,7 @@
|
||||
#include <stdint.h>
|
||||
#include <stdbool.h>
|
||||
#include "fgs_nas_utils.h"
|
||||
#include "common/utils/utils.h" // text_info_t, TO_ENUM, TO_TEXT
|
||||
|
||||
/* PDU Session Establish Accept Optional IE Identifiers - TS 24.501 Table 8.3.2.1.1 */
|
||||
|
||||
|
||||
@@ -29,15 +29,6 @@
|
||||
#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)); \
|
||||
|
||||
Reference in New Issue
Block a user