[5GC] Added BSF(Binding Support Function)

This commit is contained in:
Sukchan Lee 2021-05-29 15:56:12 +09:00
parent 611986794b
commit fe89f7cd11
293 changed files with 24988 additions and 1507 deletions

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -214,6 +215,11 @@ nssf:
s_nssai:
sst: 1
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
udr:
sbi:
- addr: 127.0.0.20

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -248,6 +249,11 @@ nssf:
s_nssai:
sst: 1
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
udr:
sbi:
- addr: 127.0.0.20

186
configs/open5gs/bsf.yaml.in Normal file
View File

@ -0,0 +1,186 @@
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,bsf,event,tlv,mem,sock
#
logger:
file: @localstatedir@/log/open5gs/bsf.log
#
# bsf:
#
# <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: bsf.key
# pem: bsf.pem
#
# o SBI Server(https://127.0.0.15:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.15
# tls:
# key: bsf.key
# pem: bsf.pem
# - addr: ::1
#
# o SBI Server(http://bsf.open5gs.org:80)
# sbi:
# - name: bsf.open5gs.org
#
# o SBI Server(http://127.0.0.15:7777)
# sbi:
# - addr: 127.0.0.15
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# - dev: eth0
#
# o Provide custom SBI address to be advertised to NRF
# sbi:
# - dev: eth0
# advertise: open5gs-bsf.svc.local
#
# sbi:
# - addr: localhost
# advertise:
# - 127.0.0.99
# - ::1
#
bsf:
sbi:
- addr: 127.0.0.15
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
#
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 default memory pool size was set assuming 1024 UEs.
# To connect more UEs, you need to increase the size further.
#
# - Pool-size 128 => 65536 Number
# - Pool-size 256 => 16384 Number
# - Pool-size 512 => 4096 Number
# - Pool-size 1024 => 1024 Number
# - Pool-size 2048 => 512 Number
# - Pool-size 8192 => 128 Number
# - Pool-size 1024*1024 => 8 Number
#
# 128: 65536
# 256: 16384
# 512: 4096
# 1024: 1024
# 2048: 512
# 8192: 128
# big: 8
#
pool:
#
# time:
#
# o NF Instance Heartbeat (Default : 0)
# NFs will not send heart-beat timer in NFProfile
# NRF will send heart-beat timer in NFProfile
#
# o NF Instance Heartbeat (20 seconds)
# NFs will send heart-beat timer (20 seconds) in NFProfile
# NRF can change heart-beat timer in NFProfile
#
# nf_instance:
# heartbeat: 20
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:

View File

@ -34,6 +34,7 @@ open5gs_conf = '''
udr.yaml
pcf.yaml
nssf.yaml
bsf.yaml
'''.split()
foreach file : open5gs_conf

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -213,6 +214,11 @@ nssf:
port: 7777
s_nssai:
sst: 1
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
udr:
sbi:
- addr: 127.0.0.20

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -228,6 +229,11 @@ nssf:
sst: 1
sd: 009000
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
udr:
sbi:
- addr: 127.0.0.20

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -214,6 +215,11 @@ nssf:
s_nssai:
sst: 1
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
udr:
sbi:
- addr: 127.0.0.20

View File

@ -29,6 +29,7 @@ systemd_conf_in = '''
open5gs-udmd.service
open5gs-pcfd.service
open5gs-nssfd.service
open5gs-bsfd.service
open5gs-udrd.service
'''.split()

View File

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

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -221,6 +222,11 @@ nssf:
s_nssai:
sst: 1
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
udr:
sbi:
- addr: 127.0.0.20

View File

@ -11,6 +11,7 @@ parameter:
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_bsf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -219,6 +220,16 @@ nssf:
s_nssai:
sst: 1
bsf:
sbi:
- addr: 127.0.0.15
port: 7777
af:
sbi:
- addr: 127.0.0.16
port: 7777
udr:
sbi:
- addr: 127.0.0.20

13
debian/control vendored
View File

