arch: DB schema Changes (#796)

- New function : NSSF
- New feature : SMF selection
This commit is contained in:
Sukchan Lee 2021-03-08 21:25:09 +09:00
parent c6bfbed922
commit 9af4268bab
691 changed files with 40727 additions and 18985 deletions

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -139,7 +140,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -200,6 +201,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -106,7 +107,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -173,7 +174,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -234,6 +235,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@ -39,7 +39,7 @@ example_conf = '''
csfb.yaml
volte.yaml
vonr.yaml
minimal.yaml
slice.yaml
srslte.yaml
sample.yaml
'''.split()

View File

@ -143,7 +143,7 @@ logger:
# mnc: 70
# s_nssai:
# - sst: 1
# - sd: 010000
# sd: 010000
# - plmn_id:
# mcc: 901
# mnc: 70

View File

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

View File

@ -0,0 +1,187 @@
#
# 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,nssf,event,tlv,mem,sock
#
logger:
file: @localstatedir@/log/open5gs/nssf.log
#
# nssf:
#
# <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: nssf.key
# pem: nssf.pem
#
# o SBI Server(https://127.0.0.14:443, http://[::1]:80)
# sbi:
# - addr: 127.0.0.14
# tls:
# key: nssf.key
# pem: nssf.pem
# - addr: ::1
#
# o SBI Server(http://nssf.open5gs.org:80)
# sbi:
# name: nssf.open5gs.org
#
# o SBI Server(http://127.0.0.14:7777)
# sbi:
# - addr: 127.0.0.14
# port: 7777
#
# o SBI Server(http://<eth0 IP address>:80)
# sbi:
# dev: eth0
#
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
#
# nrf:
#
# <SBI Client>>
#
# o SBI Client(http://127.0.0.10:7777)
# sbi:
# addr: 127.0.0.10
# port: 7777
#
# o SBI Client(https://127.0.0.10:443, http://nrf.open5gs.org:80)
# sbi:
# - addr: 127.0.0.10
# tls:
# key: nrf.key
# pem: nrf.pem
# - name: nrf.open5gs.org
#
# o SBI Client(http://[fe80::1%@loopback_devname@]:80)
# If prefer_ipv4 is true, http://127.0.0.10:80 is selected.
#
# sbi:
# addr:
# - 127.0.0.10
# - fe80::1%@loopback_devname@
#
nrf:
sbi:
- addr:
- 127.0.0.10
- ::1
port: 7777
#
# parameter:
#
# o Number of output streams per SCTP associations.
# sctp_streams: 30
#
# o Disable use of IPv4 addresses (only IPv6)
# no_ipv4: true
#
# o Disable use of IPv6 addresses (only IPv4)
# no_ipv6: true
#
# o Prefer IPv4 instead of IPv6 for estabishing new GTP connections.
# prefer_ipv4: true
#
# o Enable Multicast traffic to the UE
# multicast: true
#
# o Disable Stateless Address Autoconfiguration for IPv6
# no_slaac: true
#
parameter:
#
# max:
#
# o Maximum Number of UE per AMF/MME
# ue: 1024
# o Maximum Number of gNB/eNB per AMF/MME
# gnb: 32
#
max:
#
# pool:
#
# o The 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 NF Instance Heartbeat (Disabled)
# nf_instance:
# heartbeat: 0
#
# o NF Instance Heartbeat (10 seconds)
# nf_instance:
# heartbeat: 10
#
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
#
# o Message Wait Duration (3000 ms)
# message:
# duration: 3000
time:

View File

@ -83,61 +83,48 @@ logger:
# - addr: 127.0.0.4
# - addr: fe80::3%@loopback_devname@
#
# <PDN Configuration with UE Pool>
# <Subnet for UE Pool>
#
# o IPv4 Pool
# pdn:
# subnet:
# addr: 10.45.0.1/16
#
# o IPv4/IPv6 Pool
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# - addr: cafe:1::1/64
#
#
# o Specific DNN/APN(e.g 'ims') uses 10.46.0.1/16, cafe:2::1/64
# pdn:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
# dnn: internet
# - addr: 10.46.0.1/16
# dnn: ims
# - addr: cafe:2::1/64
# dnn: ims
#
# o Multiple Devices (default: ogstun)
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
# dnn: internet
# dev: ogstun2
# - addr: 10.46.0.1/16
# dnn: ims
# dev: ogstun3
# - addr: cafe:2::1/64
# dnn: ims
# dev: ogstun3
#
# o Pool Range Sample
# pdn:
# subnet:
# - addr: 10.45.0.1/24
# range: 10.45.0.100-10.45.0.200
#
# pdn:
# subnet:
# - addr: 10.45.0.1/24
# range:
# - 10.45.0.5-10.45.0.50
# - 10.45.0.100-
#
# pdn:
# subnet:
# - addr: 10.45.0.1/24
# range:
# - -10.45.0.200
# - 10.45.0.210-10.45.0.220
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# range:
# - 10.45.0.100-10.45.0.200
@ -151,6 +138,12 @@ logger:
#
# o Primary/Secondary can be configured. Others are ignored.
#
# dns:
# - 8.8.8.8
# - 8.8.4.4
# - 2001:4860:4860::8888
# - 2001:4860:4860::8844
#
# <MTU Size>
#
# o Provisioning a limit on the size of the packets sent by the MS
@ -167,6 +160,136 @@ logger:
# - 127.0.0.1
# - ::1
#
# <SMF Selection - 5G Core only>
# 1. SMF sends SmfInfo(S-NSSAI, DNN, TAI) to the NRF
# 2. NRF responds to AMF with SmfInfo during NF-Discovery.
# 3. AMF selects SMF based on S-NSSAI, DNN and TAI in SmfInfo.
#
# Note that if there is no SmfInfo, any AMF can select this SMF.
#
# o S-NSSAI[SST:1] and DNN[internet] - At least 1 DNN is required in S-NSSAI
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
#
# o S-NSSAI[SST:1 SD:009000] and DNN[internet or ims]
# info:
# - s_nssai:
# - sst: 1
# sd: 009000
# dnn:
# - internet
# - ims
#
# o S-NSSAI[SST:1] and DNN[internet] and TAI[PLMN-ID:90170 TAC:1]
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: 1
#
# o If any of conditions below are met:
# - S-NSSAI[SST:1] and DNN[internet] and TAI[PLMN-ID:90170 TAC:1-9]
# - S-NSSAI[SST:2 SD:000080] and DNN[internet or ims]
# - S-NSSAI[SST:4] and DNN[internet] and TAI[PLMN-ID:90170 TAC:10-20,30-40]
#
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 1-9
# - s_nssai:
# - sst: 2
# sd: 000080
# dnn:
# - internet
# - ims
# - s_nssai:
# - sst: 4
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 10-20
# - 30-40
#
# o Complex Example
# info:
# - s_nssai:
# - sst: 1
# dnn:
# - internet
# - sst: 1
# sd: 000080
# dnn:
# - internet
# - ims
# - sst: 1
# sd: 009000
# dnn:
# [internet, ims]
# - sst: 2
# dnn:
# - internet
# - sst: 3
# sd: 123456
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: [1, 2, 3]
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: 4
# - plmn_id:
# mcc: 901
# mnc: 70
# tac:
# - 5
# - 6
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 100-200
# - 300-400
# - plmn_id:
# mcc: 901
# mnc: 70
# range:
# - 500-600
# - 700-800
# - 900-1000
# - s_nssai:
# - sst: 4
# dnn:
# - internet
# tai:
# - plmn_id:
# mcc: 901
# mnc: 70
# tac: 99
#
smf:
sbi:
- addr: 127.0.0.4
@ -177,7 +300,7 @@ smf:
pfcp:
- addr: 127.0.0.4
- addr: ::1
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -231,10 +354,10 @@ nrf:
# pfcp:
# addr: 127.0.0.7
#
# <UPF_SELECTION_MODE - EPC only>
# <UPF Selection>
#
# o Round-Robin
# (note that round robin can be disabled for a particular node
# o Round-Robin
# (note that round robin can be disabled for a particular node
# by setting flag 'rr' to 0)
#
# upf:
@ -244,8 +367,8 @@ nrf:
# rr: 0
# - addr: 127.0.0.19
#
# o UPF selection by eNodeB TAC
# (either single TAC or multiple TACs, DECIMAL representation)
# o UPF selection by eNodeB TAC
# (either single TAC or multiple TACs, DECIMAL representation)
#
# upf:
# pfcp:
@ -254,7 +377,7 @@ nrf:
# - addr: 127.0.0.12
# tac: [3,5,8]
#
# o UPF selection by UE's DNN/APN (either single DNN/APN or multiple DNNs/APNs)
# o UPF selection by UE's DNN/APN (either single DNN/APN or multiple DNNs/APNs)
#
# upf:
# pfcp:
@ -263,8 +386,8 @@ nrf:
# - addr: 127.0.0.12
# dnn: [internet, web]
#
# o UPF selection by CellID(e_cell_id: 28bit, nr_cell_id: 36bit)
# (either single enb_id or multiple enb_ids, HEX representation)
# o UPF selection by CellID(e_cell_id: 28bit, nr_cell_id: 36bit)
# (either single enb_id or multiple enb_ids, HEX representation)
#
# upf:
# pfcp:

View File

@ -81,19 +81,22 @@ logger:
# advertise_name: upf1.5gc.mnc001.mcc001.3gppnetwork.org
#
#
# <PDN Configuration with UE Pool>
# <Subnet for UE network>
#
# Note that you need to setup your UE network using TUN device.
# (ogstun, ogstun2, ogstunX, ..)
#
# o IPv4 Pool
# $ sudo ip addr add 10.45.0.1/16 dev ogstun
#
# pdn:
# subnet:
# addr: 10.45.0.1/16
#
# o IPv4/IPv6 Pool
# $ sudo ip addr add 10.45.0.1/16 dev ogstun
# $ sudo ip addr add cafe:1::1/64 dev ogstun
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# - addr: cafe:1::1/64
#
@ -105,7 +108,7 @@ logger:
# $ sudo ip addr add cafe:1::1/64 dev ogstun
# $ sudo ip addr add cafe:2::1/64 dev ogstun
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
@ -121,7 +124,7 @@ logger:
# $ sudo ip addr add 10.46.0.1/16 dev ogstun3
# $ sudo ip addr add cafe:2::1/64 dev ogstun3
#
# pdn:
# subnet:
# - addr: 10.45.0.1/16
# dnn: internet
# - addr: cafe:1::1/64
@ -134,39 +137,12 @@ logger:
# dnn: ims
# dev: ogstun3
#
# o Pool Range Sample
# pdn:
# - addr: 10.45.0.1/24
# range: 10.45.0.100-10.45.0.200
#
# pdn:
# - addr: 10.45.0.1/24
# range:
# - 10.45.0.5-10.45.0.50
# - 10.45.0.100-
#
# pdn:
# - addr: 10.45.0.1/24
# range:
# - -10.45.0.200
# - 10.45.0.210-10.45.0.220
#
# pdn:
# - addr: 10.45.0.1/16
# range:
# - 10.45.0.100-10.45.0.200
# - 10.45.1.100-10.45.1.200
# - addr: cafe::1/64
# range:
# - cafe::a0-cafe:b0
# - cafe::c0-cafe:d0
#
upf:
pfcp:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -139,7 +140,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -200,6 +201,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -105,25 +106,26 @@ amf:
- addr: 127.0.0.5
guami:
- plmn_id:
mcc: 208
mnc: 93
mcc: 901
mnc: 70
amf_id:
region: 202
set: 1016
tai:
- plmn_id:
mcc: 208
mnc: 93
mcc: 901
mnc: 70
tac: 1
plmn_support:
- plmn_id:
mcc: 208
mnc: 93
mcc: 901
mnc: 70
s_nssai:
- sst: 1
sd: 010203
- sst: 1
sd: 112233
sd: 000080
- sst: 1
sd: 009000
security:
integrity_order : [ NIA2, NIA1 ]
ciphering_order : [ NEA0, NEA1, NEA2 ]
@ -142,7 +144,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -203,6 +205,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -139,7 +140,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -200,6 +201,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

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

View File

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

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -142,7 +143,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -205,6 +206,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

View File

@ -10,6 +10,7 @@ parameter:
# no_ausf: true
# no_udm: true
# no_pcf: true
# no_nssf: true
# no_udr: true
# no_mme: true
# no_sgwc: true
@ -72,7 +73,7 @@ smf:
- addr: ::1
pfcp:
- addr: 127.0.0.4
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
dns:
@ -142,7 +143,7 @@ upf:
- addr: 127.0.0.7
gtpu:
- addr: 127.0.0.7
pdn:
subnet:
- addr: 10.45.0.1/16
- addr: cafe::1/64
@ -205,6 +206,26 @@ pcf:
- addr: 127.0.0.13
port: 7777
nssf:
sbi:
- addr: 127.0.0.14
port: 7777
nsi:
- addr: ::1
port: 7777
s_nssai:
sst: 1
- addr: 127.0.0.19
port: 7777
s_nssai:
sst: 1
sd: 000080
- addr: 127.0.0.10
port: 7777
s_nssai:
sst: 1
sd: 009000
udr:
sbi:
- addr: 127.0.0.20

6
debian/changelog vendored
View File

@ -1,3 +1,9 @@
open5gs (2.2.0) unstable; urgency=medium
* New function: NSSF
-- Sukchan Lee <acetcom@gmail.com> Mon, 08 Mar 2021 14:14:41 +0900
open5gs (2.1.7) unstable; urgency=medium
* Bug Fixed

13
debian/control vendored
View File

@ -199,6 +199,18 @@ Description: PCF (Policy Control Function)
.
This package provides the PCF (Policy Control Function)
Package: open5gs-nssf
Architecture: any
Multi-Arch: same
Depends: ${shlibs:Depends},
${misc:Depends},
open5gs-common (= ${binary:Version})
Description: NSSF (Network Slice Selection 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 NSSF (Network Slice Selection Function)
Package: open5gs-udr
Architecture: any
Multi-Arch: same
@ -228,6 +240,7 @@ Depends: ${misc:Depends},
open5gs-ausf (= ${binary:Version}),
open5gs-udm (= ${binary:Version}),
open5gs-pcf (= ${binary:Version}),
open5gs-nssf (= ${binary:Version}),
open5gs-udr (= ${binary:Version})
Description: 5G Core and EPC (metapackage)
Open5GS is a C-language implementation of 5G Core and EPC

View File

@ -3,4 +3,4 @@ usr/lib/*/libfd*.so*
usr/lib/*/freeDiameter/*.fdx
configs/freeDiameter/cacert.pem /etc/freeDiameter
configs/logrotate/open5gs /etc/logrotate.d
misc/db/open5gs-dbctl /usr/bin
#misc/db/open5gs-dbctl /usr/bin

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

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

View File

@ -52,8 +52,9 @@ The Open5GS 5G SA Core contains the following functions:
* UDM - Unified Data Management
* UDR - Unified Data Repository
* PCF - Policy and Charging Function
* NSSF - Network Slice Selection 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). Finally there is the PCF, used for charging and enforcing subscriber policies.
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.
The 5G SA core **user plane** is much simpler, as it only contains a single function. The UPF carries user data packets between the gNB and the external WAN. It connects back to the SMF too.
@ -153,7 +154,7 @@ https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_20.
## 3. Install the WebUI of Open5GS
---
The WebUI allows you to interactively edit subscriber data. While it is not essential to use this, it makes things easier when you are just starting out on your Open5GS adventure. (A [command line tool](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/db/open5gs-dbctl) is available for advanced users).
The WebUI allows you to interactively edit subscriber data. While it is not essential to use this, it makes things easier when you are just starting out on your Open5GS adventure. (A [command line tool](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/db/open5gs-dbctl) is available for advanced users).
[Node.js](https://nodejs.org/) is required to install the WebUI of Open5GS
@ -218,6 +219,7 @@ NRF-sbi = 127.0.0.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-sbi = 127.0.0.13:7777 for 5G SBI
NSSF-sbi = 127.0.0.14:7777 for 5G SBI
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
@ -228,7 +230,7 @@ You will need to modify your 4G MME config to support your PLMN and TAC. The int
If you are aiming to connect an external eNB to your core, you will also need to change the S1AP bind address of the MME **and** the GTP-U bind address of the SGWU. If you are running an eNB stack locally, you will not need to make these changes.
Modify [/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@ -260,7 +262,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
```
Modify [/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
Modify [/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
@ -287,7 +289,7 @@ You will need to modify your 5G AMF config to support your PLMN and TAC. The int
If you are aiming to connect an external gNB to your core, you will also need to change the NGAP bind address of the AMF **and** the GTPU bind address of the UPF. If you are running an gNB stack locally, you will not need to make these changes.
Modify [/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
Modify [/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@ -328,7 +330,7 @@ amf:
```
Modify [/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U address.
Modify [/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
@ -463,6 +465,7 @@ $ sudo systemctl stop open5gs-nrfd
$ sudo systemctl stop open5gs-ausfd
$ sudo systemctl stop open5gs-udmd
$ sudo systemctl stop open5gs-pcfd
$ sudo systemctl stop open5gs-nssfd
$ sudo systemctl stop open5gs-udrd
$ sudo systemctl stop open5gs-webui
```
@ -480,6 +483,7 @@ $ sudo systemctl restart open5gs-nrfd
$ sudo systemctl restart open5gs-ausfd
$ sudo systemctl restart open5gs-udmd
$ sudo systemctl restart open5gs-pcfd
$ sudo systemctl restart open5gs-nssfd
$ sudo systemctl restart open5gs-udrd
$ sudo systemctl restart open5gs-webui
```

View File

@ -34,7 +34,7 @@ $ sudo ip addr add cafe::1/64 dev ogstun
$ sudo ip link set ogstun up
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
@ -93,7 +93,7 @@ $ cd ../
##### 5G Core
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@ -133,7 +133,7 @@ $ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
security:
```
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
--- upf.yaml 2020-09-05 20:52:28.652234967 -0400
@ -152,7 +152,7 @@ $ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
```
##### 4G EPC
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@ -187,7 +187,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml 2020-09-05 20:50:39.393022566 -0400
@ -211,7 +211,7 @@ If you modify the config files while Open5GS daemons are running, please restart
```bash
$ cd install/bin/
$ ./install/bin/open5gs-mmed
$ ./install/bin/open5gs-mmed
Open5GS daemon v2.1.0
08/21 22:53:47.328: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/mme.yaml' (../src/main.c:54)
@ -221,7 +221,7 @@ Open5GS daemon v2.1.0
08/21 22:53:47.365: [gtp] INFO: gtp_connect() [127.0.0.3]:2123 (../lib/gtp/path.c:59)
08/21 22:53:47.366: [mme] INFO: s1ap_server() [127.0.0.2]:36412 (../src/mme/s1ap-sctp.c:57)
$ ./install/bin/open5gs-sgwcd
$ ./install/bin/open5gs-sgwcd
Open5GS daemon v2.1.0
08/21 22:54:43.059: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwc.yaml' (../src/main.c:54)
@ -253,7 +253,7 @@ Open5GS daemon v2.1.0
08/21 22:55:14.040: [sbi] INFO: sbi_server() [127.0.0.5]:7777 (../lib/sbi/server.c:298)
08/21 22:55:14.040: [amf] INFO: ngap_server() [127.0.0.5]:38412 (../src/amf/ngap-sctp.c:56)
$ ./install/bin/open5gs-sgwud
$ ./install/bin/open5gs-sgwud
Open5GS daemon v2.1.0
08/21 22:54:10.357: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/sgwu.yaml' (../src/main.c:54)
@ -262,7 +262,7 @@ Open5GS daemon v2.1.0
08/21 22:54:10.360: [app] INFO: SGW-U initialize...done (../src/sgwu/app.c:31)
08/21 22:54:10.361: [gtp] INFO: gtp_server() [127.0.0.6]:2152 (../lib/gtp/path.c:32)
$ ./install/bin/open5gs-upfd
$ ./install/bin/open5gs-upfd
Open5GS daemon v2.1.0
08/21 22:54:21.596: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/upf.yaml' (../src/main.c:54)
@ -280,7 +280,7 @@ Open5GS daemon v2.1.0
08/21 22:57:17.451: [dbi] INFO: MongoDB URI: 'mongodb://localhost/open5gs' (../lib/dbi/ogs-mongoc.c:99)
08/21 22:57:17.519: [app] INFO: HSS initialize...done (../src/hss/app-init.c:31)
$ ./install/bin/open5gs-pcrfd
$ ./install/bin/open5gs-pcrfd
Open5GS daemon v2.1.0
08/21 22:57:45.894: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcrf.yaml' (../src/main.c:54)
@ -305,7 +305,7 @@ Open5GS daemon v2.1.0
08/21 22:55:41.900: [app] INFO: AUSF initialize...done (../src/ausf/app.c:31)
08/21 22:55:41.900: [sbi] INFO: sbi_server() [127.0.0.11]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udmd
$ ./install/bin/open5gs-udmd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udm.yaml' (../src/main.c:54)
@ -313,7 +313,7 @@ Open5GS daemon v2.1.0
08/21 22:56:02.155: [app] INFO: UDM initialize...done (../src/udm/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-pcfd
$ ./install/bin/open5gs-pcfd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/pcf.yaml' (../src/main.c:54)
@ -321,7 +321,15 @@ Open5GS daemon v2.1.0
08/21 22:56:02.155: [app] INFO: PCF initialize...done (../src/pcf/app.c:31)
08/21 22:56:02.155: [sbi] INFO: sbi_server() [127.0.0.12]:7777 (../lib/sbi/server.c:298)
$ ./install/bin/open5gs-udrd
$ ./install/bin/open5gs-nssfd
Open5GS daemon v2.1.0
08/21 22:56:02.154: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/nssfd.yaml' (../src/main.c:54)
08/21 22:56:02.154: [app] INFO: File Logging: '/home/acetcom/Documents/git/open5gs/install/var/log/open5gs/nssfd.log' (../src/main.c:57)
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-udrd
Open5GS daemon v2.1.0
08/21 22:56:15.810: [app] INFO: Configuration: '/home/acetcom/Documents/git/open5gs/install/etc/open5gs/udr.yaml' (../src/main.c:54)

View File

@ -33,7 +33,8 @@ PCRF-frDi = 127.0.0.9 :3868 for Gx auth
NRF-sbi = 127.0.0.10:7777 for 5G SBI
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
UDM-sbi = 127.0.0.12:7777 for 5G SBI
PCF-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
UDR-sbi = 127.0.0.20:7777 for 5G SBI
```
@ -50,7 +51,7 @@ You can refer to the network settings at
[{{ site.url }}{{ site.baseurl }}/assets/Open5GS-Diagram.pdf]({{ site.url }}{{ site.baseurl }}/assets/Open5GS-Diagram.pdf) provided by [@kbarlee](https://github.com/kbarlee) in issue [#528](https://github.com/{{ site.github_username }}/open5gs/issues/528)
{: .notice--danger}
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@ -85,7 +86,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwc.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwc.yaml.in) to set the PFCP IP address.
Modify [install/etc/open5gs/sgwc.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwc.yaml.in) to set the PFCP IP address.
```diff
$ diff -u /etc/open5gs/sgwc.yaml.old /etc/open5gs/sgwc.yaml
@@ -49,7 +49,7 @@
@ -108,7 +109,7 @@ $ diff -u /etc/open5gs/sgwc.yaml.old /etc/open5gs/sgwc.yaml
# parameter:
```
Modify [install/etc/open5gs/smf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/smf.yaml.in) to set the PFCP IP address.
Modify [install/etc/open5gs/smf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/smf.yaml.in) to set the PFCP IP address.
```diff
$ diff -u /etc/open5gs/smf.yaml.old /etc/open5gs/smf.yaml
--- smf.yaml.old 2020-08-22 11:37:39.990816411 -0400
@ -135,7 +136,7 @@ $ diff -u /etc/open5gs/smf.yaml.old /etc/open5gs/smf.yaml
```
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
```diff
diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
@ -178,7 +179,7 @@ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
ciphering_order : [ NEA0, NEA1, NEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U and PFCP IP address.
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml.old 2020-08-22 11:41:09.214670723 -0400
@ -197,7 +198,7 @@ $ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
# sgwc:
```
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
```diff
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
--- upf.yaml.old 2020-08-22 11:42:57.781750067 -0400

View File

@ -247,7 +247,7 @@ $ ip link show
**Notice:** This configuration is not persistent after rebooting. The
script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{
site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy
site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy
to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}
@ -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-upfd open5gs-nssfd
```
## Building WebUI of Open5GS

View File

@ -61,7 +61,7 @@ $ sudo ip link set ogstun up
$ ip link show
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}

View File

@ -80,7 +80,7 @@ $ sudo sh -c "echo 'nat on {en0} from cafe::1/64 to any -> {en0}' > /etc/pf.anch
$ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}

View File

@ -80,7 +80,7 @@ $ sudo sh -c "echo 'nat on {en0} from cafe::1/64 to any -> {en0}' > /etc/pf.anch
$ sudo pfctl -e -f /etc/pf.anchors/org.open5gs
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}

View File

@ -97,7 +97,7 @@ $ sudo sysctl -w net.inet.ip.forwarding=1
$ sudo sysctl -w net.inet6.ip6.forwarding=1
```
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/netconf.sh) makes it easy to configure the TUN device as follows:
**Tip:** The script provided in [$GIT_REPO/misc/netconf.sh](https://github.com/{{ site.github_username }}/open5gs/blob/main/misc/netconf.sh) makes it easy to configure the TUN device as follows:
`$ sudo ./misc/netconf.sh`
{: .notice--info}

View File

@ -24,10 +24,11 @@ open5gs 27485 0.0 0.0 243816 15064 ? Ssl 12:13 0:00 /usr/bin/open5g
open5gs 27543 0.0 0.0 222416 9672 ? Ssl 12:13 0:00 /usr/bin/open5gs-ausfd -c /etc/open5gs/ausf.yaml
open5gs 27600 0.0 0.0 222328 9668 ? Ssl 12:13 0:00 /usr/bin/open5gs-udmd -c /etc/open5gs/udm.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-pcfd -c /etc/open5gs/pcf.yaml
open5gs 27600 0.0 0.0 222329 9669 ? Ssl 12:13 0:00 /usr/bin/open5gs-nssfd -c /etc/open5gs/nssf.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 & 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 & UDR are all running.
If your instance doesn't show this make sure you're started each service:
```bash
@ -43,6 +44,7 @@ $ systemctl start open5gs-nrfd.service
$ systemctl start open5gs-ausfd.service
$ systemctl start open5gs-udmd.service
$ systemctl start open5gs-pcfd.service
$ systemctl start open5gs-nssfd.service
$ systemctl start open5gs-udrd.service
```

View File

@ -64,6 +64,7 @@ $ open5gs-amfd
$ open5gs-ausfd
$ open5gs-udmd
$ open5gs-pcfd
$ open5gs-nssfd
$ open5gs-udrd
```
@ -268,6 +269,7 @@ $ sudo pkill -9 open5gs-nrfd
$ sudo pkill -9 open5gs-ausfd
$ sudo pkill -9 open5gs-udmd
$ sudo pkill -9 open5gs-pcfd
$ sudo pkill -9 open5gs-nssfd
$ sudo pkill -9 open5gs-udrd
```
@ -706,7 +708,7 @@ You should configure the domain name on your computer. Otherwise, freeDiameter r
#### How many of UEs can Open5GS support?
See the [lib/core/ogs-3gpp-types.h](https://github.com/{{ site.github_username }}/open5gs/blob/master/lib/core/ogs-3gpp-types.h).
See the [lib/core/ogs-3gpp-types.h](https://github.com/{{ site.github_username }}/open5gs/blob/main/lib/core/ogs-3gpp-types.h).
```
#define MAX_NUM_OF_ENB 128
@ -744,6 +746,7 @@ Currently, the number of UE is limited to `128*128`.
* AUSF : 127.0.0.11
* UDM : 127.0.0.12
* PCF : 127.0.0.13
* NSSF : 127.0.0.14
* UDR : 127.0.0.20
```

View File

@ -222,7 +222,7 @@ Then proceed as follows:
3. Fill the IMSI, security context(K, OPc, AMF), and APN of the subscriber.
4. Click `SAVE` Button
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
```diff
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
@ -257,7 +257,7 @@ $ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
ciphering_order : [ EEA0, EEA1, EEA2 ]
```
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/main/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
```diff
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
--- sgwu.yaml.old 2020-08-22 12:08:44.782880778 -0400

View File

@ -21,7 +21,6 @@ Open5GS is a C-language Open Source implementation of 5GC and EPC, i.e. the core
#### Known Limitations
---
- No NSSF
- No VoNR(Voice over NR)
- No Interworking with EPC
- No NB-IoT

View File

@ -78,6 +78,9 @@ void ausf_terminate(void);
int pcf_initialize(void);
void pcf_terminate(void);
int nssf_initialize(void);
void nssf_terminate(void);
int upf_initialize(void);
void upf_terminate(void);

View File

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

View File

@ -473,12 +473,64 @@ char *ogs_ipv6_to_string(uint8_t *addr6)
return (char *)OGS_INET6_NTOP(addr6, buf);
}
ogs_slice_data_t *ogs_slice_find_by_s_nssai(
ogs_slice_data_t *slice_data, int num_of_slice_data,
ogs_s_nssai_t *s_nssai)
{
int i;
ogs_assert(slice_data);
ogs_assert(num_of_slice_data);
ogs_assert(s_nssai);
/* Compare S-NSSAI */
for (i = 0; i < num_of_slice_data; i++) {
if (s_nssai->sst == slice_data[i].s_nssai.sst &&
s_nssai->sd.v == slice_data[i].s_nssai.sd.v) {
return slice_data + i;
}
}
/* Compare Only SST if DefaultSingleNSSAI */
for (i = 0; i < num_of_slice_data; i++) {
if (slice_data[i].default_indicator == true &&
s_nssai->sst == slice_data[i].s_nssai.sst) {
return slice_data + i;
}
}
return NULL;
}
void ogs_subscription_data_free(ogs_subscription_data_t *subscription_data)
{
int i, j;
ogs_assert(subscription_data);
for (i = 0; i < subscription_data->num_of_slice; i++) {
ogs_slice_data_t *slice_data = &subscription_data->slice[i];
for (j = 0; j < slice_data->num_of_session; j++) {
if (slice_data->session[j].name)
ogs_free(slice_data->session[j].name);
}
slice_data->num_of_session = 0;
}
subscription_data->num_of_slice = 0;
}
void ogs_session_data_free(ogs_session_data_t *session_data)
{
int i;
ogs_assert(session_data);
if (session_data->session.name)
ogs_free(session_data->session.name);
for (i = 0; i < session_data->num_of_pcc_rule; i++)
OGS_PCC_RULE_FREE(&session_data->pcc_rule[i]);
}

View File

@ -178,13 +178,11 @@ typedef struct ogs_nr_cgi_s {
/************************************
* S-NSSAI Structure */
#define OGS_MAX_NUM_OF_S_NSSAI 16
#define OGS_MAX_NUM_OF_SLICE 8
#define OGS_S_NSSAI_NO_SD_VALUE 0xffffff
typedef struct ogs_s_nssai_s {
uint8_t sst;
ogs_uint24_t sd;
uint8_t mapped_hplmn_sst;
ogs_uint24_t mapped_hplmn_sd;
} __attribute__ ((packed)) ogs_s_nssai_t;
char *ogs_s_nssai_sd_to_string(ogs_uint24_t sd);
@ -220,26 +218,17 @@ char *ogs_ipv6_to_string(uint8_t *addr6);
typedef struct ogs_paa_s {
ED2(uint8_t spare:5;,
/* 8.34 PDN Type */
#define OGS_GTP_PDN_TYPE_IPV4 OGS_PDU_SESSION_TYPE_IPV4
#define OGS_GTP_PDN_TYPE_IPV6 OGS_PDU_SESSION_TYPE_IPV6
#define OGS_GTP_PDN_TYPE_IPV4V6 OGS_PDU_SESSION_TYPE_IPV4V6
#define OGS_GTP_PDN_TYPE_NON_IP OGS_PDU_SESSION_TYPE_NONIP
#define OGS_PFCP_PDN_TYPE_IPV4 OGS_PDU_SESSION_TYPE_IPV4
#define OGS_PFCP_PDN_TYPE_IPV6 OGS_PDU_SESSION_TYPE_IPV6
#define OGS_PFCP_PDN_TYPE_IPV4V6 OGS_PDU_SESSION_TYPE_IPV4V6
#define OGS_PFCP_PDN_TYPE_NONIP OGS_PDU_SESSION_TYPE_NONIP
#define OGS_PDU_SESSION_TYPE_IS_VALID(x) \
((x) == OGS_PDU_SESSION_TYPE_IPV4 || \
(x) == OGS_PDU_SESSION_TYPE_IPV6 || \
(x) == OGS_PDU_SESSION_TYPE_IPV4V6) \
#define OGS_GTP_PDN_TYPE_IS_VALID(x) \
((x) == OGS_GTP_PDN_TYPE_IPV4 || \
(x) == OGS_GTP_PDN_TYPE_IPV6 || \
(x) == OGS_GTP_PDN_TYPE_IPV4V6) \
uint8_t pdn_type:3;)
uint8_t session_type:3;)
union {
/* GTP_PDN_TYPE_IPV4 */
/* PDU_SESSION_TYPE_IPV4 */
uint32_t addr;
/* GTP_PDN_TYPE_IPV6 */
/* PDU_SESSION_TYPE_IPV6 */
struct {
/* the IPv6 Prefix Length */
uint8_t len;
@ -247,7 +236,7 @@ ED2(uint8_t spare:5;,
uint8_t addr6[OGS_IPV6_LEN];
};
/* GTP_PDN_TYPE_BOTH */
/* PDU_SESSION_TYPE_IPV4V6 */
struct {
struct {
/* the IPv6 Prefix Length */
@ -270,20 +259,10 @@ typedef struct ogs_bitrate_s {
/**********************************
* QoS Structure */
typedef struct ogs_qos_s {
#define OGS_PDN_QCI_1 1
#define OGS_PDN_QCI_2 2
#define OGS_PDN_QCI_3 3
#define OGS_PDN_QCI_4 4
#define OGS_PDN_QCI_5 5
#define OGS_PDN_QCI_6 6
#define OGS_PDN_QCI_7 7
#define OGS_PDN_QCI_8 8
#define OGS_PDN_QCI_9 9
#define OGS_PDN_QCI_65 65
#define OGS_PDN_QCI_66 66
#define OGS_PDN_QCI_69 69
#define OGS_PDN_QCI_70 70
uint8_t qci;
#define OGS_QOS_INDEX_1 1
#define OGS_QOS_INDEX_2 2
#define OGS_QOS_INDEX_5 5
uint8_t index;
struct {
/* Values 1 to 8 should only be assigned for services that are
@ -291,12 +270,27 @@ typedef struct ogs_qos_s {
* Values 9 to 15 may be assigned to resources that are authorized
* by the home network and thus applicable when a UE is roaming. */
uint8_t priority_level;
/*
* Ch 7.3.40 Allocation-Retenion-Proirty in TS 29.272 V15.9.0
*
* If the Pre-emption-Capability AVP is not present in the
* Allocation-Retention-Priority AVP, the default value shall be
* PRE-EMPTION_CAPABILITY_DISABLED (1).
*
* If the Pre-emption-Vulnerability AVP is not present in the
* Allocation-Retention-Priority AVP, the default value shall be
* PRE-EMPTION_VULNERABILITY_ENABLED (0).
*
* However, to easily set up VoLTE service,
* enable Pre-emption Capability/Vulnerablility
* in Default Bearer
*/
#define OGS_EPC_PRE_EMPTION_DISABLED 1
#define OGS_EPC_PRE_EMPTION_ENABLED 0
#define OGS_PDN_PRE_EMPTION_CAPABILITY_ENABLED 0
#define OGS_PDN_PRE_EMPTION_CAPABILITY_DISABLED 1
#define OGS_5GC_PRE_EMPTION_DISABLED 1
#define OGS_5GC_PRE_EMPTION_ENABLED 2
uint8_t pre_emption_capability;
#define OGS_PDN_PRE_EMPTION_VULNERABILITY_ENABLED 0
#define OGS_PDN_PRE_EMPTION_VULNERABILITY_DISABLED 1
uint8_t pre_emption_vulnerability;
} arp;
@ -394,22 +388,21 @@ typedef struct ogs_pcc_rule_s {
/**********************************
* PDN Structure */
typedef struct ogs_pdn_s {
uint32_t context_identifier;
union {
char apn[OGS_MAX_APN_LEN+1];
char dnn[OGS_MAX_DNN_LEN+1];
};
#define OGS_DIAM_PDN_TYPE_IPV4 0
#define OGS_DIAM_PDN_TYPE_IPV6 1
#define OGS_DIAM_PDN_TYPE_IPV4V6 2
#define OGS_DIAM_PDN_TYPE_IPV4_OR_IPV6 3
typedef struct ogs_session_s {
char *name;
uint32_t context_identifier; /* EPC */
bool default_dnn_indicator; /* 5GC */
#define OGS_PDU_SESSION_TYPE_IPV4 1
#define OGS_PDU_SESSION_TYPE_IPV6 2
#define OGS_PDU_SESSION_TYPE_IPV4V6 3
#define OGS_PDU_SESSION_TYPE_UNSTRUCTURED 4
#define OGS_PDU_SESSION_TYPE_ETHERNET 5
uint8_t pdn_type;
#define OGS_PDU_SESSION_TYPE_TO_DIAMETER(x) ((x)-1)
#define OGS_PDU_SESSION_TYPE_FROM_DIAMETER(x) ((x)+1)
uint8_t session_type;
#define OGS_SSC_MODE_1 1
#define OGS_SSC_MODE_2 2
@ -421,8 +414,8 @@ typedef struct ogs_pdn_s {
ogs_paa_t paa;
ogs_ip_t ue_ip;
ogs_ip_t pgw_ip;
} ogs_pdn_t;
ogs_ip_t smf_ip;
} ogs_session_t;
int ogs_fqdn_build(char *dst, char *src, int len);
int ogs_fqdn_parse(char *dst, char *src, int len);
@ -478,6 +471,20 @@ ED3(uint8_t ext:1;,
int ogs_pco_parse(ogs_pco_t *pco, unsigned char *data, int data_len);
int ogs_pco_build(unsigned char *data, int data_len, ogs_pco_t *pco);
typedef struct ogs_slice_data_s {
ogs_s_nssai_t s_nssai;
bool default_indicator;
uint32_t context_identifier; /* EPC for checking default APN */
int num_of_session;
ogs_session_t session[OGS_MAX_NUM_OF_SESS];
} ogs_slice_data_t;
ogs_slice_data_t *ogs_slice_find_by_s_nssai(
ogs_slice_data_t *slice_data, int num_of_slice_data,
ogs_s_nssai_t *s_nssai);
typedef struct ogs_subscription_data_s {
#define OGS_ACCESS_RESTRICTION_UTRAN_NOT_ALLOWED (1)
#define OGS_ACCESS_RESTRICTION_GERAN_NOT_ALLOWED (1<<1)
@ -500,9 +507,8 @@ typedef struct ogs_subscription_data_s {
#define OGS_RAU_TAU_DEFAULT_TIME (12*60) /* 12 min */
uint32_t subscribed_rau_tau_timer; /* unit : seconds */
uint32_t context_identifier; /* default APN */
ogs_pdn_t pdn[OGS_MAX_NUM_OF_SESS];
int num_of_pdn;
int num_of_slice;
ogs_slice_data_t slice[OGS_MAX_NUM_OF_SLICE];
#define OGS_MAX_NUM_OF_MSISDN 4
int num_of_msisdn;
@ -513,11 +519,13 @@ typedef struct ogs_subscription_data_s {
} msisdn[OGS_MAX_NUM_OF_MSISDN];
} ogs_subscription_data_t;
void ogs_subscription_data_free(ogs_subscription_data_t *subscription_data);
typedef struct ogs_session_data_s {
ogs_pdn_t pdn;
ogs_session_t session;
#define OGS_MAX_NUM_OF_PCC_RULE 8 /* Num of PCC Rule */
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
int num_of_pcc_rule;
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
int num_of_pcc_rule;
} ogs_session_data_t;
void ogs_session_data_free(ogs_session_data_t *session_data);

View File

@ -19,7 +19,7 @@
#include "ogs-dbi.h"
int ogs_dbi_session_data(char *supi, char *dnn,
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data)
{
int rv = OGS_OK;
@ -29,10 +29,13 @@ int ogs_dbi_session_data(char *supi, char *dnn,
bson_error_t error;
const bson_t *document;
bson_iter_t iter;
bson_iter_t child1_iter, child2_iter, child3_iter;
bson_iter_t child4_iter, child5_iter, child6_iter;
bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter, child5_iter;
bson_iter_t child6_iter, child7_iter, child8_iter, child9_iter;
const char *utf8 = NULL;
uint32_t length = 0;
bool found = false;
ogs_session_t *session = NULL;
char *supi_type = NULL;
char *supi_id = NULL;
@ -40,6 +43,7 @@ int ogs_dbi_session_data(char *supi, char *dnn,
ogs_session_data_t zero_data;
ogs_assert(supi);
ogs_assert(s_nssai);
ogs_assert(dnn);
ogs_assert(session_data);
@ -53,30 +57,17 @@ int ogs_dbi_session_data(char *supi, char *dnn,
supi_id = ogs_id_get_value(supi);
ogs_assert(supi_id);
query = BCON_NEW(
supi_type, BCON_UTF8(supi_id),
"pdn.apn", BCON_UTF8(dnn));
query = BCON_NEW(supi_type, BCON_UTF8(supi_id));
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
opts = BCON_NEW(
"projection", "{",
supi_type, BCON_INT64(1),
"pdn.$", BCON_INT64(1),
"}"
);
cursor = mongoc_collection_find_with_opts(
ogs_mongoc()->collection.subscriber, query, opts, NULL);
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
#else
asdklfjasdf
opts = BCON_NEW(
supi_type, BCON_INT64(1),
"pdn.$", BCON_INT64(1)
);
cursor = mongoc_collection_find(self.subscriberCollection,
MONGOC_QUERY_NONE, 0, 0, 0, query, opts, NULL);
cursor = mongoc_collection_find(ogs_mongoc()->collection.subscriber,
MONGOC_QUERY_NONE, 0, 0, 0, query, NULL, NULL);
#endif
if (!mongoc_cursor_next(cursor, &document)) {
ogs_error("Cannot find IMSI(%s)+APN(%s) in DB", supi_id, dnn);
ogs_error("[%s] Cannot find IMSI in DB", supi);
rv = OGS_ERROR;
goto out;
@ -89,6 +80,7 @@ int ogs_dbi_session_data(char *supi, char *dnn,
goto out;
}
/* Finding Session for S_NSSAI+DNN */
if (!bson_iter_init(&iter, document)) {
ogs_error("bson_iter_init failed in this document");
@ -98,279 +90,409 @@ int ogs_dbi_session_data(char *supi, char *dnn,
while (bson_iter_next(&iter)) {
const char *key = bson_iter_key(&iter);
if (!strcmp(key, "pdn") &&
BSON_ITER_HOLDS_ARRAY(&iter)) {
int pdn_index = 0;
if (!strcmp(key, "slice") && BSON_ITER_HOLDS_ARRAY(&iter)) {
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_pdn_t *pdn = NULL;
uint8_t sst;
ogs_uint24_t sd;
ogs_assert(child1_key);
pdn_index = atoi(child1_key);
ogs_assert(pdn_index == 0);
sst = 0;
sd.v = OGS_S_NSSAI_NO_SD_VALUE;
pdn = &session_data->pdn;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if ((!strcmp(child2_key, "apn") ||
!strcmp(child2_key, "dnn")) &&
if (!strcmp(child2_key, "sst") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
sst = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "sd") &&
BSON_ITER_HOLDS_UTF8(&child2_iter)) {
utf8 = bson_iter_utf8(&child2_iter, &length);
ogs_cpystrn(pdn->dnn, utf8,
ogs_min(length, OGS_MAX_APN_LEN)+1);
} else if (!strcmp(child2_key, "type") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
pdn->pdn_type = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "qci") &&
BSON_ITER_HOLDS_INT32(&child3_iter)) {
pdn->qos.qci = bson_iter_int32(&child3_iter);
} else if (!strcmp(child3_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.priority_level =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_capability =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child4_iter);
}
}
}
}
} else if (!strcmp(child2_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.uplink =
bson_iter_int64(&child3_iter) * 1024;
} else if (!strcmp(child3_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.downlink =
bson_iter_int64(&child3_iter) * 1024;
}
}
} else if (!strcmp(child2_key, "pcc_rule") &&
ogs_assert(utf8);
sd = ogs_s_nssai_sd_from_string(utf8);
} else if (!strcmp(child2_key, "session") &&
BSON_ITER_HOLDS_ARRAY(&child2_iter)) {
int pcc_rule_index = 0;
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
ogs_pcc_rule_t *pcc_rule = NULL;
}
}
ogs_assert(child3_key);
pcc_rule_index = atoi(child3_key);
ogs_assert(pcc_rule_index <
OGS_MAX_NUM_OF_PCC_RULE);
if (!sst) {
ogs_error("No SST");
continue;
}
pcc_rule = &session_data->pcc_rule[pcc_rule_index];
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (s_nssai->sst != sst) continue;
if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "qci") &&
BSON_ITER_HOLDS_INT32(
&child5_iter)) {
pcc_rule->qos.qci =
bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"priority_level") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
priority_level =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
pre_emption_capability =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability")
&& BSON_ITER_HOLDS_INT32(
&child6_iter)) {
pcc_rule->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(
&child6_iter);
}
}
} else if (!strcmp(child5_key, "mbr") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"downlink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.mbr.downlink =
bson_iter_int64(
&child6_iter) * 1024;
} else if (!strcmp(child6_key,
"uplink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.mbr.uplink =
bson_iter_int64(
&child6_iter) * 1024;
}
}
} else if (!strcmp(child5_key, "gbr") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(&child5_iter,
&child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"downlink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.gbr.downlink =
bson_iter_int64(
&child6_iter) * 1024;
} else if (!strcmp(child6_key,
"uplink") &&
BSON_ITER_HOLDS_INT64(
&child6_iter)) {
pcc_rule->qos.gbr.uplink =
bson_iter_int64(
&child6_iter) * 1024;
}
}
}
}
} else if (!strcmp(child4_key, "flow") &&
BSON_ITER_HOLDS_ARRAY(&child4_iter)) {
int flow_index = 0;
if (s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE &&
sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
if (s_nssai->sd.v != sd.v) continue;
}
bson_iter_recurse(&child4_iter,
&child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
ogs_flow_t *flow = NULL;
ogs_assert(child5_key);
flow_index = atoi(child5_key);
ogs_assert(
flow_index < OGS_MAX_NUM_OF_FLOW);
flow = &pcc_rule->flow[flow_index];
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"direction") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
flow->direction =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"description") &&
BSON_ITER_HOLDS_UTF8(
&child6_iter)) {
utf8 = bson_iter_utf8(
&child6_iter, &length);
flow->description =
ogs_malloc(length+1);
ogs_cpystrn(
(char*)flow->description,
utf8, length+1);
}
}
flow_index++;
}
pcc_rule->num_of_flow = flow_index;
}
while (bson_iter_next(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key = bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "name") &&
BSON_ITER_HOLDS_UTF8(&child4_iter)) {
utf8 = bson_iter_utf8(&child4_iter, &length);
if (ogs_strncasecmp(utf8, dnn, length) == 0) {
found = true;
goto done;
}
/* EPC: Charing-Rule-Name */
if (pcc_rule->name) {
ogs_error(
"PCC Rule Name has already been defined");
ogs_free(pcc_rule->name);
}
pcc_rule->name = ogs_msprintf(
"%s%d", dnn, pcc_rule_index+1);
ogs_assert(pcc_rule->name);
/* 5GC: PCC-Rule-Id */
if (pcc_rule->id) {
ogs_error(
"PCC Rule Id has already been defined");
ogs_free(pcc_rule->id);
}
pcc_rule->id = ogs_msprintf("%d", pcc_rule_index+1);
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;
}
}
}
}
}
done:
if (found == false) {
ogs_error("Cannot find SUPI[%s] S_NSSAI[SST:%d SD:0x%x] DNN[%s] in DB",
supi_id, s_nssai->sst, s_nssai->sd.v, dnn);
rv = OGS_ERROR;
goto out;
}
session = &session_data->session;
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key = bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "name") &&
BSON_ITER_HOLDS_UTF8(&child4_iter)) {
utf8 = bson_iter_utf8(&child4_iter, &length);
session->name = ogs_strndup(utf8, length);
ogs_assert(session->name);
} else if (!strcmp(child4_key, "type") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
session->session_type = bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key = bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "index") &&
BSON_ITER_HOLDS_INT32(&child5_iter)) {
session->qos.index = bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child5_iter)) {
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->qos.arp.priority_level =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->qos.arp.pre_emption_capability =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child6_iter);
}
}
}
}
} else if (!strcmp(child4_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key = bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "value") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->ambr.downlink =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
unit = bson_iter_int32(&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.downlink *= 1024;
} else if (!strcmp(child5_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "value") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
session->ambr.uplink =
bson_iter_int32(&child6_iter);
} else if (!strcmp(child6_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child6_iter)) {
unit = bson_iter_int32(&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.uplink *= 1024;
}
}
} else if (!strcmp(child4_key, "pcc_rule") &&
BSON_ITER_HOLDS_ARRAY(&child4_iter)) {
int pcc_rule_index = 0;
bson_iter_recurse(&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key = bson_iter_key(&child5_iter);
ogs_pcc_rule_t *pcc_rule = NULL;
ogs_assert(child5_key);
pcc_rule_index = atoi(child5_key);
ogs_assert(pcc_rule_index < OGS_MAX_NUM_OF_PCC_RULE);
pcc_rule = &session_data->pcc_rule[pcc_rule_index];
bson_iter_recurse(&child5_iter, &child6_iter);
while (bson_iter_next(&child6_iter)) {
const char *child6_key = bson_iter_key(&child6_iter);
if (!strcmp(child6_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child6_iter)) {
bson_iter_recurse(&child6_iter, &child7_iter);
while (bson_iter_next(&child7_iter)) {
const char *child7_key =
bson_iter_key(&child7_iter);
if (!strcmp(child7_key, "index") &&
BSON_ITER_HOLDS_INT32(&child7_iter)) {
pcc_rule->qos.index =
bson_iter_int32(&child7_iter);
} else if (!strcmp(child7_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child7_iter)) {
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
pcc_rule->qos.arp.priority_level =
bson_iter_int32(&child8_iter);
} else if (!strcmp(child8_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
pcc_rule->qos.arp.
pre_emption_capability =
bson_iter_int32(&child8_iter);
} else if (!strcmp(child8_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
pcc_rule->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(&child8_iter);
}
}
} else if (!strcmp(child7_key, "mbr") &&
BSON_ITER_HOLDS_DOCUMENT(&child7_iter)) {
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.mbr.downlink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.mbr.downlink *= 1024;
} else if (!strcmp(child8_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.mbr.uplink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.mbr.uplink *= 1024;
}
}
} else if (!strcmp(child7_key, "gbr") &&
BSON_ITER_HOLDS_DOCUMENT(&child7_iter)) {
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.gbr.downlink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.gbr.downlink *= 1024;
} else if (!strcmp(child8_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child8_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child8_iter, &child9_iter);
while (bson_iter_next(&child9_iter)) {
const char *child9_key =
bson_iter_key(&child9_iter);
if (!strcmp(child9_key, "value") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
pcc_rule->qos.gbr.uplink =
bson_iter_int32(
&child9_iter);
} else if (!strcmp(
child9_key, "unit") &&
BSON_ITER_HOLDS_INT32(
&child9_iter)) {
unit = bson_iter_int32(
&child9_iter);
}
}
for (n = 0; n < unit; n++)
pcc_rule->qos.gbr.uplink *= 1024;
}
}
}
}
} else if (!strcmp(child6_key, "flow") &&
BSON_ITER_HOLDS_ARRAY(&child6_iter)) {
int flow_index = 0;
bson_iter_recurse(&child6_iter, &child7_iter);
while (bson_iter_next(&child7_iter)) {
const char *child7_key =
bson_iter_key(&child7_iter);
ogs_flow_t *flow = NULL;
ogs_assert(child7_key);
flow_index = atoi(child7_key);
ogs_assert(flow_index < OGS_MAX_NUM_OF_FLOW);
flow = &pcc_rule->flow[flow_index];
bson_iter_recurse(&child7_iter, &child8_iter);
while (bson_iter_next(&child8_iter)) {
const char *child8_key =
bson_iter_key(&child8_iter);
if (!strcmp(child8_key, "direction") &&
BSON_ITER_HOLDS_INT32(&child8_iter)) {
flow->direction =
bson_iter_int32(&child8_iter);
} else if (!strcmp(child8_key, "description") &&
BSON_ITER_HOLDS_UTF8(&child8_iter)) {
utf8 = bson_iter_utf8(
&child8_iter, &length);
flow->description = ogs_malloc(length+1);
ogs_cpystrn((char*)flow->description,
utf8, length+1);
}
}
flow_index++;
}
pcc_rule->num_of_flow = flow_index;
}
}
/* EPC: Charing-Rule-Name */
if (pcc_rule->name) {
ogs_error("PCC Rule Name has already been defined");
ogs_free(pcc_rule->name);
}
pcc_rule->name = ogs_msprintf("%s%d", dnn, pcc_rule_index+1);
ogs_assert(pcc_rule->name);
/* 5GC: PCC-Rule-Id */
if (pcc_rule->id) {
ogs_error("PCC Rule Id has already been defined");
ogs_free(pcc_rule->id);
}
pcc_rule->id = ogs_msprintf("%d", pcc_rule_index+1);
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;
}
}
out:
if (query) bson_destroy(query);
if (opts) bson_destroy(opts);

