Files
openairinterface5g/openair3/S1AP/s1ap_eNB_ue_context.c
Robert Schmidt 8107939f08 Change OAI license to CSSL v1.0 (and others)
- 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.
2026-03-27 16:36:37 +01:00

83 lines
1.7 KiB
C

/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
/*!
* \brief s1ap UE context management within eNB
*/
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdint.h>
#include "tree.h"
#include "intertask_interface.h"
#include "s1ap_common.h"
#include "s1ap_eNB_defs.h"
#include "s1ap_eNB_ue_context.h"
int s1ap_eNB_compare_eNB_ue_s1ap_id(
struct s1ap_eNB_ue_context_s *p1, struct s1ap_eNB_ue_context_s *p2)
{
if (p1->eNB_ue_s1ap_id > p2->eNB_ue_s1ap_id) {
return 1;
}
if (p1->eNB_ue_s1ap_id < p2->eNB_ue_s1ap_id) {
return -1;
}
return 0;
}
/* Generate the tree management functions */
RB_GENERATE(s1ap_ue_map, s1ap_eNB_ue_context_s, entries,
s1ap_eNB_compare_eNB_ue_s1ap_id);
struct s1ap_eNB_ue_context_s *s1ap_eNB_allocate_new_UE_context(void)
{
struct s1ap_eNB_ue_context_s *new_p;
new_p = malloc(sizeof(struct s1ap_eNB_ue_context_s));
if (new_p == NULL) {
S1AP_ERROR("Cannot allocate new ue context\n");
return NULL;
}
memset(new_p, 0, sizeof(struct s1ap_eNB_ue_context_s));
return new_p;
}
struct s1ap_eNB_ue_context_s *s1ap_eNB_get_ue_context(
s1ap_eNB_instance_t *instance_p,
uint32_t eNB_ue_s1ap_id)
{
s1ap_eNB_ue_context_t temp;
memset(&temp, 0, sizeof(struct s1ap_eNB_ue_context_s));
/* eNB ue s1ap id = 24 bits wide */
temp.eNB_ue_s1ap_id = eNB_ue_s1ap_id & 0x00FFFFFF;
return RB_FIND(s1ap_ue_map, &instance_p->s1ap_ue_head, &temp);
}
void s1ap_eNB_free_ue_context(struct s1ap_eNB_ue_context_s *ue_context_p)
{
if (ue_context_p == NULL) {
S1AP_ERROR("Trying to free a NULL context\n");
return;
}
/* TODO: check that context is currently not in the tree of known
* contexts.
*/
free(ue_context_p);
}