@ -211,6 +211,18 @@ Description: NSSF (Network Slice Selection Function)
.
This package provides the NSSF (Network Slice Selection Function)
Package: open5gs-bsf
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 BSF (Binding Support Function)
Package: open5gs-udr
Architecture: any
Multi-Arch: same
@ -241,6 +253,7 @@ Depends: ${misc:Depends},
open5gs-udm (= ${binary:Version}),
open5gs-pcf (= ${binary:Version}),
open5gs-nssf (= ${binary:Version}),
open5gs-bsf (= ${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-bsf.install vendored Normal file
View File

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

View File

@ -53,6 +53,7 @@ The Open5GS 5G SA Core contains the following functions:
* UDR - Unified Data Repository
* PCF - Policy and Charging Function
* NSSF - Network Slice Selection Function
* BSF - Binding Support Function
The 5G SA core works in a different way to the 4G core - it uses a **Service Based Architecture** (SBI). **Control plane** functions are configured to register with the NRF, and the NRF then helps them discover the other core functions. Running through the other functions: The AMF handles connection and mobility management; a subset of what the 4G MME is tasked with. gNBs (5G basestations) connect to the AMF. The UDM, AUSF and UDR carry out similar operations as the 4G HSS, generating SIM authentication vectors and holding the subscriber profile. Session management is all handled by the SMF (previously the responsibility of the 4G MME/ SGWC/ PGWC). The NSSF provides a way to select the network slice. Finally there is the PCF, used for charging and enforcing subscriber policies.
@ -221,6 +222,7 @@ AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
NSSF-sbi = 127.0.0.14:7777 for 5G SBI
BSF-sbi = 127.0.0.15:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
@ -467,6 +469,7 @@ $ sudo systemctl stop open5gs-ausfd
$ sudo systemctl stop open5gs-udmd
$ sudo systemctl stop open5gs-pcfd
$ sudo systemctl stop open5gs-nssfd
$ sudo systemctl stop open5gs-bsfd
$ sudo systemctl stop open5gs-udrd
$ sudo systemctl stop open5gs-webui
```
@ -485,6 +488,7 @@ $ sudo systemctl restart open5gs-ausfd
$ sudo systemctl restart open5gs-udmd
$ sudo systemctl restart open5gs-pcfd
$ sudo systemctl restart open5gs-nssfd
$ sudo systemctl restart open5gs-bsfd
$ sudo systemctl restart open5gs-udrd
$ sudo systemctl restart open5gs-webui
```

View File

@ -329,6 +329,14 @@ Open5GS daemon v2.1.0
08/21 22:56:02.155: [app] INFO: NSSF initialize...done (../src/nssfd/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-bsfd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/bsf.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/bsf.log' (../src/main.c:57)
08/21 22:56:02.155: [app] INFO: BSF initialize...done (../src/bsf/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 v2.1.0

View File

@ -35,6 +35,7 @@ AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
NSSF-sbi = 127.0.0.14:7777 for 5G SBI
BSF-sbi = 127.0.0.15:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```

View File

@ -325,7 +325,7 @@ $ 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-pcfd
open5gs-upfd open5gs-nssfd
open5gs-upfd open5gs-nssfd open5gs-bsfd
```
## Building WebUI of Open5GS

View File

@ -25,10 +25,11 @@ open5gs 27543 0.0 0.0 222416 9672 ? Ssl 12:13 0:00 /usr/bin/open5g
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 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-nssfd -c /etc/open5gs/nssf.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-bsfd -c /etc/open5gs/bsf.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, PCF, NSSF & 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, NSSF, BSF & UDR are all running.
If your instance doesn't show this make sure you're started each service:
```bash
@ -45,6 +46,7 @@ $ systemctl start open5gs-ausfd.service
$ systemctl start open5gs-udmd.service
$ systemctl start open5gs-pcfd.service
$ systemctl start open5gs-nssfd.service
$ systemctl start open5gs-bsfd.service
$ systemctl start open5gs-udrd.service
```

View File

@ -280,6 +280,7 @@ $ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
$ sudo pkill -9 open5gs-nssfd
$ sudo pkill -9 open5gs-bsfd
$ sudo pkill -9 open5gs-udrd
```
@ -413,6 +414,7 @@ $ open5gs-ausfd
$ open5gs-udmd
$ open5gs-pcfd
$ open5gs-nssfd
$ open5gs-bsfd
$ open5gs-udrd
```
@ -618,6 +620,7 @@ $ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
$ sudo pkill -9 open5gs-nssfd
$ sudo pkill -9 open5gs-bsfd
$ sudo pkill -9 open5gs-udrd
```
@ -1078,6 +1081,7 @@ Currently, the number of UE is limited to `128*128`.
* UDM : 127.0.0.12
* PCF : 127.0.0.13
* NSSF : 127.0.0.14
* BSF : 127.0.0.15
* UDR : 127.0.0.20
```

View File

@ -81,6 +81,9 @@ void pcf_terminate(void);
int nssf_initialize(void);
void nssf_terminate(void);
int bsf_initialize(void);
void bsf_terminate(void);
int upf_initialize(void);
void upf_terminate(void);

View File

@ -332,6 +332,9 @@ int ogs_app_context_parse_config(void)
} else if (!strcmp(parameter_key, "no_nssf")) {
self.parameter.no_nssf =
ogs_yaml_iter_bool(&parameter_iter);
} else if (!strcmp(parameter_key, "no_bsf")) {
self.parameter.no_bsf =
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

@ -64,6 +64,7 @@ typedef struct ogs_app_context_s {
int no_udm;
int no_pcf;
int no_nssf;
int no_bsf;
int no_udr;
int no_nrf;

View File

@ -462,7 +462,7 @@ char *ogs_ipv4_to_string(uint32_t addr)
return (char*)OGS_INET_NTOP(&addr, buf);
}
char *ogs_ipv6_to_string(uint8_t *addr6)
char *ogs_ipv6addr_to_string(uint8_t *addr6)
{
char *buf = NULL;
ogs_assert(addr6);
@ -473,6 +473,96 @@ char *ogs_ipv6_to_string(uint8_t *addr6)
return (char *)OGS_INET6_NTOP(addr6, buf);
}
char *ogs_ipv6prefix_to_string(uint8_t *addr6, uint8_t prefixlen)
{
char *buf = NULL;
uint8_t tmp[OGS_IPV6_LEN];
ogs_assert(addr6);
memset(tmp, 0, OGS_IPV6_LEN);
memcpy(tmp, addr6, prefixlen >> 3);
buf = ogs_calloc(1, OGS_ADDRSTRLEN);
ogs_assert(buf);
if (OGS_INET6_NTOP(tmp, buf) == NULL) {
ogs_fatal("Invalid IPv6 address");
ogs_log_hexdump(OGS_LOG_FATAL, addr6, OGS_IPV6_LEN);
ogs_assert_if_reached();
}
return ogs_mstrcatf(buf, "/%d", prefixlen);
}
int ogs_ipv4_from_string(uint32_t *addr, char *string)
{
int rv;
ogs_sockaddr_t tmp;
ogs_assert(addr);
ogs_assert(string);
rv = ogs_inet_pton(AF_INET, string, &tmp);
if (rv != OGS_OK) {
ogs_error("Invalid IPv4 string = %s", string);
return OGS_ERROR;
}
*addr = tmp.sin.sin_addr.s_addr;
return OGS_OK;
}
int ogs_ipv6addr_from_string(uint8_t *addr6, char *string)
{
int rv;
ogs_sockaddr_t tmp;
ogs_assert(addr6);
ogs_assert(string);
rv = ogs_inet_pton(AF_INET6, string, &tmp);
if (rv != OGS_OK) {
ogs_error("Invalid IPv6 string = %s", string);
return OGS_ERROR;
}
memcpy(addr6, tmp.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN);
return OGS_OK;
}
int ogs_ipv6prefix_from_string(uint8_t *addr6, uint8_t *prefixlen, char *string)
{
int rv;
ogs_sockaddr_t tmp;
char *v = NULL, *pv = NULL, *ipstr = NULL, *mask_or_numbits = NULL;
ogs_assert(addr6);
ogs_assert(prefixlen);
ogs_assert(string);
pv = v = ogs_strdup(string);
ogs_assert(v);
ipstr = strsep(&v, "/");
if (ipstr)
mask_or_numbits = v;
if (!ipstr || !mask_or_numbits) {
ogs_error("Invalid IPv6 Prefix string = %s", v);
ogs_free(v);
return OGS_ERROR;
}
rv = ogs_inet_pton(AF_INET6, ipstr, &tmp);
ogs_expect_or_return_val(rv == OGS_OK, rv);
memcpy(addr6, tmp.sin6.sin6_addr.s6_addr, OGS_IPV6_LEN);
*prefixlen = atoi(mask_or_numbits);
ogs_free(pv);
return OGS_OK;
}
int ogs_sockaddr_to_user_plane_ip_resource_info(
ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6,
ogs_user_plane_ip_resource_info_t *info)
@ -574,3 +664,27 @@ void ogs_session_data_free(ogs_session_data_t *session_data)
for (i = 0; i < session_data->num_of_pcc_rule; i++)
OGS_PCC_RULE_FREE(&session_data->pcc_rule[i]);
}
void ogs_ims_data_free(ogs_ims_data_t *ims_data)
{
int i, j, k;
ogs_assert(ims_data);
for (i = 0; i < ims_data->num_of_media_component; i++) {
ogs_media_component_t *media_component = &ims_data->media_component[i];
for (j = 0; j < media_component->num_of_sub; j++) {
ogs_media_sub_component_t *sub = &media_component->sub[j];
for (k = 0; k < sub->num_of_flow; k++) {
ogs_flow_t *flow = &sub->flow[k];
if (flow->description) {
ogs_free(flow->description);
} else
ogs_assert_if_reached();
}
}
}
}

View File

@ -199,6 +199,7 @@ ogs_uint24_t ogs_s_nssai_sd_from_string(const char *hex);
#define OGS_IPV4_LEN 4
#define OGS_IPV6_LEN 16
#define OGS_IPV6_DEFAULT_PREFIX_LEN 64
#define OGS_IPV6_128_PREFIX_LEN 128
#define OGS_IPV4V6_LEN 20
typedef struct ogs_ip_s {
uint32_t addr;
@ -212,8 +213,14 @@ ED3(uint8_t ipv4:1;,
int ogs_ip_to_sockaddr(ogs_ip_t *ip, uint16_t port, ogs_sockaddr_t **list);
void ogs_sockaddr_to_ip(
ogs_sockaddr_t *addr, ogs_sockaddr_t *addr6, ogs_ip_t *ip);
char *ogs_ipv4_to_string(uint32_t addr);
char *ogs_ipv6_to_string(uint8_t *addr6);
char *ogs_ipv6addr_to_string(uint8_t *addr6);
char *ogs_ipv6prefix_to_string(uint8_t *addr6, uint8_t prefixlen);
int ogs_ipv4_from_string(uint32_t *addr, char *string);
int ogs_ipv6addr_from_string(uint8_t *addr6, char *string);
int ogs_ipv6prefix_from_string(
uint8_t *addr6, uint8_t *prefixlen, char *string);
/**************************************************
* 8.14 PDN Address Allocation (PAA) */
@ -314,8 +321,7 @@ typedef struct ogs_flow_s {
#define OGS_FLOW_FREE(__fLOW) \
do { \
if ((__fLOW)->description) \
{ \
if ((__fLOW)->description) { \
ogs_free((__fLOW)->description); \
} \
else \
@ -337,11 +343,6 @@ typedef struct ogs_pcc_rule_s {
ogs_flow_t flow[OGS_MAX_NUM_OF_FLOW];
int num_of_flow;
#define OGS_FLOW_STATUS_ENABLED_UPLINK 0
#define OGS_FLOW_STATUS_ENABLED_DOWNLINK 1
#define OGS_FLOW_STATUS_ENABLED 2
#define OGS_FLOW_STATUS_DISABLED 3
#define OGS_FLOW_STATUS_REMOVE 4
int flow_status;
uint32_t precedence;
@ -624,6 +625,46 @@ typedef struct ogs_session_data_s {
void ogs_session_data_free(ogs_session_data_t *session_data);
typedef struct ogs_media_sub_component_s {
uint32_t flow_number;
uint32_t flow_usage;
ogs_flow_t flow[OGS_MAX_NUM_OF_FLOW];
int num_of_flow;
} ogs_media_sub_component_t;
typedef struct ogs_media_component_s {
uint32_t media_component_number;
uint32_t media_type;
uint64_t max_requested_bandwidth_dl;
uint64_t max_requested_bandwidth_ul;
uint64_t min_requested_bandwidth_dl;
uint64_t min_requested_bandwidth_ul;
uint64_t rr_bandwidth;
uint64_t rs_bandwidth;
int flow_status;
#define OGS_MAX_NUM_OF_MEDIA_SUB_COMPONENT 8
ogs_media_sub_component_t sub[OGS_MAX_NUM_OF_MEDIA_SUB_COMPONENT];
int num_of_sub;
} ogs_media_component_t;
typedef struct ogs_ims_data_s {
int num_of_msisdn;
struct {
uint8_t buf[OGS_MAX_MSISDN_LEN];
int len;
char bcd[OGS_MAX_MSISDN_BCD_LEN+1];
} msisdn[OGS_MAX_NUM_OF_MSISDN];
#define OGS_MAX_NUM_OF_MEDIA_COMPONENT 16
ogs_media_component_t media_component[OGS_MAX_NUM_OF_MEDIA_COMPONENT];
int num_of_media_component;
} ogs_ims_data_t;
void ogs_ims_data_free(ogs_ims_data_t *ims_data);
#ifdef __cplusplus
}
#endif

View File

@ -28,6 +28,8 @@
extern "C" {
#endif
/* The ogs_msisdn_data_s structure is always used with the db library. */
typedef struct ogs_msisdn_data_s {
struct {
uint8_t buf[OGS_MAX_IMSI_LEN];
@ -46,15 +48,6 @@ typedef struct ogs_msisdn_data_s {
int ogs_dbi_msisdn_data(
char *imsi_or_msisdn_bcd, ogs_msisdn_data_t *msisdn_data);
typedef struct ogs_ims_data_s {
int num_of_msisdn;
struct {
uint8_t buf[OGS_MAX_MSISDN_LEN];
int len;
char bcd[OGS_MAX_MSISDN_BCD_LEN+1];
} msisdn[OGS_MAX_NUM_OF_MSISDN];
} ogs_ims_data_t;
int ogs_dbi_ims_data(char *supi, ogs_ims_data_t *ims_data);
#ifdef __cplusplus

View File

@ -479,7 +479,6 @@ done:
ogs_assert(pcc_rule->id);
pcc_rule->precedence = pcc_rule_index+1;
pcc_rule->flow_status = OGS_FLOW_STATUS_ENABLED;
pcc_rule_index++;
}
session_data->num_of_pcc_rule = pcc_rule_index;

View File

@ -106,29 +106,3 @@ int ogs_diam_rx_init(void)
return 0;
}
void ogs_diam_rx_message_free(ogs_diam_rx_message_t *rx_message)
{
int i, j, k;
ogs_assert(rx_message);
for (i = 0; i < rx_message->num_of_media_component; i++) {
ogs_diam_rx_media_component_t *media_component =
&rx_message->media_component[i];
for (j = 0; j < media_component->num_of_sub; j++) {
ogs_diam_rx_media_sub_component_t *sub = &media_component->sub[j];
for (k = 0; k < sub->num_of_flow; k++) {
ogs_flow_t *flow = &sub->flow[k];
if (flow->description) {
ogs_free(flow->description);
}
else
ogs_assert_if_reached();
}
}
}
}

View File

@ -46,6 +46,7 @@ extern "C" {
#define OGS_DIAM_RX_AVP_CODE_MEDIA_SUB_COMPONENT (519)
#define OGS_DIAM_RX_AVP_CODE_FLOW_DESCRIPTION (507)
#define OGS_DIAM_RX_AVP_CODE_FLOW_NUMBER (509)
#define OGS_DIAM_RX_AVP_CODE_FLOW_STATUS (511)
#define OGS_DIAM_RX_AVP_CODE_FLOW_USAGE (512)
extern struct dict_object *ogs_diam_rx_application;
@ -60,6 +61,14 @@ extern struct dict_object *ogs_diam_rx_cmd_sta;
extern struct dict_object *ogs_diam_rx_af_application_identifier;
extern struct dict_object *ogs_diam_rx_media_component_description;
extern struct dict_object *ogs_diam_rx_media_component_number;
#define OGS_DIAM_RX_MEDIA_TYPE_AUDIO 0
#define OGS_DIAM_RX_MEDIA_TYPE_VIDEO 1
#define OGS_DIAM_RX_MEDIA_TYPE_DATA 2
#define OGS_DIAM_RX_MEDIA_TYPE_APPLICATION 3
#define OGS_DIAM_RX_MEDIA_TYPE_CONTROL 4
#define OGS_DIAM_RX_MEDIA_TYPE_TEXT 5
#define OGS_DIAM_RX_MEDIA_TYPE_MESSAGE 6
#define OGS_DIAM_RX_MEDIA_TYPE_OTHER 0xFFFFFFFF
extern struct dict_object *ogs_diam_rx_media_type;
extern struct dict_object *ogs_diam_rx_max_requested_bandwidth_ul;
extern struct dict_object *ogs_diam_rx_max_requested_bandwidth_dl;
@ -75,6 +84,9 @@ extern struct dict_object *ogs_diam_rx_flow_status;
extern struct dict_object *ogs_diam_rx_codec_data;
extern struct dict_object *ogs_diam_rx_media_sub_component;
extern struct dict_object *ogs_diam_rx_flow_number;
#define OGS_DIAM_RX_FLOW_USAGE_NO_INFORMATION 0
#define OGS_DIAM_RX_FLOW_USAGE_RTCP 1
#define OGS_DIAM_RX_FLOW_USAGE_AF_SIGNALLING 2
extern struct dict_object *ogs_diam_rx_flow_usage;
extern struct dict_object *ogs_diam_rx_flow_description;
extern struct dict_object *ogs_diam_rx_subscription_id;
@ -132,41 +144,6 @@ extern struct dict_object *ogs_diam_rx_abort_cause;
#define OGS_DIAM_RX_TERMINATION_CAUSE_DIAMETER_SESSION_TIMEOUT 8
extern struct dict_object *ogs_diam_rx_termination_cause;
typedef struct ogs_diam_rx_media_sub_component_s {
uint32_t flow_number;
#define OGS_DIAM_RX_FLOW_USAGE_NO_INFORMATION 0
#define OGS_DIAM_RX_FLOW_USAGE_RTCP 1
#define OGS_DIAM_RX_FLOW_USAGE_AF_SIGNALLING 2
uint32_t flow_usage;
ogs_flow_t flow[OGS_MAX_NUM_OF_FLOW];
int num_of_flow;
} ogs_diam_rx_media_sub_component_t;
typedef struct ogs_diam_rx_media_component_s {
uint32_t media_component_number;
#define OGS_DIAM_RX_MEDIA_TYPE_AUDIO 0
#define OGS_DIAM_RX_MEDIA_TYPE_VIDEO 1
#define OGS_DIAM_RX_MEDIA_TYPE_DATA 2
#define OGS_DIAM_RX_MEDIA_TYPE_APPLICATION 3
#define OGS_DIAM_RX_MEDIA_TYPE_CONTROL 4
#define OGS_DIAM_RX_MEDIA_TYPE_TEXT 5
#define OGS_DIAM_RX_MEDIA_TYPE_MESSAGE 6
#define OGS_DIAM_RX_MEDIA_TYPE_OTHER 0xFFFFFFFF
uint32_t media_type;
uint64_t max_requested_bandwidth_dl;
uint64_t max_requested_bandwidth_ul;
uint64_t min_requested_bandwidth_dl;
uint64_t min_requested_bandwidth_ul;
uint64_t rr_bandwidth;
uint64_t rs_bandwidth;
#define OGS_DIAM_MAX_NUM_OF_MEDIA_SUB_COMPONENT 8
ogs_diam_rx_media_sub_component_t
sub[OGS_DIAM_MAX_NUM_OF_MEDIA_SUB_COMPONENT];
int num_of_sub;
} ogs_diam_rx_media_component_t;
typedef struct ogs_diam_rx_message_s {
#define OGS_DIAM_RX_CMD_CODE_AA 265
#define OGS_DIAM_RX_CMD_CODE_SESSION_TERMINATION 275
@ -183,14 +160,10 @@ typedef struct ogs_diam_rx_message_s {
#define OGS_DIAM_RX_DIAMETER_TEMPORARY_NETWORK_FAILURE 5068
uint32_t result_code;
#define OGS_DIAM_MAX_NUM_OF_MEDIA_COMPONENT 16
ogs_diam_rx_media_component_t
media_component[OGS_DIAM_MAX_NUM_OF_MEDIA_COMPONENT];
int num_of_media_component;
ogs_ims_data_t ims_data;
} ogs_diam_rx_message_t;
int ogs_diam_rx_init(void);
void ogs_diam_rx_message_free(ogs_diam_rx_message_t *rx_message);
#ifdef __cplusplus
}

View File

@ -1080,6 +1080,11 @@ bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
return true;
}
OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void)
{
return OpenAPI_uri_scheme_http;
}
ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
ogs_sbi_nf_instance_t *nf_instance, char *name, char *version)
{

View File

@ -271,6 +271,8 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
OpenAPI_uri_scheme_e ogs_sbi_default_uri_scheme(void);
#define OGS_SBI_NF_INSTANCE(__sBIObject, __nFType) \
(((__sBIObject)->nf_type_array)[__nFType].nf_instance)

View File

@ -152,9 +152,15 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message)
OpenAPI_sm_policy_decision_free(message->SmPolicyDecision);
if (message->SmPolicyData)
OpenAPI_sm_policy_data_free(message->SmPolicyData);
if (message->SmPolicyDeleteData)
OpenAPI_sm_policy_delete_data_free(message->SmPolicyDeleteData);
if (message->AuthorizedNetworkSliceInfo)
OpenAPI_authorized_network_slice_info_free(
message->AuthorizedNetworkSliceInfo);
if (message->PcfBinding)
OpenAPI_pcf_binding_free(message->PcfBinding);
if (message->AppSessionContext)
OpenAPI_app_session_context_free(message->AppSessionContext);
for (i = 0; i < message->num_of_part; i++) {
if (message->part[i].pkbuf)
@ -367,6 +373,14 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
if (sNSSAI.sd)
ogs_free(sNSSAI.sd);
}
if (message->param.ipv4addr) {
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_IPV4ADDR, message->param.ipv4addr);
}
if (message->param.ipv6prefix) {
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_IPV6PREFIX, message->param.ipv6prefix);
}
build_content(&request->http, message);
@ -522,6 +536,10 @@ int ogs_sbi_parse_request(
cJSON_Delete(item);
}
}
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_IPV4ADDR)) {
message->param.ipv4addr = ogs_hash_this_val(hi);
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_IPV6PREFIX)) {
message->param.ipv6prefix = ogs_hash_this_val(hi);
}
}
@ -831,10 +849,21 @@ static char *build_json(ogs_sbi_message_t *message)
} else if (message->SmPolicyData) {
item = OpenAPI_sm_policy_data_convertToJSON(message->SmPolicyData);
ogs_assert(item);
} else if (message->SmPolicyDeleteData) {
item = OpenAPI_sm_policy_delete_data_convertToJSON(
message->SmPolicyDeleteData);
ogs_assert(item);
} else if (message->AuthorizedNetworkSliceInfo) {
item = OpenAPI_authorized_network_slice_info_convertToJSON(
message->AuthorizedNetworkSliceInfo);
ogs_assert(item);
} else if (message->PcfBinding) {
item = OpenAPI_pcf_binding_convertToJSON(message->PcfBinding);
ogs_assert(item);
} else if (message->AppSessionContext) {
item = OpenAPI_app_session_context_convertToJSON(
message->AppSessionContext);
ogs_assert(item);
}
if (item) {
@ -1436,20 +1465,42 @@ static int parse_json(ogs_sbi_message_t *message,
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");
if (!message->h.resource.component[1]) {
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");
}
}
} else if (message->res_status == OGS_SBI_HTTP_STATUS_CREATED) {
message->SmPolicyDecision =
OpenAPI_sm_policy_decision_parseFromJSON(item);
if (!message->SmPolicyDecision) {
} else {
SWITCH(message->h.resource.component[2])
CASE(OGS_SBI_RESOURCE_NAME_DELETE)
if (message->res_status == 0) {
message->SmPolicyDeleteData =
OpenAPI_sm_policy_delete_data_parseFromJSON(
item);
if (!message->SmPolicyDeleteData) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
ogs_error("Unknown resource name [%s]",
message->h.resource.component[2]);
END
break;
}
break;
@ -1481,6 +1532,108 @@ static int parse_json(ogs_sbi_message_t *message,
END
break;
CASE(OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT)
SWITCH(message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_PCF_BINDINGS)
if (message->h.resource.component[1]) {
SWITCH(message->h.method)
CASE(OGS_SBI_HTTP_METHOD_PATCH)
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
message->PcfBinding =
OpenAPI_pcf_binding_parseFromJSON(item);
if (!message->PcfBinding) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
CASE(OGS_SBI_HTTP_METHOD_DELETE)
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown method [%s]", message->h.method);
END
break;
} else {
SWITCH(message->h.method)
CASE(OGS_SBI_HTTP_METHOD_POST)
if (message->res_status == 0 ||
message->res_status ==
OGS_SBI_HTTP_STATUS_CREATED) {
message->PcfBinding =
OpenAPI_pcf_binding_parseFromJSON(item);
if (!message->PcfBinding) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
CASE(OGS_SBI_HTTP_METHOD_GET)
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
message->PcfBinding =
OpenAPI_pcf_binding_parseFromJSON(item);
if (!message->PcfBinding) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown method [%s]", message->h.method);
END
break;
}
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[0]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION)
SWITCH(message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_APP_SESSIONS)
if (message->h.resource.component[1]) {
SWITCH(message->h.method)
CASE(OGS_SBI_HTTP_METHOD_DELETE)
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown method [%s]", message->h.method);
END
break;
} else {
SWITCH(message->h.method)
CASE(OGS_SBI_HTTP_METHOD_POST)
if (message->res_status == 0 ||
message->res_status ==
OGS_SBI_HTTP_STATUS_CREATED) {
message->AppSessionContext =
OpenAPI_app_session_context_parseFromJSON(item);
if (!message->AppSessionContext) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown method [%s]", message->h.method);
END
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

@ -143,11 +143,21 @@ extern "C" {
#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_RESOURCE_NAME_DELETE "delete"
#define OGS_SBI_SERVICE_NAME_NPCF_POLICYAUTHORIZATION \
"npcf-policyauthorization"
#define OGS_SBI_RESOURCE_NAME_APP_SESSIONS "app-sessions"
#define OGS_SBI_RESOURCE_NAME_NOTIFY "notify"
#define OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION "nnssf-nsselection"
#define OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION \
"network-slice-information"
#define OGS_SBI_SERVICE_NAME_NBSF_MANAGEMENT "nbsf-management"
#define OGS_SBI_RESOURCE_NAME_PCF_BINDINGS "pcfBindings"
#define OGS_SBI_SERVICE_NAME_NAF_EVENTEXPOSURE "naf-eventexposure"
#define OGS_SBI_FEATURES_IS_SET(__fEATURES, __n) \
(__fEATURES & (1 << ((__n)-1)))
#define OGS_SBI_FEATURES_SET(__fEATURES, __n) \
@ -199,6 +209,41 @@ extern "C" {
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DDN_EVENT_POLICY_CONTROL 37
#define OGS_SBI_NPCF_SMPOLICYCONTROL_REALLOCATION_OF_CREDIT 38
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_INFLUENCE_ON_TRAFFIC_ROUTING 1
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_SPONSORED_CONNECTIVITY 2
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_MEDIA_COMPONENT_VERSIONING 3
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_URLLC 4
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_IMS_SBI 5
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_NETLOC 6
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_PROV_AF_SIGNAL_FLOW 7
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_RESOURCE_SHARING 8
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_MCPTT 9
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_MCVIDEO 10
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_PRIORITY_SHARING 11
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_MCPTT_PREEMPTION 12
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_MAC_ADDRESS_RANGE 13
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_RAN_NAS_CAUSE 14
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_ENHANCED_SUBSCRIPTION_TO_NOTIFICATION 15
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_QOS_MONITORING 16
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_AUTHORIZATION_WITH_REQUIRED_QOS 17
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_TIME_SENSITIVE_NETWORKING 18
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_PCSCF_RESTORATION_ENHANCEMENT 19
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_CHEM 20
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_FLUS 21
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_EPS_FALLBACK_REPORT 22
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_ATSSS 23
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_QOS_HINT 24
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_REALLOCATION_OF_CREDIT 25
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_ES3XX 26
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_DISABLE_UE_NOTIFICATION 27
#define OGS_SBI_NPCF_POLICYAUTHORIZATION_PATCH_CORRECTION 28
#define OGS_SBI_NBSF_MANAGEMENT_MULTI_UE_ADDR 1
#define OGS_SBI_NBSF_MANAGEMENT_BINDING_UPDATE 2
#define OGS_SBI_NBSF_MANAGEMENT_SAME_PCF 3
#define OGS_SBI_NBSF_MANAGEMENT_ES3XX 4
#define OGS_SBI_NBSF_MANAGEMENT_EXTENDED_SAME_PCF 5
#define OGS_SBI_PARAM_NF_ID "nf-id"
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
@ -210,6 +255,8 @@ extern "C" {
#define OGS_SBI_PARAM_SNSSAI "snssai"
#define OGS_SBI_PARAM_SLICE_INFO_REQUEST_FOR_PDU_SESSION \
"slice-info-request-for-pdu-session"
#define OGS_SBI_PARAM_IPV4ADDR "ipv4Addr"
#define OGS_SBI_PARAM_IPV6PREFIX "ipv6Prefix"
#define OGS_SBI_ACCEPT "Accept"
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
@ -300,6 +347,9 @@ typedef struct ogs_sbi_message_s {
bool snssai_presence;
bool slice_info_request_for_pdu_session_presence;
OpenAPI_roaming_indication_e roaming_indication;
char *ipv4addr;
char *ipv6prefix;
} param;
int res_status;
@ -341,11 +391,16 @@ typedef struct ogs_sbi_message_s {
OpenAPI_sm_context_status_notification_t *SmContextStatusNotification;
OpenAPI_policy_association_request_t *PolicyAssociationRequest;
OpenAPI_policy_association_t *PolicyAssociation;
OpenAPI_policy_update_t *PolicyUpdate;
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;
OpenAPI_sm_policy_delete_data_t *SmPolicyDeleteData;
OpenAPI_sm_policy_notification_t *SmPolicyNotification;
OpenAPI_authorized_network_slice_info_t *AuthorizedNetworkSliceInfo;
OpenAPI_pcf_binding_t *PcfBinding;
OpenAPI_app_session_context_t *AppSessionContext;
ogs_sbi_links_t *links;

View File

@ -32,7 +32,7 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
int i = 0;
int fqdn_len;
char fqdn[OGS_MAX_FQDN_LEN+1];
char fqdn[OGS_MAX_FQDN_LEN];
ogs_assert(nf_instance);

View File

@ -148,33 +148,6 @@ static void handle_smf_info(
nf_info->smf.num_of_nr_tai_range++;
}
}
#if 0
ogs_sbi_smf_info_t *smf_info = &nf_info->smf;
int i, j;
for (i = 0; i < smf_info->num_of_slice; i++) {
ogs_fatal("%d, %x", smf_info->slice[i].s_nssai.sst,
smf_info->slice[i].s_nssai.sd.v);
for (j = 0; j < smf_info->slice[i].num_of_dnn; j++)
ogs_fatal(" %s", smf_info->slice[i].dnn[j]);
}
for (i = 0; i < smf_info->num_of_nr_tai; i++) {
ogs_fatal("%d, %d, %x",
ogs_plmn_id_mcc(&smf_info->nr_tai[i].plmn_id),
ogs_plmn_id_mnc(&smf_info->nr_tai[i].plmn_id),
smf_info->nr_tai[i].tac.v);
}
for (i = 0; i < smf_info->num_of_nr_tai_range; i++) {
ogs_fatal("%d, %d",
ogs_plmn_id_mcc(&smf_info->nr_tai[i].plmn_id),
ogs_plmn_id_mnc(&smf_info->nr_tai[i].plmn_id));
for (j = 0; j < smf_info->nr_tai_range[i].num_of_tac_range; j++) {
ogs_fatal(" %d-%d",
smf_info->nr_tai_range[i].start[j].v,
smf_info->nr_tai_range[i].end[j].v);
}
}
#endif
}
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,

View File

@ -65,8 +65,13 @@
#include "model/sm_policy_context_data.h"
#include "model/sm_policy_decision.h"
#include "model/sm_policy_data.h"
#include "model/sm_policy_delete_data.h"
#include "model/slice_info_for_pdu_session.h"
#include "model/authorized_network_slice_info.h"
#include "model/pcf_binding.h"
#include "model/app_session_context.h"
#include "model/policy_update.h"
#include "model/sm_policy_notification.h"
#include "custom/links.h"

View File

@ -779,6 +779,63 @@ libsbi_openapi_sources = files('''
model/w_agf_info.c
model/wireline_area.c
model/wireline_service_area_restriction.c
model/acceptable_service_info.c
model/access_net_charging_identifier.c
model/accumulated_usage.c
model/af_event_notification.c
model/af_event_subscription.c
model/af_notif_method.c
model/af_requested_data.c
model/af_routing_requirement.c
model/af_routing_requirement_rm.c
model/app_session_context.c
model/app_session_context_req_data.c
model/app_session_context_resp_data.c
model/app_session_context_update_data.c
model/binding_level.c
model/binding_resp.c
model/events_notification.c
model/events_subsc_req_data.c
model/events_subsc_req_data_rm.c
model/extended_problem_details.c
model/extended_problem_details_all_of.c
model/flow_usage.c
model/flows.c
model/media_component.c
model/media_component_resources_status.c
model/media_component_rm.c
model/media_sub_component.c
model/media_sub_component_rm.c
model/media_type.c
model/new_tsn_bridge.c
model/out_of_credit_information.c
model/parameter_combination.c
model/pcf_binding.c
model/pcf_binding_patch.c
model/pcscf_restoration_request_data.c
model/preemption_capability_rm.c
model/preemption_control_information.c
model/preemption_control_information_rm.c
model/preemption_vulnerability_rm.c
model/priority_sharing_indicator.c
model/qos_monitoring_information.c
model/qos_monitoring_information_rm.c
model/required_access_info.c
model/reserv_priority.c
model/resources_allocation_info.c
model/serv_auth_info.c
model/service_info_status.c
model/sip_forking_indication.c
model/spatial_validity.c
model/spatial_validity_rm.c
model/sponsoring_status.c
model/termination_cause.c
model/termination_info.c
model/tsn_qos_container.c
model/tsn_qos_container_rm.c
model/ue_identity_info.c
model/usage_threshold_rm.c
'''.split())
libsbi_openapi_inc = include_directories('.')

View File

@ -0,0 +1,178 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "acceptable_service_info.h"
OpenAPI_acceptable_service_info_t *OpenAPI_acceptable_service_info_create(
OpenAPI_list_t* acc_bw_med_comps,
char *mar_bw_ul,
char *mar_bw_dl
)
{
OpenAPI_acceptable_service_info_t *acceptable_service_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_acceptable_service_info_t));
if (!acceptable_service_info_local_var) {
return NULL;
}
acceptable_service_info_local_var->acc_bw_med_comps = acc_bw_med_comps;
acceptable_service_info_local_var->mar_bw_ul = mar_bw_ul;
acceptable_service_info_local_var->mar_bw_dl = mar_bw_dl;
return acceptable_service_info_local_var;
}
void OpenAPI_acceptable_service_info_free(OpenAPI_acceptable_service_info_t *acceptable_service_info)
{
if (NULL == acceptable_service_info) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(acceptable_service_info->acc_bw_med_comps, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_media_component_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(acceptable_service_info->acc_bw_med_comps);
ogs_free(acceptable_service_info->mar_bw_ul);
ogs_free(acceptable_service_info->mar_bw_dl);
ogs_free(acceptable_service_info);
}
cJSON *OpenAPI_acceptable_service_info_convertToJSON(OpenAPI_acceptable_service_info_t *acceptable_service_info)
{
cJSON *item = NULL;
if (acceptable_service_info == NULL) {
ogs_error("OpenAPI_acceptable_service_info_convertToJSON() failed [AcceptableServiceInfo]");
return NULL;
}
item = cJSON_CreateObject();
if (acceptable_service_info->acc_bw_med_comps) {
cJSON *acc_bw_med_comps = cJSON_AddObjectToObject(item, "accBwMedComps");
if (acc_bw_med_comps == NULL) {
ogs_error("OpenAPI_acceptable_service_info_convertToJSON() failed [acc_bw_med_comps]");
goto end;
}
cJSON *localMapObject = acc_bw_med_comps;
OpenAPI_lnode_t *acc_bw_med_comps_node;
if (acceptable_service_info->acc_bw_med_comps) {
OpenAPI_list_for_each(acceptable_service_info->acc_bw_med_comps, acc_bw_med_comps_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)acc_bw_med_comps_node->data;
cJSON *itemLocal = OpenAPI_media_component_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_acceptable_service_info_convertToJSON() failed [acc_bw_med_comps]");
goto end;
}
cJSON_AddItemToObject(acc_bw_med_comps, localKeyValue->key, itemLocal);
}
}
}
if (acceptable_service_info->mar_bw_ul) {
if (cJSON_AddStringToObject(item, "marBwUl", acceptable_service_info->mar_bw_ul) == NULL) {
ogs_error("OpenAPI_acceptable_service_info_convertToJSON() failed [mar_bw_ul]");
goto end;
}
}
if (acceptable_service_info->mar_bw_dl) {
if (cJSON_AddStringToObject(item, "marBwDl", acceptable_service_info->mar_bw_dl) == NULL) {
ogs_error("OpenAPI_acceptable_service_info_convertToJSON() failed [mar_bw_dl]");
goto end;
}
}
end:
return item;
}
OpenAPI_acceptable_service_info_t *OpenAPI_acceptable_service_info_parseFromJSON(cJSON *acceptable_service_infoJSON)
{
OpenAPI_acceptable_service_info_t *acceptable_service_info_local_var = NULL;
cJSON *acc_bw_med_comps = cJSON_GetObjectItemCaseSensitive(acceptable_service_infoJSON, "accBwMedComps");
OpenAPI_list_t *acc_bw_med_compsList;
if (acc_bw_med_comps) {
cJSON *acc_bw_med_comps_local_map;
if (!cJSON_IsObject(acc_bw_med_comps)) {
ogs_error("OpenAPI_acceptable_service_info_parseFromJSON() failed [acc_bw_med_comps]");
goto end;
}
acc_bw_med_compsList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(acc_bw_med_comps_local_map, acc_bw_med_comps) {
cJSON *localMapObject = acc_bw_med_comps_local_map;
if (!cJSON_IsObject(acc_bw_med_comps_local_map)) {
ogs_error("OpenAPI_acceptable_service_info_parseFromJSON() failed [acc_bw_med_comps]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_media_component_parseFromJSON(localMapObject));
OpenAPI_list_add(acc_bw_med_compsList, localMapKeyPair);
}
}
cJSON *mar_bw_ul = cJSON_GetObjectItemCaseSensitive(acceptable_service_infoJSON, "marBwUl");
if (mar_bw_ul) {
if (!cJSON_IsString(mar_bw_ul)) {
ogs_error("OpenAPI_acceptable_service_info_parseFromJSON() failed [mar_bw_ul]");
goto end;
}
}
cJSON *mar_bw_dl = cJSON_GetObjectItemCaseSensitive(acceptable_service_infoJSON, "marBwDl");
if (mar_bw_dl) {
if (!cJSON_IsString(mar_bw_dl)) {
ogs_error("OpenAPI_acceptable_service_info_parseFromJSON() failed [mar_bw_dl]");
goto end;
}
}
acceptable_service_info_local_var = OpenAPI_acceptable_service_info_create (
acc_bw_med_comps ? acc_bw_med_compsList : NULL,
mar_bw_ul ? ogs_strdup(mar_bw_ul->valuestring) : NULL,
mar_bw_dl ? ogs_strdup(mar_bw_dl->valuestring) : NULL
);
return acceptable_service_info_local_var;
end:
return NULL;
}
OpenAPI_acceptable_service_info_t *OpenAPI_acceptable_service_info_copy(OpenAPI_acceptable_service_info_t *dst, OpenAPI_acceptable_service_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_acceptable_service_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_acceptable_service_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_acceptable_service_info_free(dst);
dst = OpenAPI_acceptable_service_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,43 @@
/*
* acceptable_service_info.h
*
* Indicates the maximum bandwidth that shall be authorized by the PCF.
*/
#ifndef _OpenAPI_acceptable_service_info_H_
#define _OpenAPI_acceptable_service_info_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "media_component.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_acceptable_service_info_s OpenAPI_acceptable_service_info_t;
typedef struct OpenAPI_acceptable_service_info_s {
OpenAPI_list_t* acc_bw_med_comps;
char *mar_bw_ul;
char *mar_bw_dl;
} OpenAPI_acceptable_service_info_t;
OpenAPI_acceptable_service_info_t *OpenAPI_acceptable_service_info_create(
OpenAPI_list_t* acc_bw_med_comps,
char *mar_bw_ul,
char *mar_bw_dl
);
void OpenAPI_acceptable_service_info_free(OpenAPI_acceptable_service_info_t *acceptable_service_info);
OpenAPI_acceptable_service_info_t *OpenAPI_acceptable_service_info_parseFromJSON(cJSON *acceptable_service_infoJSON);
cJSON *OpenAPI_acceptable_service_info_convertToJSON(OpenAPI_acceptable_service_info_t *acceptable_service_info);
OpenAPI_acceptable_service_info_t *OpenAPI_acceptable_service_info_copy(OpenAPI_acceptable_service_info_t *dst, OpenAPI_acceptable_service_info_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_acceptable_service_info_H_ */

View File

@ -0,0 +1,155 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "access_net_charging_identifier.h"
OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_create(
int acc_net_cha_id_value,
OpenAPI_list_t *flows
)
{
OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier_local_var = OpenAPI_malloc(sizeof(OpenAPI_access_net_charging_identifier_t));
if (!access_net_charging_identifier_local_var) {
return NULL;
}
access_net_charging_identifier_local_var->acc_net_cha_id_value = acc_net_cha_id_value;
access_net_charging_identifier_local_var->flows = flows;
return access_net_charging_identifier_local_var;
}
void OpenAPI_access_net_charging_identifier_free(OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier)
{
if (NULL == access_net_charging_identifier) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(access_net_charging_identifier->flows, node) {
OpenAPI_flows_free(node->data);
}
OpenAPI_list_free(access_net_charging_identifier->flows);
ogs_free(access_net_charging_identifier);
}
cJSON *OpenAPI_access_net_charging_identifier_convertToJSON(OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier)
{
cJSON *item = NULL;
if (access_net_charging_identifier == NULL) {
ogs_error("OpenAPI_access_net_charging_identifier_convertToJSON() failed [AccessNetChargingIdentifier]");
return NULL;
}
item = cJSON_CreateObject();
if (cJSON_AddNumberToObject(item, "accNetChaIdValue", access_net_charging_identifier->acc_net_cha_id_value) == NULL) {
ogs_error("OpenAPI_access_net_charging_identifier_convertToJSON() failed [acc_net_cha_id_value]");
goto end;
}
if (access_net_charging_identifier->flows) {
cJSON *flowsList = cJSON_AddArrayToObject(item, "flows");
if (flowsList == NULL) {
ogs_error("OpenAPI_access_net_charging_identifier_convertToJSON() failed [flows]");
goto end;
}
OpenAPI_lnode_t *flows_node;
if (access_net_charging_identifier->flows) {
OpenAPI_list_for_each(access_net_charging_identifier->flows, flows_node) {
cJSON *itemLocal = OpenAPI_flows_convertToJSON(flows_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_net_charging_identifier_convertToJSON() failed [flows]");
goto end;
}
cJSON_AddItemToArray(flowsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_parseFromJSON(cJSON *access_net_charging_identifierJSON)
{
OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier_local_var = NULL;
cJSON *acc_net_cha_id_value = cJSON_GetObjectItemCaseSensitive(access_net_charging_identifierJSON, "accNetChaIdValue");
if (!acc_net_cha_id_value) {
ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [acc_net_cha_id_value]");
goto end;
}
if (!cJSON_IsNumber(acc_net_cha_id_value)) {
ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [acc_net_cha_id_value]");
goto end;
}
cJSON *flows = cJSON_GetObjectItemCaseSensitive(access_net_charging_identifierJSON, "flows");
OpenAPI_list_t *flowsList;
if (flows) {
cJSON *flows_local_nonprimitive;
if (!cJSON_IsArray(flows)) {
ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [flows]");
goto end;
}
flowsList = OpenAPI_list_create();
cJSON_ArrayForEach(flows_local_nonprimitive, flows ) {
if (!cJSON_IsObject(flows_local_nonprimitive)) {
ogs_error("OpenAPI_access_net_charging_identifier_parseFromJSON() failed [flows]");
goto end;
}
OpenAPI_flows_t *flowsItem = OpenAPI_flows_parseFromJSON(flows_local_nonprimitive);
OpenAPI_list_add(flowsList, flowsItem);
}
}
access_net_charging_identifier_local_var = OpenAPI_access_net_charging_identifier_create (
acc_net_cha_id_value->valuedouble,
flows ? flowsList : NULL
);
return access_net_charging_identifier_local_var;
end:
return NULL;
}
OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_copy(OpenAPI_access_net_charging_identifier_t *dst, OpenAPI_access_net_charging_identifier_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_access_net_charging_identifier_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_access_net_charging_identifier_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_access_net_charging_identifier_free(dst);
dst = OpenAPI_access_net_charging_identifier_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,41 @@
/*
* access_net_charging_identifier.h
*
* Describes the access network charging identifier.
*/
#ifndef _OpenAPI_access_net_charging_identifier_H_
#define _OpenAPI_access_net_charging_identifier_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "flows.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_access_net_charging_identifier_s OpenAPI_access_net_charging_identifier_t;
typedef struct OpenAPI_access_net_charging_identifier_s {
int acc_net_cha_id_value;
OpenAPI_list_t *flows;
} OpenAPI_access_net_charging_identifier_t;
OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_create(
int acc_net_cha_id_value,
OpenAPI_list_t *flows
);
void OpenAPI_access_net_charging_identifier_free(OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier);
OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_parseFromJSON(cJSON *access_net_charging_identifierJSON);
cJSON *OpenAPI_access_net_charging_identifier_convertToJSON(OpenAPI_access_net_charging_identifier_t *access_net_charging_identifier);
OpenAPI_access_net_charging_identifier_t *OpenAPI_access_net_charging_identifier_copy(OpenAPI_access_net_charging_identifier_t *dst, OpenAPI_access_net_charging_identifier_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_access_net_charging_identifier_H_ */

View File

@ -0,0 +1,161 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "accumulated_usage.h"
OpenAPI_accumulated_usage_t *OpenAPI_accumulated_usage_create(
int duration,
long total_volume,
long downlink_volume,
long uplink_volume
)
{
OpenAPI_accumulated_usage_t *accumulated_usage_local_var = OpenAPI_malloc(sizeof(OpenAPI_accumulated_usage_t));
if (!accumulated_usage_local_var) {
return NULL;
}
accumulated_usage_local_var->duration = duration;
accumulated_usage_local_var->total_volume = total_volume;
accumulated_usage_local_var->downlink_volume = downlink_volume;
accumulated_usage_local_var->uplink_volume = uplink_volume;
return accumulated_usage_local_var;
}
void OpenAPI_accumulated_usage_free(OpenAPI_accumulated_usage_t *accumulated_usage)
{
if (NULL == accumulated_usage) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(accumulated_usage);
}
cJSON *OpenAPI_accumulated_usage_convertToJSON(OpenAPI_accumulated_usage_t *accumulated_usage)
{
cJSON *item = NULL;
if (accumulated_usage == NULL) {
ogs_error("OpenAPI_accumulated_usage_convertToJSON() failed [AccumulatedUsage]");
return NULL;
}
item = cJSON_CreateObject();
if (accumulated_usage->duration) {
if (cJSON_AddNumberToObject(item, "duration", accumulated_usage->duration) == NULL) {
ogs_error("OpenAPI_accumulated_usage_convertToJSON() failed [duration]");
goto end;
}
}
if (accumulated_usage->total_volume) {
if (cJSON_AddNumberToObject(item, "totalVolume", accumulated_usage->total_volume) == NULL) {
ogs_error("OpenAPI_accumulated_usage_convertToJSON() failed [total_volume]");
goto end;
}
}
if (accumulated_usage->downlink_volume) {
if (cJSON_AddNumberToObject(item, "downlinkVolume", accumulated_usage->downlink_volume) == NULL) {
ogs_error("OpenAPI_accumulated_usage_convertToJSON() failed [downlink_volume]");
goto end;
}
}
if (accumulated_usage->uplink_volume) {
if (cJSON_AddNumberToObject(item, "uplinkVolume", accumulated_usage->uplink_volume) == NULL) {
ogs_error("OpenAPI_accumulated_usage_convertToJSON() failed [uplink_volume]");
goto end;
}
}
end:
return item;
}
OpenAPI_accumulated_usage_t *OpenAPI_accumulated_usage_parseFromJSON(cJSON *accumulated_usageJSON)
{
OpenAPI_accumulated_usage_t *accumulated_usage_local_var = NULL;
cJSON *duration = cJSON_GetObjectItemCaseSensitive(accumulated_usageJSON, "duration");
if (duration) {
if (!cJSON_IsNumber(duration)) {
ogs_error("OpenAPI_accumulated_usage_parseFromJSON() failed [duration]");
goto end;
}
}
cJSON *total_volume = cJSON_GetObjectItemCaseSensitive(accumulated_usageJSON, "totalVolume");
if (total_volume) {
if (!cJSON_IsNumber(total_volume)) {
ogs_error("OpenAPI_accumulated_usage_parseFromJSON() failed [total_volume]");
goto end;
}
}
cJSON *downlink_volume = cJSON_GetObjectItemCaseSensitive(accumulated_usageJSON, "downlinkVolume");
if (downlink_volume) {
if (!cJSON_IsNumber(downlink_volume)) {
ogs_error("OpenAPI_accumulated_usage_parseFromJSON() failed [downlink_volume]");
goto end;
}
}
cJSON *uplink_volume = cJSON_GetObjectItemCaseSensitive(accumulated_usageJSON, "uplinkVolume");
if (uplink_volume) {
if (!cJSON_IsNumber(uplink_volume)) {
ogs_error("OpenAPI_accumulated_usage_parseFromJSON() failed [uplink_volume]");
goto end;
}
}
accumulated_usage_local_var = OpenAPI_accumulated_usage_create (
duration ? duration->valuedouble : 0,
total_volume ? total_volume->valuedouble : 0,
downlink_volume ? downlink_volume->valuedouble : 0,
uplink_volume ? uplink_volume->valuedouble : 0
);
return accumulated_usage_local_var;
end:
return NULL;
}
OpenAPI_accumulated_usage_t *OpenAPI_accumulated_usage_copy(OpenAPI_accumulated_usage_t *dst, OpenAPI_accumulated_usage_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_accumulated_usage_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_accumulated_usage_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_accumulated_usage_free(dst);
dst = OpenAPI_accumulated_usage_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,44 @@
/*
* accumulated_usage.h
*
*
*/
#ifndef _OpenAPI_accumulated_usage_H_
#define _OpenAPI_accumulated_usage_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_accumulated_usage_s OpenAPI_accumulated_usage_t;
typedef struct OpenAPI_accumulated_usage_s {
int duration;
long total_volume;
long downlink_volume;
long uplink_volume;
} OpenAPI_accumulated_usage_t;
OpenAPI_accumulated_usage_t *OpenAPI_accumulated_usage_create(
int duration,
long total_volume,
long downlink_volume,
long uplink_volume
);
void OpenAPI_accumulated_usage_free(OpenAPI_accumulated_usage_t *accumulated_usage);
OpenAPI_accumulated_usage_t *OpenAPI_accumulated_usage_parseFromJSON(cJSON *accumulated_usageJSON);
cJSON *OpenAPI_accumulated_usage_convertToJSON(OpenAPI_accumulated_usage_t *accumulated_usage);
OpenAPI_accumulated_usage_t *OpenAPI_accumulated_usage_copy(OpenAPI_accumulated_usage_t *dst, OpenAPI_accumulated_usage_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_accumulated_usage_H_ */

View File

@ -0,0 +1,160 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_event_notification.h"
OpenAPI_af_event_notification_t *OpenAPI_af_event_notification_create(
OpenAPI_af_event_t *event,
OpenAPI_list_t *flows
)
{
OpenAPI_af_event_notification_t *af_event_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_event_notification_t));
if (!af_event_notification_local_var) {
return NULL;
}
af_event_notification_local_var->event = event;
af_event_notification_local_var->flows = flows;
return af_event_notification_local_var;
}
void OpenAPI_af_event_notification_free(OpenAPI_af_event_notification_t *af_event_notification)
{
if (NULL == af_event_notification) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_af_event_free(af_event_notification->event);
OpenAPI_list_for_each(af_event_notification->flows, node) {
OpenAPI_flows_free(node->data);
}
OpenAPI_list_free(af_event_notification->flows);
ogs_free(af_event_notification);
}
cJSON *OpenAPI_af_event_notification_convertToJSON(OpenAPI_af_event_notification_t *af_event_notification)
{
cJSON *item = NULL;
if (af_event_notification == NULL) {
ogs_error("OpenAPI_af_event_notification_convertToJSON() failed [AfEventNotification]");
return NULL;
}
item = cJSON_CreateObject();
cJSON *event_local_JSON = OpenAPI_af_event_convertToJSON(af_event_notification->event);
if (event_local_JSON == NULL) {
ogs_error("OpenAPI_af_event_notification_convertToJSON() failed [event]");
goto end;
}
cJSON_AddItemToObject(item, "event", event_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_event_notification_convertToJSON() failed [event]");
goto end;
}
if (af_event_notification->flows) {
cJSON *flowsList = cJSON_AddArrayToObject(item, "flows");
if (flowsList == NULL) {
ogs_error("OpenAPI_af_event_notification_convertToJSON() failed [flows]");
goto end;
}
OpenAPI_lnode_t *flows_node;
if (af_event_notification->flows) {
OpenAPI_list_for_each(af_event_notification->flows, flows_node) {
cJSON *itemLocal = OpenAPI_flows_convertToJSON(flows_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_af_event_notification_convertToJSON() failed [flows]");
goto end;
}
cJSON_AddItemToArray(flowsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_af_event_notification_t *OpenAPI_af_event_notification_parseFromJSON(cJSON *af_event_notificationJSON)
{
OpenAPI_af_event_notification_t *af_event_notification_local_var = NULL;
cJSON *event = cJSON_GetObjectItemCaseSensitive(af_event_notificationJSON, "event");
if (!event) {
ogs_error("OpenAPI_af_event_notification_parseFromJSON() failed [event]");
goto end;
}
OpenAPI_af_event_t *event_local_nonprim = NULL;
event_local_nonprim = OpenAPI_af_event_parseFromJSON(event);
cJSON *flows = cJSON_GetObjectItemCaseSensitive(af_event_notificationJSON, "flows");
OpenAPI_list_t *flowsList;
if (flows) {
cJSON *flows_local_nonprimitive;
if (!cJSON_IsArray(flows)) {
ogs_error("OpenAPI_af_event_notification_parseFromJSON() failed [flows]");
goto end;
}
flowsList = OpenAPI_list_create();
cJSON_ArrayForEach(flows_local_nonprimitive, flows ) {
if (!cJSON_IsObject(flows_local_nonprimitive)) {
ogs_error("OpenAPI_af_event_notification_parseFromJSON() failed [flows]");
goto end;
}
OpenAPI_flows_t *flowsItem = OpenAPI_flows_parseFromJSON(flows_local_nonprimitive);
OpenAPI_list_add(flowsList, flowsItem);
}
}
af_event_notification_local_var = OpenAPI_af_event_notification_create (
event_local_nonprim,
flows ? flowsList : NULL
);
return af_event_notification_local_var;
end:
return NULL;
}
OpenAPI_af_event_notification_t *OpenAPI_af_event_notification_copy(OpenAPI_af_event_notification_t *dst, OpenAPI_af_event_notification_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_event_notification_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_event_notification_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_event_notification_free(dst);
dst = OpenAPI_af_event_notification_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,42 @@
/*
* af_event_notification.h
*
* describes the event information delivered in the notification
*/
#ifndef _OpenAPI_af_event_notification_H_
#define _OpenAPI_af_event_notification_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_event.h"
#include "flows.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_event_notification_s OpenAPI_af_event_notification_t;
typedef struct OpenAPI_af_event_notification_s {
struct OpenAPI_af_event_s *event;
OpenAPI_list_t *flows;
} OpenAPI_af_event_notification_t;
OpenAPI_af_event_notification_t *OpenAPI_af_event_notification_create(
OpenAPI_af_event_t *event,
OpenAPI_list_t *flows
);
void OpenAPI_af_event_notification_free(OpenAPI_af_event_notification_t *af_event_notification);
OpenAPI_af_event_notification_t *OpenAPI_af_event_notification_parseFromJSON(cJSON *af_event_notificationJSON);
cJSON *OpenAPI_af_event_notification_convertToJSON(OpenAPI_af_event_notification_t *af_event_notification);
OpenAPI_af_event_notification_t *OpenAPI_af_event_notification_copy(OpenAPI_af_event_notification_t *dst, OpenAPI_af_event_notification_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_event_notification_H_ */

View File

@ -0,0 +1,169 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_event_subscription.h"
OpenAPI_af_event_subscription_t *OpenAPI_af_event_subscription_create(
OpenAPI_af_event_t *event,
OpenAPI_af_notif_method_e notif_method,
int rep_period,
int wait_time
)
{
OpenAPI_af_event_subscription_t *af_event_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_event_subscription_t));
if (!af_event_subscription_local_var) {
return NULL;
}
af_event_subscription_local_var->event = event;
af_event_subscription_local_var->notif_method = notif_method;
af_event_subscription_local_var->rep_period = rep_period;
af_event_subscription_local_var->wait_time = wait_time;
return af_event_subscription_local_var;
}
void OpenAPI_af_event_subscription_free(OpenAPI_af_event_subscription_t *af_event_subscription)
{
if (NULL == af_event_subscription) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_af_event_free(af_event_subscription->event);
ogs_free(af_event_subscription);
}
cJSON *OpenAPI_af_event_subscription_convertToJSON(OpenAPI_af_event_subscription_t *af_event_subscription)
{
cJSON *item = NULL;
if (af_event_subscription == NULL) {
ogs_error("OpenAPI_af_event_subscription_convertToJSON() failed [AfEventSubscription]");
return NULL;
}
item = cJSON_CreateObject();
cJSON *event_local_JSON = OpenAPI_af_event_convertToJSON(af_event_subscription->event);
if (event_local_JSON == NULL) {
ogs_error("OpenAPI_af_event_subscription_convertToJSON() failed [event]");
goto end;
}
cJSON_AddItemToObject(item, "event", event_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_event_subscription_convertToJSON() failed [event]");
goto end;
}
if (af_event_subscription->notif_method) {
if (cJSON_AddStringToObject(item, "notifMethod", OpenAPI_af_notif_method_ToString(af_event_subscription->notif_method)) == NULL) {
ogs_error("OpenAPI_af_event_subscription_convertToJSON() failed [notif_method]");
goto end;
}
}
if (af_event_subscription->rep_period) {
if (cJSON_AddNumberToObject(item, "repPeriod", af_event_subscription->rep_period) == NULL) {
ogs_error("OpenAPI_af_event_subscription_convertToJSON() failed [rep_period]");
goto end;
}
}
if (af_event_subscription->wait_time) {
if (cJSON_AddNumberToObject(item, "waitTime", af_event_subscription->wait_time) == NULL) {
ogs_error("OpenAPI_af_event_subscription_convertToJSON() failed [wait_time]");
goto end;
}
}
end:
return item;
}
OpenAPI_af_event_subscription_t *OpenAPI_af_event_subscription_parseFromJSON(cJSON *af_event_subscriptionJSON)
{
OpenAPI_af_event_subscription_t *af_event_subscription_local_var = NULL;
cJSON *event = cJSON_GetObjectItemCaseSensitive(af_event_subscriptionJSON, "event");
if (!event) {
ogs_error("OpenAPI_af_event_subscription_parseFromJSON() failed [event]");
goto end;
}
OpenAPI_af_event_t *event_local_nonprim = NULL;
event_local_nonprim = OpenAPI_af_event_parseFromJSON(event);
cJSON *notif_method = cJSON_GetObjectItemCaseSensitive(af_event_subscriptionJSON, "notifMethod");
OpenAPI_af_notif_method_e notif_methodVariable;
if (notif_method) {
if (!cJSON_IsString(notif_method)) {
ogs_error("OpenAPI_af_event_subscription_parseFromJSON() failed [notif_method]");
goto end;
}
notif_methodVariable = OpenAPI_af_notif_method_FromString(notif_method->valuestring);
}
cJSON *rep_period = cJSON_GetObjectItemCaseSensitive(af_event_subscriptionJSON, "repPeriod");
if (rep_period) {
if (!cJSON_IsNumber(rep_period)) {
ogs_error("OpenAPI_af_event_subscription_parseFromJSON() failed [rep_period]");
goto end;
}
}
cJSON *wait_time = cJSON_GetObjectItemCaseSensitive(af_event_subscriptionJSON, "waitTime");
if (wait_time) {
if (!cJSON_IsNumber(wait_time)) {
ogs_error("OpenAPI_af_event_subscription_parseFromJSON() failed [wait_time]");
goto end;
}
}
af_event_subscription_local_var = OpenAPI_af_event_subscription_create (
event_local_nonprim,
notif_method ? notif_methodVariable : 0,
rep_period ? rep_period->valuedouble : 0,
wait_time ? wait_time->valuedouble : 0
);
return af_event_subscription_local_var;
end:
return NULL;
}
OpenAPI_af_event_subscription_t *OpenAPI_af_event_subscription_copy(OpenAPI_af_event_subscription_t *dst, OpenAPI_af_event_subscription_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_event_subscription_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_event_subscription_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_event_subscription_free(dst);
dst = OpenAPI_af_event_subscription_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,46 @@
/*
* af_event_subscription.h
*
* describes the event information delivered in the subscription
*/
#ifndef _OpenAPI_af_event_subscription_H_
#define _OpenAPI_af_event_subscription_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_event.h"
#include "af_notif_method.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_event_subscription_s OpenAPI_af_event_subscription_t;
typedef struct OpenAPI_af_event_subscription_s {
struct OpenAPI_af_event_s *event;
OpenAPI_af_notif_method_e notif_method;
int rep_period;
int wait_time;
} OpenAPI_af_event_subscription_t;
OpenAPI_af_event_subscription_t *OpenAPI_af_event_subscription_create(
OpenAPI_af_event_t *event,
OpenAPI_af_notif_method_e notif_method,
int rep_period,
int wait_time
);
void OpenAPI_af_event_subscription_free(OpenAPI_af_event_subscription_t *af_event_subscription);
OpenAPI_af_event_subscription_t *OpenAPI_af_event_subscription_parseFromJSON(cJSON *af_event_subscriptionJSON);
cJSON *OpenAPI_af_event_subscription_convertToJSON(OpenAPI_af_event_subscription_t *af_event_subscription);
OpenAPI_af_event_subscription_t *OpenAPI_af_event_subscription_copy(OpenAPI_af_event_subscription_t *dst, OpenAPI_af_event_subscription_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_event_subscription_H_ */

View File

@ -0,0 +1,30 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_notif_method.h"
char* OpenAPI_af_notif_method_ToString(OpenAPI_af_notif_method_e af_notif_method)
{
const char *af_notif_methodArray[] = { "NULL", "EVENT_DETECTION", "ONE_TIME", "PERIODIC", "PDU_SESSION_RELEASE" };
size_t sizeofArray = sizeof(af_notif_methodArray) / sizeof(af_notif_methodArray[0]);
if (af_notif_method < sizeofArray)
return (char *)af_notif_methodArray[af_notif_method];
else
return (char *)"Unknown";
}
OpenAPI_af_notif_method_e OpenAPI_af_notif_method_FromString(char* af_notif_method)
{
int stringToReturn = 0;
const char *af_notif_methodArray[] = { "NULL", "EVENT_DETECTION", "ONE_TIME", "PERIODIC", "PDU_SESSION_RELEASE" };
size_t sizeofArray = sizeof(af_notif_methodArray) / sizeof(af_notif_methodArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(af_notif_method, af_notif_methodArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
return 0;
}

View File

@ -0,0 +1,31 @@
/*
* af_notif_method.h
*
*
*/
#ifndef _OpenAPI_af_notif_method_H_
#define _OpenAPI_af_notif_method_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 enum { OpenAPI_af_notif_method_NULL = 0, OpenAPI_af_notif_method_EVENT_DETECTION, OpenAPI_af_notif_method_ONE_TIME, OpenAPI_af_notif_method_PERIODIC, OpenAPI_af_notif_method_PDU_SESSION_RELEASE } OpenAPI_af_notif_method_e;
char* OpenAPI_af_notif_method_ToString(OpenAPI_af_notif_method_e af_notif_method);
OpenAPI_af_notif_method_e OpenAPI_af_notif_method_FromString(char* af_notif_method);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_notif_method_H_ */

View File

@ -0,0 +1,30 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_requested_data.h"
char* OpenAPI_af_requested_data_ToString(OpenAPI_af_requested_data_e af_requested_data)
{
const char *af_requested_dataArray[] = { "NULL", "UE_IDENTITY" };
size_t sizeofArray = sizeof(af_requested_dataArray) / sizeof(af_requested_dataArray[0]);
if (af_requested_data < sizeofArray)
return (char *)af_requested_dataArray[af_requested_data];
else
return (char *)"Unknown";
}
OpenAPI_af_requested_data_e OpenAPI_af_requested_data_FromString(char* af_requested_data)
{
int stringToReturn = 0;
const char *af_requested_dataArray[] = { "NULL", "UE_IDENTITY" };
size_t sizeofArray = sizeof(af_requested_dataArray) / sizeof(af_requested_dataArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(af_requested_data, af_requested_dataArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
return 0;
}

View File

@ -0,0 +1,31 @@
/*
* af_requested_data.h
*
*
*/
#ifndef _OpenAPI_af_requested_data_H_
#define _OpenAPI_af_requested_data_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 enum { OpenAPI_af_requested_data_NULL = 0, OpenAPI_af_requested_data_UE_IDENTITY } OpenAPI_af_requested_data_e;
char* OpenAPI_af_requested_data_ToString(OpenAPI_af_requested_data_e af_requested_data);
OpenAPI_af_requested_data_e OpenAPI_af_requested_data_FromString(char* af_requested_data);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_requested_data_H_ */

View File

@ -0,0 +1,271 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_routing_requirement.h"
OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_create(
int app_reloc,
OpenAPI_list_t *route_to_locs,
OpenAPI_spatial_validity_t *sp_val,
OpenAPI_list_t *temp_vals,
OpenAPI_up_path_chg_event_t *up_path_chg_sub,
int addr_preser_ind
)
{
OpenAPI_af_routing_requirement_t *af_routing_requirement_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_routing_requirement_t));
if (!af_routing_requirement_local_var) {
return NULL;
}
af_routing_requirement_local_var->app_reloc = app_reloc;
af_routing_requirement_local_var->route_to_locs = route_to_locs;
af_routing_requirement_local_var->sp_val = sp_val;
af_routing_requirement_local_var->temp_vals = temp_vals;
af_routing_requirement_local_var->up_path_chg_sub = up_path_chg_sub;
af_routing_requirement_local_var->addr_preser_ind = addr_preser_ind;
return af_routing_requirement_local_var;
}
void OpenAPI_af_routing_requirement_free(OpenAPI_af_routing_requirement_t *af_routing_requirement)
{
if (NULL == af_routing_requirement) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(af_routing_requirement->route_to_locs, node) {
OpenAPI_route_to_location_free(node->data);
}
OpenAPI_list_free(af_routing_requirement->route_to_locs);
OpenAPI_spatial_validity_free(af_routing_requirement->sp_val);
OpenAPI_list_for_each(af_routing_requirement->temp_vals, node) {
OpenAPI_temporal_validity_free(node->data);
}
OpenAPI_list_free(af_routing_requirement->temp_vals);
OpenAPI_up_path_chg_event_free(af_routing_requirement->up_path_chg_sub);
ogs_free(af_routing_requirement);
}
cJSON *OpenAPI_af_routing_requirement_convertToJSON(OpenAPI_af_routing_requirement_t *af_routing_requirement)
{
cJSON *item = NULL;
if (af_routing_requirement == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [AfRoutingRequirement]");
return NULL;
}
item = cJSON_CreateObject();
if (af_routing_requirement->app_reloc) {
if (cJSON_AddBoolToObject(item, "appReloc", af_routing_requirement->app_reloc) == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [app_reloc]");
goto end;
}
}
if (af_routing_requirement->route_to_locs) {
cJSON *route_to_locsList = cJSON_AddArrayToObject(item, "routeToLocs");
if (route_to_locsList == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [route_to_locs]");
goto end;
}
OpenAPI_lnode_t *route_to_locs_node;
if (af_routing_requirement->route_to_locs) {
OpenAPI_list_for_each(af_routing_requirement->route_to_locs, route_to_locs_node) {
cJSON *itemLocal = OpenAPI_route_to_location_convertToJSON(route_to_locs_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [route_to_locs]");
goto end;
}
cJSON_AddItemToArray(route_to_locsList, itemLocal);
}
}
}
if (af_routing_requirement->sp_val) {
cJSON *sp_val_local_JSON = OpenAPI_spatial_validity_convertToJSON(af_routing_requirement->sp_val);
if (sp_val_local_JSON == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [sp_val]");
goto end;
}
cJSON_AddItemToObject(item, "spVal", sp_val_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [sp_val]");
goto end;
}
}
if (af_routing_requirement->temp_vals) {
cJSON *temp_valsList = cJSON_AddArrayToObject(item, "tempVals");
if (temp_valsList == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [temp_vals]");
goto end;
}
OpenAPI_lnode_t *temp_vals_node;
if (af_routing_requirement->temp_vals) {
OpenAPI_list_for_each(af_routing_requirement->temp_vals, temp_vals_node) {
cJSON *itemLocal = OpenAPI_temporal_validity_convertToJSON(temp_vals_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [temp_vals]");
goto end;
}
cJSON_AddItemToArray(temp_valsList, itemLocal);
}
}
}
if (af_routing_requirement->up_path_chg_sub) {
cJSON *up_path_chg_sub_local_JSON = OpenAPI_up_path_chg_event_convertToJSON(af_routing_requirement->up_path_chg_sub);
if (up_path_chg_sub_local_JSON == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [up_path_chg_sub]");
goto end;
}
cJSON_AddItemToObject(item, "upPathChgSub", up_path_chg_sub_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [up_path_chg_sub]");
goto end;
}
}
if (af_routing_requirement->addr_preser_ind) {
if (cJSON_AddBoolToObject(item, "addrPreserInd", af_routing_requirement->addr_preser_ind) == NULL) {
ogs_error("OpenAPI_af_routing_requirement_convertToJSON() failed [addr_preser_ind]");
goto end;
}
}
end:
return item;
}
OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_parseFromJSON(cJSON *af_routing_requirementJSON)
{
OpenAPI_af_routing_requirement_t *af_routing_requirement_local_var = NULL;
cJSON *app_reloc = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "appReloc");
if (app_reloc) {
if (!cJSON_IsBool(app_reloc)) {
ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [app_reloc]");
goto end;
}
}
cJSON *route_to_locs = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "routeToLocs");
OpenAPI_list_t *route_to_locsList;
if (route_to_locs) {
cJSON *route_to_locs_local_nonprimitive;
if (!cJSON_IsArray(route_to_locs)) {
ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [route_to_locs]");
goto end;
}
route_to_locsList = OpenAPI_list_create();
cJSON_ArrayForEach(route_to_locs_local_nonprimitive, route_to_locs ) {
if (!cJSON_IsObject(route_to_locs_local_nonprimitive)) {
ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [route_to_locs]");
goto end;
}
OpenAPI_route_to_location_t *route_to_locsItem = OpenAPI_route_to_location_parseFromJSON(route_to_locs_local_nonprimitive);
OpenAPI_list_add(route_to_locsList, route_to_locsItem);
}
}
cJSON *sp_val = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "spVal");
OpenAPI_spatial_validity_t *sp_val_local_nonprim = NULL;
if (sp_val) {
sp_val_local_nonprim = OpenAPI_spatial_validity_parseFromJSON(sp_val);
}
cJSON *temp_vals = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "tempVals");
OpenAPI_list_t *temp_valsList;
if (temp_vals) {
cJSON *temp_vals_local_nonprimitive;
if (!cJSON_IsArray(temp_vals)) {
ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [temp_vals]");
goto end;
}
temp_valsList = OpenAPI_list_create();
cJSON_ArrayForEach(temp_vals_local_nonprimitive, temp_vals ) {
if (!cJSON_IsObject(temp_vals_local_nonprimitive)) {
ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [temp_vals]");
goto end;
}
OpenAPI_temporal_validity_t *temp_valsItem = OpenAPI_temporal_validity_parseFromJSON(temp_vals_local_nonprimitive);
OpenAPI_list_add(temp_valsList, temp_valsItem);
}
}
cJSON *up_path_chg_sub = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "upPathChgSub");
OpenAPI_up_path_chg_event_t *up_path_chg_sub_local_nonprim = NULL;
if (up_path_chg_sub) {
up_path_chg_sub_local_nonprim = OpenAPI_up_path_chg_event_parseFromJSON(up_path_chg_sub);
}
cJSON *addr_preser_ind = cJSON_GetObjectItemCaseSensitive(af_routing_requirementJSON, "addrPreserInd");
if (addr_preser_ind) {
if (!cJSON_IsBool(addr_preser_ind)) {
ogs_error("OpenAPI_af_routing_requirement_parseFromJSON() failed [addr_preser_ind]");
goto end;
}
}
af_routing_requirement_local_var = OpenAPI_af_routing_requirement_create (
app_reloc ? app_reloc->valueint : 0,
route_to_locs ? route_to_locsList : NULL,
sp_val ? sp_val_local_nonprim : NULL,
temp_vals ? temp_valsList : NULL,
up_path_chg_sub ? up_path_chg_sub_local_nonprim : NULL,
addr_preser_ind ? addr_preser_ind->valueint : 0
);
return af_routing_requirement_local_var;
end:
return NULL;
}
OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_copy(OpenAPI_af_routing_requirement_t *dst, OpenAPI_af_routing_requirement_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_routing_requirement_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_routing_requirement_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_routing_requirement_free(dst);
dst = OpenAPI_af_routing_requirement_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,52 @@
/*
* af_routing_requirement.h
*
* describes the event information delivered in the subscription
*/
#ifndef _OpenAPI_af_routing_requirement_H_
#define _OpenAPI_af_routing_requirement_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "route_to_location.h"
#include "spatial_validity.h"
#include "temporal_validity.h"
#include "up_path_chg_event.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_routing_requirement_s OpenAPI_af_routing_requirement_t;
typedef struct OpenAPI_af_routing_requirement_s {
int app_reloc;
OpenAPI_list_t *route_to_locs;
struct OpenAPI_spatial_validity_s *sp_val;
OpenAPI_list_t *temp_vals;
struct OpenAPI_up_path_chg_event_s *up_path_chg_sub;
int addr_preser_ind;
} OpenAPI_af_routing_requirement_t;
OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_create(
int app_reloc,
OpenAPI_list_t *route_to_locs,
OpenAPI_spatial_validity_t *sp_val,
OpenAPI_list_t *temp_vals,
OpenAPI_up_path_chg_event_t *up_path_chg_sub,
int addr_preser_ind
);
void OpenAPI_af_routing_requirement_free(OpenAPI_af_routing_requirement_t *af_routing_requirement);
OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_parseFromJSON(cJSON *af_routing_requirementJSON);
cJSON *OpenAPI_af_routing_requirement_convertToJSON(OpenAPI_af_routing_requirement_t *af_routing_requirement);
OpenAPI_af_routing_requirement_t *OpenAPI_af_routing_requirement_copy(OpenAPI_af_routing_requirement_t *dst, OpenAPI_af_routing_requirement_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_routing_requirement_H_ */

View File

@ -0,0 +1,271 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_routing_requirement_rm.h"
OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_create(
int app_reloc,
OpenAPI_list_t *route_to_locs,
OpenAPI_spatial_validity_rm_t *sp_val,
OpenAPI_list_t *temp_vals,
OpenAPI_up_path_chg_event_t *up_path_chg_sub,
int addr_preser_ind
)
{
OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_routing_requirement_rm_t));
if (!af_routing_requirement_rm_local_var) {
return NULL;
}
af_routing_requirement_rm_local_var->app_reloc = app_reloc;
af_routing_requirement_rm_local_var->route_to_locs = route_to_locs;
af_routing_requirement_rm_local_var->sp_val = sp_val;
af_routing_requirement_rm_local_var->temp_vals = temp_vals;
af_routing_requirement_rm_local_var->up_path_chg_sub = up_path_chg_sub;
af_routing_requirement_rm_local_var->addr_preser_ind = addr_preser_ind;
return af_routing_requirement_rm_local_var;
}
void OpenAPI_af_routing_requirement_rm_free(OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm)
{
if (NULL == af_routing_requirement_rm) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(af_routing_requirement_rm->route_to_locs, node) {
OpenAPI_route_to_location_free(node->data);
}
OpenAPI_list_free(af_routing_requirement_rm->route_to_locs);
OpenAPI_spatial_validity_rm_free(af_routing_requirement_rm->sp_val);
OpenAPI_list_for_each(af_routing_requirement_rm->temp_vals, node) {
OpenAPI_temporal_validity_free(node->data);
}
OpenAPI_list_free(af_routing_requirement_rm->temp_vals);
OpenAPI_up_path_chg_event_free(af_routing_requirement_rm->up_path_chg_sub);
ogs_free(af_routing_requirement_rm);
}
cJSON *OpenAPI_af_routing_requirement_rm_convertToJSON(OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm)
{
cJSON *item = NULL;
if (af_routing_requirement_rm == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [AfRoutingRequirementRm]");
return NULL;
}
item = cJSON_CreateObject();
if (af_routing_requirement_rm->app_reloc) {
if (cJSON_AddBoolToObject(item, "appReloc", af_routing_requirement_rm->app_reloc) == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [app_reloc]");
goto end;
}
}
if (af_routing_requirement_rm->route_to_locs) {
cJSON *route_to_locsList = cJSON_AddArrayToObject(item, "routeToLocs");
if (route_to_locsList == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [route_to_locs]");
goto end;
}
OpenAPI_lnode_t *route_to_locs_node;
if (af_routing_requirement_rm->route_to_locs) {
OpenAPI_list_for_each(af_routing_requirement_rm->route_to_locs, route_to_locs_node) {
cJSON *itemLocal = OpenAPI_route_to_location_convertToJSON(route_to_locs_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [route_to_locs]");
goto end;
}
cJSON_AddItemToArray(route_to_locsList, itemLocal);
}
}
}
if (af_routing_requirement_rm->sp_val) {
cJSON *sp_val_local_JSON = OpenAPI_spatial_validity_rm_convertToJSON(af_routing_requirement_rm->sp_val);
if (sp_val_local_JSON == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [sp_val]");
goto end;
}
cJSON_AddItemToObject(item, "spVal", sp_val_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [sp_val]");
goto end;
}
}
if (af_routing_requirement_rm->temp_vals) {
cJSON *temp_valsList = cJSON_AddArrayToObject(item, "tempVals");
if (temp_valsList == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [temp_vals]");
goto end;
}
OpenAPI_lnode_t *temp_vals_node;
if (af_routing_requirement_rm->temp_vals) {
OpenAPI_list_for_each(af_routing_requirement_rm->temp_vals, temp_vals_node) {
cJSON *itemLocal = OpenAPI_temporal_validity_convertToJSON(temp_vals_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [temp_vals]");
goto end;
}
cJSON_AddItemToArray(temp_valsList, itemLocal);
}
}
}
if (af_routing_requirement_rm->up_path_chg_sub) {
cJSON *up_path_chg_sub_local_JSON = OpenAPI_up_path_chg_event_convertToJSON(af_routing_requirement_rm->up_path_chg_sub);
if (up_path_chg_sub_local_JSON == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [up_path_chg_sub]");
goto end;
}
cJSON_AddItemToObject(item, "upPathChgSub", up_path_chg_sub_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [up_path_chg_sub]");
goto end;
}
}
if (af_routing_requirement_rm->addr_preser_ind) {
if (cJSON_AddBoolToObject(item, "addrPreserInd", af_routing_requirement_rm->addr_preser_ind) == NULL) {
ogs_error("OpenAPI_af_routing_requirement_rm_convertToJSON() failed [addr_preser_ind]");
goto end;
}
}
end:
return item;
}
OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_parseFromJSON(cJSON *af_routing_requirement_rmJSON)
{
OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm_local_var = NULL;
cJSON *app_reloc = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "appReloc");
if (app_reloc) {
if (!cJSON_IsBool(app_reloc)) {
ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [app_reloc]");
goto end;
}
}
cJSON *route_to_locs = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "routeToLocs");
OpenAPI_list_t *route_to_locsList;
if (route_to_locs) {
cJSON *route_to_locs_local_nonprimitive;
if (!cJSON_IsArray(route_to_locs)) {
ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [route_to_locs]");
goto end;
}
route_to_locsList = OpenAPI_list_create();
cJSON_ArrayForEach(route_to_locs_local_nonprimitive, route_to_locs ) {
if (!cJSON_IsObject(route_to_locs_local_nonprimitive)) {
ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [route_to_locs]");
goto end;
}
OpenAPI_route_to_location_t *route_to_locsItem = OpenAPI_route_to_location_parseFromJSON(route_to_locs_local_nonprimitive);
OpenAPI_list_add(route_to_locsList, route_to_locsItem);
}
}
cJSON *sp_val = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "spVal");
OpenAPI_spatial_validity_rm_t *sp_val_local_nonprim = NULL;
if (sp_val) {
sp_val_local_nonprim = OpenAPI_spatial_validity_rm_parseFromJSON(sp_val);
}
cJSON *temp_vals = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "tempVals");
OpenAPI_list_t *temp_valsList;
if (temp_vals) {
cJSON *temp_vals_local_nonprimitive;
if (!cJSON_IsArray(temp_vals)) {
ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [temp_vals]");
goto end;
}
temp_valsList = OpenAPI_list_create();
cJSON_ArrayForEach(temp_vals_local_nonprimitive, temp_vals ) {
if (!cJSON_IsObject(temp_vals_local_nonprimitive)) {
ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [temp_vals]");
goto end;
}
OpenAPI_temporal_validity_t *temp_valsItem = OpenAPI_temporal_validity_parseFromJSON(temp_vals_local_nonprimitive);
OpenAPI_list_add(temp_valsList, temp_valsItem);
}
}
cJSON *up_path_chg_sub = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "upPathChgSub");
OpenAPI_up_path_chg_event_t *up_path_chg_sub_local_nonprim = NULL;
if (up_path_chg_sub) {
up_path_chg_sub_local_nonprim = OpenAPI_up_path_chg_event_parseFromJSON(up_path_chg_sub);
}
cJSON *addr_preser_ind = cJSON_GetObjectItemCaseSensitive(af_routing_requirement_rmJSON, "addrPreserInd");
if (addr_preser_ind) {
if (!cJSON_IsBool(addr_preser_ind)) {
ogs_error("OpenAPI_af_routing_requirement_rm_parseFromJSON() failed [addr_preser_ind]");
goto end;
}
}
af_routing_requirement_rm_local_var = OpenAPI_af_routing_requirement_rm_create (
app_reloc ? app_reloc->valueint : 0,
route_to_locs ? route_to_locsList : NULL,
sp_val ? sp_val_local_nonprim : NULL,
temp_vals ? temp_valsList : NULL,
up_path_chg_sub ? up_path_chg_sub_local_nonprim : NULL,
addr_preser_ind ? addr_preser_ind->valueint : 0
);
return af_routing_requirement_rm_local_var;
end:
return NULL;
}
OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_copy(OpenAPI_af_routing_requirement_rm_t *dst, OpenAPI_af_routing_requirement_rm_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_routing_requirement_rm_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_routing_requirement_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_af_routing_requirement_rm_free(dst);
dst = OpenAPI_af_routing_requirement_rm_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,52 @@
/*
* af_routing_requirement_rm.h
*
* this data type is defined in the same way as the AfRoutingRequirement data type, but with the OpenAPI nullable property set to true and the spVal and tempVals attributes defined as removable.
*/
#ifndef _OpenAPI_af_routing_requirement_rm_H_
#define _OpenAPI_af_routing_requirement_rm_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "route_to_location.h"
#include "spatial_validity_rm.h"
#include "temporal_validity.h"
#include "up_path_chg_event.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_routing_requirement_rm_s OpenAPI_af_routing_requirement_rm_t;
typedef struct OpenAPI_af_routing_requirement_rm_s {
int app_reloc;
OpenAPI_list_t *route_to_locs;
struct OpenAPI_spatial_validity_rm_s *sp_val;
OpenAPI_list_t *temp_vals;
struct OpenAPI_up_path_chg_event_s *up_path_chg_sub;
int addr_preser_ind;
} OpenAPI_af_routing_requirement_rm_t;
OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_create(
int app_reloc,
OpenAPI_list_t *route_to_locs,
OpenAPI_spatial_validity_rm_t *sp_val,
OpenAPI_list_t *temp_vals,
OpenAPI_up_path_chg_event_t *up_path_chg_sub,
int addr_preser_ind
);
void OpenAPI_af_routing_requirement_rm_free(OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm);
OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_parseFromJSON(cJSON *af_routing_requirement_rmJSON);
cJSON *OpenAPI_af_routing_requirement_rm_convertToJSON(OpenAPI_af_routing_requirement_rm_t *af_routing_requirement_rm);
OpenAPI_af_routing_requirement_rm_t *OpenAPI_af_routing_requirement_rm_copy(OpenAPI_af_routing_requirement_rm_t *dst, OpenAPI_af_routing_requirement_rm_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_routing_requirement_rm_H_ */

View File

@ -9,7 +9,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre
char *supported_features,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
char *dereg_callback_uri,
char *amf_service_name_dereg,
char *pcscf_restoration_callback_uri,
@ -68,7 +68,6 @@ void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registrat
ogs_free(amf3_gpp_access_registration->amf_instance_id);
ogs_free(amf3_gpp_access_registration->supported_features);
ogs_free(amf3_gpp_access_registration->pei);
OpenAPI_ims_vo_ps_free(amf3_gpp_access_registration->ims_vo_ps);
ogs_free(amf3_gpp_access_registration->dereg_callback_uri);
ogs_free(amf3_gpp_access_registration->amf_service_name_dereg);
ogs_free(amf3_gpp_access_registration->pcscf_restoration_callback_uri);
@ -123,13 +122,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces
}
if (amf3_gpp_access_registration->ims_vo_ps) {
cJSON *ims_vo_ps_local_JSON = OpenAPI_ims_vo_ps_convertToJSON(amf3_gpp_access_registration->ims_vo_ps);
if (ims_vo_ps_local_JSON == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ims_vo_ps]");
goto end;
}
cJSON_AddItemToObject(item, "imsVoPs", ims_vo_ps_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "imsVoPs", OpenAPI_ims_vo_ps_ToString(amf3_gpp_access_registration->ims_vo_ps)) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ims_vo_ps]");
goto end;
}
@ -333,9 +326,13 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par
cJSON *ims_vo_ps = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "imsVoPs");
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_nonprim = NULL;
OpenAPI_ims_vo_ps_e ims_vo_psVariable;
if (ims_vo_ps) {
ims_vo_ps_local_nonprim = OpenAPI_ims_vo_ps_parseFromJSON(ims_vo_ps);
if (!cJSON_IsString(ims_vo_ps)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [ims_vo_ps]");
goto end;
}
ims_vo_psVariable = OpenAPI_ims_vo_ps_FromString(ims_vo_ps->valuestring);
}
cJSON *dereg_callback_uri = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "deregCallbackUri");
@ -513,7 +510,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
purge_flag ? purge_flag->valueint : 0,
pei ? ogs_strdup(pei->valuestring) : NULL,
ims_vo_ps ? ims_vo_ps_local_nonprim : NULL,
ims_vo_ps ? ims_vo_psVariable : 0,
ogs_strdup(dereg_callback_uri->valuestring),
amf_service_name_dereg ? ogs_strdup(amf_service_name_dereg->valuestring) : NULL,
pcscf_restoration_callback_uri ? ogs_strdup(pcscf_restoration_callback_uri->valuestring) : NULL,

View File

@ -30,7 +30,7 @@ typedef struct OpenAPI_amf3_gpp_access_registration_s {
char *supported_features;
int purge_flag;
char *pei;
struct OpenAPI_ims_vo_ps_s *ims_vo_ps;
OpenAPI_ims_vo_ps_e ims_vo_ps;
char *dereg_callback_uri;
char *amf_service_name_dereg;
char *pcscf_restoration_callback_uri;
@ -55,7 +55,7 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre
char *supported_features,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
char *dereg_callback_uri,
char *amf_service_name_dereg,
char *pcscf_restoration_callback_uri,

View File

@ -8,7 +8,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
OpenAPI_guami_t *guami,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
OpenAPI_list_t *backup_amf_info,
OpenAPI_eps_interworking_info_t *eps_interworking_info,
int ue_srvcc_capability,
@ -39,7 +39,6 @@ void OpenAPI_amf3_gpp_access_registration_modification_free(OpenAPI_amf3_gpp_acc
OpenAPI_lnode_t *node;
OpenAPI_guami_free(amf3_gpp_access_registration_modification->guami);
ogs_free(amf3_gpp_access_registration_modification->pei);
OpenAPI_ims_vo_ps_free(amf3_gpp_access_registration_modification->ims_vo_ps);
OpenAPI_list_for_each(amf3_gpp_access_registration_modification->backup_amf_info, node) {
OpenAPI_backup_amf_info_free(node->data);
}
@ -84,13 +83,7 @@ cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_a
}
if (amf3_gpp_access_registration_modification->ims_vo_ps) {
cJSON *ims_vo_ps_local_JSON = OpenAPI_ims_vo_ps_convertToJSON(amf3_gpp_access_registration_modification->ims_vo_ps);
if (ims_vo_ps_local_JSON == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [ims_vo_ps]");
goto end;
}
cJSON_AddItemToObject(item, "imsVoPs", ims_vo_ps_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "imsVoPs", OpenAPI_ims_vo_ps_ToString(amf3_gpp_access_registration_modification->ims_vo_ps)) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [ims_vo_ps]");
goto end;
}
@ -180,9 +173,13 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
cJSON *ims_vo_ps = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registration_modificationJSON, "imsVoPs");
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_nonprim = NULL;
OpenAPI_ims_vo_ps_e ims_vo_psVariable;
if (ims_vo_ps) {
ims_vo_ps_local_nonprim = OpenAPI_ims_vo_ps_parseFromJSON(ims_vo_ps);
if (!cJSON_IsString(ims_vo_ps)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON() failed [ims_vo_ps]");
goto end;
}
ims_vo_psVariable = OpenAPI_ims_vo_ps_FromString(ims_vo_ps->valuestring);
}
cJSON *backup_amf_info = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registration_modificationJSON, "backupAmfInfo");
@ -237,7 +234,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
guami_local_nonprim,
purge_flag ? purge_flag->valueint : 0,
pei ? ogs_strdup(pei->valuestring) : NULL,
ims_vo_ps ? ims_vo_ps_local_nonprim : NULL,
ims_vo_ps ? ims_vo_psVariable : 0,
backup_amf_info ? backup_amf_infoList : NULL,
eps_interworking_info ? eps_interworking_info_local_nonprim : NULL,
ue_srvcc_capability ? ue_srvcc_capability->valueint : 0,

View File

@ -26,7 +26,7 @@ typedef struct OpenAPI_amf3_gpp_access_registration_modification_s {
struct OpenAPI_guami_s *guami;
int purge_flag;
char *pei;
struct OpenAPI_ims_vo_ps_s *ims_vo_ps;
OpenAPI_ims_vo_ps_e ims_vo_ps;
OpenAPI_list_t *backup_amf_info;
struct OpenAPI_eps_interworking_info_s *eps_interworking_info;
int ue_srvcc_capability;
@ -37,7 +37,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
OpenAPI_guami_t *guami,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
OpenAPI_list_t *backup_amf_info,
OpenAPI_eps_interworking_info_t *eps_interworking_info,
int ue_srvcc_capability,

View File

@ -5,7 +5,7 @@
#include "amf_dereg_info.h"
OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_create(
OpenAPI_deregistration_reason_t *dereg_reason
OpenAPI_deregistration_reason_e dereg_reason
)
{
OpenAPI_amf_dereg_info_t *amf_dereg_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_dereg_info_t));
@ -23,7 +23,6 @@ void OpenAPI_amf_dereg_info_free(OpenAPI_amf_dereg_info_t *amf_dereg_info)
return;
}
OpenAPI_lnode_t *node;
OpenAPI_deregistration_reason_free(amf_dereg_info->dereg_reason);
ogs_free(amf_dereg_info);
}
@ -37,13 +36,7 @@ cJSON *OpenAPI_amf_dereg_info_convertToJSON(OpenAPI_amf_dereg_info_t *amf_dereg_
}
item = cJSON_CreateObject();
cJSON *dereg_reason_local_JSON = OpenAPI_deregistration_reason_convertToJSON(amf_dereg_info->dereg_reason);
if (dereg_reason_local_JSON == NULL) {
ogs_error("OpenAPI_amf_dereg_info_convertToJSON() failed [dereg_reason]");
goto end;
}
cJSON_AddItemToObject(item, "deregReason", dereg_reason_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "deregReason", OpenAPI_deregistration_reason_ToString(amf_dereg_info->dereg_reason)) == NULL) {
ogs_error("OpenAPI_amf_dereg_info_convertToJSON() failed [dereg_reason]");
goto end;
}
@ -61,12 +54,16 @@ OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_parseFromJSON(cJSON *amf_dereg_
goto end;
}
OpenAPI_deregistration_reason_t *dereg_reason_local_nonprim = NULL;
OpenAPI_deregistration_reason_e dereg_reasonVariable;
dereg_reason_local_nonprim = OpenAPI_deregistration_reason_parseFromJSON(dereg_reason);
if (!cJSON_IsString(dereg_reason)) {
ogs_error("OpenAPI_amf_dereg_info_parseFromJSON() failed [dereg_reason]");
goto end;
}
dereg_reasonVariable = OpenAPI_deregistration_reason_FromString(dereg_reason->valuestring);
amf_dereg_info_local_var = OpenAPI_amf_dereg_info_create (
dereg_reason_local_nonprim
dereg_reasonVariable
);
return amf_dereg_info_local_var;

View File

@ -20,11 +20,11 @@ extern "C" {
typedef struct OpenAPI_amf_dereg_info_s OpenAPI_amf_dereg_info_t;
typedef struct OpenAPI_amf_dereg_info_s {
struct OpenAPI_deregistration_reason_s *dereg_reason;
OpenAPI_deregistration_reason_e dereg_reason;
} OpenAPI_amf_dereg_info_t;
OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_create(
OpenAPI_deregistration_reason_t *dereg_reason
OpenAPI_deregistration_reason_e dereg_reason
);
void OpenAPI_amf_dereg_info_free(OpenAPI_amf_dereg_info_t *amf_dereg_info);
OpenAPI_amf_dereg_info_t *OpenAPI_amf_dereg_info_parseFromJSON(cJSON *amf_dereg_infoJSON);

View File

@ -9,7 +9,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
char *supported_features,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
char *dereg_callback_uri,
char *amf_service_name_dereg,
char *pcscf_restoration_callback_uri,
@ -58,7 +58,6 @@ void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_r
ogs_free(amf_non3_gpp_access_registration->amf_instance_id);
ogs_free(amf_non3_gpp_access_registration->supported_features);
ogs_free(amf_non3_gpp_access_registration->pei);
OpenAPI_ims_vo_ps_free(amf_non3_gpp_access_registration->ims_vo_ps);
ogs_free(amf_non3_gpp_access_registration->dereg_callback_uri);
ogs_free(amf_non3_gpp_access_registration->amf_service_name_dereg);
ogs_free(amf_non3_gpp_access_registration->pcscf_restoration_callback_uri);
@ -111,13 +110,7 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g
}
}
cJSON *ims_vo_ps_local_JSON = OpenAPI_ims_vo_ps_convertToJSON(amf_non3_gpp_access_registration->ims_vo_ps);
if (ims_vo_ps_local_JSON == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [ims_vo_ps]");
goto end;
}
cJSON_AddItemToObject(item, "imsVoPs", ims_vo_ps_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "imsVoPs", OpenAPI_ims_vo_ps_ToString(amf_non3_gpp_access_registration->ims_vo_ps)) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [ims_vo_ps]");
goto end;
}
@ -283,9 +276,13 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
goto end;
}
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_nonprim = NULL;
OpenAPI_ims_vo_ps_e ims_vo_psVariable;
ims_vo_ps_local_nonprim = OpenAPI_ims_vo_ps_parseFromJSON(ims_vo_ps);
if (!cJSON_IsString(ims_vo_ps)) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [ims_vo_ps]");
goto end;
}
ims_vo_psVariable = OpenAPI_ims_vo_ps_FromString(ims_vo_ps->valuestring);
cJSON *dereg_callback_uri = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "deregCallbackUri");
if (!dereg_callback_uri) {
@ -419,7 +416,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
purge_flag ? purge_flag->valueint : 0,
pei ? ogs_strdup(pei->valuestring) : NULL,
ims_vo_ps_local_nonprim,
ims_vo_psVariable,
ogs_strdup(dereg_callback_uri->valuestring),
amf_service_name_dereg ? ogs_strdup(amf_service_name_dereg->valuestring) : NULL,
pcscf_restoration_callback_uri ? ogs_strdup(pcscf_restoration_callback_uri->valuestring) : NULL,

View File

@ -29,7 +29,7 @@ typedef struct OpenAPI_amf_non3_gpp_access_registration_s {
char *supported_features;
int purge_flag;
char *pei;
struct OpenAPI_ims_vo_ps_s *ims_vo_ps;
OpenAPI_ims_vo_ps_e ims_vo_ps;
char *dereg_callback_uri;
char *amf_service_name_dereg;
char *pcscf_restoration_callback_uri;
@ -49,7 +49,7 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
char *supported_features,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
char *dereg_callback_uri,
char *amf_service_name_dereg,
char *pcscf_restoration_callback_uri,

View File

@ -8,7 +8,7 @@ OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_ac
OpenAPI_guami_t *guami,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
OpenAPI_list_t *backup_amf_info
)
{
@ -33,7 +33,6 @@ void OpenAPI_amf_non3_gpp_access_registration_modification_free(OpenAPI_amf_non3
OpenAPI_lnode_t *node;
OpenAPI_guami_free(amf_non3_gpp_access_registration_modification->guami);
ogs_free(amf_non3_gpp_access_registration_modification->pei);
OpenAPI_ims_vo_ps_free(amf_non3_gpp_access_registration_modification->ims_vo_ps);
OpenAPI_list_for_each(amf_non3_gpp_access_registration_modification->backup_amf_info, node) {
OpenAPI_backup_amf_info_free(node->data);
}
@ -77,13 +76,7 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON(OpenA
}
if (amf_non3_gpp_access_registration_modification->ims_vo_ps) {
cJSON *ims_vo_ps_local_JSON = OpenAPI_ims_vo_ps_convertToJSON(amf_non3_gpp_access_registration_modification->ims_vo_ps);
if (ims_vo_ps_local_JSON == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON() failed [ims_vo_ps]");
goto end;
}
cJSON_AddItemToObject(item, "imsVoPs", ims_vo_ps_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "imsVoPs", OpenAPI_ims_vo_ps_ToString(amf_non3_gpp_access_registration_modification->ims_vo_ps)) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_modification_convertToJSON() failed [ims_vo_ps]");
goto end;
}
@ -146,9 +139,13 @@ OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_ac
cJSON *ims_vo_ps = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registration_modificationJSON, "imsVoPs");
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_nonprim = NULL;
OpenAPI_ims_vo_ps_e ims_vo_psVariable;
if (ims_vo_ps) {
ims_vo_ps_local_nonprim = OpenAPI_ims_vo_ps_parseFromJSON(ims_vo_ps);
if (!cJSON_IsString(ims_vo_ps)) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_modification_parseFromJSON() failed [ims_vo_ps]");
goto end;
}
ims_vo_psVariable = OpenAPI_ims_vo_ps_FromString(ims_vo_ps->valuestring);
}
cJSON *backup_amf_info = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registration_modificationJSON, "backupAmfInfo");
@ -178,7 +175,7 @@ OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_ac
guami_local_nonprim,
purge_flag ? purge_flag->valueint : 0,
pei ? ogs_strdup(pei->valuestring) : NULL,
ims_vo_ps ? ims_vo_ps_local_nonprim : NULL,
ims_vo_ps ? ims_vo_psVariable : 0,
backup_amf_info ? backup_amf_infoList : NULL
);

View File

@ -25,7 +25,7 @@ typedef struct OpenAPI_amf_non3_gpp_access_registration_modification_s {
struct OpenAPI_guami_s *guami;
int purge_flag;
char *pei;
struct OpenAPI_ims_vo_ps_s *ims_vo_ps;
OpenAPI_ims_vo_ps_e ims_vo_ps;
OpenAPI_list_t *backup_amf_info;
} OpenAPI_amf_non3_gpp_access_registration_modification_t;
@ -33,7 +33,7 @@ OpenAPI_amf_non3_gpp_access_registration_modification_t *OpenAPI_amf_non3_gpp_ac
OpenAPI_guami_t *guami,
int purge_flag,
char *pei,
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_ims_vo_ps_e ims_vo_ps,
OpenAPI_list_t *backup_amf_info
);
void OpenAPI_amf_non3_gpp_access_registration_modification_free(OpenAPI_amf_non3_gpp_access_registration_modification_t *amf_non3_gpp_access_registration_modification);

View File

@ -0,0 +1,157 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "app_session_context.h"
OpenAPI_app_session_context_t *OpenAPI_app_session_context_create(
OpenAPI_app_session_context_req_data_t *asc_req_data,
OpenAPI_app_session_context_resp_data_t *asc_resp_data,
OpenAPI_events_notification_t *evs_notif
)
{
OpenAPI_app_session_context_t *app_session_context_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_session_context_t));
if (!app_session_context_local_var) {
return NULL;
}
app_session_context_local_var->asc_req_data = asc_req_data;
app_session_context_local_var->asc_resp_data = asc_resp_data;
app_session_context_local_var->evs_notif = evs_notif;
return app_session_context_local_var;
}
void OpenAPI_app_session_context_free(OpenAPI_app_session_context_t *app_session_context)
{
if (NULL == app_session_context) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_app_session_context_req_data_free(app_session_context->asc_req_data);
OpenAPI_app_session_context_resp_data_free(app_session_context->asc_resp_data);
OpenAPI_events_notification_free(app_session_context->evs_notif);
ogs_free(app_session_context);
}
cJSON *OpenAPI_app_session_context_convertToJSON(OpenAPI_app_session_context_t *app_session_context)
{
cJSON *item = NULL;
if (app_session_context == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [AppSessionContext]");
return NULL;
}
item = cJSON_CreateObject();
if (app_session_context->asc_req_data) {
cJSON *asc_req_data_local_JSON = OpenAPI_app_session_context_req_data_convertToJSON(app_session_context->asc_req_data);
if (asc_req_data_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [asc_req_data]");
goto end;
}
cJSON_AddItemToObject(item, "ascReqData", asc_req_data_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [asc_req_data]");
goto end;
}
}
if (app_session_context->asc_resp_data) {
cJSON *asc_resp_data_local_JSON = OpenAPI_app_session_context_resp_data_convertToJSON(app_session_context->asc_resp_data);
if (asc_resp_data_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [asc_resp_data]");
goto end;
}
cJSON_AddItemToObject(item, "ascRespData", asc_resp_data_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [asc_resp_data]");
goto end;
}
}
if (app_session_context->evs_notif) {
cJSON *evs_notif_local_JSON = OpenAPI_events_notification_convertToJSON(app_session_context->evs_notif);
if (evs_notif_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [evs_notif]");
goto end;
}
cJSON_AddItemToObject(item, "evsNotif", evs_notif_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_convertToJSON() failed [evs_notif]");
goto end;
}
}
end:
return item;
}
OpenAPI_app_session_context_t *OpenAPI_app_session_context_parseFromJSON(cJSON *app_session_contextJSON)
{
OpenAPI_app_session_context_t *app_session_context_local_var = NULL;
cJSON *asc_req_data = cJSON_GetObjectItemCaseSensitive(app_session_contextJSON, "ascReqData");
OpenAPI_app_session_context_req_data_t *asc_req_data_local_nonprim = NULL;
if (asc_req_data) {
asc_req_data_local_nonprim = OpenAPI_app_session_context_req_data_parseFromJSON(asc_req_data);
}
cJSON *asc_resp_data = cJSON_GetObjectItemCaseSensitive(app_session_contextJSON, "ascRespData");
OpenAPI_app_session_context_resp_data_t *asc_resp_data_local_nonprim = NULL;
if (asc_resp_data) {
asc_resp_data_local_nonprim = OpenAPI_app_session_context_resp_data_parseFromJSON(asc_resp_data);
}
cJSON *evs_notif = cJSON_GetObjectItemCaseSensitive(app_session_contextJSON, "evsNotif");
OpenAPI_events_notification_t *evs_notif_local_nonprim = NULL;
if (evs_notif) {
evs_notif_local_nonprim = OpenAPI_events_notification_parseFromJSON(evs_notif);
}
app_session_context_local_var = OpenAPI_app_session_context_create (
asc_req_data ? asc_req_data_local_nonprim : NULL,
asc_resp_data ? asc_resp_data_local_nonprim : NULL,
evs_notif ? evs_notif_local_nonprim : NULL
);
return app_session_context_local_var;
end:
return NULL;
}
OpenAPI_app_session_context_t *OpenAPI_app_session_context_copy(OpenAPI_app_session_context_t *dst, OpenAPI_app_session_context_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_app_session_context_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_app_session_context_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_session_context_free(dst);
dst = OpenAPI_app_session_context_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,45 @@
/*
* app_session_context.h
*
* Represents an Individual Application Session Context resource.
*/
#ifndef _OpenAPI_app_session_context_H_
#define _OpenAPI_app_session_context_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "app_session_context_req_data.h"
#include "app_session_context_resp_data.h"
#include "events_notification.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_app_session_context_s OpenAPI_app_session_context_t;
typedef struct OpenAPI_app_session_context_s {
struct OpenAPI_app_session_context_req_data_s *asc_req_data;
struct OpenAPI_app_session_context_resp_data_s *asc_resp_data;
struct OpenAPI_events_notification_s *evs_notif;
} OpenAPI_app_session_context_t;
OpenAPI_app_session_context_t *OpenAPI_app_session_context_create(
OpenAPI_app_session_context_req_data_t *asc_req_data,
OpenAPI_app_session_context_resp_data_t *asc_resp_data,
OpenAPI_events_notification_t *evs_notif
);
void OpenAPI_app_session_context_free(OpenAPI_app_session_context_t *app_session_context);
OpenAPI_app_session_context_t *OpenAPI_app_session_context_parseFromJSON(cJSON *app_session_contextJSON);
cJSON *OpenAPI_app_session_context_convertToJSON(OpenAPI_app_session_context_t *app_session_context);
OpenAPI_app_session_context_t *OpenAPI_app_session_context_copy(OpenAPI_app_session_context_t *dst, OpenAPI_app_session_context_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_app_session_context_H_ */

View File

@ -0,0 +1,771 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "app_session_context_req_data.h"
OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_create(
char *af_app_id,
char *af_charg_id,
OpenAPI_af_requested_data_e af_req_data,
OpenAPI_af_routing_requirement_t *af_rout_req,
char *asp_id,
char *bdt_ref_id,
char *dnn,
OpenAPI_events_subsc_req_data_t *ev_subsc,
char *mcptt_id,
char *mc_video_id,
OpenAPI_list_t* med_components,
char *ip_domain,
char *mps_id,
char *mcs_id,
OpenAPI_preemption_control_information_e preempt_control_info,
OpenAPI_reserv_priority_e res_prio,
OpenAPI_service_info_status_e serv_inf_status,
char *notif_uri,
char *serv_urn,
OpenAPI_snssai_t *slice_info,
char *spon_id,
OpenAPI_sponsoring_status_e spon_status,
char *supi,
char *gpsi,
char *supp_feat,
char *ue_ipv4,
char *ue_ipv6,
char *ue_mac,
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt,
OpenAPI_list_t *tsn_port_man_cont_nwtts
)
{
OpenAPI_app_session_context_req_data_t *app_session_context_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_session_context_req_data_t));
if (!app_session_context_req_data_local_var) {
return NULL;
}
app_session_context_req_data_local_var->af_app_id = af_app_id;
app_session_context_req_data_local_var->af_charg_id = af_charg_id;
app_session_context_req_data_local_var->af_req_data = af_req_data;
app_session_context_req_data_local_var->af_rout_req = af_rout_req;
app_session_context_req_data_local_var->asp_id = asp_id;
app_session_context_req_data_local_var->bdt_ref_id = bdt_ref_id;
app_session_context_req_data_local_var->dnn = dnn;
app_session_context_req_data_local_var->ev_subsc = ev_subsc;
app_session_context_req_data_local_var->mcptt_id = mcptt_id;
app_session_context_req_data_local_var->mc_video_id = mc_video_id;
app_session_context_req_data_local_var->med_components = med_components;
app_session_context_req_data_local_var->ip_domain = ip_domain;
app_session_context_req_data_local_var->mps_id = mps_id;
app_session_context_req_data_local_var->mcs_id = mcs_id;
app_session_context_req_data_local_var->preempt_control_info = preempt_control_info;
app_session_context_req_data_local_var->res_prio = res_prio;
app_session_context_req_data_local_var->serv_inf_status = serv_inf_status;
app_session_context_req_data_local_var->notif_uri = notif_uri;
app_session_context_req_data_local_var->serv_urn = serv_urn;
app_session_context_req_data_local_var->slice_info = slice_info;
app_session_context_req_data_local_var->spon_id = spon_id;
app_session_context_req_data_local_var->spon_status = spon_status;
app_session_context_req_data_local_var->supi = supi;
app_session_context_req_data_local_var->gpsi = gpsi;
app_session_context_req_data_local_var->supp_feat = supp_feat;
app_session_context_req_data_local_var->ue_ipv4 = ue_ipv4;
app_session_context_req_data_local_var->ue_ipv6 = ue_ipv6;
app_session_context_req_data_local_var->ue_mac = ue_mac;
app_session_context_req_data_local_var->tsn_port_man_cont_dstt = tsn_port_man_cont_dstt;
app_session_context_req_data_local_var->tsn_port_man_cont_nwtts = tsn_port_man_cont_nwtts;
return app_session_context_req_data_local_var;
}
void OpenAPI_app_session_context_req_data_free(OpenAPI_app_session_context_req_data_t *app_session_context_req_data)
{
if (NULL == app_session_context_req_data) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(app_session_context_req_data->af_app_id);
ogs_free(app_session_context_req_data->af_charg_id);
OpenAPI_af_routing_requirement_free(app_session_context_req_data->af_rout_req);
ogs_free(app_session_context_req_data->asp_id);
ogs_free(app_session_context_req_data->bdt_ref_id);
ogs_free(app_session_context_req_data->dnn);
OpenAPI_events_subsc_req_data_free(app_session_context_req_data->ev_subsc);
ogs_free(app_session_context_req_data->mcptt_id);
ogs_free(app_session_context_req_data->mc_video_id);
OpenAPI_list_for_each(app_session_context_req_data->med_components, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_media_component_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(app_session_context_req_data->med_components);
ogs_free(app_session_context_req_data->ip_domain);
ogs_free(app_session_context_req_data->mps_id);
ogs_free(app_session_context_req_data->mcs_id);
ogs_free(app_session_context_req_data->notif_uri);
ogs_free(app_session_context_req_data->serv_urn);
OpenAPI_snssai_free(app_session_context_req_data->slice_info);
ogs_free(app_session_context_req_data->spon_id);
ogs_free(app_session_context_req_data->supi);
ogs_free(app_session_context_req_data->gpsi);
ogs_free(app_session_context_req_data->supp_feat);
ogs_free(app_session_context_req_data->ue_ipv4);
ogs_free(app_session_context_req_data->ue_ipv6);
ogs_free(app_session_context_req_data->ue_mac);
OpenAPI_port_management_container_free(app_session_context_req_data->tsn_port_man_cont_dstt);
OpenAPI_list_for_each(app_session_context_req_data->tsn_port_man_cont_nwtts, node) {
OpenAPI_port_management_container_free(node->data);
}
OpenAPI_list_free(app_session_context_req_data->tsn_port_man_cont_nwtts);
ogs_free(app_session_context_req_data);
}
cJSON *OpenAPI_app_session_context_req_data_convertToJSON(OpenAPI_app_session_context_req_data_t *app_session_context_req_data)
{
cJSON *item = NULL;
if (app_session_context_req_data == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [AppSessionContextReqData]");
return NULL;
}
item = cJSON_CreateObject();
if (app_session_context_req_data->af_app_id) {
if (cJSON_AddStringToObject(item, "afAppId", app_session_context_req_data->af_app_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [af_app_id]");
goto end;
}
}
if (app_session_context_req_data->af_charg_id) {
if (cJSON_AddStringToObject(item, "afChargId", app_session_context_req_data->af_charg_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [af_charg_id]");
goto end;
}
}
if (app_session_context_req_data->af_req_data) {
if (cJSON_AddStringToObject(item, "afReqData", OpenAPI_af_requested_data_ToString(app_session_context_req_data->af_req_data)) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [af_req_data]");
goto end;
}
}
if (app_session_context_req_data->af_rout_req) {
cJSON *af_rout_req_local_JSON = OpenAPI_af_routing_requirement_convertToJSON(app_session_context_req_data->af_rout_req);
if (af_rout_req_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [af_rout_req]");
goto end;
}
cJSON_AddItemToObject(item, "afRoutReq", af_rout_req_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [af_rout_req]");
goto end;
}
}
if (app_session_context_req_data->asp_id) {
if (cJSON_AddStringToObject(item, "aspId", app_session_context_req_data->asp_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [asp_id]");
goto end;
}
}
if (app_session_context_req_data->bdt_ref_id) {
if (cJSON_AddStringToObject(item, "bdtRefId", app_session_context_req_data->bdt_ref_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [bdt_ref_id]");
goto end;
}
}
if (app_session_context_req_data->dnn) {
if (cJSON_AddStringToObject(item, "dnn", app_session_context_req_data->dnn) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [dnn]");
goto end;
}
}
if (app_session_context_req_data->ev_subsc) {
cJSON *ev_subsc_local_JSON = OpenAPI_events_subsc_req_data_convertToJSON(app_session_context_req_data->ev_subsc);
if (ev_subsc_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [ev_subsc]");
goto end;
}
cJSON_AddItemToObject(item, "evSubsc", ev_subsc_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [ev_subsc]");
goto end;
}
}
if (app_session_context_req_data->mcptt_id) {
if (cJSON_AddStringToObject(item, "mcpttId", app_session_context_req_data->mcptt_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [mcptt_id]");
goto end;
}
}
if (app_session_context_req_data->mc_video_id) {
if (cJSON_AddStringToObject(item, "mcVideoId", app_session_context_req_data->mc_video_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [mc_video_id]");
goto end;
}
}
if (app_session_context_req_data->med_components) {
cJSON *med_components = cJSON_AddObjectToObject(item, "medComponents");
if (med_components == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [med_components]");
goto end;
}
cJSON *localMapObject = med_components;
OpenAPI_lnode_t *med_components_node;
if (app_session_context_req_data->med_components) {
OpenAPI_list_for_each(app_session_context_req_data->med_components, med_components_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)med_components_node->data;
cJSON *itemLocal = OpenAPI_media_component_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [med_components]");
goto end;
}
cJSON_AddItemToObject(med_components, localKeyValue->key, itemLocal);
}
}
}
if (app_session_context_req_data->ip_domain) {
if (cJSON_AddStringToObject(item, "ipDomain", app_session_context_req_data->ip_domain) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [ip_domain]");
goto end;
}
}
if (app_session_context_req_data->mps_id) {
if (cJSON_AddStringToObject(item, "mpsId", app_session_context_req_data->mps_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [mps_id]");
goto end;
}
}
if (app_session_context_req_data->mcs_id) {
if (cJSON_AddStringToObject(item, "mcsId", app_session_context_req_data->mcs_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [mcs_id]");
goto end;
}
}
if (app_session_context_req_data->preempt_control_info) {
if (cJSON_AddStringToObject(item, "preemptControlInfo", OpenAPI_preemption_control_information_ToString(app_session_context_req_data->preempt_control_info)) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [preempt_control_info]");
goto end;
}
}
if (app_session_context_req_data->res_prio) {
if (cJSON_AddStringToObject(item, "resPrio", OpenAPI_reserv_priority_ToString(app_session_context_req_data->res_prio)) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [res_prio]");
goto end;
}
}
if (app_session_context_req_data->serv_inf_status) {
if (cJSON_AddStringToObject(item, "servInfStatus", OpenAPI_service_info_status_ToString(app_session_context_req_data->serv_inf_status)) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [serv_inf_status]");
goto end;
}
}
if (cJSON_AddStringToObject(item, "notifUri", app_session_context_req_data->notif_uri) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [notif_uri]");
goto end;
}
if (app_session_context_req_data->serv_urn) {
if (cJSON_AddStringToObject(item, "servUrn", app_session_context_req_data->serv_urn) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [serv_urn]");
goto end;
}
}
if (app_session_context_req_data->slice_info) {
cJSON *slice_info_local_JSON = OpenAPI_snssai_convertToJSON(app_session_context_req_data->slice_info);
if (slice_info_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [slice_info]");
goto end;
}
cJSON_AddItemToObject(item, "sliceInfo", slice_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [slice_info]");
goto end;
}
}
if (app_session_context_req_data->spon_id) {
if (cJSON_AddStringToObject(item, "sponId", app_session_context_req_data->spon_id) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [spon_id]");
goto end;
}
}
if (app_session_context_req_data->spon_status) {
if (cJSON_AddStringToObject(item, "sponStatus", OpenAPI_sponsoring_status_ToString(app_session_context_req_data->spon_status)) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [spon_status]");
goto end;
}
}
if (app_session_context_req_data->supi) {
if (cJSON_AddStringToObject(item, "supi", app_session_context_req_data->supi) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [supi]");
goto end;
}
}
if (app_session_context_req_data->gpsi) {
if (cJSON_AddStringToObject(item, "gpsi", app_session_context_req_data->gpsi) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [gpsi]");
goto end;
}
}
if (cJSON_AddStringToObject(item, "suppFeat", app_session_context_req_data->supp_feat) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [supp_feat]");
goto end;
}
if (app_session_context_req_data->ue_ipv4) {
if (cJSON_AddStringToObject(item, "ueIpv4", app_session_context_req_data->ue_ipv4) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [ue_ipv4]");
goto end;
}
}
if (app_session_context_req_data->ue_ipv6) {
if (cJSON_AddStringToObject(item, "ueIpv6", app_session_context_req_data->ue_ipv6) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [ue_ipv6]");
goto end;
}
}
if (app_session_context_req_data->ue_mac) {
if (cJSON_AddStringToObject(item, "ueMac", app_session_context_req_data->ue_mac) == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [ue_mac]");
goto end;
}
}
if (app_session_context_req_data->tsn_port_man_cont_dstt) {
cJSON *tsn_port_man_cont_dstt_local_JSON = OpenAPI_port_management_container_convertToJSON(app_session_context_req_data->tsn_port_man_cont_dstt);
if (tsn_port_man_cont_dstt_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [tsn_port_man_cont_dstt]");
goto end;
}
cJSON_AddItemToObject(item, "tsnPortManContDstt", tsn_port_man_cont_dstt_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [tsn_port_man_cont_dstt]");
goto end;
}
}
if (app_session_context_req_data->tsn_port_man_cont_nwtts) {
cJSON *tsn_port_man_cont_nwttsList = cJSON_AddArrayToObject(item, "tsnPortManContNwtts");
if (tsn_port_man_cont_nwttsList == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
OpenAPI_lnode_t *tsn_port_man_cont_nwtts_node;
if (app_session_context_req_data->tsn_port_man_cont_nwtts) {
OpenAPI_list_for_each(app_session_context_req_data->tsn_port_man_cont_nwtts, tsn_port_man_cont_nwtts_node) {
cJSON *itemLocal = OpenAPI_port_management_container_convertToJSON(tsn_port_man_cont_nwtts_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_app_session_context_req_data_convertToJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
cJSON_AddItemToArray(tsn_port_man_cont_nwttsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_parseFromJSON(cJSON *app_session_context_req_dataJSON)
{
OpenAPI_app_session_context_req_data_t *app_session_context_req_data_local_var = NULL;
cJSON *af_app_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "afAppId");
if (af_app_id) {
if (!cJSON_IsString(af_app_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [af_app_id]");
goto end;
}
}
cJSON *af_charg_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "afChargId");
if (af_charg_id) {
if (!cJSON_IsString(af_charg_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [af_charg_id]");
goto end;
}
}
cJSON *af_req_data = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "afReqData");
OpenAPI_af_requested_data_e af_req_dataVariable;
if (af_req_data) {
if (!cJSON_IsString(af_req_data)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [af_req_data]");
goto end;
}
af_req_dataVariable = OpenAPI_af_requested_data_FromString(af_req_data->valuestring);
}
cJSON *af_rout_req = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "afRoutReq");
OpenAPI_af_routing_requirement_t *af_rout_req_local_nonprim = NULL;
if (af_rout_req) {
af_rout_req_local_nonprim = OpenAPI_af_routing_requirement_parseFromJSON(af_rout_req);
}
cJSON *asp_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "aspId");
if (asp_id) {
if (!cJSON_IsString(asp_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [asp_id]");
goto end;
}
}
cJSON *bdt_ref_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "bdtRefId");
if (bdt_ref_id) {
if (!cJSON_IsString(bdt_ref_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [bdt_ref_id]");
goto end;
}
}
cJSON *dnn = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "dnn");
if (dnn) {
if (!cJSON_IsString(dnn)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [dnn]");
goto end;
}
}
cJSON *ev_subsc = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "evSubsc");
OpenAPI_events_subsc_req_data_t *ev_subsc_local_nonprim = NULL;
if (ev_subsc) {
ev_subsc_local_nonprim = OpenAPI_events_subsc_req_data_parseFromJSON(ev_subsc);
}
cJSON *mcptt_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "mcpttId");
if (mcptt_id) {
if (!cJSON_IsString(mcptt_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [mcptt_id]");
goto end;
}
}
cJSON *mc_video_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "mcVideoId");
if (mc_video_id) {
if (!cJSON_IsString(mc_video_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [mc_video_id]");
goto end;
}
}
cJSON *med_components = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "medComponents");
OpenAPI_list_t *med_componentsList;
if (med_components) {
cJSON *med_components_local_map;
if (!cJSON_IsObject(med_components)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [med_components]");
goto end;
}
med_componentsList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(med_components_local_map, med_components) {
cJSON *localMapObject = med_components_local_map;
if (!cJSON_IsObject(med_components_local_map)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [med_components]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_media_component_parseFromJSON(localMapObject));
OpenAPI_list_add(med_componentsList, localMapKeyPair);
}
}
cJSON *ip_domain = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "ipDomain");
if (ip_domain) {
if (!cJSON_IsString(ip_domain)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [ip_domain]");
goto end;
}
}
cJSON *mps_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "mpsId");
if (mps_id) {
if (!cJSON_IsString(mps_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [mps_id]");
goto end;
}
}
cJSON *mcs_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "mcsId");
if (mcs_id) {
if (!cJSON_IsString(mcs_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [mcs_id]");
goto end;
}
}
cJSON *preempt_control_info = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "preemptControlInfo");
OpenAPI_preemption_control_information_e preempt_control_infoVariable;
if (preempt_control_info) {
if (!cJSON_IsString(preempt_control_info)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [preempt_control_info]");
goto end;
}
preempt_control_infoVariable = OpenAPI_preemption_control_information_FromString(preempt_control_info->valuestring);
}
cJSON *res_prio = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "resPrio");
OpenAPI_reserv_priority_e res_prioVariable;
if (res_prio) {
if (!cJSON_IsString(res_prio)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [res_prio]");
goto end;
}
res_prioVariable = OpenAPI_reserv_priority_FromString(res_prio->valuestring);
}
cJSON *serv_inf_status = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "servInfStatus");
OpenAPI_service_info_status_e serv_inf_statusVariable;
if (serv_inf_status) {
if (!cJSON_IsString(serv_inf_status)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [serv_inf_status]");
goto end;
}
serv_inf_statusVariable = OpenAPI_service_info_status_FromString(serv_inf_status->valuestring);
}
cJSON *notif_uri = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "notifUri");
if (!notif_uri) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [notif_uri]");
goto end;
}
if (!cJSON_IsString(notif_uri)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [notif_uri]");
goto end;
}
cJSON *serv_urn = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "servUrn");
if (serv_urn) {
if (!cJSON_IsString(serv_urn)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [serv_urn]");
goto end;
}
}
cJSON *slice_info = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "sliceInfo");
OpenAPI_snssai_t *slice_info_local_nonprim = NULL;
if (slice_info) {
slice_info_local_nonprim = OpenAPI_snssai_parseFromJSON(slice_info);
}
cJSON *spon_id = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "sponId");
if (spon_id) {
if (!cJSON_IsString(spon_id)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [spon_id]");
goto end;
}
}
cJSON *spon_status = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "sponStatus");
OpenAPI_sponsoring_status_e spon_statusVariable;
if (spon_status) {
if (!cJSON_IsString(spon_status)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [spon_status]");
goto end;
}
spon_statusVariable = OpenAPI_sponsoring_status_FromString(spon_status->valuestring);
}
cJSON *supi = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "supi");
if (supi) {
if (!cJSON_IsString(supi)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [supi]");
goto end;
}
}
cJSON *gpsi = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "gpsi");
if (gpsi) {
if (!cJSON_IsString(gpsi)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [gpsi]");
goto end;
}
}
cJSON *supp_feat = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "suppFeat");
if (!supp_feat) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [supp_feat]");
goto end;
}
if (!cJSON_IsString(supp_feat)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [supp_feat]");
goto end;
}
cJSON *ue_ipv4 = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "ueIpv4");
if (ue_ipv4) {
if (!cJSON_IsString(ue_ipv4)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [ue_ipv4]");
goto end;
}
}
cJSON *ue_ipv6 = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "ueIpv6");
if (ue_ipv6) {
if (!cJSON_IsString(ue_ipv6)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [ue_ipv6]");
goto end;
}
}
cJSON *ue_mac = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "ueMac");
if (ue_mac) {
if (!cJSON_IsString(ue_mac)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [ue_mac]");
goto end;
}
}
cJSON *tsn_port_man_cont_dstt = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "tsnPortManContDstt");
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt_local_nonprim = NULL;
if (tsn_port_man_cont_dstt) {
tsn_port_man_cont_dstt_local_nonprim = OpenAPI_port_management_container_parseFromJSON(tsn_port_man_cont_dstt);
}
cJSON *tsn_port_man_cont_nwtts = cJSON_GetObjectItemCaseSensitive(app_session_context_req_dataJSON, "tsnPortManContNwtts");
OpenAPI_list_t *tsn_port_man_cont_nwttsList;
if (tsn_port_man_cont_nwtts) {
cJSON *tsn_port_man_cont_nwtts_local_nonprimitive;
if (!cJSON_IsArray(tsn_port_man_cont_nwtts)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
tsn_port_man_cont_nwttsList = OpenAPI_list_create();
cJSON_ArrayForEach(tsn_port_man_cont_nwtts_local_nonprimitive, tsn_port_man_cont_nwtts ) {
if (!cJSON_IsObject(tsn_port_man_cont_nwtts_local_nonprimitive)) {
ogs_error("OpenAPI_app_session_context_req_data_parseFromJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
OpenAPI_port_management_container_t *tsn_port_man_cont_nwttsItem = OpenAPI_port_management_container_parseFromJSON(tsn_port_man_cont_nwtts_local_nonprimitive);
OpenAPI_list_add(tsn_port_man_cont_nwttsList, tsn_port_man_cont_nwttsItem);
}
}
app_session_context_req_data_local_var = OpenAPI_app_session_context_req_data_create (
af_app_id ? ogs_strdup(af_app_id->valuestring) : NULL,
af_charg_id ? ogs_strdup(af_charg_id->valuestring) : NULL,
af_req_data ? af_req_dataVariable : 0,
af_rout_req ? af_rout_req_local_nonprim : NULL,
asp_id ? ogs_strdup(asp_id->valuestring) : NULL,
bdt_ref_id ? ogs_strdup(bdt_ref_id->valuestring) : NULL,
dnn ? ogs_strdup(dnn->valuestring) : NULL,
ev_subsc ? ev_subsc_local_nonprim : NULL,
mcptt_id ? ogs_strdup(mcptt_id->valuestring) : NULL,
mc_video_id ? ogs_strdup(mc_video_id->valuestring) : NULL,
med_components ? med_componentsList : NULL,
ip_domain ? ogs_strdup(ip_domain->valuestring) : NULL,
mps_id ? ogs_strdup(mps_id->valuestring) : NULL,
mcs_id ? ogs_strdup(mcs_id->valuestring) : NULL,
preempt_control_info ? preempt_control_infoVariable : 0,
res_prio ? res_prioVariable : 0,
serv_inf_status ? serv_inf_statusVariable : 0,
ogs_strdup(notif_uri->valuestring),
serv_urn ? ogs_strdup(serv_urn->valuestring) : NULL,
slice_info ? slice_info_local_nonprim : NULL,
spon_id ? ogs_strdup(spon_id->valuestring) : NULL,
spon_status ? spon_statusVariable : 0,
supi ? ogs_strdup(supi->valuestring) : NULL,
gpsi ? ogs_strdup(gpsi->valuestring) : NULL,
ogs_strdup(supp_feat->valuestring),
ue_ipv4 ? ogs_strdup(ue_ipv4->valuestring) : NULL,
ue_ipv6 ? ogs_strdup(ue_ipv6->valuestring) : NULL,
ue_mac ? ogs_strdup(ue_mac->valuestring) : NULL,
tsn_port_man_cont_dstt ? tsn_port_man_cont_dstt_local_nonprim : NULL,
tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL
);
return app_session_context_req_data_local_var;
end:
return NULL;
}
OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_copy(OpenAPI_app_session_context_req_data_t *dst, OpenAPI_app_session_context_req_data_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_app_session_context_req_data_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_app_session_context_req_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_app_session_context_req_data_free(dst);
dst = OpenAPI_app_session_context_req_data_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,106 @@
/*
* app_session_context_req_data.h
*
* Identifies the service requirements of an Individual Application Session Context.
*/
#ifndef _OpenAPI_app_session_context_req_data_H_
#define _OpenAPI_app_session_context_req_data_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_requested_data.h"
#include "af_routing_requirement.h"
#include "events_subsc_req_data.h"
#include "media_component.h"
#include "port_management_container.h"
#include "preemption_control_information.h"
#include "reserv_priority.h"
#include "service_info_status.h"
#include "snssai.h"
#include "sponsoring_status.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_app_session_context_req_data_s OpenAPI_app_session_context_req_data_t;
typedef struct OpenAPI_app_session_context_req_data_s {
char *af_app_id;
char *af_charg_id;
OpenAPI_af_requested_data_e af_req_data;
struct OpenAPI_af_routing_requirement_s *af_rout_req;
char *asp_id;
char *bdt_ref_id;
char *dnn;
struct OpenAPI_events_subsc_req_data_s *ev_subsc;
char *mcptt_id;
char *mc_video_id;
OpenAPI_list_t* med_components;
char *ip_domain;
char *mps_id;
char *mcs_id;
OpenAPI_preemption_control_information_e preempt_control_info;
OpenAPI_reserv_priority_e res_prio;
OpenAPI_service_info_status_e serv_inf_status;
char *notif_uri;
char *serv_urn;
struct OpenAPI_snssai_s *slice_info;
char *spon_id;
OpenAPI_sponsoring_status_e spon_status;
char *supi;
char *gpsi;
char *supp_feat;
char *ue_ipv4;
char *ue_ipv6;
char *ue_mac;
struct OpenAPI_port_management_container_s *tsn_port_man_cont_dstt;
OpenAPI_list_t *tsn_port_man_cont_nwtts;
} OpenAPI_app_session_context_req_data_t;
OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_create(
char *af_app_id,
char *af_charg_id,
OpenAPI_af_requested_data_e af_req_data,
OpenAPI_af_routing_requirement_t *af_rout_req,
char *asp_id,
char *bdt_ref_id,
char *dnn,
OpenAPI_events_subsc_req_data_t *ev_subsc,
char *mcptt_id,
char *mc_video_id,
OpenAPI_list_t* med_components,
char *ip_domain,
char *mps_id,
char *mcs_id,
OpenAPI_preemption_control_information_e preempt_control_info,
OpenAPI_reserv_priority_e res_prio,
OpenAPI_service_info_status_e serv_inf_status,
char *notif_uri,
char *serv_urn,
OpenAPI_snssai_t *slice_info,
char *spon_id,
OpenAPI_sponsoring_status_e spon_status,
char *supi,
char *gpsi,
char *supp_feat,
char *ue_ipv4,
char *ue_ipv6,
char *ue_mac,
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt,
OpenAPI_list_t *tsn_port_man_cont_nwtts
);
void OpenAPI_app_session_context_req_data_free(OpenAPI_app_session_context_req_data_t *app_session_context_req_data);
OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_parseFromJSON(cJSON *app_session_context_req_dataJSON);
cJSON *OpenAPI_app_session_context_req_data_convertToJSON(OpenAPI_app_session_context_req_data_t *app_session_context_req_data);
OpenAPI_app_session_context_req_data_t *OpenAPI_app_session_context_req_data_copy(OpenAPI_app_session_context_req_data_t *dst, OpenAPI_app_session_context_req_data_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_app_session_context_req_data_H_ */

View File

@ -0,0 +1,176 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "app_session_context_resp_data.h"
OpenAPI_app_session_context_resp_data_t *OpenAPI_app_session_context_resp_data_create(
OpenAPI_serv_auth_info_e serv_auth_info,
OpenAPI_list_t *ue_ids,
char *supp_feat
)
{
OpenAPI_app_session_context_resp_data_t *app_session_context_resp_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_session_context_resp_data_t));
if (!app_session_context_resp_data_local_var) {
return NULL;
}
app_session_context_resp_data_local_var->serv_auth_info = serv_auth_info;
app_session_context_resp_data_local_var->ue_ids = ue_ids;
app_session_context_resp_data_local_var->supp_feat = supp_feat;
return app_session_context_resp_data_local_var;
}
void OpenAPI_app_session_context_resp_data_free(OpenAPI_app_session_context_resp_data_t *app_session_context_resp_data)
{
if (NULL == app_session_context_resp_data) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(app_session_context_resp_data->ue_ids, node) {
OpenAPI_ue_identity_info_free(node->data);
}
OpenAPI_list_free(app_session_context_resp_data->ue_ids);
ogs_free(app_session_context_resp_data->supp_feat);
ogs_free(app_session_context_resp_data);
}
cJSON *OpenAPI_app_session_context_resp_data_convertToJSON(OpenAPI_app_session_context_resp_data_t *app_session_context_resp_data)
{
cJSON *item = NULL;
if (app_session_context_resp_data == NULL) {
ogs_error("OpenAPI_app_session_context_resp_data_convertToJSON() failed [AppSessionContextRespData]");
return NULL;
}
item = cJSON_CreateObject();
if (app_session_context_resp_data->serv_auth_info) {
if (cJSON_AddStringToObject(item, "servAuthInfo", OpenAPI_serv_auth_info_ToString(app_session_context_resp_data->serv_auth_info)) == NULL) {
ogs_error("OpenAPI_app_session_context_resp_data_convertToJSON() failed [serv_auth_info]");
goto end;
}
}
if (app_session_context_resp_data->ue_ids) {
cJSON *ue_idsList = cJSON_AddArrayToObject(item, "ueIds");
if (ue_idsList == NULL) {
ogs_error("OpenAPI_app_session_context_resp_data_convertToJSON() failed [ue_ids]");
goto end;
}
OpenAPI_lnode_t *ue_ids_node;
if (app_session_context_resp_data->ue_ids) {
OpenAPI_list_for_each(app_session_context_resp_data->ue_ids, ue_ids_node) {
cJSON *itemLocal = OpenAPI_ue_identity_info_convertToJSON(ue_ids_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_app_session_context_resp_data_convertToJSON() failed [ue_ids]");
goto end;
}
cJSON_AddItemToArray(ue_idsList, itemLocal);
}
}
}
if (app_session_context_resp_data->supp_feat) {
if (cJSON_AddStringToObject(item, "suppFeat", app_session_context_resp_data->supp_feat) == NULL) {
ogs_error("OpenAPI_app_session_context_resp_data_convertToJSON() failed [supp_feat]");
goto end;
}
}
end:
return item;
}
OpenAPI_app_session_context_resp_data_t *OpenAPI_app_session_context_resp_data_parseFromJSON(cJSON *app_session_context_resp_dataJSON)
{
OpenAPI_app_session_context_resp_data_t *app_session_context_resp_data_local_var = NULL;
cJSON *serv_auth_info = cJSON_GetObjectItemCaseSensitive(app_session_context_resp_dataJSON, "servAuthInfo");
OpenAPI_serv_auth_info_e serv_auth_infoVariable;
if (serv_auth_info) {
if (!cJSON_IsString(serv_auth_info)) {
ogs_error("OpenAPI_app_session_context_resp_data_parseFromJSON() failed [serv_auth_info]");
goto end;
}
serv_auth_infoVariable = OpenAPI_serv_auth_info_FromString(serv_auth_info->valuestring);
}
cJSON *ue_ids = cJSON_GetObjectItemCaseSensitive(app_session_context_resp_dataJSON, "ueIds");
OpenAPI_list_t *ue_idsList;
if (ue_ids) {
cJSON *ue_ids_local_nonprimitive;
if (!cJSON_IsArray(ue_ids)) {
ogs_error("OpenAPI_app_session_context_resp_data_parseFromJSON() failed [ue_ids]");
goto end;
}
ue_idsList = OpenAPI_list_create();
cJSON_ArrayForEach(ue_ids_local_nonprimitive, ue_ids ) {
if (!cJSON_IsObject(ue_ids_local_nonprimitive)) {
ogs_error("OpenAPI_app_session_context_resp_data_parseFromJSON() failed [ue_ids]");
goto end;
}
OpenAPI_ue_identity_info_t *ue_idsItem = OpenAPI_ue_identity_info_parseFromJSON(ue_ids_local_nonprimitive);
OpenAPI_list_add(ue_idsList, ue_idsItem);
}
}
cJSON *supp_feat = cJSON_GetObjectItemCaseSensitive(app_session_context_resp_dataJSON, "suppFeat");
if (supp_feat) {
if (!cJSON_IsString(supp_feat)) {
ogs_error("OpenAPI_app_session_context_resp_data_parseFromJSON() failed [supp_feat]");
goto end;
}
}
app_session_context_resp_data_local_var = OpenAPI_app_session_context_resp_data_create (
serv_auth_info ? serv_auth_infoVariable : 0,
ue_ids ? ue_idsList : NULL,
supp_feat ? ogs_strdup(supp_feat->valuestring) : NULL
);
return app_session_context_resp_data_local_var;
end:
return NULL;
}
OpenAPI_app_session_context_resp_data_t *OpenAPI_app_session_context_resp_data_copy(OpenAPI_app_session_context_resp_data_t *dst, OpenAPI_app_session_context_resp_data_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_app_session_context_resp_data_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_app_session_context_resp_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_app_session_context_resp_data_free(dst);
dst = OpenAPI_app_session_context_resp_data_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,44 @@
/*
* app_session_context_resp_data.h
*
* Describes the authorization data of an Individual Application Session Context created by the PCF.
*/
#ifndef _OpenAPI_app_session_context_resp_data_H_
#define _OpenAPI_app_session_context_resp_data_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "serv_auth_info.h"
#include "ue_identity_info.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_app_session_context_resp_data_s OpenAPI_app_session_context_resp_data_t;
typedef struct OpenAPI_app_session_context_resp_data_s {
OpenAPI_serv_auth_info_e serv_auth_info;
OpenAPI_list_t *ue_ids;
char *supp_feat;
} OpenAPI_app_session_context_resp_data_t;
OpenAPI_app_session_context_resp_data_t *OpenAPI_app_session_context_resp_data_create(
OpenAPI_serv_auth_info_e serv_auth_info,
OpenAPI_list_t *ue_ids,
char *supp_feat
);
void OpenAPI_app_session_context_resp_data_free(OpenAPI_app_session_context_resp_data_t *app_session_context_resp_data);
OpenAPI_app_session_context_resp_data_t *OpenAPI_app_session_context_resp_data_parseFromJSON(cJSON *app_session_context_resp_dataJSON);
cJSON *OpenAPI_app_session_context_resp_data_convertToJSON(OpenAPI_app_session_context_resp_data_t *app_session_context_resp_data);
OpenAPI_app_session_context_resp_data_t *OpenAPI_app_session_context_resp_data_copy(OpenAPI_app_session_context_resp_data_t *dst, OpenAPI_app_session_context_resp_data_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_app_session_context_resp_data_H_ */

View File

@ -0,0 +1,528 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "app_session_context_update_data.h"
OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_data_create(
char *af_app_id,
OpenAPI_af_routing_requirement_rm_t *af_rout_req,
char *asp_id,
char *bdt_ref_id,
OpenAPI_events_subsc_req_data_rm_t *ev_subsc,
char *mcptt_id,
char *mc_video_id,
OpenAPI_list_t* med_components,
char *mps_id,
char *mcs_id,
OpenAPI_preemption_control_information_rm_t *preempt_control_info,
OpenAPI_reserv_priority_e res_prio,
OpenAPI_service_info_status_e serv_inf_status,
OpenAPI_sip_forking_indication_e sip_fork_ind,
char *spon_id,
OpenAPI_sponsoring_status_e spon_status,
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt,
OpenAPI_list_t *tsn_port_man_cont_nwtts
)
{
OpenAPI_app_session_context_update_data_t *app_session_context_update_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_app_session_context_update_data_t));
if (!app_session_context_update_data_local_var) {
return NULL;
}
app_session_context_update_data_local_var->af_app_id = af_app_id;
app_session_context_update_data_local_var->af_rout_req = af_rout_req;
app_session_context_update_data_local_var->asp_id = asp_id;
app_session_context_update_data_local_var->bdt_ref_id = bdt_ref_id;
app_session_context_update_data_local_var->ev_subsc = ev_subsc;
app_session_context_update_data_local_var->mcptt_id = mcptt_id;
app_session_context_update_data_local_var->mc_video_id = mc_video_id;
app_session_context_update_data_local_var->med_components = med_components;
app_session_context_update_data_local_var->mps_id = mps_id;
app_session_context_update_data_local_var->mcs_id = mcs_id;
app_session_context_update_data_local_var->preempt_control_info = preempt_control_info;
app_session_context_update_data_local_var->res_prio = res_prio;
app_session_context_update_data_local_var->serv_inf_status = serv_inf_status;
app_session_context_update_data_local_var->sip_fork_ind = sip_fork_ind;
app_session_context_update_data_local_var->spon_id = spon_id;
app_session_context_update_data_local_var->spon_status = spon_status;
app_session_context_update_data_local_var->tsn_port_man_cont_dstt = tsn_port_man_cont_dstt;
app_session_context_update_data_local_var->tsn_port_man_cont_nwtts = tsn_port_man_cont_nwtts;
return app_session_context_update_data_local_var;
}
void OpenAPI_app_session_context_update_data_free(OpenAPI_app_session_context_update_data_t *app_session_context_update_data)
{
if (NULL == app_session_context_update_data) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(app_session_context_update_data->af_app_id);
OpenAPI_af_routing_requirement_rm_free(app_session_context_update_data->af_rout_req);
ogs_free(app_session_context_update_data->asp_id);
ogs_free(app_session_context_update_data->bdt_ref_id);
OpenAPI_events_subsc_req_data_rm_free(app_session_context_update_data->ev_subsc);
ogs_free(app_session_context_update_data->mcptt_id);
ogs_free(app_session_context_update_data->mc_video_id);
OpenAPI_list_for_each(app_session_context_update_data->med_components, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_media_component_rm_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(app_session_context_update_data->med_components);
ogs_free(app_session_context_update_data->mps_id);
ogs_free(app_session_context_update_data->mcs_id);
OpenAPI_preemption_control_information_rm_free(app_session_context_update_data->preempt_control_info);
ogs_free(app_session_context_update_data->spon_id);
OpenAPI_port_management_container_free(app_session_context_update_data->tsn_port_man_cont_dstt);
OpenAPI_list_for_each(app_session_context_update_data->tsn_port_man_cont_nwtts, node) {
OpenAPI_port_management_container_free(node->data);
}
OpenAPI_list_free(app_session_context_update_data->tsn_port_man_cont_nwtts);
ogs_free(app_session_context_update_data);
}
cJSON *OpenAPI_app_session_context_update_data_convertToJSON(OpenAPI_app_session_context_update_data_t *app_session_context_update_data)
{
cJSON *item = NULL;
if (app_session_context_update_data == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [AppSessionContextUpdateData]");
return NULL;
}
item = cJSON_CreateObject();
if (app_session_context_update_data->af_app_id) {
if (cJSON_AddStringToObject(item, "afAppId", app_session_context_update_data->af_app_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [af_app_id]");
goto end;
}
}
if (app_session_context_update_data->af_rout_req) {
cJSON *af_rout_req_local_JSON = OpenAPI_af_routing_requirement_rm_convertToJSON(app_session_context_update_data->af_rout_req);
if (af_rout_req_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [af_rout_req]");
goto end;
}
cJSON_AddItemToObject(item, "afRoutReq", af_rout_req_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [af_rout_req]");
goto end;
}
}
if (app_session_context_update_data->asp_id) {
if (cJSON_AddStringToObject(item, "aspId", app_session_context_update_data->asp_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [asp_id]");
goto end;
}
}
if (app_session_context_update_data->bdt_ref_id) {
if (cJSON_AddStringToObject(item, "bdtRefId", app_session_context_update_data->bdt_ref_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [bdt_ref_id]");
goto end;
}
}
if (app_session_context_update_data->ev_subsc) {
cJSON *ev_subsc_local_JSON = OpenAPI_events_subsc_req_data_rm_convertToJSON(app_session_context_update_data->ev_subsc);
if (ev_subsc_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [ev_subsc]");
goto end;
}
cJSON_AddItemToObject(item, "evSubsc", ev_subsc_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [ev_subsc]");
goto end;
}
}
if (app_session_context_update_data->mcptt_id) {
if (cJSON_AddStringToObject(item, "mcpttId", app_session_context_update_data->mcptt_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [mcptt_id]");
goto end;
}
}
if (app_session_context_update_data->mc_video_id) {
if (cJSON_AddStringToObject(item, "mcVideoId", app_session_context_update_data->mc_video_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [mc_video_id]");
goto end;
}
}
if (app_session_context_update_data->med_components) {
cJSON *med_components = cJSON_AddObjectToObject(item, "medComponents");
if (med_components == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [med_components]");
goto end;
}
cJSON *localMapObject = med_components;
OpenAPI_lnode_t *med_components_node;
if (app_session_context_update_data->med_components) {
OpenAPI_list_for_each(app_session_context_update_data->med_components, med_components_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)med_components_node->data;
cJSON *itemLocal = OpenAPI_media_component_rm_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [med_components]");
goto end;
}
cJSON_AddItemToObject(med_components, localKeyValue->key, itemLocal);
}
}
}
if (app_session_context_update_data->mps_id) {
if (cJSON_AddStringToObject(item, "mpsId", app_session_context_update_data->mps_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [mps_id]");
goto end;
}
}
if (app_session_context_update_data->mcs_id) {
if (cJSON_AddStringToObject(item, "mcsId", app_session_context_update_data->mcs_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [mcs_id]");
goto end;
}
}
if (app_session_context_update_data->preempt_control_info) {
cJSON *preempt_control_info_local_JSON = OpenAPI_preemption_control_information_rm_convertToJSON(app_session_context_update_data->preempt_control_info);
if (preempt_control_info_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [preempt_control_info]");
goto end;
}
cJSON_AddItemToObject(item, "preemptControlInfo", preempt_control_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [preempt_control_info]");
goto end;
}
}
if (app_session_context_update_data->res_prio) {
if (cJSON_AddStringToObject(item, "resPrio", OpenAPI_reserv_priority_ToString(app_session_context_update_data->res_prio)) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [res_prio]");
goto end;
}
}
if (app_session_context_update_data->serv_inf_status) {
if (cJSON_AddStringToObject(item, "servInfStatus", OpenAPI_service_info_status_ToString(app_session_context_update_data->serv_inf_status)) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [serv_inf_status]");
goto end;
}
}
if (app_session_context_update_data->sip_fork_ind) {
if (cJSON_AddStringToObject(item, "sipForkInd", OpenAPI_sip_forking_indication_ToString(app_session_context_update_data->sip_fork_ind)) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [sip_fork_ind]");
goto end;
}
}
if (app_session_context_update_data->spon_id) {
if (cJSON_AddStringToObject(item, "sponId", app_session_context_update_data->spon_id) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [spon_id]");
goto end;
}
}
if (app_session_context_update_data->spon_status) {
if (cJSON_AddStringToObject(item, "sponStatus", OpenAPI_sponsoring_status_ToString(app_session_context_update_data->spon_status)) == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [spon_status]");
goto end;
}
}
if (app_session_context_update_data->tsn_port_man_cont_dstt) {
cJSON *tsn_port_man_cont_dstt_local_JSON = OpenAPI_port_management_container_convertToJSON(app_session_context_update_data->tsn_port_man_cont_dstt);
if (tsn_port_man_cont_dstt_local_JSON == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [tsn_port_man_cont_dstt]");
goto end;
}
cJSON_AddItemToObject(item, "tsnPortManContDstt", tsn_port_man_cont_dstt_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [tsn_port_man_cont_dstt]");
goto end;
}
}
if (app_session_context_update_data->tsn_port_man_cont_nwtts) {
cJSON *tsn_port_man_cont_nwttsList = cJSON_AddArrayToObject(item, "tsnPortManContNwtts");
if (tsn_port_man_cont_nwttsList == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
OpenAPI_lnode_t *tsn_port_man_cont_nwtts_node;
if (app_session_context_update_data->tsn_port_man_cont_nwtts) {
OpenAPI_list_for_each(app_session_context_update_data->tsn_port_man_cont_nwtts, tsn_port_man_cont_nwtts_node) {
cJSON *itemLocal = OpenAPI_port_management_container_convertToJSON(tsn_port_man_cont_nwtts_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_app_session_context_update_data_convertToJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
cJSON_AddItemToArray(tsn_port_man_cont_nwttsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_data_parseFromJSON(cJSON *app_session_context_update_dataJSON)
{
OpenAPI_app_session_context_update_data_t *app_session_context_update_data_local_var = NULL;
cJSON *af_app_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "afAppId");
if (af_app_id) {
if (!cJSON_IsString(af_app_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [af_app_id]");
goto end;
}
}
cJSON *af_rout_req = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "afRoutReq");
OpenAPI_af_routing_requirement_rm_t *af_rout_req_local_nonprim = NULL;
if (af_rout_req) {
af_rout_req_local_nonprim = OpenAPI_af_routing_requirement_rm_parseFromJSON(af_rout_req);
}
cJSON *asp_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "aspId");
if (asp_id) {
if (!cJSON_IsString(asp_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [asp_id]");
goto end;
}
}
cJSON *bdt_ref_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "bdtRefId");
if (bdt_ref_id) {
if (!cJSON_IsString(bdt_ref_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [bdt_ref_id]");
goto end;
}
}
cJSON *ev_subsc = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "evSubsc");
OpenAPI_events_subsc_req_data_rm_t *ev_subsc_local_nonprim = NULL;
if (ev_subsc) {
ev_subsc_local_nonprim = OpenAPI_events_subsc_req_data_rm_parseFromJSON(ev_subsc);
}
cJSON *mcptt_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "mcpttId");
if (mcptt_id) {
if (!cJSON_IsString(mcptt_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [mcptt_id]");
goto end;
}
}
cJSON *mc_video_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "mcVideoId");
if (mc_video_id) {
if (!cJSON_IsString(mc_video_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [mc_video_id]");
goto end;
}
}
cJSON *med_components = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "medComponents");
OpenAPI_list_t *med_componentsList;
if (med_components) {
cJSON *med_components_local_map;
if (!cJSON_IsObject(med_components)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [med_components]");
goto end;
}
med_componentsList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(med_components_local_map, med_components) {
cJSON *localMapObject = med_components_local_map;
if (!cJSON_IsObject(med_components_local_map)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [med_components]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_media_component_rm_parseFromJSON(localMapObject));
OpenAPI_list_add(med_componentsList, localMapKeyPair);
}
}
cJSON *mps_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "mpsId");
if (mps_id) {
if (!cJSON_IsString(mps_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [mps_id]");
goto end;
}
}
cJSON *mcs_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "mcsId");
if (mcs_id) {
if (!cJSON_IsString(mcs_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [mcs_id]");
goto end;
}
}
cJSON *preempt_control_info = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "preemptControlInfo");
OpenAPI_preemption_control_information_rm_t *preempt_control_info_local_nonprim = NULL;
if (preempt_control_info) {
preempt_control_info_local_nonprim = OpenAPI_preemption_control_information_rm_parseFromJSON(preempt_control_info);
}
cJSON *res_prio = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "resPrio");
OpenAPI_reserv_priority_e res_prioVariable;
if (res_prio) {
if (!cJSON_IsString(res_prio)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [res_prio]");
goto end;
}
res_prioVariable = OpenAPI_reserv_priority_FromString(res_prio->valuestring);
}
cJSON *serv_inf_status = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "servInfStatus");
OpenAPI_service_info_status_e serv_inf_statusVariable;
if (serv_inf_status) {
if (!cJSON_IsString(serv_inf_status)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [serv_inf_status]");
goto end;
}
serv_inf_statusVariable = OpenAPI_service_info_status_FromString(serv_inf_status->valuestring);
}
cJSON *sip_fork_ind = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "sipForkInd");
OpenAPI_sip_forking_indication_e sip_fork_indVariable;
if (sip_fork_ind) {
if (!cJSON_IsString(sip_fork_ind)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [sip_fork_ind]");
goto end;
}
sip_fork_indVariable = OpenAPI_sip_forking_indication_FromString(sip_fork_ind->valuestring);
}
cJSON *spon_id = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "sponId");
if (spon_id) {
if (!cJSON_IsString(spon_id)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [spon_id]");
goto end;
}
}
cJSON *spon_status = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "sponStatus");
OpenAPI_sponsoring_status_e spon_statusVariable;
if (spon_status) {
if (!cJSON_IsString(spon_status)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [spon_status]");
goto end;
}
spon_statusVariable = OpenAPI_sponsoring_status_FromString(spon_status->valuestring);
}
cJSON *tsn_port_man_cont_dstt = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "tsnPortManContDstt");
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt_local_nonprim = NULL;
if (tsn_port_man_cont_dstt) {
tsn_port_man_cont_dstt_local_nonprim = OpenAPI_port_management_container_parseFromJSON(tsn_port_man_cont_dstt);
}
cJSON *tsn_port_man_cont_nwtts = cJSON_GetObjectItemCaseSensitive(app_session_context_update_dataJSON, "tsnPortManContNwtts");
OpenAPI_list_t *tsn_port_man_cont_nwttsList;
if (tsn_port_man_cont_nwtts) {
cJSON *tsn_port_man_cont_nwtts_local_nonprimitive;
if (!cJSON_IsArray(tsn_port_man_cont_nwtts)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
tsn_port_man_cont_nwttsList = OpenAPI_list_create();
cJSON_ArrayForEach(tsn_port_man_cont_nwtts_local_nonprimitive, tsn_port_man_cont_nwtts ) {
if (!cJSON_IsObject(tsn_port_man_cont_nwtts_local_nonprimitive)) {
ogs_error("OpenAPI_app_session_context_update_data_parseFromJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
OpenAPI_port_management_container_t *tsn_port_man_cont_nwttsItem = OpenAPI_port_management_container_parseFromJSON(tsn_port_man_cont_nwtts_local_nonprimitive);
OpenAPI_list_add(tsn_port_man_cont_nwttsList, tsn_port_man_cont_nwttsItem);
}
}
app_session_context_update_data_local_var = OpenAPI_app_session_context_update_data_create (
af_app_id ? ogs_strdup(af_app_id->valuestring) : NULL,
af_rout_req ? af_rout_req_local_nonprim : NULL,
asp_id ? ogs_strdup(asp_id->valuestring) : NULL,
bdt_ref_id ? ogs_strdup(bdt_ref_id->valuestring) : NULL,
ev_subsc ? ev_subsc_local_nonprim : NULL,
mcptt_id ? ogs_strdup(mcptt_id->valuestring) : NULL,
mc_video_id ? ogs_strdup(mc_video_id->valuestring) : NULL,
med_components ? med_componentsList : NULL,
mps_id ? ogs_strdup(mps_id->valuestring) : NULL,
mcs_id ? ogs_strdup(mcs_id->valuestring) : NULL,
preempt_control_info ? preempt_control_info_local_nonprim : NULL,
res_prio ? res_prioVariable : 0,
serv_inf_status ? serv_inf_statusVariable : 0,
sip_fork_ind ? sip_fork_indVariable : 0,
spon_id ? ogs_strdup(spon_id->valuestring) : NULL,
spon_status ? spon_statusVariable : 0,
tsn_port_man_cont_dstt ? tsn_port_man_cont_dstt_local_nonprim : NULL,
tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL
);
return app_session_context_update_data_local_var;
end:
return NULL;
}
OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_data_copy(OpenAPI_app_session_context_update_data_t *dst, OpenAPI_app_session_context_update_data_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_app_session_context_update_data_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_app_session_context_update_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_app_session_context_update_data_free(dst);
dst = OpenAPI_app_session_context_update_data_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,81 @@
/*
* app_session_context_update_data.h
*
* Identifies the modifications to an Individual Application Session Context and may include the modifications to the sub-resource Events Subscription.
*/
#ifndef _OpenAPI_app_session_context_update_data_H_
#define _OpenAPI_app_session_context_update_data_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_routing_requirement_rm.h"
#include "events_subsc_req_data_rm.h"
#include "media_component_rm.h"
#include "port_management_container.h"
#include "preemption_control_information_rm.h"
#include "reserv_priority.h"
#include "service_info_status.h"
#include "sip_forking_indication.h"
#include "sponsoring_status.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_app_session_context_update_data_s OpenAPI_app_session_context_update_data_t;
typedef struct OpenAPI_app_session_context_update_data_s {
char *af_app_id;
struct OpenAPI_af_routing_requirement_rm_s *af_rout_req;
char *asp_id;
char *bdt_ref_id;
struct OpenAPI_events_subsc_req_data_rm_s *ev_subsc;
char *mcptt_id;
char *mc_video_id;
OpenAPI_list_t* med_components;
char *mps_id;
char *mcs_id;
struct OpenAPI_preemption_control_information_rm_s *preempt_control_info;
OpenAPI_reserv_priority_e res_prio;
OpenAPI_service_info_status_e serv_inf_status;
OpenAPI_sip_forking_indication_e sip_fork_ind;
char *spon_id;
OpenAPI_sponsoring_status_e spon_status;
struct OpenAPI_port_management_container_s *tsn_port_man_cont_dstt;
OpenAPI_list_t *tsn_port_man_cont_nwtts;
} OpenAPI_app_session_context_update_data_t;
OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_data_create(
char *af_app_id,
OpenAPI_af_routing_requirement_rm_t *af_rout_req,
char *asp_id,
char *bdt_ref_id,
OpenAPI_events_subsc_req_data_rm_t *ev_subsc,
char *mcptt_id,
char *mc_video_id,
OpenAPI_list_t* med_components,
char *mps_id,
char *mcs_id,
OpenAPI_preemption_control_information_rm_t *preempt_control_info,
OpenAPI_reserv_priority_e res_prio,
OpenAPI_service_info_status_e serv_inf_status,
OpenAPI_sip_forking_indication_e sip_fork_ind,
char *spon_id,
OpenAPI_sponsoring_status_e spon_status,
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt,
OpenAPI_list_t *tsn_port_man_cont_nwtts
);
void OpenAPI_app_session_context_update_data_free(OpenAPI_app_session_context_update_data_t *app_session_context_update_data);
OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_data_parseFromJSON(cJSON *app_session_context_update_dataJSON);
cJSON *OpenAPI_app_session_context_update_data_convertToJSON(OpenAPI_app_session_context_update_data_t *app_session_context_update_data);
OpenAPI_app_session_context_update_data_t *OpenAPI_app_session_context_update_data_copy(OpenAPI_app_session_context_update_data_t *dst, OpenAPI_app_session_context_update_data_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_app_session_context_update_data_H_ */

View File

@ -0,0 +1,30 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "binding_level.h"
char* OpenAPI_binding_level_ToString(OpenAPI_binding_level_e binding_level)
{
const char *binding_levelArray[] = { "NULL", "NF_SET", "NF_INSTANCE" };
size_t sizeofArray = sizeof(binding_levelArray) / sizeof(binding_levelArray[0]);
if (binding_level < sizeofArray)
return (char *)binding_levelArray[binding_level];
else
return (char *)"Unknown";
}
OpenAPI_binding_level_e OpenAPI_binding_level_FromString(char* binding_level)
{
int stringToReturn = 0;
const char *binding_levelArray[] = { "NULL", "NF_SET", "NF_INSTANCE" };
size_t sizeofArray = sizeof(binding_levelArray) / sizeof(binding_levelArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(binding_level, binding_levelArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
return 0;
}

View File

@ -0,0 +1,31 @@
/*
* binding_level.h
*
*
*/
#ifndef _OpenAPI_binding_level_H_
#define _OpenAPI_binding_level_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 enum { OpenAPI_binding_level_NULL = 0, OpenAPI_binding_level_NF_SET, OpenAPI_binding_level_NF_INSTANCE } OpenAPI_binding_level_e;
char* OpenAPI_binding_level_ToString(OpenAPI_binding_level_e binding_level);
OpenAPI_binding_level_e OpenAPI_binding_level_FromString(char* binding_level);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_binding_level_H_ */

View File

@ -0,0 +1,155 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "binding_resp.h"
OpenAPI_binding_resp_t *OpenAPI_binding_resp_create(
char *pcf_sm_fqdn,
OpenAPI_list_t *pcf_sm_ip_end_points
)
{
OpenAPI_binding_resp_t *binding_resp_local_var = OpenAPI_malloc(sizeof(OpenAPI_binding_resp_t));
if (!binding_resp_local_var) {
return NULL;
}
binding_resp_local_var->pcf_sm_fqdn = pcf_sm_fqdn;
binding_resp_local_var->pcf_sm_ip_end_points = pcf_sm_ip_end_points;
return binding_resp_local_var;
}
void OpenAPI_binding_resp_free(OpenAPI_binding_resp_t *binding_resp)
{
if (NULL == binding_resp) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(binding_resp->pcf_sm_fqdn);
OpenAPI_list_for_each(binding_resp->pcf_sm_ip_end_points, node) {
OpenAPI_ip_end_point_free(node->data);
}
OpenAPI_list_free(binding_resp->pcf_sm_ip_end_points);
ogs_free(binding_resp);
}
cJSON *OpenAPI_binding_resp_convertToJSON(OpenAPI_binding_resp_t *binding_resp)
{
cJSON *item = NULL;
if (binding_resp == NULL) {
ogs_error("OpenAPI_binding_resp_convertToJSON() failed [BindingResp]");
return NULL;
}
item = cJSON_CreateObject();
if (binding_resp->pcf_sm_fqdn) {
if (cJSON_AddStringToObject(item, "pcfSmFqdn", binding_resp->pcf_sm_fqdn) == NULL) {
ogs_error("OpenAPI_binding_resp_convertToJSON() failed [pcf_sm_fqdn]");
goto end;
}
}
if (binding_resp->pcf_sm_ip_end_points) {
cJSON *pcf_sm_ip_end_pointsList = cJSON_AddArrayToObject(item, "pcfSmIpEndPoints");
if (pcf_sm_ip_end_pointsList == NULL) {
ogs_error("OpenAPI_binding_resp_convertToJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
OpenAPI_lnode_t *pcf_sm_ip_end_points_node;
if (binding_resp->pcf_sm_ip_end_points) {
OpenAPI_list_for_each(binding_resp->pcf_sm_ip_end_points, pcf_sm_ip_end_points_node) {
cJSON *itemLocal = OpenAPI_ip_end_point_convertToJSON(pcf_sm_ip_end_points_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_binding_resp_convertToJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
cJSON_AddItemToArray(pcf_sm_ip_end_pointsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_binding_resp_t *OpenAPI_binding_resp_parseFromJSON(cJSON *binding_respJSON)
{
OpenAPI_binding_resp_t *binding_resp_local_var = NULL;
cJSON *pcf_sm_fqdn = cJSON_GetObjectItemCaseSensitive(binding_respJSON, "pcfSmFqdn");
if (pcf_sm_fqdn) {
if (!cJSON_IsString(pcf_sm_fqdn)) {
ogs_error("OpenAPI_binding_resp_parseFromJSON() failed [pcf_sm_fqdn]");
goto end;
}
}
cJSON *pcf_sm_ip_end_points = cJSON_GetObjectItemCaseSensitive(binding_respJSON, "pcfSmIpEndPoints");
OpenAPI_list_t *pcf_sm_ip_end_pointsList;
if (pcf_sm_ip_end_points) {
cJSON *pcf_sm_ip_end_points_local_nonprimitive;
if (!cJSON_IsArray(pcf_sm_ip_end_points)) {
ogs_error("OpenAPI_binding_resp_parseFromJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
pcf_sm_ip_end_pointsList = OpenAPI_list_create();
cJSON_ArrayForEach(pcf_sm_ip_end_points_local_nonprimitive, pcf_sm_ip_end_points ) {
if (!cJSON_IsObject(pcf_sm_ip_end_points_local_nonprimitive)) {
ogs_error("OpenAPI_binding_resp_parseFromJSON() failed [pcf_sm_ip_end_points]");
goto end;
}
OpenAPI_ip_end_point_t *pcf_sm_ip_end_pointsItem = OpenAPI_ip_end_point_parseFromJSON(pcf_sm_ip_end_points_local_nonprimitive);
OpenAPI_list_add(pcf_sm_ip_end_pointsList, pcf_sm_ip_end_pointsItem);
}
}
binding_resp_local_var = OpenAPI_binding_resp_create (
pcf_sm_fqdn ? ogs_strdup(pcf_sm_fqdn->valuestring) : NULL,
pcf_sm_ip_end_points ? pcf_sm_ip_end_pointsList : NULL
);
return binding_resp_local_var;
end:
return NULL;
}
OpenAPI_binding_resp_t *OpenAPI_binding_resp_copy(OpenAPI_binding_resp_t *dst, OpenAPI_binding_resp_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_binding_resp_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_binding_resp_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_binding_resp_free(dst);
dst = OpenAPI_binding_resp_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,41 @@
/*
* binding_resp.h
*
*
*/
#ifndef _OpenAPI_binding_resp_H_
#define _OpenAPI_binding_resp_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "ip_end_point.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_binding_resp_s OpenAPI_binding_resp_t;
typedef struct OpenAPI_binding_resp_s {
char *pcf_sm_fqdn;
OpenAPI_list_t *pcf_sm_ip_end_points;
} OpenAPI_binding_resp_t;
OpenAPI_binding_resp_t *OpenAPI_binding_resp_create(
char *pcf_sm_fqdn,
OpenAPI_list_t *pcf_sm_ip_end_points
);
void OpenAPI_binding_resp_free(OpenAPI_binding_resp_t *binding_resp);
OpenAPI_binding_resp_t *OpenAPI_binding_resp_parseFromJSON(cJSON *binding_respJSON);
cJSON *OpenAPI_binding_resp_convertToJSON(OpenAPI_binding_resp_t *binding_resp);
OpenAPI_binding_resp_t *OpenAPI_binding_resp_copy(OpenAPI_binding_resp_t *dst, OpenAPI_binding_resp_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_binding_resp_H_ */

View File

@ -5,7 +5,7 @@
#include "deregistration_data.h"
OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_create(
OpenAPI_deregistration_reason_t *dereg_reason,
OpenAPI_deregistration_reason_e dereg_reason,
OpenAPI_access_type_e access_type,
int pdu_session_id,
char *new_smf_instance_id
@ -29,7 +29,6 @@ void OpenAPI_deregistration_data_free(OpenAPI_deregistration_data_t *deregistrat
return;
}
OpenAPI_lnode_t *node;
OpenAPI_deregistration_reason_free(deregistration_data->dereg_reason);
ogs_free(deregistration_data->new_smf_instance_id);
ogs_free(deregistration_data);
}
@ -44,13 +43,7 @@ cJSON *OpenAPI_deregistration_data_convertToJSON(OpenAPI_deregistration_data_t *
}
item = cJSON_CreateObject();
cJSON *dereg_reason_local_JSON = OpenAPI_deregistration_reason_convertToJSON(deregistration_data->dereg_reason);
if (dereg_reason_local_JSON == NULL) {
ogs_error("OpenAPI_deregistration_data_convertToJSON() failed [dereg_reason]");
goto end;
}
cJSON_AddItemToObject(item, "deregReason", dereg_reason_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "deregReason", OpenAPI_deregistration_reason_ToString(deregistration_data->dereg_reason)) == NULL) {
ogs_error("OpenAPI_deregistration_data_convertToJSON() failed [dereg_reason]");
goto end;
}
@ -89,9 +82,13 @@ OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_parseFromJSON(cJSON *
goto end;
}
OpenAPI_deregistration_reason_t *dereg_reason_local_nonprim = NULL;
OpenAPI_deregistration_reason_e dereg_reasonVariable;
dereg_reason_local_nonprim = OpenAPI_deregistration_reason_parseFromJSON(dereg_reason);
if (!cJSON_IsString(dereg_reason)) {
ogs_error("OpenAPI_deregistration_data_parseFromJSON() failed [dereg_reason]");
goto end;
}
dereg_reasonVariable = OpenAPI_deregistration_reason_FromString(dereg_reason->valuestring);
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(deregistration_dataJSON, "accessType");
@ -123,7 +120,7 @@ OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_parseFromJSON(cJSON *
}
deregistration_data_local_var = OpenAPI_deregistration_data_create (
dereg_reason_local_nonprim,
dereg_reasonVariable,
access_type ? access_typeVariable : 0,
pdu_session_id ? pdu_session_id->valuedouble : 0,
new_smf_instance_id ? ogs_strdup(new_smf_instance_id->valuestring) : NULL

View File

@ -21,14 +21,14 @@ extern "C" {
typedef struct OpenAPI_deregistration_data_s OpenAPI_deregistration_data_t;
typedef struct OpenAPI_deregistration_data_s {
struct OpenAPI_deregistration_reason_s *dereg_reason;
OpenAPI_deregistration_reason_e dereg_reason;
OpenAPI_access_type_e access_type;
int pdu_session_id;
char *new_smf_instance_id;
} OpenAPI_deregistration_data_t;
OpenAPI_deregistration_data_t *OpenAPI_deregistration_data_create(
OpenAPI_deregistration_reason_t *dereg_reason,
OpenAPI_deregistration_reason_e dereg_reason,
OpenAPI_access_type_e access_type,
int pdu_session_id,
char *new_smf_instance_id

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "deregistration_reason.h"
OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_create(
)
char* OpenAPI_deregistration_reason_ToString(OpenAPI_deregistration_reason_e deregistration_reason)
{
OpenAPI_deregistration_reason_t *deregistration_reason_local_var = OpenAPI_malloc(sizeof(OpenAPI_deregistration_reason_t));
if (!deregistration_reason_local_var) {
return NULL;
}
return deregistration_reason_local_var;
const char *deregistration_reasonArray[] = { "NULL", "UE_INITIAL_REGISTRATION", "UE_REGISTRATION_AREA_CHANGE", "SUBSCRIPTION_WITHDRAWN", "_5GS_TO_EPS_MOBILITY", "_5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION", "REREGISTRATION_REQUIRED", "SMF_CONTEXT_TRANSFERRED" };
size_t sizeofArray = sizeof(deregistration_reasonArray) / sizeof(deregistration_reasonArray[0]);
if (deregistration_reason < sizeofArray)
return (char *)deregistration_reasonArray[deregistration_reason];
else
return (char *)"Unknown";
}
void OpenAPI_deregistration_reason_free(OpenAPI_deregistration_reason_t *deregistration_reason)
OpenAPI_deregistration_reason_e OpenAPI_deregistration_reason_FromString(char* deregistration_reason)
{
if (NULL == deregistration_reason) {
return;
int stringToReturn = 0;
const char *deregistration_reasonArray[] = { "NULL", "UE_INITIAL_REGISTRATION", "UE_REGISTRATION_AREA_CHANGE", "SUBSCRIPTION_WITHDRAWN", "_5GS_TO_EPS_MOBILITY", "_5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION", "REREGISTRATION_REQUIRED", "SMF_CONTEXT_TRANSFERRED" };
size_t sizeofArray = sizeof(deregistration_reasonArray) / sizeof(deregistration_reasonArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(deregistration_reason, deregistration_reasonArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(deregistration_reason);
}
cJSON *OpenAPI_deregistration_reason_convertToJSON(OpenAPI_deregistration_reason_t *deregistration_reason)
{
cJSON *item = NULL;
if (deregistration_reason == NULL) {
ogs_error("OpenAPI_deregistration_reason_convertToJSON() failed [DeregistrationReason]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_parseFromJSON(cJSON *deregistration_reasonJSON)
{
OpenAPI_deregistration_reason_t *deregistration_reason_local_var = NULL;
deregistration_reason_local_var = OpenAPI_deregistration_reason_create (
);
return deregistration_reason_local_var;
end:
return NULL;
}
OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_copy(OpenAPI_deregistration_reason_t *dst, OpenAPI_deregistration_reason_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_deregistration_reason_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_deregistration_reason_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_deregistration_reason_free(dst);
dst = OpenAPI_deregistration_reason_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_deregistration_reason_s OpenAPI_deregistration_reason_t;
typedef struct OpenAPI_deregistration_reason_s {
} OpenAPI_deregistration_reason_t;
typedef enum { OpenAPI_deregistration_reason_NULL = 0, OpenAPI_deregistration_reason_UE_INITIAL_REGISTRATION, OpenAPI_deregistration_reason_UE_REGISTRATION_AREA_CHANGE, OpenAPI_deregistration_reason_SUBSCRIPTION_WITHDRAWN, OpenAPI_deregistration_reason__5GS_TO_EPS_MOBILITY, OpenAPI_deregistration_reason__5GS_TO_EPS_MOBILITY_UE_INITIAL_REGISTRATION, OpenAPI_deregistration_reason_REREGISTRATION_REQUIRED, OpenAPI_deregistration_reason_SMF_CONTEXT_TRANSFERRED } OpenAPI_deregistration_reason_e;
OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_create(
);
void OpenAPI_deregistration_reason_free(OpenAPI_deregistration_reason_t *deregistration_reason);
OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_parseFromJSON(cJSON *deregistration_reasonJSON);
cJSON *OpenAPI_deregistration_reason_convertToJSON(OpenAPI_deregistration_reason_t *deregistration_reason);
OpenAPI_deregistration_reason_t *OpenAPI_deregistration_reason_copy(OpenAPI_deregistration_reason_t *dst, OpenAPI_deregistration_reason_t *src);
char* OpenAPI_deregistration_reason_ToString(OpenAPI_deregistration_reason_e deregistration_reason);
OpenAPI_deregistration_reason_e OpenAPI_deregistration_reason_FromString(char* deregistration_reason);
#ifdef __cplusplus
}

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "dnai_change_type.h"
OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_create(
)
char* OpenAPI_dnai_change_type_ToString(OpenAPI_dnai_change_type_e dnai_change_type)
{
OpenAPI_dnai_change_type_t *dnai_change_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_dnai_change_type_t));
if (!dnai_change_type_local_var) {
return NULL;
}
return dnai_change_type_local_var;
const char *dnai_change_typeArray[] = { "NULL", "EARLY", "EARLY_LATE", "LATE" };
size_t sizeofArray = sizeof(dnai_change_typeArray) / sizeof(dnai_change_typeArray[0]);
if (dnai_change_type < sizeofArray)
return (char *)dnai_change_typeArray[dnai_change_type];
else
return (char *)"Unknown";
}
void OpenAPI_dnai_change_type_free(OpenAPI_dnai_change_type_t *dnai_change_type)
OpenAPI_dnai_change_type_e OpenAPI_dnai_change_type_FromString(char* dnai_change_type)
{
if (NULL == dnai_change_type) {
return;
int stringToReturn = 0;
const char *dnai_change_typeArray[] = { "NULL", "EARLY", "EARLY_LATE", "LATE" };
size_t sizeofArray = sizeof(dnai_change_typeArray) / sizeof(dnai_change_typeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(dnai_change_type, dnai_change_typeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(dnai_change_type);
}
cJSON *OpenAPI_dnai_change_type_convertToJSON(OpenAPI_dnai_change_type_t *dnai_change_type)
{
cJSON *item = NULL;
if (dnai_change_type == NULL) {
ogs_error("OpenAPI_dnai_change_type_convertToJSON() failed [DnaiChangeType]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_parseFromJSON(cJSON *dnai_change_typeJSON)
{
OpenAPI_dnai_change_type_t *dnai_change_type_local_var = NULL;
dnai_change_type_local_var = OpenAPI_dnai_change_type_create (
);
return dnai_change_type_local_var;
end:
return NULL;
}
OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_copy(OpenAPI_dnai_change_type_t *dst, OpenAPI_dnai_change_type_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_dnai_change_type_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_dnai_change_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_dnai_change_type_free(dst);
dst = OpenAPI_dnai_change_type_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -1,7 +1,7 @@
/*
* dnai_change_type.h
*
* Possible values are - EARLY: Early notification of UP path reconfiguration. - EARLY_LATE: Early and late notification of UP path reconfiguration. This value shall only be present in the subscription to the DNAI change event. - LATE: Late notification of UP path reconfiguration.
*
*/
#ifndef _OpenAPI_dnai_change_type_H_
@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_dnai_change_type_s OpenAPI_dnai_change_type_t;
typedef struct OpenAPI_dnai_change_type_s {
} OpenAPI_dnai_change_type_t;
typedef enum { OpenAPI_dnai_change_type_NULL = 0, OpenAPI_dnai_change_type_EARLY, OpenAPI_dnai_change_type_EARLY_LATE, OpenAPI_dnai_change_type_LATE } OpenAPI_dnai_change_type_e;
OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_create(
);
void OpenAPI_dnai_change_type_free(OpenAPI_dnai_change_type_t *dnai_change_type);
OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_parseFromJSON(cJSON *dnai_change_typeJSON);
cJSON *OpenAPI_dnai_change_type_convertToJSON(OpenAPI_dnai_change_type_t *dnai_change_type);
OpenAPI_dnai_change_type_t *OpenAPI_dnai_change_type_copy(OpenAPI_dnai_change_type_t *dst, OpenAPI_dnai_change_type_t *src);
char* OpenAPI_dnai_change_type_ToString(OpenAPI_dnai_change_type_e dnai_change_type);
OpenAPI_dnai_change_type_e OpenAPI_dnai_change_type_FromString(char* dnai_change_type);
#ifdef __cplusplus
}

View File

@ -0,0 +1,756 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "events_notification.h"
OpenAPI_events_notification_t *OpenAPI_events_notification_create(
OpenAPI_access_type_e access_type,
OpenAPI_acc_net_charging_address_t *an_charg_addr,
OpenAPI_list_t *an_charg_ids,
OpenAPI_an_gw_address_t *an_gw_addr,
char *ev_subs_uri,
OpenAPI_list_t *ev_notifs,
OpenAPI_list_t *failed_resourc_alloc_reports,
int no_net_loc_supp,
OpenAPI_list_t *out_of_cred_reports,
OpenAPI_plmn_id_t *plmn_id,
OpenAPI_list_t *qnc_reports,
OpenAPI_list_t *qos_mon_reports,
OpenAPI_list_t *ran_nas_rel_causes,
OpenAPI_rat_type_e rat_type,
OpenAPI_user_location_t *ue_loc,
char *ue_time_zone,
OpenAPI_accumulated_usage_t *usg_rep,
OpenAPI_tsn_bridge_info_t *tsn_bridge_info,
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt,
OpenAPI_list_t *tsn_port_man_cont_nwtts
)
{
OpenAPI_events_notification_t *events_notification_local_var = OpenAPI_malloc(sizeof(OpenAPI_events_notification_t));
if (!events_notification_local_var) {
return NULL;
}
events_notification_local_var->access_type = access_type;
events_notification_local_var->an_charg_addr = an_charg_addr;
events_notification_local_var->an_charg_ids = an_charg_ids;
events_notification_local_var->an_gw_addr = an_gw_addr;
events_notification_local_var->ev_subs_uri = ev_subs_uri;
events_notification_local_var->ev_notifs = ev_notifs;
events_notification_local_var->failed_resourc_alloc_reports = failed_resourc_alloc_reports;
events_notification_local_var->no_net_loc_supp = no_net_loc_supp;
events_notification_local_var->out_of_cred_reports = out_of_cred_reports;
events_notification_local_var->plmn_id = plmn_id;
events_notification_local_var->qnc_reports = qnc_reports;
events_notification_local_var->qos_mon_reports = qos_mon_reports;
events_notification_local_var->ran_nas_rel_causes = ran_nas_rel_causes;
events_notification_local_var->rat_type = rat_type;
events_notification_local_var->ue_loc = ue_loc;
events_notification_local_var->ue_time_zone = ue_time_zone;
events_notification_local_var->usg_rep = usg_rep;
events_notification_local_var->tsn_bridge_info = tsn_bridge_info;
events_notification_local_var->tsn_port_man_cont_dstt = tsn_port_man_cont_dstt;
events_notification_local_var->tsn_port_man_cont_nwtts = tsn_port_man_cont_nwtts;
return events_notification_local_var;
}
void OpenAPI_events_notification_free(OpenAPI_events_notification_t *events_notification)
{
if (NULL == events_notification) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_acc_net_charging_address_free(events_notification->an_charg_addr);
OpenAPI_list_for_each(events_notification->an_charg_ids, node) {
OpenAPI_access_net_charging_identifier_free(node->data);
}
OpenAPI_list_free(events_notification->an_charg_ids);
OpenAPI_an_gw_address_free(events_notification->an_gw_addr);
ogs_free(events_notification->ev_subs_uri);
OpenAPI_list_for_each(events_notification->ev_notifs, node) {
OpenAPI_af_event_notification_free(node->data);
}
OpenAPI_list_free(events_notification->ev_notifs);
OpenAPI_list_for_each(events_notification->failed_resourc_alloc_reports, node) {
OpenAPI_resources_allocation_info_free(node->data);
}
OpenAPI_list_free(events_notification->failed_resourc_alloc_reports);
OpenAPI_list_for_each(events_notification->out_of_cred_reports, node) {
OpenAPI_out_of_credit_information_free(node->data);
}
OpenAPI_list_free(events_notification->out_of_cred_reports);
OpenAPI_plmn_id_free(events_notification->plmn_id);
OpenAPI_list_for_each(events_notification->qnc_reports, node) {
OpenAPI_qos_notification_control_info_free(node->data);
}
OpenAPI_list_free(events_notification->qnc_reports);
OpenAPI_list_for_each(events_notification->qos_mon_reports, node) {
OpenAPI_qos_monitoring_report_free(node->data);
}
OpenAPI_list_free(events_notification->qos_mon_reports);
OpenAPI_list_for_each(events_notification->ran_nas_rel_causes, node) {
OpenAPI_ran_nas_rel_cause_free(node->data);
}
OpenAPI_list_free(events_notification->ran_nas_rel_causes);
OpenAPI_user_location_free(events_notification->ue_loc);
ogs_free(events_notification->ue_time_zone);
OpenAPI_accumulated_usage_free(events_notification->usg_rep);
OpenAPI_tsn_bridge_info_free(events_notification->tsn_bridge_info);
OpenAPI_port_management_container_free(events_notification->tsn_port_man_cont_dstt);
OpenAPI_list_for_each(events_notification->tsn_port_man_cont_nwtts, node) {
OpenAPI_port_management_container_free(node->data);
}
OpenAPI_list_free(events_notification->tsn_port_man_cont_nwtts);
ogs_free(events_notification);
}
cJSON *OpenAPI_events_notification_convertToJSON(OpenAPI_events_notification_t *events_notification)
{
cJSON *item = NULL;
if (events_notification == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [EventsNotification]");
return NULL;
}
item = cJSON_CreateObject();
if (events_notification->access_type) {
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(events_notification->access_type)) == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [access_type]");
goto end;
}
}
if (events_notification->an_charg_addr) {
cJSON *an_charg_addr_local_JSON = OpenAPI_acc_net_charging_address_convertToJSON(events_notification->an_charg_addr);
if (an_charg_addr_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [an_charg_addr]");
goto end;
}
cJSON_AddItemToObject(item, "anChargAddr", an_charg_addr_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [an_charg_addr]");
goto end;
}
}
if (events_notification->an_charg_ids) {
cJSON *an_charg_idsList = cJSON_AddArrayToObject(item, "anChargIds");
if (an_charg_idsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [an_charg_ids]");
goto end;
}
OpenAPI_lnode_t *an_charg_ids_node;
if (events_notification->an_charg_ids) {
OpenAPI_list_for_each(events_notification->an_charg_ids, an_charg_ids_node) {
cJSON *itemLocal = OpenAPI_access_net_charging_identifier_convertToJSON(an_charg_ids_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [an_charg_ids]");
goto end;
}
cJSON_AddItemToArray(an_charg_idsList, itemLocal);
}
}
}
if (events_notification->an_gw_addr) {
cJSON *an_gw_addr_local_JSON = OpenAPI_an_gw_address_convertToJSON(events_notification->an_gw_addr);
if (an_gw_addr_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [an_gw_addr]");
goto end;
}
cJSON_AddItemToObject(item, "anGwAddr", an_gw_addr_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [an_gw_addr]");
goto end;
}
}
if (cJSON_AddStringToObject(item, "evSubsUri", events_notification->ev_subs_uri) == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ev_subs_uri]");
goto end;
}
cJSON *ev_notifsList = cJSON_AddArrayToObject(item, "evNotifs");
if (ev_notifsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ev_notifs]");
goto end;
}
OpenAPI_lnode_t *ev_notifs_node;
if (events_notification->ev_notifs) {
OpenAPI_list_for_each(events_notification->ev_notifs, ev_notifs_node) {
cJSON *itemLocal = OpenAPI_af_event_notification_convertToJSON(ev_notifs_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ev_notifs]");
goto end;
}
cJSON_AddItemToArray(ev_notifsList, itemLocal);
}
}
if (events_notification->failed_resourc_alloc_reports) {
cJSON *failed_resourc_alloc_reportsList = cJSON_AddArrayToObject(item, "failedResourcAllocReports");
if (failed_resourc_alloc_reportsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [failed_resourc_alloc_reports]");
goto end;
}
OpenAPI_lnode_t *failed_resourc_alloc_reports_node;
if (events_notification->failed_resourc_alloc_reports) {
OpenAPI_list_for_each(events_notification->failed_resourc_alloc_reports, failed_resourc_alloc_reports_node) {
cJSON *itemLocal = OpenAPI_resources_allocation_info_convertToJSON(failed_resourc_alloc_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [failed_resourc_alloc_reports]");
goto end;
}
cJSON_AddItemToArray(failed_resourc_alloc_reportsList, itemLocal);
}
}
}
if (events_notification->no_net_loc_supp) {
if (cJSON_AddBoolToObject(item, "noNetLocSupp", events_notification->no_net_loc_supp) == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [no_net_loc_supp]");
goto end;
}
}
if (events_notification->out_of_cred_reports) {
cJSON *out_of_cred_reportsList = cJSON_AddArrayToObject(item, "outOfCredReports");
if (out_of_cred_reportsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [out_of_cred_reports]");
goto end;
}
OpenAPI_lnode_t *out_of_cred_reports_node;
if (events_notification->out_of_cred_reports) {
OpenAPI_list_for_each(events_notification->out_of_cred_reports, out_of_cred_reports_node) {
cJSON *itemLocal = OpenAPI_out_of_credit_information_convertToJSON(out_of_cred_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [out_of_cred_reports]");
goto end;
}
cJSON_AddItemToArray(out_of_cred_reportsList, itemLocal);
}
}
}
if (events_notification->plmn_id) {
cJSON *plmn_id_local_JSON = OpenAPI_plmn_id_convertToJSON(events_notification->plmn_id);
if (plmn_id_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [plmn_id]");
goto end;
}
cJSON_AddItemToObject(item, "plmnId", plmn_id_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [plmn_id]");
goto end;
}
}
if (events_notification->qnc_reports) {
cJSON *qnc_reportsList = cJSON_AddArrayToObject(item, "qncReports");
if (qnc_reportsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [qnc_reports]");
goto end;
}
OpenAPI_lnode_t *qnc_reports_node;
if (events_notification->qnc_reports) {
OpenAPI_list_for_each(events_notification->qnc_reports, qnc_reports_node) {
cJSON *itemLocal = OpenAPI_qos_notification_control_info_convertToJSON(qnc_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [qnc_reports]");
goto end;
}
cJSON_AddItemToArray(qnc_reportsList, itemLocal);
}
}
}
if (events_notification->qos_mon_reports) {
cJSON *qos_mon_reportsList = cJSON_AddArrayToObject(item, "qosMonReports");
if (qos_mon_reportsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [qos_mon_reports]");
goto end;
}
OpenAPI_lnode_t *qos_mon_reports_node;
if (events_notification->qos_mon_reports) {
OpenAPI_list_for_each(events_notification->qos_mon_reports, qos_mon_reports_node) {
cJSON *itemLocal = OpenAPI_qos_monitoring_report_convertToJSON(qos_mon_reports_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [qos_mon_reports]");
goto end;
}
cJSON_AddItemToArray(qos_mon_reportsList, itemLocal);
}
}
}
if (events_notification->ran_nas_rel_causes) {
cJSON *ran_nas_rel_causesList = cJSON_AddArrayToObject(item, "ranNasRelCauses");
if (ran_nas_rel_causesList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ran_nas_rel_causes]");
goto end;
}
OpenAPI_lnode_t *ran_nas_rel_causes_node;
if (events_notification->ran_nas_rel_causes) {
OpenAPI_list_for_each(events_notification->ran_nas_rel_causes, ran_nas_rel_causes_node) {
cJSON *itemLocal = OpenAPI_ran_nas_rel_cause_convertToJSON(ran_nas_rel_causes_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ran_nas_rel_causes]");
goto end;
}
cJSON_AddItemToArray(ran_nas_rel_causesList, itemLocal);
}
}
}
if (events_notification->rat_type) {
if (cJSON_AddStringToObject(item, "ratType", OpenAPI_rat_type_ToString(events_notification->rat_type)) == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [rat_type]");
goto end;
}
}
if (events_notification->ue_loc) {
cJSON *ue_loc_local_JSON = OpenAPI_user_location_convertToJSON(events_notification->ue_loc);
if (ue_loc_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ue_loc]");
goto end;
}
cJSON_AddItemToObject(item, "ueLoc", ue_loc_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ue_loc]");
goto end;
}
}
if (events_notification->ue_time_zone) {
if (cJSON_AddStringToObject(item, "ueTimeZone", events_notification->ue_time_zone) == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [ue_time_zone]");
goto end;
}
}
if (events_notification->usg_rep) {
cJSON *usg_rep_local_JSON = OpenAPI_accumulated_usage_convertToJSON(events_notification->usg_rep);
if (usg_rep_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [usg_rep]");
goto end;
}
cJSON_AddItemToObject(item, "usgRep", usg_rep_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [usg_rep]");
goto end;
}
}
if (events_notification->tsn_bridge_info) {
cJSON *tsn_bridge_info_local_JSON = OpenAPI_tsn_bridge_info_convertToJSON(events_notification->tsn_bridge_info);
if (tsn_bridge_info_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [tsn_bridge_info]");
goto end;
}
cJSON_AddItemToObject(item, "tsnBridgeInfo", tsn_bridge_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [tsn_bridge_info]");
goto end;
}
}
if (events_notification->tsn_port_man_cont_dstt) {
cJSON *tsn_port_man_cont_dstt_local_JSON = OpenAPI_port_management_container_convertToJSON(events_notification->tsn_port_man_cont_dstt);
if (tsn_port_man_cont_dstt_local_JSON == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [tsn_port_man_cont_dstt]");
goto end;
}
cJSON_AddItemToObject(item, "tsnPortManContDstt", tsn_port_man_cont_dstt_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [tsn_port_man_cont_dstt]");
goto end;
}
}
if (events_notification->tsn_port_man_cont_nwtts) {
cJSON *tsn_port_man_cont_nwttsList = cJSON_AddArrayToObject(item, "tsnPortManContNwtts");
if (tsn_port_man_cont_nwttsList == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
OpenAPI_lnode_t *tsn_port_man_cont_nwtts_node;
if (events_notification->tsn_port_man_cont_nwtts) {
OpenAPI_list_for_each(events_notification->tsn_port_man_cont_nwtts, tsn_port_man_cont_nwtts_node) {
cJSON *itemLocal = OpenAPI_port_management_container_convertToJSON(tsn_port_man_cont_nwtts_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_notification_convertToJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
cJSON_AddItemToArray(tsn_port_man_cont_nwttsList, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON *events_notificationJSON)
{
OpenAPI_events_notification_t *events_notification_local_var = NULL;
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "accessType");
OpenAPI_access_type_e access_typeVariable;
if (access_type) {
if (!cJSON_IsString(access_type)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [access_type]");
goto end;
}
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
}
cJSON *an_charg_addr = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "anChargAddr");
OpenAPI_acc_net_charging_address_t *an_charg_addr_local_nonprim = NULL;
if (an_charg_addr) {
an_charg_addr_local_nonprim = OpenAPI_acc_net_charging_address_parseFromJSON(an_charg_addr);
}
cJSON *an_charg_ids = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "anChargIds");
OpenAPI_list_t *an_charg_idsList;
if (an_charg_ids) {
cJSON *an_charg_ids_local_nonprimitive;
if (!cJSON_IsArray(an_charg_ids)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [an_charg_ids]");
goto end;
}
an_charg_idsList = OpenAPI_list_create();
cJSON_ArrayForEach(an_charg_ids_local_nonprimitive, an_charg_ids ) {
if (!cJSON_IsObject(an_charg_ids_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [an_charg_ids]");
goto end;
}
OpenAPI_access_net_charging_identifier_t *an_charg_idsItem = OpenAPI_access_net_charging_identifier_parseFromJSON(an_charg_ids_local_nonprimitive);
OpenAPI_list_add(an_charg_idsList, an_charg_idsItem);
}
}
cJSON *an_gw_addr = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "anGwAddr");
OpenAPI_an_gw_address_t *an_gw_addr_local_nonprim = NULL;
if (an_gw_addr) {
an_gw_addr_local_nonprim = OpenAPI_an_gw_address_parseFromJSON(an_gw_addr);
}
cJSON *ev_subs_uri = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "evSubsUri");
if (!ev_subs_uri) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ev_subs_uri]");
goto end;
}
if (!cJSON_IsString(ev_subs_uri)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ev_subs_uri]");
goto end;
}
cJSON *ev_notifs = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "evNotifs");
if (!ev_notifs) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ev_notifs]");
goto end;
}
OpenAPI_list_t *ev_notifsList;
cJSON *ev_notifs_local_nonprimitive;
if (!cJSON_IsArray(ev_notifs)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ev_notifs]");
goto end;
}
ev_notifsList = OpenAPI_list_create();
cJSON_ArrayForEach(ev_notifs_local_nonprimitive, ev_notifs ) {
if (!cJSON_IsObject(ev_notifs_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ev_notifs]");
goto end;
}
OpenAPI_af_event_notification_t *ev_notifsItem = OpenAPI_af_event_notification_parseFromJSON(ev_notifs_local_nonprimitive);
OpenAPI_list_add(ev_notifsList, ev_notifsItem);
}
cJSON *failed_resourc_alloc_reports = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "failedResourcAllocReports");
OpenAPI_list_t *failed_resourc_alloc_reportsList;
if (failed_resourc_alloc_reports) {
cJSON *failed_resourc_alloc_reports_local_nonprimitive;
if (!cJSON_IsArray(failed_resourc_alloc_reports)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [failed_resourc_alloc_reports]");
goto end;
}
failed_resourc_alloc_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(failed_resourc_alloc_reports_local_nonprimitive, failed_resourc_alloc_reports ) {
if (!cJSON_IsObject(failed_resourc_alloc_reports_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [failed_resourc_alloc_reports]");
goto end;
}
OpenAPI_resources_allocation_info_t *failed_resourc_alloc_reportsItem = OpenAPI_resources_allocation_info_parseFromJSON(failed_resourc_alloc_reports_local_nonprimitive);
OpenAPI_list_add(failed_resourc_alloc_reportsList, failed_resourc_alloc_reportsItem);
}
}
cJSON *no_net_loc_supp = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "noNetLocSupp");
if (no_net_loc_supp) {
if (!cJSON_IsBool(no_net_loc_supp)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [no_net_loc_supp]");
goto end;
}
}
cJSON *out_of_cred_reports = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "outOfCredReports");
OpenAPI_list_t *out_of_cred_reportsList;
if (out_of_cred_reports) {
cJSON *out_of_cred_reports_local_nonprimitive;
if (!cJSON_IsArray(out_of_cred_reports)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [out_of_cred_reports]");
goto end;
}
out_of_cred_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(out_of_cred_reports_local_nonprimitive, out_of_cred_reports ) {
if (!cJSON_IsObject(out_of_cred_reports_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [out_of_cred_reports]");
goto end;
}
OpenAPI_out_of_credit_information_t *out_of_cred_reportsItem = OpenAPI_out_of_credit_information_parseFromJSON(out_of_cred_reports_local_nonprimitive);
OpenAPI_list_add(out_of_cred_reportsList, out_of_cred_reportsItem);
}
}
cJSON *plmn_id = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "plmnId");
OpenAPI_plmn_id_t *plmn_id_local_nonprim = NULL;
if (plmn_id) {
plmn_id_local_nonprim = OpenAPI_plmn_id_parseFromJSON(plmn_id);
}
cJSON *qnc_reports = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "qncReports");
OpenAPI_list_t *qnc_reportsList;
if (qnc_reports) {
cJSON *qnc_reports_local_nonprimitive;
if (!cJSON_IsArray(qnc_reports)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [qnc_reports]");
goto end;
}
qnc_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(qnc_reports_local_nonprimitive, qnc_reports ) {
if (!cJSON_IsObject(qnc_reports_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [qnc_reports]");
goto end;
}
OpenAPI_qos_notification_control_info_t *qnc_reportsItem = OpenAPI_qos_notification_control_info_parseFromJSON(qnc_reports_local_nonprimitive);
OpenAPI_list_add(qnc_reportsList, qnc_reportsItem);
}
}
cJSON *qos_mon_reports = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "qosMonReports");
OpenAPI_list_t *qos_mon_reportsList;
if (qos_mon_reports) {
cJSON *qos_mon_reports_local_nonprimitive;
if (!cJSON_IsArray(qos_mon_reports)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [qos_mon_reports]");
goto end;
}
qos_mon_reportsList = OpenAPI_list_create();
cJSON_ArrayForEach(qos_mon_reports_local_nonprimitive, qos_mon_reports ) {
if (!cJSON_IsObject(qos_mon_reports_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [qos_mon_reports]");
goto end;
}
OpenAPI_qos_monitoring_report_t *qos_mon_reportsItem = OpenAPI_qos_monitoring_report_parseFromJSON(qos_mon_reports_local_nonprimitive);
OpenAPI_list_add(qos_mon_reportsList, qos_mon_reportsItem);
}
}
cJSON *ran_nas_rel_causes = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ranNasRelCauses");
OpenAPI_list_t *ran_nas_rel_causesList;
if (ran_nas_rel_causes) {
cJSON *ran_nas_rel_causes_local_nonprimitive;
if (!cJSON_IsArray(ran_nas_rel_causes)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ran_nas_rel_causes]");
goto end;
}
ran_nas_rel_causesList = OpenAPI_list_create();
cJSON_ArrayForEach(ran_nas_rel_causes_local_nonprimitive, ran_nas_rel_causes ) {
if (!cJSON_IsObject(ran_nas_rel_causes_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ran_nas_rel_causes]");
goto end;
}
OpenAPI_ran_nas_rel_cause_t *ran_nas_rel_causesItem = OpenAPI_ran_nas_rel_cause_parseFromJSON(ran_nas_rel_causes_local_nonprimitive);
OpenAPI_list_add(ran_nas_rel_causesList, ran_nas_rel_causesItem);
}
}
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ratType");
OpenAPI_rat_type_e rat_typeVariable;
if (rat_type) {
if (!cJSON_IsString(rat_type)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [rat_type]");
goto end;
}
rat_typeVariable = OpenAPI_rat_type_FromString(rat_type->valuestring);
}
cJSON *ue_loc = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ueLoc");
OpenAPI_user_location_t *ue_loc_local_nonprim = NULL;
if (ue_loc) {
ue_loc_local_nonprim = OpenAPI_user_location_parseFromJSON(ue_loc);
}
cJSON *ue_time_zone = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "ueTimeZone");
if (ue_time_zone) {
if (!cJSON_IsString(ue_time_zone)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [ue_time_zone]");
goto end;
}
}
cJSON *usg_rep = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "usgRep");
OpenAPI_accumulated_usage_t *usg_rep_local_nonprim = NULL;
if (usg_rep) {
usg_rep_local_nonprim = OpenAPI_accumulated_usage_parseFromJSON(usg_rep);
}
cJSON *tsn_bridge_info = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "tsnBridgeInfo");
OpenAPI_tsn_bridge_info_t *tsn_bridge_info_local_nonprim = NULL;
if (tsn_bridge_info) {
tsn_bridge_info_local_nonprim = OpenAPI_tsn_bridge_info_parseFromJSON(tsn_bridge_info);
}
cJSON *tsn_port_man_cont_dstt = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "tsnPortManContDstt");
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt_local_nonprim = NULL;
if (tsn_port_man_cont_dstt) {
tsn_port_man_cont_dstt_local_nonprim = OpenAPI_port_management_container_parseFromJSON(tsn_port_man_cont_dstt);
}
cJSON *tsn_port_man_cont_nwtts = cJSON_GetObjectItemCaseSensitive(events_notificationJSON, "tsnPortManContNwtts");
OpenAPI_list_t *tsn_port_man_cont_nwttsList;
if (tsn_port_man_cont_nwtts) {
cJSON *tsn_port_man_cont_nwtts_local_nonprimitive;
if (!cJSON_IsArray(tsn_port_man_cont_nwtts)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
tsn_port_man_cont_nwttsList = OpenAPI_list_create();
cJSON_ArrayForEach(tsn_port_man_cont_nwtts_local_nonprimitive, tsn_port_man_cont_nwtts ) {
if (!cJSON_IsObject(tsn_port_man_cont_nwtts_local_nonprimitive)) {
ogs_error("OpenAPI_events_notification_parseFromJSON() failed [tsn_port_man_cont_nwtts]");
goto end;
}
OpenAPI_port_management_container_t *tsn_port_man_cont_nwttsItem = OpenAPI_port_management_container_parseFromJSON(tsn_port_man_cont_nwtts_local_nonprimitive);
OpenAPI_list_add(tsn_port_man_cont_nwttsList, tsn_port_man_cont_nwttsItem);
}
}
events_notification_local_var = OpenAPI_events_notification_create (
access_type ? access_typeVariable : 0,
an_charg_addr ? an_charg_addr_local_nonprim : NULL,
an_charg_ids ? an_charg_idsList : NULL,
an_gw_addr ? an_gw_addr_local_nonprim : NULL,
ogs_strdup(ev_subs_uri->valuestring),
ev_notifsList,
failed_resourc_alloc_reports ? failed_resourc_alloc_reportsList : NULL,
no_net_loc_supp ? no_net_loc_supp->valueint : 0,
out_of_cred_reports ? out_of_cred_reportsList : NULL,
plmn_id ? plmn_id_local_nonprim : NULL,
qnc_reports ? qnc_reportsList : NULL,
qos_mon_reports ? qos_mon_reportsList : NULL,
ran_nas_rel_causes ? ran_nas_rel_causesList : NULL,
rat_type ? rat_typeVariable : 0,
ue_loc ? ue_loc_local_nonprim : NULL,
ue_time_zone ? ogs_strdup(ue_time_zone->valuestring) : NULL,
usg_rep ? usg_rep_local_nonprim : NULL,
tsn_bridge_info ? tsn_bridge_info_local_nonprim : NULL,
tsn_port_man_cont_dstt ? tsn_port_man_cont_dstt_local_nonprim : NULL,
tsn_port_man_cont_nwtts ? tsn_port_man_cont_nwttsList : NULL
);
return events_notification_local_var;
end:
return NULL;
}
OpenAPI_events_notification_t *OpenAPI_events_notification_copy(OpenAPI_events_notification_t *dst, OpenAPI_events_notification_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_events_notification_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_events_notification_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_events_notification_free(dst);
dst = OpenAPI_events_notification_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,92 @@
/*
* events_notification.h
*
* describes the notification of a matched event
*/
#ifndef _OpenAPI_events_notification_H_
#define _OpenAPI_events_notification_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "acc_net_charging_address.h"
#include "access_net_charging_identifier.h"
#include "access_type.h"
#include "accumulated_usage.h"
#include "af_event_notification.h"
#include "an_gw_address.h"
#include "out_of_credit_information.h"
#include "plmn_id.h"
#include "port_management_container.h"
#include "qos_monitoring_report.h"
#include "qos_notification_control_info.h"
#include "ran_nas_rel_cause.h"
#include "rat_type.h"
#include "resources_allocation_info.h"
#include "tsn_bridge_info.h"
#include "user_location.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_events_notification_s OpenAPI_events_notification_t;
typedef struct OpenAPI_events_notification_s {
OpenAPI_access_type_e access_type;
struct OpenAPI_acc_net_charging_address_s *an_charg_addr;
OpenAPI_list_t *an_charg_ids;
struct OpenAPI_an_gw_address_s *an_gw_addr;
char *ev_subs_uri;
OpenAPI_list_t *ev_notifs;
OpenAPI_list_t *failed_resourc_alloc_reports;
int no_net_loc_supp;
OpenAPI_list_t *out_of_cred_reports;
struct OpenAPI_plmn_id_s *plmn_id;
OpenAPI_list_t *qnc_reports;
OpenAPI_list_t *qos_mon_reports;
OpenAPI_list_t *ran_nas_rel_causes;
OpenAPI_rat_type_e rat_type;
struct OpenAPI_user_location_s *ue_loc;
char *ue_time_zone;
struct OpenAPI_accumulated_usage_s *usg_rep;
struct OpenAPI_tsn_bridge_info_s *tsn_bridge_info;
struct OpenAPI_port_management_container_s *tsn_port_man_cont_dstt;
OpenAPI_list_t *tsn_port_man_cont_nwtts;
} OpenAPI_events_notification_t;
OpenAPI_events_notification_t *OpenAPI_events_notification_create(
OpenAPI_access_type_e access_type,
OpenAPI_acc_net_charging_address_t *an_charg_addr,
OpenAPI_list_t *an_charg_ids,
OpenAPI_an_gw_address_t *an_gw_addr,
char *ev_subs_uri,
OpenAPI_list_t *ev_notifs,
OpenAPI_list_t *failed_resourc_alloc_reports,
int no_net_loc_supp,
OpenAPI_list_t *out_of_cred_reports,
OpenAPI_plmn_id_t *plmn_id,
OpenAPI_list_t *qnc_reports,
OpenAPI_list_t *qos_mon_reports,
OpenAPI_list_t *ran_nas_rel_causes,
OpenAPI_rat_type_e rat_type,
OpenAPI_user_location_t *ue_loc,
char *ue_time_zone,
OpenAPI_accumulated_usage_t *usg_rep,
OpenAPI_tsn_bridge_info_t *tsn_bridge_info,
OpenAPI_port_management_container_t *tsn_port_man_cont_dstt,
OpenAPI_list_t *tsn_port_man_cont_nwtts
);
void OpenAPI_events_notification_free(OpenAPI_events_notification_t *events_notification);
OpenAPI_events_notification_t *OpenAPI_events_notification_parseFromJSON(cJSON *events_notificationJSON);
cJSON *OpenAPI_events_notification_convertToJSON(OpenAPI_events_notification_t *events_notification);
OpenAPI_events_notification_t *OpenAPI_events_notification_copy(OpenAPI_events_notification_t *dst, OpenAPI_events_notification_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_events_notification_H_ */

View File

@ -0,0 +1,286 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "events_subsc_req_data.h"
OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_create(
OpenAPI_list_t *events,
char *notif_uri,
OpenAPI_list_t *req_qos_mon_params,
OpenAPI_qos_monitoring_information_t *qos_mon,
OpenAPI_required_access_info_e req_ani,
OpenAPI_usage_threshold_t *usg_thres,
char *notif_corre_id
)
{
OpenAPI_events_subsc_req_data_t *events_subsc_req_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_events_subsc_req_data_t));
if (!events_subsc_req_data_local_var) {
return NULL;
}
events_subsc_req_data_local_var->events = events;
events_subsc_req_data_local_var->notif_uri = notif_uri;
events_subsc_req_data_local_var->req_qos_mon_params = req_qos_mon_params;
events_subsc_req_data_local_var->qos_mon = qos_mon;
events_subsc_req_data_local_var->req_ani = req_ani;
events_subsc_req_data_local_var->usg_thres = usg_thres;
events_subsc_req_data_local_var->notif_corre_id = notif_corre_id;
return events_subsc_req_data_local_var;
}
void OpenAPI_events_subsc_req_data_free(OpenAPI_events_subsc_req_data_t *events_subsc_req_data)
{
if (NULL == events_subsc_req_data) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(events_subsc_req_data->events, node) {
OpenAPI_af_event_subscription_free(node->data);
}
OpenAPI_list_free(events_subsc_req_data->events);
ogs_free(events_subsc_req_data->notif_uri);
OpenAPI_list_free(events_subsc_req_data->req_qos_mon_params);
OpenAPI_qos_monitoring_information_free(events_subsc_req_data->qos_mon);
OpenAPI_usage_threshold_free(events_subsc_req_data->usg_thres);
ogs_free(events_subsc_req_data->notif_corre_id);
ogs_free(events_subsc_req_data);
}
cJSON *OpenAPI_events_subsc_req_data_convertToJSON(OpenAPI_events_subsc_req_data_t *events_subsc_req_data)
{
cJSON *item = NULL;
if (events_subsc_req_data == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [EventsSubscReqData]");
return NULL;
}
item = cJSON_CreateObject();
cJSON *eventsList = cJSON_AddArrayToObject(item, "events");
if (eventsList == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [events]");
goto end;
}
OpenAPI_lnode_t *events_node;
if (events_subsc_req_data->events) {
OpenAPI_list_for_each(events_subsc_req_data->events, events_node) {
cJSON *itemLocal = OpenAPI_af_event_subscription_convertToJSON(events_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [events]");
goto end;
}
cJSON_AddItemToArray(eventsList, itemLocal);
}
}
if (events_subsc_req_data->notif_uri) {
if (cJSON_AddStringToObject(item, "notifUri", events_subsc_req_data->notif_uri) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [notif_uri]");
goto end;
}
}
if (events_subsc_req_data->req_qos_mon_params) {
cJSON *req_qos_mon_params = cJSON_AddArrayToObject(item, "reqQosMonParams");
if (req_qos_mon_params == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
OpenAPI_lnode_t *req_qos_mon_params_node;
OpenAPI_list_for_each(events_subsc_req_data->req_qos_mon_params, req_qos_mon_params_node) {
if (cJSON_AddStringToObject(req_qos_mon_params, "", OpenAPI_requested_qos_monitoring_parameter_ToString((intptr_t)req_qos_mon_params_node->data)) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
}
}
if (events_subsc_req_data->qos_mon) {
cJSON *qos_mon_local_JSON = OpenAPI_qos_monitoring_information_convertToJSON(events_subsc_req_data->qos_mon);
if (qos_mon_local_JSON == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [qos_mon]");
goto end;
}
cJSON_AddItemToObject(item, "qosMon", qos_mon_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [qos_mon]");
goto end;
}
}
if (events_subsc_req_data->req_ani) {
if (cJSON_AddStringToObject(item, "reqAni", OpenAPI_required_access_info_ToString(events_subsc_req_data->req_ani)) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [req_ani]");
goto end;
}
}
if (events_subsc_req_data->usg_thres) {
cJSON *usg_thres_local_JSON = OpenAPI_usage_threshold_convertToJSON(events_subsc_req_data->usg_thres);
if (usg_thres_local_JSON == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [usg_thres]");
goto end;
}
cJSON_AddItemToObject(item, "usgThres", usg_thres_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [usg_thres]");
goto end;
}
}
if (events_subsc_req_data->notif_corre_id) {
if (cJSON_AddStringToObject(item, "notifCorreId", events_subsc_req_data->notif_corre_id) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_convertToJSON() failed [notif_corre_id]");
goto end;
}
}
end:
return item;
}
OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_parseFromJSON(cJSON *events_subsc_req_dataJSON)
{
OpenAPI_events_subsc_req_data_t *events_subsc_req_data_local_var = NULL;
cJSON *events = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "events");
if (!events) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [events]");
goto end;
}
OpenAPI_list_t *eventsList;
cJSON *events_local_nonprimitive;
if (!cJSON_IsArray(events)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [events]");
goto end;
}
eventsList = OpenAPI_list_create();
cJSON_ArrayForEach(events_local_nonprimitive, events ) {
if (!cJSON_IsObject(events_local_nonprimitive)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [events]");
goto end;
}
OpenAPI_af_event_subscription_t *eventsItem = OpenAPI_af_event_subscription_parseFromJSON(events_local_nonprimitive);
OpenAPI_list_add(eventsList, eventsItem);
}
cJSON *notif_uri = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "notifUri");
if (notif_uri) {
if (!cJSON_IsString(notif_uri)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [notif_uri]");
goto end;
}
}
cJSON *req_qos_mon_params = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "reqQosMonParams");
OpenAPI_list_t *req_qos_mon_paramsList;
if (req_qos_mon_params) {
cJSON *req_qos_mon_params_local_nonprimitive;
if (!cJSON_IsArray(req_qos_mon_params)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [req_qos_mon_params]");
goto end;
}
req_qos_mon_paramsList = OpenAPI_list_create();
cJSON_ArrayForEach(req_qos_mon_params_local_nonprimitive, req_qos_mon_params ) {
if (!cJSON_IsString(req_qos_mon_params_local_nonprimitive)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [req_qos_mon_params]");
goto end;
}
OpenAPI_list_add(req_qos_mon_paramsList, (void *)OpenAPI_requested_qos_monitoring_parameter_FromString(req_qos_mon_params_local_nonprimitive->valuestring));
}
}
cJSON *qos_mon = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "qosMon");
OpenAPI_qos_monitoring_information_t *qos_mon_local_nonprim = NULL;
if (qos_mon) {
qos_mon_local_nonprim = OpenAPI_qos_monitoring_information_parseFromJSON(qos_mon);
}
cJSON *req_ani = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "reqAni");
OpenAPI_required_access_info_e req_aniVariable;
if (req_ani) {
if (!cJSON_IsString(req_ani)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [req_ani]");
goto end;
}
req_aniVariable = OpenAPI_required_access_info_FromString(req_ani->valuestring);
}
cJSON *usg_thres = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "usgThres");
OpenAPI_usage_threshold_t *usg_thres_local_nonprim = NULL;
if (usg_thres) {
usg_thres_local_nonprim = OpenAPI_usage_threshold_parseFromJSON(usg_thres);
}
cJSON *notif_corre_id = cJSON_GetObjectItemCaseSensitive(events_subsc_req_dataJSON, "notifCorreId");
if (notif_corre_id) {
if (!cJSON_IsString(notif_corre_id)) {
ogs_error("OpenAPI_events_subsc_req_data_parseFromJSON() failed [notif_corre_id]");
goto end;
}
}
events_subsc_req_data_local_var = OpenAPI_events_subsc_req_data_create (
eventsList,
notif_uri ? ogs_strdup(notif_uri->valuestring) : NULL,
req_qos_mon_params ? req_qos_mon_paramsList : NULL,
qos_mon ? qos_mon_local_nonprim : NULL,
req_ani ? req_aniVariable : 0,
usg_thres ? usg_thres_local_nonprim : NULL,
notif_corre_id ? ogs_strdup(notif_corre_id->valuestring) : NULL
);
return events_subsc_req_data_local_var;
end:
return NULL;
}
OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_copy(OpenAPI_events_subsc_req_data_t *dst, OpenAPI_events_subsc_req_data_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_events_subsc_req_data_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_events_subsc_req_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_events_subsc_req_data_free(dst);
dst = OpenAPI_events_subsc_req_data_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,55 @@
/*
* events_subsc_req_data.h
*
* Identifies the events the application subscribes to.
*/
#ifndef _OpenAPI_events_subsc_req_data_H_
#define _OpenAPI_events_subsc_req_data_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_event_subscription.h"
#include "qos_monitoring_information.h"
#include "requested_qos_monitoring_parameter.h"
#include "required_access_info.h"
#include "usage_threshold.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_events_subsc_req_data_s OpenAPI_events_subsc_req_data_t;
typedef struct OpenAPI_events_subsc_req_data_s {
OpenAPI_list_t *events;
char *notif_uri;
OpenAPI_list_t *req_qos_mon_params;
struct OpenAPI_qos_monitoring_information_s *qos_mon;
OpenAPI_required_access_info_e req_ani;
struct OpenAPI_usage_threshold_s *usg_thres;
char *notif_corre_id;
} OpenAPI_events_subsc_req_data_t;
OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_create(
OpenAPI_list_t *events,
char *notif_uri,
OpenAPI_list_t *req_qos_mon_params,
OpenAPI_qos_monitoring_information_t *qos_mon,
OpenAPI_required_access_info_e req_ani,
OpenAPI_usage_threshold_t *usg_thres,
char *notif_corre_id
);
void OpenAPI_events_subsc_req_data_free(OpenAPI_events_subsc_req_data_t *events_subsc_req_data);
OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_parseFromJSON(cJSON *events_subsc_req_dataJSON);
cJSON *OpenAPI_events_subsc_req_data_convertToJSON(OpenAPI_events_subsc_req_data_t *events_subsc_req_data);
OpenAPI_events_subsc_req_data_t *OpenAPI_events_subsc_req_data_copy(OpenAPI_events_subsc_req_data_t *dst, OpenAPI_events_subsc_req_data_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_events_subsc_req_data_H_ */

View File

@ -0,0 +1,286 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "events_subsc_req_data_rm.h"
OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_create(
OpenAPI_list_t *events,
char *notif_uri,
OpenAPI_list_t *req_qos_mon_params,
OpenAPI_qos_monitoring_information_rm_t *qos_mon,
OpenAPI_required_access_info_e req_ani,
OpenAPI_usage_threshold_rm_t *usg_thres,
char *notif_corre_id
)
{
OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_events_subsc_req_data_rm_t));
if (!events_subsc_req_data_rm_local_var) {
return NULL;
}
events_subsc_req_data_rm_local_var->events = events;
events_subsc_req_data_rm_local_var->notif_uri = notif_uri;
events_subsc_req_data_rm_local_var->req_qos_mon_params = req_qos_mon_params;
events_subsc_req_data_rm_local_var->qos_mon = qos_mon;
events_subsc_req_data_rm_local_var->req_ani = req_ani;
events_subsc_req_data_rm_local_var->usg_thres = usg_thres;
events_subsc_req_data_rm_local_var->notif_corre_id = notif_corre_id;
return events_subsc_req_data_rm_local_var;
}
void OpenAPI_events_subsc_req_data_rm_free(OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm)
{
if (NULL == events_subsc_req_data_rm) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(events_subsc_req_data_rm->events, node) {
OpenAPI_af_event_subscription_free(node->data);
}
OpenAPI_list_free(events_subsc_req_data_rm->events);
ogs_free(events_subsc_req_data_rm->notif_uri);
OpenAPI_list_free(events_subsc_req_data_rm->req_qos_mon_params);
OpenAPI_qos_monitoring_information_rm_free(events_subsc_req_data_rm->qos_mon);
OpenAPI_usage_threshold_rm_free(events_subsc_req_data_rm->usg_thres);
ogs_free(events_subsc_req_data_rm->notif_corre_id);
ogs_free(events_subsc_req_data_rm);
}
cJSON *OpenAPI_events_subsc_req_data_rm_convertToJSON(OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm)
{
cJSON *item = NULL;
if (events_subsc_req_data_rm == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [EventsSubscReqDataRm]");
return NULL;
}
item = cJSON_CreateObject();
cJSON *eventsList = cJSON_AddArrayToObject(item, "events");
if (eventsList == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [events]");
goto end;
}
OpenAPI_lnode_t *events_node;
if (events_subsc_req_data_rm->events) {
OpenAPI_list_for_each(events_subsc_req_data_rm->events, events_node) {
cJSON *itemLocal = OpenAPI_af_event_subscription_convertToJSON(events_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [events]");
goto end;
}
cJSON_AddItemToArray(eventsList, itemLocal);
}
}
if (events_subsc_req_data_rm->notif_uri) {
if (cJSON_AddStringToObject(item, "notifUri", events_subsc_req_data_rm->notif_uri) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [notif_uri]");
goto end;
}
}
if (events_subsc_req_data_rm->req_qos_mon_params) {
cJSON *req_qos_mon_params = cJSON_AddArrayToObject(item, "reqQosMonParams");
if (req_qos_mon_params == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
OpenAPI_lnode_t *req_qos_mon_params_node;
OpenAPI_list_for_each(events_subsc_req_data_rm->req_qos_mon_params, req_qos_mon_params_node) {
if (cJSON_AddStringToObject(req_qos_mon_params, "", OpenAPI_requested_qos_monitoring_parameter_ToString((intptr_t)req_qos_mon_params_node->data)) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [req_qos_mon_params]");
goto end;
}
}
}
if (events_subsc_req_data_rm->qos_mon) {
cJSON *qos_mon_local_JSON = OpenAPI_qos_monitoring_information_rm_convertToJSON(events_subsc_req_data_rm->qos_mon);
if (qos_mon_local_JSON == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [qos_mon]");
goto end;
}
cJSON_AddItemToObject(item, "qosMon", qos_mon_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [qos_mon]");
goto end;
}
}
if (events_subsc_req_data_rm->req_ani) {
if (cJSON_AddStringToObject(item, "reqAni", OpenAPI_required_access_info_ToString(events_subsc_req_data_rm->req_ani)) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [req_ani]");
goto end;
}
}
if (events_subsc_req_data_rm->usg_thres) {
cJSON *usg_thres_local_JSON = OpenAPI_usage_threshold_rm_convertToJSON(events_subsc_req_data_rm->usg_thres);
if (usg_thres_local_JSON == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [usg_thres]");
goto end;
}
cJSON_AddItemToObject(item, "usgThres", usg_thres_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [usg_thres]");
goto end;
}
}
if (events_subsc_req_data_rm->notif_corre_id) {
if (cJSON_AddStringToObject(item, "notifCorreId", events_subsc_req_data_rm->notif_corre_id) == NULL) {
ogs_error("OpenAPI_events_subsc_req_data_rm_convertToJSON() failed [notif_corre_id]");
goto end;
}
}
end:
return item;
}
OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_parseFromJSON(cJSON *events_subsc_req_data_rmJSON)
{
OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm_local_var = NULL;
cJSON *events = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "events");
if (!events) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [events]");
goto end;
}
OpenAPI_list_t *eventsList;
cJSON *events_local_nonprimitive;
if (!cJSON_IsArray(events)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [events]");
goto end;
}
eventsList = OpenAPI_list_create();
cJSON_ArrayForEach(events_local_nonprimitive, events ) {
if (!cJSON_IsObject(events_local_nonprimitive)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [events]");
goto end;
}
OpenAPI_af_event_subscription_t *eventsItem = OpenAPI_af_event_subscription_parseFromJSON(events_local_nonprimitive);
OpenAPI_list_add(eventsList, eventsItem);
}
cJSON *notif_uri = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "notifUri");
if (notif_uri) {
if (!cJSON_IsString(notif_uri)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [notif_uri]");
goto end;
}
}
cJSON *req_qos_mon_params = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "reqQosMonParams");
OpenAPI_list_t *req_qos_mon_paramsList;
if (req_qos_mon_params) {
cJSON *req_qos_mon_params_local_nonprimitive;
if (!cJSON_IsArray(req_qos_mon_params)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [req_qos_mon_params]");
goto end;
}
req_qos_mon_paramsList = OpenAPI_list_create();
cJSON_ArrayForEach(req_qos_mon_params_local_nonprimitive, req_qos_mon_params ) {
if (!cJSON_IsString(req_qos_mon_params_local_nonprimitive)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [req_qos_mon_params]");
goto end;
}
OpenAPI_list_add(req_qos_mon_paramsList, (void *)OpenAPI_requested_qos_monitoring_parameter_FromString(req_qos_mon_params_local_nonprimitive->valuestring));
}
}
cJSON *qos_mon = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "qosMon");
OpenAPI_qos_monitoring_information_rm_t *qos_mon_local_nonprim = NULL;
if (qos_mon) {
qos_mon_local_nonprim = OpenAPI_qos_monitoring_information_rm_parseFromJSON(qos_mon);
}
cJSON *req_ani = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "reqAni");
OpenAPI_required_access_info_e req_aniVariable;
if (req_ani) {
if (!cJSON_IsString(req_ani)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [req_ani]");
goto end;
}
req_aniVariable = OpenAPI_required_access_info_FromString(req_ani->valuestring);
}
cJSON *usg_thres = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "usgThres");
OpenAPI_usage_threshold_rm_t *usg_thres_local_nonprim = NULL;
if (usg_thres) {
usg_thres_local_nonprim = OpenAPI_usage_threshold_rm_parseFromJSON(usg_thres);
}
cJSON *notif_corre_id = cJSON_GetObjectItemCaseSensitive(events_subsc_req_data_rmJSON, "notifCorreId");
if (notif_corre_id) {
if (!cJSON_IsString(notif_corre_id)) {
ogs_error("OpenAPI_events_subsc_req_data_rm_parseFromJSON() failed [notif_corre_id]");
goto end;
}
}
events_subsc_req_data_rm_local_var = OpenAPI_events_subsc_req_data_rm_create (
eventsList,
notif_uri ? ogs_strdup(notif_uri->valuestring) : NULL,
req_qos_mon_params ? req_qos_mon_paramsList : NULL,
qos_mon ? qos_mon_local_nonprim : NULL,
req_ani ? req_aniVariable : 0,
usg_thres ? usg_thres_local_nonprim : NULL,
notif_corre_id ? ogs_strdup(notif_corre_id->valuestring) : NULL
);
return events_subsc_req_data_rm_local_var;
end:
return NULL;
}
OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_copy(OpenAPI_events_subsc_req_data_rm_t *dst, OpenAPI_events_subsc_req_data_rm_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_events_subsc_req_data_rm_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_events_subsc_req_data_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_events_subsc_req_data_rm_free(dst);
dst = OpenAPI_events_subsc_req_data_rm_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,55 @@
/*
* events_subsc_req_data_rm.h
*
* this data type is defined in the same way as the EventsSubscReqData data type, but with the OpenAPI nullable property set to true.
*/
#ifndef _OpenAPI_events_subsc_req_data_rm_H_
#define _OpenAPI_events_subsc_req_data_rm_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "af_event_subscription.h"
#include "qos_monitoring_information_rm.h"
#include "requested_qos_monitoring_parameter.h"
#include "required_access_info.h"
#include "usage_threshold_rm.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_events_subsc_req_data_rm_s OpenAPI_events_subsc_req_data_rm_t;
typedef struct OpenAPI_events_subsc_req_data_rm_s {
OpenAPI_list_t *events;
char *notif_uri;
OpenAPI_list_t *req_qos_mon_params;
struct OpenAPI_qos_monitoring_information_rm_s *qos_mon;
OpenAPI_required_access_info_e req_ani;
struct OpenAPI_usage_threshold_rm_s *usg_thres;
char *notif_corre_id;
} OpenAPI_events_subsc_req_data_rm_t;
OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_create(
OpenAPI_list_t *events,
char *notif_uri,
OpenAPI_list_t *req_qos_mon_params,
OpenAPI_qos_monitoring_information_rm_t *qos_mon,
OpenAPI_required_access_info_e req_ani,
OpenAPI_usage_threshold_rm_t *usg_thres,
char *notif_corre_id
);
void OpenAPI_events_subsc_req_data_rm_free(OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm);
OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_parseFromJSON(cJSON *events_subsc_req_data_rmJSON);
cJSON *OpenAPI_events_subsc_req_data_rm_convertToJSON(OpenAPI_events_subsc_req_data_rm_t *events_subsc_req_data_rm);
OpenAPI_events_subsc_req_data_rm_t *OpenAPI_events_subsc_req_data_rm_copy(OpenAPI_events_subsc_req_data_rm_t *dst, OpenAPI_events_subsc_req_data_rm_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_events_subsc_req_data_rm_H_ */

View File

@ -0,0 +1,318 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "extended_problem_details.h"
OpenAPI_extended_problem_details_t *OpenAPI_extended_problem_details_create(
char *type,
char *title,
int status,
char *detail,
char *instance,
char *cause,
OpenAPI_list_t *invalid_params,
char *supported_features,
char *target_scp,
OpenAPI_acceptable_service_info_t *acceptable_serv_info
)
{
OpenAPI_extended_problem_details_t *extended_problem_details_local_var = OpenAPI_malloc(sizeof(OpenAPI_extended_problem_details_t));
if (!extended_problem_details_local_var) {
return NULL;
}
extended_problem_details_local_var->type = type;
extended_problem_details_local_var->title = title;
extended_problem_details_local_var->status = status;
extended_problem_details_local_var->detail = detail;
extended_problem_details_local_var->instance = instance;
extended_problem_details_local_var->cause = cause;
extended_problem_details_local_var->invalid_params = invalid_params;
extended_problem_details_local_var->supported_features = supported_features;
extended_problem_details_local_var->target_scp = target_scp;
extended_problem_details_local_var->acceptable_serv_info = acceptable_serv_info;
return extended_problem_details_local_var;
}
void OpenAPI_extended_problem_details_free(OpenAPI_extended_problem_details_t *extended_problem_details)
{
if (NULL == extended_problem_details) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(extended_problem_details->type);
ogs_free(extended_problem_details->title);
ogs_free(extended_problem_details->detail);
ogs_free(extended_problem_details->instance);
ogs_free(extended_problem_details->cause);
OpenAPI_list_for_each(extended_problem_details->invalid_params, node) {
OpenAPI_invalid_param_free(node->data);
}
OpenAPI_list_free(extended_problem_details->invalid_params);
ogs_free(extended_problem_details->supported_features);
ogs_free(extended_problem_details->target_scp);
OpenAPI_acceptable_service_info_free(extended_problem_details->acceptable_serv_info);
ogs_free(extended_problem_details);
}
cJSON *OpenAPI_extended_problem_details_convertToJSON(OpenAPI_extended_problem_details_t *extended_problem_details)
{
cJSON *item = NULL;
if (extended_problem_details == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [ExtendedProblemDetails]");
return NULL;
}
item = cJSON_CreateObject();
if (extended_problem_details->type) {
if (cJSON_AddStringToObject(item, "type", extended_problem_details->type) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [type]");
goto end;
}
}
if (extended_problem_details->title) {
if (cJSON_AddStringToObject(item, "title", extended_problem_details->title) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [title]");
goto end;
}
}
if (extended_problem_details->status) {
if (cJSON_AddNumberToObject(item, "status", extended_problem_details->status) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [status]");
goto end;
}
}
if (extended_problem_details->detail) {
if (cJSON_AddStringToObject(item, "detail", extended_problem_details->detail) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [detail]");
goto end;
}
}
if (extended_problem_details->instance) {
if (cJSON_AddStringToObject(item, "instance", extended_problem_details->instance) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [instance]");
goto end;
}
}
if (extended_problem_details->cause) {
if (cJSON_AddStringToObject(item, "cause", extended_problem_details->cause) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [cause]");
goto end;
}
}
if (extended_problem_details->invalid_params) {
cJSON *invalid_paramsList = cJSON_AddArrayToObject(item, "invalidParams");
if (invalid_paramsList == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [invalid_params]");
goto end;
}
OpenAPI_lnode_t *invalid_params_node;
if (extended_problem_details->invalid_params) {
OpenAPI_list_for_each(extended_problem_details->invalid_params, invalid_params_node) {
cJSON *itemLocal = OpenAPI_invalid_param_convertToJSON(invalid_params_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [invalid_params]");
goto end;
}
cJSON_AddItemToArray(invalid_paramsList, itemLocal);
}
}
}
if (extended_problem_details->supported_features) {
if (cJSON_AddStringToObject(item, "supportedFeatures", extended_problem_details->supported_features) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [supported_features]");
goto end;
}
}
if (extended_problem_details->target_scp) {
if (cJSON_AddStringToObject(item, "targetScp", extended_problem_details->target_scp) == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [target_scp]");
goto end;
}
}
if (extended_problem_details->acceptable_serv_info) {
cJSON *acceptable_serv_info_local_JSON = OpenAPI_acceptable_service_info_convertToJSON(extended_problem_details->acceptable_serv_info);
if (acceptable_serv_info_local_JSON == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [acceptable_serv_info]");
goto end;
}
cJSON_AddItemToObject(item, "acceptableServInfo", acceptable_serv_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_extended_problem_details_convertToJSON() failed [acceptable_serv_info]");
goto end;
}
}
end:
return item;
}
OpenAPI_extended_problem_details_t *OpenAPI_extended_problem_details_parseFromJSON(cJSON *extended_problem_detailsJSON)
{
OpenAPI_extended_problem_details_t *extended_problem_details_local_var = NULL;
cJSON *type = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "type");
if (type) {
if (!cJSON_IsString(type)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [type]");
goto end;
}
}
cJSON *title = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "title");
if (title) {
if (!cJSON_IsString(title)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [title]");
goto end;
}
}
cJSON *status = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "status");
if (status) {
if (!cJSON_IsNumber(status)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [status]");
goto end;
}
}
cJSON *detail = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "detail");
if (detail) {
if (!cJSON_IsString(detail)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [detail]");
goto end;
}
}
cJSON *instance = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "instance");
if (instance) {
if (!cJSON_IsString(instance)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [instance]");
goto end;
}
}
cJSON *cause = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "cause");
if (cause) {
if (!cJSON_IsString(cause)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [cause]");
goto end;
}
}
cJSON *invalid_params = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "invalidParams");
OpenAPI_list_t *invalid_paramsList;
if (invalid_params) {
cJSON *invalid_params_local_nonprimitive;
if (!cJSON_IsArray(invalid_params)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [invalid_params]");
goto end;
}
invalid_paramsList = OpenAPI_list_create();
cJSON_ArrayForEach(invalid_params_local_nonprimitive, invalid_params ) {
if (!cJSON_IsObject(invalid_params_local_nonprimitive)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [invalid_params]");
goto end;
}
OpenAPI_invalid_param_t *invalid_paramsItem = OpenAPI_invalid_param_parseFromJSON(invalid_params_local_nonprimitive);
OpenAPI_list_add(invalid_paramsList, invalid_paramsItem);
}
}
cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "supportedFeatures");
if (supported_features) {
if (!cJSON_IsString(supported_features)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [supported_features]");
goto end;
}
}
cJSON *target_scp = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "targetScp");
if (target_scp) {
if (!cJSON_IsString(target_scp)) {
ogs_error("OpenAPI_extended_problem_details_parseFromJSON() failed [target_scp]");
goto end;
}
}
cJSON *acceptable_serv_info = cJSON_GetObjectItemCaseSensitive(extended_problem_detailsJSON, "acceptableServInfo");
OpenAPI_acceptable_service_info_t *acceptable_serv_info_local_nonprim = NULL;
if (acceptable_serv_info) {
acceptable_serv_info_local_nonprim = OpenAPI_acceptable_service_info_parseFromJSON(acceptable_serv_info);
}
extended_problem_details_local_var = OpenAPI_extended_problem_details_create (
type ? ogs_strdup(type->valuestring) : NULL,
title ? ogs_strdup(title->valuestring) : NULL,
status ? status->valuedouble : 0,
detail ? ogs_strdup(detail->valuestring) : NULL,
instance ? ogs_strdup(instance->valuestring) : NULL,
cause ? ogs_strdup(cause->valuestring) : NULL,
invalid_params ? invalid_paramsList : NULL,
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
target_scp ? ogs_strdup(target_scp->valuestring) : NULL,
acceptable_serv_info ? acceptable_serv_info_local_nonprim : NULL
);
return extended_problem_details_local_var;
end:
return NULL;
}
OpenAPI_extended_problem_details_t *OpenAPI_extended_problem_details_copy(OpenAPI_extended_problem_details_t *dst, OpenAPI_extended_problem_details_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_extended_problem_details_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_extended_problem_details_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_extended_problem_details_free(dst);
dst = OpenAPI_extended_problem_details_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,60 @@
/*
* extended_problem_details.h
*
* Extends ProblemDetails to also include the acceptable service info.
*/
#ifndef _OpenAPI_extended_problem_details_H_
#define _OpenAPI_extended_problem_details_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "acceptable_service_info.h"
#include "extended_problem_details_all_of.h"
#include "invalid_param.h"
#include "problem_details.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_extended_problem_details_s OpenAPI_extended_problem_details_t;
typedef struct OpenAPI_extended_problem_details_s {
char *type;
char *title;
int status;
char *detail;
char *instance;
char *cause;
OpenAPI_list_t *invalid_params;
char *supported_features;
char *target_scp;
struct OpenAPI_acceptable_service_info_s *acceptable_serv_info;
} OpenAPI_extended_problem_details_t;
OpenAPI_extended_problem_details_t *OpenAPI_extended_problem_details_create(
char *type,
char *title,
int status,
char *detail,
char *instance,
char *cause,
OpenAPI_list_t *invalid_params,
char *supported_features,
char *target_scp,
OpenAPI_acceptable_service_info_t *acceptable_serv_info
);
void OpenAPI_extended_problem_details_free(OpenAPI_extended_problem_details_t *extended_problem_details);
OpenAPI_extended_problem_details_t *OpenAPI_extended_problem_details_parseFromJSON(cJSON *extended_problem_detailsJSON);
cJSON *OpenAPI_extended_problem_details_convertToJSON(OpenAPI_extended_problem_details_t *extended_problem_details);
OpenAPI_extended_problem_details_t *OpenAPI_extended_problem_details_copy(OpenAPI_extended_problem_details_t *dst, OpenAPI_extended_problem_details_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_extended_problem_details_H_ */

View File

@ -0,0 +1,109 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "extended_problem_details_all_of.h"
OpenAPI_extended_problem_details_all_of_t *OpenAPI_extended_problem_details_all_of_create(
OpenAPI_acceptable_service_info_t *acceptable_serv_info
)
{
OpenAPI_extended_problem_details_all_of_t *extended_problem_details_all_of_local_var = OpenAPI_malloc(sizeof(OpenAPI_extended_problem_details_all_of_t));
if (!extended_problem_details_all_of_local_var) {
return NULL;
}
extended_problem_details_all_of_local_var->acceptable_serv_info = acceptable_serv_info;
return extended_problem_details_all_of_local_var;
}
void OpenAPI_extended_problem_details_all_of_free(OpenAPI_extended_problem_details_all_of_t *extended_problem_details_all_of)
{
if (NULL == extended_problem_details_all_of) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_acceptable_service_info_free(extended_problem_details_all_of->acceptable_serv_info);
ogs_free(extended_problem_details_all_of);
}
cJSON *OpenAPI_extended_problem_details_all_of_convertToJSON(OpenAPI_extended_problem_details_all_of_t *extended_problem_details_all_of)
{
cJSON *item = NULL;
if (extended_problem_details_all_of == NULL) {
ogs_error("OpenAPI_extended_problem_details_all_of_convertToJSON() failed [ExtendedProblemDetails_allOf]");
return NULL;
}
item = cJSON_CreateObject();
if (extended_problem_details_all_of->acceptable_serv_info) {
cJSON *acceptable_serv_info_local_JSON = OpenAPI_acceptable_service_info_convertToJSON(extended_problem_details_all_of->acceptable_serv_info);
if (acceptable_serv_info_local_JSON == NULL) {
ogs_error("OpenAPI_extended_problem_details_all_of_convertToJSON() failed [acceptable_serv_info]");
goto end;
}
cJSON_AddItemToObject(item, "acceptableServInfo", acceptable_serv_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_extended_problem_details_all_of_convertToJSON() failed [acceptable_serv_info]");
goto end;
}
}
end:
return item;
}
OpenAPI_extended_problem_details_all_of_t *OpenAPI_extended_problem_details_all_of_parseFromJSON(cJSON *extended_problem_details_all_ofJSON)
{
OpenAPI_extended_problem_details_all_of_t *extended_problem_details_all_of_local_var = NULL;
cJSON *acceptable_serv_info = cJSON_GetObjectItemCaseSensitive(extended_problem_details_all_ofJSON, "acceptableServInfo");
OpenAPI_acceptable_service_info_t *acceptable_serv_info_local_nonprim = NULL;
if (acceptable_serv_info) {
acceptable_serv_info_local_nonprim = OpenAPI_acceptable_service_info_parseFromJSON(acceptable_serv_info);
}
extended_problem_details_all_of_local_var = OpenAPI_extended_problem_details_all_of_create (
acceptable_serv_info ? acceptable_serv_info_local_nonprim : NULL
);
return extended_problem_details_all_of_local_var;
end:
return NULL;
}
OpenAPI_extended_problem_details_all_of_t *OpenAPI_extended_problem_details_all_of_copy(OpenAPI_extended_problem_details_all_of_t *dst, OpenAPI_extended_problem_details_all_of_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_extended_problem_details_all_of_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_extended_problem_details_all_of_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_extended_problem_details_all_of_free(dst);
dst = OpenAPI_extended_problem_details_all_of_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,39 @@
/*
* extended_problem_details_all_of.h
*
*
*/
#ifndef _OpenAPI_extended_problem_details_all_of_H_
#define _OpenAPI_extended_problem_details_all_of_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "acceptable_service_info.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_extended_problem_details_all_of_s OpenAPI_extended_problem_details_all_of_t;
typedef struct OpenAPI_extended_problem_details_all_of_s {
struct OpenAPI_acceptable_service_info_s *acceptable_serv_info;
} OpenAPI_extended_problem_details_all_of_t;
OpenAPI_extended_problem_details_all_of_t *OpenAPI_extended_problem_details_all_of_create(
OpenAPI_acceptable_service_info_t *acceptable_serv_info
);
void OpenAPI_extended_problem_details_all_of_free(OpenAPI_extended_problem_details_all_of_t *extended_problem_details_all_of);
OpenAPI_extended_problem_details_all_of_t *OpenAPI_extended_problem_details_all_of_parseFromJSON(cJSON *extended_problem_details_all_ofJSON);
cJSON *OpenAPI_extended_problem_details_all_of_convertToJSON(OpenAPI_extended_problem_details_all_of_t *extended_problem_details_all_of);
OpenAPI_extended_problem_details_all_of_t *OpenAPI_extended_problem_details_all_of_copy(OpenAPI_extended_problem_details_all_of_t *dst, OpenAPI_extended_problem_details_all_of_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_extended_problem_details_all_of_H_ */

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "flow_status.h"
OpenAPI_flow_status_t *OpenAPI_flow_status_create(
)
char* OpenAPI_flow_status_ToString(OpenAPI_flow_status_e flow_status)
{
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;
const char *flow_statusArray[] = { "NULL", "ENABLED_UPLINK", "ENABLED_DOWNLINK", "ENABLED", "DISABLED", "REMOVED" };
size_t sizeofArray = sizeof(flow_statusArray) / sizeof(flow_statusArray[0]);
if (flow_status < sizeofArray)
return (char *)flow_statusArray[flow_status];
else
return (char *)"Unknown";
}
void OpenAPI_flow_status_free(OpenAPI_flow_status_t *flow_status)
OpenAPI_flow_status_e OpenAPI_flow_status_FromString(char* flow_status)
{
if (NULL == flow_status) {
return;
int stringToReturn = 0;
const char *flow_statusArray[] = { "NULL", "ENABLED_UPLINK", "ENABLED_DOWNLINK", "ENABLED", "DISABLED", "REMOVED" };
size_t sizeofArray = sizeof(flow_statusArray) / sizeof(flow_statusArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(flow_status, flow_statusArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
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;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_flow_status_s OpenAPI_flow_status_t;
typedef struct OpenAPI_flow_status_s {
} OpenAPI_flow_status_t;
typedef enum { OpenAPI_flow_status_NULL = 0, OpenAPI_flow_status_ENABLED_UPLINK, OpenAPI_flow_status_ENABLED_DOWNLINK, OpenAPI_flow_status_ENABLED, OpenAPI_flow_status_DISABLED, OpenAPI_flow_status_REMOVED } OpenAPI_flow_status_e;
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);
char* OpenAPI_flow_status_ToString(OpenAPI_flow_status_e flow_status);
OpenAPI_flow_status_e OpenAPI_flow_status_FromString(char* flow_status);
#ifdef __cplusplus
}

View File

@ -0,0 +1,30 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "flow_usage.h"
char* OpenAPI_flow_usage_ToString(OpenAPI_flow_usage_e flow_usage)
{
const char *flow_usageArray[] = { "NULL", "NO_INFO", "RTCP", "AF_SIGNALLING" };
size_t sizeofArray = sizeof(flow_usageArray) / sizeof(flow_usageArray[0]);
if (flow_usage < sizeofArray)
return (char *)flow_usageArray[flow_usage];
else
return (char *)"Unknown";
}
OpenAPI_flow_usage_e OpenAPI_flow_usage_FromString(char* flow_usage)
{
int stringToReturn = 0;
const char *flow_usageArray[] = { "NULL", "NO_INFO", "RTCP", "AF_SIGNALLING" };
size_t sizeofArray = sizeof(flow_usageArray) / sizeof(flow_usageArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(flow_usage, flow_usageArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
return 0;
}

View File

@ -0,0 +1,31 @@
/*
* flow_usage.h
*
*
*/
#ifndef _OpenAPI_flow_usage_H_
#define _OpenAPI_flow_usage_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 enum { OpenAPI_flow_usage_NULL = 0, OpenAPI_flow_usage_NO_INFO, OpenAPI_flow_usage_RTCP, OpenAPI_flow_usage_AF_SIGNALLING } OpenAPI_flow_usage_e;
char* OpenAPI_flow_usage_ToString(OpenAPI_flow_usage_e flow_usage);
OpenAPI_flow_usage_e OpenAPI_flow_usage_FromString(char* flow_usage);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_flow_usage_H_ */

View File

@ -0,0 +1,191 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "flows.h"
OpenAPI_flows_t *OpenAPI_flows_create(
OpenAPI_list_t *cont_vers,
OpenAPI_list_t *f_nums,
int med_comp_n
)
{
OpenAPI_flows_t *flows_local_var = OpenAPI_malloc(sizeof(OpenAPI_flows_t));
if (!flows_local_var) {
return NULL;
}
flows_local_var->cont_vers = cont_vers;
flows_local_var->f_nums = f_nums;
flows_local_var->med_comp_n = med_comp_n;
return flows_local_var;
}
void OpenAPI_flows_free(OpenAPI_flows_t *flows)
{
if (NULL == flows) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(flows->cont_vers, node) {
ogs_free(node->data);
}
OpenAPI_list_free(flows->cont_vers);
OpenAPI_list_for_each(flows->f_nums, node) {
ogs_free(node->data);
}
OpenAPI_list_free(flows->f_nums);
ogs_free(flows);
}
cJSON *OpenAPI_flows_convertToJSON(OpenAPI_flows_t *flows)
{
cJSON *item = NULL;
if (flows == NULL) {
ogs_error("OpenAPI_flows_convertToJSON() failed [Flows]");
return NULL;
}
item = cJSON_CreateObject();
if (flows->cont_vers) {
cJSON *cont_vers = cJSON_AddArrayToObject(item, "contVers");
if (cont_vers == NULL) {
ogs_error("OpenAPI_flows_convertToJSON() failed [cont_vers]");
goto end;
}
OpenAPI_lnode_t *cont_vers_node;
OpenAPI_list_for_each(flows->cont_vers, cont_vers_node) {
if (cJSON_AddNumberToObject(cont_vers, "", *(double *)cont_vers_node->data) == NULL) {
ogs_error("OpenAPI_flows_convertToJSON() failed [cont_vers]");
goto end;
}
}
}
if (flows->f_nums) {
cJSON *f_nums = cJSON_AddArrayToObject(item, "fNums");
if (f_nums == NULL) {
ogs_error("OpenAPI_flows_convertToJSON() failed [f_nums]");
goto end;
}
OpenAPI_lnode_t *f_nums_node;
OpenAPI_list_for_each(flows->f_nums, f_nums_node) {
if (cJSON_AddNumberToObject(f_nums, "", *(double *)f_nums_node->data) == NULL) {
ogs_error("OpenAPI_flows_convertToJSON() failed [f_nums]");
goto end;
}
}
}
if (cJSON_AddNumberToObject(item, "medCompN", flows->med_comp_n) == NULL) {
ogs_error("OpenAPI_flows_convertToJSON() failed [med_comp_n]");
goto end;
}
end:
return item;
}
OpenAPI_flows_t *OpenAPI_flows_parseFromJSON(cJSON *flowsJSON)
{
OpenAPI_flows_t *flows_local_var = NULL;
cJSON *cont_vers = cJSON_GetObjectItemCaseSensitive(flowsJSON, "contVers");
OpenAPI_list_t *cont_versList;
if (cont_vers) {
cJSON *cont_vers_local;
if (!cJSON_IsArray(cont_vers)) {
ogs_error("OpenAPI_flows_parseFromJSON() failed [cont_vers]");
goto end;
}
cont_versList = OpenAPI_list_create();
cJSON_ArrayForEach(cont_vers_local, cont_vers) {
if (!cJSON_IsNumber(cont_vers_local)) {
ogs_error("OpenAPI_flows_parseFromJSON() failed [cont_vers]");
goto end;
}
OpenAPI_list_add(cont_versList, &cont_vers_local->valuedouble);
}
}
cJSON *f_nums = cJSON_GetObjectItemCaseSensitive(flowsJSON, "fNums");
OpenAPI_list_t *f_numsList;
if (f_nums) {
cJSON *f_nums_local;
if (!cJSON_IsArray(f_nums)) {
ogs_error("OpenAPI_flows_parseFromJSON() failed [f_nums]");
goto end;
}
f_numsList = OpenAPI_list_create();
cJSON_ArrayForEach(f_nums_local, f_nums) {
if (!cJSON_IsNumber(f_nums_local)) {
ogs_error("OpenAPI_flows_parseFromJSON() failed [f_nums]");
goto end;
}
OpenAPI_list_add(f_numsList, &f_nums_local->valuedouble);
}
}
cJSON *med_comp_n = cJSON_GetObjectItemCaseSensitive(flowsJSON, "medCompN");
if (!med_comp_n) {
ogs_error("OpenAPI_flows_parseFromJSON() failed [med_comp_n]");
goto end;
}
if (!cJSON_IsNumber(med_comp_n)) {
ogs_error("OpenAPI_flows_parseFromJSON() failed [med_comp_n]");
goto end;
}
flows_local_var = OpenAPI_flows_create (
cont_vers ? cont_versList : NULL,
f_nums ? f_numsList : NULL,
med_comp_n->valuedouble
);
return flows_local_var;
end:
return NULL;
}
OpenAPI_flows_t *OpenAPI_flows_copy(OpenAPI_flows_t *dst, OpenAPI_flows_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_flows_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_flows_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_flows_free(dst);
dst = OpenAPI_flows_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,42 @@
/*
* flows.h
*
* Identifies the flows
*/
#ifndef _OpenAPI_flows_H_
#define _OpenAPI_flows_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_flows_s OpenAPI_flows_t;
typedef struct OpenAPI_flows_s {
OpenAPI_list_t *cont_vers;
OpenAPI_list_t *f_nums;
int med_comp_n;
} OpenAPI_flows_t;
OpenAPI_flows_t *OpenAPI_flows_create(
OpenAPI_list_t *cont_vers,
OpenAPI_list_t *f_nums,
int med_comp_n
);
void OpenAPI_flows_free(OpenAPI_flows_t *flows);
OpenAPI_flows_t *OpenAPI_flows_parseFromJSON(cJSON *flowsJSON);
cJSON *OpenAPI_flows_convertToJSON(OpenAPI_flows_t *flows);
OpenAPI_flows_t *OpenAPI_flows_copy(OpenAPI_flows_t *dst, OpenAPI_flows_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_flows_H_ */

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "ims_vo_ps.h"
OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_create(
)
char* OpenAPI_ims_vo_ps_ToString(OpenAPI_ims_vo_ps_e ims_vo_ps)
{
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_var = OpenAPI_malloc(sizeof(OpenAPI_ims_vo_ps_t));
if (!ims_vo_ps_local_var) {
return NULL;
}
return ims_vo_ps_local_var;
const char *ims_vo_psArray[] = { "NULL", "HOMOGENEOUS_SUPPORT", "HOMOGENEOUS_NON_SUPPORT", "NON_HOMOGENEOUS_OR_UNKNOWN" };
size_t sizeofArray = sizeof(ims_vo_psArray) / sizeof(ims_vo_psArray[0]);
if (ims_vo_ps < sizeofArray)
return (char *)ims_vo_psArray[ims_vo_ps];
else
return (char *)"Unknown";
}
void OpenAPI_ims_vo_ps_free(OpenAPI_ims_vo_ps_t *ims_vo_ps)
OpenAPI_ims_vo_ps_e OpenAPI_ims_vo_ps_FromString(char* ims_vo_ps)
{
if (NULL == ims_vo_ps) {
return;
int stringToReturn = 0;
const char *ims_vo_psArray[] = { "NULL", "HOMOGENEOUS_SUPPORT", "HOMOGENEOUS_NON_SUPPORT", "NON_HOMOGENEOUS_OR_UNKNOWN" };
size_t sizeofArray = sizeof(ims_vo_psArray) / sizeof(ims_vo_psArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(ims_vo_ps, ims_vo_psArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(ims_vo_ps);
}
cJSON *OpenAPI_ims_vo_ps_convertToJSON(OpenAPI_ims_vo_ps_t *ims_vo_ps)
{
cJSON *item = NULL;
if (ims_vo_ps == NULL) {
ogs_error("OpenAPI_ims_vo_ps_convertToJSON() failed [ImsVoPs]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_parseFromJSON(cJSON *ims_vo_psJSON)
{
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_var = NULL;
ims_vo_ps_local_var = OpenAPI_ims_vo_ps_create (
);
return ims_vo_ps_local_var;
end:
return NULL;
}
OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_copy(OpenAPI_ims_vo_ps_t *dst, OpenAPI_ims_vo_ps_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_ims_vo_ps_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_ims_vo_ps_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_ims_vo_ps_free(dst);
dst = OpenAPI_ims_vo_ps_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_ims_vo_ps_s OpenAPI_ims_vo_ps_t;
typedef struct OpenAPI_ims_vo_ps_s {
} OpenAPI_ims_vo_ps_t;
typedef enum { OpenAPI_ims_vo_ps_NULL = 0, OpenAPI_ims_vo_ps_HOMOGENEOUS_SUPPORT, OpenAPI_ims_vo_ps_HOMOGENEOUS_NON_SUPPORT, OpenAPI_ims_vo_ps_NON_HOMOGENEOUS_OR_UNKNOWN } OpenAPI_ims_vo_ps_e;
OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_create(
);
void OpenAPI_ims_vo_ps_free(OpenAPI_ims_vo_ps_t *ims_vo_ps);
OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_parseFromJSON(cJSON *ims_vo_psJSON);
cJSON *OpenAPI_ims_vo_ps_convertToJSON(OpenAPI_ims_vo_ps_t *ims_vo_ps);
OpenAPI_ims_vo_ps_t *OpenAPI_ims_vo_ps_copy(OpenAPI_ims_vo_ps_t *dst, OpenAPI_ims_vo_ps_t *src);
char* OpenAPI_ims_vo_ps_ToString(OpenAPI_ims_vo_ps_e ims_vo_ps);
OpenAPI_ims_vo_ps_e OpenAPI_ims_vo_ps_FromString(char* ims_vo_ps);
#ifdef __cplusplus
}

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