View File

@ -28,7 +28,7 @@
extern "C" {
#endif
int ogs_dbi_session_data(char *supi, char *dnn,
int ogs_dbi_session_data(char *supi, ogs_s_nssai_t *s_nssai, char *dnn,
ogs_session_data_t *session_data);
#ifdef __cplusplus

View File

@ -211,16 +211,24 @@ int ogs_dbi_subscription_data(char *supi,
bson_error_t error;
const bson_t *document;
bson_iter_t iter;
bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter;
bson_iter_t child1_iter, child2_iter, child3_iter;
bson_iter_t child4_iter, child5_iter, child6_iter;
const char *utf8 = NULL;
uint32_t length = 0;
char *supi_type = NULL;
char *supi_id = NULL;
ogs_subscription_data_t zero_data;
ogs_assert(subscription_data);
ogs_assert(supi);
memset(&zero_data, 0, sizeof(zero_data));
/* subscription_data should be initialized to zero */
ogs_assert(memcmp(subscription_data, &zero_data, sizeof(zero_data)) == 0);
supi_type = ogs_id_get_type(supi);
ogs_assert(supi_type);
supi_id = ogs_id_get_value(supi);
@ -256,7 +264,6 @@ int ogs_dbi_subscription_data(char *supi,
goto out;
}
memset(subscription_data, 0, sizeof(ogs_subscription_data_t));
while (bson_iter_next(&iter)) {
const char *key = bson_iter_key(&iter);
if (!strcmp(key, "msisdn") &&
@ -265,10 +272,6 @@ int ogs_dbi_subscription_data(char *supi,
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_assert(child1_key);
msisdn_index = atoi(child1_key);
ogs_assert(msisdn_index < OGS_MAX_NUM_OF_MSISDN);
if (BSON_ITER_HOLDS_UTF8(&child1_iter)) {
@ -301,160 +304,310 @@ int ogs_dbi_subscription_data(char *supi,
BSON_ITER_HOLDS_INT32(&iter)) {
subscription_data->subscribed_rau_tau_timer =
bson_iter_int32(&iter);
} else if (!strcmp(key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&iter)) {
} else if (!strcmp(key, "ambr") && BSON_ITER_HOLDS_DOCUMENT(&iter)) {
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
if (!strcmp(child1_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child1_iter)) {
subscription_data->ambr.uplink =
bson_iter_int64(&child1_iter) * 1024;
} else if (!strcmp(child1_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child1_iter)) {
subscription_data->ambr.downlink =
bson_iter_int64(&child1_iter) * 1024;
if (!strcmp(child1_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(&child1_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if (!strcmp(child2_key, "value") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
subscription_data->ambr.downlink =
bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
unit = bson_iter_int32(&child2_iter);
}
}
for (n = 0; n < unit; n++)
subscription_data->ambr.downlink *= 1024;
} else if (!strcmp(child1_key, "uplink") &&
BSON_ITER_HOLDS_DOCUMENT(&child1_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if (!strcmp(child2_key, "value") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
subscription_data->ambr.uplink =
bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "unit") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
unit = bson_iter_int32(&child2_iter);
}
}
for (n = 0; n < unit; n++)
subscription_data->ambr.uplink *= 1024;
}
}
} else if (!strcmp(key, "pdn") &&
BSON_ITER_HOLDS_ARRAY(&iter)) {
int pdn_index = 0;
} else if (!strcmp(key, "slice") && BSON_ITER_HOLDS_ARRAY(&iter)) {
bson_iter_recurse(&iter, &child1_iter);
while (bson_iter_next(&child1_iter)) {
const char *child1_key = bson_iter_key(&child1_iter);
ogs_pdn_t *pdn = NULL;
ogs_slice_data_t *slice_data = NULL;
ogs_assert(child1_key);
pdn_index = atoi(child1_key);
ogs_assert(pdn_index < OGS_MAX_NUM_OF_SESS);
ogs_assert(
subscription_data->num_of_slice < OGS_MAX_NUM_OF_SLICE);
pdn = &subscription_data->pdn[pdn_index];
slice_data = &subscription_data->slice[
subscription_data->num_of_slice];
slice_data->s_nssai.sst = 0;
slice_data->s_nssai.sd.v = OGS_S_NSSAI_NO_SD_VALUE;
bson_iter_recurse(&child1_iter, &child2_iter);
while (bson_iter_next(&child2_iter)) {
const char *child2_key = bson_iter_key(&child2_iter);
if (!strcmp(child2_key, "apn") &&
if (!strcmp(child2_key, "sst") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
slice_data->s_nssai.sst = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "sd") &&
BSON_ITER_HOLDS_UTF8(&child2_iter)) {
utf8 = bson_iter_utf8(&child2_iter, &length);
ogs_cpystrn(pdn->apn, utf8,
ogs_min(length, OGS_MAX_APN_LEN)+1);
} else if (!strcmp(child2_key, "type") &&
BSON_ITER_HOLDS_INT32(&child2_iter)) {
pdn->pdn_type = bson_iter_int32(&child2_iter);
} else if (!strcmp(child2_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
ogs_assert(utf8);
slice_data->s_nssai.sd =
ogs_s_nssai_sd_from_string(utf8);
} else if (!strcmp(child2_key, "default_indicator") &&
BSON_ITER_HOLDS_BOOL(&child2_iter)) {
slice_data->default_indicator =
bson_iter_bool(&child2_iter);
} else if (!strcmp(child2_key, "session") &&
BSON_ITER_HOLDS_ARRAY(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "qci") &&
BSON_ITER_HOLDS_INT32(&child3_iter)) {
pdn->qos.qci = bson_iter_int32(&child3_iter);
} else if (!strcmp(child3_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) {
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "priority_level") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.priority_level =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_capability =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key,
ogs_session_t *session = NULL;
ogs_assert(
slice_data->num_of_session <
OGS_MAX_NUM_OF_SESS);
session = &slice_data->session
[slice_data->num_of_session];
bson_iter_recurse(&child3_iter, &child4_iter);
while (bson_iter_next(&child4_iter)) {
const char *child4_key =
bson_iter_key(&child4_iter);
if (!strcmp(child4_key, "name") &&
BSON_ITER_HOLDS_UTF8(&child4_iter)) {
utf8 = bson_iter_utf8(
&child4_iter, &length);
session->name = ogs_strndup(utf8, length);
ogs_assert(session->name);
} else if (!strcmp(child4_key, "type") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
session->session_type =
bson_iter_int32(&child4_iter);
} else if (!strcmp(child4_key, "qos") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "index") &&
BSON_ITER_HOLDS_INT32(
&child5_iter)) {
session->qos.index =
bson_iter_int32(&child5_iter);
} else if (!strcmp(child5_key, "arp") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"priority_level") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->qos.arp.
priority_level =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_capability") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->qos.arp.
pre_emption_capability =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"pre_emption_vulnerability") &&
BSON_ITER_HOLDS_INT32(&child4_iter)) {
pdn->qos.arp.pre_emption_vulnerability =
bson_iter_int32(&child4_iter);
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->qos.arp.
pre_emption_vulnerability =
bson_iter_int32(
&child6_iter);
}
}
}
}
} else if (!strcmp(child4_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "downlink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"value") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->ambr.downlink =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"unit") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
unit = bson_iter_int32(
&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.downlink *= 1024;
} else if (!strcmp(child5_key,
"uplink") &&
BSON_ITER_HOLDS_DOCUMENT(
&child5_iter)) {
uint8_t unit = 0;
int n;
bson_iter_recurse(
&child5_iter, &child6_iter);
while (bson_iter_next(
&child6_iter)) {
const char *child6_key =
bson_iter_key(&child6_iter);
if (!strcmp(child6_key,
"value") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
session->ambr.uplink =
bson_iter_int32(
&child6_iter);
} else if (!strcmp(child6_key,
"unit") &&
BSON_ITER_HOLDS_INT32(
&child6_iter)) {
unit = bson_iter_int32(
&child6_iter);
}
}
for (n = 0; n < unit; n++)
session->ambr.uplink *= 1024;
}
}
} else if (!strcmp(child4_key, "smf") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "addr") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->smf_ip.ipv4 = 1;
session->smf_ip.addr =
ipsub.sub[0];
}
} else if (!strcmp(
child5_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->smf_ip.ipv6 = 1;
memcpy(session->smf_ip.addr6,
ipsub.sub,
sizeof(ipsub.sub));
}
}
}
} else if (!strcmp(child4_key, "ue") &&
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
bson_iter_recurse(
&child4_iter, &child5_iter);
while (bson_iter_next(&child5_iter)) {
const char *child5_key =
bson_iter_key(&child5_iter);
if (!strcmp(child5_key, "addr") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->ue_ip.ipv4 = true;
session->ue_ip.addr =
ipsub.sub[0];
}
} else if (!strcmp(
child5_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(
&child5_iter)) {
ogs_ipsubnet_t ipsub;
const char *v = bson_iter_utf8(
&child5_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
session->ue_ip.ipv6 = true;
memcpy(session->ue_ip.addr6,
ipsub.sub, OGS_IPV6_LEN);
}
}
}
}
}
}
} else if (!strcmp(child2_key, "ambr") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "uplink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.uplink =
bson_iter_int64(&child3_iter) * 1024;
} else if (!strcmp(child3_key, "downlink") &&
BSON_ITER_HOLDS_INT64(&child3_iter)) {
pdn->ambr.downlink =
bson_iter_int64(&child3_iter) * 1024;
}
}
} else if (!strcmp(child2_key, "pgw") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "addr") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->pgw_ip.ipv4 = 1;
pdn->pgw_ip.addr = ipsub.sub[0];
}
} else if (!strcmp(child3_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->pgw_ip.ipv6 = 1;
memcpy(pdn->pgw_ip.addr6,
ipsub.sub, sizeof(ipsub.sub));
}
}
}
} else if (!strcmp(child2_key, "ue") &&
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
bson_iter_recurse(&child2_iter, &child3_iter);
while (bson_iter_next(&child3_iter)) {
const char *child3_key =
bson_iter_key(&child3_iter);
if (!strcmp(child3_key, "addr") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->ue_ip.ipv4 = true;
pdn->ue_ip.addr = ipsub.sub[0];
}
} else if (!strcmp(child3_key, "addr6") &&
BSON_ITER_HOLDS_UTF8(&child3_iter)) {
ogs_ipsubnet_t ipsub;
const char *v =
bson_iter_utf8(&child3_iter, &length);
rv = ogs_ipsubnet(&ipsub, v, NULL);
if (rv == OGS_OK) {
pdn->ue_ip.ipv6 = true;
memcpy(pdn->ue_ip.addr6,
ipsub.sub, OGS_IPV6_LEN);
}
}
slice_data->num_of_session++;
}
}
}
pdn_index++;
subscription_data->num_of_slice++;
}
subscription_data->num_of_pdn = pdn_index;
}
}

View File

