Commit d671d8ad authored by mir's avatar mir

Remove CN_UTIL

parent 3bc86d69
...@@ -2112,12 +2112,6 @@ include_directories("${OPENAIR1_DIR}/SCHED_NR_UE") ...@@ -2112,12 +2112,6 @@ include_directories("${OPENAIR1_DIR}/SCHED_NR_UE")
# CN libs # CN libs
########################## ##########################
add_library(CN_UTILS
${OPENAIR3_DIR}/UTILS/conversions.c
${OPENAIR3_DIR}/UTILS/enum_string.c
${OPENAIR3_DIR}/UTILS/mcc_mnc_itu.c
)
add_library (GTPV1U add_library (GTPV1U
${NR_RRC_DIR}/rrc_gNB_GTPV1U.c ${NR_RRC_DIR}/rrc_gNB_GTPV1U.c
${RRC_DIR}/rrc_eNB_GTPV1U.c ${RRC_DIR}/rrc_eNB_GTPV1U.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
*/
#include <stdlib.h>
#include <stdint.h>
#include <ctype.h>
#include "conversions.h"
static const char hex_to_ascii_table[16] = {
'0', '1', '2', '3', '4', '5', '6', '7', '8', '9', 'a', 'b', 'c', 'd', 'e', 'f',
};
static const signed char ascii_to_hex_table[0x100] = {
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
0, 1, 2, 3, 4, 5, 6, 7, 8, 9,-1,-1,-1,-1,-1,-1,
-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,10,11,12,13,14,15,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,
-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1,-1
};
void hexa_to_ascii(uint8_t *from, char *to, size_t length)
{
int i;
for(i = 0; i < length; i++) {
uint8_t upper = (from[i] & 0xf0) >> 4;
uint8_t lower = from[i] & 0x0f;
to[2 * i] = hex_to_ascii_table[upper];
to[2 * i + 1] = hex_to_ascii_table[lower];
}
}
int ascii_to_hex(uint8_t *dst, const char *h)
{
const unsigned char *hex = (const unsigned char *) h;
unsigned i = 0;
for (;;) {
int high, low;
while (*hex && isspace(*hex))
hex++;
if (!*hex)
return 1;
high = ascii_to_hex_table[*hex++];
if (high < 0)
return 0;
while (*hex && isspace(*hex))
hex++;
if (!*hex)
return 0;
low = ascii_to_hex_table[*hex++];
if (low < 0)
return 0;
dst[i++] = (high << 4) | low;
}
}
...@@ -560,8 +560,4 @@ do { \ ...@@ -560,8 +560,4 @@ do { \
#define GTP_TEID_TO_ASN1 INT32_TO_OCTET_STRING #define GTP_TEID_TO_ASN1 INT32_TO_OCTET_STRING
#define OCTET_STRING_TO_TAC OCTET_STRING_TO_INT16 #define OCTET_STRING_TO_TAC OCTET_STRING_TO_INT16
void hexa_to_ascii(uint8_t *from, char *to, size_t length);
int ascii_to_hex(uint8_t *dst, const char *h);
#endif /* CONVERSIONS_H_ */ #endif /* CONVERSIONS_H_ */
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include "common_types.h"
#include "enum_string.h"
enum_to_string_t rat_to_string[NUMBER_OF_RAT_TYPE] = {
{ RAT_WLAN, "WLAN" },
{ RAT_VIRTUAL, "VIRUTAL" },
{ RAT_UTRAN, "UTRAN" },
{ RAT_GERAN, "GERAN" },
{ RAT_GAN, "GAN" },
{ RAT_HSPA_EVOLUTION, "HSPA_EVOLUTION" },
{ RAT_EUTRAN, "E-UTRAN" },
{ RAT_CDMA2000_1X, "CDMA2000_1X" },
{ RAT_HRPD, "HRPD" },
{ RAT_UMB, "UMB" },
{ RAT_EHRPD, "EHRPD" },
};
enum_to_string_t network_access_mode_to_string[NAM_MAX] = {
{ NAM_PACKET_AND_CIRCUIT, "PACKET AND CIRCUIT" },
{ NAM_RESERVED, "RESERVED" },
{ NAM_ONLY_PACKET, "ONLY PACKET" },
};
enum_to_string_t all_apn_conf_ind_to_string[ALL_APN_MAX] = {
{ ALL_APN_CONFIGURATIONS_INCLUDED, "ALL APN CONFIGURATIONS INCLUDED" },
{ MODIFIED_ADDED_APN_CONFIGURATIONS_INCLUDED, "MODIFIED ADDED APN CONFIGURATIONS INCLUDED" },
};
enum_to_string_t pdn_type_to_string[IP_MAX] = {
{ IPv4, "IPv4" },
{ IPv6, "IPv6" },
{ IPv4_AND_v6, "IPv4 and IPv6" },
{ IPv4_OR_v6, "IPv4 or IPv6" },
};
static int
compare_values(const void *m1, const void *m2)
{
enum_to_string_t *mi1 = (enum_to_string_t *) m1;
enum_to_string_t *mi2 = (enum_to_string_t *) m2;
return (mi1->enum_value - mi2->enum_value);
}
char *enum_to_string(int enum_val, enum_to_string_t *string_table, int nb_element)
{
enum_to_string_t *res;
enum_to_string_t temp;
temp.enum_value = enum_val;
res = bsearch(&temp, string_table, nb_element,
sizeof(enum_to_string_t), compare_values);
if (res == NULL) {
return "UNKNOWN";
}
return res->enum_value_name;
}
/*
* 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 ENUM_STRING_H_
#define ENUM_STRING_H_
typedef struct {
int enum_value;
char *enum_value_name;
} enum_to_string_t;
extern enum_to_string_t network_access_mode_to_string[NAM_MAX];
extern enum_to_string_t rat_to_string[NUMBER_OF_RAT_TYPE];
extern enum_to_string_t pdn_type_to_string[IP_MAX];
char *enum_to_string(int enum_val, enum_to_string_t *string_table, int nb_element);
#define ACCESS_MODE_TO_STRING(vAL) \
enum_to_string((int)vAL, network_access_mode_to_string, \
sizeof(network_access_mode_to_string) / sizeof(enum_to_string_t))
#define PDN_TYPE_TO_STRING(vAL) \
enum_to_string((int)vAL, pdn_type_to_string, \
sizeof(pdn_type_to_string) / sizeof(enum_to_string_t))
#endif /* ENUM_STRING_H_ */
This diff is collapsed.
/*
* Licensed to the OpenAirInterface (OAI) Software Alliance under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The OpenAirInterface Software Alliance licenses this file to You under
* the OAI Public License, Version 1.1 (the "License"); you may not use this file
* except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.openairinterface.org/?page_id=698
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*-------------------------------------------------------------------------------
* For more information about the OpenAirInterface (OAI) Software Alliance:
* contact@openairinterface.org
*/
/*****************************************************************************
Source mcc_mnc.h
Version 0.1
Date {2014/10/02
Product
Subsystem
Author Lionel GAUTHIER
Description Defines the MCC/MNC list delivered by the ITU
*****************************************************************************/
#ifndef __MCC_MNC_H__
#define __MCC_MNC_H__
typedef struct mcc_mnc_list_s {
uint16_t mcc;
char mnc[4];
} mcc_mnc_list_t;
int find_mnc_length(const char mcc_digit1P,
const char mcc_digit2P,
const char mcc_digit3P,
const char mnc_digit1P,
const char mnc_digit2P,
const char mnc_digit3P);
#endif
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