mirror of
https://gitlab.eurecom.fr/oai/openairinterface5g.git
synced 2026-07-13 04:30:28 +00:00
- all RAN code, CI code, configuration files, dockerfiles, in CSSL v1.0
- all deployment code (openshift, charts, ancillary files like shell
scripts), in MIT
- documentation in CC-BY-4.0
- exceptions might apply and are listed in NOTICE
- there is a new LICENSES folder with all licenses
- CONTRIBUTIONS.md has been updated accordingly
For automated changes based on OAI PL v1.1:
perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.{c,h,cpp}
perl -i~ -0pe 's/\/\*.*Licensed to the OpenAirInterface.*openairinterface.org\n#?/\/*\n * SPDX-License-Identifier: LicenseRef-CSSL-1.0\n/s' **/*.ts
perl -i~ -0pe 's/<!--.*Licensed to the OpenAirInterface.*openairinterface.org\n.*-->/<!-- SPDX-License-Identifier: LicenseRef-CSSL-1.0 -->/s' **/*.xml
The rest (cmake, files with missing license, cmake) manually.
112 lines
2.3 KiB
C
112 lines
2.3 KiB
C
/*
|
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
*/
|
|
|
|
#include "m2ap_ids.h"
|
|
|
|
#include <string.h>
|
|
|
|
void m2ap_id_manager_init(m2ap_id_manager *m)
|
|
{
|
|
int i;
|
|
memset(m, 0, sizeof(m2ap_id_manager));
|
|
for (i = 0; i < M2AP_MAX_IDS; i++)
|
|
m->ids[i].rnti = -1;
|
|
}
|
|
|
|
int m2ap_allocate_new_id(m2ap_id_manager *m)
|
|
{
|
|
int i;
|
|
for (i = 0; i < M2AP_MAX_IDS; i++)
|
|
if (m->ids[i].rnti == -1) {
|
|
m->ids[i].rnti = 0;
|
|
m->ids[i].id_source = -1;
|
|
m->ids[i].id_target = -1;
|
|
return i;
|
|
}
|
|
return -1;
|
|
}
|
|
|
|
void m2ap_release_id(m2ap_id_manager *m, int id)
|
|
{
|
|
m->ids[id].rnti = -1;
|
|
}
|
|
|
|
int m2ap_find_id(m2ap_id_manager *m, int id_source, int id_target)
|
|
{
|
|
int i;
|
|
for (i = 0; i < M2AP_MAX_IDS; i++)
|
|
if (m->ids[i].rnti != -1 &&
|
|
m->ids[i].id_source == id_source &&
|
|
m->ids[i].id_target == id_target)
|
|
return i;
|
|
return -1;
|
|
}
|
|
|
|
int m2ap_find_id_from_id_source(m2ap_id_manager *m, int id_source)
|
|
{
|
|
int i;
|
|
for (i = 0; i < M2AP_MAX_IDS; i++)
|
|
if (m->ids[i].rnti != -1 &&
|
|
m->ids[i].id_source == id_source)
|
|
return i;
|
|
return -1;
|
|
}
|
|
|
|
int m2ap_find_id_from_rnti(m2ap_id_manager *m, int rnti)
|
|
{
|
|
int i;
|
|
for (i = 0; i < M2AP_MAX_IDS; i++)
|
|
if (m->ids[i].rnti == rnti)
|
|
return i;
|
|
return -1;
|
|
}
|
|
|
|
void m2ap_set_ids(m2ap_id_manager *m, int ue_id, int rnti, int id_source, int id_target)
|
|
{
|
|
m->ids[ue_id].rnti = rnti;
|
|
m->ids[ue_id].id_source = id_source;
|
|
m->ids[ue_id].id_target = id_target;
|
|
}
|
|
|
|
/* real type of target is m2ap_eNB_data_t * */
|
|
void m2ap_id_set_target(m2ap_id_manager *m, int ue_id, void *target)
|
|
{
|
|
m->ids[ue_id].target = target;
|
|
}
|
|
|
|
void m2ap_id_set_state(m2ap_id_manager *m, int ue_id, m2id_state_t state)
|
|
{
|
|
m->ids[ue_id].state = state;
|
|
}
|
|
|
|
void m2ap_set_reloc_prep_timer(m2ap_id_manager *m, int ue_id, uint64_t time)
|
|
{
|
|
m->ids[ue_id].t_reloc_prep_start = time;
|
|
}
|
|
|
|
void m2ap_set_reloc_overall_timer(m2ap_id_manager *m, int ue_id, uint64_t time)
|
|
{
|
|
m->ids[ue_id].tm2_reloc_overall_start = time;
|
|
}
|
|
|
|
int m2ap_id_get_id_source(m2ap_id_manager *m, int ue_id)
|
|
{
|
|
return m->ids[ue_id].id_source;
|
|
}
|
|
|
|
int m2ap_id_get_id_target(m2ap_id_manager *m, int ue_id)
|
|
{
|
|
return m->ids[ue_id].id_target;
|
|
}
|
|
|
|
int m2ap_id_get_rnti(m2ap_id_manager *m, int ue_id)
|
|
{
|
|
return m->ids[ue_id].rnti;
|
|
}
|
|
|
|
void *m2ap_id_get_target(m2ap_id_manager *m, int ue_id)
|
|
{
|
|
return m->ids[ue_id].target;
|
|
}
|