@ -147,16 +147,16 @@ int ogs_gtp_paa_to_ip(ogs_paa_t *paa, ogs_ip_t *ip)
memset(ip, 0, sizeof *ip);
if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
ip->ipv4 = 1;
ip->addr = paa->both.addr;
ip->ipv6 = 1;
memcpy(ip->addr6, paa->both.addr6, OGS_IPV6_LEN);
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4) {
ip->ipv4 = 1;
ip->ipv6 = 0;
ip->addr = paa->addr;
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV6) {
ip->ipv4 = 0;
ip->ipv6 = 1;
memcpy(ip->addr6, paa->addr6, OGS_IPV6_LEN);

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.448896 by acetcom
* Created on: 2021-02-22 09:29:55.336137 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.459717 by acetcom
* Created on: 2021-02-22 09:29:55.346343 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.431932 by acetcom
* Created on: 2021-02-22 09:29:55.319953 by acetcom
* from 24501-g41.docx
******************************************************************************/
@ -2987,8 +2987,8 @@ int ogs_nas_5gs_decode_session_ambr(ogs_nas_session_ambr_t *session_ambr, ogs_pk
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(session_ambr, pkbuf->data - size, size);
session_ambr->downlink.bitrate = be16toh(source->downlink.bitrate);
session_ambr->uplink.bitrate = be16toh(source->uplink.bitrate);
session_ambr->downlink.value = be16toh(source->downlink.value);
session_ambr->uplink.value = be16toh(source->uplink.value);
ogs_trace(" SESSION_AMBR - ");
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
@ -3002,8 +3002,8 @@ int ogs_nas_5gs_encode_session_ambr(ogs_pkbuf_t *pkbuf, ogs_nas_session_ambr_t *
ogs_nas_session_ambr_t target;
memcpy(&target, session_ambr, sizeof(ogs_nas_session_ambr_t));
target.downlink.bitrate = htobe16(session_ambr->downlink.bitrate);
target.uplink.bitrate = htobe16(session_ambr->uplink.bitrate);
target.downlink.value = htobe16(session_ambr->downlink.value);
target.uplink.value = htobe16(session_ambr->uplink.value);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &target, size);

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.429071 by acetcom
* Created on: 2021-02-22 09:29:55.317282 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -28,7 +28,7 @@
/*******************************************************************************
* This file had been created by nas-message.py script v0.2.0
* Please do not modify this file but regenerate it via script.
* Created on: 2020-06-30 08:13:45.441307 by acetcom
* Created on: 2021-02-22 09:29:55.328800 by acetcom
* from 24501-g41.docx
******************************************************************************/

View File

@ -38,12 +38,12 @@ type_list["DNN"]["encode"] = \
" size = target.length + sizeof(target.length);\n\n"
type_list["Session-AMBR"]["decode"] = \
" session_ambr->downlink.bitrate = be16toh(source->downlink.bitrate);\n" \
" session_ambr->uplink.bitrate = be16toh(source->uplink.bitrate);\n\n"
" session_ambr->downlink.value = be16toh(source->downlink.value);\n" \
" session_ambr->uplink.value = be16toh(source->uplink.value);\n\n"
type_list["Session-AMBR"]["encode"] = \
" target.downlink.bitrate = htobe16(session_ambr->downlink.bitrate);\n" \
" target.uplink.bitrate = htobe16(session_ambr->uplink.bitrate);\n\n"
" target.downlink.value = htobe16(session_ambr->downlink.value);\n" \
" target.uplink.value = htobe16(session_ambr->uplink.value);\n\n"
type_list["Uplink data status"]["decode"] = \
" uplink_data_status->psi = be16toh(uplink_data_status->psi);\n\n"

View File

@ -92,30 +92,42 @@ void ogs_nas_5gs_tai_list_build(
}
void ogs_nas_build_s_nssai(
ogs_nas_s_nssai_t *nas_s_nssai, ogs_s_nssai_t *s_nssai)
ogs_nas_s_nssai_t *nas_s_nssai, ogs_nas_s_nssai_ie_t *nas_s_nssai_ie)
{
int pos;
ogs_uint24_t v;
ogs_assert(nas_s_nssai);
ogs_assert(s_nssai);
ogs_assert(nas_s_nssai_ie);
pos = 0;
if (s_nssai->sst)
nas_s_nssai->buffer[pos++] = s_nssai->sst;
if (nas_s_nssai_ie->sst)
nas_s_nssai->buffer[pos++] = nas_s_nssai_ie->sst;
if (s_nssai->sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
v = ogs_htobe24(s_nssai->sd);
if (nas_s_nssai_ie->sd.v != OGS_S_NSSAI_NO_SD_VALUE ||
/*
* If the SST encoded in octet 3 is not associated
* with a valid SD value, and the sender needs to include
* a mapped HPLMN SST (octet 7) and a mapped HPLMN SD (octets 8 to 10),
* then the sender shall set the SD value (octets 4 to 6) to
* "no SD value associated with the SST".
*/
(nas_s_nssai_ie->sd.v == OGS_S_NSSAI_NO_SD_VALUE &&
nas_s_nssai_ie->mapped_hplmn_sst &&
nas_s_nssai_ie->mapped_hplmn_sd.v != OGS_S_NSSAI_NO_SD_VALUE)) {
v = ogs_htobe24(nas_s_nssai_ie->sd);
memcpy(nas_s_nssai->buffer+pos, &v, 3);
pos += 3;
}
if (s_nssai->mapped_hplmn_sst)
nas_s_nssai->buffer[pos++] = s_nssai->mapped_hplmn_sst;
if (nas_s_nssai_ie->mapped_hplmn_sst)
nas_s_nssai->buffer[pos++] = nas_s_nssai_ie->mapped_hplmn_sst;
if (s_nssai->mapped_hplmn_sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
v = ogs_htobe24(s_nssai->mapped_hplmn_sd);
if (nas_s_nssai_ie->mapped_hplmn_sd.v != OGS_S_NSSAI_NO_SD_VALUE) {
v = ogs_htobe24(nas_s_nssai_ie->mapped_hplmn_sd);
memcpy(nas_s_nssai->buffer+pos, &v, 3);
pos += 3;
}
@ -123,19 +135,39 @@ void ogs_nas_build_s_nssai(
nas_s_nssai->length = pos;
}
void ogs_nas_build_s_nssai2(
ogs_nas_s_nssai_t *nas_s_nssai,
ogs_s_nssai_t *s_nssai, ogs_s_nssai_t *mapped_hplmn)
{
ogs_nas_s_nssai_ie_t ie;
ogs_assert(nas_s_nssai);
ogs_assert(s_nssai);
ogs_assert(mapped_hplmn);
memset(&ie, 0, sizeof(ie));
ie.sst = s_nssai->sst;
ie.sd.v = s_nssai->sd.v;
ie.mapped_hplmn_sst = mapped_hplmn->sst;
ie.mapped_hplmn_sd.v = mapped_hplmn->sd.v;
ogs_nas_build_s_nssai(nas_s_nssai, &ie);
}
int ogs_nas_parse_s_nssai(
ogs_s_nssai_t *s_nssai, ogs_nas_s_nssai_t *nas_s_nssai)
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_s_nssai_t *nas_s_nssai)
{
ogs_uint24_t v;
int pos = 0;
bool sst, sd, mapped_hplmn_sst, mapped_hplmn_sd;
ogs_assert(nas_s_nssai);
ogs_assert(s_nssai);
ogs_assert(nas_s_nssai_ie);
memset(s_nssai, 0, sizeof(*s_nssai));
s_nssai->sd.v = OGS_S_NSSAI_NO_SD_VALUE;
s_nssai->mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE;
memset(nas_s_nssai_ie, 0, sizeof(*nas_s_nssai_ie));
nas_s_nssai_ie->sd.v = OGS_S_NSSAI_NO_SD_VALUE;
nas_s_nssai_ie->mapped_hplmn_sd.v = OGS_S_NSSAI_NO_SD_VALUE;
if (nas_s_nssai->length == OGS_NAS_S_NSSAI_SST_LEN) {
sst = true;
@ -174,20 +206,20 @@ int ogs_nas_parse_s_nssai(
pos = 0;
if (sst)
s_nssai->sst = nas_s_nssai->buffer[pos++];
nas_s_nssai_ie->sst = nas_s_nssai->buffer[pos++];
if (sd) {
memcpy(&v, nas_s_nssai->buffer+pos, 3);
s_nssai->sd = ogs_htobe24(v);
nas_s_nssai_ie->sd = ogs_htobe24(v);
pos += 3;
}
if (mapped_hplmn_sst)
s_nssai->mapped_hplmn_sst = nas_s_nssai->buffer[pos++];
nas_s_nssai_ie->mapped_hplmn_sst = nas_s_nssai->buffer[pos++];
if (mapped_hplmn_sd) {
memcpy(&v, nas_s_nssai->buffer+pos, 3);
s_nssai->mapped_hplmn_sd = ogs_htobe24(v);
nas_s_nssai_ie->mapped_hplmn_sd = ogs_htobe24(v);
pos += 3;
}
@ -195,18 +227,18 @@ int ogs_nas_parse_s_nssai(
}
void ogs_nas_build_nssai(ogs_nas_nssai_t *nas_nssai,
ogs_s_nssai_t *s_nssai, int num_of_s_nssai)
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, int num_of_nas_s_nssai_ie)
{
int i;
ogs_nas_s_nssai_t nas_s_nssai;
ogs_assert(nas_nssai);
ogs_assert(s_nssai);
ogs_assert(num_of_s_nssai);
ogs_assert(nas_s_nssai_ie);
ogs_assert(num_of_nas_s_nssai_ie);
for (i = 0; i < num_of_s_nssai; i++) {
for (i = 0; i < num_of_nas_s_nssai_ie; i++) {
if (nas_nssai->length < OGS_NAS_MAX_NSSAI_LEN) {
ogs_nas_build_s_nssai(&nas_s_nssai, s_nssai + i);
ogs_nas_build_s_nssai(&nas_s_nssai, nas_s_nssai_ie + i);
memcpy(nas_nssai->buffer + nas_nssai->length, &nas_s_nssai,
sizeof(nas_s_nssai.length) + nas_s_nssai.length);
nas_nssai->length +=
@ -215,13 +247,14 @@ void ogs_nas_build_nssai(ogs_nas_nssai_t *nas_nssai,
}
}
int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
int ogs_nas_parse_nssai(
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_nssai_t *nas_nssai)
{
int num_of_s_nssai = 0;
int num_of_nas_s_nssai_ie = 0;
int pos = 0, len;
ogs_assert(nas_nssai);
ogs_assert(s_nssai);
ogs_assert(nas_s_nssai_ie);
if (!nas_nssai->length) {
ogs_error("No NSSAI [%p:%d]", nas_nssai->buffer, nas_nssai->length);
@ -229,9 +262,9 @@ int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
}
while (pos < nas_nssai->length &&
num_of_s_nssai < OGS_MAX_NUM_OF_S_NSSAI) {
num_of_nas_s_nssai_ie < OGS_MAX_NUM_OF_SLICE) {
len = ogs_nas_parse_s_nssai(s_nssai + num_of_s_nssai,
len = ogs_nas_parse_s_nssai(nas_s_nssai_ie + num_of_nas_s_nssai_ie,
(ogs_nas_s_nssai_t *)(nas_nssai->buffer + pos));
if (len == 0) {
ogs_error("Cannot parse NSSAI [%d]", nas_nssai->length);
@ -240,10 +273,97 @@ int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
pos += len;
num_of_s_nssai++;
num_of_nas_s_nssai_ie++;
}
return num_of_s_nssai;
return num_of_nas_s_nssai_ie;
}
void ogs_nas_build_rejected_nssai(
ogs_nas_rejected_nssai_t *rejected_nssai,
ogs_nas_rejected_s_nssai_t *rejected_s_nssai,
int num_of_rejected_s_nssai)
{
int i;
ogs_assert(rejected_nssai);
ogs_assert(rejected_s_nssai);
ogs_assert(num_of_rejected_s_nssai);
for (i = 0; i < num_of_rejected_s_nssai; i++) {
if (rejected_nssai->length < OGS_NAS_MAX_REJECTED_NSSAI_LEN) {
memcpy(rejected_nssai->buffer + rejected_nssai->length,
rejected_s_nssai + i, 1);
rejected_nssai->length += 1;
ogs_assert(
rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4);
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
rejected_nssai->buffer[rejected_nssai->length] =
rejected_s_nssai[i].sst;
rejected_nssai->length += 1;
}
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
ogs_uint24_t v;
v = ogs_htobe24(rejected_s_nssai[i].sd);
memcpy(rejected_nssai->buffer + rejected_nssai->length, &v, 3);
rejected_nssai->length += 3;
}
}
}
}
int ogs_nas_parse_rejected_nssai(
ogs_nas_rejected_s_nssai_t *rejected_s_nssai,
ogs_nas_rejected_nssai_t *rejected_nssai)
{
int i, pos;
ogs_assert(rejected_nssai);
ogs_assert(rejected_s_nssai);
if (!rejected_nssai->length) {
ogs_error("No NSSAI [%p:%d]",
rejected_nssai->buffer, rejected_nssai->length);
return OGS_ERROR;
}
i = 0;
pos = 0;
while (pos < rejected_nssai->length && i < OGS_MAX_NUM_OF_SLICE) {
ogs_assert((pos + 1) <= rejected_nssai->length);
memcpy(rejected_s_nssai + i, rejected_nssai->buffer + pos, 1);
pos += 1;
ogs_assert(
rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4);
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 1 ||
rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
ogs_assert((pos + 1) <= rejected_nssai->length);
rejected_s_nssai[i].sst = rejected_nssai->buffer[pos];
pos += 1;
}
if (rejected_s_nssai[i].length_of_rejected_s_nssai == 4) {
ogs_uint24_t v;
ogs_assert((pos + 3) <= rejected_nssai->length);
memcpy(&v, rejected_nssai->buffer + pos, 3);
rejected_s_nssai[i].sd = ogs_be24toh(v);
pos += 3;
}
i++;
}
return i;
}
void ogs_nas_build_qos_flow_descriptions(
@ -290,7 +410,7 @@ void ogs_nas_build_qos_flow_descriptions(
ogs_assert(target.param[j].len == 1);
ogs_assert(length + target.param[j].len <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
memcpy(buffer + length, &target.param[j].qci,
memcpy(buffer + length, &target.param[j].qos_index,
target.param[j].len);
length += target.param[j].len;
break;
@ -302,8 +422,8 @@ void ogs_nas_build_qos_flow_descriptions(
ogs_assert(target.param[j].len == 3);
ogs_assert(length + target.param[j].len <=
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
target.param[j].br.bitrate =
htobe16(target.param[j].br.bitrate);
target.param[j].br.value =
htobe16(target.param[j].br.value);
memcpy(buffer + length, &target.param[j].br,
target.param[j].len);
length += target.param[j].len;

View File

@ -62,10 +62,20 @@ typedef struct ogs_nas_s_nssai_s {
uint8_t buffer[OGS_NAS_S_NSSAI_SST_SD_AND_MAPPED_HPLMN_SST_SD_LEN];
} __attribute__ ((packed)) ogs_nas_s_nssai_t;
typedef struct ogs_nas_s_nssai_ie_s {
uint8_t sst;
ogs_uint24_t sd;
uint8_t mapped_hplmn_sst;
ogs_uint24_t mapped_hplmn_sd;
} __attribute__ ((packed)) ogs_nas_s_nssai_ie_t;
void ogs_nas_build_s_nssai(
ogs_nas_s_nssai_t *nas_s_nssai, ogs_s_nssai_t *s_nssai);
ogs_nas_s_nssai_t *nas_s_nssai, ogs_nas_s_nssai_ie_t *nas_s_nssai_ie);
void ogs_nas_build_s_nssai2(
ogs_nas_s_nssai_t *nas_s_nssai,
ogs_s_nssai_t *s_nssai, ogs_s_nssai_t *mapped_hplmn);
int ogs_nas_parse_s_nssai(
ogs_s_nssai_t *s_nssai, ogs_nas_s_nssai_t *nas_s_nssai);
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_s_nssai_t *nas_s_nssai);
/* 9.11.3.1 5GMM capability
* O TLV 3-15 */
typedef struct ogs_nas_5gmm_capability_s {
@ -443,8 +453,9 @@ typedef struct ogs_nas_nssai_s {
} __attribute__ ((packed)) ogs_nas_nssai_t;
void ogs_nas_build_nssai(ogs_nas_nssai_t *nas_nssai,
ogs_s_nssai_t *s_nssai, int num_of_s_nssai);
int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai);
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, int num_of_nas_s_nssai_ie);
int ogs_nas_parse_nssai(
ogs_nas_s_nssai_ie_t *nas_s_nssai_ie, ogs_nas_nssai_t *nas_nssai);
/* 9.11.3.37A NSSAI inclusion mode
* O TV 1 */
@ -513,6 +524,24 @@ typedef struct ogs_nas_rejected_nssai_s {
char buffer[OGS_NAS_MAX_REJECTED_NSSAI_LEN];
} ogs_nas_rejected_nssai_t;
typedef struct ogs_nas_rejected_s_nssai_s {
#define OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_IN_PLMN 0
#define OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_IN_TAI 1
#define OGS_NAS_REJECTED_S_NSSAI_NOT_AVIALABLE_DUE_TO_AUTH_FAILURE 22
ED2(uint8_t length_of_rejected_s_nssai:4;,
uint8_t cause_value:4;)
uint8_t sst;
ogs_uint24_t sd;
} __attribute__ ((packed)) ogs_nas_rejected_s_nssai_t;
void ogs_nas_build_rejected_nssai(
ogs_nas_rejected_nssai_t *nas_rejected_nssai,
ogs_nas_rejected_s_nssai_t *nas_rejected_s_nssai,
int num_of_nas_rejected_s_nssai);
int ogs_nas_parse_rejected_nssai(
ogs_nas_rejected_s_nssai_t *nas_rejected_s_nssai,
ogs_nas_rejected_nssai_t *nas_rejected_nssai);
/* 9.11.3.49 Service area list
* O TLV 6-114 */
#define OGS_NAS_MAX_SERVICE_AREA_LIST_LEN 112
@ -708,7 +737,7 @@ typedef struct ogs_nas_qos_flow_parameter_s {
uint8_t identifier;
uint8_t len;
union {
uint8_t qci;
uint8_t qos_index;
ogs_nas_bitrate_t br;
};
} ogs_nas_qos_flow_parameter_t;

View File

@ -444,5 +444,5 @@ void ogs_nas_bitrate_from_uint64(ogs_nas_bitrate_t *nas, uint64_t bitrate)
}
bitrate >>= 2;
}
nas->bitrate = bitrate;
nas->value = bitrate;
}

View File

@ -951,7 +951,7 @@ ED8(uint8_t ebi15:1;,
#define OGS_NAS_BR_UNIT_256P 25
typedef struct ogs_nas_bitrate_s {
uint8_t unit;
uint16_t bitrate;
uint16_t value;
} __attribute__ ((packed)) ogs_nas_bitrate_t;
void ogs_nas_bitrate_from_uint64(

View File

@ -231,7 +231,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@ -292,9 +292,9 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
NULL, self.pfcp_port);
ogs_assert(rv == OGS_OK);
}
} else if (!strcmp(local_key, "pdn")) {
ogs_yaml_iter_t pdn_array, pdn_iter;
ogs_yaml_iter_recurse(&local_iter, &pdn_array);
} else if (!strcmp(local_key, "subnet")) {
ogs_yaml_iter_t subnet_array, subnet_iter;
ogs_yaml_iter_recurse(&local_iter, &subnet_array);
do {
ogs_pfcp_subnet_t *subnet = NULL;
@ -306,41 +306,41 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
const char *high[MAX_NUM_OF_SUBNET_RANGE];
int i, num = 0;
if (ogs_yaml_iter_type(&pdn_array) ==
if (ogs_yaml_iter_type(&subnet_array) ==
YAML_MAPPING_NODE) {
memcpy(&pdn_iter, &pdn_array,
memcpy(&subnet_iter, &subnet_array,
sizeof(ogs_yaml_iter_t));
} else if (ogs_yaml_iter_type(&pdn_array) ==
} else if (ogs_yaml_iter_type(&subnet_array) ==
YAML_SEQUENCE_NODE) {
if (!ogs_yaml_iter_next(&pdn_array))
if (!ogs_yaml_iter_next(&subnet_array))
break;
ogs_yaml_iter_recurse(&pdn_array, &pdn_iter);
} else if (ogs_yaml_iter_type(&pdn_array) ==
ogs_yaml_iter_recurse(&subnet_array, &subnet_iter);
} else if (ogs_yaml_iter_type(&subnet_array) ==
YAML_SCALAR_NODE) {
break;
} else
ogs_assert_if_reached();
while (ogs_yaml_iter_next(&pdn_iter)) {
const char *pdn_key = ogs_yaml_iter_key(&pdn_iter);
ogs_assert(pdn_key);
if (!strcmp(pdn_key, "addr")) {
while (ogs_yaml_iter_next(&subnet_iter)) {
const char *subnet_key = ogs_yaml_iter_key(&subnet_iter);
ogs_assert(subnet_key);
if (!strcmp(subnet_key, "addr")) {
char *v =
(char *)ogs_yaml_iter_value(&pdn_iter);
(char *)ogs_yaml_iter_value(&subnet_iter);
if (v) {
ipstr = (const char *)strsep(&v, "/");
if (ipstr) {
mask_or_numbits = (const char *)v;
}
}
} else if (!strcmp(pdn_key, "apn") ||
!strcmp(pdn_key, "dnn")) {
dnn = ogs_yaml_iter_value(&pdn_iter);
} else if (!strcmp(pdn_key, "dev")) {
dev = ogs_yaml_iter_value(&pdn_iter);
} else if (!strcmp(pdn_key, "range")) {
} else if (!strcmp(subnet_key, "apn") ||
!strcmp(subnet_key, "dnn")) {
dnn = ogs_yaml_iter_value(&subnet_iter);
} else if (!strcmp(subnet_key, "dev")) {
dev = ogs_yaml_iter_value(&subnet_iter);
} else if (!strcmp(subnet_key, "range")) {
ogs_yaml_iter_t range_iter;
ogs_yaml_iter_recurse(&pdn_iter, &range_iter);
ogs_yaml_iter_recurse(&subnet_iter, &range_iter);
ogs_assert(ogs_yaml_iter_type(&range_iter) !=
YAML_MAPPING_NODE);
do {
@ -355,7 +355,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
v = (char *)
ogs_yaml_iter_value(&range_iter);
if (v) {
ogs_assert(num <=
ogs_assert(num <
MAX_NUM_OF_SUBNET_RANGE);
low[num] =
(const char *)strsep(&v, "-");
@ -372,7 +372,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
ogs_yaml_iter_type(&range_iter) ==
YAML_SEQUENCE_NODE);
} else
ogs_warn("unknown key `%s`", pdn_key);
ogs_warn("unknown key `%s`", subnet_key);
}
subnet = ogs_pfcp_subnet_add(
@ -385,7 +385,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
subnet->range[i].high = high[i];
}
} while (ogs_yaml_iter_type(&pdn_array) ==
} while (ogs_yaml_iter_type(&subnet_array) ==
YAML_SEQUENCE_NODE);
}
}
@ -462,7 +462,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@ -480,7 +480,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_tac <=
ogs_assert(num_of_tac <
OGS_MAX_NUM_OF_TAI);
if (ogs_yaml_iter_type(&tac_iter) ==
YAML_SEQUENCE_NODE) {
@ -506,7 +506,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_dnn <=
ogs_assert(num_of_dnn <
OGS_MAX_NUM_OF_DNN);
if (ogs_yaml_iter_type(&dnn_iter) ==
YAML_SEQUENCE_NODE) {
@ -532,7 +532,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_e_cell_id <=
ogs_assert(num_of_e_cell_id <
OGS_MAX_NUM_OF_ENB_ID);
if (ogs_yaml_iter_type(&e_cell_id_iter) ==
YAML_SEQUENCE_NODE) {
@ -560,7 +560,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
do {
const char *v = NULL;
ogs_assert(num_of_nr_cell_id <=
ogs_assert(num_of_nr_cell_id <
OGS_MAX_NUM_OF_ENB_ID);
if (ogs_yaml_iter_type(&nr_cell_id_iter) ==
YAML_SEQUENCE_NODE) {
@ -1555,7 +1555,7 @@ ogs_pfcp_ue_ip_t *ogs_pfcp_ue_ip_alloc(
ogs_error("CHECK CONFIGURATION: Cannot find subnet [family:%d, dnn:%s]",
family, dnn ? dnn : "No DNN");
ogs_error("smf");
ogs_error(" pdn:");
ogs_error(" subnet:");
if (family == AF_INET)
ogs_error(" - addr: 10.45.0.1/16");
else if (family == AF_INET6)

View File

@ -331,18 +331,18 @@ int ogs_pfcp_paa_to_ue_ip_addr(
memset(addr, 0, sizeof *addr);
if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4V6) {
if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4V6) {
addr->ipv4 = 1;
addr->both.addr = paa->both.addr;
addr->ipv6 = 1;
memcpy(addr->both.addr6, paa->both.addr6, OGS_IPV6_LEN);
*len = OGS_IPV4V6_LEN + hdr_len;
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV4) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV4) {
addr->ipv4 = 1;
addr->ipv6 = 0;
addr->addr = paa->addr;
*len = OGS_IPV4_LEN + hdr_len;
} else if (paa->pdn_type == OGS_GTP_PDN_TYPE_IPV6) {
} else if (paa->session_type == OGS_PDU_SESSION_TYPE_IPV6) {
addr->ipv4 = 0;
addr->ipv6 = 1;
memcpy(addr->addr6, paa->addr6, OGS_IPV6_LEN);

View File

@ -26,6 +26,8 @@ static OGS_POOL(nf_instance_pool, ogs_sbi_nf_instance_t);
static OGS_POOL(nf_service_pool, ogs_sbi_nf_service_t);
static OGS_POOL(xact_pool, ogs_sbi_xact_t);
static OGS_POOL(subscription_pool, ogs_sbi_subscription_t);
static OGS_POOL(smf_info_pool, ogs_sbi_smf_info_t);
static OGS_POOL(nf_info_pool, ogs_sbi_nf_info_t);
static ogs_sbi_context_t self;
@ -54,6 +56,10 @@ void ogs_sbi_context_init(void)
ogs_list_init(&self.subscription_list);
ogs_pool_init(&subscription_pool, ogs_app()->pool.nf_subscription);
ogs_pool_init(&smf_info_pool, ogs_app()->pool.nf);
ogs_pool_init(&nf_info_pool, ogs_app()->pool.nf * OGS_MAX_NUM_OF_NF_INFO);
ogs_uuid_get(&self.uuid);
ogs_uuid_format(self.nf_instance_id, &self.uuid);
@ -70,8 +76,14 @@ void ogs_sbi_context_final(void)
ogs_pool_final(&xact_pool);
ogs_sbi_nf_instance_remove_all();
ogs_sbi_nf_info_remove_all(&self.nf_info_list);
ogs_pool_final(&nf_instance_pool);
ogs_pool_final(&nf_service_pool);
ogs_pool_final(&smf_info_pool);
ogs_pool_final(&nf_info_pool);
ogs_sbi_client_final();
ogs_sbi_server_final();
@ -191,7 +203,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@ -360,7 +372,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
break;
}
ogs_assert(num <= OGS_MAX_NUM_OF_HOSTNAME);
ogs_assert(num < OGS_MAX_NUM_OF_HOSTNAME);
hostname[num++] =
ogs_yaml_iter_value(&hostname_iter);
} while (
@ -499,6 +511,8 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
ogs_trace("ogs_sbi_nf_instance_remove()");
ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance);
ogs_sbi_nf_info_remove_all(&nf_instance->nf_info_list);
ogs_sbi_subscription_remove_all_by_nf_instance_id(nf_instance->id);
ogs_sbi_nf_service_remove_all(nf_instance);
@ -690,6 +704,72 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_name(
return nf_service;
}
ogs_sbi_nf_info_t *ogs_sbi_nf_info_add(
ogs_list_t *list, OpenAPI_nf_type_e nf_type)
{
ogs_sbi_nf_info_t *nf_info = NULL;
ogs_assert(list);
ogs_assert(nf_type);
ogs_pool_alloc(&nf_info_pool, &nf_info);
ogs_assert(nf_info);
memset(nf_info, 0, sizeof(*nf_info));
nf_info->nf_type = nf_type;
ogs_list_add(list, nf_info);
return nf_info;
}
static void smf_info_free(ogs_sbi_smf_info_t *smf_info)
{
int i, j;
ogs_assert(smf_info);
for (i = 0; i < smf_info->num_of_slice; i++) {
for (j = 0; j < smf_info->slice[i].num_of_dnn; j++)
ogs_free(smf_info->slice[i].dnn[j]);
smf_info->slice[i].num_of_dnn = 0;
}
smf_info->num_of_slice = 0;
smf_info->num_of_nr_tai = 0;
smf_info->num_of_nr_tai_range = 0;
ogs_pool_free(&smf_info_pool, smf_info);
}
void ogs_sbi_nf_info_remove(ogs_list_t *list, ogs_sbi_nf_info_t *nf_info)
{
ogs_assert(list);
ogs_assert(nf_info);
ogs_list_remove(list, nf_info);
switch(nf_info->nf_type) {
case OpenAPI_nf_type_SMF:
smf_info_free(&nf_info->smf);
break;
default:
ogs_fatal("Not implemented NF-type[%s]",
OpenAPI_nf_type_ToString(nf_info->nf_type));
ogs_assert_if_reached();
}
ogs_pool_free(&nf_info_pool, nf_info);
}
void ogs_sbi_nf_info_remove_all(ogs_list_t *list)
{
ogs_sbi_nf_info_t *nf_info = NULL, *next_nf_info = NULL;
ogs_assert(list);
ogs_list_for_each_safe(list, next_nf_info, nf_info)
ogs_sbi_nf_info_remove(list, nf_info);
}
void ogs_sbi_nf_instance_build_default(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type)
{
@ -730,6 +810,9 @@ void ogs_sbi_nf_instance_build_default(
if (hostname)
strcpy(nf_instance->fqdn, hostname);
nf_instance->time.heartbeat_interval =
ogs_app()->time.nf_instance.heartbeat_interval;
}
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
@ -893,48 +976,34 @@ static void nf_service_associate_client_all(ogs_sbi_nf_instance_t *nf_instance)
nf_service_associate_client(nf_service);
}
bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
OpenAPI_nf_type_e nf_type, void *state)
void ogs_sbi_select_nrf(ogs_sbi_object_t *sbi_object, void *state)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
if (nf_type == OpenAPI_nf_type_NRF) {
nf_instance = ogs_sbi_nf_instance_find(ogs_sbi_self()->nf_instance_id);
if (nf_instance) {
if (OGS_FSM_CHECK(&nf_instance->sm, state)) {
if (OGS_SBI_NF_INSTANCE_GET(
nf_type_array, OpenAPI_nf_type_NRF)) {
ogs_warn("UE %s-EndPoint updated [%s]",
OpenAPI_nf_type_ToString(OpenAPI_nf_type_NRF),
nf_instance->id);
ogs_sbi_nf_instance_remove(
nf_type_array[OpenAPI_nf_type_NRF].nf_instance);
}
OGS_SETUP_SBI_NF_INSTANCE(
&nf_type_array[OpenAPI_nf_type_NRF], nf_instance);
return true;
}
}
}
ogs_assert(sbi_object);
/* SELF NF Instace is used for NRF Instance */
nf_instance = ogs_sbi_nf_instance_find(ogs_sbi_self()->nf_instance_id);
if (nf_instance && OGS_FSM_CHECK(&nf_instance->sm, state))
OGS_SBI_SETUP_NF(sbi_object, OpenAPI_nf_type_NRF, nf_instance);
}
void ogs_sbi_select_first_nf(
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_assert(sbi_object);
ogs_assert(nf_type);
ogs_assert(state);
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (nf_instance->nf_type == nf_type) {
if (OGS_FSM_CHECK(&nf_instance->sm, state)) {
if (OGS_SBI_NF_INSTANCE_GET(nf_type_array, nf_type)) {
ogs_warn("%s-EndPoint updated [%s]",
OpenAPI_nf_type_ToString(nf_type),
nf_instance->id);
ogs_sbi_nf_instance_remove(
nf_type_array[nf_type].nf_instance);
}
OGS_SETUP_SBI_NF_INSTANCE(
&nf_type_array[nf_type], nf_instance);
return true;
}
if (OGS_FSM_CHECK(&nf_instance->sm, state) &&
nf_instance->nf_type == nf_type) {
OGS_SBI_SETUP_NF(sbi_object, nf_type, nf_instance);
break;
}
}
return false;
}
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
@ -983,19 +1052,6 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
return nf_instance->client;
}
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type(
OpenAPI_nf_type_e nf_type)
{
ogs_sbi_nf_instance_t *nf_instance = NULL;
ogs_list_for_each(&ogs_sbi_self()->nf_instance_list, nf_instance) {
if (nf_instance->nf_type == nf_type)
break;
}
return nf_instance;
}
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
{
int i;
@ -1006,9 +1062,8 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
ogs_error("SBI running [%d]", ogs_list_count(&sbi_object->xact_list));
for (i = 0; i < OGS_SBI_MAX_NF_TYPE; i++) {
if (sbi_object->nf_type_array[i].nf_instance)
ogs_sbi_nf_instance_remove(
sbi_object->nf_type_array[i].nf_instance);
if (OGS_SBI_NF_INSTANCE(sbi_object, i))
ogs_sbi_nf_instance_remove(OGS_SBI_NF_INSTANCE(sbi_object, i));
}
}

View File

@ -30,7 +30,11 @@ extern "C" {
#define OGS_SBI_MAX_NF_TYPE 64
#define OGS_MAX_NUM_OF_NF_INFO 8
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
typedef struct ogs_sbi_smf_info_s ogs_sbi_smf_info_t;
typedef struct ogs_sbi_context_s {
uint32_t http_port; /* SBI HTTP local port */
uint32_t https_port; /* SBI HTTPS local port */
@ -44,16 +48,17 @@ typedef struct ogs_sbi_context_s {
ogs_list_t nf_instance_list;
ogs_list_t subscription_list;
ogs_list_t nf_info_list;
const char *content_encoding;
} ogs_sbi_context_t;
#define OGS_SETUP_SBI_NF_INSTANCE(__cTX, __pNF_INSTANCE) \
do { \
ogs_assert((__cTX)); \
ogs_assert((__pNF_INSTANCE)); \
if ((__cTX)->nf_instance != __pNF_INSTANCE) \
if ((__cTX) != __pNF_INSTANCE) \
__pNF_INSTANCE->reference_count++; \
(__cTX)->nf_instance = __pNF_INSTANCE; \
(__cTX) = __pNF_INSTANCE; \
ogs_trace("nf_instance->reference_count = %d", \
__pNF_INSTANCE->reference_count); \
} while(0)
@ -95,11 +100,11 @@ typedef struct ogs_sbi_nf_instance_s {
void *client; /* only used in CLIENT */
unsigned int reference_count; /* reference count for memory free */
ogs_list_t nf_info_list;
OpenAPI_nf_profile_t *nf_profile; /* stored NF Profile */
} ogs_sbi_nf_instance_t;
#define OGS_SBI_NF_INSTANCE_GET(__aRRAY, __nFType) \
((__aRRAY)[__nFType].nf_instance)
typedef struct ogs_sbi_nf_type_array_s {
ogs_sbi_nf_instance_t *nf_instance;
} ogs_sbi_nf_type_array_t[OGS_SBI_MAX_NF_TYPE];
@ -193,6 +198,41 @@ typedef struct ogs_sbi_subscription_s {
void *client; /* only used in SERVER */
} ogs_sbi_subscription_t;
typedef struct ogs_sbi_smf_info_s {
int num_of_slice;
struct {
ogs_s_nssai_t s_nssai;
int num_of_dnn;
char *dnn[OGS_MAX_NUM_OF_DNN];
} slice[OGS_MAX_NUM_OF_SLICE];
int num_of_nr_tai;
ogs_5gs_tai_t nr_tai[OGS_MAX_NUM_OF_TAI];
int num_of_nr_tai_range;
struct {
ogs_plmn_id_t plmn_id;
/*
* TS29.510 6.1.6.2.28 Type: TacRange
*
* Either the start and end attributes, or
* the pattern attribute, shall be present.
*/
int num_of_tac_range;
ogs_uint24_t start[OGS_MAX_NUM_OF_TAI], end[OGS_MAX_NUM_OF_TAI];
} nr_tai_range[OGS_MAX_NUM_OF_TAI];
} ogs_sbi_smf_info_t;
typedef struct ogs_sbi_nf_info_s {
ogs_lnode_t lnode;
OpenAPI_nf_type_e nf_type;
union {
ogs_sbi_smf_info_t smf;
};
} ogs_sbi_nf_info_t;
void ogs_sbi_context_init(void);
void ogs_sbi_context_final(void);
ogs_sbi_context_t *ogs_sbi_self(void);
@ -203,8 +243,6 @@ void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nf_instance_remove_all(void);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id);
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type(
OpenAPI_nf_type_e nf_type);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(ogs_sbi_nf_instance_t *nf_instance,
char *id, char *name, OpenAPI_uri_scheme_e scheme);
@ -218,6 +256,11 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_id(
ogs_sbi_nf_service_t *ogs_sbi_nf_service_find_by_name(
ogs_sbi_nf_instance_t *nf_instance, char *name);
ogs_sbi_nf_info_t *ogs_sbi_nf_info_add(
ogs_list_t *list, OpenAPI_nf_type_e nf_type);
void ogs_sbi_nf_info_remove(ogs_list_t *list, ogs_sbi_nf_info_t *nf_info);
void ogs_sbi_nf_info_remove_all(ogs_list_t *list);
void ogs_sbi_nf_instance_build_default(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type);
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
@ -227,8 +270,36 @@ ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
ogs_sbi_nf_instance_t *nf_instance, char *name, char *version);
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
OpenAPI_nf_type_e nf_type, void *state);
#define OGS_SBI_NF_INSTANCE(__sBIObject, __nFType) \
(((__sBIObject)->nf_type_array)[__nFType].nf_instance)
#define OGS_SBI_SETUP_NF(__sBIObject, __nFType, __nFInstance) \
do { \
ogs_assert((__sBIObject)); \
ogs_assert((__nFType)); \
ogs_assert((__nFInstance)); \
\
if (OGS_SBI_NF_INSTANCE((__sBIObject), (__nFType))) { \
ogs_warn("UE %s-EndPoint updated [%s]", \
OpenAPI_nf_type_ToString((__nFType)), \
(__nFInstance)->id); \
ogs_sbi_nf_instance_remove( \
OGS_SBI_NF_INSTANCE((__sBIObject), (__nFType))); \
} \
\
if (OGS_SBI_NF_INSTANCE( \
(__sBIObject), (__nFType)) != (__nFInstance)) { \
(__nFInstance)->reference_count++; \
} \
OGS_SBI_NF_INSTANCE((__sBIObject), (__nFType)) = (__nFInstance); \
ogs_trace("nf_instance->reference_count = %d", \
(__nFInstance)->reference_count); \
} while(0)
void ogs_sbi_select_nrf(ogs_sbi_object_t *sbi_object, void *state);
void ogs_sbi_select_first_nf(
ogs_sbi_object_t *sbi_object, OpenAPI_nf_type_e nf_type, void *state);
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);

View File

@ -20,7 +20,7 @@
#include "ogs-sbi.h"
#include "yuarel.h"
static char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h)
char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h)
{
char buf[OGS_ADDRSTRLEN];
char uri[OGS_HUGE_LEN];
@ -515,7 +515,7 @@ OpenAPI_guami_t *ogs_sbi_build_guami(ogs_guami_t *guami)
Guami = ogs_calloc(1, sizeof(*Guami));
ogs_assert(Guami);
Guami->plmn_id = ogs_sbi_build_plmn_id(&guami->plmn_id);
Guami->plmn_id = ogs_sbi_build_plmn_id_nid(&guami->plmn_id);
ogs_assert(Guami->plmn_id);
Guami->amf_id = ogs_amf_id_to_string(&guami->amf_id);
ogs_assert(Guami->amf_id);
@ -531,7 +531,7 @@ bool ogs_sbi_parse_guami(ogs_guami_t *guami, OpenAPI_guami_t *Guami)
ogs_assert(Guami->plmn_id);
ogs_amf_id_from_string(&guami->amf_id, Guami->amf_id);
ogs_sbi_parse_plmn_id(&guami->plmn_id, Guami->plmn_id);
ogs_sbi_parse_plmn_id_nid(&guami->plmn_id, Guami->plmn_id);
return true;
}
@ -541,7 +541,7 @@ void ogs_sbi_free_guami(OpenAPI_guami_t *Guami)
ogs_assert(Guami);
if (Guami->plmn_id)
ogs_sbi_free_plmn_id(Guami->plmn_id);
ogs_sbi_free_plmn_id_nid(Guami->plmn_id);
if (Guami->amf_id)
ogs_free(Guami->amf_id);
ogs_free(Guami);

View File

@ -32,6 +32,7 @@ typedef struct ogs_sbi_server_s ogs_sbi_server_t;
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
typedef struct ogs_sbi_header_s ogs_sbi_header_t;
char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h);
char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h);
char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h);

View File

@ -152,6 +152,9 @@ 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->AuthorizedNetworkSliceInfo)
OpenAPI_authorized_network_slice_info_free(
message->AuthorizedNetworkSliceInfo);
for (i = 0; i < message->num_of_part; i++) {
if (message->part[i].pkbuf)
@ -242,6 +245,10 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
}
/* URL Param */
if (message->param.nf_id) {
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_NF_ID, message->param.nf_id);
}
if (message->param.nf_type) {
char *v = OpenAPI_nf_type_ToString(message->param.nf_type);
ogs_assert(v);
@ -266,10 +273,8 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
ogs_free(v);
}
if (message->param.dnn) {
char *v = ogs_msprintf("%s", message->param.dnn);
ogs_assert(v);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_DNN, v);
ogs_free(v);
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_DNN, message->param.dnn);
}
if (message->param.plmn_id_presence) {
OpenAPI_plmn_id_t plmn_id;
@ -295,15 +300,73 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
}
}
if (message->param.single_nssai_presence) {
char *v = ogs_sbi_s_nssai_to_string(&message->param.single_nssai);
char *v = ogs_sbi_s_nssai_to_string(&message->param.s_nssai);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SINGLE_NSSAI, v);
ogs_free(v);
}
if (message->param.snssai_presence) {
char *v = ogs_sbi_s_nssai_to_string(&message->param.snssai);
char *v = ogs_sbi_s_nssai_to_string(&message->param.s_nssai);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_SNSSAI, v);
ogs_free(v);
}
if (message->param.plmn_id_presence) {
OpenAPI_plmn_id_t plmn_id;
plmn_id.mnc = ogs_plmn_id_mnc_string(&message->param.plmn_id);
plmn_id.mcc = ogs_plmn_id_mcc_string(&message->param.plmn_id);
if (plmn_id.mnc && plmn_id.mcc) {
char *v = NULL;
cJSON *item = NULL;
item = OpenAPI_plmn_id_convertToJSON(&plmn_id);
ogs_assert(item);
if (plmn_id.mnc) ogs_free(plmn_id.mnc);
if (plmn_id.mcc) ogs_free(plmn_id.mcc);
v = cJSON_Print(item);
ogs_assert(v);
cJSON_Delete(item);
ogs_sbi_header_set(request->http.params, OGS_SBI_PARAM_PLMN_ID, v);
ogs_free(v);
}
}
if (message->param.slice_info_request_for_pdu_session_presence) {
OpenAPI_slice_info_for_pdu_session_t SliceInfoForPDUSession;
OpenAPI_snssai_t sNSSAI;
char *v = NULL;
cJSON *item = NULL;
ogs_assert(message->param.s_nssai.sst);
ogs_assert(message->param.roaming_indication);
memset(&sNSSAI, 0, sizeof(sNSSAI));
sNSSAI.sst = message->param.s_nssai.sst;
sNSSAI.sd = ogs_s_nssai_sd_to_string(message->param.s_nssai.sd);
memset(&SliceInfoForPDUSession, 0, sizeof(SliceInfoForPDUSession));
SliceInfoForPDUSession.s_nssai = &sNSSAI;
SliceInfoForPDUSession.roaming_indication =
message->param.roaming_indication;
item = OpenAPI_slice_info_for_pdu_session_convertToJSON(
&SliceInfoForPDUSession);
ogs_assert(item);
v = cJSON_Print(item);
ogs_assert(v);
cJSON_Delete(item);
ogs_sbi_header_set(request->http.params,
OGS_SBI_PARAM_SLICE_INFO_REQUEST_FOR_PDU_SESSION, v);
ogs_free(v);
if (sNSSAI.sd)
ogs_free(sNSSAI.sd);
}
build_content(&request->http, message);
@ -374,7 +437,9 @@ int ogs_sbi_parse_request(
for (hi = ogs_hash_first(request->http.params);
hi; hi = ogs_hash_next(hi)) {
if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_TYPE)) {
if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_ID)) {
message->param.nf_id = ogs_hash_this_val(hi);
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_PARAM_NF_TYPE)) {
message->param.nf_type =
OpenAPI_nf_type_FromString(ogs_hash_this_val(hi));
} else if (!strcmp(ogs_hash_this_key(hi),
@ -413,7 +478,7 @@ int ogs_sbi_parse_request(
char *v = ogs_hash_this_val(hi);
if (v) {
bool rc = ogs_sbi_s_nssai_from_string(
&message->param.single_nssai, v);
&message->param.s_nssai, v);
if (rc == true)
message->param.single_nssai_presence = true;
}
@ -421,10 +486,42 @@ int ogs_sbi_parse_request(
char *v = ogs_hash_this_val(hi);
if (v) {
bool rc = ogs_sbi_s_nssai_from_string(
&message->param.snssai, v);
&message->param.s_nssai, v);
if (rc == true)
message->param.snssai_presence = true;
}
} else if (!strcmp(ogs_hash_this_key(hi),
OGS_SBI_PARAM_SLICE_INFO_REQUEST_FOR_PDU_SESSION)) {
char *v = NULL;
cJSON *item = NULL;
OpenAPI_slice_info_for_pdu_session_t *SliceInfoForPduSession = NULL;
v = ogs_hash_this_val(hi);
if (v) {
item = cJSON_Parse(v);
if (item) {
SliceInfoForPduSession =
OpenAPI_slice_info_for_pdu_session_parseFromJSON(item);
if (SliceInfoForPduSession) {
OpenAPI_snssai_t *s_nssai =
SliceInfoForPduSession->s_nssai;
if (s_nssai) {
message->param.s_nssai.sst = s_nssai->sst;
message->param.s_nssai.sd =
ogs_s_nssai_sd_from_string(s_nssai->sd);
}
message->param.roaming_indication =
SliceInfoForPduSession->roaming_indication;
message->param.
slice_info_request_for_pdu_session_presence = true;
OpenAPI_slice_info_for_pdu_session_free(
SliceInfoForPduSession);
}
cJSON_Delete(item);
}
}
}
}
@ -744,6 +841,10 @@ 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->AuthorizedNetworkSliceInfo) {
item = OpenAPI_authorized_network_slice_info_convertToJSON(
message->AuthorizedNetworkSliceInfo);
ogs_assert(item);
}
if (item) {
@ -1369,6 +1470,27 @@ static int parse_json(ogs_sbi_message_t *message,
END
break;
CASE(OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION)
SWITCH(message->h.resource.component[0])
CASE(OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION)
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
message->AuthorizedNetworkSliceInfo =
OpenAPI_authorized_network_slice_info_parseFromJSON(
item);
if (!message->AuthorizedNetworkSliceInfo) {
rv = OGS_ERROR;
ogs_error("JSON parse error");
}
}
break;
DEFAULT
rv = OGS_ERROR;
ogs_error("Unknown resource name [%s]",
message->h.resource.component[0]);
END
break;
CASE(OGS_SBI_SERVICE_NAME_NAMF_CALLBACK)
SWITCH(message->h.resource.component[1])
CASE(OGS_SBI_RESOURCE_NAME_SM_CONTEXT_STATUS)

View File

@ -144,6 +144,10 @@ extern "C" {
#define OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL "npcf-smpolicycontrol"
#define OGS_SBI_RESOURCE_NAME_SM_POLICIES "sm-policies"
#define OGS_SBI_SERVICE_NAME_NNSSF_NSSELECTION "nnssf-nsselection"
#define OGS_SBI_RESOURCE_NAME_NETWORK_SLICE_INFORMATION \
"network-slice-information"
#define OGS_SBI_FEATURES_IS_SET(__fEATURES, __n) \
(__fEATURES & (1 << ((__n)-1)))
#define OGS_SBI_FEATURES_SET(__fEATURES, __n) \
@ -195,6 +199,7 @@ extern "C" {
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DDN_EVENT_POLICY_CONTROL 37
#define OGS_SBI_NPCF_SMPOLICYCONTROL_REALLOCATION_OF_CREDIT 38
#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"
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"
@ -203,6 +208,8 @@ extern "C" {
#define OGS_SBI_PARAM_PLMN_ID "plmn-id"
#define OGS_SBI_PARAM_SINGLE_NSSAI "single-nssai"
#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_ACCEPT "Accept"
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
@ -279,16 +286,20 @@ typedef struct ogs_sbi_message_s {
struct {
OpenAPI_nf_type_e target_nf_type;
OpenAPI_nf_type_e requester_nf_type;
char *nf_id;
OpenAPI_nf_type_e nf_type;
int limit;
char *dnn;
bool plmn_id_presence;
ogs_plmn_id_t plmn_id;
/* Shared memory */
ogs_plmn_id_t plmn_id;
ogs_s_nssai_t s_nssai;
bool plmn_id_presence;
bool single_nssai_presence;
ogs_s_nssai_t single_nssai;
bool snssai_presence;
ogs_s_nssai_t snssai;
bool slice_info_request_for_pdu_session_presence;
OpenAPI_roaming_indication_e roaming_indication;
} param;
int res_status;
@ -334,6 +345,7 @@ typedef struct ogs_sbi_message_s {
OpenAPI_sm_policy_context_data_t *SmPolicyContextData;
OpenAPI_sm_policy_decision_t *SmPolicyDecision;
OpenAPI_sm_policy_data_t *SmPolicyData;
OpenAPI_authorized_network_slice_info_t *AuthorizedNetworkSliceInfo;
ogs_sbi_links_t *links;

View File

@ -50,6 +50,9 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
OpenAPI_nf_status_ToString(nf_instance->nf_status),
nf_instance->num_of_ipv4, nf_instance->num_of_ipv6);
NFProfile->heart_beat_timer = nf_instance->time.heartbeat_interval;
NFProfile->nf_profile_changes_support_ind = true;
if (strlen(nf_instance->fqdn)) {
memset(fqdn, 0, sizeof(fqdn));
fqdn_len = ogs_fqdn_build(fqdn,
@ -234,45 +237,6 @@ void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile)
ogs_free(NFProfile);
}
ogs_sbi_request_t *ogs_nnrf_nfm_build_register(
ogs_sbi_nf_instance_t *nf_instance)
{
ogs_sbi_message_t message;
ogs_sbi_request_t *request = NULL;
ogs_sbi_client_t *client = NULL;
OpenAPI_nf_profile_t *NFProfile = NULL;
ogs_assert(nf_instance);
client = nf_instance->client;
ogs_assert(client);
memset(&message, 0, sizeof(message));
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PUT;
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
message.h.api.version = (char *)OGS_SBI_API_V1;
message.h.resource.component[0] =
(char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES;
message.h.resource.component[1] = ogs_sbi_self()->nf_instance_id;
message.http.content_encoding = (char*)ogs_sbi_self()->content_encoding;
NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance);
ogs_assert(NFProfile);
NFProfile->nf_profile_changes_support_ind = true;
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer =
ogs_app()->time.nf_instance.heartbeat_interval;
message.NFProfile = NFProfile;
request = ogs_sbi_build_request(&message);
ogs_sbi_nnrf_free_nf_profile(NFProfile);
return request;
}
ogs_sbi_request_t *ogs_nnrf_nfm_build_update(ogs_sbi_nf_instance_t *nf_instance)
{
ogs_sbi_message_t message;

View File

@ -28,8 +28,6 @@ OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
ogs_sbi_nf_instance_t *nf_instance);
void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile);
ogs_sbi_request_t *ogs_nnrf_nfm_build_register(
ogs_sbi_nf_instance_t *nf_instance);
ogs_sbi_request_t *ogs_nnrf_nfm_build_update(
ogs_sbi_nf_instance_t *nf_instance);
ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(

View File

@ -20,6 +20,163 @@
#include "ogs-sbi.h"
#include "ogs-app.h"
static void handle_smf_info(
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_smf_info_t *SmfInfo)
{
ogs_sbi_nf_info_t *nf_info = NULL;
OpenAPI_list_t *sNssaiSmfInfoList = NULL;
OpenAPI_snssai_smf_info_item_t *sNssaiSmfInfoItem = NULL;
OpenAPI_snssai_t *sNssai = NULL;
OpenAPI_list_t *DnnSmfInfoList = NULL;
OpenAPI_dnn_smf_info_item_t *DnnSmfInfoItem = NULL;
OpenAPI_list_t *TaiList = NULL;
OpenAPI_tai_t *TaiItem = NULL;
OpenAPI_list_t *TaiRangeList = NULL;
OpenAPI_tai_range_t *TaiRangeItem = NULL;
OpenAPI_list_t *TacRangeList = NULL;
OpenAPI_tac_range_t *TacRangeItem = NULL;
OpenAPI_lnode_t *node = NULL, *node2 = NULL;
ogs_assert(nf_instance);
ogs_assert(SmfInfo);
nf_info = ogs_sbi_nf_info_add(
&nf_instance->nf_info_list, OpenAPI_nf_type_SMF);
ogs_assert(nf_info);
sNssaiSmfInfoList = SmfInfo->s_nssai_smf_info_list;
OpenAPI_list_for_each(sNssaiSmfInfoList, node) {
sNssaiSmfInfoItem = node->data;
if (sNssaiSmfInfoItem) {
ogs_assert(nf_info->smf.num_of_slice < OGS_MAX_NUM_OF_SLICE);
DnnSmfInfoList = sNssaiSmfInfoItem->dnn_smf_info_list;
OpenAPI_list_for_each(DnnSmfInfoList, node2) {
DnnSmfInfoItem = node2->data;
if (DnnSmfInfoItem && DnnSmfInfoItem->dnn) {
int dnn_index = nf_info->smf.slice
[nf_info->smf.num_of_slice].num_of_dnn;
ogs_assert(dnn_index < OGS_MAX_NUM_OF_DNN);
nf_info->smf.slice[nf_info->smf.num_of_slice].
dnn[dnn_index] = ogs_strdup(DnnSmfInfoItem->dnn);
nf_info->smf.slice[nf_info->smf.num_of_slice].
num_of_dnn++;
}
}
if (!nf_info->smf.slice[nf_info->smf.num_of_slice].num_of_dnn) {
ogs_error("No DNN");
continue;
}
sNssai = sNssaiSmfInfoItem->s_nssai;
if (sNssai) {
ogs_s_nssai_t *s_nssai = NULL;
s_nssai = &nf_info->smf.
slice[nf_info->smf.num_of_slice].s_nssai;
s_nssai->sst = sNssai->sst;
s_nssai->sd = ogs_s_nssai_sd_from_string(sNssai->sd);
nf_info->smf.num_of_slice++;
}
}
}
if (nf_info->smf.num_of_slice == 0) {
ogs_error("No S-NSSAI(DNN) in smfInfo");
ogs_sbi_nf_info_remove(&nf_instance->nf_info_list, nf_info);
return;
}
TaiList = SmfInfo->tai_list;
OpenAPI_list_for_each(TaiList, node) {
TaiItem = node->data;
if (TaiItem && TaiItem->plmn_id && TaiItem->tac) {
ogs_5gs_tai_t *nr_tai = NULL;
ogs_assert(nf_info->smf.num_of_nr_tai < OGS_MAX_NUM_OF_TAI);
nr_tai = &nf_info->smf.nr_tai[nf_info->smf.num_of_nr_tai];
ogs_assert(nr_tai);
ogs_sbi_parse_plmn_id(&nr_tai->plmn_id, TaiItem->plmn_id);
nr_tai->tac = ogs_uint24_from_string(TaiItem->tac);
nf_info->smf.num_of_nr_tai++;
}
}
TaiRangeList = SmfInfo->tai_range_list;
OpenAPI_list_for_each(TaiRangeList, node) {
TaiRangeItem = node->data;
if (TaiRangeItem && TaiRangeItem->plmn_id &&
TaiRangeItem->tac_range_list) {
ogs_assert(nf_info->smf.num_of_nr_tai_range <
OGS_MAX_NUM_OF_TAI);
ogs_sbi_parse_plmn_id(
&nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].plmn_id,
TaiRangeItem->plmn_id);
TacRangeList = TaiRangeItem->tac_range_list;
OpenAPI_list_for_each(TacRangeList, node2) {
TacRangeItem = node2->data;
if (TacRangeItem &&
TacRangeItem->start && TacRangeItem->end) {
int tac_index = nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].num_of_tac_range;
ogs_assert(tac_index < OGS_MAX_NUM_OF_TAI);
nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].
start[tac_index] =
ogs_uint24_from_string(TacRangeItem->start);
nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].
end[tac_index] =
ogs_uint24_from_string(TacRangeItem->end);
nf_info->smf.nr_tai_range
[nf_info->smf.num_of_nr_tai_range].
num_of_tac_range++;
}
}
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,
OpenAPI_nf_profile_t *NFProfile,
ogs_sbi_stream_t *stream, ogs_sbi_message_t *message)
@ -222,5 +379,16 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
}
}
ogs_sbi_nf_info_remove_all(&nf_instance->nf_info_list);
if (NFProfile->smf_info)
handle_smf_info(nf_instance, NFProfile->smf_info);
OpenAPI_list_for_each(NFProfile->smf_info_list, node) {
OpenAPI_map_t *SmfInfoMap = node->data;
if (SmfInfoMap && SmfInfoMap->value)
handle_smf_info(nf_instance, SmfInfoMap->value);
}
return true;
}

