Add PCF(Policy Control Function)

This commit is contained in:
Sukchan Lee 2020-12-11 14:03:20 -05:00
parent fb95725ca4
commit 198abc6e8b
299 changed files with 29050 additions and 1075 deletions

View File

@ -194,7 +194,12 @@ udm:
- addr: 127.0.0.12
port: 7777
udr:
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

View File

@ -228,7 +228,12 @@ udm:
- addr: 127.0.0.12
port: 7777
udr:
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

View File

@ -197,7 +197,12 @@ udm:
- addr: 127.0.0.12
port: 7777
udr:
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

View File

@ -32,6 +32,7 @@ open5gs_conf = '''
ausf.yaml
udm.yaml
udr.yaml
pcf.yaml
'''.split()
foreach file : open5gs_conf

View File

@ -1,3 +1,5 @@
db_uri: mongodb://localhost/open5gs
#
# logger:
#

179
configs/open5gs/pcf.yaml.in Normal file
View File

@ -0,0 +1,179 @@
db_uri: mongodb://localhost/open5gs
#
# logger:
#
# o Set OGS_LOG_INFO to all domain level
# - If `level` is omitted, the default level is OGS_LOG_INFO)
# - If `domain` is omitted, the all domain level is set from 'level'
# (Nothing is needed)
#
# o Set OGS_LOG_ERROR to all domain level
# - `level` can be set with none, fatal, error, warn, info, debug, trace
# level: error
#
# o Set OGS_LOG_DEBUG to mme/emm domain level
# level: debug
# domain: mme,emm
#
# o Set OGS_LOG_TRACE to all domain level
# level: trace
# domain: core,sbi,pcf,event,tlv,mem,sock
#
logger:
file: @localstatedir@/log/open5gs/pcf.log
#
# pcf:
#
# <SBI Server>
#
# o SBI Server(http://<all address available>:80)
# sbi:
#
# o SBI Server(http://<any address>:80)
# sbi:
# - addr:
# - 0.0.0.0
# - ::0
# port: 7777
#
# o SBI Server(https://<all address avaiable>:443)
# sbi:
# tls:
# key: pcf.key
# pem: pcf.pem
#
# o SBI Server(https://127.0.0.13:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.13
# tls:
# key: pcf.key
# pem: pcf.pem
# - addr: ::1
#
# o SBI Server(http://pcf.open5gs.org:80)
# sbi:
# name: pcf.open5gs.org
#
# o SBI Server(http://127.0.0.13:7777)
# sbi:
# - addr: 127.0.0.13
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%@loopback_devname@]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%@loopback_devname@
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The Number of Default Memory Pool Size
#
# - Pool-size 128 => 32768 Number
# - Pool-size 256 => 4096 Number
# - Pool-size 512 => 2048 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 32768
# 256: 4096
# 512: 2048
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 10 seconds)
#
# o NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:

View File

@ -43,9 +43,9 @@ logger:
# key: udr.key
# pem: udr.pem
#
# o SBI Server(https://127.0.0.13:443, http://[::1]:80)
# o SBI Server(https://127.0.0.20:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.13
# - addr: 127.0.0.20
# tls:
# key: udr.key
# pem: udr.pem
@ -55,9 +55,9 @@ logger:
# sbi:
# name: udr.open5gs.org
#
# o SBI Server(http://127.0.0.13:7777)
# o SBI Server(http://127.0.0.20:7777)
# sbi:
# - addr: 127.0.0.13
# - addr: 127.0.0.20
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
@ -66,7 +66,7 @@ logger:
#
udr:
sbi:
- addr: 127.0.0.13
- addr: 127.0.0.20
port: 7777
#

View File

@ -194,7 +194,12 @@ udm:
- addr: 127.0.0.12
port: 7777
udr:
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

View File

@ -194,7 +194,12 @@ udm:
- addr: 127.0.0.12
port: 7777
udr:
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

View File

@ -27,6 +27,7 @@ systemd_conf_in = '''
open5gs-nrfd.service
open5gs-ausfd.service
open5gs-udmd.service
open5gs-pcfd.service
open5gs-udrd.service
'''.split()

View File

@ -0,0 +1,18 @@
[Unit]
Description=Open5GS PCF Daemon
After=networking.service
[Service]
Type=simple
User=open5gs
Group=open5gs
Restart=always
ExecStart=@bindir@/open5gs-pcfd -c @sysconfdir@/open5gs/pcf.yaml
RestartSec=2
RestartPreventExitStatus=1
ExecReload=/bin/kill -HUP $MAINPID
[Install]
WantedBy=multi-user.target

View File

@ -199,7 +199,12 @@ udm:
- addr: 127.0.0.12
port: 7777
udr:
pcf:
sbi:
- addr: 127.0.0.13
port: 7777
udr:
sbi:
- addr: 127.0.0.20
port: 7777

13
debian/control vendored
View File

@ -187,6 +187,18 @@ Description: UDM (Unified Data Management)
.
This package provides the UDM (Unified Data Managemement)
Package: open5gs-pcf
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
open5gs-common (= ${binary:Version})
Description: PCF (Policy Control Function)
Open5GS is a C-language implementation of 5G Core and EPC
Packet Core, i.e. the core network of an NR/LTE network (Release-16)
.
This package provides the PCF (Policy Control Function)
Package: open5gs-udr
Architecture: any
Multi-Arch: same
@ -215,6 +227,7 @@ Depends: ${misc:Depends},
open5gs-nrf (= ${binary:Version}),
open5gs-ausf (= ${binary:Version}),
open5gs-udm (= ${binary:Version}),
open5gs-pcf (= ${binary:Version}),
open5gs-udr (= ${binary:Version})
Description: 5G Core and EPC (metapackage)
Open5GS is a C-language implementation of 5G Core and EPC

3
debian/open5gs-pcf.install vendored Normal file
View File

@ -0,0 +1,3 @@
usr/bin/open5gs-pcfd
configs/open5gs/pcf.yaml etc/open5gs
configs/systemd/open5gs-pcfd.service lib/systemd/system

View File

