- 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.
89 lines
2.1 KiB
C
89 lines
2.1 KiB
C
/*
|
|
* SPDX-License-Identifier: LicenseRef-CSSL-1.0
|
|
*/
|
|
|
|
#include <stdio.h>
|
|
#include <stdlib.h>
|
|
#include <string.h>
|
|
#include "utils.h"
|
|
#include "../T_defs.h"
|
|
|
|
void usage(void)
|
|
{
|
|
printf(
|
|
"options:\n"
|
|
" -i <input file> this option is mandatory\n"
|
|
);
|
|
exit(1);
|
|
}
|
|
|
|
#define ERR printf("ERROR: read file %s failed\n", input_filename)
|
|
|
|
int main(int n, char **v)
|
|
{
|
|
char *input_filename = NULL;
|
|
int i;
|
|
FILE *in;
|
|
|
|
for (i = 1; i < n; i++) {
|
|
if (!strcmp(v[i], "-h") || !strcmp(v[i], "--help")) usage();
|
|
if (!strcmp(v[i], "-i"))
|
|
{ if (i > n-2) usage(); input_filename = v[++i]; continue; }
|
|
usage();
|
|
}
|
|
|
|
if (input_filename == NULL) {
|
|
printf("ERROR: provide an input file (-i)\n");
|
|
exit(1);
|
|
}
|
|
|
|
in = fopen(input_filename, "r");
|
|
if (in == NULL) { perror(input_filename); abort(); }
|
|
|
|
OBUF ebuf = {.osize = 0, .omaxsize = 0, .obuf = NULL};
|
|
|
|
while (1) {
|
|
int type;
|
|
int32_t length;
|
|
char *v;
|
|
int vpos = 0;
|
|
|
|
/* read event from file */
|
|
if (fread(&length, 4, 1, in) != 1) break;
|
|
if (ebuf.omaxsize < length + 4) {
|
|
ebuf.omaxsize = (length + 4 + 65535) & ~65535;
|
|
ebuf.obuf = realloc(ebuf.obuf, ebuf.omaxsize);
|
|
if (ebuf.obuf == NULL) { printf("out of memory\n"); exit(1); }
|
|
}
|
|
v = ebuf.obuf;
|
|
memcpy(v+vpos, &length, 4);
|
|
vpos += 4;
|
|
#ifdef T_SEND_TIME
|
|
if (length < sizeof(struct timespec)) { ERR; break; }
|
|
if (fread(v+vpos, sizeof(struct timespec), 1, in) != 1) { ERR; break; }
|
|
vpos += sizeof(struct timespec);
|
|
length -= sizeof(struct timespec);
|
|
#endif
|
|
if (length < sizeof(int)) { ERR; break; }
|
|
if (fread(&type, sizeof(int), 1, in) != 1) { ERR; break; }
|
|
memcpy(v+vpos, &type, sizeof(int));
|
|
vpos += sizeof(int);
|
|
length -= sizeof(int);
|
|
if (length) if (fread(v+vpos, length, 1, in) != 1) { ERR; break; }
|
|
vpos += length;
|
|
|
|
if (type == -1) {
|
|
if (length < sizeof(int)) { ERR; break; }
|
|
length -= sizeof(int);
|
|
if (fwrite(v+vpos-length, length, 1, stdout) != 1) { ERR; break; }
|
|
}
|
|
|
|
/* TODO: parse all file? */
|
|
if (type == -2) break;
|
|
}
|
|
|
|
fclose(in);
|
|
|
|
return 0;
|
|
}
|