View File

@ -65,6 +65,8 @@
#include "model/sm_policy_context_data.h"
#include "model/sm_policy_decision.h"
#include "model/sm_policy_data.h"
#include "model/slice_info_for_pdu_session.h"
#include "model/authorized_network_slice_info.h"
#include "custom/links.h"

File diff suppressed because it is too large Load Diff

View File

@ -8,7 +8,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
char *supported_features,
OpenAPI_list_t *gpsis,
OpenAPI_list_t *internal_group_ids,
OpenAPI_list_t* vn_group_info,
OpenAPI_list_t* shared_vn_group_data_ids,
OpenAPI_ambr_rm_t *subscribed_ue_ambr,
OpenAPI_nssai_t *nssai,
@ -22,7 +21,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int mps_priority,
int mcs_priority,
int active_time,
int dl_packet_count,
OpenAPI_sor_info_t *sor_info,
int sor_info_expect_ind,
int soraf_retrieval,
@ -30,9 +28,11 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
OpenAPI_upu_info_t *upu_info,
int mico_allowed,
OpenAPI_list_t *shared_am_data_ids,
OpenAPI_odb_packet_services_t *odb_packet_services,
OpenAPI_odb_packet_services_e odb_packet_services,
OpenAPI_list_t *subscribed_dnn_list,
int service_gap_time,
OpenAPI_mdt_user_consent_e mdt_user_consent,
OpenAPI_mdt_configuration_t *mdt_configuration,
OpenAPI_trace_data_t *trace_data,
OpenAPI_cag_data_t *cag_data,
char *stn_sr,
@ -40,20 +40,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int nb_io_t_ue_priority,
int nssai_inclusion_allowed,
char rg_wireline_characteristics,
OpenAPI_tmbr_t *rg_tmbr,
OpenAPI_ec_restriction_data_t *ec_restriction_data,
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb,
int ec_restriction_data_nb,
OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_list,
OpenAPI_list_t *maximum_response_time_list,
OpenAPI_list_t *maximum_latency_list,
OpenAPI_list_t *primary_rat_restrictions,
OpenAPI_list_t *secondary_rat_restrictions,
OpenAPI_list_t *edrx_parameters_list,
OpenAPI_list_t *ptw_parameters_list,
int iab_operation_allowed,
OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth,
OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth,
char *nr_ue_pc5_ambr,
char *lte_pc5_ambr
OpenAPI_list_t *wireline_forbidden_areas,
OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction
)
{
OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_access_and_mobility_subscription_data_t));
@ -63,7 +59,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->supported_features = supported_features;
access_and_mobility_subscription_data_local_var->gpsis = gpsis;
access_and_mobility_subscription_data_local_var->internal_group_ids = internal_group_ids;
access_and_mobility_subscription_data_local_var->vn_group_info = vn_group_info;
access_and_mobility_subscription_data_local_var->shared_vn_group_data_ids = shared_vn_group_data_ids;
access_and_mobility_subscription_data_local_var->subscribed_ue_ambr = subscribed_ue_ambr;
access_and_mobility_subscription_data_local_var->nssai = nssai;
@ -77,7 +72,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->mps_priority = mps_priority;
access_and_mobility_subscription_data_local_var->mcs_priority = mcs_priority;
access_and_mobility_subscription_data_local_var->active_time = active_time;
access_and_mobility_subscription_data_local_var->dl_packet_count = dl_packet_count;
access_and_mobility_subscription_data_local_var->sor_info = sor_info;
access_and_mobility_subscription_data_local_var->sor_info_expect_ind = sor_info_expect_ind;
access_and_mobility_subscription_data_local_var->soraf_retrieval = soraf_retrieval;
@ -88,6 +82,8 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->odb_packet_services = odb_packet_services;
access_and_mobility_subscription_data_local_var->subscribed_dnn_list = subscribed_dnn_list;
access_and_mobility_subscription_data_local_var->service_gap_time = service_gap_time;
access_and_mobility_subscription_data_local_var->mdt_user_consent = mdt_user_consent;
access_and_mobility_subscription_data_local_var->mdt_configuration = mdt_configuration;
access_and_mobility_subscription_data_local_var->trace_data = trace_data;
access_and_mobility_subscription_data_local_var->cag_data = cag_data;
access_and_mobility_subscription_data_local_var->stn_sr = stn_sr;
@ -95,20 +91,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
access_and_mobility_subscription_data_local_var->nb_io_t_ue_priority = nb_io_t_ue_priority;
access_and_mobility_subscription_data_local_var->nssai_inclusion_allowed = nssai_inclusion_allowed;
access_and_mobility_subscription_data_local_var->rg_wireline_characteristics = rg_wireline_characteristics;
access_and_mobility_subscription_data_local_var->rg_tmbr = rg_tmbr;
access_and_mobility_subscription_data_local_var->ec_restriction_data = ec_restriction_data;
access_and_mobility_subscription_data_local_var->ec_restriction_data_wb = ec_restriction_data_wb;
access_and_mobility_subscription_data_local_var->ec_restriction_data_nb = ec_restriction_data_nb;
access_and_mobility_subscription_data_local_var->expected_ue_behaviour_list = expected_ue_behaviour_list;
access_and_mobility_subscription_data_local_var->maximum_response_time_list = maximum_response_time_list;
access_and_mobility_subscription_data_local_var->maximum_latency_list = maximum_latency_list;
access_and_mobility_subscription_data_local_var->primary_rat_restrictions = primary_rat_restrictions;
access_and_mobility_subscription_data_local_var->secondary_rat_restrictions = secondary_rat_restrictions;
access_and_mobility_subscription_data_local_var->edrx_parameters_list = edrx_parameters_list;
access_and_mobility_subscription_data_local_var->ptw_parameters_list = ptw_parameters_list;
access_and_mobility_subscription_data_local_var->iab_operation_allowed = iab_operation_allowed;
access_and_mobility_subscription_data_local_var->nr_v2x_services_auth = nr_v2x_services_auth;
access_and_mobility_subscription_data_local_var->lte_v2x_services_auth = lte_v2x_services_auth;
access_and_mobility_subscription_data_local_var->nr_ue_pc5_ambr = nr_ue_pc5_ambr;
access_and_mobility_subscription_data_local_var->lte_pc5_ambr = lte_pc5_ambr;
access_and_mobility_subscription_data_local_var->wireline_forbidden_areas = wireline_forbidden_areas;
access_and_mobility_subscription_data_local_var->wireline_service_area_restriction = wireline_service_area_restriction;
return access_and_mobility_subscription_data_local_var;
}
@ -128,12 +120,6 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
ogs_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->internal_group_ids);
OpenAPI_list_for_each(access_and_mobility_subscription_data->vn_group_info, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_vn_group_data_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(access_and_mobility_subscription_data->vn_group_info);
OpenAPI_list_for_each(access_and_mobility_subscription_data->shared_vn_group_data_ids, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
ogs_free(localKeyValue->value);
@ -156,26 +142,17 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
ogs_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->shared_am_data_ids);
OpenAPI_odb_packet_services_free(access_and_mobility_subscription_data->odb_packet_services);
OpenAPI_list_for_each(access_and_mobility_subscription_data->subscribed_dnn_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->subscribed_dnn_list);
OpenAPI_mdt_configuration_free(access_and_mobility_subscription_data->mdt_configuration);
OpenAPI_trace_data_free(access_and_mobility_subscription_data->trace_data);
OpenAPI_cag_data_free(access_and_mobility_subscription_data->cag_data);
ogs_free(access_and_mobility_subscription_data->stn_sr);
ogs_free(access_and_mobility_subscription_data->c_msisdn);
OpenAPI_tmbr_free(access_and_mobility_subscription_data->rg_tmbr);
OpenAPI_ec_restriction_data_free(access_and_mobility_subscription_data->ec_restriction_data);
OpenAPI_ec_restriction_data_wb_free(access_and_mobility_subscription_data->ec_restriction_data_wb);
OpenAPI_expected_ue_behaviour_data_free(access_and_mobility_subscription_data->expected_ue_behaviour_list);
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_response_time_list, node) {
OpenAPI_maximum_response_time_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->maximum_response_time_list);
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_latency_list, node) {
OpenAPI_maximum_latency_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->maximum_latency_list);
OpenAPI_list_free(access_and_mobility_subscription_data->primary_rat_restrictions);
OpenAPI_list_free(access_and_mobility_subscription_data->secondary_rat_restrictions);
OpenAPI_list_for_each(access_and_mobility_subscription_data->edrx_parameters_list, node) {
@ -186,10 +163,11 @@ void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobil
OpenAPI_ptw_parameters_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->ptw_parameters_list);
OpenAPI_nr_v2x_auth_free(access_and_mobility_subscription_data->nr_v2x_services_auth);
OpenAPI_lte_v2x_auth_free(access_and_mobility_subscription_data->lte_v2x_services_auth);
ogs_free(access_and_mobility_subscription_data->nr_ue_pc5_ambr);
ogs_free(access_and_mobility_subscription_data->lte_pc5_ambr);
OpenAPI_list_for_each(access_and_mobility_subscription_data->wireline_forbidden_areas, node) {
OpenAPI_wireline_area_free(node->data);
}
OpenAPI_list_free(access_and_mobility_subscription_data->wireline_forbidden_areas);
OpenAPI_wireline_service_area_restriction_free(access_and_mobility_subscription_data->wireline_service_area_restriction);
ogs_free(access_and_mobility_subscription_data);
}
@ -242,27 +220,6 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->vn_group_info) {
cJSON *vn_group_info = cJSON_AddObjectToObject(item, "vnGroupInfo");
if (vn_group_info == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [vn_group_info]");
goto end;
}
cJSON *localMapObject = vn_group_info;
OpenAPI_lnode_t *vn_group_info_node;
if (access_and_mobility_subscription_data->vn_group_info) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->vn_group_info, vn_group_info_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)vn_group_info_node->data;
cJSON *itemLocal = OpenAPI_vn_group_data_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [vn_group_info]");
goto end;
}
cJSON_AddItemToObject(vn_group_info, localKeyValue->key, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->shared_vn_group_data_ids) {
cJSON *shared_vn_group_data_ids = cJSON_AddObjectToObject(item, "sharedVnGroupDataIds");
if (shared_vn_group_data_ids == NULL) {
@ -409,13 +366,6 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->dl_packet_count) {
if (cJSON_AddNumberToObject(item, "dlPacketCount", access_and_mobility_subscription_data->dl_packet_count) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [dl_packet_count]");
goto end;
}
}
if (access_and_mobility_subscription_data->sor_info) {
cJSON *sor_info_local_JSON = OpenAPI_sor_info_convertToJSON(access_and_mobility_subscription_data->sor_info);
if (sor_info_local_JSON == NULL) {
@ -495,13 +445,7 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
if (access_and_mobility_subscription_data->odb_packet_services) {
cJSON *odb_packet_services_local_JSON = OpenAPI_odb_packet_services_convertToJSON(access_and_mobility_subscription_data->odb_packet_services);
if (odb_packet_services_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [odb_packet_services]");
goto end;
}
cJSON_AddItemToObject(item, "odbPacketServices", odb_packet_services_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "odbPacketServices", OpenAPI_odb_packet_services_ToString(access_and_mobility_subscription_data->odb_packet_services)) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [odb_packet_services]");
goto end;
}
@ -530,6 +474,26 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->mdt_user_consent) {
if (cJSON_AddStringToObject(item, "mdtUserConsent", OpenAPI_mdt_user_consent_ToString(access_and_mobility_subscription_data->mdt_user_consent)) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mdt_user_consent]");
goto end;
}
}
if (access_and_mobility_subscription_data->mdt_configuration) {
cJSON *mdt_configuration_local_JSON = OpenAPI_mdt_configuration_convertToJSON(access_and_mobility_subscription_data->mdt_configuration);
if (mdt_configuration_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mdt_configuration]");
goto end;
}
cJSON_AddItemToObject(item, "mdtConfiguration", mdt_configuration_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [mdt_configuration]");
goto end;
}
}
if (access_and_mobility_subscription_data->trace_data) {
cJSON *trace_data_local_JSON = OpenAPI_trace_data_convertToJSON(access_and_mobility_subscription_data->trace_data);
if (trace_data_local_JSON == NULL) {
@ -591,28 +555,22 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->rg_tmbr) {
cJSON *rg_tmbr_local_JSON = OpenAPI_tmbr_convertToJSON(access_and_mobility_subscription_data->rg_tmbr);
if (rg_tmbr_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rg_tmbr]");
if (access_and_mobility_subscription_data->ec_restriction_data_wb) {
cJSON *ec_restriction_data_wb_local_JSON = OpenAPI_ec_restriction_data_wb_convertToJSON(access_and_mobility_subscription_data->ec_restriction_data_wb);
if (ec_restriction_data_wb_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data_wb]");
goto end;
}
cJSON_AddItemToObject(item, "rgTMBR", rg_tmbr_local_JSON);
cJSON_AddItemToObject(item, "ecRestrictionDataWb", ec_restriction_data_wb_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [rg_tmbr]");
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data_wb]");
goto end;
}
}
if (access_and_mobility_subscription_data->ec_restriction_data) {
cJSON *ec_restriction_data_local_JSON = OpenAPI_ec_restriction_data_convertToJSON(access_and_mobility_subscription_data->ec_restriction_data);
if (ec_restriction_data_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data]");
goto end;
}
cJSON_AddItemToObject(item, "ecRestrictionData", ec_restriction_data_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data]");
if (access_and_mobility_subscription_data->ec_restriction_data_nb) {
if (cJSON_AddBoolToObject(item, "ecRestrictionDataNb", access_and_mobility_subscription_data->ec_restriction_data_nb) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [ec_restriction_data_nb]");
goto end;
}
}
@ -630,46 +588,6 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->maximum_response_time_list) {
cJSON *maximum_response_time_listList = cJSON_AddArrayToObject(item, "maximumResponseTimeList");
if (maximum_response_time_listList == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_response_time_list]");
goto end;
}
OpenAPI_lnode_t *maximum_response_time_list_node;
if (access_and_mobility_subscription_data->maximum_response_time_list) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_response_time_list, maximum_response_time_list_node) {
cJSON *itemLocal = OpenAPI_maximum_response_time_convertToJSON(maximum_response_time_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_response_time_list]");
goto end;
}
cJSON_AddItemToArray(maximum_response_time_listList, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->maximum_latency_list) {
cJSON *maximum_latency_listList = cJSON_AddArrayToObject(item, "maximumLatencyList");
if (maximum_latency_listList == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_latency_list]");
goto end;
}
OpenAPI_lnode_t *maximum_latency_list_node;
if (access_and_mobility_subscription_data->maximum_latency_list) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->maximum_latency_list, maximum_latency_list_node) {
cJSON *itemLocal = OpenAPI_maximum_latency_convertToJSON(maximum_latency_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [maximum_latency_list]");
goto end;
}
cJSON_AddItemToArray(maximum_latency_listList, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->primary_rat_restrictions) {
cJSON *primary_rat_restrictions = cJSON_AddArrayToObject(item, "primaryRatRestrictions");
if (primary_rat_restrictions == NULL) {
@ -747,42 +665,35 @@ cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_acces
}
}
if (access_and_mobility_subscription_data->nr_v2x_services_auth) {
cJSON *nr_v2x_services_auth_local_JSON = OpenAPI_nr_v2x_auth_convertToJSON(access_and_mobility_subscription_data->nr_v2x_services_auth);
if (nr_v2x_services_auth_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nr_v2x_services_auth]");
if (access_and_mobility_subscription_data->wireline_forbidden_areas) {
cJSON *wireline_forbidden_areasList = cJSON_AddArrayToObject(item, "wirelineForbiddenAreas");
if (wireline_forbidden_areasList == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_forbidden_areas]");
goto end;
}
cJSON_AddItemToObject(item, "nrV2xServicesAuth", nr_v2x_services_auth_local_JSON);
OpenAPI_lnode_t *wireline_forbidden_areas_node;
if (access_and_mobility_subscription_data->wireline_forbidden_areas) {
OpenAPI_list_for_each(access_and_mobility_subscription_data->wireline_forbidden_areas, wireline_forbidden_areas_node) {
cJSON *itemLocal = OpenAPI_wireline_area_convertToJSON(wireline_forbidden_areas_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_forbidden_areas]");
goto end;
}
cJSON_AddItemToArray(wireline_forbidden_areasList, itemLocal);
}
}
}
if (access_and_mobility_subscription_data->wireline_service_area_restriction) {
cJSON *wireline_service_area_restriction_local_JSON = OpenAPI_wireline_service_area_restriction_convertToJSON(access_and_mobility_subscription_data->wireline_service_area_restriction);
if (wireline_service_area_restriction_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_service_area_restriction]");
goto end;
}
cJSON_AddItemToObject(item, "wirelineServiceAreaRestriction", wireline_service_area_restriction_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nr_v2x_services_auth]");
goto end;
}
}
if (access_and_mobility_subscription_data->lte_v2x_services_auth) {
cJSON *lte_v2x_services_auth_local_JSON = OpenAPI_lte_v2x_auth_convertToJSON(access_and_mobility_subscription_data->lte_v2x_services_auth);
if (lte_v2x_services_auth_local_JSON == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [lte_v2x_services_auth]");
goto end;
}
cJSON_AddItemToObject(item, "lteV2xServicesAuth", lte_v2x_services_auth_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [lte_v2x_services_auth]");
goto end;
}
}
if (access_and_mobility_subscription_data->nr_ue_pc5_ambr) {
if (cJSON_AddStringToObject(item, "nrUePc5Ambr", access_and_mobility_subscription_data->nr_ue_pc5_ambr) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [nr_ue_pc5_ambr]");
goto end;
}
}
if (access_and_mobility_subscription_data->lte_pc5_ambr) {
if (cJSON_AddStringToObject(item, "ltePc5Ambr", access_and_mobility_subscription_data->lte_pc5_ambr) == NULL) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [lte_pc5_ambr]");
ogs_error("OpenAPI_access_and_mobility_subscription_data_convertToJSON() failed [wireline_service_area_restriction]");
goto end;
}
}
@ -843,29 +754,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *vn_group_info = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "vnGroupInfo");
OpenAPI_list_t *vn_group_infoList;
if (vn_group_info) {
cJSON *vn_group_info_local_map;
if (!cJSON_IsObject(vn_group_info)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [vn_group_info]");
goto end;
}
vn_group_infoList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(vn_group_info_local_map, vn_group_info) {
cJSON *localMapObject = vn_group_info_local_map;
if (!cJSON_IsObject(vn_group_info_local_map)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [vn_group_info]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_vn_group_data_parseFromJSON(localMapObject));
OpenAPI_list_add(vn_group_infoList, localMapKeyPair);
}
}
cJSON *shared_vn_group_data_ids = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "sharedVnGroupDataIds");
OpenAPI_list_t *shared_vn_group_data_idsList;
@ -1025,15 +913,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *dl_packet_count = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "dlPacketCount");
if (dl_packet_count) {
if (!cJSON_IsNumber(dl_packet_count)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [dl_packet_count]");
goto end;
}
}
cJSON *sor_info = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "sorInfo");
OpenAPI_sor_info_t *sor_info_local_nonprim = NULL;
@ -1119,9 +998,13 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
cJSON *odb_packet_services = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "odbPacketServices");
OpenAPI_odb_packet_services_t *odb_packet_services_local_nonprim = NULL;
OpenAPI_odb_packet_services_e odb_packet_servicesVariable;
if (odb_packet_services) {
odb_packet_services_local_nonprim = OpenAPI_odb_packet_services_parseFromJSON(odb_packet_services);
if (!cJSON_IsString(odb_packet_services)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [odb_packet_services]");
goto end;
}
odb_packet_servicesVariable = OpenAPI_odb_packet_services_FromString(odb_packet_services->valuestring);
}
cJSON *subscribed_dnn_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "subscribedDnnList");
@ -1153,6 +1036,24 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *mdt_user_consent = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "mdtUserConsent");
OpenAPI_mdt_user_consent_e mdt_user_consentVariable;
if (mdt_user_consent) {
if (!cJSON_IsString(mdt_user_consent)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [mdt_user_consent]");
goto end;
}
mdt_user_consentVariable = OpenAPI_mdt_user_consent_FromString(mdt_user_consent->valuestring);
}
cJSON *mdt_configuration = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "mdtConfiguration");
OpenAPI_mdt_configuration_t *mdt_configuration_local_nonprim = NULL;
if (mdt_configuration) {
mdt_configuration_local_nonprim = OpenAPI_mdt_configuration_parseFromJSON(mdt_configuration);
}
cJSON *trace_data = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "traceData");
OpenAPI_trace_data_t *trace_data_local_nonprim = NULL;
@ -1212,18 +1113,20 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *rg_tmbr = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "rgTMBR");
cJSON *ec_restriction_data_wb = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ecRestrictionDataWb");
OpenAPI_tmbr_t *rg_tmbr_local_nonprim = NULL;
if (rg_tmbr) {
rg_tmbr_local_nonprim = OpenAPI_tmbr_parseFromJSON(rg_tmbr);
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb_local_nonprim = NULL;
if (ec_restriction_data_wb) {
ec_restriction_data_wb_local_nonprim = OpenAPI_ec_restriction_data_wb_parseFromJSON(ec_restriction_data_wb);
}
cJSON *ec_restriction_data = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ecRestrictionData");
cJSON *ec_restriction_data_nb = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ecRestrictionDataNb");
OpenAPI_ec_restriction_data_t *ec_restriction_data_local_nonprim = NULL;
if (ec_restriction_data) {
ec_restriction_data_local_nonprim = OpenAPI_ec_restriction_data_parseFromJSON(ec_restriction_data);
if (ec_restriction_data_nb) {
if (!cJSON_IsBool(ec_restriction_data_nb)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [ec_restriction_data_nb]");
goto end;
}
}
cJSON *expected_ue_behaviour_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "expectedUeBehaviourList");
@ -1233,52 +1136,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
expected_ue_behaviour_list_local_nonprim = OpenAPI_expected_ue_behaviour_data_parseFromJSON(expected_ue_behaviour_list);
}
cJSON *maximum_response_time_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "maximumResponseTimeList");
OpenAPI_list_t *maximum_response_time_listList;
if (maximum_response_time_list) {
cJSON *maximum_response_time_list_local_nonprimitive;
if (!cJSON_IsArray(maximum_response_time_list)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_response_time_list]");
goto end;
}
maximum_response_time_listList = OpenAPI_list_create();
cJSON_ArrayForEach(maximum_response_time_list_local_nonprimitive, maximum_response_time_list ) {
if (!cJSON_IsObject(maximum_response_time_list_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_response_time_list]");
goto end;
}
OpenAPI_maximum_response_time_t *maximum_response_time_listItem = OpenAPI_maximum_response_time_parseFromJSON(maximum_response_time_list_local_nonprimitive);
OpenAPI_list_add(maximum_response_time_listList, maximum_response_time_listItem);
}
}
cJSON *maximum_latency_list = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "maximumLatencyList");
OpenAPI_list_t *maximum_latency_listList;
if (maximum_latency_list) {
cJSON *maximum_latency_list_local_nonprimitive;
if (!cJSON_IsArray(maximum_latency_list)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_latency_list]");
goto end;
}
maximum_latency_listList = OpenAPI_list_create();
cJSON_ArrayForEach(maximum_latency_list_local_nonprimitive, maximum_latency_list ) {
if (!cJSON_IsObject(maximum_latency_list_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [maximum_latency_list]");
goto end;
}
OpenAPI_maximum_latency_t *maximum_latency_listItem = OpenAPI_maximum_latency_parseFromJSON(maximum_latency_list_local_nonprimitive);
OpenAPI_list_add(maximum_latency_listList, maximum_latency_listItem);
}
}
cJSON *primary_rat_restrictions = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "primaryRatRestrictions");
OpenAPI_list_t *primary_rat_restrictionsList;
@ -1378,43 +1235,40 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
}
}
cJSON *nr_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "nrV2xServicesAuth");
cJSON *wireline_forbidden_areas = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "wirelineForbiddenAreas");
OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth_local_nonprim = NULL;
if (nr_v2x_services_auth) {
nr_v2x_services_auth_local_nonprim = OpenAPI_nr_v2x_auth_parseFromJSON(nr_v2x_services_auth);
}
cJSON *lte_v2x_services_auth = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "lteV2xServicesAuth");
OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth_local_nonprim = NULL;
if (lte_v2x_services_auth) {
lte_v2x_services_auth_local_nonprim = OpenAPI_lte_v2x_auth_parseFromJSON(lte_v2x_services_auth);
}
cJSON *nr_ue_pc5_ambr = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "nrUePc5Ambr");
if (nr_ue_pc5_ambr) {
if (!cJSON_IsString(nr_ue_pc5_ambr)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [nr_ue_pc5_ambr]");
OpenAPI_list_t *wireline_forbidden_areasList;
if (wireline_forbidden_areas) {
cJSON *wireline_forbidden_areas_local_nonprimitive;
if (!cJSON_IsArray(wireline_forbidden_areas)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [wireline_forbidden_areas]");
goto end;
}
wireline_forbidden_areasList = OpenAPI_list_create();
cJSON_ArrayForEach(wireline_forbidden_areas_local_nonprimitive, wireline_forbidden_areas ) {
if (!cJSON_IsObject(wireline_forbidden_areas_local_nonprimitive)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [wireline_forbidden_areas]");
goto end;
}
OpenAPI_wireline_area_t *wireline_forbidden_areasItem = OpenAPI_wireline_area_parseFromJSON(wireline_forbidden_areas_local_nonprimitive);
OpenAPI_list_add(wireline_forbidden_areasList, wireline_forbidden_areasItem);
}
}
cJSON *lte_pc5_ambr = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "ltePc5Ambr");
cJSON *wireline_service_area_restriction = cJSON_GetObjectItemCaseSensitive(access_and_mobility_subscription_dataJSON, "wirelineServiceAreaRestriction");
if (lte_pc5_ambr) {
if (!cJSON_IsString(lte_pc5_ambr)) {
ogs_error("OpenAPI_access_and_mobility_subscription_data_parseFromJSON() failed [lte_pc5_ambr]");
goto end;
}
OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction_local_nonprim = NULL;
if (wireline_service_area_restriction) {
wireline_service_area_restriction_local_nonprim = OpenAPI_wireline_service_area_restriction_parseFromJSON(wireline_service_area_restriction);
}
access_and_mobility_subscription_data_local_var = OpenAPI_access_and_mobility_subscription_data_create (
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
gpsis ? gpsisList : NULL,
internal_group_ids ? internal_group_idsList : NULL,
vn_group_info ? vn_group_infoList : NULL,
shared_vn_group_data_ids ? shared_vn_group_data_idsList : NULL,
subscribed_ue_ambr ? subscribed_ue_ambr_local_nonprim : NULL,
nssai ? nssai_local_nonprim : NULL,
@ -1428,7 +1282,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
mps_priority ? mps_priority->valueint : 0,
mcs_priority ? mcs_priority->valueint : 0,
active_time ? active_time->valuedouble : 0,
dl_packet_count ? dl_packet_count->valuedouble : 0,
sor_info ? sor_info_local_nonprim : NULL,
sor_info_expect_ind ? sor_info_expect_ind->valueint : 0,
soraf_retrieval ? soraf_retrieval->valueint : 0,
@ -1436,9 +1289,11 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
upu_info ? upu_info_local_nonprim : NULL,
mico_allowed ? mico_allowed->valueint : 0,
shared_am_data_ids ? shared_am_data_idsList : NULL,
odb_packet_services ? odb_packet_services_local_nonprim : NULL,
odb_packet_services ? odb_packet_servicesVariable : 0,
subscribed_dnn_list ? subscribed_dnn_listList : NULL,
service_gap_time ? service_gap_time->valuedouble : 0,
mdt_user_consent ? mdt_user_consentVariable : 0,
mdt_configuration ? mdt_configuration_local_nonprim : NULL,
trace_data ? trace_data_local_nonprim : NULL,
cag_data ? cag_data_local_nonprim : NULL,
stn_sr ? ogs_strdup(stn_sr->valuestring) : NULL,
@ -1446,20 +1301,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
nb_io_t_ue_priority ? nb_io_t_ue_priority->valuedouble : 0,
nssai_inclusion_allowed ? nssai_inclusion_allowed->valueint : 0,
rg_wireline_characteristics ? rg_wireline_characteristics->valueint : 0,
rg_tmbr ? rg_tmbr_local_nonprim : NULL,
ec_restriction_data ? ec_restriction_data_local_nonprim : NULL,
ec_restriction_data_wb ? ec_restriction_data_wb_local_nonprim : NULL,
ec_restriction_data_nb ? ec_restriction_data_nb->valueint : 0,
expected_ue_behaviour_list ? expected_ue_behaviour_list_local_nonprim : NULL,
maximum_response_time_list ? maximum_response_time_listList : NULL,
maximum_latency_list ? maximum_latency_listList : NULL,
primary_rat_restrictions ? primary_rat_restrictionsList : NULL,
secondary_rat_restrictions ? secondary_rat_restrictionsList : NULL,
edrx_parameters_list ? edrx_parameters_listList : NULL,
ptw_parameters_list ? ptw_parameters_listList : NULL,
iab_operation_allowed ? iab_operation_allowed->valueint : 0,
nr_v2x_services_auth ? nr_v2x_services_auth_local_nonprim : NULL,
lte_v2x_services_auth ? lte_v2x_services_auth_local_nonprim : NULL,
nr_ue_pc5_ambr ? ogs_strdup(nr_ue_pc5_ambr->valuestring) : NULL,
lte_pc5_ambr ? ogs_strdup(lte_pc5_ambr->valuestring) : NULL
wireline_forbidden_areas ? wireline_forbidden_areasList : NULL,
wireline_service_area_restriction ? wireline_service_area_restriction_local_nonprim : NULL
);
return access_and_mobility_subscription_data_local_var;

View File

@ -16,13 +16,11 @@
#include "area.h"
#include "cag_data.h"
#include "core_network_type.h"
#include "ec_restriction_data.h"
#include "ec_restriction_data_wb.h"
#include "edrx_parameters.h"
#include "expected_ue_behaviour_data.h"
#include "lte_v2x_auth.h"
#include "maximum_latency.h"
#include "maximum_response_time.h"
#include "nr_v2x_auth.h"
#include "mdt_configuration.h"
#include "mdt_user_consent.h"
#include "nssai.h"
#include "odb_packet_services.h"
#include "ptw_parameters.h"
@ -30,10 +28,10 @@
#include "service_area_restriction.h"
#include "sor_info.h"
#include "sor_update_indicator.h"
#include "tmbr.h"
#include "trace_data.h"
#include "upu_info.h"
#include "vn_group_data.h"
#include "wireline_area.h"
#include "wireline_service_area_restriction.h"
#ifdef __cplusplus
extern "C" {
@ -44,7 +42,6 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
char *supported_features;
OpenAPI_list_t *gpsis;
OpenAPI_list_t *internal_group_ids;
OpenAPI_list_t* vn_group_info;
OpenAPI_list_t* shared_vn_group_data_ids;
struct OpenAPI_ambr_rm_s *subscribed_ue_ambr;
struct OpenAPI_nssai_s *nssai;
@ -58,7 +55,6 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
int mps_priority;
int mcs_priority;
int active_time;
int dl_packet_count;
struct OpenAPI_sor_info_s *sor_info;
int sor_info_expect_ind;
int soraf_retrieval;
@ -66,9 +62,11 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
struct OpenAPI_upu_info_s *upu_info;
int mico_allowed;
OpenAPI_list_t *shared_am_data_ids;
struct OpenAPI_odb_packet_services_s *odb_packet_services;
OpenAPI_odb_packet_services_e odb_packet_services;
OpenAPI_list_t *subscribed_dnn_list;
int service_gap_time;
OpenAPI_mdt_user_consent_e mdt_user_consent;
struct OpenAPI_mdt_configuration_s *mdt_configuration;
struct OpenAPI_trace_data_s *trace_data;
struct OpenAPI_cag_data_s *cag_data;
char *stn_sr;
@ -76,27 +74,22 @@ typedef struct OpenAPI_access_and_mobility_subscription_data_s {
int nb_io_t_ue_priority;
int nssai_inclusion_allowed;
char rg_wireline_characteristics;
struct OpenAPI_tmbr_s *rg_tmbr;
struct OpenAPI_ec_restriction_data_s *ec_restriction_data;
struct OpenAPI_ec_restriction_data_wb_s *ec_restriction_data_wb;
int ec_restriction_data_nb;
struct OpenAPI_expected_ue_behaviour_data_s *expected_ue_behaviour_list;
OpenAPI_list_t *maximum_response_time_list;
OpenAPI_list_t *maximum_latency_list;
OpenAPI_list_t *primary_rat_restrictions;
OpenAPI_list_t *secondary_rat_restrictions;
OpenAPI_list_t *edrx_parameters_list;
OpenAPI_list_t *ptw_parameters_list;
int iab_operation_allowed;
struct OpenAPI_nr_v2x_auth_s *nr_v2x_services_auth;
struct OpenAPI_lte_v2x_auth_s *lte_v2x_services_auth;
char *nr_ue_pc5_ambr;
char *lte_pc5_ambr;
OpenAPI_list_t *wireline_forbidden_areas;
struct OpenAPI_wireline_service_area_restriction_s *wireline_service_area_restriction;
} OpenAPI_access_and_mobility_subscription_data_t;
OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_create(
char *supported_features,
OpenAPI_list_t *gpsis,
OpenAPI_list_t *internal_group_ids,
OpenAPI_list_t* vn_group_info,
OpenAPI_list_t* shared_vn_group_data_ids,
OpenAPI_ambr_rm_t *subscribed_ue_ambr,
OpenAPI_nssai_t *nssai,
@ -110,7 +103,6 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int mps_priority,
int mcs_priority,
int active_time,
int dl_packet_count,
OpenAPI_sor_info_t *sor_info,
int sor_info_expect_ind,
int soraf_retrieval,
@ -118,9 +110,11 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
OpenAPI_upu_info_t *upu_info,
int mico_allowed,
OpenAPI_list_t *shared_am_data_ids,
OpenAPI_odb_packet_services_t *odb_packet_services,
OpenAPI_odb_packet_services_e odb_packet_services,
OpenAPI_list_t *subscribed_dnn_list,
int service_gap_time,
OpenAPI_mdt_user_consent_e mdt_user_consent,
OpenAPI_mdt_configuration_t *mdt_configuration,
OpenAPI_trace_data_t *trace_data,
OpenAPI_cag_data_t *cag_data,
char *stn_sr,
@ -128,20 +122,16 @@ OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_sub
int nb_io_t_ue_priority,
int nssai_inclusion_allowed,
char rg_wireline_characteristics,
OpenAPI_tmbr_t *rg_tmbr,
OpenAPI_ec_restriction_data_t *ec_restriction_data,
OpenAPI_ec_restriction_data_wb_t *ec_restriction_data_wb,
int ec_restriction_data_nb,
OpenAPI_expected_ue_behaviour_data_t *expected_ue_behaviour_list,
OpenAPI_list_t *maximum_response_time_list,
OpenAPI_list_t *maximum_latency_list,
OpenAPI_list_t *primary_rat_restrictions,
OpenAPI_list_t *secondary_rat_restrictions,
OpenAPI_list_t *edrx_parameters_list,
OpenAPI_list_t *ptw_parameters_list,
int iab_operation_allowed,
OpenAPI_nr_v2x_auth_t *nr_v2x_services_auth,
OpenAPI_lte_v2x_auth_t *lte_v2x_services_auth,
char *nr_ue_pc5_ambr,
char *lte_pc5_ambr
OpenAPI_list_t *wireline_forbidden_areas,
OpenAPI_wireline_service_area_restriction_t *wireline_service_area_restriction
);
void OpenAPI_access_and_mobility_subscription_data_free(OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data);
OpenAPI_access_and_mobility_subscription_data_t *OpenAPI_access_and_mobility_subscription_data_parseFromJSON(cJSON *access_and_mobility_subscription_dataJSON);

View File

@ -0,0 +1,30 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "access_network_id.h"
char* OpenAPI_access_network_id_ToString(OpenAPI_access_network_id_e access_network_id)
{
const char *access_network_idArray[] = { "NULL", "HRPD", "WIMAX", "WLAN", "ETHERNET" };
size_t sizeofArray = sizeof(access_network_idArray) / sizeof(access_network_idArray[0]);
if (access_network_id < sizeofArray)
return (char *)access_network_idArray[access_network_id];
else
return (char *)"Unknown";
}
OpenAPI_access_network_id_e OpenAPI_access_network_id_FromString(char* access_network_id)
{
int stringToReturn = 0;
const char *access_network_idArray[] = { "NULL", "HRPD", "WIMAX", "WLAN", "ETHERNET" };
size_t sizeofArray = sizeof(access_network_idArray) / sizeof(access_network_idArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(access_network_id, access_network_idArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
return 0;
}

View File

@ -0,0 +1,31 @@
/*
* access_network_id.h
*
*
*/
#ifndef _OpenAPI_access_network_id_H_
#define _OpenAPI_access_network_id_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum { OpenAPI_access_network_id_NULL = 0, OpenAPI_access_network_id_HRPD, OpenAPI_access_network_id_WIMAX, OpenAPI_access_network_id_WLAN, OpenAPI_access_network_id_ETHERNET } OpenAPI_access_network_id_e;
char* OpenAPI_access_network_id_ToString(OpenAPI_access_network_id_e access_network_id);
OpenAPI_access_network_id_e OpenAPI_access_network_id_FromString(char* access_network_id);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_access_network_id_H_ */

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "additional_qos_flow_info.h"
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_create(
)
char* OpenAPI_additional_qos_flow_info_ToString(OpenAPI_additional_qos_flow_info_e additional_qos_flow_info)
{
OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_additional_qos_flow_info_t));
if (!additional_qos_flow_info_local_var) {
return NULL;
}
return additional_qos_flow_info_local_var;
const char *additional_qos_flow_infoArray[] = { "NULL", "MORE_LIKELY" };
size_t sizeofArray = sizeof(additional_qos_flow_infoArray) / sizeof(additional_qos_flow_infoArray[0]);
if (additional_qos_flow_info < sizeofArray)
return (char *)additional_qos_flow_infoArray[additional_qos_flow_info];
else
return (char *)"Unknown";
}
void OpenAPI_additional_qos_flow_info_free(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info)
OpenAPI_additional_qos_flow_info_e OpenAPI_additional_qos_flow_info_FromString(char* additional_qos_flow_info)
{
if (NULL == additional_qos_flow_info) {
return;
int stringToReturn = 0;
const char *additional_qos_flow_infoArray[] = { "NULL", "MORE_LIKELY" };
size_t sizeofArray = sizeof(additional_qos_flow_infoArray) / sizeof(additional_qos_flow_infoArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(additional_qos_flow_info, additional_qos_flow_infoArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(additional_qos_flow_info);
}
cJSON *OpenAPI_additional_qos_flow_info_convertToJSON(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info)
{
cJSON *item = NULL;
if (additional_qos_flow_info == NULL) {
ogs_error("OpenAPI_additional_qos_flow_info_convertToJSON() failed [AdditionalQosFlowInfo]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_parseFromJSON(cJSON *additional_qos_flow_infoJSON)
{
OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info_local_var = NULL;
additional_qos_flow_info_local_var = OpenAPI_additional_qos_flow_info_create (
);
return additional_qos_flow_info_local_var;
end:
return NULL;
}
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_copy(OpenAPI_additional_qos_flow_info_t *dst, OpenAPI_additional_qos_flow_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_additional_qos_flow_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_additional_qos_flow_info_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_additional_qos_flow_info_free(dst);
dst = OpenAPI_additional_qos_flow_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -12,22 +12,16 @@
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_additional_qos_flow_info_s OpenAPI_additional_qos_flow_info_t;
typedef struct OpenAPI_additional_qos_flow_info_s {
} OpenAPI_additional_qos_flow_info_t;
typedef enum { OpenAPI_additional_qos_flow_info_NULL = 0, OpenAPI_additional_qos_flow_info_MORE_LIKELY } OpenAPI_additional_qos_flow_info_e;
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_create(
);
void OpenAPI_additional_qos_flow_info_free(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info);
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_parseFromJSON(cJSON *additional_qos_flow_infoJSON);
cJSON *OpenAPI_additional_qos_flow_info_convertToJSON(OpenAPI_additional_qos_flow_info_t *additional_qos_flow_info);
OpenAPI_additional_qos_flow_info_t *OpenAPI_additional_qos_flow_info_copy(OpenAPI_additional_qos_flow_info_t *dst, OpenAPI_additional_qos_flow_info_t *src);
char* OpenAPI_additional_qos_flow_info_ToString(OpenAPI_additional_qos_flow_info_e additional_qos_flow_info);
OpenAPI_additional_qos_flow_info_e OpenAPI_additional_qos_flow_info_FromString(char* additional_qos_flow_info);
#ifdef __cplusplus
}

View File

@ -1,226 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "af_non_external.h"
OpenAPI_af_non_external_t *OpenAPI_af_non_external_create(
char *af_id,
OpenAPI_list_t *allowed_geographic_area,
OpenAPI_privacy_check_related_action_e privacy_check_related_action,
OpenAPI_code_word_ind_e code_word_ind,
OpenAPI_valid_time_period_t *valid_time_period
)
{
OpenAPI_af_non_external_t *af_non_external_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_non_external_t));
if (!af_non_external_local_var) {
return NULL;
}
af_non_external_local_var->af_id = af_id;
af_non_external_local_var->allowed_geographic_area = allowed_geographic_area;
af_non_external_local_var->privacy_check_related_action = privacy_check_related_action;
af_non_external_local_var->code_word_ind = code_word_ind;
af_non_external_local_var->valid_time_period = valid_time_period;
return af_non_external_local_var;
}
void OpenAPI_af_non_external_free(OpenAPI_af_non_external_t *af_non_external)
{
if (NULL == af_non_external) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(af_non_external->af_id);
OpenAPI_list_for_each(af_non_external->allowed_geographic_area, node) {
OpenAPI_geographic_area_free(node->data);
}
OpenAPI_list_free(af_non_external->allowed_geographic_area);
OpenAPI_valid_time_period_free(af_non_external->valid_time_period);
ogs_free(af_non_external);
}
cJSON *OpenAPI_af_non_external_convertToJSON(OpenAPI_af_non_external_t *af_non_external)
{
cJSON *item = NULL;
if (af_non_external == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [AfNonExternal]");
return NULL;
}
item = cJSON_CreateObject();
if (!af_non_external->af_id) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [af_id]");
goto end;
}
if (cJSON_AddStringToObject(item, "afId", af_non_external->af_id) == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [af_id]");
goto end;
}
if (af_non_external->allowed_geographic_area) {
cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea");
if (allowed_geographic_areaList == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [allowed_geographic_area]");
goto end;
}
OpenAPI_lnode_t *allowed_geographic_area_node;
if (af_non_external->allowed_geographic_area) {
OpenAPI_list_for_each(af_non_external->allowed_geographic_area, allowed_geographic_area_node) {
cJSON *itemLocal = OpenAPI_geographic_area_convertToJSON(allowed_geographic_area_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [allowed_geographic_area]");
goto end;
}
cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal);
}
}
}
if (af_non_external->privacy_check_related_action) {
if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(af_non_external->privacy_check_related_action)) == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [privacy_check_related_action]");
goto end;
}
}
if (af_non_external->code_word_ind) {
if (cJSON_AddStringToObject(item, "codeWordInd", OpenAPI_code_word_ind_ToString(af_non_external->code_word_ind)) == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [code_word_ind]");
goto end;
}
}
if (af_non_external->valid_time_period) {
cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_convertToJSON(af_non_external->valid_time_period);
if (valid_time_period_local_JSON == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [valid_time_period]");
goto end;
}
cJSON_AddItemToObject(item, "validTimePeriod", valid_time_period_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_af_non_external_convertToJSON() failed [valid_time_period]");
goto end;
}
}
end:
return item;
}
OpenAPI_af_non_external_t *OpenAPI_af_non_external_parseFromJSON(cJSON *af_non_externalJSON)
{
OpenAPI_af_non_external_t *af_non_external_local_var = NULL;
cJSON *af_id = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "afId");
if (!af_id) {
ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [af_id]");
goto end;
}
if (!cJSON_IsString(af_id)) {
ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [af_id]");
goto end;
}
cJSON *allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "allowedGeographicArea");
OpenAPI_list_t *allowed_geographic_areaList;
if (allowed_geographic_area) {
cJSON *allowed_geographic_area_local_nonprimitive;
if (!cJSON_IsArray(allowed_geographic_area)) {
ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [allowed_geographic_area]");
goto end;
}
allowed_geographic_areaList = OpenAPI_list_create();
cJSON_ArrayForEach(allowed_geographic_area_local_nonprimitive, allowed_geographic_area ) {
if (!cJSON_IsObject(allowed_geographic_area_local_nonprimitive)) {
ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [allowed_geographic_area]");
goto end;
}
OpenAPI_geographic_area_t *allowed_geographic_areaItem = OpenAPI_geographic_area_parseFromJSON(allowed_geographic_area_local_nonprimitive);
OpenAPI_list_add(allowed_geographic_areaList, allowed_geographic_areaItem);
}
}
cJSON *privacy_check_related_action = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "privacyCheckRelatedAction");
OpenAPI_privacy_check_related_action_e privacy_check_related_actionVariable;
if (privacy_check_related_action) {
if (!cJSON_IsString(privacy_check_related_action)) {
ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [privacy_check_related_action]");
goto end;
}
privacy_check_related_actionVariable = OpenAPI_privacy_check_related_action_FromString(privacy_check_related_action->valuestring);
}
cJSON *code_word_ind = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "codeWordInd");
OpenAPI_code_word_ind_e code_word_indVariable;
if (code_word_ind) {
if (!cJSON_IsString(code_word_ind)) {
ogs_error("OpenAPI_af_non_external_parseFromJSON() failed [code_word_ind]");
goto end;
}
code_word_indVariable = OpenAPI_code_word_ind_FromString(code_word_ind->valuestring);
}
cJSON *valid_time_period = cJSON_GetObjectItemCaseSensitive(af_non_externalJSON, "validTimePeriod");
OpenAPI_valid_time_period_t *valid_time_period_local_nonprim = NULL;
if (valid_time_period) {
valid_time_period_local_nonprim = OpenAPI_valid_time_period_parseFromJSON(valid_time_period);
}
af_non_external_local_var = OpenAPI_af_non_external_create (
ogs_strdup(af_id->valuestring),
allowed_geographic_area ? allowed_geographic_areaList : NULL,
privacy_check_related_action ? privacy_check_related_actionVariable : 0,
code_word_ind ? code_word_indVariable : 0,
valid_time_period ? valid_time_period_local_nonprim : NULL
);
return af_non_external_local_var;
end:
return NULL;
}
OpenAPI_af_non_external_t *OpenAPI_af_non_external_copy(OpenAPI_af_non_external_t *dst, OpenAPI_af_non_external_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_af_non_external_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_af_non_external_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_non_external_free(dst);
dst = OpenAPI_af_non_external_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -1,50 +0,0 @@
/*
* af_non_external.h
*
*
*/
#ifndef _OpenAPI_af_non_external_H_
#define _OpenAPI_af_non_external_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "code_word_ind.h"
#include "geographic_area.h"
#include "privacy_check_related_action.h"
#include "valid_time_period.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_af_non_external_s OpenAPI_af_non_external_t;
typedef struct OpenAPI_af_non_external_s {
char *af_id;
OpenAPI_list_t *allowed_geographic_area;
OpenAPI_privacy_check_related_action_e privacy_check_related_action;
OpenAPI_code_word_ind_e code_word_ind;
struct OpenAPI_valid_time_period_s *valid_time_period;
} OpenAPI_af_non_external_t;
OpenAPI_af_non_external_t *OpenAPI_af_non_external_create(
char *af_id,
OpenAPI_list_t *allowed_geographic_area,
OpenAPI_privacy_check_related_action_e privacy_check_related_action,
OpenAPI_code_word_ind_e code_word_ind,
OpenAPI_valid_time_period_t *valid_time_period
);
void OpenAPI_af_non_external_free(OpenAPI_af_non_external_t *af_non_external);
OpenAPI_af_non_external_t *OpenAPI_af_non_external_parseFromJSON(cJSON *af_non_externalJSON);
cJSON *OpenAPI_af_non_external_convertToJSON(OpenAPI_af_non_external_t *af_non_external);
OpenAPI_af_non_external_t *OpenAPI_af_non_external_copy(OpenAPI_af_non_external_t *dst, OpenAPI_af_non_external_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_af_non_external_H_ */

View File

@ -0,0 +1,188 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "alternative_qos_profile.h"
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_create(
int index,
char *gua_fbr_dl,
char *gua_fbr_ul,
int packet_delay_budget,
char *packet_err_rate
)
{
OpenAPI_alternative_qos_profile_t *alternative_qos_profile_local_var = OpenAPI_malloc(sizeof(OpenAPI_alternative_qos_profile_t));
if (!alternative_qos_profile_local_var) {
return NULL;
}
alternative_qos_profile_local_var->index = index;
alternative_qos_profile_local_var->gua_fbr_dl = gua_fbr_dl;
alternative_qos_profile_local_var->gua_fbr_ul = gua_fbr_ul;
alternative_qos_profile_local_var->packet_delay_budget = packet_delay_budget;
alternative_qos_profile_local_var->packet_err_rate = packet_err_rate;
return alternative_qos_profile_local_var;
}
void OpenAPI_alternative_qos_profile_free(OpenAPI_alternative_qos_profile_t *alternative_qos_profile)
{
if (NULL == alternative_qos_profile) {
return;
}
OpenAPI_lnode_t *node;
ogs_free(alternative_qos_profile->gua_fbr_dl);
ogs_free(alternative_qos_profile->gua_fbr_ul);
ogs_free(alternative_qos_profile->packet_err_rate);
ogs_free(alternative_qos_profile);
}
cJSON *OpenAPI_alternative_qos_profile_convertToJSON(OpenAPI_alternative_qos_profile_t *alternative_qos_profile)
{
cJSON *item = NULL;
if (alternative_qos_profile == NULL) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [AlternativeQosProfile]");
return NULL;
}
item = cJSON_CreateObject();
if (!alternative_qos_profile->index) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [index]");
goto end;
}
if (cJSON_AddNumberToObject(item, "index", alternative_qos_profile->index) == NULL) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [index]");
goto end;
}
if (alternative_qos_profile->gua_fbr_dl) {
if (cJSON_AddStringToObject(item, "guaFbrDl", alternative_qos_profile->gua_fbr_dl) == NULL) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [gua_fbr_dl]");
goto end;
}
}
if (alternative_qos_profile->gua_fbr_ul) {
if (cJSON_AddStringToObject(item, "guaFbrUl", alternative_qos_profile->gua_fbr_ul) == NULL) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [gua_fbr_ul]");
goto end;
}
}
if (alternative_qos_profile->packet_delay_budget) {
if (cJSON_AddNumberToObject(item, "packetDelayBudget", alternative_qos_profile->packet_delay_budget) == NULL) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [packet_delay_budget]");
goto end;
}
}
if (alternative_qos_profile->packet_err_rate) {
if (cJSON_AddStringToObject(item, "packetErrRate", alternative_qos_profile->packet_err_rate) == NULL) {
ogs_error("OpenAPI_alternative_qos_profile_convertToJSON() failed [packet_err_rate]");
goto end;
}
}
end:
return item;
}
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON(cJSON *alternative_qos_profileJSON)
{
OpenAPI_alternative_qos_profile_t *alternative_qos_profile_local_var = NULL;
cJSON *index = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "index");
if (!index) {
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [index]");
goto end;
}
if (!cJSON_IsNumber(index)) {
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [index]");
goto end;
}
cJSON *gua_fbr_dl = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrDl");
if (gua_fbr_dl) {
if (!cJSON_IsString(gua_fbr_dl)) {
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [gua_fbr_dl]");
goto end;
}
}
cJSON *gua_fbr_ul = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "guaFbrUl");
if (gua_fbr_ul) {
if (!cJSON_IsString(gua_fbr_ul)) {
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [gua_fbr_ul]");
goto end;
}
}
cJSON *packet_delay_budget = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetDelayBudget");
if (packet_delay_budget) {
if (!cJSON_IsNumber(packet_delay_budget)) {
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [packet_delay_budget]");
goto end;
}
}
cJSON *packet_err_rate = cJSON_GetObjectItemCaseSensitive(alternative_qos_profileJSON, "packetErrRate");
if (packet_err_rate) {
if (!cJSON_IsString(packet_err_rate)) {
ogs_error("OpenAPI_alternative_qos_profile_parseFromJSON() failed [packet_err_rate]");
goto end;
}
}
alternative_qos_profile_local_var = OpenAPI_alternative_qos_profile_create (
index->valuedouble,
gua_fbr_dl ? ogs_strdup(gua_fbr_dl->valuestring) : NULL,
gua_fbr_ul ? ogs_strdup(gua_fbr_ul->valuestring) : NULL,
packet_delay_budget ? packet_delay_budget->valuedouble : 0,
packet_err_rate ? ogs_strdup(packet_err_rate->valuestring) : NULL
);
return alternative_qos_profile_local_var;
end:
return NULL;
}
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_copy(OpenAPI_alternative_qos_profile_t *dst, OpenAPI_alternative_qos_profile_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_alternative_qos_profile_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_alternative_qos_profile_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_alternative_qos_profile_free(dst);
dst = OpenAPI_alternative_qos_profile_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,46 @@
/*
* alternative_qos_profile.h
*
*
*/
#ifndef _OpenAPI_alternative_qos_profile_H_
#define _OpenAPI_alternative_qos_profile_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_alternative_qos_profile_s OpenAPI_alternative_qos_profile_t;
typedef struct OpenAPI_alternative_qos_profile_s {
int index;
char *gua_fbr_dl;
char *gua_fbr_ul;
int packet_delay_budget;
char *packet_err_rate;
} OpenAPI_alternative_qos_profile_t;
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_create(
int index,
char *gua_fbr_dl,
char *gua_fbr_ul,
int packet_delay_budget,
char *packet_err_rate
);
void OpenAPI_alternative_qos_profile_free(OpenAPI_alternative_qos_profile_t *alternative_qos_profile);
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_parseFromJSON(cJSON *alternative_qos_profileJSON);
cJSON *OpenAPI_alternative_qos_profile_convertToJSON(OpenAPI_alternative_qos_profile_t *alternative_qos_profile);
OpenAPI_alternative_qos_profile_t *OpenAPI_alternative_qos_profile_copy(OpenAPI_alternative_qos_profile_t *dst, OpenAPI_alternative_qos_profile_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_alternative_qos_profile_H_ */

View File

@ -12,6 +12,8 @@
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "ambr.h"
#include "null_value.h"
#ifdef __cplusplus
extern "C" {

View File

@ -21,12 +21,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre
OpenAPI_rat_type_e rat_type,
int urrp_indicator,
char *amf_ee_subscription_id,
OpenAPI_eps_interworking_info_t *eps_interworking_info,
int ue_srvcc_capability,
char *nid,
char *registration_time,
char *vgmlc_address_ipv4,
char *vgmlc_address_ipv6,
char *vgmlc_fqdn
OpenAPI_vgmlc_address_t *vgmlc_address,
OpenAPI_context_info_t *context_info,
int no_ee_subscription_ind
)
{
OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_t));
@ -49,12 +49,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre
amf3_gpp_access_registration_local_var->rat_type = rat_type;
amf3_gpp_access_registration_local_var->urrp_indicator = urrp_indicator;
amf3_gpp_access_registration_local_var->amf_ee_subscription_id = amf_ee_subscription_id;
amf3_gpp_access_registration_local_var->eps_interworking_info = eps_interworking_info;
amf3_gpp_access_registration_local_var->ue_srvcc_capability = ue_srvcc_capability;
amf3_gpp_access_registration_local_var->nid = nid;
amf3_gpp_access_registration_local_var->registration_time = registration_time;
amf3_gpp_access_registration_local_var->vgmlc_address_ipv4 = vgmlc_address_ipv4;
amf3_gpp_access_registration_local_var->vgmlc_address_ipv6 = vgmlc_address_ipv6;
amf3_gpp_access_registration_local_var->vgmlc_fqdn = vgmlc_fqdn;
amf3_gpp_access_registration_local_var->vgmlc_address = vgmlc_address;
amf3_gpp_access_registration_local_var->context_info = context_info;
amf3_gpp_access_registration_local_var->no_ee_subscription_ind = no_ee_subscription_ind;
return amf3_gpp_access_registration_local_var;
}
@ -79,11 +79,10 @@ void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registrat
}
OpenAPI_list_free(amf3_gpp_access_registration->backup_amf_info);
ogs_free(amf3_gpp_access_registration->amf_ee_subscription_id);
ogs_free(amf3_gpp_access_registration->nid);
OpenAPI_eps_interworking_info_free(amf3_gpp_access_registration->eps_interworking_info);
ogs_free(amf3_gpp_access_registration->registration_time);
ogs_free(amf3_gpp_access_registration->vgmlc_address_ipv4);
ogs_free(amf3_gpp_access_registration->vgmlc_address_ipv6);
ogs_free(amf3_gpp_access_registration->vgmlc_fqdn);
OpenAPI_vgmlc_address_free(amf3_gpp_access_registration->vgmlc_address);
OpenAPI_context_info_free(amf3_gpp_access_registration->context_info);
ogs_free(amf3_gpp_access_registration);
}
@ -242,16 +241,22 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces
}
}
if (amf3_gpp_access_registration->ue_srvcc_capability) {
if (cJSON_AddBoolToObject(item, "ueSrvccCapability", amf3_gpp_access_registration->ue_srvcc_capability) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_srvcc_capability]");
if (amf3_gpp_access_registration->eps_interworking_info) {
cJSON *eps_interworking_info_local_JSON = OpenAPI_eps_interworking_info_convertToJSON(amf3_gpp_access_registration->eps_interworking_info);
if (eps_interworking_info_local_JSON == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [eps_interworking_info]");
goto end;
}
cJSON_AddItemToObject(item, "epsInterworkingInfo", eps_interworking_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [eps_interworking_info]");
goto end;
}
}
if (amf3_gpp_access_registration->nid) {
if (cJSON_AddStringToObject(item, "nid", amf3_gpp_access_registration->nid) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [nid]");
if (amf3_gpp_access_registration->ue_srvcc_capability) {
if (cJSON_AddBoolToObject(item, "ueSrvccCapability", amf3_gpp_access_registration->ue_srvcc_capability) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ue_srvcc_capability]");
goto end;
}
}
@ -263,23 +268,35 @@ cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_acces
}
}
if (amf3_gpp_access_registration->vgmlc_address_ipv4) {
if (cJSON_AddStringToObject(item, "vgmlcAddressIpv4", amf3_gpp_access_registration->vgmlc_address_ipv4) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv4]");
if (amf3_gpp_access_registration->vgmlc_address) {
cJSON *vgmlc_address_local_JSON = OpenAPI_vgmlc_address_convertToJSON(amf3_gpp_access_registration->vgmlc_address);
if (vgmlc_address_local_JSON == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address]");
goto end;
}
cJSON_AddItemToObject(item, "vgmlcAddress", vgmlc_address_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address]");
goto end;
}
}
if (amf3_gpp_access_registration->vgmlc_address_ipv6) {
if (cJSON_AddStringToObject(item, "vgmlcAddressIpv6", amf3_gpp_access_registration->vgmlc_address_ipv6) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv6]");
if (amf3_gpp_access_registration->context_info) {
cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(amf3_gpp_access_registration->context_info);
if (context_info_local_JSON == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [context_info]");
goto end;
}
cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [context_info]");
goto end;
}
}
if (amf3_gpp_access_registration->vgmlc_fqdn) {
if (cJSON_AddStringToObject(item, "vgmlcFqdn", amf3_gpp_access_registration->vgmlc_fqdn) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [vgmlc_fqdn]");
if (amf3_gpp_access_registration->no_ee_subscription_ind) {
if (cJSON_AddBoolToObject(item, "noEeSubscriptionInd", amf3_gpp_access_registration->no_ee_subscription_ind) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [no_ee_subscription_ind]");
goto end;
}
}
@ -459,6 +476,13 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par
}
}
cJSON *eps_interworking_info = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "epsInterworkingInfo");
OpenAPI_eps_interworking_info_t *eps_interworking_info_local_nonprim = NULL;
if (eps_interworking_info) {
eps_interworking_info_local_nonprim = OpenAPI_eps_interworking_info_parseFromJSON(eps_interworking_info);
}
cJSON *ue_srvcc_capability = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "ueSrvccCapability");
if (ue_srvcc_capability) {
@ -468,15 +492,6 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par
}
}
cJSON *nid = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "nid");
if (nid) {
if (!cJSON_IsString(nid)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [nid]");
goto end;
}
}
cJSON *registration_time = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "registrationTime");
if (registration_time) {
@ -486,29 +501,25 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par
}
}
cJSON *vgmlc_address_ipv4 = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddressIpv4");
cJSON *vgmlc_address = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddress");
if (vgmlc_address_ipv4) {
if (!cJSON_IsString(vgmlc_address_ipv4)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv4]");
goto end;
}
OpenAPI_vgmlc_address_t *vgmlc_address_local_nonprim = NULL;
if (vgmlc_address) {
vgmlc_address_local_nonprim = OpenAPI_vgmlc_address_parseFromJSON(vgmlc_address);
}
cJSON *vgmlc_address_ipv6 = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddressIpv6");
cJSON *context_info = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "contextInfo");
if (vgmlc_address_ipv6) {
if (!cJSON_IsString(vgmlc_address_ipv6)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv6]");
goto end;
}
OpenAPI_context_info_t *context_info_local_nonprim = NULL;
if (context_info) {
context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info);
}
cJSON *vgmlc_fqdn = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcFqdn");
cJSON *no_ee_subscription_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "noEeSubscriptionInd");
if (vgmlc_fqdn) {
if (!cJSON_IsString(vgmlc_fqdn)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_fqdn]");
if (no_ee_subscription_ind) {
if (!cJSON_IsBool(no_ee_subscription_ind)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [no_ee_subscription_ind]");
goto end;
}
}
@ -530,12 +541,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_par
rat_typeVariable,
urrp_indicator ? urrp_indicator->valueint : 0,
amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : NULL,
eps_interworking_info ? eps_interworking_info_local_nonprim : NULL,
ue_srvcc_capability ? ue_srvcc_capability->valueint : 0,
nid ? ogs_strdup(nid->valuestring) : NULL,
registration_time ? ogs_strdup(registration_time->valuestring) : NULL,
vgmlc_address_ipv4 ? ogs_strdup(vgmlc_address_ipv4->valuestring) : NULL,
vgmlc_address_ipv6 ? ogs_strdup(vgmlc_address_ipv6->valuestring) : NULL,
vgmlc_fqdn ? ogs_strdup(vgmlc_fqdn->valuestring) : NULL
vgmlc_address ? vgmlc_address_local_nonprim : NULL,
context_info ? context_info_local_nonprim : NULL,
no_ee_subscription_ind ? no_ee_subscription_ind->valueint : 0
);
return amf3_gpp_access_registration_local_var;

