Commit 34adb355 authored by LiBingxuan's avatar LiBingxuan

update udm

parent 536206c5
# OpenXG-UDM
<img src="README.assets/openxglogo.png" alt="OpenXG" style="zoom: 100;" />
# 1. Generals
OpenXG is a series of 5G/6G-oriented open source projects developed by Open Source Radio Access Network Community. Currently, the community has developed the project from five aspects, including:
* Core network projects, 3GPP R15/R16 specification compliant network functions have been developed, including AMF, SMF, NRF, UPF, AUSF, UDM, AUSF, NWDAF, etc. Message level stateless mechanism is introduced in to the core network to make it better adapted to the cloud environment.
* Open hardware reference design, the reference design of heterogeneous computing hardware, white-box radio frontend, and open source UE hardware are also opened to the community.
* Radio access network projects, currently CU, DU and UE protocol software are developed, which is mainly compliant with 3GPP R15/R16 specifications. The software is developed by a modular-design, and which is flexible to customize to different vertical scenarios.
* AI-enabled management projects, three kinds of projects are developed under this category, including the AIEngine, which is aimed to provide the core AI capability for the management, the network measurement, and computing network for cloud-edge-end collaborative.
* Uses cases and applications in verticals, some key use cases when applying OpenXG to vertical scenarios are also developed as a reference for the community.
OpenXG-UDM Arch
```
├── build: Build directory, contains targets and object files generated by compilation of network functions.
├── scripts: Directory containing scripts for building network functions.
├── ext: Directory containing pistache and the JSON library.
└── UDM: Directory containing object files generated by compilation of UDM network function.
├── etc: Directory containing the configuration file to be deployed for UDM.
└── src: Source files of UDM.
├── udm_app: UDM Procedures handling logic.
├── common: Common definitions for 3GPP specifications.
├── 5gaka: algorithms for 5G-AKA authentication procedures.
├── asnlib: asn library.
├── utils: Common utilities.  .
├── model: UDM service.
├── api: UDM service.
└── impl: UDM service.
```
# 2. License
The OpenXG series projects are distributed under OS-RAN license, which is derived from the Fair, Reasonable, and Non-Discriminatory principle. See [online version for details](http://www.openxg.org.cn/?falu_69.html).
# 3. How to start
## Download source code from Gitlab
```
git clone http://git.opensource5g.org/openxg/udm.git
cd openxg-udm/
```
As master branch is usually the stable branch, so we would suggest you start from the master:
```
git checkout master
```
## install dependencies
OpenXG-UDM relies on some third-party software or libraries, please install the dependencies when you first build the project, run by:
```
cd ./build/scripts
sudo ./build_udm -I
```
## build UDM
When you finish install the dependencies, you can finally build the UDM executables by:
```
sudo ./build_udm -c -b Debug -j
```
## launch UDM
UDM executable files will be installed to /usr/local/bin/ by default, you can run UDM by simply type:
```
sudo ./build/UDM/udm -c etc/udm.conf -o
sudo udm -c etc/udm.conf -o
```
etc/udm.conf is the config file for UDM.
Customize the config file according to your environments.
Enjoy.
################################################################################
# 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
################################################################################
# ! file
# brief
# author Jian Yang,Fengjiao He,Hongxin Wang
# date 2020
# email: contact@openairinterface.org
# Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
# Software Alliance under one or more contributor license agreements. The
# initial OpenXG series projects are derided from OAI projects, the files from
# OAI projects are all in compliance with OAI Public License, Version 1.1.
# codes and files developed from OpenXG projects and from OS-RAN Alliance
# are all under OS-RAN licenses; you may not use this file except in compliance
# with the license. You may get a copy of the license at:
# http://www.openxg.org.cn/?falu_69.html
# For more information about OpenXG, please contact:
# contact@openxg.org.cn
################################################################################
## udm configuration file
......
/*
* 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
*/
/*! \file authentication_algorithms_with_5gaka.cpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "authentication_algorithms_with_5gaka.hpp"
......
/*
* 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
*/
/*! \file authentication_algorithms_with_5gaka.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#ifndef _5GAKA_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
*/
/*! \file rijndael.cpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "authentication_algorithms_with_5gaka.hpp"
......
/*
* 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
*/
/*! \file sha256.cpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "sha256.hpp"
......
/*
* 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
*/
/*! \file sha256.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#ifndef Sha256_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
*/
/*! \file comUt.hpp
\brief
\author Keliang DU, BUPT
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#ifndef _PRINT_BUFFER_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
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
/*! \file common_defs.h
\brief
\author Sebastien ROUX, Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_COMMON_DEFS_SEEN
#define FILE_COMMON_DEFS_SEEN
......
/*
* 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
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
/*! \file conversions.cpp
\brief
\author Sebastien ROUX
\company Eurecom
*/
#include "conversions.hpp"
#include <arpa/inet.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
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
/*! \file conversions.hpp
\brief
\author Sebastien ROUX, Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_CONVERSIONS_HPP_SEEN
#define FILE_CONVERSIONS_HPP_SEEN
......
/*
* 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
*/
/*! \file logger.cpp
\brief
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "logger.hpp"
......
/*
* 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
*/
/*! \file logger.hpp
\brief
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#ifndef __LOGGER_H
......
This source diff could not be displayed because it is too large. You can view the blob instead.
/*
* This source file is part of the bstring string library. This code was
* written by Paul Hsieh in 2002-2015, and is covered by the BSD open source
* license and the GPL. Refer to the accompanying documentation for details
* on usage and license.
*/
/*
* bstrlib.h
*
* This file is the interface for the core bstring functions.
*/
#ifndef BSTRLIB_INCLUDE
#define BSTRLIB_INCLUDE
#ifdef __cplusplus
extern "C" {
#endif
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#if !defined(BSTRLIB_VSNP_OK) && !defined(BSTRLIB_NOVSNP)
#if defined(__TURBOC__) && !defined(__BORLANDC__)
#define BSTRLIB_NOVSNP
#endif
#endif
#define BSTR_ERR (-1)
#define BSTR_OK (0)
#define BSTR_BS_BUFF_LENGTH_GET (0)
typedef struct tagbstring *bstring;
typedef const struct tagbstring *const_bstring;
/* Copy functions */
#define cstr2bstr bfromcstr
extern bstring bfromcstr(const char *str);
extern bstring bfromcstralloc(int mlen, const char *str);
extern bstring bfromcstrrangealloc(int minl, int maxl, const char *str);
extern bstring blk2bstr(const void *blk, int len);
extern char *bstr2cstr(const_bstring s, char z);
extern int bcstrfree(char *s);
extern bstring bstrcpy(const_bstring b1);
extern int bassign(bstring a, const_bstring b);
extern int bassignmidstr(bstring a, const_bstring b, int left, int len);
extern int bassigncstr(bstring a, const char *str);
extern int bassignblk(bstring a, const void *s, int len);
/* Destroy function */
extern int bdestroy(bstring b);
/* Space allocation hinting functions */
extern int balloc(bstring s, int len);
extern int ballocmin(bstring b, int len);
/* Substring extraction */
extern bstring bmidstr(const_bstring b, int left, int len);
/* Various standard manipulations */
extern int bconcat(bstring b0, const_bstring b1);
extern int bconchar(bstring b0, char c);
extern int bcatcstr(bstring b, const char *s);
extern int bcatblk(bstring b, const void *s, int len);
extern int binsert(bstring s1, int pos, const_bstring s2, unsigned char fill);
extern int binsertblk(bstring s1, int pos, const void *s2, int len,
unsigned char fill);
extern int binsertch(bstring s1, int pos, int len, unsigned char fill);
extern int breplace(bstring b1, int pos, int len, const_bstring b2,
unsigned char fill);
extern int bdelete(bstring s1, int pos, int len);
extern int bsetstr(bstring b0, int pos, const_bstring b1, unsigned char fill);
extern int btrunc(bstring b, int n);
/* Scan/search functions */
extern int bstricmp(const_bstring b0, const_bstring b1);
extern int bstrnicmp(const_bstring b0, const_bstring b1, int n);
extern int biseqcaseless(const_bstring b0, const_bstring b1);
extern int biseqcaselessblk(const_bstring b, const void *blk, int len);
extern int bisstemeqcaselessblk(const_bstring b0, const void *blk, int len);
extern int biseq(const_bstring b0, const_bstring b1);
extern int biseqblk(const_bstring b, const void *blk, int len);
extern int bisstemeqblk(const_bstring b0, const void *blk, int len);
extern int biseqcstr(const_bstring b, const char *s);
extern int biseqcstrcaseless(const_bstring b, const char *s);
extern int bstrcmp(const_bstring b0, const_bstring b1);
extern int bstrncmp(const_bstring b0, const_bstring b1, int n);
extern int binstr(const_bstring s1, int pos, const_bstring s2);
extern int binstrr(const_bstring s1, int pos, const_bstring s2);
extern int binstrcaseless(const_bstring s1, int pos, const_bstring s2);
extern int binstrrcaseless(const_bstring s1, int pos, const_bstring s2);
extern int bstrchrp(const_bstring b, int c, int pos);
extern int bstrrchrp(const_bstring b, int c, int pos);
#define bstrchr(b, c) bstrchrp((b), (c), 0)
#define bstrrchr(b, c) bstrrchrp((b), (c), blength(b) - 1)
extern int binchr(const_bstring b0, int pos, const_bstring b1);
extern int binchrr(const_bstring b0, int pos, const_bstring b1);
extern int bninchr(const_bstring b0, int pos, const_bstring b1);
extern int bninchrr(const_bstring b0, int pos, const_bstring b1);
extern int bfindreplace(bstring b, const_bstring find, const_bstring repl,
int pos);
extern int bfindreplacecaseless(bstring b, const_bstring find,
const_bstring repl, int pos);
/* List of string container functions */
struct bstrList {
int qty, mlen;
bstring *entry;
};
extern struct bstrList *bstrListCreate(void);
extern int bstrListDestroy(struct bstrList *sl);
extern int bstrListAlloc(struct bstrList *sl, int msz);
extern int bstrListAllocMin(struct bstrList *sl, int msz);
/* String split and join functions */
extern struct bstrList *bsplit(const_bstring str, unsigned char splitChar);
extern struct bstrList *bsplits(const_bstring str, const_bstring splitStr);
extern struct bstrList *bsplitstr(const_bstring str, const_bstring splitStr);
extern bstring bjoin(const struct bstrList *bl, const_bstring sep);
extern bstring bjoinblk(const struct bstrList *bl, const void *s, int len);
extern int bsplitcb(const_bstring str, unsigned char splitChar, int pos,
int (*cb)(void *parm, int ofs, int len), void *parm);
extern int bsplitscb(const_bstring str, const_bstring splitStr, int pos,
int (*cb)(void *parm, int ofs, int len), void *parm);
extern int bsplitstrcb(const_bstring str, const_bstring splitStr, int pos,
int (*cb)(void *parm, int ofs, int len), void *parm);
/* Miscellaneous functions */
extern int bpattern(bstring b, int len);
extern int btoupper(bstring b);
extern int btolower(bstring b);
extern int bltrimws(bstring b);
extern int brtrimws(bstring b);
extern int btrimws(bstring b);
#if !defined(BSTRLIB_NOVSNP)
extern bstring bformat(const char *fmt, ...);
extern int bformata(bstring b, const char *fmt, ...);
extern int bassignformat(bstring b, const char *fmt, ...);
extern int bvcformata(bstring b, int count, const char *fmt, va_list arglist);
#define bvformata(ret, b, fmt, lastarg) \
{ \
bstring bstrtmp_b = (b); \
const char *bstrtmp_fmt = (fmt); \
int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
for (;;) { \
va_list bstrtmp_arglist; \
va_start(bstrtmp_arglist, lastarg); \
bstrtmp_r = \
bvcformata(bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, bstrtmp_arglist); \
va_end(bstrtmp_arglist); \
if (bstrtmp_r >= 0) { /* Everything went ok */ \
bstrtmp_r = BSTR_OK; \
break; \
} else if (-bstrtmp_r <= bstrtmp_sz) { /* A real error? */ \
bstrtmp_r = BSTR_ERR; \
break; \
} \
bstrtmp_sz = -bstrtmp_r; /* Doubled or target size */ \
} \
ret = bstrtmp_r; \
}
#endif
typedef int (*bNgetc)(void *parm);
typedef size_t (*bNread)(void *buff, size_t elsize, size_t nelem, void *parm);
/* Input functions */
extern bstring bgets(bNgetc getcPtr, void *parm, char terminator);
extern bstring bread(bNread readPtr, void *parm);
extern int bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator);
extern int bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator);
extern int breada(bstring b, bNread readPtr, void *parm);
/* Stream functions */
extern struct bStream *bsopen(bNread readPtr, void *parm);
extern void *bsclose(struct bStream *s);
extern int bsbufflength(struct bStream *s, int sz);
extern int bsreadln(bstring b, struct bStream *s, char terminator);
extern int bsreadlns(bstring r, struct bStream *s, const_bstring term);
extern int bsread(bstring b, struct bStream *s, int n);
extern int bsreadlna(bstring b, struct bStream *s, char terminator);
extern int bsreadlnsa(bstring r, struct bStream *s, const_bstring term);
extern int bsreada(bstring b, struct bStream *s, int n);
extern int bsunread(struct bStream *s, const_bstring b);
extern int bspeek(bstring r, const struct bStream *s);
extern int bssplitscb(struct bStream *s, const_bstring splitStr,
int (*cb)(void *parm, int ofs, const_bstring entry),
void *parm);
extern int bssplitstrcb(struct bStream *s, const_bstring splitStr,
int (*cb)(void *parm, int ofs, const_bstring entry),
void *parm);
extern int bseof(const struct bStream *s);
struct tagbstring {
int mlen;
int slen;
unsigned char *data;
};
/* Accessor macros */
#define blengthe(b, e) \
(((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen))
#define blength(b) (blengthe((b), 0))
#define bdataofse(b, o, e) \
(((b) == (void *)0 || (b)->data == (void *)0) ? (char *)(e) \
: ((char *)(b)->data) + (o))
#define bdataofs(b, o) (bdataofse((b), (o), (void *)0))
#define bdatae(b, e) (bdataofse(b, 0, e))
#define bdata(b) (bdataofs(b, 0))
#define bchare(b, p, e) \
((((unsigned)(p)) < (unsigned)blength(b)) ? ((b)->data[(p)]) : (e))
#define bchar(b, p) bchare((b), (p), '\0')
/* Static constant string initialization macro */
#define bsStaticMlen(q, m) \
{ (m), (int)sizeof(q) - 1, (unsigned char *)("" q "") }
#if defined(_MSC_VER)
#define bsStatic(q) bsStaticMlen(q, -32)
#endif
#ifndef bsStatic
#define bsStatic(q) bsStaticMlen(q, -__LINE__)
#endif
/* Static constant block parameter pair */
#define bsStaticBlkParms(q) ((void *)("" q "")), ((int)sizeof(q) - 1)
#define bcatStatic(b, s) ((bcatblk)((b), bsStaticBlkParms(s)))
#define bfromStatic(s) ((blk2bstr)(bsStaticBlkParms(s)))
#define bassignStatic(b, s) ((bassignblk)((b), bsStaticBlkParms(s)))
#define binsertStatic(b, p, s, f) \
((binsertblk)((b), (p), bsStaticBlkParms(s), (f)))
#define bjoinStatic(b, s) ((bjoinblk)((b), bsStaticBlkParms(s)))
#define biseqStatic(b, s) ((biseqblk)((b), bsStaticBlkParms(s)))
#define bisstemeqStatic(b, s) ((bisstemeqblk)((b), bsStaticBlkParms(s)))
#define biseqcaselessStatic(b, s) ((biseqcaselessblk)((b), bsStaticBlkParms(s)))
#define bisstemeqcaselessStatic(b, s) \
((bisstemeqcaselessblk)((b), bsStaticBlkParms(s)))
/* Reference building macros */
#define cstr2tbstr btfromcstr
#define btfromcstr(t, s) \
{ \
(t).data = (unsigned char *)(s); \
(t).slen = ((t).data) ? ((int)(strlen)((char *)(t).data)) : 0; \
(t).mlen = -1; \
}
#define blk2tbstr(t, s, l) \
{ \
(t).data = (unsigned char *)(s); \
(t).slen = l; \
(t).mlen = -1; \
}
#define btfromblk(t, s, l) blk2tbstr(t, s, l)
#define bmid2tbstr(t, b, p, l) \
{ \
const_bstring bstrtmp_s = (b); \
if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \
int bstrtmp_left = (p); \
int bstrtmp_len = (l); \
if (bstrtmp_left < 0) { \
bstrtmp_len += bstrtmp_left; \
bstrtmp_left = 0; \
} \
if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) \
bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
if (bstrtmp_len <= 0) { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} else { \
(t).data = bstrtmp_s->data + bstrtmp_left; \
(t).slen = bstrtmp_len; \
} \
} else { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} \
(t).mlen = -__LINE__; \
}
#define btfromblkltrimws(t, s, l) \
{ \
int bstrtmp_idx = 0, bstrtmp_len = (l); \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \
if (!isspace(bstrtmp_s[bstrtmp_idx])) \
break; \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len - bstrtmp_idx; \
(t).mlen = -__LINE__; \
}
#define btfromblkrtrimws(t, s, l) \
{ \
int bstrtmp_len = (l)-1; \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_len >= 0; bstrtmp_len--) { \
if (!isspace(bstrtmp_s[bstrtmp_len])) \
break; \
} \
} \
(t).data = bstrtmp_s; \
(t).slen = bstrtmp_len + 1; \
(t).mlen = -__LINE__; \
}
#define btfromblktrimws(t, s, l) \
{ \
int bstrtmp_idx = 0, bstrtmp_len = (l)-1; \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \
if (!isspace(bstrtmp_s[bstrtmp_idx])) \
break; \
} \
for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
if (!isspace(bstrtmp_s[bstrtmp_len])) \
break; \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
(t).mlen = -__LINE__; \
}
/* Write protection macros */
#define bwriteprotect(t) \
{ \
if ((t).mlen >= 0) \
(t).mlen = -1; \
}
#define bwriteallow(t) \
{ \
if ((t).mlen == -1) \
(t).mlen = (t).slen + ((t).slen == 0); \
}
#define biswriteprotected(t) ((t).mlen <= 0)
#ifdef __cplusplus
}
#endif
#endif
/*
* This source file is part of the bstring string library. This code was
* written by Paul Hsieh in 2002-2015, and is covered by the BSD open source
* license and the GPL. Refer to the accompanying documentation for details
* on usage and license.
*/
/*
* bstrlib.h
*
* This file is the interface for the core bstring functions.
*/
#ifndef BSTRLIB_INCLUDE
#define BSTRLIB_INCLUDE
#ifdef __cplusplus
extern "C" {
#endif
#include <ctype.h>
#include <limits.h>
#include <stdarg.h>
#include <string.h>
#if !defined(BSTRLIB_VSNP_OK) && !defined(BSTRLIB_NOVSNP)
#if defined(__TURBOC__) && !defined(__BORLANDC__)
#define BSTRLIB_NOVSNP
#endif
#endif
#define BSTR_ERR (-1)
#define BSTR_OK (0)
#define BSTR_BS_BUFF_LENGTH_GET (0)
typedef struct tagbstring *bstring;
typedef const struct tagbstring *const_bstring;
/* Copy functions */
#define cstr2bstr bfromcstr
extern bstring bfromcstr(const char *str);
extern bstring bfromcstralloc(int mlen, const char *str);
extern bstring bfromcstrrangealloc(int minl, int maxl, const char *str);
extern bstring blk2bstr(const void *blk, int len);
extern char *bstr2cstr(const_bstring s, char z);
extern int bcstrfree(char *s);
extern bstring bstrcpy(const_bstring b1);
extern int bassign(bstring a, const_bstring b);
extern int bassignmidstr(bstring a, const_bstring b, int left, int len);
extern int bassigncstr(bstring a, const char *str);
extern int bassignblk(bstring a, const void *s, int len);
/* Destroy function */
extern int bdestroy(bstring b);
/* Space allocation hinting functions */
extern int balloc(bstring s, int len);
extern int ballocmin(bstring b, int len);
/* Substring extraction */
extern bstring bmidstr(const_bstring b, int left, int len);
/* Various standard manipulations */
extern int bconcat(bstring b0, const_bstring b1);
extern int bconchar(bstring b0, char c);
extern int bcatcstr(bstring b, const char *s);
extern int bcatblk(bstring b, const void *s, int len);
extern int binsert(bstring s1, int pos, const_bstring s2, unsigned char fill);
extern int binsertblk(bstring s1, int pos, const void *s2, int len,
unsigned char fill);
extern int binsertch(bstring s1, int pos, int len, unsigned char fill);
extern int breplace(bstring b1, int pos, int len, const_bstring b2,
unsigned char fill);
extern int bdelete(bstring s1, int pos, int len);
extern int bsetstr(bstring b0, int pos, const_bstring b1, unsigned char fill);
extern int btrunc(bstring b, int n);
/* Scan/search functions */
extern int bstricmp(const_bstring b0, const_bstring b1);
extern int bstrnicmp(const_bstring b0, const_bstring b1, int n);
extern int biseqcaseless(const_bstring b0, const_bstring b1);
extern int biseqcaselessblk(const_bstring b, const void *blk, int len);
extern int bisstemeqcaselessblk(const_bstring b0, const void *blk, int len);
extern int biseq(const_bstring b0, const_bstring b1);
extern int biseqblk(const_bstring b, const void *blk, int len);
extern int bisstemeqblk(const_bstring b0, const void *blk, int len);
extern int biseqcstr(const_bstring b, const char *s);
extern int biseqcstrcaseless(const_bstring b, const char *s);
extern int bstrcmp(const_bstring b0, const_bstring b1);
extern int bstrncmp(const_bstring b0, const_bstring b1, int n);
extern int binstr(const_bstring s1, int pos, const_bstring s2);
extern int binstrr(const_bstring s1, int pos, const_bstring s2);
extern int binstrcaseless(const_bstring s1, int pos, const_bstring s2);
extern int binstrrcaseless(const_bstring s1, int pos, const_bstring s2);
extern int bstrchrp(const_bstring b, int c, int pos);
extern int bstrrchrp(const_bstring b, int c, int pos);
#define bstrchr(b, c) bstrchrp((b), (c), 0)
#define bstrrchr(b, c) bstrrchrp((b), (c), blength(b) - 1)
extern int binchr(const_bstring b0, int pos, const_bstring b1);
extern int binchrr(const_bstring b0, int pos, const_bstring b1);
extern int bninchr(const_bstring b0, int pos, const_bstring b1);
extern int bninchrr(const_bstring b0, int pos, const_bstring b1);
extern int bfindreplace(bstring b, const_bstring find, const_bstring repl,
int pos);
extern int bfindreplacecaseless(bstring b, const_bstring find,
const_bstring repl, int pos);
/* List of string container functions */
struct bstrList {
int qty, mlen;
bstring *entry;
};
extern struct bstrList *bstrListCreate(void);
extern int bstrListDestroy(struct bstrList *sl);
extern int bstrListAlloc(struct bstrList *sl, int msz);
extern int bstrListAllocMin(struct bstrList *sl, int msz);
/* String split and join functions */
extern struct bstrList *bsplit(const_bstring str, unsigned char splitChar);
extern struct bstrList *bsplits(const_bstring str, const_bstring splitStr);
extern struct bstrList *bsplitstr(const_bstring str, const_bstring splitStr);
extern bstring bjoin(const struct bstrList *bl, const_bstring sep);
extern bstring bjoinblk(const struct bstrList *bl, const void *s, int len);
extern int bsplitcb(const_bstring str, unsigned char splitChar, int pos,
int (*cb)(void *parm, int ofs, int len), void *parm);
extern int bsplitscb(const_bstring str, const_bstring splitStr, int pos,
int (*cb)(void *parm, int ofs, int len), void *parm);
extern int bsplitstrcb(const_bstring str, const_bstring splitStr, int pos,
int (*cb)(void *parm, int ofs, int len), void *parm);
/* Miscellaneous functions */
extern int bpattern(bstring b, int len);
extern int btoupper(bstring b);
extern int btolower(bstring b);
extern int bltrimws(bstring b);
extern int brtrimws(bstring b);
extern int btrimws(bstring b);
#if !defined(BSTRLIB_NOVSNP)
extern bstring bformat(const char *fmt, ...);
extern int bformata(bstring b, const char *fmt, ...);
extern int bassignformat(bstring b, const char *fmt, ...);
extern int bvcformata(bstring b, int count, const char *fmt, va_list arglist);
#define bvformata(ret, b, fmt, lastarg) \
{ \
bstring bstrtmp_b = (b); \
const char *bstrtmp_fmt = (fmt); \
int bstrtmp_r = BSTR_ERR, bstrtmp_sz = 16; \
for (;;) { \
va_list bstrtmp_arglist; \
va_start(bstrtmp_arglist, lastarg); \
bstrtmp_r = \
bvcformata(bstrtmp_b, bstrtmp_sz, bstrtmp_fmt, bstrtmp_arglist); \
va_end(bstrtmp_arglist); \
if (bstrtmp_r >= 0) { /* Everything went ok */ \
bstrtmp_r = BSTR_OK; \
break; \
} else if (-bstrtmp_r <= bstrtmp_sz) { /* A real error? */ \
bstrtmp_r = BSTR_ERR; \
break; \
} \
bstrtmp_sz = -bstrtmp_r; /* Doubled or target size */ \
} \
ret = bstrtmp_r; \
}
#endif
typedef int (*bNgetc)(void *parm);
typedef size_t (*bNread)(void *buff, size_t elsize, size_t nelem, void *parm);
/* Input functions */
extern bstring bgets(bNgetc getcPtr, void *parm, char terminator);
extern bstring bread(bNread readPtr, void *parm);
extern int bgetsa(bstring b, bNgetc getcPtr, void *parm, char terminator);
extern int bassigngets(bstring b, bNgetc getcPtr, void *parm, char terminator);
extern int breada(bstring b, bNread readPtr, void *parm);
/* Stream functions */
extern struct bStream *bsopen(bNread readPtr, void *parm);
extern void *bsclose(struct bStream *s);
extern int bsbufflength(struct bStream *s, int sz);
extern int bsreadln(bstring b, struct bStream *s, char terminator);
extern int bsreadlns(bstring r, struct bStream *s, const_bstring term);
extern int bsread(bstring b, struct bStream *s, int n);
extern int bsreadlna(bstring b, struct bStream *s, char terminator);
extern int bsreadlnsa(bstring r, struct bStream *s, const_bstring term);
extern int bsreada(bstring b, struct bStream *s, int n);
extern int bsunread(struct bStream *s, const_bstring b);
extern int bspeek(bstring r, const struct bStream *s);
extern int bssplitscb(struct bStream *s, const_bstring splitStr,
int (*cb)(void *parm, int ofs, const_bstring entry),
void *parm);
extern int bssplitstrcb(struct bStream *s, const_bstring splitStr,
int (*cb)(void *parm, int ofs, const_bstring entry),
void *parm);
extern int bseof(const struct bStream *s);
struct tagbstring {
int mlen;
int slen;
unsigned char *data;
};
/* Accessor macros */
#define blengthe(b, e) \
(((b) == (void *)0 || (b)->slen < 0) ? (int)(e) : ((b)->slen))
#define blength(b) (blengthe((b), 0))
#define bdataofse(b, o, e) \
(((b) == (void *)0 || (b)->data == (void *)0) ? (char *)(e) \
: ((char *)(b)->data) + (o))
#define bdataofs(b, o) (bdataofse((b), (o), (void *)0))
#define bdatae(b, e) (bdataofse(b, 0, e))
#define bdata(b) (bdataofs(b, 0))
#define bchare(b, p, e) \
((((unsigned)(p)) < (unsigned)blength(b)) ? ((b)->data[(p)]) : (e))
#define bchar(b, p) bchare((b), (p), '\0')
/* Static constant string initialization macro */
#define bsStaticMlen(q, m) \
{ (m), (int)sizeof(q) - 1, (unsigned char *)("" q "") }
#if defined(_MSC_VER)
#define bsStatic(q) bsStaticMlen(q, -32)
#endif
#ifndef bsStatic
#define bsStatic(q) bsStaticMlen(q, -__LINE__)
#endif
/* Static constant block parameter pair */
#define bsStaticBlkParms(q) ((void *)("" q "")), ((int)sizeof(q) - 1)
#define bcatStatic(b, s) ((bcatblk)((b), bsStaticBlkParms(s)))
#define bfromStatic(s) ((blk2bstr)(bsStaticBlkParms(s)))
#define bassignStatic(b, s) ((bassignblk)((b), bsStaticBlkParms(s)))
#define binsertStatic(b, p, s, f) \
((binsertblk)((b), (p), bsStaticBlkParms(s), (f)))
#define bjoinStatic(b, s) ((bjoinblk)((b), bsStaticBlkParms(s)))
#define biseqStatic(b, s) ((biseqblk)((b), bsStaticBlkParms(s)))
#define bisstemeqStatic(b, s) ((bisstemeqblk)((b), bsStaticBlkParms(s)))
#define biseqcaselessStatic(b, s) ((biseqcaselessblk)((b), bsStaticBlkParms(s)))
#define bisstemeqcaselessStatic(b, s) \
((bisstemeqcaselessblk)((b), bsStaticBlkParms(s)))
/* Reference building macros */
#define cstr2tbstr btfromcstr
#define btfromcstr(t, s) \
{ \
(t).data = (unsigned char *)(s); \
(t).slen = ((t).data) ? ((int)(strlen)((char *)(t).data)) : 0; \
(t).mlen = -1; \
}
#define blk2tbstr(t, s, l) \
{ \
(t).data = (unsigned char *)(s); \
(t).slen = l; \
(t).mlen = -1; \
}
#define btfromblk(t, s, l) blk2tbstr(t, s, l)
#define bmid2tbstr(t, b, p, l) \
{ \
const_bstring bstrtmp_s = (b); \
if (bstrtmp_s && bstrtmp_s->data && bstrtmp_s->slen >= 0) { \
int bstrtmp_left = (p); \
int bstrtmp_len = (l); \
if (bstrtmp_left < 0) { \
bstrtmp_len += bstrtmp_left; \
bstrtmp_left = 0; \
} \
if (bstrtmp_len > bstrtmp_s->slen - bstrtmp_left) \
bstrtmp_len = bstrtmp_s->slen - bstrtmp_left; \
if (bstrtmp_len <= 0) { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} else { \
(t).data = bstrtmp_s->data + bstrtmp_left; \
(t).slen = bstrtmp_len; \
} \
} else { \
(t).data = (unsigned char *)""; \
(t).slen = 0; \
} \
(t).mlen = -__LINE__; \
}
#define btfromblkltrimws(t, s, l) \
{ \
int bstrtmp_idx = 0, bstrtmp_len = (l); \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx < bstrtmp_len; bstrtmp_idx++) { \
if (!isspace(bstrtmp_s[bstrtmp_idx])) \
break; \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len - bstrtmp_idx; \
(t).mlen = -__LINE__; \
}
#define btfromblkrtrimws(t, s, l) \
{ \
int bstrtmp_len = (l)-1; \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_len >= 0; bstrtmp_len--) { \
if (!isspace(bstrtmp_s[bstrtmp_len])) \
break; \
} \
} \
(t).data = bstrtmp_s; \
(t).slen = bstrtmp_len + 1; \
(t).mlen = -__LINE__; \
}
#define btfromblktrimws(t, s, l) \
{ \
int bstrtmp_idx = 0, bstrtmp_len = (l)-1; \
unsigned char *bstrtmp_s = (s); \
if (bstrtmp_s && bstrtmp_len >= 0) { \
for (; bstrtmp_idx <= bstrtmp_len; bstrtmp_idx++) { \
if (!isspace(bstrtmp_s[bstrtmp_idx])) \
break; \
} \
for (; bstrtmp_len >= bstrtmp_idx; bstrtmp_len--) { \
if (!isspace(bstrtmp_s[bstrtmp_len])) \
break; \
} \
} \
(t).data = bstrtmp_s + bstrtmp_idx; \
(t).slen = bstrtmp_len + 1 - bstrtmp_idx; \
(t).mlen = -__LINE__; \
}
/* Write protection macros */
#define bwriteprotect(t) \
{ \
if ((t).mlen >= 0) \
(t).mlen = -1; \
}
#define bwriteallow(t) \
{ \
if ((t).mlen == -1) \
(t).mlen = (t).slen + ((t).slen == 0); \
}
#define biswriteprotected(t) ((t).mlen <= 0)
#ifdef __cplusplus
}
#endif
#endif
/*
* 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
*/
/*! \file curl.cpp
\brief
\author Hongxin WANG, BUPT
\date 2021
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "curl.hpp"
......
/*
* 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
*/
/*! \file curl.hpp
\brief
\date 2020
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#ifndef _CURL_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 Apache License, Version 2.0 (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.apache.org/licenses/LICENSE-2.0
*
* 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
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
/*! \file get_gateway_netlink.h
\brief
\author Lionel Gauthier
\company Eurecom
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_IF_HPP_SEEN
#define FILE_IF_HPP_SEEN
......
/*
* 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
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "string.hpp"
......
/*
* 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
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
/*! \file string.hpp
\brief
\author Lionel GAUTHIER
\date 2018
\email: lionel.gauthier@eurecom.fr
*/
#ifndef FILE_STRING_HPP_FILE_SEEN
#define FILE_STRING_HPP_FILE_SEEN
......
/*
* 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
*/
/*! \file udm_config.cpp
\brief
\author Hongxin WANG, BUPT
\date 2021
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#include "udm_config.hpp"
......
/*
* 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
*/
/*! \file udm_config.hpp
\brief
\author Hongxin WANG, BUPT
\date 2021
\email: contact@openairinterface.org
* Licensed to Open Source Radio Access Network(OS-RAN) Alliance and OAI
* Software Alliance under one or more contributor license agreements. The
* initial OpenXG series projects are derided from OAI projects, the files from
* OAI projects are all in compliance with OAI Public License, Version 1.1.
* codes and files developed from OpenXG projects and from OS-RAN Alliance
* are all under OS-RAN licenses; you may not use this file except in compliance
* with the license. You may get a copy of the license at:
* http://www.openxg.org.cn/?falu_69.html
* For more information about OpenXG, please contact:
* contact@openxg.org.cn
*/
#ifndef _UDM_CONFIG_H_
......
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