@ -13,7 +13,7 @@ This post explains how to compile and install the source code on **Debian/Ubuntu
### Getting MongoDB
---
Install MongoDB with package manager. It is used as database for the HSS and PCRF.
Install MongoDB with package manager. It is used as database for NRF/PCF/UDR and PCRF/HSS.
```bash
$ sudo apt update
@ -212,7 +212,7 @@ If you modify the config files while Open5GS daemons are running, please restart
```bash
$ cd install/bin/
$ ./install/bin/open5gs-mmed
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:53:47.328: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' (../src/main.c:54)
08/21 22:53:47.328: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/mme.log' (../src/main.c:57)
@ -222,7 +222,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:53:47.366: [mme] INFO: s1ap_server() [127.0.0.2]:36412 (../src/mme/s1ap-sctp.c:57)
$ ./install/bin/open5gs-sgwcd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:54:43.059: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwc.yaml' (../src/main.c:54)
08/21 22:54:43.059: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwc.log' (../src/main.c:57)
@ -232,7 +232,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:54:43.066: [pfcp] INFO: ogs_pfcp_connect() [127.0.0.6]:8805 (../lib/pfcp/path.c:60)
$ ./install/bin/open5gs-smfd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:54:56.000: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/smf.yaml' (../src/main.c:54)
08/21 22:54:56.000: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/smf.log' (../src/main.c:57)
@ -245,7 +245,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:54:56.051: [sbi] INFO: sbi_server() [127.0.0.4]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-amfd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:55:14.015: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/amf.yaml' (../src/main.c:54)
08/21 22:55:14.015: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/amf.log' (../src/main.c:57)
@ -254,7 +254,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:55:14.040: [amf] INFO: ngap_server() [127.0.0.5]:38412 (../src/amf/ngap-sctp.c:56)
$ ./install/bin/open5gs-sgwud
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:54:10.357: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwu.yaml' (../src/main.c:54)
08/21 22:54:10.357: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/sgwu.log' (../src/main.c:57)
@ -263,7 +263,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:54:10.361: [gtp] INFO: gtp_server() [127.0.0.6]:2152 (../lib/gtp/path.c:32)
$ ./install/bin/open5gs-upfd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:54:21.596: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/upf.yaml' (../src/main.c:54)
08/21 22:54:21.596: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/upf.log' (../src/main.c:57)
@ -273,7 +273,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:54:21.601: [gtp] INFO: gtp_server() [::1]:2152 (../lib/gtp/path.c:32)
$ ./install/bin/open5gs-hssd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:57:17.450: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/hss.yaml' (../src/main.c:54)
08/21 22:57:17.450: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/hss.log' (../src/main.c:57)
@ -281,7 +281,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:57:17.519: [app] INFO: HSS initialize...done (../src/hss/app-init.c:31)
$ ./install/bin/open5gs-pcrfd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:57:45.894: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcrf.yaml' (../src/main.c:54)
08/21 22:57:45.894: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcrf.log' (../src/main.c:57)
@ -289,7 +289,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:57:45.997: [app] INFO: PCRF initialize...done (../src/pcrf/app-init.c:31)
$ ./install/bin/open5gs-nrfd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:56:35.472: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nrf.yaml' (../src/main.c:54)
08/21 22:56:35.472: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nrf.log' (../src/main.c:57)
@ -298,7 +298,7 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:56:35.473: [sbi] INFO: sbi_server() [::1]:7777 (../lib/sbi/server.c:298
$ ./install/bin/open5gs-ausfd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:55:41.899: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/ausf.yaml' (../src/main.c:54)
08/21 22:55:41.899: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/ausf.log' (../src/main.c:57)
@ -306,15 +306,23 @@ Open5GS daemon v1.3.0-213-gd190548+
08/21 22:55:41.900: [sbi] INFO: sbi_server() [127.0.0.11]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udmd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udm.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udm.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: UDM initialize...done (../src/udm/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-pcfd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcf.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/pcf.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: PCF initialize...done (../src/pcf/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udrd
Open5GS daemon v1.3.0-213-gd190548+
Open5GS daemon v2.1.0
08/21 22:56:15.810: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udr.yaml' (../src/main.c:54)
08/21 22:56:15.810: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/udr.log' (../src/main.c:57)

View File

@ -33,7 +33,8 @@ PCRF-frDi = 127.0.0.9 :3868 for Gx auth
NRF-sbi = 127.0.0.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
UDR-sbi = 127.0.0.13:7777 for 5G SBI
PCF-sbi = 127.0.0.12:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
_Cloud Userplane Server (to host IMS etc)_

View File

@ -324,7 +324,8 @@ $ ninja install
$ cd ../
$ ls install/bin
open5gs-amfd open5gs-hssd open5gs-nrfd open5gs-sgwcd open5gs-smfd open5gs-udrd
open5gs-ausfd open5gs-mmed open5gs-pcrfd open5gs-sgwud open5gs-udmd open5gs-upfd
open5gs-ausfd open5gs-mmed open5gs-pcrfd open5gs-sgwud open5gs-udmd open5gs-pcfd
open5gs-upfd
```
## Building WebUI of Open5GS

View File

@ -23,10 +23,11 @@ open5gs 27366 0.0 0.0 2890772 14380 ? Ssl 12:13 0:00 /usr/bin/open5g
open5gs 27485 0.0 0.0 243816 15064 ? Ssl 12:13 0:00 /usr/bin/open5gs-nrfd -c /etc/open5gs/nrf.yaml
open5gs 27543 0.0 0.0 222416 9672 ? Ssl 12:13 0:00 /usr/bin/open5gs-ausfd -c /etc/open5gs/ausf.yaml
open5gs 27600 0.0 0.0 222328 9668 ? Ssl 12:13 0:00 /usr/bin/open5gs-udmd -c /etc/open5gs/udm.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-pcfd -c /etc/open5gs/pcf.yaml
open5gs 27697 0.0 0.0 243976 13716 ? Ssl 12:13 0:00 /usr/bin/open5gs-udrd -c /etc/open5gs/udr.yaml
```
You should see each of the above services, MME, SGW-C, SMF, AMF, SGW-U, UPF, HSS, PCRF, NRF, AUSF, UDM & UDR are all running.
You should see each of the above services, MME, SGW-C, SMF, AMF, SGW-U, UPF, HSS, PCRF, NRF, AUSF, UDM, PCF & UDR are all running.
If your instance doesn't show this make sure you're started each service:
```bash
@ -41,6 +42,7 @@ $ systemctl start open5gs-pcrfd.service
$ systemctl start open5gs-nrfd.service
$ systemctl start open5gs-ausfd.service
$ systemctl start open5gs-udmd.service
$ systemctl start open5gs-pcfd.service
$ systemctl start open5gs-udrd.service
```

View File

@ -56,6 +56,7 @@ $ open5gs-nrfd
$ open5gs-amfd
$ open5gs-ausfd
$ open5gs-udmd
$ open5gs-pcfd
$ open5gs-udrd
```
@ -254,6 +255,7 @@ $ sudo pkill -9 open5gs-pcrfd
$ sudo pkill -9 open5gs-nrfd
$ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
$ sudo pkill -9 open5gs-udrd
```
@ -721,7 +723,8 @@ Currently, the number of UE is limited to `128*128`.
* NRF : 127.0.0.10
* AUSF : 127.0.0.11
* UDM : 127.0.0.12
* UDR : 127.0.0.13
* PCF : 127.0.0.13
* UDR : 127.0.0.20
```
- AMF_ID, TAC and S_NSSAI

View File

@ -75,6 +75,9 @@ void udm_terminate(void);
int ausf_initialize(void);
void ausf_terminate(void);
int pcf_initialize(void);
void pcf_terminate(void);
int upf_initialize(void);
void upf_terminate(void);

View File

@ -303,6 +303,9 @@ int ogs_app_context_parse_config(void)
} else if (!strcmp(parameter_key, "no_udm")) {
self.parameter.no_udm =
ogs_yaml_iter_bool(&parameter_iter);
} else if (!strcmp(parameter_key, "no_pcf")) {
self.parameter.no_pcf =
ogs_yaml_iter_bool(&parameter_iter);
} else if (!strcmp(parameter_key, "no_udr")) {
self.parameter.no_udr =
ogs_yaml_iter_bool(&parameter_iter);

View File

@ -62,6 +62,7 @@ typedef struct ogs_app_context_s {
int no_upf;
int no_ausf;
int no_udm;
int no_pcf;
int no_udr;
int no_nrf;

View File

@ -189,32 +189,16 @@ ogs_sock_t *ogs_sock_accept(ogs_sock_t *sock)
ssize_t ogs_write(ogs_socket_t fd, const void *buf, size_t len)
{
ssize_t size;
ogs_assert(fd != INVALID_SOCKET);
size = write(fd, buf, len);
if (size < 0) {
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
"ogs_write(len:%d) failed", (int)size);
}
return size;
return write(fd, buf, len);
}
ssize_t ogs_read(ogs_socket_t fd, void *buf, size_t len)
{
ssize_t size;
ogs_assert(fd != INVALID_SOCKET);
size = read(fd, buf, len);
if (size < 0) {
ogs_log_message(OGS_LOG_ERROR, ogs_socket_errno,
"ogs_read(len:%d) failed", (int)size);
}
return size;
return read(fd, buf, len);
}
ssize_t ogs_send(ogs_socket_t fd, const void *buf, size_t len, int flags)

View File

@ -102,9 +102,20 @@ typedef struct ogs_sbi_nf_type_array_s {
ogs_sbi_nf_instance_t *nf_instance;
} ogs_sbi_nf_type_array_t[OGS_SBI_MAX_NF_TYPE];
typedef enum {
OGS_SBI_OBJ_BASE = 0,
OGS_SBI_OBJ_UE_TYPE,
OGS_SBI_OBJ_SESS_TYPE,
OGS_SBI_OBJ_TOP,
} ogs_sbi_obj_type_e;
typedef struct ogs_sbi_object_s {
ogs_lnode_t lnode;
ogs_sbi_obj_type_e type;
ogs_sbi_nf_type_array_t nf_type_array;
ogs_list_t xact_list;

View File

@ -316,6 +316,54 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str)
return true;
}
char *ogs_sbi_s_nssai_to_string(ogs_s_nssai_t *s_nssai)
{
cJSON *item = NULL;
OpenAPI_snssai_t sNSSAI;
char *v = NULL;
ogs_assert(s_nssai);
sNSSAI.sst = s_nssai->sst;
sNSSAI.sd = ogs_s_nssai_sd_to_string(s_nssai->sd);
item = OpenAPI_snssai_convertToJSON(&sNSSAI);
ogs_assert(item);
if (sNSSAI.sd) ogs_free(sNSSAI.sd);
v = cJSON_Print(item);
ogs_assert(v);
cJSON_Delete(item);
return v;
}
bool ogs_sbi_s_nssai_from_string(ogs_s_nssai_t *s_nssai, char *str)
{
bool rc = false;
cJSON *item = NULL;
OpenAPI_snssai_t *sNSSAI = NULL;
ogs_assert(s_nssai);
ogs_assert(str);
item = cJSON_Parse(str);
if (item) {
sNSSAI = OpenAPI_snssai_parseFromJSON(item);
if (sNSSAI) {
s_nssai->sst = sNSSAI->sst;
s_nssai->sd = ogs_s_nssai_sd_from_string(sNSSAI->sd);
OpenAPI_snssai_free(sNSSAI);
rc = true;
}
cJSON_Delete(item);
}
return rc;
}
OpenAPI_plmn_id_t *ogs_sbi_build_plmn_id(ogs_plmn_id_t *plmn_id)
{
OpenAPI_plmn_id_t *PlmnId = NULL;

View File

@ -51,6 +51,9 @@ char *ogs_sbi_gmtime_string(ogs_time_t time);
char *ogs_sbi_timezone_string(int tm_offset);
bool ogs_sbi_time_from_string(ogs_time_t *time, char *str);
char *ogs_sbi_s_nssai_to_string(ogs_s_nssai_t *s_nssai);
bool ogs_sbi_s_nssai_from_string(ogs_s_nssai_t *s_nssai, char *str);
OpenAPI_plmn_id_t *ogs_sbi_build_plmn_id(ogs_plmn_id_t *plmn_id);
bool ogs_sbi_parse_plmn_id(
ogs_plmn_id_t *plmn_id, OpenAPI_plmn_id_t *PlmnId);

View File

@ -136,6 +136,19 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message)
if (message->SmContextStatusNotification)
OpenAPI_sm_context_status_notification_free(
message->SmContextStatusNotification);
if (message->PolicyAssociationRequest)
OpenAPI_policy_association_request_free(
message->PolicyAssociationRequest);
if (message->PolicyAssociation)
OpenAPI_policy_association_free(message->PolicyAssociation);
if (message->AmPolicyData)
OpenAPI_am_policy_data_free(message->AmPolicyData);
if (message->SmPolicyContextData)
OpenAPI_sm_policy_context_data_free(message->SmPolicyContextData);
if (message->SmPolicyDecision)
OpenAPI_sm_policy_decision_free(message->SmPolicyDecision);
if (message->SmPolicyData)
OpenAPI_sm_policy_data_free(message->SmPolicyData);
for (i = 0; i < message->num_of_part; i++) {
if (message->part[i].pkbuf)
@ -279,23 +292,14 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
ogs_free(v);
}
}
if (message->param.s_nssai_presence) {
char *v = NULL;
cJSON *item = NULL;
OpenAPI_snssai_t s_nssai;
s_nssai.sst = message->param.s_nssai.sst;
s_nssai.sd = ogs_s_nssai_sd_to_string(message->param.s_nssai.sd);
item = OpenAPI_snssai_convertToJSON(&s_nssai);
ogs_assert(item);
if (s_nssai.sd) ogs_free(s_nssai.sd);
v = cJSON_Print(item);
ogs_assert(v);
cJSON_Delete(item);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_S_NSSAI, v);
if (message->param.single_nssai_presence) {
char *v = ogs_sbi_s_nssai_to_string(&message->param.single_nssai);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SINGLE_NSSAI, v);
ogs_free(v);
}
if (message->param.snssai_presence) {
char *v = ogs_sbi_s_nssai_to_string(&message->param.snssai);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SNSSAI, v);
ogs_free(v);
}
@ -403,25 +407,21 @@ int ogs_sbi_parse_request(
cJSON_Delete(item);
}
}
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_S_NSSAI)) {
char *v = NULL;
cJSON *item = NULL;
OpenAPI_snssai_t *s_nssai = NULL;
v = ogs_hash_this_val(hi);
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_SINGLE_NSSAI)) {
char *v = ogs_hash_this_val(hi);
if (v) {
item = cJSON_Parse(v);
if (item) {
s_nssai = OpenAPI_snssai_parseFromJSON(item);
if (s_nssai) {
message->param.s_nssai_presence = true;
message->param.s_nssai.sst = s_nssai->sst;
message->param.s_nssai.sd =
ogs_s_nssai_sd_from_string(s_nssai->sd);
OpenAPI_snssai_free(s_nssai);
}
cJSON_Delete(item);
}
bool rc = ogs_sbi_s_nssai_from_string(
&message->param.single_nssai, v);
if (rc == true)
message->param.single_nssai_presence = true;
}
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_SNSSAI)) {
char *v = ogs_hash_this_val(hi);
if (v) {
bool rc = ogs_sbi_s_nssai_from_string(
&message->param.snssai, v);
if (rc == true)
message->param.snssai_presence = true;
}
}
}
@ -719,6 +719,28 @@ static char *build_json(ogs_sbi_message_t *message)
item = OpenAPI_sm_context_status_notification_convertToJSON(
message->SmContextStatusNotification);
ogs_assert(item);
} else if (message->PolicyAssociationRequest) {
item = OpenAPI_policy_association_request_convertToJSON(
message->PolicyAssociationRequest);
ogs_assert(item);
} else if (message->PolicyAssociation) {
item = OpenAPI_policy_association_convertToJSON(
message->PolicyAssociation);
ogs_assert(item);
} else if (message->AmPolicyData) {
item = OpenAPI_am_policy_data_convertToJSON(message->AmPolicyData);
ogs_assert(item);
} else if (message->SmPolicyContextData) {
item = OpenAPI_sm_policy_context_data_convertToJSON(
message->SmPolicyContextData);
ogs_assert(item);
} else if (message->SmPolicyDecision) {
item = OpenAPI_sm_policy_decision_convertToJSON(
message->SmPolicyDecision);
ogs_assert(item);
} else if (message->SmPolicyData) {
item = OpenAPI_sm_policy_data_convertToJSON(message->SmPolicyData);
ogs_assert(item);
}
if (item) {
@ -1102,6 +1124,44 @@ static int parse_json(ogs_sbi_message_t *message,
END
break;
CASE(OGS_SBI_RESOURCE_NAME_POLICY_DATA)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_UES)
SWITCH(message->h.resource.component[3])
CASE(OGS_SBI_RESOURCE_NAME_AM_DATA)
message->AmPolicyData =
OpenAPI_am_policy_data_parseFromJSON(item);
if (!message->AmPolicyData) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
break;
CASE(OGS_SBI_RESOURCE_NAME_SM_DATA)
message->SmPolicyData =
OpenAPI_sm_policy_data_parseFromJSON(item);
if (!message->SmPolicyData) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[3]);
END
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[1]);
END
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
@ -1251,6 +1311,61 @@ static int parse_json(ogs_sbi_message_t *message,
message->h.resource.component[0]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL)
SWITCH(message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_POLICIES)
if (message->res_status == 0) {
message->PolicyAssociationRequest =
OpenAPI_policy_association_request_parseFromJSON(
item);
if (!message->PolicyAssociationRequest) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
} else if (message->res_status == OGS_SBI_HTTP_STATUS_CREATED) {
message->PolicyAssociation =
OpenAPI_policy_association_parseFromJSON(item);
if (!message->PolicyAssociation) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[0]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL)
SWITCH(message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_SM_POLICIES)
if (message->res_status == 0) {
message->SmPolicyContextData =
OpenAPI_sm_policy_context_data_parseFromJSON(item);
if (!message->SmPolicyContextData) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
} else if (message->res_status == OGS_SBI_HTTP_STATUS_CREATED) {
message->SmPolicyDecision =
OpenAPI_sm_policy_decision_parseFromJSON(item);
if (!message->SmPolicyDecision) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[0]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NAMF_CALLBACK)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS)

View File

@ -104,7 +104,6 @@ extern "C" {
#define OGS_SBI_SERVICE_NAME_NUDM_UECM "nudm-uecm"
#define OGS_SBI_RESOURCE_NAME_REGISTRATIONS "registrations"
#define OGS_SBI_RESOURCE_NAME_AMF_3GPP_ACCESS "amf-3gpp-access"
#define OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY "dereg-notify"
#define OGS_SBI_SERVICE_NAME_NUDR_DR "nudr-dr"
#define OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA "subscription-data"
@ -114,6 +113,9 @@ extern "C" {
#define OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS "authentication-status"
#define OGS_SBI_RESOURCE_NAME_CONTEXT_DATA "context-data"
#define OGS_SBI_RESOURCE_NAME_PROVISIONED_DATA "provisioned-data"
#define OGS_SBI_RESOURCE_NAME_POLICY_DATA "policy-data"
#define OGS_SBI_RESOURCE_NAME_UES "ues"
#define OGS_SBI_RESOURCE_NAME_AM_DATA "am-data"
#define OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION "nsmf-pdusession"
#define OGS_SBI_RESOURCE_NAME_SM_CONTEXTS "sm-contexts"
@ -121,11 +123,22 @@ extern "C" {
#define OGS_SBI_RESOURCE_NAME_MODIFY "modify"
#define OGS_SBI_RESOURCE_NAME_RELEASE "release"
#define OGS_SBI_SERVICE_NAME_NSMF_CALLBACK "nsmf-callback"
#define OGS_SBI_RESOURCE_NAME_SM_POLICY_NOTIFY "sm-policy-notify"
#define OGS_SBI_SERVICE_NAME_NAMF_COMM "namf-comm"
#define OGS_SBI_SERVICE_NAME_NAMF_CALLBACK "namf-callback"
#define OGS_SBI_RESOURCE_NAME_UE_CONTEXTS "ue-contexts"
#define OGS_SBI_RESOURCE_NAME_N1_N2_MESSAGES "n1-n2-messages"
#define OGS_SBI_SERVICE_NAME_NAMF_CALLBACK "namf-callback"
#define OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS "sm-context-status"
#define OGS_SBI_RESOURCE_NAME_AM_POLICY_NOTIFY "am-policy-notify"
#define OGS_SBI_RESOURCE_NAME_DEREG_NOTIFY "dereg-notify"
#define OGS_SBI_SERVICE_NAME_NPCF_AM_POLICY_CONTROL "npcf-am-policy-control"
#define OGS_SBI_RESOURCE_NAME_POLICIES "policies"
#define OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL "npcf-smpolicycontrol"
#define OGS_SBI_RESOURCE_NAME_SM_POLICIES "sm-policies"
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
@ -133,7 +146,8 @@ extern "C" {
#define OGS_SBI_PARAM_LIMIT "limit"
#define OGS_SBI_PARAM_DNN "dnn"
#define OGS_SBI_PARAM_PLMN_ID "plmn-id"
#define OGS_SBI_PARAM_S_NSSAI "single-nssai"
#define OGS_SBI_PARAM_SINGLE_NSSAI "single-nssai"
#define OGS_SBI_PARAM_SNSSAI "snssai"
#define OGS_SBI_ACCEPT "Accept"
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
@ -215,8 +229,11 @@ typedef struct ogs_sbi_message_s {
char *dnn;
bool plmn_id_presence;
ogs_plmn_id_t plmn_id;
bool s_nssai_presence;
ogs_s_nssai_t s_nssai;
bool single_nssai_presence;
ogs_s_nssai_t single_nssai;
bool snssai_presence;
ogs_s_nssai_t snssai;
} param;
int res_status;
@ -254,6 +271,12 @@ typedef struct ogs_sbi_message_s {
OpenAPI_n1_n2_message_transfer_req_data_t *N1N2MessageTransferReqData;
OpenAPI_n1_n2_message_transfer_rsp_data_t *N1N2MessageTransferRspData;
OpenAPI_sm_context_status_notification_t *SmContextStatusNotification;
OpenAPI_policy_association_request_t *PolicyAssociationRequest;
OpenAPI_policy_association_t *PolicyAssociation;
OpenAPI_am_policy_data_t *AmPolicyData;
OpenAPI_sm_policy_context_data_t *SmPolicyContextData;
OpenAPI_sm_policy_decision_t *SmPolicyDecision;
OpenAPI_sm_policy_data_t *SmPolicyData;
ogs_sbi_links_t *links;

View File

@ -59,6 +59,11 @@
#include "model/n1_n2_message_transfer_req_data.h"
#include "model/n1_n2_message_transfer_rsp_data.h"
#include "model/sm_context_status_notification.h"
#include "model/policy_association.h"
#include "model/am_policy_data.h"
#include "model/sm_policy_context_data.h"
#include "model/sm_policy_decision.h"
#include "model/sm_policy_data.h"
#include "custom/links.h"

View File

@ -643,6 +643,89 @@ libsbi_openapi_sources = files('''
model/ue_reg_status_update_rsp_data.c
model/v2x_context.c
model/acc_net_ch_id.c
model/acc_net_charging_address.c
model/accu_usage_report.c
model/additional_access_info.c
model/af_sig_protocol.c
model/an_gw_address.c
model/app_detection_info.c
model/authorized_default_qos.c
model/candidate_for_replacement.c
model/charging_data.c
model/condition_data.c
model/credit_management_status.c
model/error_report.c
model/failure_cause.c
model/failure_code.c
model/final_unit_action.c
model/flow_direction_rm.c
model/flow_information.c
model/flow_status.c
model/ip_multicast_address_info.c
model/ma_pdu_indication.c
model/mapping_of_snssai.c
model/metering_method.c
model/packet_filter_info.c
model/partial_success_report.c
model/pcc_rule.c
model/pdu_session_rel_cause.c
model/policy_association.c
model/policy_association_release_cause.c
model/policy_association_request.c
model/policy_association_update_request.c
model/policy_control_request_trigger.c
model/policy_update.c
model/port_management_container.c
model/presence_info_rm.c
model/qos_characteristics.c
model/qos_data.c
model/qos_flow_usage.c
model/qos_monitoring_data.c
model/qos_monitoring_report.c
model/qos_notif_type.c
model/qos_notification_control_info.c
model/ran_nas_rel_cause.c
model/redirect_address_type.c
model/redirect_information.c
model/reporting_frequency.c
model/reporting_level.c
model/request_trigger.c
model/requested_qos.c
model/requested_qos_monitoring_parameter.c
model/requested_rule_data.c
model/requested_rule_data_type.c
model/requested_usage_data.c
model/rule_operation.c
model/rule_report.c
model/rule_status.c
model/serving_nf_identity.c
model/session_rule.c
model/session_rule_failure_code.c
model/session_rule_report.c
model/sm_policy_association_release_cause.c
model/sm_policy_context_data.c
model/sm_policy_control.c
model/sm_policy_decision.c
model/sm_policy_delete_data.c
model/sm_policy_notification.c
model/sm_policy_update_context_data.c
model/smf_selection_data.c
model/steer_mode_value.c
model/steering_functionality.c
model/steering_mode.c
model/termination_notification.c
model/traffic_control_data.c
model/tscai_input_container.c
model/tsn_bridge_info.c
model/tsn_port_identifier.c
model/ue_camping_rep.c
model/ue_initiated_resource_request.c
model/up_path_chg_event.c
model/usage_monitoring_data.c
model/wireline_area.c
model/wireline_service_area_restriction.c
'''.split())
libsbi_openapi_inc = include_directories('.')

View File

@ -0,0 +1,171 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "acc_net_ch_id.h"
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create(
int acc_net_cha_id_value,
OpenAPI_list_t *ref_pcc_rule_ids,
int session_ch_scope
)
{
OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = OpenAPI_malloc(sizeof(OpenAPI_acc_net_ch_id_t));
if (!acc_net_ch_id_local_var) {
return NULL;
}
acc_net_ch_id_local_var->acc_net_cha_id_value = acc_net_cha_id_value;
acc_net_ch_id_local_var->ref_pcc_rule_ids = ref_pcc_rule_ids;
acc_net_ch_id_local_var->session_ch_scope = session_ch_scope;
return acc_net_ch_id_local_var;
}
void OpenAPI_acc_net_ch_id_free(OpenAPI_acc_net_ch_id_t *acc_net_ch_id)
{
if (NULL == acc_net_ch_id) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, node) {
ogs_free(node->data);
}
OpenAPI_list_free(acc_net_ch_id->ref_pcc_rule_ids);
ogs_free(acc_net_ch_id);
}
cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_id)
{
cJSON *item = NULL;
if (acc_net_ch_id == NULL) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [AccNetChId]");
return NULL;
}
item = cJSON_CreateObject();
if (!acc_net_ch_id->acc_net_cha_id_value) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [acc_net_cha_id_value]");
goto end;
}
if (cJSON_AddNumberToObject(item, "accNetChaIdValue", acc_net_ch_id->acc_net_cha_id_value) == NULL) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [acc_net_cha_id_value]");
goto end;
}
if (acc_net_ch_id->ref_pcc_rule_ids) {
cJSON *ref_pcc_rule_ids = cJSON_AddArrayToObject(item, "refPccRuleIds");
if (ref_pcc_rule_ids == NULL) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
goto end;
}
OpenAPI_lnode_t *ref_pcc_rule_ids_node;
OpenAPI_list_for_each(acc_net_ch_id->ref_pcc_rule_ids, ref_pcc_rule_ids_node) {
if (cJSON_AddStringToObject(ref_pcc_rule_ids, "", (char*)ref_pcc_rule_ids_node->data) == NULL) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [ref_pcc_rule_ids]");
goto end;
}
}
}
if (acc_net_ch_id->session_ch_scope) {
if (cJSON_AddBoolToObject(item, "sessionChScope", acc_net_ch_id->session_ch_scope) == NULL) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed [session_ch_scope]");
goto end;
}
}
end:
return item;
}
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_idJSON)
{
OpenAPI_acc_net_ch_id_t *acc_net_ch_id_local_var = NULL;
cJSON *acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "accNetChaIdValue");
if (!acc_net_cha_id_value) {
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]");
goto end;
}
if (!cJSON_IsNumber(acc_net_cha_id_value)) {
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [acc_net_cha_id_value]");
goto end;
}
cJSON *ref_pcc_rule_ids = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "refPccRuleIds");
OpenAPI_list_t *ref_pcc_rule_idsList;
if (ref_pcc_rule_ids) {
cJSON *ref_pcc_rule_ids_local;
if (!cJSON_IsArray(ref_pcc_rule_ids)) {
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
goto end;
}
ref_pcc_rule_idsList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_pcc_rule_ids_local, ref_pcc_rule_ids) {
if (!cJSON_IsString(ref_pcc_rule_ids_local)) {
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [ref_pcc_rule_ids]");
goto end;
}
OpenAPI_list_add(ref_pcc_rule_idsList, ogs_strdup(ref_pcc_rule_ids_local->valuestring));
}
}
cJSON *session_ch_scope = cJSON_GetObjectItemCaseSensitive(acc_net_ch_idJSON, "sessionChScope");
if (session_ch_scope) {
if (!cJSON_IsBool(session_ch_scope)) {
ogs_error("OpenAPI_acc_net_ch_id_parseFromJSON() failed [session_ch_scope]");
goto end;
}
}
acc_net_ch_id_local_var = OpenAPI_acc_net_ch_id_create (
acc_net_cha_id_value->valuedouble,
ref_pcc_rule_ids ? ref_pcc_rule_idsList : NULL,
session_ch_scope ? session_ch_scope->valueint : 0
);
return acc_net_ch_id_local_var;
end:
return NULL;
}
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_copy(OpenAPI_acc_net_ch_id_t *dst, OpenAPI_acc_net_ch_id_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_acc_net_ch_id_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_acc_net_ch_id_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_acc_net_ch_id_free(dst);
dst = OpenAPI_acc_net_ch_id_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,42 @@
/*
* acc_net_ch_id.h
*
*
*/
#ifndef _OpenAPI_acc_net_ch_id_H_
#define _OpenAPI_acc_net_ch_id_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_acc_net_ch_id_s OpenAPI_acc_net_ch_id_t;
typedef struct OpenAPI_acc_net_ch_id_s {
int acc_net_cha_id_value;
OpenAPI_list_t *ref_pcc_rule_ids;
int session_ch_scope;
} OpenAPI_acc_net_ch_id_t;
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_create(
int acc_net_cha_id_value,
OpenAPI_list_t *ref_pcc_rule_ids,
int session_ch_scope
);
void OpenAPI_acc_net_ch_id_free(OpenAPI_acc_net_ch_id_t *acc_net_ch_id);
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_parseFromJSON(cJSON *acc_net_ch_idJSON);
cJSON *OpenAPI_acc_net_ch_id_convertToJSON(OpenAPI_acc_net_ch_id_t *acc_net_ch_id);
OpenAPI_acc_net_ch_id_t *OpenAPI_acc_net_ch_id_copy(OpenAPI_acc_net_ch_id_t *dst, OpenAPI_acc_net_ch_id_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_acc_net_ch_id_H_ */

View File

@ -0,0 +1,125 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "acc_net_charging_address.h"
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_create(
char *an_charg_ipv4_addr,
char *an_charg_ipv6_addr
)
{
OpenAPI_acc_net_charging_address_t *acc_net_charging_address_local_var = OpenAPI_malloc(sizeof(OpenAPI_acc_net_charging_address_t));
if (!acc_net_charging_address_local_var) {
return NULL;
}
acc_net_charging_address_local_var->an_charg_ipv4_addr = an_charg_ipv4_addr;
acc_net_charging_address_local_var->an_charg_ipv6_addr = an_charg_ipv6_addr;
return acc_net_charging_address_local_var;
}
void OpenAPI_acc_net_charging_address_free(OpenAPI_acc_net_charging_address_t *acc_net_charging_address)
{
if (NULL == acc_net_charging_address) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(acc_net_charging_address->an_charg_ipv4_addr);
ogs_free(acc_net_charging_address->an_charg_ipv6_addr);
ogs_free(acc_net_charging_address);
}
cJSON *OpenAPI_acc_net_charging_address_convertToJSON(OpenAPI_acc_net_charging_address_t *acc_net_charging_address)
{
cJSON *item = NULL;
if (acc_net_charging_address == NULL) {
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed [AccNetChargingAddress]");
return NULL;
}
item = cJSON_CreateObject();
if (acc_net_charging_address->an_charg_ipv4_addr) {
if (cJSON_AddStringToObject(item, "anChargIpv4Addr", acc_net_charging_address->an_charg_ipv4_addr) == NULL) {
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed [an_charg_ipv4_addr]");
goto end;
}
}
if (acc_net_charging_address->an_charg_ipv6_addr) {
if (cJSON_AddStringToObject(item, "anChargIpv6Addr", acc_net_charging_address->an_charg_ipv6_addr) == NULL) {
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed [an_charg_ipv6_addr]");
goto end;
}
}
end:
return item;
}
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_parseFromJSON(cJSON *acc_net_charging_addressJSON)
{
OpenAPI_acc_net_charging_address_t *acc_net_charging_address_local_var = NULL;
cJSON *an_charg_ipv4_addr = cJSON_GetObjectItemCaseSensitive(acc_net_charging_addressJSON, "anChargIpv4Addr");
if (an_charg_ipv4_addr) {
if (!cJSON_IsString(an_charg_ipv4_addr)) {
ogs_error("OpenAPI_acc_net_charging_address_parseFromJSON() failed [an_charg_ipv4_addr]");
goto end;
}
}
cJSON *an_charg_ipv6_addr = cJSON_GetObjectItemCaseSensitive(acc_net_charging_addressJSON, "anChargIpv6Addr");
if (an_charg_ipv6_addr) {
if (!cJSON_IsString(an_charg_ipv6_addr)) {
ogs_error("OpenAPI_acc_net_charging_address_parseFromJSON() failed [an_charg_ipv6_addr]");
goto end;
}
}
acc_net_charging_address_local_var = OpenAPI_acc_net_charging_address_create (
an_charg_ipv4_addr ? ogs_strdup(an_charg_ipv4_addr->valuestring) : NULL,
an_charg_ipv6_addr ? ogs_strdup(an_charg_ipv6_addr->valuestring) : NULL
);
return acc_net_charging_address_local_var;
end:
return NULL;
}
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_copy(OpenAPI_acc_net_charging_address_t *dst, OpenAPI_acc_net_charging_address_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_acc_net_charging_address_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_acc_net_charging_address_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_acc_net_charging_address_free(dst);
dst = OpenAPI_acc_net_charging_address_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,40 @@
/*
* acc_net_charging_address.h
*
* Describes the network entity within the access network performing charging
*/
#ifndef _OpenAPI_acc_net_charging_address_H_
#define _OpenAPI_acc_net_charging_address_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_acc_net_charging_address_s OpenAPI_acc_net_charging_address_t;
typedef struct OpenAPI_acc_net_charging_address_s {
char *an_charg_ipv4_addr;
char *an_charg_ipv6_addr;
} OpenAPI_acc_net_charging_address_t;
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_create(
char *an_charg_ipv4_addr,
char *an_charg_ipv6_addr
);
void OpenAPI_acc_net_charging_address_free(OpenAPI_acc_net_charging_address_t *acc_net_charging_address);
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_parseFromJSON(cJSON *acc_net_charging_addressJSON);
cJSON *OpenAPI_acc_net_charging_address_convertToJSON(OpenAPI_acc_net_charging_address_t *acc_net_charging_address);
OpenAPI_acc_net_charging_address_t *OpenAPI_acc_net_charging_address_copy(OpenAPI_acc_net_charging_address_t *dst, OpenAPI_acc_net_charging_address_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_acc_net_charging_address_H_ */

View File

@ -148,9 +148,6 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
}
OpenAPI_list_free(access_and_mobility_subscription_data->forbidden_areas);
OpenAPI_service_area_restriction_free(access_and_mobility_subscription_data->service_area_restriction);
OpenAPI_list_for_each(access_and_mobility_subscription_data->core_network_type_restrictions, node) {
OpenAPI_core_network_type_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->core_network_type_restrictions);
OpenAPI_sor_info_free(access_and_mobility_subscription_data->sor_info);
OpenAPI_list_free(access_and_mobility_subscription_data->sor_update_indicator_list);
@ -356,21 +353,16 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
if (access_and_mobility_subscription_data->core_network_type_restrictions) {
cJSON *core_network_type_restrictionsList = cJSON_AddArrayToObject(item, "coreNetworkTypeRestrictions");
if (core_network_type_restrictionsList == NULL) {
cJSON *core_network_type_restrictions = cJSON_AddArrayToObject(item, "coreNetworkTypeRestrictions");
if (core_network_type_restrictions == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [core_network_type_restrictions]");
goto end;
}
OpenAPI_lnode_t *core_network_type_restrictions_node;
if (access_and_mobility_subscription_data->core_network_type_restrictions) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->core_network_type_restrictions, core_network_type_restrictions_node) {
cJSON *itemLocal = OpenAPI_core_network_type_convertToJSON(core_network_type_restrictions_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [core_network_type_restrictions]");
goto end;
}
cJSON_AddItemToArray(core_network_type_restrictionsList, itemLocal);
OpenAPI_list_for_each(access_and_mobility_subscription_data->core_network_type_restrictions, core_network_type_restrictions_node) {
if (cJSON_AddStringToObject(core_network_type_restrictions, "", OpenAPI_core_network_type_ToString((OpenAPI_core_network_type_e)core_network_type_restrictions_node->data)) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [core_network_type_restrictions]");
goto end;
}
}
}
@ -970,13 +962,12 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
core_network_type_restrictionsList = OpenAPI_list_create();
cJSON_ArrayForEach(core_network_type_restrictions_local_nonprimitive, core_network_type_restrictions ) {
if (!cJSON_IsObject(core_network_type_restrictions_local_nonprimitive)) {
if (!cJSON_IsString(core_network_type_restrictions_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [core_network_type_restrictions]");
goto end;
}
OpenAPI_core_network_type_t *core_network_type_restrictionsItem = OpenAPI_core_network_type_parseFromJSON(core_network_type_restrictions_local_nonprimitive);
OpenAPI_list_add(core_network_type_restrictionsList, core_network_type_restrictionsItem);
OpenAPI_list_add(core_network_type_restrictionsList, (void *)OpenAPI_core_network_type_FromString(core_network_type_restrictions_local_nonprimitive->valuestring));
}
}

View File

@ -0,0 +1,262 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "accu_usage_report.h"
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_create(
char *ref_um_ids,
long vol_usage,
long vol_usage_uplink,
long vol_usage_downlink,
int time_usage,
long next_vol_usage,
long next_vol_usage_uplink,
long next_vol_usage_downlink,
int next_time_usage
)
{
OpenAPI_accu_usage_report_t *accu_usage_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_accu_usage_report_t));
if (!accu_usage_report_local_var) {
return NULL;
}
accu_usage_report_local_var->ref_um_ids = ref_um_ids;
accu_usage_report_local_var->vol_usage = vol_usage;
accu_usage_report_local_var->vol_usage_uplink = vol_usage_uplink;
accu_usage_report_local_var->vol_usage_downlink = vol_usage_downlink;
accu_usage_report_local_var->time_usage = time_usage;
accu_usage_report_local_var->next_vol_usage = next_vol_usage;
accu_usage_report_local_var->next_vol_usage_uplink = next_vol_usage_uplink;
accu_usage_report_local_var->next_vol_usage_downlink = next_vol_usage_downlink;
accu_usage_report_local_var->next_time_usage = next_time_usage;
return accu_usage_report_local_var;
}
void OpenAPI_accu_usage_report_free(OpenAPI_accu_usage_report_t *accu_usage_report)
{
if (NULL == accu_usage_report) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(accu_usage_report->ref_um_ids);
ogs_free(accu_usage_report);
}
cJSON *OpenAPI_accu_usage_report_convertToJSON(OpenAPI_accu_usage_report_t *accu_usage_report)
{
cJSON *item = NULL;
if (accu_usage_report == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [AccuUsageReport]");
return NULL;
}
item = cJSON_CreateObject();
if (!accu_usage_report->ref_um_ids) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [ref_um_ids]");
goto end;
}
if (cJSON_AddStringToObject(item, "refUmIds", accu_usage_report->ref_um_ids) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [ref_um_ids]");
goto end;
}
if (accu_usage_report->vol_usage) {
if (cJSON_AddNumberToObject(item, "volUsage", accu_usage_report->vol_usage) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [vol_usage]");
goto end;
}
}
if (accu_usage_report->vol_usage_uplink) {
if (cJSON_AddNumberToObject(item, "volUsageUplink", accu_usage_report->vol_usage_uplink) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [vol_usage_uplink]");
goto end;
}
}
if (accu_usage_report->vol_usage_downlink) {
if (cJSON_AddNumberToObject(item, "volUsageDownlink", accu_usage_report->vol_usage_downlink) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [vol_usage_downlink]");
goto end;
}
}
if (accu_usage_report->time_usage) {
if (cJSON_AddNumberToObject(item, "timeUsage", accu_usage_report->time_usage) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [time_usage]");
goto end;
}
}
if (accu_usage_report->next_vol_usage) {
if (cJSON_AddNumberToObject(item, "nextVolUsage", accu_usage_report->next_vol_usage) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_vol_usage]");
goto end;
}
}
if (accu_usage_report->next_vol_usage_uplink) {
if (cJSON_AddNumberToObject(item, "nextVolUsageUplink", accu_usage_report->next_vol_usage_uplink) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_vol_usage_uplink]");
goto end;
}
}
if (accu_usage_report->next_vol_usage_downlink) {
if (cJSON_AddNumberToObject(item, "nextVolUsageDownlink", accu_usage_report->next_vol_usage_downlink) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_vol_usage_downlink]");
goto end;
}
}
if (accu_usage_report->next_time_usage) {
if (cJSON_AddNumberToObject(item, "nextTimeUsage", accu_usage_report->next_time_usage) == NULL) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed [next_time_usage]");
goto end;
}
}
end:
return item;
}
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_parseFromJSON(cJSON *accu_usage_reportJSON)
{
OpenAPI_accu_usage_report_t *accu_usage_report_local_var = NULL;
cJSON *ref_um_ids = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "refUmIds");
if (!ref_um_ids) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [ref_um_ids]");
goto end;
}
if (!cJSON_IsString(ref_um_ids)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [ref_um_ids]");
goto end;
}
cJSON *vol_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "volUsage");
if (vol_usage) {
if (!cJSON_IsNumber(vol_usage)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [vol_usage]");
goto end;
}
}
cJSON *vol_usage_uplink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "volUsageUplink");
if (vol_usage_uplink) {
if (!cJSON_IsNumber(vol_usage_uplink)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [vol_usage_uplink]");
goto end;
}
}
cJSON *vol_usage_downlink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "volUsageDownlink");
if (vol_usage_downlink) {
if (!cJSON_IsNumber(vol_usage_downlink)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [vol_usage_downlink]");
goto end;
}
}
cJSON *time_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "timeUsage");
if (time_usage) {
if (!cJSON_IsNumber(time_usage)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [time_usage]");
goto end;
}
}
cJSON *next_vol_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextVolUsage");
if (next_vol_usage) {
if (!cJSON_IsNumber(next_vol_usage)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_vol_usage]");
goto end;
}
}
cJSON *next_vol_usage_uplink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextVolUsageUplink");
if (next_vol_usage_uplink) {
if (!cJSON_IsNumber(next_vol_usage_uplink)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_vol_usage_uplink]");
goto end;
}
}
cJSON *next_vol_usage_downlink = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextVolUsageDownlink");
if (next_vol_usage_downlink) {
if (!cJSON_IsNumber(next_vol_usage_downlink)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_vol_usage_downlink]");
goto end;
}
}
cJSON *next_time_usage = cJSON_GetObjectItemCaseSensitive(accu_usage_reportJSON, "nextTimeUsage");
if (next_time_usage) {
if (!cJSON_IsNumber(next_time_usage)) {
ogs_error("OpenAPI_accu_usage_report_parseFromJSON() failed [next_time_usage]");
goto end;
}
}
accu_usage_report_local_var = OpenAPI_accu_usage_report_create (
ogs_strdup(ref_um_ids->valuestring),
vol_usage ? vol_usage->valuedouble : 0,
vol_usage_uplink ? vol_usage_uplink->valuedouble : 0,
vol_usage_downlink ? vol_usage_downlink->valuedouble : 0,
time_usage ? time_usage->valuedouble : 0,
next_vol_usage ? next_vol_usage->valuedouble : 0,
next_vol_usage_uplink ? next_vol_usage_uplink->valuedouble : 0,
next_vol_usage_downlink ? next_vol_usage_downlink->valuedouble : 0,
next_time_usage ? next_time_usage->valuedouble : 0
);
return accu_usage_report_local_var;
end:
return NULL;
}
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_copy(OpenAPI_accu_usage_report_t *dst, OpenAPI_accu_usage_report_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_accu_usage_report_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_accu_usage_report_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_accu_usage_report_free(dst);
dst = OpenAPI_accu_usage_report_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,54 @@
/*
* accu_usage_report.h
*
*
*/
#ifndef _OpenAPI_accu_usage_report_H_
#define _OpenAPI_accu_usage_report_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_accu_usage_report_s OpenAPI_accu_usage_report_t;
typedef struct OpenAPI_accu_usage_report_s {
char *ref_um_ids;
long vol_usage;
long vol_usage_uplink;
long vol_usage_downlink;
int time_usage;
long next_vol_usage;
long next_vol_usage_uplink;
long next_vol_usage_downlink;
int next_time_usage;
} OpenAPI_accu_usage_report_t;
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_create(
char *ref_um_ids,
long vol_usage,
long vol_usage_uplink,
long vol_usage_downlink,
int time_usage,
long next_vol_usage,
long next_vol_usage_uplink,
long next_vol_usage_downlink,
int next_time_usage
);
void OpenAPI_accu_usage_report_free(OpenAPI_accu_usage_report_t *accu_usage_report);
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_parseFromJSON(cJSON *accu_usage_reportJSON);
cJSON *OpenAPI_accu_usage_report_convertToJSON(OpenAPI_accu_usage_report_t *accu_usage_report);
OpenAPI_accu_usage_report_t *OpenAPI_accu_usage_report_copy(OpenAPI_accu_usage_report_t *dst, OpenAPI_accu_usage_report_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_accu_usage_report_H_ */

View File

@ -0,0 +1,132 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "additional_access_info.h"
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_create(
OpenAPI_access_type_e access_type,
OpenAPI_rat_type_e rat_type
)
{
OpenAPI_additional_access_info_t *additional_access_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_additional_access_info_t));
if (!additional_access_info_local_var) {
return NULL;
}
additional_access_info_local_var->access_type = access_type;
additional_access_info_local_var->rat_type = rat_type;
return additional_access_info_local_var;
}
void OpenAPI_additional_access_info_free(OpenAPI_additional_access_info_t *additional_access_info)
{
if (NULL == additional_access_info) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(additional_access_info);
}
cJSON *OpenAPI_additional_access_info_convertToJSON(OpenAPI_additional_access_info_t *additional_access_info)
{
cJSON *item = NULL;
if (additional_access_info == NULL) {
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [AdditionalAccessInfo]");
return NULL;
}
item = cJSON_CreateObject();
if (!additional_access_info->access_type) {
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [access_type]");
goto end;
}
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(additional_access_info->access_type)) == NULL) {
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [access_type]");
goto end;
}
if (additional_access_info->rat_type) {
if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(additional_access_info->rat_type)) == NULL) {
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed [rat_type]");
goto end;
}
}
end:
return item;
}
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_parseFromJSON(cJSON *additional_access_infoJSON)
{
OpenAPI_additional_access_info_t *additional_access_info_local_var = NULL;
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(additional_access_infoJSON, "accessType");
if (!access_type) {
ogs_error("OpenAPI_additional_access_info_parseFromJSON() failed [access_type]");
goto end;
}
OpenAPI_access_type_e access_typeVariable;
if (!cJSON_IsString(access_type)) {
ogs_error("OpenAPI_additional_access_info_parseFromJSON() failed [access_type]");
goto end;
}
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(additional_access_infoJSON, "ratType");
OpenAPI_rat_type_e rat_typeVariable;
if (rat_type) {
if (!cJSON_IsString(rat_type)) {
ogs_error("OpenAPI_additional_access_info_parseFromJSON() failed [rat_type]");
goto end;
}
rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring);
}
additional_access_info_local_var = OpenAPI_additional_access_info_create (
access_typeVariable,
rat_type ? rat_typeVariable : 0
);
return additional_access_info_local_var;
end:
return NULL;
}
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_copy(OpenAPI_additional_access_info_t *dst, OpenAPI_additional_access_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_additional_access_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_additional_access_info_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_additional_access_info_free(dst);
dst = OpenAPI_additional_access_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,42 @@
/*
* additional_access_info.h
*
*
*/
#ifndef _OpenAPI_additional_access_info_H_
#define _OpenAPI_additional_access_info_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "access_type.h"
#include "rat_type.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_additional_access_info_s OpenAPI_additional_access_info_t;
typedef struct OpenAPI_additional_access_info_s {
OpenAPI_access_type_e access_type;
OpenAPI_rat_type_e rat_type;
} OpenAPI_additional_access_info_t;
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_create(
OpenAPI_access_type_e access_type,
OpenAPI_rat_type_e rat_type
);
void OpenAPI_additional_access_info_free(OpenAPI_additional_access_info_t *additional_access_info);
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_parseFromJSON(cJSON *additional_access_infoJSON);
cJSON *OpenAPI_additional_access_info_convertToJSON(OpenAPI_additional_access_info_t *additional_access_info);
OpenAPI_additional_access_info_t *OpenAPI_additional_access_info_copy(OpenAPI_additional_access_info_t *dst, OpenAPI_additional_access_info_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_additional_access_info_H_ */

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_sig_protocol.h"
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
)
{
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_sig_protocol_t));
if (!af_sig_protocol_local_var) {
return NULL;
}
return af_sig_protocol_local_var;
}
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol)
{
if (NULL == af_sig_protocol) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(af_sig_protocol);
}
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol)
{
cJSON *item = NULL;
if (af_sig_protocol == NULL) {
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed [AfSigProtocol]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON)
{
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = NULL;
af_sig_protocol_local_var = OpenAPI_af_sig_protocol_create (
);
return af_sig_protocol_local_var;
end:
return NULL;
}
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_sig_protocol_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_af_sig_protocol_free(dst);
dst = OpenAPI_af_sig_protocol_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,37 @@
/*
* af_sig_protocol.h
*
* Possible values are - NO_INFORMATION: Indicate that no information about the AF signalling protocol is being provided. - SIP: Indicate that the signalling protocol is Session Initiation Protocol.
*/
#ifndef _OpenAPI_af_sig_protocol_H_
#define _OpenAPI_af_sig_protocol_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_sig_protocol_s OpenAPI_af_sig_protocol_t;
typedef struct OpenAPI_af_sig_protocol_s {
} OpenAPI_af_sig_protocol_t;
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
);
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol);
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON);
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol);
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_sig_protocol_H_ */

View File

@ -0,0 +1,125 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "an_gw_address.h"
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_create(
char *an_gw_ipv4_addr,
char *an_gw_ipv6_addr
)
{
OpenAPI_an_gw_address_t *an_gw_address_local_var = OpenAPI_malloc(sizeof(OpenAPI_an_gw_address_t));
if (!an_gw_address_local_var) {
return NULL;
}
an_gw_address_local_var->an_gw_ipv4_addr = an_gw_ipv4_addr;
an_gw_address_local_var->an_gw_ipv6_addr = an_gw_ipv6_addr;
return an_gw_address_local_var;
}
void OpenAPI_an_gw_address_free(OpenAPI_an_gw_address_t *an_gw_address)
{
if (NULL == an_gw_address) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(an_gw_address->an_gw_ipv4_addr);
ogs_free(an_gw_address->an_gw_ipv6_addr);
ogs_free(an_gw_address);
}
cJSON *OpenAPI_an_gw_address_convertToJSON(OpenAPI_an_gw_address_t *an_gw_address)
{
cJSON *item = NULL;
if (an_gw_address == NULL) {
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed [AnGwAddress]");
return NULL;
}
item = cJSON_CreateObject();
if (an_gw_address->an_gw_ipv4_addr) {
if (cJSON_AddStringToObject(item, "anGwIpv4Addr", an_gw_address->an_gw_ipv4_addr) == NULL) {
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed [an_gw_ipv4_addr]");
goto end;
}
}
if (an_gw_address->an_gw_ipv6_addr) {
if (cJSON_AddStringToObject(item, "anGwIpv6Addr", an_gw_address->an_gw_ipv6_addr) == NULL) {
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed [an_gw_ipv6_addr]");
goto end;
}
}
end:
return item;
}
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_parseFromJSON(cJSON *an_gw_addressJSON)
{
OpenAPI_an_gw_address_t *an_gw_address_local_var = NULL;
cJSON *an_gw_ipv4_addr = cJSON_GetObjectItemCaseSensitive(an_gw_addressJSON, "anGwIpv4Addr");
if (an_gw_ipv4_addr) {
if (!cJSON_IsString(an_gw_ipv4_addr)) {
ogs_error("OpenAPI_an_gw_address_parseFromJSON() failed [an_gw_ipv4_addr]");
goto end;
}
}
cJSON *an_gw_ipv6_addr = cJSON_GetObjectItemCaseSensitive(an_gw_addressJSON, "anGwIpv6Addr");
if (an_gw_ipv6_addr) {
if (!cJSON_IsString(an_gw_ipv6_addr)) {
ogs_error("OpenAPI_an_gw_address_parseFromJSON() failed [an_gw_ipv6_addr]");
goto end;
}
}
an_gw_address_local_var = OpenAPI_an_gw_address_create (
an_gw_ipv4_addr ? ogs_strdup(an_gw_ipv4_addr->valuestring) : NULL,
an_gw_ipv6_addr ? ogs_strdup(an_gw_ipv6_addr->valuestring) : NULL
);
return an_gw_address_local_var;
end:
return NULL;
}
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_copy(OpenAPI_an_gw_address_t *dst, OpenAPI_an_gw_address_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_an_gw_address_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_an_gw_address_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_an_gw_address_free(dst);
dst = OpenAPI_an_gw_address_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,40 @@
/*
* an_gw_address.h
*
* describes the address of the access network gateway control node
*/
#ifndef _OpenAPI_an_gw_address_H_
#define _OpenAPI_an_gw_address_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_an_gw_address_s OpenAPI_an_gw_address_t;
typedef struct OpenAPI_an_gw_address_s {
char *an_gw_ipv4_addr;
char *an_gw_ipv6_addr;
} OpenAPI_an_gw_address_t;
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_create(
char *an_gw_ipv4_addr,
char *an_gw_ipv6_addr
);
void OpenAPI_an_gw_address_free(OpenAPI_an_gw_address_t *an_gw_address);
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_parseFromJSON(cJSON *an_gw_addressJSON);
cJSON *OpenAPI_an_gw_address_convertToJSON(OpenAPI_an_gw_address_t *an_gw_address);
OpenAPI_an_gw_address_t *OpenAPI_an_gw_address_copy(OpenAPI_an_gw_address_t *dst, OpenAPI_an_gw_address_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_an_gw_address_H_ */

View File

@ -0,0 +1,180 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "app_detection_info.h"
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_create(
char *app_id,
char *instance_id,
OpenAPI_list_t *sdf_descriptions
)
{
OpenAPI_app_detection_info_t *app_detection_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_detection_info_t));
if (!app_detection_info_local_var) {
return NULL;
}
app_detection_info_local_var->app_id = app_id;
app_detection_info_local_var->instance_id = instance_id;
app_detection_info_local_var->sdf_descriptions = sdf_descriptions;
return app_detection_info_local_var;
}
void OpenAPI_app_detection_info_free(OpenAPI_app_detection_info_t *app_detection_info)
{
if (NULL == app_detection_info) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(app_detection_info->app_id);
ogs_free(app_detection_info->instance_id);
OpenAPI_list_for_each(app_detection_info->sdf_descriptions, node) {
OpenAPI_flow_information_free(node->data);
}
OpenAPI_list_free(app_detection_info->sdf_descriptions);
ogs_free(app_detection_info);
}
cJSON *OpenAPI_app_detection_info_convertToJSON(OpenAPI_app_detection_info_t *app_detection_info)
{
cJSON *item = NULL;
if (app_detection_info == NULL) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [AppDetectionInfo]");
return NULL;
}
item = cJSON_CreateObject();
if (!app_detection_info->app_id) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [app_id]");
goto end;
}
if (cJSON_AddStringToObject(item, "appId", app_detection_info->app_id) == NULL) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [app_id]");
goto end;
}
if (app_detection_info->instance_id) {
if (cJSON_AddStringToObject(item, "instanceId", app_detection_info->instance_id) == NULL) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [instance_id]");
goto end;
}
}
if (app_detection_info->sdf_descriptions) {
cJSON *sdf_descriptionsList = cJSON_AddArrayToObject(item, "sdfDescriptions");
if (sdf_descriptionsList == NULL) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [sdf_descriptions]");
goto end;
}
OpenAPI_lnode_t *sdf_descriptions_node;
if (app_detection_info->sdf_descriptions) {
OpenAPI_list_for_each(app_detection_info->sdf_descriptions, sdf_descriptions_node) {
cJSON *itemLocal = OpenAPI_flow_information_convertToJSON(sdf_descriptions_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed [sdf_descriptions]");
goto end;
}
cJSON_AddItemToArray(sdf_descriptionsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_parseFromJSON(cJSON *app_detection_infoJSON)
{
OpenAPI_app_detection_info_t *app_detection_info_local_var = NULL;
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(app_detection_infoJSON, "appId");
if (!app_id) {
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [app_id]");
goto end;
}
if (!cJSON_IsString(app_id)) {
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [app_id]");
goto end;
}
cJSON *instance_id = cJSON_GetObjectItemCaseSensitive(app_detection_infoJSON, "instanceId");
if (instance_id) {
if (!cJSON_IsString(instance_id)) {
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [instance_id]");
goto end;
}
}
cJSON *sdf_descriptions = cJSON_GetObjectItemCaseSensitive(app_detection_infoJSON, "sdfDescriptions");
OpenAPI_list_t *sdf_descriptionsList;
if (sdf_descriptions) {
cJSON *sdf_descriptions_local_nonprimitive;
if (!cJSON_IsArray(sdf_descriptions)) {
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [sdf_descriptions]");
goto end;
}
sdf_descriptionsList = OpenAPI_list_create();
cJSON_ArrayForEach(sdf_descriptions_local_nonprimitive, sdf_descriptions ) {
if (!cJSON_IsObject(sdf_descriptions_local_nonprimitive)) {
ogs_error("OpenAPI_app_detection_info_parseFromJSON() failed [sdf_descriptions]");
goto end;
}
OpenAPI_flow_information_t *sdf_descriptionsItem = OpenAPI_flow_information_parseFromJSON(sdf_descriptions_local_nonprimitive);
OpenAPI_list_add(sdf_descriptionsList, sdf_descriptionsItem);
}
}
app_detection_info_local_var = OpenAPI_app_detection_info_create (
ogs_strdup(app_id->valuestring),
instance_id ? ogs_strdup(instance_id->valuestring) : NULL,
sdf_descriptions ? sdf_descriptionsList : NULL
);
return app_detection_info_local_var;
end:
return NULL;
}
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_copy(OpenAPI_app_detection_info_t *dst, OpenAPI_app_detection_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_app_detection_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_app_detection_info_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_app_detection_info_free(dst);
dst = OpenAPI_app_detection_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,43 @@
/*
* app_detection_info.h
*
*
*/
#ifndef _OpenAPI_app_detection_info_H_
#define _OpenAPI_app_detection_info_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "flow_information.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_app_detection_info_s OpenAPI_app_detection_info_t;
typedef struct OpenAPI_app_detection_info_s {
char *app_id;
char *instance_id;
OpenAPI_list_t *sdf_descriptions;
} OpenAPI_app_detection_info_t;
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_create(
char *app_id,
char *instance_id,
OpenAPI_list_t *sdf_descriptions
);
void OpenAPI_app_detection_info_free(OpenAPI_app_detection_info_t *app_detection_info);
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_parseFromJSON(cJSON *app_detection_infoJSON);
cJSON *OpenAPI_app_detection_info_convertToJSON(OpenAPI_app_detection_info_t *app_detection_info);
OpenAPI_app_detection_info_t *OpenAPI_app_detection_info_copy(OpenAPI_app_detection_info_t *dst, OpenAPI_app_detection_info_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_app_detection_info_H_ */

View File

@ -0,0 +1,303 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "authorized_default_qos.h"
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_create(
int _5qi,
OpenAPI_arp_t *arp,
int priority_level,
int aver_window,
int max_data_burst_vol,
char *maxbr_ul,
char *maxbr_dl,
char *gbr_ul,
char *gbr_dl,
int qnc,
int ext_max_data_burst_vol
)
{
OpenAPI_authorized_default_qos_t *authorized_default_qos_local_var = OpenAPI_malloc(sizeof(OpenAPI_authorized_default_qos_t));
if (!authorized_default_qos_local_var) {
return NULL;
}
authorized_default_qos_local_var->_5qi = _5qi;
authorized_default_qos_local_var->arp = arp;
authorized_default_qos_local_var->priority_level = priority_level;
authorized_default_qos_local_var->aver_window = aver_window;
authorized_default_qos_local_var->max_data_burst_vol = max_data_burst_vol;
authorized_default_qos_local_var->maxbr_ul = maxbr_ul;
authorized_default_qos_local_var->maxbr_dl = maxbr_dl;
authorized_default_qos_local_var->gbr_ul = gbr_ul;
authorized_default_qos_local_var->gbr_dl = gbr_dl;
authorized_default_qos_local_var->qnc = qnc;
authorized_default_qos_local_var->ext_max_data_burst_vol = ext_max_data_burst_vol;
return authorized_default_qos_local_var;
}
void OpenAPI_authorized_default_qos_free(OpenAPI_authorized_default_qos_t *authorized_default_qos)
{
if (NULL == authorized_default_qos) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_arp_free(authorized_default_qos->arp);
ogs_free(authorized_default_qos->maxbr_ul);
ogs_free(authorized_default_qos->maxbr_dl);
ogs_free(authorized_default_qos->gbr_ul);
ogs_free(authorized_default_qos->gbr_dl);
ogs_free(authorized_default_qos);
}
cJSON *OpenAPI_authorized_default_qos_convertToJSON(OpenAPI_authorized_default_qos_t *authorized_default_qos)
{
cJSON *item = NULL;
if (authorized_default_qos == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [AuthorizedDefaultQos]");
return NULL;
}
item = cJSON_CreateObject();
if (authorized_default_qos->_5qi) {
if (cJSON_AddNumberToObject(item, "5qi", authorized_default_qos->_5qi) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [_5qi]");
goto end;
}
}
if (authorized_default_qos->arp) {
cJSON *arp_local_JSON = OpenAPI_arp_convertToJSON(authorized_default_qos->arp);
if (arp_local_JSON == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [arp]");
goto end;
}
cJSON_AddItemToObject(item, "arp", arp_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [arp]");
goto end;
}
}
if (authorized_default_qos->priority_level) {
if (cJSON_AddNumberToObject(item, "priorityLevel", authorized_default_qos->priority_level) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [priority_level]");
goto end;
}
}
if (authorized_default_qos->aver_window) {
if (cJSON_AddNumberToObject(item, "averWindow", authorized_default_qos->aver_window) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [aver_window]");
goto end;
}
}
if (authorized_default_qos->max_data_burst_vol) {
if (cJSON_AddNumberToObject(item, "maxDataBurstVol", authorized_default_qos->max_data_burst_vol) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [max_data_burst_vol]");
goto end;
}
}
if (authorized_default_qos->maxbr_ul) {
if (cJSON_AddStringToObject(item, "maxbrUl", authorized_default_qos->maxbr_ul) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [maxbr_ul]");
goto end;
}
}
if (authorized_default_qos->maxbr_dl) {
if (cJSON_AddStringToObject(item, "maxbrDl", authorized_default_qos->maxbr_dl) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [maxbr_dl]");
goto end;
}
}
if (authorized_default_qos->gbr_ul) {
if (cJSON_AddStringToObject(item, "gbrUl", authorized_default_qos->gbr_ul) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [gbr_ul]");
goto end;
}
}
if (authorized_default_qos->gbr_dl) {
if (cJSON_AddStringToObject(item, "gbrDl", authorized_default_qos->gbr_dl) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [gbr_dl]");
goto end;
}
}
if (authorized_default_qos->qnc) {
if (cJSON_AddBoolToObject(item, "qnc", authorized_default_qos->qnc) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [qnc]");
goto end;
}
}
if (authorized_default_qos->ext_max_data_burst_vol) {
if (cJSON_AddNumberToObject(item, "extMaxDataBurstVol", authorized_default_qos->ext_max_data_burst_vol) == NULL) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed [ext_max_data_burst_vol]");
goto end;
}
}
end:
return item;
}
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_parseFromJSON(cJSON *authorized_default_qosJSON)
{
OpenAPI_authorized_default_qos_t *authorized_default_qos_local_var = NULL;
cJSON *_5qi = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "5qi");
if (_5qi) {
if (!cJSON_IsNumber(_5qi)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [_5qi]");
goto end;
}
}
cJSON *arp = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "arp");
OpenAPI_arp_t *arp_local_nonprim = NULL;
if (arp) {
arp_local_nonprim = OpenAPI_arp_parseFromJSON(arp);
}
cJSON *priority_level = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "priorityLevel");
if (priority_level) {
if (!cJSON_IsNumber(priority_level)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [priority_level]");
goto end;
}
}
cJSON *aver_window = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "averWindow");
if (aver_window) {
if (!cJSON_IsNumber(aver_window)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [aver_window]");
goto end;
}
}
cJSON *max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "maxDataBurstVol");
if (max_data_burst_vol) {
if (!cJSON_IsNumber(max_data_burst_vol)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [max_data_burst_vol]");
goto end;
}
}
cJSON *maxbr_ul = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "maxbrUl");
if (maxbr_ul) {
if (!cJSON_IsString(maxbr_ul)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [maxbr_ul]");
goto end;
}
}
cJSON *maxbr_dl = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "maxbrDl");
if (maxbr_dl) {
if (!cJSON_IsString(maxbr_dl)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [maxbr_dl]");
goto end;
}
}
cJSON *gbr_ul = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "gbrUl");
if (gbr_ul) {
if (!cJSON_IsString(gbr_ul)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [gbr_ul]");
goto end;
}
}
cJSON *gbr_dl = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "gbrDl");
if (gbr_dl) {
if (!cJSON_IsString(gbr_dl)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [gbr_dl]");
goto end;
}
}
cJSON *qnc = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "qnc");
if (qnc) {
if (!cJSON_IsBool(qnc)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [qnc]");
goto end;
}
}
cJSON *ext_max_data_burst_vol = cJSON_GetObjectItemCaseSensitive(authorized_default_qosJSON, "extMaxDataBurstVol");
if (ext_max_data_burst_vol) {
if (!cJSON_IsNumber(ext_max_data_burst_vol)) {
ogs_error("OpenAPI_authorized_default_qos_parseFromJSON() failed [ext_max_data_burst_vol]");
goto end;
}
}
authorized_default_qos_local_var = OpenAPI_authorized_default_qos_create (
_5qi ? _5qi->valuedouble : 0,
arp ? arp_local_nonprim : NULL,
priority_level ? priority_level->valuedouble : 0,
aver_window ? aver_window->valuedouble : 0,
max_data_burst_vol ? max_data_burst_vol->valuedouble : 0,
maxbr_ul ? ogs_strdup(maxbr_ul->valuestring) : NULL,
maxbr_dl ? ogs_strdup(maxbr_dl->valuestring) : NULL,
gbr_ul ? ogs_strdup(gbr_ul->valuestring) : NULL,
gbr_dl ? ogs_strdup(gbr_dl->valuestring) : NULL,
qnc ? qnc->valueint : 0,
ext_max_data_burst_vol ? ext_max_data_burst_vol->valuedouble : 0
);
return authorized_default_qos_local_var;
end:
return NULL;
}
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_copy(OpenAPI_authorized_default_qos_t *dst, OpenAPI_authorized_default_qos_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_authorized_default_qos_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_authorized_default_qos_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_authorized_default_qos_free(dst);
dst = OpenAPI_authorized_default_qos_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,59 @@
/*
* authorized_default_qos.h
*
*
*/
#ifndef _OpenAPI_authorized_default_qos_H_
#define _OpenAPI_authorized_default_qos_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "arp.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_authorized_default_qos_s OpenAPI_authorized_default_qos_t;
typedef struct OpenAPI_authorized_default_qos_s {
int _5qi;
struct OpenAPI_arp_s *arp;
int priority_level;
int aver_window;
int max_data_burst_vol;
char *maxbr_ul;
char *maxbr_dl;
char *gbr_ul;
char *gbr_dl;
int qnc;
int ext_max_data_burst_vol;
} OpenAPI_authorized_default_qos_t;
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_create(
int _5qi,
OpenAPI_arp_t *arp,
int priority_level,
int aver_window,
int max_data_burst_vol,
char *maxbr_ul,
char *maxbr_dl,
char *gbr_ul,
char *gbr_dl,
int qnc,
int ext_max_data_burst_vol
);
void OpenAPI_authorized_default_qos_free(OpenAPI_authorized_default_qos_t *authorized_default_qos);
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_parseFromJSON(cJSON *authorized_default_qosJSON);
cJSON *OpenAPI_authorized_default_qos_convertToJSON(OpenAPI_authorized_default_qos_t *authorized_default_qos);
OpenAPI_authorized_default_qos_t *OpenAPI_authorized_default_qos_copy(OpenAPI_authorized_default_qos_t *dst, OpenAPI_authorized_default_qos_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_authorized_default_qos_H_ */

View File

@ -0,0 +1,157 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "candidate_for_replacement.h"
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_create(
OpenAPI_snssai_t *snssai,
OpenAPI_list_t *dnns
)
{
OpenAPI_candidate_for_replacement_t *candidate_for_replacement_local_var = OpenAPI_malloc(sizeof(OpenAPI_candidate_for_replacement_t));
if (!candidate_for_replacement_local_var) {
return NULL;
}
candidate_for_replacement_local_var->snssai = snssai;
candidate_for_replacement_local_var->dnns = dnns;
return candidate_for_replacement_local_var;
}
void OpenAPI_candidate_for_replacement_free(OpenAPI_candidate_for_replacement_t *candidate_for_replacement)
{
if (NULL == candidate_for_replacement) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_snssai_free(candidate_for_replacement->snssai);
OpenAPI_list_for_each(candidate_for_replacement->dnns, node) {
ogs_free(node->data);
}
OpenAPI_list_free(candidate_for_replacement->dnns);
ogs_free(candidate_for_replacement);
}
cJSON *OpenAPI_candidate_for_replacement_convertToJSON(OpenAPI_candidate_for_replacement_t *candidate_for_replacement)
{
cJSON *item = NULL;
if (candidate_for_replacement == NULL) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [CandidateForReplacement]");
return NULL;
}
item = cJSON_CreateObject();
if (!candidate_for_replacement->snssai) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [snssai]");
goto end;
}
cJSON *snssai_local_JSON = OpenAPI_snssai_convertToJSON(candidate_for_replacement->snssai);
if (snssai_local_JSON == NULL) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [snssai]");
goto end;
}
cJSON_AddItemToObject(item, "snssai", snssai_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [snssai]");
goto end;
}
if (candidate_for_replacement->dnns) {
cJSON *dnns = cJSON_AddArrayToObject(item, "dnns");
if (dnns == NULL) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [dnns]");
goto end;
}
OpenAPI_lnode_t *dnns_node;
OpenAPI_list_for_each(candidate_for_replacement->dnns, dnns_node) {
if (cJSON_AddStringToObject(dnns, "", (char*)dnns_node->data) == NULL) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed [dnns]");
goto end;
}
}
}
end:
return item;
}
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_parseFromJSON(cJSON *candidate_for_replacementJSON)
{
OpenAPI_candidate_for_replacement_t *candidate_for_replacement_local_var = NULL;
cJSON *snssai = cJSON_GetObjectItemCaseSensitive(candidate_for_replacementJSON, "snssai");
if (!snssai) {
ogs_error("OpenAPI_candidate_for_replacement_parseFromJSON() failed [snssai]");
goto end;
}
OpenAPI_snssai_t *snssai_local_nonprim = NULL;
snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(snssai);
cJSON *dnns = cJSON_GetObjectItemCaseSensitive(candidate_for_replacementJSON, "dnns");
OpenAPI_list_t *dnnsList;
if (dnns) {
cJSON *dnns_local;
if (!cJSON_IsArray(dnns)) {
ogs_error("OpenAPI_candidate_for_replacement_parseFromJSON() failed [dnns]");
goto end;
}
dnnsList = OpenAPI_list_create();
cJSON_ArrayForEach(dnns_local, dnns) {
if (!cJSON_IsString(dnns_local)) {
ogs_error("OpenAPI_candidate_for_replacement_parseFromJSON() failed [dnns]");
goto end;
}
OpenAPI_list_add(dnnsList, ogs_strdup(dnns_local->valuestring));
}
}
candidate_for_replacement_local_var = OpenAPI_candidate_for_replacement_create (
snssai_local_nonprim,
dnns ? dnnsList : NULL
);
return candidate_for_replacement_local_var;
end:
return NULL;
}
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_copy(OpenAPI_candidate_for_replacement_t *dst, OpenAPI_candidate_for_replacement_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_candidate_for_replacement_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_candidate_for_replacement_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_candidate_for_replacement_free(dst);
dst = OpenAPI_candidate_for_replacement_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,41 @@
/*
* candidate_for_replacement.h
*
*
*/
#ifndef _OpenAPI_candidate_for_replacement_H_
#define _OpenAPI_candidate_for_replacement_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "snssai.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_candidate_for_replacement_s OpenAPI_candidate_for_replacement_t;
typedef struct OpenAPI_candidate_for_replacement_s {
struct OpenAPI_snssai_s *snssai;
OpenAPI_list_t *dnns;
} OpenAPI_candidate_for_replacement_t;
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_create(
OpenAPI_snssai_t *snssai,
OpenAPI_list_t *dnns
);
void OpenAPI_candidate_for_replacement_free(OpenAPI_candidate_for_replacement_t *candidate_for_replacement);
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_parseFromJSON(cJSON *candidate_for_replacementJSON);
cJSON *OpenAPI_candidate_for_replacement_convertToJSON(OpenAPI_candidate_for_replacement_t *candidate_for_replacement);
OpenAPI_candidate_for_replacement_t *OpenAPI_candidate_for_replacement_copy(OpenAPI_candidate_for_replacement_t *dst, OpenAPI_candidate_for_replacement_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_candidate_for_replacement_H_ */

View File

@ -0,0 +1,332 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "charging_data.h"
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
char *chg_id,
OpenAPI_metering_method_t *metering_method,
int offline,
int online,
int sdf_handl,
int rating_group,
OpenAPI_reporting_level_t *reporting_level,
int service_id,
char *sponsor_id,
char *app_svc_prov_id,
int af_charging_identifier,
char *af_charg_id
)
{
OpenAPI_charging_data_t *charging_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_charging_data_t));
if (!charging_data_local_var) {
return NULL;
}
charging_data_local_var->chg_id = chg_id;
charging_data_local_var->metering_method = metering_method;
charging_data_local_var->offline = offline;
charging_data_local_var->online = online;
charging_data_local_var->sdf_handl = sdf_handl;
charging_data_local_var->rating_group = rating_group;
charging_data_local_var->reporting_level = reporting_level;
charging_data_local_var->service_id = service_id;
charging_data_local_var->sponsor_id = sponsor_id;
charging_data_local_var->app_svc_prov_id = app_svc_prov_id;
charging_data_local_var->af_charging_identifier = af_charging_identifier;
charging_data_local_var->af_charg_id = af_charg_id;
return charging_data_local_var;
}
void OpenAPI_charging_data_free(OpenAPI_charging_data_t *charging_data)
{
if (NULL == charging_data) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(charging_data->chg_id);
OpenAPI_metering_method_free(charging_data->metering_method);
OpenAPI_reporting_level_free(charging_data->reporting_level);
ogs_free(charging_data->sponsor_id);
ogs_free(charging_data->app_svc_prov_id);
ogs_free(charging_data->af_charg_id);
ogs_free(charging_data);
}
cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_data)
{
cJSON *item = NULL;
if (charging_data == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [ChargingData]");
return NULL;
}
item = cJSON_CreateObject();
if (!charging_data->chg_id) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [chg_id]");
goto end;
}
if (cJSON_AddStringToObject(item, "chgId", charging_data->chg_id) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [chg_id]");
goto end;
}
if (charging_data->metering_method) {
cJSON *metering_method_local_JSON = OpenAPI_metering_method_convertToJSON(charging_data->metering_method);
if (metering_method_local_JSON == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
goto end;
}
cJSON_AddItemToObject(item, "meteringMethod", metering_method_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
goto end;
}
}
if (charging_data->offline) {
if (cJSON_AddBoolToObject(item, "offline", charging_data->offline) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [offline]");
goto end;
}
}
if (charging_data->online) {
if (cJSON_AddBoolToObject(item, "online", charging_data->online) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [online]");
goto end;
}
}
if (charging_data->sdf_handl) {
if (cJSON_AddBoolToObject(item, "sdfHandl", charging_data->sdf_handl) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [sdf_handl]");
goto end;
}
}
if (charging_data->rating_group) {
if (cJSON_AddNumberToObject(item, "ratingGroup", charging_data->rating_group) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [rating_group]");
goto end;
}
}
if (charging_data->reporting_level) {
cJSON *reporting_level_local_JSON = OpenAPI_reporting_level_convertToJSON(charging_data->reporting_level);
if (reporting_level_local_JSON == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
goto end;
}
cJSON_AddItemToObject(item, "reportingLevel", reporting_level_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
goto end;
}
}
if (charging_data->service_id) {
if (cJSON_AddNumberToObject(item, "serviceId", charging_data->service_id) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [service_id]");
goto end;
}
}
if (charging_data->sponsor_id) {
if (cJSON_AddStringToObject(item, "sponsorId", charging_data->sponsor_id) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [sponsor_id]");
goto end;
}
}
if (charging_data->app_svc_prov_id) {
if (cJSON_AddStringToObject(item, "appSvcProvId", charging_data->app_svc_prov_id) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [app_svc_prov_id]");
goto end;
}
}
if (charging_data->af_charging_identifier) {
if (cJSON_AddNumberToObject(item, "afChargingIdentifier", charging_data->af_charging_identifier) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [af_charging_identifier]");
goto end;
}
}
if (charging_data->af_charg_id) {
if (cJSON_AddStringToObject(item, "afChargId", charging_data->af_charg_id) == NULL) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed [af_charg_id]");
goto end;
}
}
end:
return item;
}
OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dataJSON)
{
OpenAPI_charging_data_t *charging_data_local_var = NULL;
cJSON *chg_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "chgId");
if (!chg_id) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [chg_id]");
goto end;
}
if (!cJSON_IsString(chg_id)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [chg_id]");
goto end;
}
cJSON *metering_method = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "meteringMethod");
OpenAPI_metering_method_t *metering_method_local_nonprim = NULL;
if (metering_method) {
metering_method_local_nonprim = OpenAPI_metering_method_parseFromJSON(metering_method);
}
cJSON *offline = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "offline");
if (offline) {
if (!cJSON_IsBool(offline)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [offline]");
goto end;
}
}
cJSON *online = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "online");
if (online) {
if (!cJSON_IsBool(online)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [online]");
goto end;
}
}
cJSON *sdf_handl = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "sdfHandl");
if (sdf_handl) {
if (!cJSON_IsBool(sdf_handl)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [sdf_handl]");
goto end;
}
}
cJSON *rating_group = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "ratingGroup");
if (rating_group) {
if (!cJSON_IsNumber(rating_group)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [rating_group]");
goto end;
}
}
cJSON *reporting_level = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "reportingLevel");
OpenAPI_reporting_level_t *reporting_level_local_nonprim = NULL;
if (reporting_level) {
reporting_level_local_nonprim = OpenAPI_reporting_level_parseFromJSON(reporting_level);
}
cJSON *service_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "serviceId");
if (service_id) {
if (!cJSON_IsNumber(service_id)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [service_id]");
goto end;
}
}
cJSON *sponsor_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "sponsorId");
if (sponsor_id) {
if (!cJSON_IsString(sponsor_id)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [sponsor_id]");
goto end;
}
}
cJSON *app_svc_prov_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "appSvcProvId");
if (app_svc_prov_id) {
if (!cJSON_IsString(app_svc_prov_id)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [app_svc_prov_id]");
goto end;
}
}
cJSON *af_charging_identifier = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "afChargingIdentifier");
if (af_charging_identifier) {
if (!cJSON_IsNumber(af_charging_identifier)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [af_charging_identifier]");
goto end;
}
}
cJSON *af_charg_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "afChargId");
if (af_charg_id) {
if (!cJSON_IsString(af_charg_id)) {
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [af_charg_id]");
goto end;
}
}
charging_data_local_var = OpenAPI_charging_data_create (
ogs_strdup(chg_id->valuestring),
metering_method ? metering_method_local_nonprim : NULL,
offline ? offline->valueint : 0,
online ? online->valueint : 0,
sdf_handl ? sdf_handl->valueint : 0,
rating_group ? rating_group->valuedouble : 0,
reporting_level ? reporting_level_local_nonprim : NULL,
service_id ? service_id->valuedouble : 0,
sponsor_id ? ogs_strdup(sponsor_id->valuestring) : NULL,
app_svc_prov_id ? ogs_strdup(app_svc_prov_id->valuestring) : NULL,
af_charging_identifier ? af_charging_identifier->valuedouble : 0,
af_charg_id ? ogs_strdup(af_charg_id->valuestring) : NULL
);
return charging_data_local_var;
end:
return NULL;
}
OpenAPI_charging_data_t *OpenAPI_charging_data_copy(OpenAPI_charging_data_t *dst, OpenAPI_charging_data_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_charging_data_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_charging_data_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_charging_data_free(dst);
dst = OpenAPI_charging_data_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,62 @@
/*
* charging_data.h
*
*
*/
#ifndef _OpenAPI_charging_data_H_
#define _OpenAPI_charging_data_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "metering_method.h"
#include "reporting_level.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_charging_data_s OpenAPI_charging_data_t;
typedef struct OpenAPI_charging_data_s {
char *chg_id;
struct OpenAPI_metering_method_s *metering_method;
int offline;
int online;
int sdf_handl;
int rating_group;
struct OpenAPI_reporting_level_s *reporting_level;
int service_id;
char *sponsor_id;
char *app_svc_prov_id;
int af_charging_identifier;
char *af_charg_id;
} OpenAPI_charging_data_t;
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
char *chg_id,
OpenAPI_metering_method_t *metering_method,
int offline,
int online,
int sdf_handl,
int rating_group,
OpenAPI_reporting_level_t *reporting_level,
int service_id,
char *sponsor_id,
char *app_svc_prov_id,
int af_charging_identifier,
char *af_charg_id
);
void OpenAPI_charging_data_free(OpenAPI_charging_data_t *charging_data);
OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dataJSON);
cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_data);
OpenAPI_charging_data_t *OpenAPI_charging_data_copy(OpenAPI_charging_data_t *dst, OpenAPI_charging_data_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_charging_data_H_ */

View File

@ -5,12 +5,12 @@
#include "cn_assisted_ran_para.h"
OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_create(
OpenAPI_stationary_indication_t *stationary_indication,
OpenAPI_stationary_indication_e stationary_indication,
int communication_duration_time,
int periodic_time,
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
OpenAPI_traffic_profile_t *traffic_profile,
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
OpenAPI_traffic_profile_e traffic_profile,
OpenAPI_battery_indication_t *battery_indication
)
{
@ -35,10 +35,7 @@ void OpenAPI_cn_assisted_ran_para_free(OpenAPI_cn_assisted_ran_para_t *cn_assist
return;
}
OpenAPI_lnode_t *node;
OpenAPI_stationary_indication_free(cn_assisted_ran_para->stationary_indication);
OpenAPI_scheduled_communication_time_free(cn_assisted_ran_para->scheduled_communication_time);
OpenAPI_scheduled_communication_type_free(cn_assisted_ran_para->scheduled_communication_type);
OpenAPI_traffic_profile_free(cn_assisted_ran_para->traffic_profile);
OpenAPI_battery_indication_free(cn_assisted_ran_para->battery_indication);
ogs_free(cn_assisted_ran_para);
}
@ -54,13 +51,7 @@ cJSON *OpenAPI_cn_assisted_ran_para_convertToJSON(OpenAPI_cn_assisted_ran_para_t
item = cJSON_CreateObject();
if (cn_assisted_ran_para->stationary_indication) {
cJSON *stationary_indication_local_JSON = OpenAPI_stationary_indication_convertToJSON(cn_assisted_ran_para->stationary_indication);
if (stationary_indication_local_JSON == NULL) {
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [stationary_indication]");
goto end;
}
cJSON_AddItemToObject(item, "stationaryIndication", stationary_indication_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "stationaryIndication", OpenAPI_stationary_indication_ToString(cn_assisted_ran_para->stationary_indication)) == NULL) {
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [stationary_indication]");
goto end;
}
@ -94,26 +85,14 @@ cJSON *OpenAPI_cn_assisted_ran_para_convertToJSON(OpenAPI_cn_assisted_ran_para_t
}
if (cn_assisted_ran_para->scheduled_communication_type) {
cJSON *scheduled_communication_type_local_JSON = OpenAPI_scheduled_communication_type_convertToJSON(cn_assisted_ran_para->scheduled_communication_type);
if (scheduled_communication_type_local_JSON == NULL) {
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_type]");
goto end;
}
cJSON_AddItemToObject(item, "scheduledCommunicationType", scheduled_communication_type_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "scheduledCommunicationType", OpenAPI_scheduled_communication_type_ToString(cn_assisted_ran_para->scheduled_communication_type)) == NULL) {
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [scheduled_communication_type]");
goto end;
}
}
if (cn_assisted_ran_para->traffic_profile) {
cJSON *traffic_profile_local_JSON = OpenAPI_traffic_profile_convertToJSON(cn_assisted_ran_para->traffic_profile);
if (traffic_profile_local_JSON == NULL) {
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [traffic_profile]");
goto end;
}
cJSON_AddItemToObject(item, "trafficProfile", traffic_profile_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "trafficProfile", OpenAPI_traffic_profile_ToString(cn_assisted_ran_para->traffic_profile)) == NULL) {
ogs_error("OpenAPI_cn_assisted_ran_para_convertToJSON() failed [traffic_profile]");
goto end;
}
@ -141,9 +120,13 @@ OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON
OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para_local_var = NULL;
cJSON *stationary_indication = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "stationaryIndication");
OpenAPI_stationary_indication_t *stationary_indication_local_nonprim = NULL;
OpenAPI_stationary_indication_e stationary_indicationVariable;
if (stationary_indication) {
stationary_indication_local_nonprim = OpenAPI_stationary_indication_parseFromJSON(stationary_indication);
if (!cJSON_IsString(stationary_indication)) {
ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [stationary_indication]");
goto end;
}
stationary_indicationVariable = OpenAPI_stationary_indication_FromString(stationary_indication->valuestring);
}
cJSON *communication_duration_time = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "communicationDurationTime");
@ -173,16 +156,24 @@ OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON
cJSON *scheduled_communication_type = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "scheduledCommunicationType");
OpenAPI_scheduled_communication_type_t *scheduled_communication_type_local_nonprim = NULL;
OpenAPI_scheduled_communication_type_e scheduled_communication_typeVariable;
if (scheduled_communication_type) {
scheduled_communication_type_local_nonprim = OpenAPI_scheduled_communication_type_parseFromJSON(scheduled_communication_type);
if (!cJSON_IsString(scheduled_communication_type)) {
ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [scheduled_communication_type]");
goto end;
}
scheduled_communication_typeVariable = OpenAPI_scheduled_communication_type_FromString(scheduled_communication_type->valuestring);
}
cJSON *traffic_profile = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "trafficProfile");
OpenAPI_traffic_profile_t *traffic_profile_local_nonprim = NULL;
OpenAPI_traffic_profile_e traffic_profileVariable;
if (traffic_profile) {
traffic_profile_local_nonprim = OpenAPI_traffic_profile_parseFromJSON(traffic_profile);
if (!cJSON_IsString(traffic_profile)) {
ogs_error("OpenAPI_cn_assisted_ran_para_parseFromJSON() failed [traffic_profile]");
goto end;
}
traffic_profileVariable = OpenAPI_traffic_profile_FromString(traffic_profile->valuestring);
}
cJSON *battery_indication = cJSON_GetObjectItemCaseSensitive(cn_assisted_ran_paraJSON, "batteryIndication");
@ -193,12 +184,12 @@ OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_parseFromJSON(cJSON
}
cn_assisted_ran_para_local_var = OpenAPI_cn_assisted_ran_para_create (
stationary_indication ? stationary_indication_local_nonprim : NULL,
stationary_indication ? stationary_indicationVariable : 0,
communication_duration_time ? communication_duration_time->valuedouble : 0,
periodic_time ? periodic_time->valuedouble : 0,
scheduled_communication_time ? scheduled_communication_time_local_nonprim : NULL,
scheduled_communication_type ? scheduled_communication_type_local_nonprim : NULL,
traffic_profile ? traffic_profile_local_nonprim : NULL,
scheduled_communication_type ? scheduled_communication_typeVariable : 0,
traffic_profile ? traffic_profileVariable : 0,
battery_indication ? battery_indication_local_nonprim : NULL
);

View File

@ -24,22 +24,22 @@ extern "C" {
typedef struct OpenAPI_cn_assisted_ran_para_s OpenAPI_cn_assisted_ran_para_t;
typedef struct OpenAPI_cn_assisted_ran_para_s {
struct OpenAPI_stationary_indication_s *stationary_indication;
OpenAPI_stationary_indication_e stationary_indication;
int communication_duration_time;
int periodic_time;
struct OpenAPI_scheduled_communication_time_s *scheduled_communication_time;
struct OpenAPI_scheduled_communication_type_s *scheduled_communication_type;
struct OpenAPI_traffic_profile_s *traffic_profile;
OpenAPI_scheduled_communication_type_e scheduled_communication_type;
OpenAPI_traffic_profile_e traffic_profile;
struct OpenAPI_battery_indication_s *battery_indication;
} OpenAPI_cn_assisted_ran_para_t;
OpenAPI_cn_assisted_ran_para_t *OpenAPI_cn_assisted_ran_para_create(
OpenAPI_stationary_indication_t *stationary_indication,
OpenAPI_stationary_indication_e stationary_indication,
int communication_duration_time,
int periodic_time,
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
OpenAPI_traffic_profile_t *traffic_profile,
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
OpenAPI_traffic_profile_e traffic_profile,
OpenAPI_battery_indication_t *battery_indication
);
void OpenAPI_cn_assisted_ran_para_free(OpenAPI_cn_assisted_ran_para_t *cn_assisted_ran_para);

View File

@ -0,0 +1,192 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "condition_data.h"
OpenAPI_condition_data_t *OpenAPI_condition_data_create(
char *cond_id,
char *activation_time,
char *deactivation_time,
OpenAPI_access_type_e access_type,
OpenAPI_rat_type_e rat_type
)
{
OpenAPI_condition_data_t *condition_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_condition_data_t));
if (!condition_data_local_var) {
return NULL;
}
condition_data_local_var->cond_id = cond_id;
condition_data_local_var->activation_time = activation_time;
condition_data_local_var->deactivation_time = deactivation_time;
condition_data_local_var->access_type = access_type;
condition_data_local_var->rat_type = rat_type;
return condition_data_local_var;
}
void OpenAPI_condition_data_free(OpenAPI_condition_data_t *condition_data)
{
if (NULL == condition_data) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(condition_data->cond_id);
ogs_free(condition_data->activation_time);
ogs_free(condition_data->deactivation_time);
ogs_free(condition_data);
}
cJSON *OpenAPI_condition_data_convertToJSON(OpenAPI_condition_data_t *condition_data)
{
cJSON *item = NULL;
if (condition_data == NULL) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [ConditionData]");
return NULL;
}
item = cJSON_CreateObject();
if (!condition_data->cond_id) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [cond_id]");
goto end;
}
if (cJSON_AddStringToObject(item, "condId", condition_data->cond_id) == NULL) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [cond_id]");
goto end;
}
if (condition_data->activation_time) {
if (cJSON_AddStringToObject(item, "activationTime", condition_data->activation_time) == NULL) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [activation_time]");
goto end;
}
}
if (condition_data->deactivation_time) {
if (cJSON_AddStringToObject(item, "deactivationTime", condition_data->deactivation_time) == NULL) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [deactivation_time]");
goto end;
}
}
if (condition_data->access_type) {
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(condition_data->access_type)) == NULL) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [access_type]");
goto end;
}
}
if (condition_data->rat_type) {
if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(condition_data->rat_type)) == NULL) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed [rat_type]");
goto end;
}
}
end:
return item;
}
OpenAPI_condition_data_t *OpenAPI_condition_data_parseFromJSON(cJSON *condition_dataJSON)
{
OpenAPI_condition_data_t *condition_data_local_var = NULL;
cJSON *cond_id = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "condId");
if (!cond_id) {
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [cond_id]");
goto end;
}
if (!cJSON_IsString(cond_id)) {
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [cond_id]");
goto end;
}
cJSON *activation_time = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "activationTime");
if (activation_time) {
if (!cJSON_IsString(activation_time)) {
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [activation_time]");
goto end;
}
}
cJSON *deactivation_time = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "deactivationTime");
if (deactivation_time) {
if (!cJSON_IsString(deactivation_time)) {
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [deactivation_time]");
goto end;
}
}
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "accessType");
OpenAPI_access_type_e access_typeVariable;
if (access_type) {
if (!cJSON_IsString(access_type)) {
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [access_type]");
goto end;
}
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
}
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(condition_dataJSON, "ratType");
OpenAPI_rat_type_e rat_typeVariable;
if (rat_type) {
if (!cJSON_IsString(rat_type)) {
ogs_error("OpenAPI_condition_data_parseFromJSON() failed [rat_type]");
goto end;
}
rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring);
}
condition_data_local_var = OpenAPI_condition_data_create (
ogs_strdup(cond_id->valuestring),
activation_time ? ogs_strdup(activation_time->valuestring) : NULL,
deactivation_time ? ogs_strdup(deactivation_time->valuestring) : NULL,
access_type ? access_typeVariable : 0,
rat_type ? rat_typeVariable : 0
);
return condition_data_local_var;
end:
return NULL;
}
OpenAPI_condition_data_t *OpenAPI_condition_data_copy(OpenAPI_condition_data_t *dst, OpenAPI_condition_data_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_condition_data_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_condition_data_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_condition_data_free(dst);
dst = OpenAPI_condition_data_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,48 @@
/*
* condition_data.h
*
*
*/
#ifndef _OpenAPI_condition_data_H_
#define _OpenAPI_condition_data_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "access_type.h"
#include "rat_type.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_condition_data_s OpenAPI_condition_data_t;
typedef struct OpenAPI_condition_data_s {
char *cond_id;
char *activation_time;
char *deactivation_time;
OpenAPI_access_type_e access_type;
OpenAPI_rat_type_e rat_type;
} OpenAPI_condition_data_t;
OpenAPI_condition_data_t *OpenAPI_condition_data_create(
char *cond_id,
char *activation_time,
char *deactivation_time,
OpenAPI_access_type_e access_type,
OpenAPI_rat_type_e rat_type
);
void OpenAPI_condition_data_free(OpenAPI_condition_data_t *condition_data);
OpenAPI_condition_data_t *OpenAPI_condition_data_parseFromJSON(cJSON *condition_dataJSON);
cJSON *OpenAPI_condition_data_convertToJSON(OpenAPI_condition_data_t *condition_data);
OpenAPI_condition_data_t *OpenAPI_condition_data_copy(OpenAPI_condition_data_t *dst, OpenAPI_condition_data_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_condition_data_H_ */

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "core_network_type.h"
OpenAPI_core_network_type_t *OpenAPI_core_network_type_create(
)
char* OpenAPI_core_network_type_ToString(OpenAPI_core_network_type_e core_network_type)
{
OpenAPI_core_network_type_t *core_network_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_core_network_type_t));
if (!core_network_type_local_var) {
return NULL;
}
return core_network_type_local_var;
const char *core_network_typeArray[] = { "NULL", "_5GC", "EPC" };
size_t sizeofArray = sizeof(core_network_typeArray) / sizeof(core_network_typeArray[0]);
if (core_network_type < sizeofArray)
return (char *)core_network_typeArray[core_network_type];
else
return (char *)"Unknown";
}
void OpenAPI_core_network_type_free(OpenAPI_core_network_type_t *core_network_type)
OpenAPI_core_network_type_e OpenAPI_core_network_type_FromString(char* core_network_type)
{
if (NULL == core_network_type) {
return;
int stringToReturn = 0;
const char *core_network_typeArray[] = { "NULL", "_5GC", "EPC" };
size_t sizeofArray = sizeof(core_network_typeArray) / sizeof(core_network_typeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(core_network_type, core_network_typeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(core_network_type);
}
cJSON *OpenAPI_core_network_type_convertToJSON(OpenAPI_core_network_type_t *core_network_type)
{
cJSON *item = NULL;
if (core_network_type == NULL) {
ogs_error("OpenAPI_core_network_type_convertToJSON() failed [CoreNetworkType]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_core_network_type_t *OpenAPI_core_network_type_parseFromJSON(cJSON *core_network_typeJSON)
{
OpenAPI_core_network_type_t *core_network_type_local_var = NULL;
core_network_type_local_var = OpenAPI_core_network_type_create (
);
return core_network_type_local_var;
end:
return NULL;
}
OpenAPI_core_network_type_t *OpenAPI_core_network_type_copy(OpenAPI_core_network_type_t *dst, OpenAPI_core_network_type_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_core_network_type_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_core_network_type_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_core_network_type_free(dst);
dst = OpenAPI_core_network_type_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_core_network_type_s OpenAPI_core_network_type_t;
typedef struct OpenAPI_core_network_type_s {
} OpenAPI_core_network_type_t;
typedef enum { OpenAPI_core_network_type_NULL = 0, OpenAPI_core_network_type__5GC, OpenAPI_core_network_type_EPC } OpenAPI_core_network_type_e;
OpenAPI_core_network_type_t *OpenAPI_core_network_type_create(
);
void OpenAPI_core_network_type_free(OpenAPI_core_network_type_t *core_network_type);
OpenAPI_core_network_type_t *OpenAPI_core_network_type_parseFromJSON(cJSON *core_network_typeJSON);
cJSON *OpenAPI_core_network_type_convertToJSON(OpenAPI_core_network_type_t *core_network_type);
OpenAPI_core_network_type_t *OpenAPI_core_network_type_copy(OpenAPI_core_network_type_t *dst, OpenAPI_core_network_type_t *src);
char* OpenAPI_core_network_type_ToString(OpenAPI_core_network_type_e core_network_type);
OpenAPI_core_network_type_e OpenAPI_core_network_type_FromString(char* core_network_type);
#ifdef __cplusplus
}

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "credit_management_status.h"
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
)
{
OpenAPI_credit_management_status_t *credit_management_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_credit_management_status_t));
if (!credit_management_status_local_var) {
return NULL;
}
return credit_management_status_local_var;
}
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status)
{
if (NULL == credit_management_status) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(credit_management_status);
}
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status)
{
cJSON *item = NULL;
if (credit_management_status == NULL) {
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed [CreditManagementStatus]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON)
{
OpenAPI_credit_management_status_t *credit_management_status_local_var = NULL;
credit_management_status_local_var = OpenAPI_credit_management_status_create (
);
return credit_management_status_local_var;
end:
return NULL;
}
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_credit_management_status_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_credit_management_status_free(dst);
dst = OpenAPI_credit_management_status_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* credit_management_status.h
*
*
*/
#ifndef _OpenAPI_credit_management_status_H_
#define _OpenAPI_credit_management_status_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_credit_management_status_s OpenAPI_credit_management_status_t;
typedef struct OpenAPI_credit_management_status_s {
} OpenAPI_credit_management_status_t;
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
);
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status);
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON);
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status);
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_credit_management_status_H_ */

View File

@ -0,0 +1,209 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "error_report.h"
OpenAPI_error_report_t *OpenAPI_error_report_create(
OpenAPI_problem_details_t *error,
OpenAPI_list_t *rule_reports,
OpenAPI_list_t *sess_rule_reports
)
{
OpenAPI_error_report_t *error_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_error_report_t));
if (!error_report_local_var) {
return NULL;
}
error_report_local_var->error = error;
error_report_local_var->rule_reports = rule_reports;
error_report_local_var->sess_rule_reports = sess_rule_reports;
return error_report_local_var;
}
void OpenAPI_error_report_free(OpenAPI_error_report_t *error_report)
{
if (NULL == error_report) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_problem_details_free(error_report->error);
OpenAPI_list_for_each(error_report->rule_reports, node) {
OpenAPI_rule_report_free(node->data);
}
OpenAPI_list_free(error_report->rule_reports);
OpenAPI_list_for_each(error_report->sess_rule_reports, node) {
OpenAPI_session_rule_report_free(node->data);
}
OpenAPI_list_free(error_report->sess_rule_reports);
ogs_free(error_report);
}
cJSON *OpenAPI_error_report_convertToJSON(OpenAPI_error_report_t *error_report)
{
cJSON *item = NULL;
if (error_report == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [ErrorReport]");
return NULL;
}
item = cJSON_CreateObject();
if (error_report->error) {
cJSON *error_local_JSON = OpenAPI_problem_details_convertToJSON(error_report->error);
if (error_local_JSON == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [error]");
goto end;
}
cJSON_AddItemToObject(item, "error", error_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [error]");
goto end;
}
}
if (error_report->rule_reports) {
cJSON *rule_reportsList = cJSON_AddArrayToObject(item, "ruleReports");
if (rule_reportsList == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [rule_reports]");
goto end;
}
OpenAPI_lnode_t *rule_reports_node;
if (error_report->rule_reports) {
OpenAPI_list_for_each(error_report->rule_reports, rule_reports_node) {
cJSON *itemLocal = OpenAPI_rule_report_convertToJSON(rule_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [rule_reports]");
goto end;
}
cJSON_AddItemToArray(rule_reportsList, itemLocal);
}
}
}
if (error_report->sess_rule_reports) {
cJSON *sess_rule_reportsList = cJSON_AddArrayToObject(item, "sessRuleReports");
if (sess_rule_reportsList == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [sess_rule_reports]");
goto end;
}
OpenAPI_lnode_t *sess_rule_reports_node;
if (error_report->sess_rule_reports) {
OpenAPI_list_for_each(error_report->sess_rule_reports, sess_rule_reports_node) {
cJSON *itemLocal = OpenAPI_session_rule_report_convertToJSON(sess_rule_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_error_report_convertToJSON() failed [sess_rule_reports]");
goto end;
}
cJSON_AddItemToArray(sess_rule_reportsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJSON)
{
OpenAPI_error_report_t *error_report_local_var = NULL;
cJSON *error = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "error");
OpenAPI_problem_details_t *error_local_nonprim = NULL;
if (error) {
error_local_nonprim = OpenAPI_problem_details_parseFromJSON(error);
}
cJSON *rule_reports = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "ruleReports");
OpenAPI_list_t *rule_reportsList;
if (rule_reports) {
cJSON *rule_reports_local_nonprimitive;
if (!cJSON_IsArray(rule_reports)) {
ogs_error("OpenAPI_error_report_parseFromJSON() failed [rule_reports]");
goto end;
}
rule_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(rule_reports_local_nonprimitive, rule_reports ) {
if (!cJSON_IsObject(rule_reports_local_nonprimitive)) {
ogs_error("OpenAPI_error_report_parseFromJSON() failed [rule_reports]");
goto end;
}
OpenAPI_rule_report_t *rule_reportsItem = OpenAPI_rule_report_parseFromJSON(rule_reports_local_nonprimitive);
OpenAPI_list_add(rule_reportsList, rule_reportsItem);
}
}
cJSON *sess_rule_reports = cJSON_GetObjectItemCaseSensitive(error_reportJSON, "sessRuleReports");
OpenAPI_list_t *sess_rule_reportsList;
if (sess_rule_reports) {
cJSON *sess_rule_reports_local_nonprimitive;
if (!cJSON_IsArray(sess_rule_reports)) {
ogs_error("OpenAPI_error_report_parseFromJSON() failed [sess_rule_reports]");
goto end;
}
sess_rule_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(sess_rule_reports_local_nonprimitive, sess_rule_reports ) {
if (!cJSON_IsObject(sess_rule_reports_local_nonprimitive)) {
ogs_error("OpenAPI_error_report_parseFromJSON() failed [sess_rule_reports]");
goto end;
}
OpenAPI_session_rule_report_t *sess_rule_reportsItem = OpenAPI_session_rule_report_parseFromJSON(sess_rule_reports_local_nonprimitive);
OpenAPI_list_add(sess_rule_reportsList, sess_rule_reportsItem);
}
}
error_report_local_var = OpenAPI_error_report_create (
error ? error_local_nonprim : NULL,
rule_reports ? rule_reportsList : NULL,
sess_rule_reports ? sess_rule_reportsList : NULL
);
return error_report_local_var;
end:
return NULL;
}
OpenAPI_error_report_t *OpenAPI_error_report_copy(OpenAPI_error_report_t *dst, OpenAPI_error_report_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_error_report_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_error_report_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_error_report_free(dst);
dst = OpenAPI_error_report_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,45 @@
/*
* error_report.h
*
*
*/
#ifndef _OpenAPI_error_report_H_
#define _OpenAPI_error_report_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "problem_details.h"
#include "rule_report.h"
#include "session_rule_report.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_error_report_s OpenAPI_error_report_t;
typedef struct OpenAPI_error_report_s {
struct OpenAPI_problem_details_s *error;
OpenAPI_list_t *rule_reports;
OpenAPI_list_t *sess_rule_reports;
} OpenAPI_error_report_t;
OpenAPI_error_report_t *OpenAPI_error_report_create(
OpenAPI_problem_details_t *error,
OpenAPI_list_t *rule_reports,
OpenAPI_list_t *sess_rule_reports
);
void OpenAPI_error_report_free(OpenAPI_error_report_t *error_report);
OpenAPI_error_report_t *OpenAPI_error_report_parseFromJSON(cJSON *error_reportJSON);
cJSON *OpenAPI_error_report_convertToJSON(OpenAPI_error_report_t *error_report);
OpenAPI_error_report_t *OpenAPI_error_report_copy(OpenAPI_error_report_t *dst, OpenAPI_error_report_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_error_report_H_ */

View File

@ -5,13 +5,13 @@
#include "expected_ue_behaviour_data.h"
OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_create(
OpenAPI_stationary_indication_t *stationary_indication,
OpenAPI_stationary_indication_e stationary_indication,
int communication_duration_time,
int periodic_time,
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
OpenAPI_list_t *expected_umts,
OpenAPI_traffic_profile_t *traffic_profile,
OpenAPI_traffic_profile_e traffic_profile,
OpenAPI_battery_indication_t *battery_indication,
char *validity_time
)
@ -39,14 +39,11 @@ void OpenAPI_expected_ue_behaviour_data_free(OpenAPI_expected_ue_behaviour_data_
return;
}
OpenAPI_lnode_t *node;
OpenAPI_stationary_indication_free(expected_ue_behaviour_data->stationary_indication);
OpenAPI_scheduled_communication_time_free(expected_ue_behaviour_data->scheduled_communication_time);
OpenAPI_scheduled_communication_type_free(expected_ue_behaviour_data->scheduled_communication_type);
OpenAPI_list_for_each(expected_ue_behaviour_data->expected_umts, node) {
OpenAPI_location_area_free(node->data);
}
OpenAPI_list_free(expected_ue_behaviour_data->expected_umts);
OpenAPI_traffic_profile_free(expected_ue_behaviour_data->traffic_profile);
OpenAPI_battery_indication_free(expected_ue_behaviour_data->battery_indication);
ogs_free(expected_ue_behaviour_data->validity_time);
ogs_free(expected_ue_behaviour_data);
@ -63,13 +60,7 @@ cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_beha
item = cJSON_CreateObject();
if (expected_ue_behaviour_data->stationary_indication) {
cJSON *stationary_indication_local_JSON = OpenAPI_stationary_indication_convertToJSON(expected_ue_behaviour_data->stationary_indication);
if (stationary_indication_local_JSON == NULL) {
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [stationary_indication]");
goto end;
}
cJSON_AddItemToObject(item, "stationaryIndication", stationary_indication_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "stationaryIndication", OpenAPI_stationary_indication_ToString(expected_ue_behaviour_data->stationary_indication)) == NULL) {
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [stationary_indication]");
goto end;
}
@ -103,13 +94,7 @@ cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_beha
}
if (expected_ue_behaviour_data->scheduled_communication_type) {
cJSON *scheduled_communication_type_local_JSON = OpenAPI_scheduled_communication_type_convertToJSON(expected_ue_behaviour_data->scheduled_communication_type);
if (scheduled_communication_type_local_JSON == NULL) {
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [scheduled_communication_type]");
goto end;
}
cJSON_AddItemToObject(item, "scheduledCommunicationType", scheduled_communication_type_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "scheduledCommunicationType", OpenAPI_scheduled_communication_type_ToString(expected_ue_behaviour_data->scheduled_communication_type)) == NULL) {
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [scheduled_communication_type]");
goto end;
}
@ -136,13 +121,7 @@ cJSON *OpenAPI_expected_ue_behaviour_data_convertToJSON(OpenAPI_expected_ue_beha
}
if (expected_ue_behaviour_data->traffic_profile) {
cJSON *traffic_profile_local_JSON = OpenAPI_traffic_profile_convertToJSON(expected_ue_behaviour_data->traffic_profile);
if (traffic_profile_local_JSON == NULL) {
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [traffic_profile]");
goto end;
}
cJSON_AddItemToObject(item, "trafficProfile", traffic_profile_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "trafficProfile", OpenAPI_traffic_profile_ToString(expected_ue_behaviour_data->traffic_profile)) == NULL) {
ogs_error("OpenAPI_expected_ue_behaviour_data_convertToJSON() failed [traffic_profile]");
goto end;
}
@ -177,9 +156,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_data_local_var = NULL;
cJSON *stationary_indication = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "stationaryIndication");
OpenAPI_stationary_indication_t *stationary_indication_local_nonprim = NULL;
OpenAPI_stationary_indication_e stationary_indicationVariable;
if (stationary_indication) {
stationary_indication_local_nonprim = OpenAPI_stationary_indication_parseFromJSON(stationary_indication);
if (!cJSON_IsString(stationary_indication)) {
ogs_error("OpenAPI_expected_ue_behaviour_data_parseFromJSON() failed [stationary_indication]");
goto end;
}
stationary_indicationVariable = OpenAPI_stationary_indication_FromString(stationary_indication->valuestring);
}
cJSON *communication_duration_time = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "communicationDurationTime");
@ -209,9 +192,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
cJSON *scheduled_communication_type = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "scheduledCommunicationType");
OpenAPI_scheduled_communication_type_t *scheduled_communication_type_local_nonprim = NULL;
OpenAPI_scheduled_communication_type_e scheduled_communication_typeVariable;
if (scheduled_communication_type) {
scheduled_communication_type_local_nonprim = OpenAPI_scheduled_communication_type_parseFromJSON(scheduled_communication_type);
if (!cJSON_IsString(scheduled_communication_type)) {
ogs_error("OpenAPI_expected_ue_behaviour_data_parseFromJSON() failed [scheduled_communication_type]");
goto end;
}
scheduled_communication_typeVariable = OpenAPI_scheduled_communication_type_FromString(scheduled_communication_type->valuestring);
}
cJSON *expected_umts = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "expectedUmts");
@ -239,9 +226,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
cJSON *traffic_profile = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "trafficProfile");
OpenAPI_traffic_profile_t *traffic_profile_local_nonprim = NULL;
OpenAPI_traffic_profile_e traffic_profileVariable;
if (traffic_profile) {
traffic_profile_local_nonprim = OpenAPI_traffic_profile_parseFromJSON(traffic_profile);
if (!cJSON_IsString(traffic_profile)) {
ogs_error("OpenAPI_expected_ue_behaviour_data_parseFromJSON() failed [traffic_profile]");
goto end;
}
traffic_profileVariable = OpenAPI_traffic_profile_FromString(traffic_profile->valuestring);
}
cJSON *battery_indication = cJSON_GetObjectItemCaseSensitive(expected_ue_behaviour_dataJSON, "batteryIndication");
@ -261,13 +252,13 @@ OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_parseFr
}
expected_ue_behaviour_data_local_var = OpenAPI_expected_ue_behaviour_data_create (
stationary_indication ? stationary_indication_local_nonprim : NULL,
stationary_indication ? stationary_indicationVariable : 0,
communication_duration_time ? communication_duration_time->valuedouble : 0,
periodic_time ? periodic_time->valuedouble : 0,
scheduled_communication_time ? scheduled_communication_time_local_nonprim : NULL,
scheduled_communication_type ? scheduled_communication_type_local_nonprim : NULL,
scheduled_communication_type ? scheduled_communication_typeVariable : 0,
expected_umts ? expected_umtsList : NULL,
traffic_profile ? traffic_profile_local_nonprim : NULL,
traffic_profile ? traffic_profileVariable : 0,
battery_indication ? battery_indication_local_nonprim : NULL,
validity_time ? ogs_strdup(validity_time->valuestring) : NULL
);

View File

@ -25,25 +25,25 @@ extern "C" {
typedef struct OpenAPI_expected_ue_behaviour_data_s OpenAPI_expected_ue_behaviour_data_t;
typedef struct OpenAPI_expected_ue_behaviour_data_s {
struct OpenAPI_stationary_indication_s *stationary_indication;
OpenAPI_stationary_indication_e stationary_indication;
int communication_duration_time;
int periodic_time;
struct OpenAPI_scheduled_communication_time_s *scheduled_communication_time;
struct OpenAPI_scheduled_communication_type_s *scheduled_communication_type;
OpenAPI_scheduled_communication_type_e scheduled_communication_type;
OpenAPI_list_t *expected_umts;
struct OpenAPI_traffic_profile_s *traffic_profile;
OpenAPI_traffic_profile_e traffic_profile;
struct OpenAPI_battery_indication_s *battery_indication;
char *validity_time;
} OpenAPI_expected_ue_behaviour_data_t;
OpenAPI_expected_ue_behaviour_data_t *OpenAPI_expected_ue_behaviour_data_create(
OpenAPI_stationary_indication_t *stationary_indication,
OpenAPI_stationary_indication_e stationary_indication,
int communication_duration_time,
int periodic_time,
OpenAPI_scheduled_communication_time_t *scheduled_communication_time,
OpenAPI_scheduled_communication_type_t *scheduled_communication_type,
OpenAPI_scheduled_communication_type_e scheduled_communication_type,
OpenAPI_list_t *expected_umts,
OpenAPI_traffic_profile_t *traffic_profile,
OpenAPI_traffic_profile_e traffic_profile,
OpenAPI_battery_indication_t *battery_indication,
char *validity_time
);

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "failure_cause.h"
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
)
{
OpenAPI_failure_cause_t *failure_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_cause_t));
if (!failure_cause_local_var) {
return NULL;
}
return failure_cause_local_var;
}
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause)
{
if (NULL == failure_cause) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(failure_cause);
}
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause)
{
cJSON *item = NULL;
if (failure_cause == NULL) {
ogs_error("OpenAPI_failure_cause_convertToJSON() failed [FailureCause]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON)
{
OpenAPI_failure_cause_t *failure_cause_local_var = NULL;
failure_cause_local_var = OpenAPI_failure_cause_create (
);
return failure_cause_local_var;
end:
return NULL;
}
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_failure_cause_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_failure_cause_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_failure_cause_free(dst);
dst = OpenAPI_failure_cause_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* failure_cause.h
*
*
*/
#ifndef _OpenAPI_failure_cause_H_
#define _OpenAPI_failure_cause_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_failure_cause_s OpenAPI_failure_cause_t;
typedef struct OpenAPI_failure_cause_s {
} OpenAPI_failure_cause_t;
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
);
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause);
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON);
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause);
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_failure_cause_H_ */

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "failure_code.h"
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
)
{
OpenAPI_failure_code_t *failure_code_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_code_t));
if (!failure_code_local_var) {
return NULL;
}
return failure_code_local_var;
}
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code)
{
if (NULL == failure_code) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(failure_code);
}
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code)
{
cJSON *item = NULL;
if (failure_code == NULL) {
ogs_error("OpenAPI_failure_code_convertToJSON() failed [FailureCode]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON)
{
OpenAPI_failure_code_t *failure_code_local_var = NULL;
failure_code_local_var = OpenAPI_failure_code_create (
);
return failure_code_local_var;
end:
return NULL;
}
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_failure_code_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_failure_code_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_failure_code_free(dst);
dst = OpenAPI_failure_code_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* failure_code.h
*
* Possible values are - UNK_RULE_ID: Indicates that the pre-provisioned PCC rule could not be successfully activated because the PCC rule identifier is unknown to the SMF. - RA_GR_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Rating Group specified within the Charging Data policy decision which the PCC rule refers to is unknown or, invalid. - SER_ID_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Service Identifier specified within the Charging Data policy decision which the PCC rule refers to is invalid, unknown, or not applicable to the service being charged. - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. - MAX_NR_QoS_FLOW: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to the fact that the maximum number of QoS flows has been reached for the PDU session. - MISS_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or enforced because neither the \&quot;flowInfos\&quot; attribute nor the \&quot;appId\&quot; attribute is specified within the PccRule data structure by the PCF during the first install request of the PCC rule. - RES_ALLO_FAIL: Indicate that the PCC rule could not be successfully installed or maintained since the QoS flow establishment/modification failed, or the QoS flow was released. - UNSUCC_QOS_VAL: indicate that the QoS validation has failed or when Guaranteed Bandwidth &gt; Max-Requested-Bandwidth. - INCOR_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or modified at the SMF because the provided flow information is not supported by the network (e.g. the provided IP address(es) or Ipv6 prefix(es) do not correspond to an IP version applicable for the PDU session). - PS_TO_CS_HAN: Indicate that the PCC rule could not be maintained because of PS to CS handover. - APP_ID_ERR: Indicate that the rule could not be successfully installed or enforced because the Application Identifier is invalid, unknown, or not applicable to the application required for detection. - NO_QOS_FLOW_BOUND: Indicate that there is no QoS flow which the SMF can bind the PCC rule(s) to. - FILTER_RES: Indicate that the Flow Information within the \&quot;flowInfos\&quot; attribute cannot be handled by the SMF because any of the restrictions defined in subclause 5.4.2 of 3GPP TS 29.212 was not met. - MISS_REDI_SER_ADDR: Indicate that the PCC rule could not be successfully installed or enforced at the SMF because there is no valid Redirect Server Address within the Traffic Control Data policy decision which the PCC rule refers to provided by the PCF and no preconfigured redirection address for this PCC rule at the SMF. - CM_END_USER_SER_DENIED: Indicate that the charging system denied the service request due to service restrictions (e.g. terminate rating group) or limitations related to the end-user, for example the end-user&#39;s account could not cover the requested service. - CM_CREDIT_CON_NOT_APP: Indicate that the charging system determined that the service can be granted to the end user but no further credit control is needed for the service (e.g. service is free of charge or is treated for offline charging). - CM_AUTH_REJ: Indicate that the charging system denied the service request in order to terminate the service for which credit is requested. - CM_USER_UNK: Indicate that the specified end user could not be found in the charging system. - CM_RAT_FAILED: Indicate that the charging system cannot rate the service request due to insufficient rating input, incorrect AVP combination or due to an attribute or an attribute value that is not recognized or supported in the rating. - UE_STA_SUSP: Indicates that the UE is in suspend state.
*/
#ifndef _OpenAPI_failure_code_H_
#define _OpenAPI_failure_code_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_failure_code_s OpenAPI_failure_code_t;
typedef struct OpenAPI_failure_code_s {
} OpenAPI_failure_code_t;
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
);
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code);
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON);
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code);
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_failure_code_H_ */

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "final_unit_action.h"
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_create(
)
{
OpenAPI_final_unit_action_t *final_unit_action_local_var = OpenAPI_malloc(sizeof(OpenAPI_final_unit_action_t));
if (!final_unit_action_local_var) {
return NULL;
}
return final_unit_action_local_var;
}
void OpenAPI_final_unit_action_free(OpenAPI_final_unit_action_t *final_unit_action)
{
if (NULL == final_unit_action) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(final_unit_action);
}
cJSON *OpenAPI_final_unit_action_convertToJSON(OpenAPI_final_unit_action_t *final_unit_action)
{
cJSON *item = NULL;
if (final_unit_action == NULL) {
ogs_error("OpenAPI_final_unit_action_convertToJSON() failed [FinalUnitAction]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_parseFromJSON(cJSON *final_unit_actionJSON)
{
OpenAPI_final_unit_action_t *final_unit_action_local_var = NULL;
final_unit_action_local_var = OpenAPI_final_unit_action_create (
);
return final_unit_action_local_var;
end:
return NULL;
}
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_copy(OpenAPI_final_unit_action_t *dst, OpenAPI_final_unit_action_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_final_unit_action_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_final_unit_action_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_final_unit_action_free(dst);
dst = OpenAPI_final_unit_action_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* final_unit_action.h
*
*
*/
#ifndef _OpenAPI_final_unit_action_H_
#define _OpenAPI_final_unit_action_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_final_unit_action_s OpenAPI_final_unit_action_t;
typedef struct OpenAPI_final_unit_action_s {
} OpenAPI_final_unit_action_t;
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_create(
);
void OpenAPI_final_unit_action_free(OpenAPI_final_unit_action_t *final_unit_action);
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_parseFromJSON(cJSON *final_unit_actionJSON);
cJSON *OpenAPI_final_unit_action_convertToJSON(OpenAPI_final_unit_action_t *final_unit_action);
OpenAPI_final_unit_action_t *OpenAPI_final_unit_action_copy(OpenAPI_final_unit_action_t *dst, OpenAPI_final_unit_action_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_final_unit_action_H_ */

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "flow_direction_rm.h"
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create(
)
{
OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_direction_rm_t));
if (!flow_direction_rm_local_var) {
return NULL;
}
return flow_direction_rm_local_var;
}
void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm)
{
if (NULL == flow_direction_rm) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(flow_direction_rm);
}
cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm)
{
cJSON *item = NULL;
if (flow_direction_rm == NULL) {
ogs_error("OpenAPI_flow_direction_rm_convertToJSON() failed [FlowDirectionRm]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON)
{
OpenAPI_flow_direction_rm_t *flow_direction_rm_local_var = NULL;
flow_direction_rm_local_var = OpenAPI_flow_direction_rm_create (
);
return flow_direction_rm_local_var;
end:
return NULL;
}
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_flow_direction_rm_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_flow_direction_rm_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_flow_direction_rm_free(dst);
dst = OpenAPI_flow_direction_rm_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,38 @@
/*
* flow_direction_rm.h
*
*
*/
#ifndef _OpenAPI_flow_direction_rm_H_
#define _OpenAPI_flow_direction_rm_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "flow_direction.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_flow_direction_rm_s OpenAPI_flow_direction_rm_t;
typedef struct OpenAPI_flow_direction_rm_s {
} OpenAPI_flow_direction_rm_t;
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_create(
);
void OpenAPI_flow_direction_rm_free(OpenAPI_flow_direction_rm_t *flow_direction_rm);
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_parseFromJSON(cJSON *flow_direction_rmJSON);
cJSON *OpenAPI_flow_direction_rm_convertToJSON(OpenAPI_flow_direction_rm_t *flow_direction_rm);
OpenAPI_flow_direction_rm_t *OpenAPI_flow_direction_rm_copy(OpenAPI_flow_direction_rm_t *dst, OpenAPI_flow_direction_rm_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_flow_direction_rm_H_ */

View File

@ -0,0 +1,252 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "flow_information.h"
OpenAPI_flow_information_t *OpenAPI_flow_information_create(
char *flow_description,
OpenAPI_eth_flow_description_t *eth_flow_description,
char *pack_filt_id,
int packet_filter_usage,
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_rm_t *flow_direction
)
{
OpenAPI_flow_information_t *flow_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_information_t));
if (!flow_information_local_var) {
return NULL;
}
flow_information_local_var->flow_description = flow_description;
flow_information_local_var->eth_flow_description = eth_flow_description;
flow_information_local_var->pack_filt_id = pack_filt_id;
flow_information_local_var->packet_filter_usage = packet_filter_usage;
flow_information_local_var->tos_traffic_class = tos_traffic_class;
flow_information_local_var->spi = spi;
flow_information_local_var->flow_label = flow_label;
flow_information_local_var->flow_direction = flow_direction;
return flow_information_local_var;
}
void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information)
{
if (NULL == flow_information) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(flow_information->flow_description);
OpenAPI_eth_flow_description_free(flow_information->eth_flow_description);
ogs_free(flow_information->pack_filt_id);
ogs_free(flow_information->tos_traffic_class);
ogs_free(flow_information->spi);
ogs_free(flow_information->flow_label);
OpenAPI_flow_direction_rm_free(flow_information->flow_direction);
ogs_free(flow_information);
}
cJSON *OpenAPI_flow_information_convertToJSON(OpenAPI_flow_information_t *flow_information)
{
cJSON *item = NULL;
if (flow_information == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [FlowInformation]");
return NULL;
}
item = cJSON_CreateObject();
if (flow_information->flow_description) {
if (cJSON_AddStringToObject(item, "flowDescription", flow_information->flow_description) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_description]");
goto end;
}
}
if (flow_information->eth_flow_description) {
cJSON *eth_flow_description_local_JSON = OpenAPI_eth_flow_description_convertToJSON(flow_information->eth_flow_description);
if (eth_flow_description_local_JSON == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [eth_flow_description]");
goto end;
}
cJSON_AddItemToObject(item, "ethFlowDescription", eth_flow_description_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [eth_flow_description]");
goto end;
}
}
if (flow_information->pack_filt_id) {
if (cJSON_AddStringToObject(item, "packFiltId", flow_information->pack_filt_id) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [pack_filt_id]");
goto end;
}
}
if (flow_information->packet_filter_usage) {
if (cJSON_AddBoolToObject(item, "packetFilterUsage", flow_information->packet_filter_usage) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [packet_filter_usage]");
goto end;
}
}
if (flow_information->tos_traffic_class) {
if (cJSON_AddStringToObject(item, "tosTrafficClass", flow_information->tos_traffic_class) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [tos_traffic_class]");
goto end;
}
}
if (flow_information->spi) {
if (cJSON_AddStringToObject(item, "spi", flow_information->spi) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [spi]");
goto end;
}
}
if (flow_information->flow_label) {
if (cJSON_AddStringToObject(item, "flowLabel", flow_information->flow_label) == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_label]");
goto end;
}
}
if (flow_information->flow_direction) {
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_rm_convertToJSON(flow_information->flow_direction);
if (flow_direction_local_JSON == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
goto end;
}
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
goto end;
}
}
end:
return item;
}
OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_informationJSON)
{
OpenAPI_flow_information_t *flow_information_local_var = NULL;
cJSON *flow_description = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowDescription");
if (flow_description) {
if (!cJSON_IsString(flow_description)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [flow_description]");
goto end;
}
}
cJSON *eth_flow_description = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "ethFlowDescription");
OpenAPI_eth_flow_description_t *eth_flow_description_local_nonprim = NULL;
if (eth_flow_description) {
eth_flow_description_local_nonprim = OpenAPI_eth_flow_description_parseFromJSON(eth_flow_description);
}
cJSON *pack_filt_id = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "packFiltId");
if (pack_filt_id) {
if (!cJSON_IsString(pack_filt_id)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [pack_filt_id]");
goto end;
}
}
cJSON *packet_filter_usage = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "packetFilterUsage");
if (packet_filter_usage) {
if (!cJSON_IsBool(packet_filter_usage)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [packet_filter_usage]");
goto end;
}
}
cJSON *tos_traffic_class = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "tosTrafficClass");
if (tos_traffic_class) {
if (!cJSON_IsString(tos_traffic_class)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [tos_traffic_class]");
goto end;
}
}
cJSON *spi = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "spi");
if (spi) {
if (!cJSON_IsString(spi)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [spi]");
goto end;
}
}
cJSON *flow_label = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowLabel");
if (flow_label) {
if (!cJSON_IsString(flow_label)) {
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [flow_label]");
goto end;
}
}
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowDirection");
OpenAPI_flow_direction_rm_t *flow_direction_local_nonprim = NULL;
if (flow_direction) {
flow_direction_local_nonprim = OpenAPI_flow_direction_rm_parseFromJSON(flow_direction);
}
flow_information_local_var = OpenAPI_flow_information_create (
flow_description ? ogs_strdup(flow_description->valuestring) : NULL,
eth_flow_description ? eth_flow_description_local_nonprim : NULL,
pack_filt_id ? ogs_strdup(pack_filt_id->valuestring) : NULL,
packet_filter_usage ? packet_filter_usage->valueint : 0,
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
spi ? ogs_strdup(spi->valuestring) : NULL,
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
flow_direction ? flow_direction_local_nonprim : NULL
);
return flow_information_local_var;
end:
return NULL;
}
OpenAPI_flow_information_t *OpenAPI_flow_information_copy(OpenAPI_flow_information_t *dst, OpenAPI_flow_information_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_flow_information_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_flow_information_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_flow_information_free(dst);
dst = OpenAPI_flow_information_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,54 @@
/*
* flow_information.h
*
*
*/
#ifndef _OpenAPI_flow_information_H_
#define _OpenAPI_flow_information_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "eth_flow_description.h"
#include "flow_direction_rm.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_flow_information_s OpenAPI_flow_information_t;
typedef struct OpenAPI_flow_information_s {
char *flow_description;
struct OpenAPI_eth_flow_description_s *eth_flow_description;
char *pack_filt_id;
int packet_filter_usage;
char *tos_traffic_class;
char *spi;
char *flow_label;
struct OpenAPI_flow_direction_rm_s *flow_direction;
} OpenAPI_flow_information_t;
OpenAPI_flow_information_t *OpenAPI_flow_information_create(
char *flow_description,
OpenAPI_eth_flow_description_t *eth_flow_description,
char *pack_filt_id,
int packet_filter_usage,
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_rm_t *flow_direction
);
void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information);
OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_informationJSON);
cJSON *OpenAPI_flow_information_convertToJSON(OpenAPI_flow_information_t *flow_information);
OpenAPI_flow_information_t *OpenAPI_flow_information_copy(OpenAPI_flow_information_t *dst, OpenAPI_flow_information_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_flow_information_H_ */

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "flow_status.h"
OpenAPI_flow_status_t *OpenAPI_flow_status_create(
)
{
OpenAPI_flow_status_t *flow_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_status_t));
if (!flow_status_local_var) {
return NULL;
}
return flow_status_local_var;
}
void OpenAPI_flow_status_free(OpenAPI_flow_status_t *flow_status)
{
if (NULL == flow_status) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(flow_status);
}
cJSON *OpenAPI_flow_status_convertToJSON(OpenAPI_flow_status_t *flow_status)
{
cJSON *item = NULL;
if (flow_status == NULL) {
ogs_error("OpenAPI_flow_status_convertToJSON() failed [FlowStatus]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_flow_status_t *OpenAPI_flow_status_parseFromJSON(cJSON *flow_statusJSON)
{
OpenAPI_flow_status_t *flow_status_local_var = NULL;
flow_status_local_var = OpenAPI_flow_status_create (
);
return flow_status_local_var;
end:
return NULL;
}
OpenAPI_flow_status_t *OpenAPI_flow_status_copy(OpenAPI_flow_status_t *dst, OpenAPI_flow_status_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_flow_status_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_flow_status_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_flow_status_free(dst);
dst = OpenAPI_flow_status_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* flow_status.h
*
*
*/
#ifndef _OpenAPI_flow_status_H_
#define _OpenAPI_flow_status_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_flow_status_s OpenAPI_flow_status_t;
typedef struct OpenAPI_flow_status_s {
} OpenAPI_flow_status_t;
OpenAPI_flow_status_t *OpenAPI_flow_status_create(
);
void OpenAPI_flow_status_free(OpenAPI_flow_status_t *flow_status);
OpenAPI_flow_status_t *OpenAPI_flow_status_parseFromJSON(cJSON *flow_statusJSON);
cJSON *OpenAPI_flow_status_convertToJSON(OpenAPI_flow_status_t *flow_status);
OpenAPI_flow_status_t *OpenAPI_flow_status_copy(OpenAPI_flow_status_t *dst, OpenAPI_flow_status_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_flow_status_H_ */

View File

@ -44,7 +44,7 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create(
OpenAPI_n4_information_t *n4_info,
OpenAPI_n4_information_t *n4_info_ext1,
OpenAPI_n4_information_t *n4_info_ext2,
OpenAPI_presence_state_t *presence_in_ladn,
OpenAPI_presence_state_e presence_in_ladn,
char *vsmf_pdu_session_uri,
char *vsmf_id,
char *v_smf_service_instance_id,
@ -174,7 +174,6 @@ void OpenAPI_hsmf_update_data_free(OpenAPI_hsmf_update_data_t *hsmf_update_data)
OpenAPI_n4_information_free(hsmf_update_data->n4_info);
OpenAPI_n4_information_free(hsmf_update_data->n4_info_ext1);
OpenAPI_n4_information_free(hsmf_update_data->n4_info_ext2);
OpenAPI_presence_state_free(hsmf_update_data->presence_in_ladn);
ogs_free(hsmf_update_data->vsmf_pdu_session_uri);
ogs_free(hsmf_update_data->vsmf_id);
ogs_free(hsmf_update_data->v_smf_service_instance_id);
@ -653,13 +652,7 @@ cJSON *OpenAPI_hsmf_update_data_convertToJSON(OpenAPI_hsmf_update_data_t *hsmf_u
}
if (hsmf_update_data->presence_in_ladn) {
cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(hsmf_update_data->presence_in_ladn);
if (presence_in_ladn_local_JSON == NULL) {
ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [presence_in_ladn]");
goto end;
}
cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "presenceInLadn", OpenAPI_presence_state_ToString(hsmf_update_data->presence_in_ladn)) == NULL) {
ogs_error("OpenAPI_hsmf_update_data_convertToJSON() failed [presence_in_ladn]");
goto end;
}
@ -1248,9 +1241,13 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u
cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "presenceInLadn");
OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL;
OpenAPI_presence_state_e presence_in_ladnVariable;
if (presence_in_ladn) {
presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn);
if (!cJSON_IsString(presence_in_ladn)) {
ogs_error("OpenAPI_hsmf_update_data_parseFromJSON() failed [presence_in_ladn]");
goto end;
}
presence_in_ladnVariable = OpenAPI_presence_state_FromString(presence_in_ladn->valuestring);
}
cJSON *vsmf_pdu_session_uri = cJSON_GetObjectItemCaseSensitive(hsmf_update_dataJSON, "vsmfPduSessionUri");
@ -1413,7 +1410,7 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_parseFromJSON(cJSON *hsmf_u
n4_info ? n4_info_local_nonprim : NULL,
n4_info_ext1 ? n4_info_ext1_local_nonprim : NULL,
n4_info_ext2 ? n4_info_ext2_local_nonprim : NULL,
presence_in_ladn ? presence_in_ladn_local_nonprim : NULL,
presence_in_ladn ? presence_in_ladnVariable : 0,
vsmf_pdu_session_uri ? ogs_strdup(vsmf_pdu_session_uri->valuestring) : NULL,
vsmf_id ? ogs_strdup(vsmf_id->valuestring) : NULL,
v_smf_service_instance_id ? ogs_strdup(v_smf_service_instance_id->valuestring) : NULL,

View File

@ -83,7 +83,7 @@ typedef struct OpenAPI_hsmf_update_data_s {
struct OpenAPI_n4_information_s *n4_info;
struct OpenAPI_n4_information_s *n4_info_ext1;
struct OpenAPI_n4_information_s *n4_info_ext2;
struct OpenAPI_presence_state_s *presence_in_ladn;
OpenAPI_presence_state_e presence_in_ladn;
char *vsmf_pdu_session_uri;
char *vsmf_id;
char *v_smf_service_instance_id;
@ -139,7 +139,7 @@ OpenAPI_hsmf_update_data_t *OpenAPI_hsmf_update_data_create(
OpenAPI_n4_information_t *n4_info,
OpenAPI_n4_information_t *n4_info_ext1,
OpenAPI_n4_information_t *n4_info_ext2,
OpenAPI_presence_state_t *presence_in_ladn,
OpenAPI_presence_state_e presence_in_ladn,
char *vsmf_pdu_session_uri,
char *vsmf_id,
char *v_smf_service_instance_id,

View File

@ -0,0 +1,165 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "ip_multicast_address_info.h"
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_create(
char *src_ipv4_addr,
char *ipv4_mul_addr,
char *src_ipv6_addr,
char *ipv6_mul_addr
)
{
OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ip_multicast_address_info_t));
if (!ip_multicast_address_info_local_var) {
return NULL;
}
ip_multicast_address_info_local_var->src_ipv4_addr = src_ipv4_addr;
ip_multicast_address_info_local_var->ipv4_mul_addr = ipv4_mul_addr;
ip_multicast_address_info_local_var->src_ipv6_addr = src_ipv6_addr;
ip_multicast_address_info_local_var->ipv6_mul_addr = ipv6_mul_addr;
return ip_multicast_address_info_local_var;
}
void OpenAPI_ip_multicast_address_info_free(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info)
{
if (NULL == ip_multicast_address_info) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(ip_multicast_address_info->src_ipv4_addr);
ogs_free(ip_multicast_address_info->ipv4_mul_addr);
ogs_free(ip_multicast_address_info->src_ipv6_addr);
ogs_free(ip_multicast_address_info->ipv6_mul_addr);
ogs_free(ip_multicast_address_info);
}
cJSON *OpenAPI_ip_multicast_address_info_convertToJSON(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info)
{
cJSON *item = NULL;
if (ip_multicast_address_info == NULL) {
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [IpMulticastAddressInfo]");
return NULL;
}
item = cJSON_CreateObject();
if (ip_multicast_address_info->src_ipv4_addr) {
if (cJSON_AddStringToObject(item, "srcIpv4Addr", ip_multicast_address_info->src_ipv4_addr) == NULL) {
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [src_ipv4_addr]");
goto end;
}
}
if (ip_multicast_address_info->ipv4_mul_addr) {
if (cJSON_AddStringToObject(item, "ipv4MulAddr", ip_multicast_address_info->ipv4_mul_addr) == NULL) {
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [ipv4_mul_addr]");
goto end;
}
}
if (ip_multicast_address_info->src_ipv6_addr) {
if (cJSON_AddStringToObject(item, "srcIpv6Addr", ip_multicast_address_info->src_ipv6_addr) == NULL) {
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [src_ipv6_addr]");
goto end;
}
}
if (ip_multicast_address_info->ipv6_mul_addr) {
if (cJSON_AddStringToObject(item, "ipv6MulAddr", ip_multicast_address_info->ipv6_mul_addr) == NULL) {
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed [ipv6_mul_addr]");
goto end;
}
}
end:
return item;
}
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_parseFromJSON(cJSON *ip_multicast_address_infoJSON)
{
OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info_local_var = NULL;
cJSON *src_ipv4_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "srcIpv4Addr");
if (src_ipv4_addr) {
if (!cJSON_IsString(src_ipv4_addr)) {
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [src_ipv4_addr]");
goto end;
}
}
cJSON *ipv4_mul_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "ipv4MulAddr");
if (ipv4_mul_addr) {
if (!cJSON_IsString(ipv4_mul_addr)) {
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [ipv4_mul_addr]");
goto end;
}
}
cJSON *src_ipv6_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "srcIpv6Addr");
if (src_ipv6_addr) {
if (!cJSON_IsString(src_ipv6_addr)) {
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [src_ipv6_addr]");
goto end;
}
}
cJSON *ipv6_mul_addr = cJSON_GetObjectItemCaseSensitive(ip_multicast_address_infoJSON, "ipv6MulAddr");
if (ipv6_mul_addr) {
if (!cJSON_IsString(ipv6_mul_addr)) {
ogs_error("OpenAPI_ip_multicast_address_info_parseFromJSON() failed [ipv6_mul_addr]");
goto end;
}
}
ip_multicast_address_info_local_var = OpenAPI_ip_multicast_address_info_create (
src_ipv4_addr ? ogs_strdup(src_ipv4_addr->valuestring) : NULL,
ipv4_mul_addr ? ogs_strdup(ipv4_mul_addr->valuestring) : NULL,
src_ipv6_addr ? ogs_strdup(src_ipv6_addr->valuestring) : NULL,
ipv6_mul_addr ? ogs_strdup(ipv6_mul_addr->valuestring) : NULL
);
return ip_multicast_address_info_local_var;
end:
return NULL;
}
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_copy(OpenAPI_ip_multicast_address_info_t *dst, OpenAPI_ip_multicast_address_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_ip_multicast_address_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_ip_multicast_address_info_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_ip_multicast_address_info_free(dst);
dst = OpenAPI_ip_multicast_address_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,44 @@
/*
* ip_multicast_address_info.h
*
*
*/
#ifndef _OpenAPI_ip_multicast_address_info_H_
#define _OpenAPI_ip_multicast_address_info_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_ip_multicast_address_info_s OpenAPI_ip_multicast_address_info_t;
typedef struct OpenAPI_ip_multicast_address_info_s {
char *src_ipv4_addr;
char *ipv4_mul_addr;
char *src_ipv6_addr;
char *ipv6_mul_addr;
} OpenAPI_ip_multicast_address_info_t;
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_create(
char *src_ipv4_addr,
char *ipv4_mul_addr,
char *src_ipv6_addr,
char *ipv6_mul_addr
);
void OpenAPI_ip_multicast_address_info_free(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info);
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_parseFromJSON(cJSON *ip_multicast_address_infoJSON);
cJSON *OpenAPI_ip_multicast_address_info_convertToJSON(OpenAPI_ip_multicast_address_info_t *ip_multicast_address_info);
OpenAPI_ip_multicast_address_info_t *OpenAPI_ip_multicast_address_info_copy(OpenAPI_ip_multicast_address_info_t *dst, OpenAPI_ip_multicast_address_info_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_ip_multicast_address_info_H_ */

View File

@ -6,7 +6,7 @@
OpenAPI_ladn_info_t *OpenAPI_ladn_info_create(
char *ladn,
OpenAPI_presence_state_t *presence
OpenAPI_presence_state_e presence
)
{
OpenAPI_ladn_info_t *ladn_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_ladn_info_t));
@ -26,7 +26,6 @@ void OpenAPI_ladn_info_free(OpenAPI_ladn_info_t *ladn_info)
}
OpenAPI_lnode_t *node;
ogs_free(ladn_info->ladn);
OpenAPI_presence_state_free(ladn_info->presence);
ogs_free(ladn_info);
}
@ -50,13 +49,7 @@ cJSON *OpenAPI_ladn_info_convertToJSON(OpenAPI_ladn_info_t *ladn_info)
}
if (ladn_info->presence) {
cJSON *presence_local_JSON = OpenAPI_presence_state_convertToJSON(ladn_info->presence);
if (presence_local_JSON == NULL) {
ogs_error("OpenAPI_ladn_info_convertToJSON() failed [presence]");
goto end;
}
cJSON_AddItemToObject(item, "presence", presence_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "presence", OpenAPI_presence_state_ToString(ladn_info->presence)) == NULL) {
ogs_error("OpenAPI_ladn_info_convertToJSON() failed [presence]");
goto end;
}
@ -83,14 +76,18 @@ OpenAPI_ladn_info_t *OpenAPI_ladn_info_parseFromJSON(cJSON *ladn_infoJSON)
cJSON *presence = cJSON_GetObjectItemCaseSensitive(ladn_infoJSON, "presence");
OpenAPI_presence_state_t *presence_local_nonprim = NULL;
OpenAPI_presence_state_e presenceVariable;
if (presence) {
presence_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence);
if (!cJSON_IsString(presence)) {
ogs_error("OpenAPI_ladn_info_parseFromJSON() failed [presence]");
goto end;
}
presenceVariable = OpenAPI_presence_state_FromString(presence->valuestring);
}
ladn_info_local_var = OpenAPI_ladn_info_create (
ogs_strdup(ladn->valuestring),
presence ? presence_local_nonprim : NULL
presence ? presenceVariable : 0
);
return ladn_info_local_var;

View File

@ -21,12 +21,12 @@ extern "C" {
typedef struct OpenAPI_ladn_info_s OpenAPI_ladn_info_t;
typedef struct OpenAPI_ladn_info_s {
char *ladn;
struct OpenAPI_presence_state_s *presence;
OpenAPI_presence_state_e presence;
} OpenAPI_ladn_info_t;
OpenAPI_ladn_info_t *OpenAPI_ladn_info_create(
char *ladn,
OpenAPI_presence_state_t *presence
OpenAPI_presence_state_e presence
);
void OpenAPI_ladn_info_free(OpenAPI_ladn_info_t *ladn_info);
OpenAPI_ladn_info_t *OpenAPI_ladn_info_parseFromJSON(cJSON *ladn_infoJSON);

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "ma_pdu_indication.h"
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
)
{
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_ma_pdu_indication_t));
if (!ma_pdu_indication_local_var) {
return NULL;
}
return ma_pdu_indication_local_var;
}
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
{
if (NULL == ma_pdu_indication) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(ma_pdu_indication);
}
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
{
cJSON *item = NULL;
if (ma_pdu_indication == NULL) {
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed [MaPduIndication]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON)
{
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = NULL;
ma_pdu_indication_local_var = OpenAPI_ma_pdu_indication_create (
);
return ma_pdu_indication_local_var;
end:
return NULL;
}
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_ma_pdu_indication_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_ma_pdu_indication_free(dst);
dst = OpenAPI_ma_pdu_indication_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* ma_pdu_indication.h
*
*
*/
#ifndef _OpenAPI_ma_pdu_indication_H_
#define _OpenAPI_ma_pdu_indication_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_ma_pdu_indication_s OpenAPI_ma_pdu_indication_t;
typedef struct OpenAPI_ma_pdu_indication_s {
} OpenAPI_ma_pdu_indication_t;
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
);
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON);
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_ma_pdu_indication_H_ */

View File

@ -0,0 +1,143 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "mapping_of_snssai.h"
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_create(
OpenAPI_snssai_t *serving_snssai,
OpenAPI_snssai_t *home_snssai
)
{
OpenAPI_mapping_of_snssai_t *mapping_of_snssai_local_var = OpenAPI_malloc(sizeof(OpenAPI_mapping_of_snssai_t));
if (!mapping_of_snssai_local_var) {
return NULL;
}
mapping_of_snssai_local_var->serving_snssai = serving_snssai;
mapping_of_snssai_local_var->home_snssai = home_snssai;
return mapping_of_snssai_local_var;
}
void OpenAPI_mapping_of_snssai_free(OpenAPI_mapping_of_snssai_t *mapping_of_snssai)
{
if (NULL == mapping_of_snssai) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_snssai_free(mapping_of_snssai->serving_snssai);
OpenAPI_snssai_free(mapping_of_snssai->home_snssai);
ogs_free(mapping_of_snssai);
}
cJSON *OpenAPI_mapping_of_snssai_convertToJSON(OpenAPI_mapping_of_snssai_t *mapping_of_snssai)
{
cJSON *item = NULL;
if (mapping_of_snssai == NULL) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [MappingOfSnssai]");
return NULL;
}
item = cJSON_CreateObject();
if (!mapping_of_snssai->serving_snssai) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [serving_snssai]");
goto end;
}
cJSON *serving_snssai_local_JSON = OpenAPI_snssai_convertToJSON(mapping_of_snssai->serving_snssai);
if (serving_snssai_local_JSON == NULL) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [serving_snssai]");
goto end;
}
cJSON_AddItemToObject(item, "servingSnssai", serving_snssai_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [serving_snssai]");
goto end;
}
if (!mapping_of_snssai->home_snssai) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [home_snssai]");
goto end;
}
cJSON *home_snssai_local_JSON = OpenAPI_snssai_convertToJSON(mapping_of_snssai->home_snssai);
if (home_snssai_local_JSON == NULL) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [home_snssai]");
goto end;
}
cJSON_AddItemToObject(item, "homeSnssai", home_snssai_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed [home_snssai]");
goto end;
}
end:
return item;
}
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_parseFromJSON(cJSON *mapping_of_snssaiJSON)
{
OpenAPI_mapping_of_snssai_t *mapping_of_snssai_local_var = NULL;
cJSON *serving_snssai = cJSON_GetObjectItemCaseSensitive(mapping_of_snssaiJSON, "servingSnssai");
if (!serving_snssai) {
ogs_error("OpenAPI_mapping_of_snssai_parseFromJSON() failed [serving_snssai]");
goto end;
}
OpenAPI_snssai_t *serving_snssai_local_nonprim = NULL;
serving_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(serving_snssai);
cJSON *home_snssai = cJSON_GetObjectItemCaseSensitive(mapping_of_snssaiJSON, "homeSnssai");
if (!home_snssai) {
ogs_error("OpenAPI_mapping_of_snssai_parseFromJSON() failed [home_snssai]");
goto end;
}
OpenAPI_snssai_t *home_snssai_local_nonprim = NULL;
home_snssai_local_nonprim = OpenAPI_snssai_parseFromJSON(home_snssai);
mapping_of_snssai_local_var = OpenAPI_mapping_of_snssai_create (
serving_snssai_local_nonprim,
home_snssai_local_nonprim
);
return mapping_of_snssai_local_var;
end:
return NULL;
}
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_copy(OpenAPI_mapping_of_snssai_t *dst, OpenAPI_mapping_of_snssai_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_mapping_of_snssai_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_mapping_of_snssai_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_mapping_of_snssai_free(dst);
dst = OpenAPI_mapping_of_snssai_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,41 @@
/*
* mapping_of_snssai.h
*
*
*/
#ifndef _OpenAPI_mapping_of_snssai_H_
#define _OpenAPI_mapping_of_snssai_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "snssai.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_mapping_of_snssai_s OpenAPI_mapping_of_snssai_t;
typedef struct OpenAPI_mapping_of_snssai_s {
struct OpenAPI_snssai_s *serving_snssai;
struct OpenAPI_snssai_s *home_snssai;
} OpenAPI_mapping_of_snssai_t;
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_create(
OpenAPI_snssai_t *serving_snssai,
OpenAPI_snssai_t *home_snssai
);
void OpenAPI_mapping_of_snssai_free(OpenAPI_mapping_of_snssai_t *mapping_of_snssai);
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_parseFromJSON(cJSON *mapping_of_snssaiJSON);
cJSON *OpenAPI_mapping_of_snssai_convertToJSON(OpenAPI_mapping_of_snssai_t *mapping_of_snssai);
OpenAPI_mapping_of_snssai_t *OpenAPI_mapping_of_snssai_copy(OpenAPI_mapping_of_snssai_t *dst, OpenAPI_mapping_of_snssai_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_mapping_of_snssai_H_ */

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "metering_method.h"
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
)
{
OpenAPI_metering_method_t *metering_method_local_var = OpenAPI_malloc(sizeof(OpenAPI_metering_method_t));
if (!metering_method_local_var) {
return NULL;
}
return metering_method_local_var;
}
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method)
{
if (NULL == metering_method) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(metering_method);
}
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method)
{
cJSON *item = NULL;
if (metering_method == NULL) {
ogs_error("OpenAPI_metering_method_convertToJSON() failed [MeteringMethod]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON)
{
OpenAPI_metering_method_t *metering_method_local_var = NULL;
metering_method_local_var = OpenAPI_metering_method_create (
);
return metering_method_local_var;
end:
return NULL;
}
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_metering_method_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_metering_method_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_metering_method_free(dst);
dst = OpenAPI_metering_method_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,37 @@
/*
* metering_method.h
*
* Possible values are - DURATION: Indicates that the duration of the service data flow traffic shall be metered. - VOLUME: Indicates that volume of the service data flow traffic shall be metered. - DURATION_VOLUME: Indicates that the duration and the volume of the service data flow traffic shall be metered. - EVENT: Indicates that events of the service data flow traffic shall be metered.
*/
#ifndef _OpenAPI_metering_method_H_
#define _OpenAPI_metering_method_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_metering_method_s OpenAPI_metering_method_t;
typedef struct OpenAPI_metering_method_s {
} OpenAPI_metering_method_t;
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
);
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method);
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON);
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method);
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_metering_method_H_ */

View File

@ -0,0 +1,209 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "packet_filter_info.h"
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
char *pack_filt_id,
char *pack_filt_cont,
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_t *flow_direction
)
{
OpenAPI_packet_filter_info_t *packet_filter_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_packet_filter_info_t));
if (!packet_filter_info_local_var) {
return NULL;
}
packet_filter_info_local_var->pack_filt_id = pack_filt_id;
packet_filter_info_local_var->pack_filt_cont = pack_filt_cont;
packet_filter_info_local_var->tos_traffic_class = tos_traffic_class;
packet_filter_info_local_var->spi = spi;
packet_filter_info_local_var->flow_label = flow_label;
packet_filter_info_local_var->flow_direction = flow_direction;
return packet_filter_info_local_var;
}
void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter_info)
{
if (NULL == packet_filter_info) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(packet_filter_info->pack_filt_id);
ogs_free(packet_filter_info->pack_filt_cont);
ogs_free(packet_filter_info->tos_traffic_class);
ogs_free(packet_filter_info->spi);
ogs_free(packet_filter_info->flow_label);
OpenAPI_flow_direction_free(packet_filter_info->flow_direction);
ogs_free(packet_filter_info);
}
cJSON *OpenAPI_packet_filter_info_convertToJSON(OpenAPI_packet_filter_info_t *packet_filter_info)
{
cJSON *item = NULL;
if (packet_filter_info == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [PacketFilterInfo]");
return NULL;
}
item = cJSON_CreateObject();
if (packet_filter_info->pack_filt_id) {
if (cJSON_AddStringToObject(item, "packFiltId", packet_filter_info->pack_filt_id) == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [pack_filt_id]");
goto end;
}
}
if (packet_filter_info->pack_filt_cont) {
if (cJSON_AddStringToObject(item, "packFiltCont", packet_filter_info->pack_filt_cont) == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [pack_filt_cont]");
goto end;
}
}
if (packet_filter_info->tos_traffic_class) {
if (cJSON_AddStringToObject(item, "tosTrafficClass", packet_filter_info->tos_traffic_class) == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [tos_traffic_class]");
goto end;
}
}
if (packet_filter_info->spi) {
if (cJSON_AddStringToObject(item, "spi", packet_filter_info->spi) == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [spi]");
goto end;
}
}
if (packet_filter_info->flow_label) {
if (cJSON_AddStringToObject(item, "flowLabel", packet_filter_info->flow_label) == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_label]");
goto end;
}
}
if (packet_filter_info->flow_direction) {
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_convertToJSON(packet_filter_info->flow_direction);
if (flow_direction_local_JSON == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
goto end;
}
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
goto end;
}
}
end:
return item;
}
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *packet_filter_infoJSON)
{
OpenAPI_packet_filter_info_t *packet_filter_info_local_var = NULL;
cJSON *pack_filt_id = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "packFiltId");
if (pack_filt_id) {
if (!cJSON_IsString(pack_filt_id)) {
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [pack_filt_id]");
goto end;
}
}
cJSON *pack_filt_cont = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "packFiltCont");
if (pack_filt_cont) {
if (!cJSON_IsString(pack_filt_cont)) {
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [pack_filt_cont]");
goto end;
}
}
cJSON *tos_traffic_class = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "tosTrafficClass");
if (tos_traffic_class) {
if (!cJSON_IsString(tos_traffic_class)) {
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [tos_traffic_class]");
goto end;
}
}
cJSON *spi = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "spi");
if (spi) {
if (!cJSON_IsString(spi)) {
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [spi]");
goto end;
}
}
cJSON *flow_label = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "flowLabel");
if (flow_label) {
if (!cJSON_IsString(flow_label)) {
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [flow_label]");
goto end;
}
}
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "flowDirection");
OpenAPI_flow_direction_t *flow_direction_local_nonprim = NULL;
if (flow_direction) {
flow_direction_local_nonprim = OpenAPI_flow_direction_parseFromJSON(flow_direction);
}
packet_filter_info_local_var = OpenAPI_packet_filter_info_create (
pack_filt_id ? ogs_strdup(pack_filt_id->valuestring) : NULL,
pack_filt_cont ? ogs_strdup(pack_filt_cont->valuestring) : NULL,
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
spi ? ogs_strdup(spi->valuestring) : NULL,
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
flow_direction ? flow_direction_local_nonprim : NULL
);
return packet_filter_info_local_var;
end:
return NULL;
}
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_copy(OpenAPI_packet_filter_info_t *dst, OpenAPI_packet_filter_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_packet_filter_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_packet_filter_info_free(dst);
dst = OpenAPI_packet_filter_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,49 @@
/*
* packet_filter_info.h
*
*
*/
#ifndef _OpenAPI_packet_filter_info_H_
#define _OpenAPI_packet_filter_info_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "flow_direction.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_packet_filter_info_s OpenAPI_packet_filter_info_t;
typedef struct OpenAPI_packet_filter_info_s {
char *pack_filt_id;
char *pack_filt_cont;
char *tos_traffic_class;
char *spi;
char *flow_label;
struct OpenAPI_flow_direction_s *flow_direction;
} OpenAPI_packet_filter_info_t;
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
char *pack_filt_id,
char *pack_filt_cont,
char *tos_traffic_class,
char *spi,
char *flow_label,
OpenAPI_flow_direction_t *flow_direction
);
void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter_info);
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *packet_filter_infoJSON);
cJSON *OpenAPI_packet_filter_info_convertToJSON(OpenAPI_packet_filter_info_t *packet_filter_info);
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_copy(OpenAPI_packet_filter_info_t *dst, OpenAPI_packet_filter_info_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_packet_filter_info_H_ */

View File

@ -0,0 +1,238 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "partial_success_report.h"
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
OpenAPI_failure_cause_t *failure_cause,
OpenAPI_list_t *rule_reports,
OpenAPI_list_t *sess_rule_reports,
OpenAPI_ue_camping_rep_t *ue_camping_rep
)
{
OpenAPI_partial_success_report_t *partial_success_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_partial_success_report_t));
if (!partial_success_report_local_var) {
return NULL;
}
partial_success_report_local_var->failure_cause = failure_cause;
partial_success_report_local_var->rule_reports = rule_reports;
partial_success_report_local_var->sess_rule_reports = sess_rule_reports;
partial_success_report_local_var->ue_camping_rep = ue_camping_rep;
return partial_success_report_local_var;
}
void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *partial_success_report)
{
if (NULL == partial_success_report) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_failure_cause_free(partial_success_report->failure_cause);
OpenAPI_list_for_each(partial_success_report->rule_reports, node) {
OpenAPI_rule_report_free(node->data);
}
OpenAPI_list_free(partial_success_report->rule_reports);
OpenAPI_list_for_each(partial_success_report->sess_rule_reports, node) {
OpenAPI_session_rule_report_free(node->data);
}
OpenAPI_list_free(partial_success_report->sess_rule_reports);
OpenAPI_ue_camping_rep_free(partial_success_report->ue_camping_rep);
ogs_free(partial_success_report);
}
cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_report_t *partial_success_report)
{
cJSON *item = NULL;
if (partial_success_report == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [PartialSuccessReport]");
return NULL;
}
item = cJSON_CreateObject();
if (!partial_success_report->failure_cause) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
goto end;
}
cJSON *failure_cause_local_JSON = OpenAPI_failure_cause_convertToJSON(partial_success_report->failure_cause);
if (failure_cause_local_JSON == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
goto end;
}
cJSON_AddItemToObject(item, "failureCause", failure_cause_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
goto end;
}
if (partial_success_report->rule_reports) {
cJSON *rule_reportsList = cJSON_AddArrayToObject(item, "ruleReports");
if (rule_reportsList == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [rule_reports]");
goto end;
}
OpenAPI_lnode_t *rule_reports_node;
if (partial_success_report->rule_reports) {
OpenAPI_list_for_each(partial_success_report->rule_reports, rule_reports_node) {
cJSON *itemLocal = OpenAPI_rule_report_convertToJSON(rule_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [rule_reports]");
goto end;
}
cJSON_AddItemToArray(rule_reportsList, itemLocal);
}
}
}
if (partial_success_report->sess_rule_reports) {
cJSON *sess_rule_reportsList = cJSON_AddArrayToObject(item, "sessRuleReports");
if (sess_rule_reportsList == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [sess_rule_reports]");
goto end;
}
OpenAPI_lnode_t *sess_rule_reports_node;
if (partial_success_report->sess_rule_reports) {
OpenAPI_list_for_each(partial_success_report->sess_rule_reports, sess_rule_reports_node) {
cJSON *itemLocal = OpenAPI_session_rule_report_convertToJSON(sess_rule_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [sess_rule_reports]");
goto end;
}
cJSON_AddItemToArray(sess_rule_reportsList, itemLocal);
}
}
}
if (partial_success_report->ue_camping_rep) {
cJSON *ue_camping_rep_local_JSON = OpenAPI_ue_camping_rep_convertToJSON(partial_success_report->ue_camping_rep);
if (ue_camping_rep_local_JSON == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [ue_camping_rep]");
goto end;
}
cJSON_AddItemToObject(item, "ueCampingRep", ue_camping_rep_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [ue_camping_rep]");
goto end;
}
}
end:
return item;
}
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(cJSON *partial_success_reportJSON)
{
OpenAPI_partial_success_report_t *partial_success_report_local_var = NULL;
cJSON *failure_cause = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "failureCause");
if (!failure_cause) {
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [failure_cause]");
goto end;
}
OpenAPI_failure_cause_t *failure_cause_local_nonprim = NULL;
failure_cause_local_nonprim = OpenAPI_failure_cause_parseFromJSON(failure_cause);
cJSON *rule_reports = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "ruleReports");
OpenAPI_list_t *rule_reportsList;
if (rule_reports) {
cJSON *rule_reports_local_nonprimitive;
if (!cJSON_IsArray(rule_reports)) {
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [rule_reports]");
goto end;
}
rule_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(rule_reports_local_nonprimitive, rule_reports ) {
if (!cJSON_IsObject(rule_reports_local_nonprimitive)) {
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [rule_reports]");
goto end;
}
OpenAPI_rule_report_t *rule_reportsItem = OpenAPI_rule_report_parseFromJSON(rule_reports_local_nonprimitive);
OpenAPI_list_add(rule_reportsList, rule_reportsItem);
}
}
cJSON *sess_rule_reports = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "sessRuleReports");
OpenAPI_list_t *sess_rule_reportsList;
if (sess_rule_reports) {
cJSON *sess_rule_reports_local_nonprimitive;
if (!cJSON_IsArray(sess_rule_reports)) {
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [sess_rule_reports]");
goto end;
}
sess_rule_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(sess_rule_reports_local_nonprimitive, sess_rule_reports ) {
if (!cJSON_IsObject(sess_rule_reports_local_nonprimitive)) {
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [sess_rule_reports]");
goto end;
}
OpenAPI_session_rule_report_t *sess_rule_reportsItem = OpenAPI_session_rule_report_parseFromJSON(sess_rule_reports_local_nonprimitive);
OpenAPI_list_add(sess_rule_reportsList, sess_rule_reportsItem);
}
}
cJSON *ue_camping_rep = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "ueCampingRep");
OpenAPI_ue_camping_rep_t *ue_camping_rep_local_nonprim = NULL;
if (ue_camping_rep) {
ue_camping_rep_local_nonprim = OpenAPI_ue_camping_rep_parseFromJSON(ue_camping_rep);
}
partial_success_report_local_var = OpenAPI_partial_success_report_create (
failure_cause_local_nonprim,
rule_reports ? rule_reportsList : NULL,
sess_rule_reports ? sess_rule_reportsList : NULL,
ue_camping_rep ? ue_camping_rep_local_nonprim : NULL
);
return partial_success_report_local_var;
end:
return NULL;
}
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_copy(OpenAPI_partial_success_report_t *dst, OpenAPI_partial_success_report_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_partial_success_report_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_partial_success_report_free(dst);
dst = OpenAPI_partial_success_report_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,48 @@
/*
* partial_success_report.h
*
*
*/
#ifndef _OpenAPI_partial_success_report_H_
#define _OpenAPI_partial_success_report_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "failure_cause.h"
#include "rule_report.h"
#include "session_rule_report.h"
#include "ue_camping_rep.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_partial_success_report_s OpenAPI_partial_success_report_t;
typedef struct OpenAPI_partial_success_report_s {
struct OpenAPI_failure_cause_s *failure_cause;
OpenAPI_list_t *rule_reports;
OpenAPI_list_t *sess_rule_reports;
struct OpenAPI_ue_camping_rep_s *ue_camping_rep;
} OpenAPI_partial_success_report_t;
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
OpenAPI_failure_cause_t *failure_cause,
OpenAPI_list_t *rule_reports,
OpenAPI_list_t *sess_rule_reports,
OpenAPI_ue_camping_rep_t *ue_camping_rep
);
void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *partial_success_report);
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(cJSON *partial_success_reportJSON);
cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_report_t *partial_success_report);
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_copy(OpenAPI_partial_success_report_t *dst, OpenAPI_partial_success_report_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_partial_success_report_H_ */

View File

@ -0,0 +1,692 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pcc_rule.h"
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
OpenAPI_list_t *flow_infos,
char *app_id,
int cont_ver,
char *pcc_rule_id,
int precedence,
OpenAPI_af_sig_protocol_t *af_sig_protocol,
int app_reloc,
OpenAPI_list_t *ref_qos_data,
OpenAPI_list_t *ref_alt_qos_params,
OpenAPI_list_t *ref_tc_data,
OpenAPI_list_t *ref_chg_data,
OpenAPI_list_t *ref_chg_n3g_data,
OpenAPI_list_t *ref_um_data,
OpenAPI_list_t *ref_um_n3g_data,
char *ref_cond_data,
OpenAPI_list_t *ref_qos_mon,
int addr_preser_ind,
OpenAPI_tscai_input_container_t *tscai_input_dl,
OpenAPI_tscai_input_container_t *tscai_input_ul
)
{
OpenAPI_pcc_rule_t *pcc_rule_local_var = OpenAPI_malloc(sizeof(OpenAPI_pcc_rule_t));
if (!pcc_rule_local_var) {
return NULL;
}
pcc_rule_local_var->flow_infos = flow_infos;
pcc_rule_local_var->app_id = app_id;
pcc_rule_local_var->cont_ver = cont_ver;
pcc_rule_local_var->pcc_rule_id = pcc_rule_id;
pcc_rule_local_var->precedence = precedence;
pcc_rule_local_var->af_sig_protocol = af_sig_protocol;
pcc_rule_local_var->app_reloc = app_reloc;
pcc_rule_local_var->ref_qos_data = ref_qos_data;
pcc_rule_local_var->ref_alt_qos_params = ref_alt_qos_params;
pcc_rule_local_var->ref_tc_data = ref_tc_data;
pcc_rule_local_var->ref_chg_data = ref_chg_data;
pcc_rule_local_var->ref_chg_n3g_data = ref_chg_n3g_data;
pcc_rule_local_var->ref_um_data = ref_um_data;
pcc_rule_local_var->ref_um_n3g_data = ref_um_n3g_data;
pcc_rule_local_var->ref_cond_data = ref_cond_data;
pcc_rule_local_var->ref_qos_mon = ref_qos_mon;
pcc_rule_local_var->addr_preser_ind = addr_preser_ind;
pcc_rule_local_var->tscai_input_dl = tscai_input_dl;
pcc_rule_local_var->tscai_input_ul = tscai_input_ul;
return pcc_rule_local_var;
}
void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule)
{
if (NULL == pcc_rule) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(pcc_rule->flow_infos, node) {
OpenAPI_flow_information_free(node->data);
}
OpenAPI_list_free(pcc_rule->flow_infos);
ogs_free(pcc_rule->app_id);
ogs_free(pcc_rule->pcc_rule_id);
OpenAPI_af_sig_protocol_free(pcc_rule->af_sig_protocol);
OpenAPI_list_for_each(pcc_rule->ref_qos_data, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_qos_data);
OpenAPI_list_for_each(pcc_rule->ref_alt_qos_params, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_alt_qos_params);
OpenAPI_list_for_each(pcc_rule->ref_tc_data, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_tc_data);
OpenAPI_list_for_each(pcc_rule->ref_chg_data, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_chg_data);
OpenAPI_list_for_each(pcc_rule->ref_chg_n3g_data, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_chg_n3g_data);
OpenAPI_list_for_each(pcc_rule->ref_um_data, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_um_data);
OpenAPI_list_for_each(pcc_rule->ref_um_n3g_data, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_um_n3g_data);
ogs_free(pcc_rule->ref_cond_data);
OpenAPI_list_for_each(pcc_rule->ref_qos_mon, node) {
ogs_free(node->data);
}
OpenAPI_list_free(pcc_rule->ref_qos_mon);
OpenAPI_tscai_input_container_free(pcc_rule->tscai_input_dl);
OpenAPI_tscai_input_container_free(pcc_rule->tscai_input_ul);
ogs_free(pcc_rule);
}
cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule)
{
cJSON *item = NULL;
if (pcc_rule == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [PccRule]");
return NULL;
}
item = cJSON_CreateObject();
if (pcc_rule->flow_infos) {
cJSON *flow_infosList = cJSON_AddArrayToObject(item, "flowInfos");
if (flow_infosList == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [flow_infos]");
goto end;
}
OpenAPI_lnode_t *flow_infos_node;
if (pcc_rule->flow_infos) {
OpenAPI_list_for_each(pcc_rule->flow_infos, flow_infos_node) {
cJSON *itemLocal = OpenAPI_flow_information_convertToJSON(flow_infos_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [flow_infos]");
goto end;
}
cJSON_AddItemToArray(flow_infosList, itemLocal);
}
}
}
if (pcc_rule->app_id) {
if (cJSON_AddStringToObject(item, "appId", pcc_rule->app_id) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [app_id]");
goto end;
}
}
if (pcc_rule->cont_ver) {
if (cJSON_AddNumberToObject(item, "contVer", pcc_rule->cont_ver) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [cont_ver]");
goto end;
}
}
if (!pcc_rule->pcc_rule_id) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [pcc_rule_id]");
goto end;
}
if (cJSON_AddStringToObject(item, "pccRuleId", pcc_rule->pcc_rule_id) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [pcc_rule_id]");
goto end;
}
if (pcc_rule->precedence) {
if (cJSON_AddNumberToObject(item, "precedence", pcc_rule->precedence) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [precedence]");
goto end;
}
}
if (pcc_rule->af_sig_protocol) {
cJSON *af_sig_protocol_local_JSON = OpenAPI_af_sig_protocol_convertToJSON(pcc_rule->af_sig_protocol);
if (af_sig_protocol_local_JSON == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
goto end;
}
cJSON_AddItemToObject(item, "afSigProtocol", af_sig_protocol_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
goto end;
}
}
if (pcc_rule->app_reloc) {
if (cJSON_AddBoolToObject(item, "appReloc", pcc_rule->app_reloc) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [app_reloc]");
goto end;
}
}
if (pcc_rule->ref_qos_data) {
cJSON *ref_qos_data = cJSON_AddArrayToObject(item, "refQosData");
if (ref_qos_data == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_data]");
goto end;
}
OpenAPI_lnode_t *ref_qos_data_node;
OpenAPI_list_for_each(pcc_rule->ref_qos_data, ref_qos_data_node) {
if (cJSON_AddStringToObject(ref_qos_data, "", (char*)ref_qos_data_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_data]");
goto end;
}
}
}
if (pcc_rule->ref_alt_qos_params) {
cJSON *ref_alt_qos_params = cJSON_AddArrayToObject(item, "refAltQosParams");
if (ref_alt_qos_params == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_alt_qos_params]");
goto end;
}
OpenAPI_lnode_t *ref_alt_qos_params_node;
OpenAPI_list_for_each(pcc_rule->ref_alt_qos_params, ref_alt_qos_params_node) {
if (cJSON_AddStringToObject(ref_alt_qos_params, "", (char*)ref_alt_qos_params_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_alt_qos_params]");
goto end;
}
}
}
if (pcc_rule->ref_tc_data) {
cJSON *ref_tc_data = cJSON_AddArrayToObject(item, "refTcData");
if (ref_tc_data == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_tc_data]");
goto end;
}
OpenAPI_lnode_t *ref_tc_data_node;
OpenAPI_list_for_each(pcc_rule->ref_tc_data, ref_tc_data_node) {
if (cJSON_AddStringToObject(ref_tc_data, "", (char*)ref_tc_data_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_tc_data]");
goto end;
}
}
}
if (pcc_rule->ref_chg_data) {
cJSON *ref_chg_data = cJSON_AddArrayToObject(item, "refChgData");
if (ref_chg_data == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_data]");
goto end;
}
OpenAPI_lnode_t *ref_chg_data_node;
OpenAPI_list_for_each(pcc_rule->ref_chg_data, ref_chg_data_node) {
if (cJSON_AddStringToObject(ref_chg_data, "", (char*)ref_chg_data_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_data]");
goto end;
}
}
}
if (pcc_rule->ref_chg_n3g_data) {
cJSON *ref_chg_n3g_data = cJSON_AddArrayToObject(item, "refChgN3gData");
if (ref_chg_n3g_data == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_n3g_data]");
goto end;
}
OpenAPI_lnode_t *ref_chg_n3g_data_node;
OpenAPI_list_for_each(pcc_rule->ref_chg_n3g_data, ref_chg_n3g_data_node) {
if (cJSON_AddStringToObject(ref_chg_n3g_data, "", (char*)ref_chg_n3g_data_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_chg_n3g_data]");
goto end;
}
}
}
if (pcc_rule->ref_um_data) {
cJSON *ref_um_data = cJSON_AddArrayToObject(item, "refUmData");
if (ref_um_data == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_data]");
goto end;
}
OpenAPI_lnode_t *ref_um_data_node;
OpenAPI_list_for_each(pcc_rule->ref_um_data, ref_um_data_node) {
if (cJSON_AddStringToObject(ref_um_data, "", (char*)ref_um_data_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_data]");
goto end;
}
}
}
if (pcc_rule->ref_um_n3g_data) {
cJSON *ref_um_n3g_data = cJSON_AddArrayToObject(item, "refUmN3gData");
if (ref_um_n3g_data == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_n3g_data]");
goto end;
}
OpenAPI_lnode_t *ref_um_n3g_data_node;
OpenAPI_list_for_each(pcc_rule->ref_um_n3g_data, ref_um_n3g_data_node) {
if (cJSON_AddStringToObject(ref_um_n3g_data, "", (char*)ref_um_n3g_data_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_um_n3g_data]");
goto end;
}
}
}
if (pcc_rule->ref_cond_data) {
if (cJSON_AddStringToObject(item, "refCondData", pcc_rule->ref_cond_data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_cond_data]");
goto end;
}
}
if (pcc_rule->ref_qos_mon) {
cJSON *ref_qos_mon = cJSON_AddArrayToObject(item, "refQosMon");
if (ref_qos_mon == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_mon]");
goto end;
}
OpenAPI_lnode_t *ref_qos_mon_node;
OpenAPI_list_for_each(pcc_rule->ref_qos_mon, ref_qos_mon_node) {
if (cJSON_AddStringToObject(ref_qos_mon, "", (char*)ref_qos_mon_node->data) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [ref_qos_mon]");
goto end;
}
}
}
if (pcc_rule->addr_preser_ind) {
if (cJSON_AddBoolToObject(item, "addrPreserInd", pcc_rule->addr_preser_ind) == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [addr_preser_ind]");
goto end;
}
}
if (pcc_rule->tscai_input_dl) {
cJSON *tscai_input_dl_local_JSON = OpenAPI_tscai_input_container_convertToJSON(pcc_rule->tscai_input_dl);
if (tscai_input_dl_local_JSON == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_dl]");
goto end;
}
cJSON_AddItemToObject(item, "tscaiInputDl", tscai_input_dl_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_dl]");
goto end;
}
}
if (pcc_rule->tscai_input_ul) {
cJSON *tscai_input_ul_local_JSON = OpenAPI_tscai_input_container_convertToJSON(pcc_rule->tscai_input_ul);
if (tscai_input_ul_local_JSON == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_ul]");
goto end;
}
cJSON_AddItemToObject(item, "tscaiInputUl", tscai_input_ul_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [tscai_input_ul]");
goto end;
}
}
end:
return item;
}
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON)
{
OpenAPI_pcc_rule_t *pcc_rule_local_var = NULL;
cJSON *flow_infos = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "flowInfos");
OpenAPI_list_t *flow_infosList;
if (flow_infos) {
cJSON *flow_infos_local_nonprimitive;
if (!cJSON_IsArray(flow_infos)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [flow_infos]");
goto end;
}
flow_infosList = OpenAPI_list_create();
cJSON_ArrayForEach(flow_infos_local_nonprimitive, flow_infos ) {
if (!cJSON_IsObject(flow_infos_local_nonprimitive)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [flow_infos]");
goto end;
}
OpenAPI_flow_information_t *flow_infosItem = OpenAPI_flow_information_parseFromJSON(flow_infos_local_nonprimitive);
OpenAPI_list_add(flow_infosList, flow_infosItem);
}
}
cJSON *app_id = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "appId");
if (app_id) {
if (!cJSON_IsString(app_id)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [app_id]");
goto end;
}
}
cJSON *cont_ver = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "contVer");
if (cont_ver) {
if (!cJSON_IsNumber(cont_ver)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [cont_ver]");
goto end;
}
}
cJSON *pcc_rule_id = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "pccRuleId");
if (!pcc_rule_id) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [pcc_rule_id]");
goto end;
}
if (!cJSON_IsString(pcc_rule_id)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [pcc_rule_id]");
goto end;
}
cJSON *precedence = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "precedence");
if (precedence) {
if (!cJSON_IsNumber(precedence)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [precedence]");
goto end;
}
}
cJSON *af_sig_protocol = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "afSigProtocol");
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_nonprim = NULL;
if (af_sig_protocol) {
af_sig_protocol_local_nonprim = OpenAPI_af_sig_protocol_parseFromJSON(af_sig_protocol);
}
cJSON *app_reloc = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "appReloc");
if (app_reloc) {
if (!cJSON_IsBool(app_reloc)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [app_reloc]");
goto end;
}
}
cJSON *ref_qos_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refQosData");
OpenAPI_list_t *ref_qos_dataList;
if (ref_qos_data) {
cJSON *ref_qos_data_local;
if (!cJSON_IsArray(ref_qos_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_data]");
goto end;
}
ref_qos_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_qos_data_local, ref_qos_data) {
if (!cJSON_IsString(ref_qos_data_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_data]");
goto end;
}
OpenAPI_list_add(ref_qos_dataList, ogs_strdup(ref_qos_data_local->valuestring));
}
}
cJSON *ref_alt_qos_params = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refAltQosParams");
OpenAPI_list_t *ref_alt_qos_paramsList;
if (ref_alt_qos_params) {
cJSON *ref_alt_qos_params_local;
if (!cJSON_IsArray(ref_alt_qos_params)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_alt_qos_params]");
goto end;
}
ref_alt_qos_paramsList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_alt_qos_params_local, ref_alt_qos_params) {
if (!cJSON_IsString(ref_alt_qos_params_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_alt_qos_params]");
goto end;
}
OpenAPI_list_add(ref_alt_qos_paramsList, ogs_strdup(ref_alt_qos_params_local->valuestring));
}
}
cJSON *ref_tc_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refTcData");
OpenAPI_list_t *ref_tc_dataList;
if (ref_tc_data) {
cJSON *ref_tc_data_local;
if (!cJSON_IsArray(ref_tc_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_tc_data]");
goto end;
}
ref_tc_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_tc_data_local, ref_tc_data) {
if (!cJSON_IsString(ref_tc_data_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_tc_data]");
goto end;
}
OpenAPI_list_add(ref_tc_dataList, ogs_strdup(ref_tc_data_local->valuestring));
}
}
cJSON *ref_chg_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refChgData");
OpenAPI_list_t *ref_chg_dataList;
if (ref_chg_data) {
cJSON *ref_chg_data_local;
if (!cJSON_IsArray(ref_chg_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_data]");
goto end;
}
ref_chg_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_chg_data_local, ref_chg_data) {
if (!cJSON_IsString(ref_chg_data_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_data]");
goto end;
}
OpenAPI_list_add(ref_chg_dataList, ogs_strdup(ref_chg_data_local->valuestring));
}
}
cJSON *ref_chg_n3g_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refChgN3gData");
OpenAPI_list_t *ref_chg_n3g_dataList;
if (ref_chg_n3g_data) {
cJSON *ref_chg_n3g_data_local;
if (!cJSON_IsArray(ref_chg_n3g_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_n3g_data]");
goto end;
}
ref_chg_n3g_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_chg_n3g_data_local, ref_chg_n3g_data) {
if (!cJSON_IsString(ref_chg_n3g_data_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_chg_n3g_data]");
goto end;
}
OpenAPI_list_add(ref_chg_n3g_dataList, ogs_strdup(ref_chg_n3g_data_local->valuestring));
}
}
cJSON *ref_um_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refUmData");
OpenAPI_list_t *ref_um_dataList;
if (ref_um_data) {
cJSON *ref_um_data_local;
if (!cJSON_IsArray(ref_um_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_data]");
goto end;
}
ref_um_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_um_data_local, ref_um_data) {
if (!cJSON_IsString(ref_um_data_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_data]");
goto end;
}
OpenAPI_list_add(ref_um_dataList, ogs_strdup(ref_um_data_local->valuestring));
}
}
cJSON *ref_um_n3g_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refUmN3gData");
OpenAPI_list_t *ref_um_n3g_dataList;
if (ref_um_n3g_data) {
cJSON *ref_um_n3g_data_local;
if (!cJSON_IsArray(ref_um_n3g_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_n3g_data]");
goto end;
}
ref_um_n3g_dataList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_um_n3g_data_local, ref_um_n3g_data) {
if (!cJSON_IsString(ref_um_n3g_data_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_um_n3g_data]");
goto end;
}
OpenAPI_list_add(ref_um_n3g_dataList, ogs_strdup(ref_um_n3g_data_local->valuestring));
}
}
cJSON *ref_cond_data = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refCondData");
if (ref_cond_data) {
if (!cJSON_IsString(ref_cond_data)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_cond_data]");
goto end;
}
}
cJSON *ref_qos_mon = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "refQosMon");
OpenAPI_list_t *ref_qos_monList;
if (ref_qos_mon) {
cJSON *ref_qos_mon_local;
if (!cJSON_IsArray(ref_qos_mon)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_mon]");
goto end;
}
ref_qos_monList = OpenAPI_list_create();
cJSON_ArrayForEach(ref_qos_mon_local, ref_qos_mon) {
if (!cJSON_IsString(ref_qos_mon_local)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [ref_qos_mon]");
goto end;
}
OpenAPI_list_add(ref_qos_monList, ogs_strdup(ref_qos_mon_local->valuestring));
}
}
cJSON *addr_preser_ind = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "addrPreserInd");
if (addr_preser_ind) {
if (!cJSON_IsBool(addr_preser_ind)) {
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [addr_preser_ind]");
goto end;
}
}
cJSON *tscai_input_dl = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "tscaiInputDl");
OpenAPI_tscai_input_container_t *tscai_input_dl_local_nonprim = NULL;
if (tscai_input_dl) {
tscai_input_dl_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_dl);
}
cJSON *tscai_input_ul = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "tscaiInputUl");
OpenAPI_tscai_input_container_t *tscai_input_ul_local_nonprim = NULL;
if (tscai_input_ul) {
tscai_input_ul_local_nonprim = OpenAPI_tscai_input_container_parseFromJSON(tscai_input_ul);
}
pcc_rule_local_var = OpenAPI_pcc_rule_create (
flow_infos ? flow_infosList : NULL,
app_id ? ogs_strdup(app_id->valuestring) : NULL,
cont_ver ? cont_ver->valuedouble : 0,
ogs_strdup(pcc_rule_id->valuestring),
precedence ? precedence->valuedouble : 0,
af_sig_protocol ? af_sig_protocol_local_nonprim : NULL,
app_reloc ? app_reloc->valueint : 0,
ref_qos_data ? ref_qos_dataList : NULL,
ref_alt_qos_params ? ref_alt_qos_paramsList : NULL,
ref_tc_data ? ref_tc_dataList : NULL,
ref_chg_data ? ref_chg_dataList : NULL,
ref_chg_n3g_data ? ref_chg_n3g_dataList : NULL,
ref_um_data ? ref_um_dataList : NULL,
ref_um_n3g_data ? ref_um_n3g_dataList : NULL,
ref_cond_data ? ogs_strdup(ref_cond_data->valuestring) : NULL,
ref_qos_mon ? ref_qos_monList : NULL,
addr_preser_ind ? addr_preser_ind->valueint : 0,
tscai_input_dl ? tscai_input_dl_local_nonprim : NULL,
tscai_input_ul ? tscai_input_ul_local_nonprim : NULL
);
return pcc_rule_local_var;
end:
return NULL;
}
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_copy(OpenAPI_pcc_rule_t *dst, OpenAPI_pcc_rule_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_pcc_rule_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_pcc_rule_free(dst);
dst = OpenAPI_pcc_rule_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,77 @@
/*
* pcc_rule.h
*
*
*/
#ifndef _OpenAPI_pcc_rule_H_
#define _OpenAPI_pcc_rule_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_sig_protocol.h"
#include "flow_information.h"
#include "tscai_input_container.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_pcc_rule_s OpenAPI_pcc_rule_t;
typedef struct OpenAPI_pcc_rule_s {
OpenAPI_list_t *flow_infos;
char *app_id;
int cont_ver;
char *pcc_rule_id;
int precedence;
struct OpenAPI_af_sig_protocol_s *af_sig_protocol;
int app_reloc;
OpenAPI_list_t *ref_qos_data;
OpenAPI_list_t *ref_alt_qos_params;
OpenAPI_list_t *ref_tc_data;
OpenAPI_list_t *ref_chg_data;
OpenAPI_list_t *ref_chg_n3g_data;
OpenAPI_list_t *ref_um_data;
OpenAPI_list_t *ref_um_n3g_data;
char *ref_cond_data;
OpenAPI_list_t *ref_qos_mon;
int addr_preser_ind;
struct OpenAPI_tscai_input_container_s *tscai_input_dl;
struct OpenAPI_tscai_input_container_s *tscai_input_ul;
} OpenAPI_pcc_rule_t;
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
OpenAPI_list_t *flow_infos,
char *app_id,
int cont_ver,
char *pcc_rule_id,
int precedence,
OpenAPI_af_sig_protocol_t *af_sig_protocol,
int app_reloc,
OpenAPI_list_t *ref_qos_data,
OpenAPI_list_t *ref_alt_qos_params,
OpenAPI_list_t *ref_tc_data,
OpenAPI_list_t *ref_chg_data,
OpenAPI_list_t *ref_chg_n3g_data,
OpenAPI_list_t *ref_um_data,
OpenAPI_list_t *ref_um_n3g_data,
char *ref_cond_data,
OpenAPI_list_t *ref_qos_mon,
int addr_preser_ind,
OpenAPI_tscai_input_container_t *tscai_input_dl,
OpenAPI_tscai_input_container_t *tscai_input_ul
);
void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule);
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON);
cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule);
OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_copy(OpenAPI_pcc_rule_t *dst, OpenAPI_pcc_rule_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_pcc_rule_H_ */

View File

@ -58,7 +58,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create(
int ma_request_ind,
int ma_nw_upgrade_ind,
OpenAPI_list_t *dnai_list,
OpenAPI_presence_state_t *presence_in_ladn,
OpenAPI_presence_state_e presence_in_ladn,
OpenAPI_list_t *secondary_rat_usage_info,
OpenAPI_small_data_rate_status_t *small_data_rate_status,
OpenAPI_apn_rate_status_t *apn_rate_status,
@ -179,7 +179,6 @@ void OpenAPI_pdu_session_create_data_free(OpenAPI_pdu_session_create_data_t *pdu
ogs_free(node->data);
}
OpenAPI_list_free(pdu_session_create_data->dnai_list);
OpenAPI_presence_state_free(pdu_session_create_data->presence_in_ladn);
OpenAPI_list_for_each(pdu_session_create_data->secondary_rat_usage_info, node) {
OpenAPI_secondary_rat_usage_info_free(node->data);
}
@ -667,13 +666,7 @@ cJSON *OpenAPI_pdu_session_create_data_convertToJSON(OpenAPI_pdu_session_create_
}
if (pdu_session_create_data->presence_in_ladn) {
cJSON *presence_in_ladn_local_JSON = OpenAPI_presence_state_convertToJSON(pdu_session_create_data->presence_in_ladn);
if (presence_in_ladn_local_JSON == NULL) {
ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [presence_in_ladn]");
goto end;
}
cJSON_AddItemToObject(item, "presenceInLadn", presence_in_ladn_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "presenceInLadn", OpenAPI_presence_state_ToString(pdu_session_create_data->presence_in_ladn)) == NULL) {
ogs_error("OpenAPI_pdu_session_create_data_convertToJSON() failed [presence_in_ladn]");
goto end;
}
@ -1237,9 +1230,13 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON
cJSON *presence_in_ladn = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "presenceInLadn");
OpenAPI_presence_state_t *presence_in_ladn_local_nonprim = NULL;
OpenAPI_presence_state_e presence_in_ladnVariable;
if (presence_in_ladn) {
presence_in_ladn_local_nonprim = OpenAPI_presence_state_parseFromJSON(presence_in_ladn);
if (!cJSON_IsString(presence_in_ladn)) {
ogs_error("OpenAPI_pdu_session_create_data_parseFromJSON() failed [presence_in_ladn]");
goto end;
}
presence_in_ladnVariable = OpenAPI_presence_state_FromString(presence_in_ladn->valuestring);
}
cJSON *secondary_rat_usage_info = cJSON_GetObjectItemCaseSensitive(pdu_session_create_dataJSON, "secondaryRatUsageInfo");
@ -1342,7 +1339,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_parseFromJSON
ma_request_ind ? ma_request_ind->valueint : 0,
ma_nw_upgrade_ind ? ma_nw_upgrade_ind->valueint : 0,
dnai_list ? dnai_listList : NULL,
presence_in_ladn ? presence_in_ladn_local_nonprim : NULL,
presence_in_ladn ? presence_in_ladnVariable : 0,
secondary_rat_usage_info ? secondary_rat_usage_infoList : NULL,
small_data_rate_status ? small_data_rate_status_local_nonprim : NULL,
apn_rate_status ? apn_rate_status_local_nonprim : NULL,

View File

@ -88,7 +88,7 @@ typedef struct OpenAPI_pdu_session_create_data_s {
int ma_request_ind;
int ma_nw_upgrade_ind;
OpenAPI_list_t *dnai_list;
struct OpenAPI_presence_state_s *presence_in_ladn;
OpenAPI_presence_state_e presence_in_ladn;
OpenAPI_list_t *secondary_rat_usage_info;
struct OpenAPI_small_data_rate_status_s *small_data_rate_status;
struct OpenAPI_apn_rate_status_s *apn_rate_status;
@ -149,7 +149,7 @@ OpenAPI_pdu_session_create_data_t *OpenAPI_pdu_session_create_data_create(
int ma_request_ind,
int ma_nw_upgrade_ind,
OpenAPI_list_t *dnai_list,
OpenAPI_presence_state_t *presence_in_ladn,
OpenAPI_presence_state_e presence_in_ladn,
OpenAPI_list_t *secondary_rat_usage_info,
OpenAPI_small_data_rate_status_t *small_data_rate_status,
OpenAPI_apn_rate_status_t *apn_rate_status,

View File

@ -0,0 +1,85 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "pdu_session_rel_cause.h"
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_create(
)
{
OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_pdu_session_rel_cause_t));
if (!pdu_session_rel_cause_local_var) {
return NULL;
}
return pdu_session_rel_cause_local_var;
}
void OpenAPI_pdu_session_rel_cause_free(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause)
{
if (NULL == pdu_session_rel_cause) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(pdu_session_rel_cause);
}
cJSON *OpenAPI_pdu_session_rel_cause_convertToJSON(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause)
{
cJSON *item = NULL;
if (pdu_session_rel_cause == NULL) {
ogs_error("OpenAPI_pdu_session_rel_cause_convertToJSON() failed [PduSessionRelCause]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_parseFromJSON(cJSON *pdu_session_rel_causeJSON)
{
OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause_local_var = NULL;
pdu_session_rel_cause_local_var = OpenAPI_pdu_session_rel_cause_create (
);
return pdu_session_rel_cause_local_var;
end:
return NULL;
}
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_copy(OpenAPI_pdu_session_rel_cause_t *dst, OpenAPI_pdu_session_rel_cause_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_pdu_session_rel_cause_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_pdu_session_rel_cause_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_pdu_session_rel_cause_free(dst);
dst = OpenAPI_pdu_session_rel_cause_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,36 @@
/*
* pdu_session_rel_cause.h
*
*
*/
#ifndef _OpenAPI_pdu_session_rel_cause_H_
#define _OpenAPI_pdu_session_rel_cause_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_pdu_session_rel_cause_s OpenAPI_pdu_session_rel_cause_t;
typedef struct OpenAPI_pdu_session_rel_cause_s {
} OpenAPI_pdu_session_rel_cause_t;
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_create(
);
void OpenAPI_pdu_session_rel_cause_free(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause);
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_parseFromJSON(cJSON *pdu_session_rel_causeJSON);
cJSON *OpenAPI_pdu_session_rel_cause_convertToJSON(OpenAPI_pdu_session_rel_cause_t *pdu_session_rel_cause);
OpenAPI_pdu_session_rel_cause_t *OpenAPI_pdu_session_rel_cause_copy(OpenAPI_pdu_session_rel_cause_t *dst, OpenAPI_pdu_session_rel_cause_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_pdu_session_rel_cause_H_ */

View File

@ -0,0 +1,367 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "policy_association.h"
OpenAPI_policy_association_t *OpenAPI_policy_association_create(
OpenAPI_policy_association_request_t *request,
OpenAPI_list_t *triggers,
OpenAPI_service_area_restriction_t *serv_area_res,
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
int rfsp,
OpenAPI_smf_selection_data_t *smf_sel_info,
OpenAPI_ambr_t *ue_ambr,
OpenAPI_ambr_t *rg_tmbr,
OpenAPI_list_t* pras,
char *supp_feat
)
{
OpenAPI_policy_association_t *policy_association_local_var = OpenAPI_malloc(sizeof(OpenAPI_policy_association_t));
if (!policy_association_local_var) {
return NULL;
}
policy_association_local_var->request = request;
policy_association_local_var->triggers = triggers;
policy_association_local_var->serv_area_res = serv_area_res;
policy_association_local_var->wl_serv_area_res = wl_serv_area_res;
policy_association_local_var->rfsp = rfsp;
policy_association_local_var->smf_sel_info = smf_sel_info;
policy_association_local_var->ue_ambr = ue_ambr;
policy_association_local_var->rg_tmbr = rg_tmbr;
policy_association_local_var->pras = pras;
policy_association_local_var->supp_feat = supp_feat;
return policy_association_local_var;
}
void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_association)
{
if (NULL == policy_association) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_policy_association_request_free(policy_association->request);
OpenAPI_list_free(policy_association->triggers);
OpenAPI_service_area_restriction_free(policy_association->serv_area_res);
OpenAPI_wireline_service_area_restriction_free(policy_association->wl_serv_area_res);
OpenAPI_smf_selection_data_free(policy_association->smf_sel_info);
OpenAPI_ambr_free(policy_association->ue_ambr);
OpenAPI_ambr_free(policy_association->rg_tmbr);
OpenAPI_list_for_each(policy_association->pras, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_presence_info_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(policy_association->pras);
ogs_free(policy_association->supp_feat);
ogs_free(policy_association);
}
cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *policy_association)
{
cJSON *item = NULL;
if (policy_association == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [PolicyAssociation]");
return NULL;
}
item = cJSON_CreateObject();
if (policy_association->request) {
cJSON *request_local_JSON = OpenAPI_policy_association_request_convertToJSON(policy_association->request);
if (request_local_JSON == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [request]");
goto end;
}
cJSON_AddItemToObject(item, "request", request_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [request]");
goto end;
}
}
if (policy_association->triggers) {
cJSON *triggers = cJSON_AddArrayToObject(item, "triggers");
if (triggers == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [triggers]");
goto end;
}
OpenAPI_lnode_t *triggers_node;
OpenAPI_list_for_each(policy_association->triggers, triggers_node) {
if (cJSON_AddStringToObject(triggers, "", OpenAPI_request_trigger_ToString((OpenAPI_request_trigger_e)triggers_node->data)) == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [triggers]");
goto end;
}
}
}
if (policy_association->serv_area_res) {
cJSON *serv_area_res_local_JSON = OpenAPI_service_area_restriction_convertToJSON(policy_association->serv_area_res);
if (serv_area_res_local_JSON == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [serv_area_res]");
goto end;
}
cJSON_AddItemToObject(item, "servAreaRes", serv_area_res_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [serv_area_res]");
goto end;
}
}
if (policy_association->wl_serv_area_res) {
cJSON *wl_serv_area_res_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(policy_association->wl_serv_area_res);
if (wl_serv_area_res_local_JSON == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [wl_serv_area_res]");
goto end;
}
cJSON_AddItemToObject(item, "wlServAreaRes", wl_serv_area_res_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [wl_serv_area_res]");
goto end;
}
}
if (policy_association->rfsp) {
if (cJSON_AddNumberToObject(item, "rfsp", policy_association->rfsp) == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [rfsp]");
goto end;
}
}
if (policy_association->smf_sel_info) {
cJSON *smf_sel_info_local_JSON = OpenAPI_smf_selection_data_convertToJSON(policy_association->smf_sel_info);
if (smf_sel_info_local_JSON == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [smf_sel_info]");
goto end;
}
cJSON_AddItemToObject(item, "smfSelInfo", smf_sel_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [smf_sel_info]");
goto end;
}
}
if (policy_association->ue_ambr) {
cJSON *ue_ambr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association->ue_ambr);
if (ue_ambr_local_JSON == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [ue_ambr]");
goto end;
}
cJSON_AddItemToObject(item, "ueAmbr", ue_ambr_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [ue_ambr]");
goto end;
}
}
if (policy_association->rg_tmbr) {
cJSON *rg_tmbr_local_JSON = OpenAPI_ambr_convertToJSON(policy_association->rg_tmbr);
if (rg_tmbr_local_JSON == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [rg_tmbr]");
goto end;
}
cJSON_AddItemToObject(item, "rgTmbr", rg_tmbr_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [rg_tmbr]");
goto end;
}
}
if (policy_association->pras) {
cJSON *pras = cJSON_AddObjectToObject(item, "pras");
if (pras == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [pras]");
goto end;
}
cJSON *localMapObject = pras;
OpenAPI_lnode_t *pras_node;
if (policy_association->pras) {
OpenAPI_list_for_each(policy_association->pras, pras_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pras_node->data;
cJSON *itemLocal = OpenAPI_presence_info_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [pras]");
goto end;
}
cJSON_AddItemToObject(pras, localKeyValue->key, itemLocal);
}
}
}
if (!policy_association->supp_feat) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [supp_feat]");
goto end;
}
if (cJSON_AddStringToObject(item, "suppFeat", policy_association->supp_feat) == NULL) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed [supp_feat]");
goto end;
}
end:
return item;
}
OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *policy_associationJSON)
{
OpenAPI_policy_association_t *policy_association_local_var = NULL;
cJSON *request = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "request");
OpenAPI_policy_association_request_t *request_local_nonprim = NULL;
if (request) {
request_local_nonprim = OpenAPI_policy_association_request_parseFromJSON(request);
}
cJSON *triggers = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "triggers");
OpenAPI_list_t *triggersList;
if (triggers) {
cJSON *triggers_local_nonprimitive;
if (!cJSON_IsArray(triggers)) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [triggers]");
goto end;
}
triggersList = OpenAPI_list_create();
cJSON_ArrayForEach(triggers_local_nonprimitive, triggers ) {
if (!cJSON_IsString(triggers_local_nonprimitive)) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [triggers]");
goto end;
}
OpenAPI_list_add(triggersList, (void *)OpenAPI_request_trigger_FromString(triggers_local_nonprimitive->valuestring));
}
}
cJSON *serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "servAreaRes");
OpenAPI_service_area_restriction_t *serv_area_res_local_nonprim = NULL;
if (serv_area_res) {
serv_area_res_local_nonprim = OpenAPI_service_area_restriction_parseFromJSON(serv_area_res);
}
cJSON *wl_serv_area_res = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "wlServAreaRes");
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res_local_nonprim = NULL;
if (wl_serv_area_res) {
wl_serv_area_res_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wl_serv_area_res);
}
cJSON *rfsp = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "rfsp");
if (rfsp) {
if (!cJSON_IsNumber(rfsp)) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [rfsp]");
goto end;
}
}
cJSON *smf_sel_info = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "smfSelInfo");
OpenAPI_smf_selection_data_t *smf_sel_info_local_nonprim = NULL;
if (smf_sel_info) {
smf_sel_info_local_nonprim = OpenAPI_smf_selection_data_parseFromJSON(smf_sel_info);
}
cJSON *ue_ambr = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "ueAmbr");
OpenAPI_ambr_t *ue_ambr_local_nonprim = NULL;
if (ue_ambr) {
ue_ambr_local_nonprim = OpenAPI_ambr_parseFromJSON(ue_ambr);
}
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "rgTmbr");
OpenAPI_ambr_t *rg_tmbr_local_nonprim = NULL;
if (rg_tmbr) {
rg_tmbr_local_nonprim = OpenAPI_ambr_parseFromJSON(rg_tmbr);
}
cJSON *pras = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "pras");
OpenAPI_list_t *prasList;
if (pras) {
cJSON *pras_local_map;
if (!cJSON_IsObject(pras)) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [pras]");
goto end;
}
prasList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(pras_local_map, pras) {
cJSON *localMapObject = pras_local_map;
if (!cJSON_IsObject(pras_local_map)) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [pras]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_presence_info_parseFromJSON(localMapObject));
OpenAPI_list_add(prasList, localMapKeyPair);
}
}
cJSON *supp_feat = cJSON_GetObjectItemCaseSensitive(policy_associationJSON, "suppFeat");
if (!supp_feat) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [supp_feat]");
goto end;
}
if (!cJSON_IsString(supp_feat)) {
ogs_error("OpenAPI_policy_association_parseFromJSON() failed [supp_feat]");
goto end;
}
policy_association_local_var = OpenAPI_policy_association_create (
request ? request_local_nonprim : NULL,
triggers ? triggersList : NULL,
serv_area_res ? serv_area_res_local_nonprim : NULL,
wl_serv_area_res ? wl_serv_area_res_local_nonprim : NULL,
rfsp ? rfsp->valuedouble : 0,
smf_sel_info ? smf_sel_info_local_nonprim : NULL,
ue_ambr ? ue_ambr_local_nonprim : NULL,
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
pras ? prasList : NULL,
ogs_strdup(supp_feat->valuestring)
);
return policy_association_local_var;
end:
return NULL;
}
OpenAPI_policy_association_t *OpenAPI_policy_association_copy(OpenAPI_policy_association_t *dst, OpenAPI_policy_association_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_policy_association_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_policy_association_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_policy_association_free(dst);
dst = OpenAPI_policy_association_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,63 @@
/*
* policy_association.h
*
*
*/
#ifndef _OpenAPI_policy_association_H_
#define _OpenAPI_policy_association_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "ambr.h"
#include "policy_association_request.h"
#include "presence_info.h"
#include "request_trigger.h"
#include "service_area_restriction.h"
#include "smf_selection_data.h"
#include "wireline_service_area_restriction.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_policy_association_s OpenAPI_policy_association_t;
typedef struct OpenAPI_policy_association_s {
struct OpenAPI_policy_association_request_s *request;
OpenAPI_list_t *triggers;
struct OpenAPI_service_area_restriction_s *serv_area_res;
struct OpenAPI_wireline_service_area_restriction_s *wl_serv_area_res;
int rfsp;
struct OpenAPI_smf_selection_data_s *smf_sel_info;
struct OpenAPI_ambr_s *ue_ambr;
struct OpenAPI_ambr_s *rg_tmbr;
OpenAPI_list_t* pras;
char *supp_feat;
} OpenAPI_policy_association_t;
OpenAPI_policy_association_t *OpenAPI_policy_association_create(
OpenAPI_policy_association_request_t *request,
OpenAPI_list_t *triggers,
OpenAPI_service_area_restriction_t *serv_area_res,
OpenAPI_wireline_service_area_restriction_t *wl_serv_area_res,
int rfsp,
OpenAPI_smf_selection_data_t *smf_sel_info,
OpenAPI_ambr_t *ue_ambr,
OpenAPI_ambr_t *rg_tmbr,
OpenAPI_list_t* pras,
char *supp_feat
);
void OpenAPI_policy_association_free(OpenAPI_policy_association_t *policy_association);
OpenAPI_policy_association_t *OpenAPI_policy_association_parseFromJSON(cJSON *policy_associationJSON);
cJSON *OpenAPI_policy_association_convertToJSON(OpenAPI_policy_association_t *policy_association);
OpenAPI_policy_association_t *OpenAPI_policy_association_copy(OpenAPI_policy_association_t *dst, OpenAPI_policy_association_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_policy_association_H_ */

Some files were not shown because too many files have changed in this diff Show More