View File

@ -13,9 +13,12 @@
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "backup_amf_info.h"
#include "context_info.h"
#include "eps_interworking_info.h"
#include "guami.h"
#include "ims_vo_ps.h"
#include "rat_type.h"
#include "vgmlc_address.h"
#ifdef __cplusplus
extern "C" {
@ -39,12 +42,12 @@ typedef struct OpenAPI_amf3_gpp_access_registration_s {
OpenAPI_rat_type_e rat_type;
int urrp_indicator;
char *amf_ee_subscription_id;
struct OpenAPI_eps_interworking_info_s *eps_interworking_info;
int ue_srvcc_capability;
char *nid;
char *registration_time;
char *vgmlc_address_ipv4;
char *vgmlc_address_ipv6;
char *vgmlc_fqdn;
struct OpenAPI_vgmlc_address_s *vgmlc_address;
struct OpenAPI_context_info_s *context_info;
int no_ee_subscription_ind;
} OpenAPI_amf3_gpp_access_registration_t;
OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_create(
@ -64,12 +67,12 @@ OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_cre
OpenAPI_rat_type_e rat_type,
int urrp_indicator,
char *amf_ee_subscription_id,
OpenAPI_eps_interworking_info_t *eps_interworking_info,
int ue_srvcc_capability,
char *nid,
char *registration_time,
char *vgmlc_address_ipv4,
char *vgmlc_address_ipv6,
char *vgmlc_fqdn
OpenAPI_vgmlc_address_t *vgmlc_address,
OpenAPI_context_info_t *context_info,
int no_ee_subscription_ind
);
void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration);
OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_parseFromJSON(cJSON *amf3_gpp_access_registrationJSON);

