Files
openairinterface5g/nfapi/tests/nr_fapi_test.h
T
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

82 lines
1.5 KiB
C

/*
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
*/
#ifndef OPENAIRINTERFACE_NR_FAPI_TEST_H
#define OPENAIRINTERFACE_NR_FAPI_TEST_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <inttypes.h>
#include <sys/wait.h>
#include <unistd.h>
#ifndef _STANDALONE_TESTING_
#include "common/utils/LOG/log.h"
#endif
#include "nfapi_nr_interface.h"
#include "nfapi_nr_interface_scf.h"
#define FILL_TLV(TlV, TaG, VaL) \
do { \
TlV.tl.tag = TaG; \
TlV.value = VaL; \
} while (0)
uint8_t rand8()
{
return (rand() & 0xff);
}
uint16_t rand16()
{
return rand8() << 8 | rand8();
}
uint32_t rand24()
{
return rand16() << 8 | rand8();
}
uint32_t rand32()
{
return rand24() << 8 | rand8();
}
uint64_t rand64()
{
return (uint64_t)rand32() << 32 | rand32();
}
uint8_t rand8_range(uint8_t lower, uint8_t upper)
{
return (rand() % (upper - lower + 1)) + lower;
}
uint16_t rand16_range(uint16_t lower, uint16_t upper)
{
return (rand() % (upper - lower + 1)) + lower;
}
int16_t rands16_range(int16_t lower, int16_t upper)
{
return (rand() % (upper - lower + 1)) + lower;
}
uint32_t rand32_range(uint32_t lower, uint32_t upper)
{
return (rand() % (upper - lower + 1)) + lower;
}
int main(int n, char *v[]);
static inline void fapi_test_init_seeded(time_t seed)
{
srand(seed);
printf("srand seed is %ld\n", seed);
logInit();
set_glog(OAILOG_DISABLE);
}
static inline void fapi_test_init()
{
fapi_test_init_seeded(time(NULL));
}
#endif // OPENAIRINTERFACE_NR_FAPI_TEST_H