View File

@ -11,7 +11,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_list_t *backup_amf_info,
OpenAPI_eps_interworking_info_t *eps_interworking_info,
int ue_srvcc_capability
int ue_srvcc_capability,
int no_ee_subscription_ind
)
{
OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_modification_t));
@ -25,6 +26,7 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
amf3_gpp_access_registration_modification_local_var->backup_amf_info = backup_amf_info;
amf3_gpp_access_registration_modification_local_var->eps_interworking_info = eps_interworking_info;
amf3_gpp_access_registration_modification_local_var->ue_srvcc_capability = ue_srvcc_capability;
amf3_gpp_access_registration_modification_local_var->no_ee_subscription_ind = no_ee_subscription_ind;
return amf3_gpp_access_registration_modification_local_var;
}
@ -138,6 +140,13 @@ cJSON *OpenAPI_amf3_gpp_access_registration_modification_convertToJSON(OpenAPI_a
}
}
if (amf3_gpp_access_registration_modification->no_ee_subscription_ind) {
if (cJSON_AddBoolToObject(item, "noEeSubscriptionInd", amf3_gpp_access_registration_modification->no_ee_subscription_ind) == NULL) {
ogs_error("OpenAPI_amf3_gpp_access_registration_modification_convertToJSON() failed [no_ee_subscription_ind]");
goto end;
}
}
end:
return item;
}
@ -219,6 +228,15 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
}
}
cJSON *no_ee_subscription_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registration_modificationJSON, "noEeSubscriptionInd");
if (no_ee_subscription_ind) {
if (!cJSON_IsBool(no_ee_subscription_ind)) {
ogs_error("OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON() failed [no_ee_subscription_ind]");
goto end;
}
}
amf3_gpp_access_registration_modification_local_var = OpenAPI_amf3_gpp_access_registration_modification_create (
guami_local_nonprim,
purge_flag ? purge_flag->valueint : 0,
@ -226,7 +244,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
ims_vo_ps ? ims_vo_ps_local_nonprim : NULL,
backup_amf_info ? backup_amf_infoList : NULL,
eps_interworking_info ? eps_interworking_info_local_nonprim : NULL,
ue_srvcc_capability ? ue_srvcc_capability->valueint : 0
ue_srvcc_capability ? ue_srvcc_capability->valueint : 0,
no_ee_subscription_ind ? no_ee_subscription_ind->valueint : 0
);
return amf3_gpp_access_registration_modification_local_var;

View File

@ -30,6 +30,7 @@ typedef struct OpenAPI_amf3_gpp_access_registration_modification_s {
OpenAPI_list_t *backup_amf_info;
struct OpenAPI_eps_interworking_info_s *eps_interworking_info;
int ue_srvcc_capability;
int no_ee_subscription_ind;
} OpenAPI_amf3_gpp_access_registration_modification_t;
OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_create(
@ -39,7 +40,8 @@ OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_reg
OpenAPI_ims_vo_ps_t *ims_vo_ps,
OpenAPI_list_t *backup_amf_info,
OpenAPI_eps_interworking_info_t *eps_interworking_info,
int ue_srvcc_capability
int ue_srvcc_capability,
int no_ee_subscription_ind
);
void OpenAPI_amf3_gpp_access_registration_modification_free(OpenAPI_amf3_gpp_access_registration_modification_t *amf3_gpp_access_registration_modification);
OpenAPI_amf3_gpp_access_registration_modification_t *OpenAPI_amf3_gpp_access_registration_modification_parseFromJSON(cJSON *amf3_gpp_access_registration_modificationJSON);

View File

@ -19,11 +19,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
OpenAPI_rat_type_e rat_type,
int urrp_indicator,
char *amf_ee_subscription_id,
char *nid,
char *registration_time,
char *vgmlc_address_ipv4,
char *vgmlc_address_ipv6,
char *vgmlc_fqdn
OpenAPI_vgmlc_address_t *vgmlc_address,
OpenAPI_context_info_t *context_info
)
{
OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf_non3_gpp_access_registration_t));
@ -44,11 +42,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
amf_non3_gpp_access_registration_local_var->rat_type = rat_type;
amf_non3_gpp_access_registration_local_var->urrp_indicator = urrp_indicator;
amf_non3_gpp_access_registration_local_var->amf_ee_subscription_id = amf_ee_subscription_id;
amf_non3_gpp_access_registration_local_var->nid = nid;
amf_non3_gpp_access_registration_local_var->registration_time = registration_time;
amf_non3_gpp_access_registration_local_var->vgmlc_address_ipv4 = vgmlc_address_ipv4;
amf_non3_gpp_access_registration_local_var->vgmlc_address_ipv6 = vgmlc_address_ipv6;
amf_non3_gpp_access_registration_local_var->vgmlc_fqdn = vgmlc_fqdn;
amf_non3_gpp_access_registration_local_var->vgmlc_address = vgmlc_address;
amf_non3_gpp_access_registration_local_var->context_info = context_info;
return amf_non3_gpp_access_registration_local_var;
}
@ -73,11 +69,9 @@ void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_r
}
OpenAPI_list_free(amf_non3_gpp_access_registration->backup_amf_info);
ogs_free(amf_non3_gpp_access_registration->amf_ee_subscription_id);
ogs_free(amf_non3_gpp_access_registration->nid);
ogs_free(amf_non3_gpp_access_registration->registration_time);
ogs_free(amf_non3_gpp_access_registration->vgmlc_address_ipv4);
ogs_free(amf_non3_gpp_access_registration->vgmlc_address_ipv6);
ogs_free(amf_non3_gpp_access_registration->vgmlc_fqdn);
OpenAPI_vgmlc_address_free(amf_non3_gpp_access_registration->vgmlc_address);
OpenAPI_context_info_free(amf_non3_gpp_access_registration->context_info);
ogs_free(amf_non3_gpp_access_registration);
}
@ -224,13 +218,6 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g
}
}
if (amf_non3_gpp_access_registration->nid) {
if (cJSON_AddStringToObject(item, "nid", amf_non3_gpp_access_registration->nid) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [nid]");
goto end;
}
}
if (amf_non3_gpp_access_registration->registration_time) {
if (cJSON_AddStringToObject(item, "registrationTime", amf_non3_gpp_access_registration->registration_time) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [registration_time]");
@ -238,23 +225,28 @@ cJSON *OpenAPI_amf_non3_gpp_access_registration_convertToJSON(OpenAPI_amf_non3_g
}
}
if (amf_non3_gpp_access_registration->vgmlc_address_ipv4) {
if (cJSON_AddStringToObject(item, "vgmlcAddressIpv4", amf_non3_gpp_access_registration->vgmlc_address_ipv4) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv4]");
if (amf_non3_gpp_access_registration->vgmlc_address) {
cJSON *vgmlc_address_local_JSON = OpenAPI_vgmlc_address_convertToJSON(amf_non3_gpp_access_registration->vgmlc_address);
if (vgmlc_address_local_JSON == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address]");
goto end;
}
cJSON_AddItemToObject(item, "vgmlcAddress", vgmlc_address_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address]");
goto end;
}
}
if (amf_non3_gpp_access_registration->vgmlc_address_ipv6) {
if (cJSON_AddStringToObject(item, "vgmlcAddressIpv6", amf_non3_gpp_access_registration->vgmlc_address_ipv6) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_address_ipv6]");
if (amf_non3_gpp_access_registration->context_info) {
cJSON *context_info_local_JSON = OpenAPI_context_info_convertToJSON(amf_non3_gpp_access_registration->context_info);
if (context_info_local_JSON == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [context_info]");
goto end;
}
}
if (amf_non3_gpp_access_registration->vgmlc_fqdn) {
if (cJSON_AddStringToObject(item, "vgmlcFqdn", amf_non3_gpp_access_registration->vgmlc_fqdn) == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [vgmlc_fqdn]");
cJSON_AddItemToObject(item, "contextInfo", context_info_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_convertToJSON() failed [context_info]");
goto end;
}
}
@ -419,15 +411,6 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
}
}
cJSON *nid = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "nid");
if (nid) {
if (!cJSON_IsString(nid)) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [nid]");
goto end;
}
}
cJSON *registration_time = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "registrationTime");
if (registration_time) {
@ -437,31 +420,18 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
}
}
cJSON *vgmlc_address_ipv4 = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcAddressIpv4");
cJSON *vgmlc_address = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcAddress");
if (vgmlc_address_ipv4) {
if (!cJSON_IsString(vgmlc_address_ipv4)) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv4]");
goto end;
}
OpenAPI_vgmlc_address_t *vgmlc_address_local_nonprim = NULL;
if (vgmlc_address) {
vgmlc_address_local_nonprim = OpenAPI_vgmlc_address_parseFromJSON(vgmlc_address);
}
cJSON *vgmlc_address_ipv6 = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcAddressIpv6");
cJSON *context_info = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "contextInfo");
if (vgmlc_address_ipv6) {
if (!cJSON_IsString(vgmlc_address_ipv6)) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv6]");
goto end;
}
}
cJSON *vgmlc_fqdn = cJSON_GetObjectItemCaseSensitive(amf_non3_gpp_access_registrationJSON, "vgmlcFqdn");
if (vgmlc_fqdn) {
if (!cJSON_IsString(vgmlc_fqdn)) {
ogs_error("OpenAPI_amf_non3_gpp_access_registration_parseFromJSON() failed [vgmlc_fqdn]");
goto end;
}
OpenAPI_context_info_t *context_info_local_nonprim = NULL;
if (context_info) {
context_info_local_nonprim = OpenAPI_context_info_parseFromJSON(context_info);
}
amf_non3_gpp_access_registration_local_var = OpenAPI_amf_non3_gpp_access_registration_create (
@ -479,11 +449,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
rat_typeVariable,
urrp_indicator ? urrp_indicator->valueint : 0,
amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : NULL,
nid ? ogs_strdup(nid->valuestring) : NULL,
registration_time ? ogs_strdup(registration_time->valuestring) : NULL,
vgmlc_address_ipv4 ? ogs_strdup(vgmlc_address_ipv4->valuestring) : NULL,
vgmlc_address_ipv6 ? ogs_strdup(vgmlc_address_ipv6->valuestring) : NULL,
vgmlc_fqdn ? ogs_strdup(vgmlc_fqdn->valuestring) : NULL
vgmlc_address ? vgmlc_address_local_nonprim : NULL,
context_info ? context_info_local_nonprim : NULL
);
return amf_non3_gpp_access_registration_local_var;

View File

@ -13,9 +13,11 @@
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "backup_amf_info.h"
#include "context_info.h"
#include "guami.h"
#include "ims_vo_ps.h"
#include "rat_type.h"
#include "vgmlc_address.h"
#ifdef __cplusplus
extern "C" {
@ -37,11 +39,9 @@ typedef struct OpenAPI_amf_non3_gpp_access_registration_s {
OpenAPI_rat_type_e rat_type;
int urrp_indicator;
char *amf_ee_subscription_id;
char *nid;
char *registration_time;
char *vgmlc_address_ipv4;
char *vgmlc_address_ipv6;
char *vgmlc_fqdn;
struct OpenAPI_vgmlc_address_s *vgmlc_address;
struct OpenAPI_context_info_s *context_info;
} OpenAPI_amf_non3_gpp_access_registration_t;
OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_create(
@ -59,11 +59,9 @@ OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registra
OpenAPI_rat_type_e rat_type,
int urrp_indicator,
char *amf_ee_subscription_id,
char *nid,
char *registration_time,
char *vgmlc_address_ipv4,
char *vgmlc_address_ipv6,
char *vgmlc_fqdn
OpenAPI_vgmlc_address_t *vgmlc_address,
OpenAPI_context_info_t *context_info
);
void OpenAPI_amf_non3_gpp_access_registration_free(OpenAPI_amf_non3_gpp_access_registration_t *amf_non3_gpp_access_registration);
OpenAPI_amf_non3_gpp_access_registration_t *OpenAPI_amf_non3_gpp_access_registration_parseFromJSON(cJSON *amf_non3_gpp_access_registrationJSON);

View File

@ -4,82 +4,27 @@
#include <stdio.h>
#include "an_node_type.h"
OpenAPI_an_node_type_t *OpenAPI_an_node_type_create(
)
char* OpenAPI_an_node_type_ToString(OpenAPI_an_node_type_e an_node_type)
{
OpenAPI_an_node_type_t *an_node_type_local_var = OpenAPI_malloc(sizeof(OpenAPI_an_node_type_t));
if (!an_node_type_local_var) {
return NULL;
}
return an_node_type_local_var;
const char *an_node_typeArray[] = { "NULL", "GNB", "NG_ENB" };
size_t sizeofArray = sizeof(an_node_typeArray) / sizeof(an_node_typeArray[0]);
if (an_node_type < sizeofArray)
return (char *)an_node_typeArray[an_node_type];
else
return (char *)"Unknown";
}
void OpenAPI_an_node_type_free(OpenAPI_an_node_type_t *an_node_type)
OpenAPI_an_node_type_e OpenAPI_an_node_type_FromString(char* an_node_type)
{
if (NULL == an_node_type) {
return;
int stringToReturn = 0;
const char *an_node_typeArray[] = { "NULL", "GNB", "NG_ENB" };
size_t sizeofArray = sizeof(an_node_typeArray) / sizeof(an_node_typeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(an_node_type, an_node_typeArray[stringToReturn]) == 0) {
return stringToReturn;
}
stringToReturn++;
}
OpenAPI_lnode_t *node;
ogs_free(an_node_type);
}
cJSON *OpenAPI_an_node_type_convertToJSON(OpenAPI_an_node_type_t *an_node_type)
{
cJSON *item = NULL;
if (an_node_type == NULL) {
ogs_error("OpenAPI_an_node_type_convertToJSON() failed [AnNodeType]");
return NULL;
}
item = cJSON_CreateObject();
end:
return item;
}
OpenAPI_an_node_type_t *OpenAPI_an_node_type_parseFromJSON(cJSON *an_node_typeJSON)
{
OpenAPI_an_node_type_t *an_node_type_local_var = NULL;
an_node_type_local_var = OpenAPI_an_node_type_create (
);
return an_node_type_local_var;
end:
return NULL;
}
OpenAPI_an_node_type_t *OpenAPI_an_node_type_copy(OpenAPI_an_node_type_t *dst, OpenAPI_an_node_type_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_an_node_type_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_an_node_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_an_node_type_free(dst);
dst = OpenAPI_an_node_type_parseFromJSON(item);
cJSON_Delete(item);
return dst;
return 0;
}

View File

@ -17,16 +17,11 @@
extern "C" {
#endif
typedef struct OpenAPI_an_node_type_s OpenAPI_an_node_type_t;
typedef struct OpenAPI_an_node_type_s {
} OpenAPI_an_node_type_t;
typedef enum { OpenAPI_an_node_type_NULL = 0, OpenAPI_an_node_type_GNB, OpenAPI_an_node_type_NG_ENB } OpenAPI_an_node_type_e;
OpenAPI_an_node_type_t *OpenAPI_an_node_type_create(
);
void OpenAPI_an_node_type_free(OpenAPI_an_node_type_t *an_node_type);
OpenAPI_an_node_type_t *OpenAPI_an_node_type_parseFromJSON(cJSON *an_node_typeJSON);
cJSON *OpenAPI_an_node_type_convertToJSON(OpenAPI_an_node_type_t *an_node_type);
OpenAPI_an_node_type_t *OpenAPI_an_node_type_copy(OpenAPI_an_node_type_t *dst, OpenAPI_an_node_type_t *src);
char* OpenAPI_an_node_type_ToString(OpenAPI_an_node_type_e an_node_type);
OpenAPI_an_node_type_e OpenAPI_an_node_type_FromString(char* an_node_type);
#ifdef __cplusplus
}

View File

@ -0,0 +1,267 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "area_scope.h"
OpenAPI_area_scope_t *OpenAPI_area_scope_create(
OpenAPI_list_t *eutra_cell_id_list,
OpenAPI_list_t *nr_cell_id_list,
OpenAPI_list_t *tac_list,
OpenAPI_list_t* tac_info_per_plmn
)
{
OpenAPI_area_scope_t *area_scope_local_var = OpenAPI_malloc(sizeof(OpenAPI_area_scope_t));
if (!area_scope_local_var) {
return NULL;
}
area_scope_local_var->eutra_cell_id_list = eutra_cell_id_list;
area_scope_local_var->nr_cell_id_list = nr_cell_id_list;
area_scope_local_var->tac_list = tac_list;
area_scope_local_var->tac_info_per_plmn = tac_info_per_plmn;
return area_scope_local_var;
}
void OpenAPI_area_scope_free(OpenAPI_area_scope_t *area_scope)
{
if (NULL == area_scope) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(area_scope->eutra_cell_id_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(area_scope->eutra_cell_id_list);
OpenAPI_list_for_each(area_scope->nr_cell_id_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(area_scope->nr_cell_id_list);
OpenAPI_list_for_each(area_scope->tac_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(area_scope->tac_list);
OpenAPI_list_for_each(area_scope->tac_info_per_plmn, node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
OpenAPI_tac_info_free(localKeyValue->value);
ogs_free(localKeyValue);
}
OpenAPI_list_free(area_scope->tac_info_per_plmn);
ogs_free(area_scope);
}
cJSON *OpenAPI_area_scope_convertToJSON(OpenAPI_area_scope_t *area_scope)
{
cJSON *item = NULL;
if (area_scope == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [AreaScope]");
return NULL;
}
item = cJSON_CreateObject();
if (area_scope->eutra_cell_id_list) {
cJSON *eutra_cell_id_list = cJSON_AddArrayToObject(item, "eutraCellIdList");
if (eutra_cell_id_list == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [eutra_cell_id_list]");
goto end;
}
OpenAPI_lnode_t *eutra_cell_id_list_node;
OpenAPI_list_for_each(area_scope->eutra_cell_id_list, eutra_cell_id_list_node) {
if (cJSON_AddStringToObject(eutra_cell_id_list, "", (char*)eutra_cell_id_list_node->data) == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [eutra_cell_id_list]");
goto end;
}
}
}
if (area_scope->nr_cell_id_list) {
cJSON *nr_cell_id_list = cJSON_AddArrayToObject(item, "nrCellIdList");
if (nr_cell_id_list == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [nr_cell_id_list]");
goto end;
}
OpenAPI_lnode_t *nr_cell_id_list_node;
OpenAPI_list_for_each(area_scope->nr_cell_id_list, nr_cell_id_list_node) {
if (cJSON_AddStringToObject(nr_cell_id_list, "", (char*)nr_cell_id_list_node->data) == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [nr_cell_id_list]");
goto end;
}
}
}
if (area_scope->tac_list) {
cJSON *tac_list = cJSON_AddArrayToObject(item, "tacList");
if (tac_list == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_list]");
goto end;
}
OpenAPI_lnode_t *tac_list_node;
OpenAPI_list_for_each(area_scope->tac_list, tac_list_node) {
if (cJSON_AddStringToObject(tac_list, "", (char*)tac_list_node->data) == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_list]");
goto end;
}
}
}
if (area_scope->tac_info_per_plmn) {
cJSON *tac_info_per_plmn = cJSON_AddObjectToObject(item, "tacInfoPerPlmn");
if (tac_info_per_plmn == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]");
goto end;
}
cJSON *localMapObject = tac_info_per_plmn;
OpenAPI_lnode_t *tac_info_per_plmn_node;
if (area_scope->tac_info_per_plmn) {
OpenAPI_list_for_each(area_scope->tac_info_per_plmn, tac_info_per_plmn_node) {
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)tac_info_per_plmn_node->data;
cJSON *itemLocal = OpenAPI_tac_info_convertToJSON(localKeyValue->value);
if (itemLocal == NULL) {
ogs_error("OpenAPI_area_scope_convertToJSON() failed [tac_info_per_plmn]");
goto end;
}
cJSON_AddItemToObject(tac_info_per_plmn, localKeyValue->key, itemLocal);
}
}
}
end:
return item;
}
OpenAPI_area_scope_t *OpenAPI_area_scope_parseFromJSON(cJSON *area_scopeJSON)
{
OpenAPI_area_scope_t *area_scope_local_var = NULL;
cJSON *eutra_cell_id_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "eutraCellIdList");
OpenAPI_list_t *eutra_cell_id_listList;
if (eutra_cell_id_list) {
cJSON *eutra_cell_id_list_local;
if (!cJSON_IsArray(eutra_cell_id_list)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [eutra_cell_id_list]");
goto end;
}
eutra_cell_id_listList = OpenAPI_list_create();
cJSON_ArrayForEach(eutra_cell_id_list_local, eutra_cell_id_list) {
if (!cJSON_IsString(eutra_cell_id_list_local)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [eutra_cell_id_list]");
goto end;
}
OpenAPI_list_add(eutra_cell_id_listList, ogs_strdup(eutra_cell_id_list_local->valuestring));
}
}
cJSON *nr_cell_id_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "nrCellIdList");
OpenAPI_list_t *nr_cell_id_listList;
if (nr_cell_id_list) {
cJSON *nr_cell_id_list_local;
if (!cJSON_IsArray(nr_cell_id_list)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nr_cell_id_list]");
goto end;
}
nr_cell_id_listList = OpenAPI_list_create();
cJSON_ArrayForEach(nr_cell_id_list_local, nr_cell_id_list) {
if (!cJSON_IsString(nr_cell_id_list_local)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [nr_cell_id_list]");
goto end;
}
OpenAPI_list_add(nr_cell_id_listList, ogs_strdup(nr_cell_id_list_local->valuestring));
}
}
cJSON *tac_list = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacList");
OpenAPI_list_t *tac_listList;
if (tac_list) {
cJSON *tac_list_local;
if (!cJSON_IsArray(tac_list)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_list]");
goto end;
}
tac_listList = OpenAPI_list_create();
cJSON_ArrayForEach(tac_list_local, tac_list) {
if (!cJSON_IsString(tac_list_local)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_list]");
goto end;
}
OpenAPI_list_add(tac_listList, ogs_strdup(tac_list_local->valuestring));
}
}
cJSON *tac_info_per_plmn = cJSON_GetObjectItemCaseSensitive(area_scopeJSON, "tacInfoPerPlmn");
OpenAPI_list_t *tac_info_per_plmnList;
if (tac_info_per_plmn) {
cJSON *tac_info_per_plmn_local_map;
if (!cJSON_IsObject(tac_info_per_plmn)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_info_per_plmn]");
goto end;
}
tac_info_per_plmnList = OpenAPI_list_create();
OpenAPI_map_t *localMapKeyPair = NULL;
cJSON_ArrayForEach(tac_info_per_plmn_local_map, tac_info_per_plmn) {
cJSON *localMapObject = tac_info_per_plmn_local_map;
if (!cJSON_IsObject(tac_info_per_plmn_local_map)) {
ogs_error("OpenAPI_area_scope_parseFromJSON() failed [tac_info_per_plmn]");
goto end;
}
localMapKeyPair = OpenAPI_map_create(
localMapObject->string, OpenAPI_tac_info_parseFromJSON(localMapObject));
OpenAPI_list_add(tac_info_per_plmnList, localMapKeyPair);
}
}
area_scope_local_var = OpenAPI_area_scope_create (
eutra_cell_id_list ? eutra_cell_id_listList : NULL,
nr_cell_id_list ? nr_cell_id_listList : NULL,
tac_list ? tac_listList : NULL,
tac_info_per_plmn ? tac_info_per_plmnList : NULL
);
return area_scope_local_var;
end:
return NULL;
}
OpenAPI_area_scope_t *OpenAPI_area_scope_copy(OpenAPI_area_scope_t *dst, OpenAPI_area_scope_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_area_scope_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_area_scope_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_area_scope_free(dst);
dst = OpenAPI_area_scope_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,45 @@
/*
* area_scope.h
*
*
*/
#ifndef _OpenAPI_area_scope_H_
#define _OpenAPI_area_scope_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "tac_info.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_area_scope_s OpenAPI_area_scope_t;
typedef struct OpenAPI_area_scope_s {
OpenAPI_list_t *eutra_cell_id_list;
OpenAPI_list_t *nr_cell_id_list;
OpenAPI_list_t *tac_list;
OpenAPI_list_t* tac_info_per_plmn;
} OpenAPI_area_scope_t;
OpenAPI_area_scope_t *OpenAPI_area_scope_create(
OpenAPI_list_t *eutra_cell_id_list,
OpenAPI_list_t *nr_cell_id_list,
OpenAPI_list_t *tac_list,
OpenAPI_list_t* tac_info_per_plmn
);
void OpenAPI_area_scope_free(OpenAPI_area_scope_t *area_scope);
OpenAPI_area_scope_t *OpenAPI_area_scope_parseFromJSON(cJSON *area_scopeJSON);
cJSON *OpenAPI_area_scope_convertToJSON(OpenAPI_area_scope_t *area_scope);
OpenAPI_area_scope_t *OpenAPI_area_scope_copy(OpenAPI_area_scope_t *dst, OpenAPI_area_scope_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_area_scope_H_ */

View File

@ -6,7 +6,8 @@
OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create(
int atsss_ll,
int mptcp
int mptcp,
int rtt_without_pmf
)
{
OpenAPI_atsss_capability_t *atsss_capability_local_var = OpenAPI_malloc(sizeof(OpenAPI_atsss_capability_t));
@ -15,6 +16,7 @@ OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create(
}
atsss_capability_local_var->atsss_ll = atsss_ll;
atsss_capability_local_var->mptcp = mptcp;
atsss_capability_local_var->rtt_without_pmf = rtt_without_pmf;
return atsss_capability_local_var;
}
@ -52,6 +54,13 @@ cJSON *OpenAPI_atsss_capability_convertToJSON(OpenAPI_atsss_capability_t *atsss_
}
}
if (atsss_capability->rtt_without_pmf) {
if (cJSON_AddBoolToObject(item, "rttWithoutPmf", atsss_capability->rtt_without_pmf) == NULL) {
ogs_error("OpenAPI_atsss_capability_convertToJSON() failed [rtt_without_pmf]");
goto end;
}
}
end:
return item;
}
@ -77,9 +86,19 @@ OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_
}
}
cJSON *rtt_without_pmf = cJSON_GetObjectItemCaseSensitive(atsss_capabilityJSON, "rttWithoutPmf");
if (rtt_without_pmf) {
if (!cJSON_IsBool(rtt_without_pmf)) {
ogs_error("OpenAPI_atsss_capability_parseFromJSON() failed [rtt_without_pmf]");
goto end;
}
}
atsss_capability_local_var = OpenAPI_atsss_capability_create (
atsss_ll ? atsss_ll->valueint : 0,
mptcp ? mptcp->valueint : 0
mptcp ? mptcp->valueint : 0,
rtt_without_pmf ? rtt_without_pmf->valueint : 0
);
return atsss_capability_local_var;

View File

@ -21,11 +21,13 @@ typedef struct OpenAPI_atsss_capability_s OpenAPI_atsss_capability_t;
typedef struct OpenAPI_atsss_capability_s {
int atsss_ll;
int mptcp;
int rtt_without_pmf;
} OpenAPI_atsss_capability_t;
OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_create(
int atsss_ll,
int mptcp
int mptcp,
int rtt_without_pmf
);
void OpenAPI_atsss_capability_free(OpenAPI_atsss_capability_t *atsss_capability);
OpenAPI_atsss_capability_t *OpenAPI_atsss_capability_parseFromJSON(cJSON *atsss_capabilityJSON);

View File

@ -9,7 +9,8 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create(
int success,
char *time_stamp,
OpenAPI_auth_type_e auth_type,
char *serving_network_name
char *serving_network_name,
int auth_removal_ind
)
{
OpenAPI_auth_event_t *auth_event_local_var = OpenAPI_malloc(sizeof(OpenAPI_auth_event_t));
@ -21,6 +22,7 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create(
auth_event_local_var->time_stamp = time_stamp;
auth_event_local_var->auth_type = auth_type;
auth_event_local_var->serving_network_name = serving_network_name;
auth_event_local_var->auth_removal_ind = auth_removal_ind;
return auth_event_local_var;
}
@ -88,6 +90,13 @@ cJSON *OpenAPI_auth_event_convertToJSON(OpenAPI_auth_event_t *auth_event)
goto end;
}
if (auth_event->auth_removal_ind) {
if (cJSON_AddBoolToObject(item, "authRemovalInd", auth_event->auth_removal_ind) == NULL) {
ogs_error("OpenAPI_auth_event_convertToJSON() failed [auth_removal_ind]");
goto end;
}
}
end:
return item;
}
@ -157,12 +166,22 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON)
goto end;
}
cJSON *auth_removal_ind = cJSON_GetObjectItemCaseSensitive(auth_eventJSON, "authRemovalInd");
if (auth_removal_ind) {
if (!cJSON_IsBool(auth_removal_ind)) {
ogs_error("OpenAPI_auth_event_parseFromJSON() failed [auth_removal_ind]");
goto end;
}
}
auth_event_local_var = OpenAPI_auth_event_create (
ogs_strdup(nf_instance_id->valuestring),
success->valueint,
ogs_strdup(time_stamp->valuestring),
auth_typeVariable,
ogs_strdup(serving_network_name->valuestring)
ogs_strdup(serving_network_name->valuestring),
auth_removal_ind ? auth_removal_ind->valueint : 0
);
return auth_event_local_var;

View File

@ -25,6 +25,7 @@ typedef struct OpenAPI_auth_event_s {
char *time_stamp;
OpenAPI_auth_type_e auth_type;
char *serving_network_name;
int auth_removal_ind;
} OpenAPI_auth_event_t;
OpenAPI_auth_event_t *OpenAPI_auth_event_create(
@ -32,7 +33,8 @@ OpenAPI_auth_event_t *OpenAPI_auth_event_create(
int success,
char *time_stamp,
OpenAPI_auth_type_e auth_type,
char *serving_network_name
char *serving_network_name,
int auth_removal_ind
);
void OpenAPI_auth_event_free(OpenAPI_auth_event_t *auth_event);
OpenAPI_auth_event_t *OpenAPI_auth_event_parseFromJSON(cJSON *auth_eventJSON);

View File

@ -9,7 +9,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat
char *serving_network_name,
OpenAPI_resynchronization_info_t *resynchronization_info,
char *ausf_instance_id,
char *cag_id
OpenAPI_list_t *cell_cag_info,
int n5gc_ind
)
{
OpenAPI_authentication_info_request_t *authentication_info_request_local_var = OpenAPI_malloc(sizeof(OpenAPI_authentication_info_request_t));
@ -20,7 +21,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat
authentication_info_request_local_var->serving_network_name = serving_network_name;
authentication_info_request_local_var->resynchronization_info = resynchronization_info;
authentication_info_request_local_var->ausf_instance_id = ausf_instance_id;
authentication_info_request_local_var->cag_id = cag_id;
authentication_info_request_local_var->cell_cag_info = cell_cag_info;
authentication_info_request_local_var->n5gc_ind = n5gc_ind;
return authentication_info_request_local_var;
}
@ -35,7 +37,10 @@ void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_reques
ogs_free(authentication_info_request->serving_network_name);
OpenAPI_resynchronization_info_free(authentication_info_request->resynchronization_info);
ogs_free(authentication_info_request->ausf_instance_id);
ogs_free(authentication_info_request->cag_id);
OpenAPI_list_for_each(authentication_info_request->cell_cag_info, node) {
ogs_free(node->data);
}
OpenAPI_list_free(authentication_info_request->cell_cag_info);
ogs_free(authentication_info_request);
}
@ -87,9 +92,25 @@ cJSON *OpenAPI_authentication_info_request_convertToJSON(OpenAPI_authentication_
goto end;
}
if (authentication_info_request->cag_id) {
if (cJSON_AddStringToObject(item, "cagId", authentication_info_request->cag_id) == NULL) {
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cag_id]");
if (authentication_info_request->cell_cag_info) {
cJSON *cell_cag_info = cJSON_AddArrayToObject(item, "cellCagInfo");
if (cell_cag_info == NULL) {
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]");
goto end;
}
OpenAPI_lnode_t *cell_cag_info_node;
OpenAPI_list_for_each(authentication_info_request->cell_cag_info, cell_cag_info_node) {
if (cJSON_AddStringToObject(cell_cag_info, "", (char*)cell_cag_info_node->data) == NULL) {
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [cell_cag_info]");
goto end;
}
}
}
if (authentication_info_request->n5gc_ind) {
if (cJSON_AddBoolToObject(item, "n5gcInd", authentication_info_request->n5gc_ind) == NULL) {
ogs_error("OpenAPI_authentication_info_request_convertToJSON() failed [n5gc_ind]");
goto end;
}
}
@ -141,11 +162,31 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse
goto end;
}
cJSON *cag_id = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "cagId");
cJSON *cell_cag_info = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "cellCagInfo");
if (cag_id) {
if (!cJSON_IsString(cag_id)) {
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cag_id]");
OpenAPI_list_t *cell_cag_infoList;
if (cell_cag_info) {
cJSON *cell_cag_info_local;
if (!cJSON_IsArray(cell_cag_info)) {
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]");
goto end;
}
cell_cag_infoList = OpenAPI_list_create();
cJSON_ArrayForEach(cell_cag_info_local, cell_cag_info) {
if (!cJSON_IsString(cell_cag_info_local)) {
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [cell_cag_info]");
goto end;
}
OpenAPI_list_add(cell_cag_infoList, ogs_strdup(cell_cag_info_local->valuestring));
}
}
cJSON *n5gc_ind = cJSON_GetObjectItemCaseSensitive(authentication_info_requestJSON, "n5gcInd");
if (n5gc_ind) {
if (!cJSON_IsBool(n5gc_ind)) {
ogs_error("OpenAPI_authentication_info_request_parseFromJSON() failed [n5gc_ind]");
goto end;
}
}
@ -155,7 +196,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parse
ogs_strdup(serving_network_name->valuestring),
resynchronization_info ? resynchronization_info_local_nonprim : NULL,
ogs_strdup(ausf_instance_id->valuestring),
cag_id ? ogs_strdup(cag_id->valuestring) : NULL
cell_cag_info ? cell_cag_infoList : NULL,
n5gc_ind ? n5gc_ind->valueint : 0
);
return authentication_info_request_local_var;

View File

@ -24,7 +24,8 @@ typedef struct OpenAPI_authentication_info_request_s {
char *serving_network_name;
struct OpenAPI_resynchronization_info_s *resynchronization_info;
char *ausf_instance_id;
char *cag_id;
OpenAPI_list_t *cell_cag_info;
int n5gc_ind;
} OpenAPI_authentication_info_request_t;
OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_create(
@ -32,7 +33,8 @@ OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_creat
char *serving_network_name,
OpenAPI_resynchronization_info_t *resynchronization_info,
char *ausf_instance_id,
char *cag_id
OpenAPI_list_t *cell_cag_info,
int n5gc_ind
);
void OpenAPI_authentication_info_request_free(OpenAPI_authentication_info_request_t *authentication_info_request);
OpenAPI_authentication_info_request_t *OpenAPI_authentication_info_request_parseFromJSON(cJSON *authentication_info_requestJSON);

View File

@ -13,7 +13,10 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat
char *algorithm_id,
char *enc_opc_key,
char *enc_topc_key,
int vector_generation_in_hss
int vector_generation_in_hss,
OpenAPI_auth_method_e n5gc_auth_method,
int rg_authentication_ind,
char *supi
)
{
OpenAPI_authentication_subscription_t *authentication_subscription_local_var = OpenAPI_malloc(sizeof(OpenAPI_authentication_subscription_t));
@ -29,6 +32,9 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat
authentication_subscription_local_var->enc_opc_key = enc_opc_key;
authentication_subscription_local_var->enc_topc_key = enc_topc_key;
authentication_subscription_local_var->vector_generation_in_hss = vector_generation_in_hss;
authentication_subscription_local_var->n5gc_auth_method = n5gc_auth_method;
authentication_subscription_local_var->rg_authentication_ind = rg_authentication_ind;
authentication_subscription_local_var->supi = supi;
return authentication_subscription_local_var;
}
@ -46,6 +52,7 @@ void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscriptio
ogs_free(authentication_subscription->algorithm_id);
ogs_free(authentication_subscription->enc_opc_key);
ogs_free(authentication_subscription->enc_topc_key);
ogs_free(authentication_subscription->supi);
ogs_free(authentication_subscription);
}
@ -130,6 +137,27 @@ cJSON *OpenAPI_authentication_subscription_convertToJSON(OpenAPI_authentication_
}
}
if (authentication_subscription->n5gc_auth_method) {
if (cJSON_AddStringToObject(item, "n5gcAuthMethod", OpenAPI_auth_method_ToString(authentication_subscription->n5gc_auth_method)) == NULL) {
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [n5gc_auth_method]");
goto end;
}
}
if (authentication_subscription->rg_authentication_ind) {
if (cJSON_AddBoolToObject(item, "rgAuthenticationInd", authentication_subscription->rg_authentication_ind) == NULL) {
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [rg_authentication_ind]");
goto end;
}
}
if (authentication_subscription->supi) {
if (cJSON_AddStringToObject(item, "supi", authentication_subscription->supi) == NULL) {
ogs_error("OpenAPI_authentication_subscription_convertToJSON() failed [supi]");
goto end;
}
}
end:
return item;
}
@ -221,6 +249,35 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse
}
}
cJSON *n5gc_auth_method = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "n5gcAuthMethod");
OpenAPI_auth_method_e n5gc_auth_methodVariable;
if (n5gc_auth_method) {
if (!cJSON_IsString(n5gc_auth_method)) {
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [n5gc_auth_method]");
goto end;
}
n5gc_auth_methodVariable = OpenAPI_auth_method_FromString(n5gc_auth_method->valuestring);
}
cJSON *rg_authentication_ind = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "rgAuthenticationInd");
if (rg_authentication_ind) {
if (!cJSON_IsBool(rg_authentication_ind)) {
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [rg_authentication_ind]");
goto end;
}
}
cJSON *supi = cJSON_GetObjectItemCaseSensitive(authentication_subscriptionJSON, "supi");
if (supi) {
if (!cJSON_IsString(supi)) {
ogs_error("OpenAPI_authentication_subscription_parseFromJSON() failed [supi]");
goto end;
}
}
authentication_subscription_local_var = OpenAPI_authentication_subscription_create (
authentication_methodVariable,
enc_permanent_key ? ogs_strdup(enc_permanent_key->valuestring) : NULL,
@ -230,7 +287,10 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parse
algorithm_id ? ogs_strdup(algorithm_id->valuestring) : NULL,
enc_opc_key ? ogs_strdup(enc_opc_key->valuestring) : NULL,
enc_topc_key ? ogs_strdup(enc_topc_key->valuestring) : NULL,
vector_generation_in_hss ? vector_generation_in_hss->valueint : 0
vector_generation_in_hss ? vector_generation_in_hss->valueint : 0,
n5gc_auth_method ? n5gc_auth_methodVariable : 0,
rg_authentication_ind ? rg_authentication_ind->valueint : 0,
supi ? ogs_strdup(supi->valuestring) : NULL
);
return authentication_subscription_local_var;

View File

@ -30,6 +30,9 @@ typedef struct OpenAPI_authentication_subscription_s {
char *enc_opc_key;
char *enc_topc_key;
int vector_generation_in_hss;
OpenAPI_auth_method_e n5gc_auth_method;
int rg_authentication_ind;
char *supi;
} OpenAPI_authentication_subscription_t;
OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_create(
@ -41,7 +44,10 @@ OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_creat
char *algorithm_id,
char *enc_opc_key,
char *enc_topc_key,
int vector_generation_in_hss
int vector_generation_in_hss,
OpenAPI_auth_method_e n5gc_auth_method,
int rg_authentication_ind,
char *supi
);
void OpenAPI_authentication_subscription_free(OpenAPI_authentication_subscription_t *authentication_subscription);
OpenAPI_authentication_subscription_t *OpenAPI_authentication_subscription_parseFromJSON(cJSON *authentication_subscriptionJSON);

View File

@ -0,0 +1,472 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "authorized_network_slice_info.h"
OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_create(
OpenAPI_list_t *allowed_nssai_list,
OpenAPI_list_t *configured_nssai,
char *target_amf_set,
OpenAPI_list_t *candidate_amf_list,
OpenAPI_list_t *rejected_nssai_in_plmn,
OpenAPI_list_t *rejected_nssai_in_ta,
OpenAPI_nsi_information_t *nsi_information,
char *supported_features,
char *nrf_amf_set,
char *nrf_amf_set_nf_mgt_uri,
char *nrf_amf_set_access_token_uri,
char *target_amf_service_set
)
{
OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_authorized_network_slice_info_t));
if (!authorized_network_slice_info_local_var) {
return NULL;
}
authorized_network_slice_info_local_var->allowed_nssai_list = allowed_nssai_list;
authorized_network_slice_info_local_var->configured_nssai = configured_nssai;
authorized_network_slice_info_local_var->target_amf_set = target_amf_set;
authorized_network_slice_info_local_var->candidate_amf_list = candidate_amf_list;
authorized_network_slice_info_local_var->rejected_nssai_in_plmn = rejected_nssai_in_plmn;
authorized_network_slice_info_local_var->rejected_nssai_in_ta = rejected_nssai_in_ta;
authorized_network_slice_info_local_var->nsi_information = nsi_information;
authorized_network_slice_info_local_var->supported_features = supported_features;
authorized_network_slice_info_local_var->nrf_amf_set = nrf_amf_set;
authorized_network_slice_info_local_var->nrf_amf_set_nf_mgt_uri = nrf_amf_set_nf_mgt_uri;
authorized_network_slice_info_local_var->nrf_amf_set_access_token_uri = nrf_amf_set_access_token_uri;
authorized_network_slice_info_local_var->target_amf_service_set = target_amf_service_set;
return authorized_network_slice_info_local_var;
}
void OpenAPI_authorized_network_slice_info_free(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info)
{
if (NULL == authorized_network_slice_info) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(authorized_network_slice_info->allowed_nssai_list, node) {
OpenAPI_allowed_nssai_free(node->data);
}
OpenAPI_list_free(authorized_network_slice_info->allowed_nssai_list);
OpenAPI_list_for_each(authorized_network_slice_info->configured_nssai, node) {
OpenAPI_configured_snssai_free(node->data);
}
OpenAPI_list_free(authorized_network_slice_info->configured_nssai);
ogs_free(authorized_network_slice_info->target_amf_set);
OpenAPI_list_for_each(authorized_network_slice_info->candidate_amf_list, node) {
ogs_free(node->data);
}
OpenAPI_list_free(authorized_network_slice_info->candidate_amf_list);
OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_plmn, node) {
OpenAPI_snssai_free(node->data);
}
OpenAPI_list_free(authorized_network_slice_info->rejected_nssai_in_plmn);
OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_ta, node) {
OpenAPI_snssai_free(node->data);
}
OpenAPI_list_free(authorized_network_slice_info->rejected_nssai_in_ta);
OpenAPI_nsi_information_free(authorized_network_slice_info->nsi_information);
ogs_free(authorized_network_slice_info->supported_features);
ogs_free(authorized_network_slice_info->nrf_amf_set);
ogs_free(authorized_network_slice_info->nrf_amf_set_nf_mgt_uri);
ogs_free(authorized_network_slice_info->nrf_amf_set_access_token_uri);
ogs_free(authorized_network_slice_info->target_amf_service_set);
ogs_free(authorized_network_slice_info);
}
cJSON *OpenAPI_authorized_network_slice_info_convertToJSON(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info)
{
cJSON *item = NULL;
if (authorized_network_slice_info == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [AuthorizedNetworkSliceInfo]");
return NULL;
}
item = cJSON_CreateObject();
if (authorized_network_slice_info->allowed_nssai_list) {
cJSON *allowed_nssai_listList = cJSON_AddArrayToObject(item, "allowedNssaiList");
if (allowed_nssai_listList == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [allowed_nssai_list]");
goto end;
}
OpenAPI_lnode_t *allowed_nssai_list_node;
if (authorized_network_slice_info->allowed_nssai_list) {
OpenAPI_list_for_each(authorized_network_slice_info->allowed_nssai_list, allowed_nssai_list_node) {
cJSON *itemLocal = OpenAPI_allowed_nssai_convertToJSON(allowed_nssai_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [allowed_nssai_list]");
goto end;
}
cJSON_AddItemToArray(allowed_nssai_listList, itemLocal);
}
}
}
if (authorized_network_slice_info->configured_nssai) {
cJSON *configured_nssaiList = cJSON_AddArrayToObject(item, "configuredNssai");
if (configured_nssaiList == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [configured_nssai]");
goto end;
}
OpenAPI_lnode_t *configured_nssai_node;
if (authorized_network_slice_info->configured_nssai) {
OpenAPI_list_for_each(authorized_network_slice_info->configured_nssai, configured_nssai_node) {
cJSON *itemLocal = OpenAPI_configured_snssai_convertToJSON(configured_nssai_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [configured_nssai]");
goto end;
}
cJSON_AddItemToArray(configured_nssaiList, itemLocal);
}
}
}
if (authorized_network_slice_info->target_amf_set) {
if (cJSON_AddStringToObject(item, "targetAmfSet", authorized_network_slice_info->target_amf_set) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_amf_set]");
goto end;
}
}
if (authorized_network_slice_info->candidate_amf_list) {
cJSON *candidate_amf_list = cJSON_AddArrayToObject(item, "candidateAmfList");
if (candidate_amf_list == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [candidate_amf_list]");
goto end;
}
OpenAPI_lnode_t *candidate_amf_list_node;
OpenAPI_list_for_each(authorized_network_slice_info->candidate_amf_list, candidate_amf_list_node) {
if (cJSON_AddStringToObject(candidate_amf_list, "", (char*)candidate_amf_list_node->data) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [candidate_amf_list]");
goto end;
}
}
}
if (authorized_network_slice_info->rejected_nssai_in_plmn) {
cJSON *rejected_nssai_in_plmnList = cJSON_AddArrayToObject(item, "rejectedNssaiInPlmn");
if (rejected_nssai_in_plmnList == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_plmn]");
goto end;
}
OpenAPI_lnode_t *rejected_nssai_in_plmn_node;
if (authorized_network_slice_info->rejected_nssai_in_plmn) {
OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_plmn, rejected_nssai_in_plmn_node) {
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(rejected_nssai_in_plmn_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_plmn]");
goto end;
}
cJSON_AddItemToArray(rejected_nssai_in_plmnList, itemLocal);
}
}
}
if (authorized_network_slice_info->rejected_nssai_in_ta) {
cJSON *rejected_nssai_in_taList = cJSON_AddArrayToObject(item, "rejectedNssaiInTa");
if (rejected_nssai_in_taList == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_ta]");
goto end;
}
OpenAPI_lnode_t *rejected_nssai_in_ta_node;
if (authorized_network_slice_info->rejected_nssai_in_ta) {
OpenAPI_list_for_each(authorized_network_slice_info->rejected_nssai_in_ta, rejected_nssai_in_ta_node) {
cJSON *itemLocal = OpenAPI_snssai_convertToJSON(rejected_nssai_in_ta_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [rejected_nssai_in_ta]");
goto end;
}
cJSON_AddItemToArray(rejected_nssai_in_taList, itemLocal);
}
}
}
if (authorized_network_slice_info->nsi_information) {
cJSON *nsi_information_local_JSON = OpenAPI_nsi_information_convertToJSON(authorized_network_slice_info->nsi_information);
if (nsi_information_local_JSON == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nsi_information]");
goto end;
}
cJSON_AddItemToObject(item, "nsiInformation", nsi_information_local_JSON);
if (item->child == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nsi_information]");
goto end;
}
}
if (authorized_network_slice_info->supported_features) {
if (cJSON_AddStringToObject(item, "supportedFeatures", authorized_network_slice_info->supported_features) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [supported_features]");
goto end;
}
}
if (authorized_network_slice_info->nrf_amf_set) {
if (cJSON_AddStringToObject(item, "nrfAmfSet", authorized_network_slice_info->nrf_amf_set) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_amf_set]");
goto end;
}
}
if (authorized_network_slice_info->nrf_amf_set_nf_mgt_uri) {
if (cJSON_AddStringToObject(item, "nrfAmfSetNfMgtUri", authorized_network_slice_info->nrf_amf_set_nf_mgt_uri) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_amf_set_nf_mgt_uri]");
goto end;
}
}
if (authorized_network_slice_info->nrf_amf_set_access_token_uri) {
if (cJSON_AddStringToObject(item, "nrfAmfSetAccessTokenUri", authorized_network_slice_info->nrf_amf_set_access_token_uri) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [nrf_amf_set_access_token_uri]");
goto end;
}
}
if (authorized_network_slice_info->target_amf_service_set) {
if (cJSON_AddStringToObject(item, "targetAmfServiceSet", authorized_network_slice_info->target_amf_service_set) == NULL) {
ogs_error("OpenAPI_authorized_network_slice_info_convertToJSON() failed [target_amf_service_set]");
goto end;
}
}
end:
return item;
}
OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_parseFromJSON(cJSON *authorized_network_slice_infoJSON)
{
OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info_local_var = NULL;
cJSON *allowed_nssai_list = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "allowedNssaiList");
OpenAPI_list_t *allowed_nssai_listList;
if (allowed_nssai_list) {
cJSON *allowed_nssai_list_local_nonprimitive;
if (!cJSON_IsArray(allowed_nssai_list)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [allowed_nssai_list]");
goto end;
}
allowed_nssai_listList = OpenAPI_list_create();
cJSON_ArrayForEach(allowed_nssai_list_local_nonprimitive, allowed_nssai_list ) {
if (!cJSON_IsObject(allowed_nssai_list_local_nonprimitive)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [allowed_nssai_list]");
goto end;
}
OpenAPI_allowed_nssai_t *allowed_nssai_listItem = OpenAPI_allowed_nssai_parseFromJSON(allowed_nssai_list_local_nonprimitive);
OpenAPI_list_add(allowed_nssai_listList, allowed_nssai_listItem);
}
}
cJSON *configured_nssai = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "configuredNssai");
OpenAPI_list_t *configured_nssaiList;
if (configured_nssai) {
cJSON *configured_nssai_local_nonprimitive;
if (!cJSON_IsArray(configured_nssai)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [configured_nssai]");
goto end;
}
configured_nssaiList = OpenAPI_list_create();
cJSON_ArrayForEach(configured_nssai_local_nonprimitive, configured_nssai ) {
if (!cJSON_IsObject(configured_nssai_local_nonprimitive)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [configured_nssai]");
goto end;
}
OpenAPI_configured_snssai_t *configured_nssaiItem = OpenAPI_configured_snssai_parseFromJSON(configured_nssai_local_nonprimitive);
OpenAPI_list_add(configured_nssaiList, configured_nssaiItem);
}
}
cJSON *target_amf_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "targetAmfSet");
if (target_amf_set) {
if (!cJSON_IsString(target_amf_set)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [target_amf_set]");
goto end;
}
}
cJSON *candidate_amf_list = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "candidateAmfList");
OpenAPI_list_t *candidate_amf_listList;
if (candidate_amf_list) {
cJSON *candidate_amf_list_local;
if (!cJSON_IsArray(candidate_amf_list)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [candidate_amf_list]");
goto end;
}
candidate_amf_listList = OpenAPI_list_create();
cJSON_ArrayForEach(candidate_amf_list_local, candidate_amf_list) {
if (!cJSON_IsString(candidate_amf_list_local)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [candidate_amf_list]");
goto end;
}
OpenAPI_list_add(candidate_amf_listList, ogs_strdup(candidate_amf_list_local->valuestring));
}
}
cJSON *rejected_nssai_in_plmn = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "rejectedNssaiInPlmn");
OpenAPI_list_t *rejected_nssai_in_plmnList;
if (rejected_nssai_in_plmn) {
cJSON *rejected_nssai_in_plmn_local_nonprimitive;
if (!cJSON_IsArray(rejected_nssai_in_plmn)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_plmn]");
goto end;
}
rejected_nssai_in_plmnList = OpenAPI_list_create();
cJSON_ArrayForEach(rejected_nssai_in_plmn_local_nonprimitive, rejected_nssai_in_plmn ) {
if (!cJSON_IsObject(rejected_nssai_in_plmn_local_nonprimitive)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_plmn]");
goto end;
}
OpenAPI_snssai_t *rejected_nssai_in_plmnItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_in_plmn_local_nonprimitive);
OpenAPI_list_add(rejected_nssai_in_plmnList, rejected_nssai_in_plmnItem);
}
}
cJSON *rejected_nssai_in_ta = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "rejectedNssaiInTa");
OpenAPI_list_t *rejected_nssai_in_taList;
if (rejected_nssai_in_ta) {
cJSON *rejected_nssai_in_ta_local_nonprimitive;
if (!cJSON_IsArray(rejected_nssai_in_ta)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_ta]");
goto end;
}
rejected_nssai_in_taList = OpenAPI_list_create();
cJSON_ArrayForEach(rejected_nssai_in_ta_local_nonprimitive, rejected_nssai_in_ta ) {
if (!cJSON_IsObject(rejected_nssai_in_ta_local_nonprimitive)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [rejected_nssai_in_ta]");
goto end;
}
OpenAPI_snssai_t *rejected_nssai_in_taItem = OpenAPI_snssai_parseFromJSON(rejected_nssai_in_ta_local_nonprimitive);
OpenAPI_list_add(rejected_nssai_in_taList, rejected_nssai_in_taItem);
}
}
cJSON *nsi_information = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nsiInformation");
OpenAPI_nsi_information_t *nsi_information_local_nonprim = NULL;
if (nsi_information) {
nsi_information_local_nonprim = OpenAPI_nsi_information_parseFromJSON(nsi_information);
}
cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "supportedFeatures");
if (supported_features) {
if (!cJSON_IsString(supported_features)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [supported_features]");
goto end;
}
}
cJSON *nrf_amf_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfAmfSet");
if (nrf_amf_set) {
if (!cJSON_IsString(nrf_amf_set)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_amf_set]");
goto end;
}
}
cJSON *nrf_amf_set_nf_mgt_uri = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfAmfSetNfMgtUri");
if (nrf_amf_set_nf_mgt_uri) {
if (!cJSON_IsString(nrf_amf_set_nf_mgt_uri)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_amf_set_nf_mgt_uri]");
goto end;
}
}
cJSON *nrf_amf_set_access_token_uri = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "nrfAmfSetAccessTokenUri");
if (nrf_amf_set_access_token_uri) {
if (!cJSON_IsString(nrf_amf_set_access_token_uri)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [nrf_amf_set_access_token_uri]");
goto end;
}
}
cJSON *target_amf_service_set = cJSON_GetObjectItemCaseSensitive(authorized_network_slice_infoJSON, "targetAmfServiceSet");
if (target_amf_service_set) {
if (!cJSON_IsString(target_amf_service_set)) {
ogs_error("OpenAPI_authorized_network_slice_info_parseFromJSON() failed [target_amf_service_set]");
goto end;
}
}
authorized_network_slice_info_local_var = OpenAPI_authorized_network_slice_info_create (
allowed_nssai_list ? allowed_nssai_listList : NULL,
configured_nssai ? configured_nssaiList : NULL,
target_amf_set ? ogs_strdup(target_amf_set->valuestring) : NULL,
candidate_amf_list ? candidate_amf_listList : NULL,
rejected_nssai_in_plmn ? rejected_nssai_in_plmnList : NULL,
rejected_nssai_in_ta ? rejected_nssai_in_taList : NULL,
nsi_information ? nsi_information_local_nonprim : NULL,
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
nrf_amf_set ? ogs_strdup(nrf_amf_set->valuestring) : NULL,
nrf_amf_set_nf_mgt_uri ? ogs_strdup(nrf_amf_set_nf_mgt_uri->valuestring) : NULL,
nrf_amf_set_access_token_uri ? ogs_strdup(nrf_amf_set_access_token_uri->valuestring) : NULL,
target_amf_service_set ? ogs_strdup(target_amf_service_set->valuestring) : NULL
);
return authorized_network_slice_info_local_var;
end:
return NULL;
}
OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_copy(OpenAPI_authorized_network_slice_info_t *dst, OpenAPI_authorized_network_slice_info_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_authorized_network_slice_info_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_authorized_network_slice_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_authorized_network_slice_info_free(dst);
dst = OpenAPI_authorized_network_slice_info_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

View File

@ -0,0 +1,64 @@
/*
* authorized_network_slice_info.h
*
*
*/
#ifndef _OpenAPI_authorized_network_slice_info_H_
#define _OpenAPI_authorized_network_slice_info_H_
#include <string.h>
#include "../external/cJSON.h"
#include "../include/list.h"
#include "../include/keyValuePair.h"
#include "../include/binary.h"
#include "allowed_nssai.h"
#include "configured_snssai.h"
#include "nsi_information.h"
#include "snssai.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef struct OpenAPI_authorized_network_slice_info_s OpenAPI_authorized_network_slice_info_t;
typedef struct OpenAPI_authorized_network_slice_info_s {
OpenAPI_list_t *allowed_nssai_list;
OpenAPI_list_t *configured_nssai;
char *target_amf_set;
OpenAPI_list_t *candidate_amf_list;
OpenAPI_list_t *rejected_nssai_in_plmn;
OpenAPI_list_t *rejected_nssai_in_ta;
struct OpenAPI_nsi_information_s *nsi_information;
char *supported_features;
char *nrf_amf_set;
char *nrf_amf_set_nf_mgt_uri;
char *nrf_amf_set_access_token_uri;
char *target_amf_service_set;
} OpenAPI_authorized_network_slice_info_t;
OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_create(
OpenAPI_list_t *allowed_nssai_list,
OpenAPI_list_t *configured_nssai,
char *target_amf_set,
OpenAPI_list_t *candidate_amf_list,
OpenAPI_list_t *rejected_nssai_in_plmn,
OpenAPI_list_t *rejected_nssai_in_ta,
OpenAPI_nsi_information_t *nsi_information,
char *supported_features,
char *nrf_amf_set,
char *nrf_amf_set_nf_mgt_uri,
char *nrf_amf_set_access_token_uri,
char *target_amf_service_set
);
void OpenAPI_authorized_network_slice_info_free(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info);
OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_parseFromJSON(cJSON *authorized_network_slice_infoJSON);
cJSON *OpenAPI_authorized_network_slice_info_convertToJSON(OpenAPI_authorized_network_slice_info_t *authorized_network_slice_info);
OpenAPI_authorized_network_slice_info_t *OpenAPI_authorized_network_slice_info_copy(OpenAPI_authorized_network_slice_info_t *dst, OpenAPI_authorized_network_slice_info_t *src);
#ifdef __cplusplus
}
#endif
#endif /* _OpenAPI_authorized_network_slice_info_H_ */

View File

@ -5,7 +5,7 @@
#include "av_eps_aka.h"
OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_create(
OpenAPI_hss_av_type_t *av_type,
OpenAPI_hss_av_type_e av_type,
char *rand,
char *xres,
char *autn,
@ -31,7 +31,6 @@ void OpenAPI_av_eps_aka_free(OpenAPI_av_eps_aka_t *av_eps_aka)
return;
}
OpenAPI_lnode_t *node;
OpenAPI_hss_av_type_free(av_eps_aka->av_type);
ogs_free(av_eps_aka->rand);
ogs_free(av_eps_aka->xres);
ogs_free(av_eps_aka->autn);
@ -53,13 +52,7 @@ cJSON *OpenAPI_av_eps_aka_convertToJSON(OpenAPI_av_eps_aka_t *av_eps_aka)
ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed [av_type]");
goto end;
}
cJSON *av_type_local_JSON = OpenAPI_hss_av_type_convertToJSON(av_eps_aka->av_type);
if (av_type_local_JSON == NULL) {
ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed [av_type]");
goto end;
}
cJSON_AddItemToObject(item, "avType", av_type_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "avType", OpenAPI_hss_av_type_ToString(av_eps_aka->av_type)) == NULL) {
ogs_error("OpenAPI_av_eps_aka_convertToJSON() failed [av_type]");
goto end;
}
@ -113,9 +106,13 @@ OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_parseFromJSON(cJSON *av_eps_akaJSON)
goto end;
}
OpenAPI_hss_av_type_t *av_type_local_nonprim = NULL;
OpenAPI_hss_av_type_e av_typeVariable;
av_type_local_nonprim = OpenAPI_hss_av_type_parseFromJSON(av_type);
if (!cJSON_IsString(av_type)) {
ogs_error("OpenAPI_av_eps_aka_parseFromJSON() failed [av_type]");
goto end;
}
av_typeVariable = OpenAPI_hss_av_type_FromString(av_type->valuestring);
cJSON *rand = cJSON_GetObjectItemCaseSensitive(av_eps_akaJSON, "rand");
if (!rand) {
@ -166,7 +163,7 @@ OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_parseFromJSON(cJSON *av_eps_akaJSON)
}
av_eps_aka_local_var = OpenAPI_av_eps_aka_create (
av_type_local_nonprim,
av_typeVariable,
ogs_strdup(rand->valuestring),
ogs_strdup(xres->valuestring),
ogs_strdup(autn->valuestring),

View File

@ -20,7 +20,7 @@ extern "C" {
typedef struct OpenAPI_av_eps_aka_s OpenAPI_av_eps_aka_t;
typedef struct OpenAPI_av_eps_aka_s {
struct OpenAPI_hss_av_type_s *av_type;
OpenAPI_hss_av_type_e av_type;
char *rand;
char *xres;
char *autn;
@ -28,7 +28,7 @@ typedef struct OpenAPI_av_eps_aka_s {
} OpenAPI_av_eps_aka_t;
OpenAPI_av_eps_aka_t *OpenAPI_av_eps_aka_create(
OpenAPI_hss_av_type_t *av_type,
OpenAPI_hss_av_type_e av_type,
char *rand,
char *xres,
char *autn,

View File

@ -5,7 +5,7 @@
#include "av_ims_gba_eap_aka.h"
OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_create(
OpenAPI_hss_av_type_t *av_type,
OpenAPI_hss_av_type_e av_type,
char *rand,
char *xres,
char *autn,
@ -33,7 +33,6 @@ void OpenAPI_av_ims_gba_eap_aka_free(OpenAPI_av_ims_gba_eap_aka_t *av_ims_gba_ea
return;
}
OpenAPI_lnode_t *node;
OpenAPI_hss_av_type_free(av_ims_gba_eap_aka->av_type);
ogs_free(av_ims_gba_eap_aka->rand);
ogs_free(av_ims_gba_eap_aka->xres);
ogs_free(av_ims_gba_eap_aka->autn);
@ -56,13 +55,7 @@ cJSON *OpenAPI_av_ims_gba_eap_aka_convertToJSON(OpenAPI_av_ims_gba_eap_aka_t *av
ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed [av_type]");
goto end;
}
cJSON *av_type_local_JSON = OpenAPI_hss_av_type_convertToJSON(av_ims_gba_eap_aka->av_type);
if (av_type_local_JSON == NULL) {
ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed [av_type]");
goto end;
}
cJSON_AddItemToObject(item, "avType", av_type_local_JSON);
if (item->child == NULL) {
if (cJSON_AddStringToObject(item, "avType", OpenAPI_hss_av_type_ToString(av_ims_gba_eap_aka->av_type)) == NULL) {
ogs_error("OpenAPI_av_ims_gba_eap_aka_convertToJSON() failed [av_type]");
goto end;
}
@ -125,9 +118,13 @@ OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_parseFromJSON(cJSON *av
goto end;
}
OpenAPI_hss_av_type_t *av_type_local_nonprim = NULL;
OpenAPI_hss_av_type_e av_typeVariable;
av_type_local_nonprim = OpenAPI_hss_av_type_parseFromJSON(av_type);
if (!cJSON_IsString(av_type)) {
ogs_error("OpenAPI_av_ims_gba_eap_aka_parseFromJSON() failed [av_type]");
goto end;
}
av_typeVariable = OpenAPI_hss_av_type_FromString(av_type->valuestring);
cJSON *rand = cJSON_GetObjectItemCaseSensitive(av_ims_gba_eap_akaJSON, "rand");
if (!rand) {
@ -190,7 +187,7 @@ OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_parseFromJSON(cJSON *av
}
av_ims_gba_eap_aka_local_var = OpenAPI_av_ims_gba_eap_aka_create (
av_type_local_nonprim,
av_typeVariable,
ogs_strdup(rand->valuestring),
ogs_strdup(xres->valuestring),
ogs_strdup(autn->valuestring),

View File

@ -20,7 +20,7 @@ extern "C" {
typedef struct OpenAPI_av_ims_gba_eap_aka_s OpenAPI_av_ims_gba_eap_aka_t;
typedef struct OpenAPI_av_ims_gba_eap_aka_s {
struct OpenAPI_hss_av_type_s *av_type;
OpenAPI_hss_av_type_e av_type;
char *rand;
char *xres;
char *autn;
@ -29,7 +29,7 @@ typedef struct OpenAPI_av_ims_gba_eap_aka_s {
} OpenAPI_av_ims_gba_eap_aka_t;
OpenAPI_av_ims_gba_eap_aka_t *OpenAPI_av_ims_gba_eap_aka_create(
OpenAPI_hss_av_type_t *av_type,
OpenAPI_hss_av_type_e av_type,
char *rand,
char *xres,
char *autn,

View File

@ -6,7 +6,7 @@
char* OpenAPI_cause_ToString(OpenAPI_cause_e cause)
{
const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS" };
const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF" };
size_t sizeofArray = sizeof(causeArray) / sizeof(causeArray[0]);
if (cause < sizeofArray)
return (char *)causeArray[cause];
@ -17,7 +17,7 @@ char* OpenAPI_cause_ToString(OpenAPI_cause_e cause)
OpenAPI_cause_e OpenAPI_cause_FromString(char* cause)
{
int stringToReturn = 0;
const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS" };
const char *causeArray[] = { "NULL", "REL_DUE_TO_HO", "EPS_FALLBACK", "REL_DUE_TO_UP_SEC", "DNN_CONGESTION", "S_NSSAI_CONGESTION", "REL_DUE_TO_REACTIVATION", "_5G_AN_NOT_RESPONDING", "REL_DUE_TO_SLICE_NOT_AVAILABLE", "REL_DUE_TO_DUPLICATE_SESSION_ID", "PDU_SESSION_STATUS_MISMATCH", "HO_FAILURE", "INSUFFICIENT_UP_RESOURCES", "PDU_SESSION_HANDED_OVER", "PDU_SESSION_RESUMED", "CN_ASSISTED_RAN_PARAMETER_TUNING", "ISMF_CONTEXT_TRANSFER", "SMF_CONTEXT_TRANSFER", "REL_DUE_TO_PS_TO_CS_HO", "REL_DUE_TO_SUBSCRIPTION_CHANGE", "HO_CANCEL", "REL_DUE_TO_SLICE_NOT_AUTHORIZED", "PDU_SESSION_HAND_OVER_FAILURE", "DDN_FAILURE_STATUS", "REL_DUE_TO_CP_ONLY_NOT_APPLICABLE", "NOT_SUPPORTED_WITH_ISMF" };
size_t sizeofArray = sizeof(causeArray) / sizeof(causeArray[0]);
while (stringToReturn < sizeofArray) {
if (strcmp(cause, causeArray[stringToReturn]) == 0) {

View File

@ -17,7 +17,7 @@
extern "C" {
#endif
typedef enum { OpenAPI_cause_NULL = 0, OpenAPI_cause_REL_DUE_TO_HO, OpenAPI_cause_EPS_FALLBACK, OpenAPI_cause_REL_DUE_TO_UP_SEC, OpenAPI_cause_DNN_CONGESTION, OpenAPI_cause_S_NSSAI_CONGESTION, OpenAPI_cause_REL_DUE_TO_REACTIVATION, OpenAPI_cause__5G_AN_NOT_RESPONDING, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AVAILABLE, OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID, OpenAPI_cause_PDU_SESSION_STATUS_MISMATCH, OpenAPI_cause_HO_FAILURE, OpenAPI_cause_INSUFFICIENT_UP_RESOURCES, OpenAPI_cause_PDU_SESSION_HANDED_OVER, OpenAPI_cause_PDU_SESSION_RESUMED, OpenAPI_cause_CN_ASSISTED_RAN_PARAMETER_TUNING, OpenAPI_cause_ISMF_CONTEXT_TRANSFER, OpenAPI_cause_SMF_CONTEXT_TRANSFER, OpenAPI_cause_REL_DUE_TO_PS_TO_CS_HO, OpenAPI_cause_REL_DUE_TO_SUBSCRIPTION_CHANGE, OpenAPI_cause_HO_CANCEL, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AUTHORIZED, OpenAPI_cause_PDU_SESSION_HAND_OVER_FAILURE, OpenAPI_cause_DDN_FAILURE_STATUS } OpenAPI_cause_e;
typedef enum { OpenAPI_cause_NULL = 0, OpenAPI_cause_REL_DUE_TO_HO, OpenAPI_cause_EPS_FALLBACK, OpenAPI_cause_REL_DUE_TO_UP_SEC, OpenAPI_cause_DNN_CONGESTION, OpenAPI_cause_S_NSSAI_CONGESTION, OpenAPI_cause_REL_DUE_TO_REACTIVATION, OpenAPI_cause__5G_AN_NOT_RESPONDING, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AVAILABLE, OpenAPI_cause_REL_DUE_TO_DUPLICATE_SESSION_ID, OpenAPI_cause_PDU_SESSION_STATUS_MISMATCH, OpenAPI_cause_HO_FAILURE, OpenAPI_cause_INSUFFICIENT_UP_RESOURCES, OpenAPI_cause_PDU_SESSION_HANDED_OVER, OpenAPI_cause_PDU_SESSION_RESUMED, OpenAPI_cause_CN_ASSISTED_RAN_PARAMETER_TUNING, OpenAPI_cause_ISMF_CONTEXT_TRANSFER, OpenAPI_cause_SMF_CONTEXT_TRANSFER, OpenAPI_cause_REL_DUE_TO_PS_TO_CS_HO, OpenAPI_cause_REL_DUE_TO_SUBSCRIPTION_CHANGE, OpenAPI_cause_HO_CANCEL, OpenAPI_cause_REL_DUE_TO_SLICE_NOT_AUTHORIZED, OpenAPI_cause_PDU_SESSION_HAND_OVER_FAILURE, OpenAPI_cause_DDN_FAILURE_STATUS, OpenAPI_cause_REL_DUE_TO_CP_ONLY_NOT_APPLICABLE, OpenAPI_cause_NOT_SUPPORTED_WITH_ISMF } OpenAPI_cause_e;
char* OpenAPI_cause_ToString(OpenAPI_cause_e cause);

View File

@ -1,190 +0,0 @@
#include <stdlib.h>
#include <string.h>
#include <stdio.h>
#include "cm_info_report.h"
OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_create(
OpenAPI_list_t *old_cm_info_list,
OpenAPI_list_t *new_cm_info_list
)
{
OpenAPI_cm_info_report_t *cm_info_report_local_var = OpenAPI_malloc(sizeof(OpenAPI_cm_info_report_t));
if (!cm_info_report_local_var) {
return NULL;
}
cm_info_report_local_var->old_cm_info_list = old_cm_info_list;
cm_info_report_local_var->new_cm_info_list = new_cm_info_list;
return cm_info_report_local_var;
}
void OpenAPI_cm_info_report_free(OpenAPI_cm_info_report_t *cm_info_report)
{
if (NULL == cm_info_report) {
return;
}
OpenAPI_lnode_t *node;
OpenAPI_list_for_each(cm_info_report->old_cm_info_list, node) {
OpenAPI_cm_info_free(node->data);
}
OpenAPI_list_free(cm_info_report->old_cm_info_list);
OpenAPI_list_for_each(cm_info_report->new_cm_info_list, node) {
OpenAPI_cm_info_free(node->data);
}
OpenAPI_list_free(cm_info_report->new_cm_info_list);
ogs_free(cm_info_report);
}
cJSON *OpenAPI_cm_info_report_convertToJSON(OpenAPI_cm_info_report_t *cm_info_report)
{
cJSON *item = NULL;
if (cm_info_report == NULL) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [CmInfoReport]");
return NULL;
}
item = cJSON_CreateObject();
if (cm_info_report->old_cm_info_list) {
cJSON *old_cm_info_listList = cJSON_AddArrayToObject(item, "oldCmInfoList");
if (old_cm_info_listList == NULL) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [old_cm_info_list]");
goto end;
}
OpenAPI_lnode_t *old_cm_info_list_node;
if (cm_info_report->old_cm_info_list) {
OpenAPI_list_for_each(cm_info_report->old_cm_info_list, old_cm_info_list_node) {
cJSON *itemLocal = OpenAPI_cm_info_convertToJSON(old_cm_info_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [old_cm_info_list]");
goto end;
}
cJSON_AddItemToArray(old_cm_info_listList, itemLocal);
}
}
}
if (!cm_info_report->new_cm_info_list) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [new_cm_info_list]");
goto end;
}
cJSON *new_cm_info_listList = cJSON_AddArrayToObject(item, "newCmInfoList");
if (new_cm_info_listList == NULL) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [new_cm_info_list]");
goto end;
}
OpenAPI_lnode_t *new_cm_info_list_node;
if (cm_info_report->new_cm_info_list) {
OpenAPI_list_for_each(cm_info_report->new_cm_info_list, new_cm_info_list_node) {
cJSON *itemLocal = OpenAPI_cm_info_convertToJSON(new_cm_info_list_node->data);
if (itemLocal == NULL) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed [new_cm_info_list]");
goto end;
}
cJSON_AddItemToArray(new_cm_info_listList, itemLocal);
}
}
end:
return item;
}
OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_parseFromJSON(cJSON *cm_info_reportJSON)
{
OpenAPI_cm_info_report_t *cm_info_report_local_var = NULL;
cJSON *old_cm_info_list = cJSON_GetObjectItemCaseSensitive(cm_info_reportJSON, "oldCmInfoList");
OpenAPI_list_t *old_cm_info_listList;
if (old_cm_info_list) {
cJSON *old_cm_info_list_local_nonprimitive;
if (!cJSON_IsArray(old_cm_info_list)) {
ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [old_cm_info_list]");
goto end;
}
old_cm_info_listList = OpenAPI_list_create();
cJSON_ArrayForEach(old_cm_info_list_local_nonprimitive, old_cm_info_list ) {
if (!cJSON_IsObject(old_cm_info_list_local_nonprimitive)) {
ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [old_cm_info_list]");
goto end;
}
OpenAPI_cm_info_t *old_cm_info_listItem = OpenAPI_cm_info_parseFromJSON(old_cm_info_list_local_nonprimitive);
OpenAPI_list_add(old_cm_info_listList, old_cm_info_listItem);
}
}
cJSON *new_cm_info_list = cJSON_GetObjectItemCaseSensitive(cm_info_reportJSON, "newCmInfoList");
if (!new_cm_info_list) {
ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [new_cm_info_list]");
goto end;
}
OpenAPI_list_t *new_cm_info_listList;
cJSON *new_cm_info_list_local_nonprimitive;
if (!cJSON_IsArray(new_cm_info_list)) {
ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [new_cm_info_list]");
goto end;
}
new_cm_info_listList = OpenAPI_list_create();
cJSON_ArrayForEach(new_cm_info_list_local_nonprimitive, new_cm_info_list ) {
if (!cJSON_IsObject(new_cm_info_list_local_nonprimitive)) {
ogs_error("OpenAPI_cm_info_report_parseFromJSON() failed [new_cm_info_list]");
goto end;
}
OpenAPI_cm_info_t *new_cm_info_listItem = OpenAPI_cm_info_parseFromJSON(new_cm_info_list_local_nonprimitive);
OpenAPI_list_add(new_cm_info_listList, new_cm_info_listItem);
}
cm_info_report_local_var = OpenAPI_cm_info_report_create (
old_cm_info_list ? old_cm_info_listList : NULL,
new_cm_info_listList
);
return cm_info_report_local_var;
end:
return NULL;
}
OpenAPI_cm_info_report_t *OpenAPI_cm_info_report_copy(OpenAPI_cm_info_report_t *dst, OpenAPI_cm_info_report_t *src)
{
cJSON *item = NULL;
char *content = NULL;
ogs_assert(src);
item = OpenAPI_cm_info_report_convertToJSON(src);
if (!item) {
ogs_error("OpenAPI_cm_info_report_convertToJSON() failed");
return NULL;
}
content = cJSON_Print(item);
cJSON_Delete(item);
if (!content) {
ogs_error("cJSON_Print() failed");
return NULL;
}
item = cJSON_Parse(content);
ogs_free(content);
if (!item) {
ogs_error("cJSON_Parse() failed");
return NULL;
}
OpenAPI_cm_info_report_free(dst);
dst = OpenAPI_cm_info_report_parseFromJSON(item);
cJSON_Delete(item);
return dst;
}

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