forked from acouzens/open5gs
Add AUSF, UDM, and UDR
This commit is contained in:
parent
0c0241d5e5
commit
72370ff0b2
|
@ -4,13 +4,6 @@ logger:
|
||||||
|
|
||||||
parameter:
|
parameter:
|
||||||
|
|
||||||
nrf:
|
|
||||||
sbi:
|
|
||||||
- addr:
|
|
||||||
- 127.0.0.1
|
|
||||||
- ::1
|
|
||||||
port: 7777
|
|
||||||
|
|
||||||
amf:
|
amf:
|
||||||
sbi:
|
sbi:
|
||||||
- addr: 127.0.0.2
|
- addr: 127.0.0.2
|
||||||
|
@ -83,3 +76,24 @@ upf:
|
||||||
- 127.0.0.4
|
- 127.0.0.4
|
||||||
- ::1
|
- ::1
|
||||||
pdn:
|
pdn:
|
||||||
|
|
||||||
|
ausf:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.5
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
udm:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.6
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
udr:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.7
|
||||||
|
port: 7777
|
||||||
|
nrf:
|
||||||
|
sbi:
|
||||||
|
- addr:
|
||||||
|
- 127.0.0.1
|
||||||
|
- ::1
|
||||||
|
port: 7777
|
||||||
|
|
|
@ -4,13 +4,6 @@ logger:
|
||||||
|
|
||||||
parameter:
|
parameter:
|
||||||
|
|
||||||
nrf:
|
|
||||||
sbi:
|
|
||||||
- addr:
|
|
||||||
- 127.0.0.1
|
|
||||||
- ::1
|
|
||||||
port: 7777
|
|
||||||
|
|
||||||
amf:
|
amf:
|
||||||
sbi:
|
sbi:
|
||||||
- addr: 127.0.0.2
|
- addr: 127.0.0.2
|
||||||
|
@ -39,8 +32,8 @@ amf:
|
||||||
- sst: 1
|
- sst: 1
|
||||||
sd: 112233
|
sd: 112233
|
||||||
security:
|
security:
|
||||||
integrity_order : [ EIA1, EIA2, EIA0 ]
|
integrity_order : [ EIA2, EIA1 ]
|
||||||
ciphering_order : [ EEA0, EEA1, EEA2 ]
|
ciphering_order : [ EEA2, EEA1, EEA0 ]
|
||||||
network_name:
|
network_name:
|
||||||
full: Open5GS
|
full: Open5GS
|
||||||
amf_name: open5gs-amf0
|
amf_name: open5gs-amf0
|
||||||
|
@ -87,3 +80,24 @@ upf:
|
||||||
- 127.0.0.4
|
- 127.0.0.4
|
||||||
- ::1
|
- ::1
|
||||||
pdn:
|
pdn:
|
||||||
|
|
||||||
|
ausf:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.5
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
udm:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.6
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
udr:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.7
|
||||||
|
port: 7777
|
||||||
|
nrf:
|
||||||
|
sbi:
|
||||||
|
- addr:
|
||||||
|
- 127.0.0.1
|
||||||
|
- ::1
|
||||||
|
port: 7777
|
||||||
|
|
|
@ -155,6 +155,8 @@ parameter:
|
||||||
# gnb: 32
|
# gnb: 32
|
||||||
# o Maximum Number of UE per gNB
|
# o Maximum Number of UE per gNB
|
||||||
# ue: 128
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
#
|
#
|
||||||
max:
|
max:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
#
|
||||||
|
# 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,pfcp,fd,gtp,ausf,event,tlv,mem,sock
|
||||||
|
#
|
||||||
|
logger:
|
||||||
|
file: @localstatedir@/log/open5gs/ausf.log
|
||||||
|
#
|
||||||
|
# ausf:
|
||||||
|
#
|
||||||
|
# <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: ausf.key
|
||||||
|
# pem: ausf.pem
|
||||||
|
#
|
||||||
|
# o SBI Server(https://127.0.0.5:443, http://[::1]:80)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.5
|
||||||
|
# tls:
|
||||||
|
# key: ausf.key
|
||||||
|
# pem: ausf.pem
|
||||||
|
# - addr: ::1
|
||||||
|
#
|
||||||
|
# o SBI Server(http://ausf.open5gs.org:80)
|
||||||
|
# sbi:
|
||||||
|
# name: ausf.open5gs.org
|
||||||
|
#
|
||||||
|
# o SBI Server(http://127.0.0.5:7777)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.5
|
||||||
|
# port: 7777
|
||||||
|
#
|
||||||
|
# o SBI Server(http://<eth0 IP address>:80)
|
||||||
|
# sbi:
|
||||||
|
# dev: eth0
|
||||||
|
#
|
||||||
|
ausf:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.5
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
#
|
||||||
|
# nrf:
|
||||||
|
#
|
||||||
|
# <SBI Client>>
|
||||||
|
#
|
||||||
|
# o SBI Client(http://127.0.0.1:7777)
|
||||||
|
# sbi:
|
||||||
|
# addr: 127.0.0.1
|
||||||
|
# port: 7777
|
||||||
|
#
|
||||||
|
# o SBI Client(https://127.0.0.1:443, http://nrf.open5gs.org:80)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.1
|
||||||
|
# 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.1:80 is selected.
|
||||||
|
#
|
||||||
|
# sbi:
|
||||||
|
# addr:
|
||||||
|
# - 127.0.0.1
|
||||||
|
# - fe80::1%@loopback_devname@
|
||||||
|
#
|
||||||
|
nrf:
|
||||||
|
sbi:
|
||||||
|
- addr:
|
||||||
|
- 127.0.0.1
|
||||||
|
- ::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 gNB per AMF
|
||||||
|
# gnb: 32
|
||||||
|
# o Maximum Number of UE per gNB
|
||||||
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
|
#
|
||||||
|
max:
|
||||||
|
|
||||||
|
#
|
||||||
|
# pool:
|
||||||
|
#
|
||||||
|
# o The Number of Default Memory Pool Size
|
||||||
|
#
|
||||||
|
# - Pool-size 128 => 8192 Number
|
||||||
|
# - Pool-size 256 => 4096 Number
|
||||||
|
# - Pool-size 512 => 2048 Number
|
||||||
|
# - Pool-size 1024 => 1024 Number
|
||||||
|
# - Pool-size 2048 => 512 Number
|
||||||
|
# - Pool-size 8192 => 128 Number
|
||||||
|
# - Pool-size 1024*1024 => 8 Number
|
||||||
|
#
|
||||||
|
# 128: 8192
|
||||||
|
# 256: 4096
|
||||||
|
# 512: 2048
|
||||||
|
# 1024: 1024
|
||||||
|
# 2048: 512
|
||||||
|
# 8192: 128
|
||||||
|
# big: 8
|
||||||
|
#
|
||||||
|
# o Memory of Packet Buffering in SGW
|
||||||
|
# - Maximum Number of packet(SDU size = 8Kbytes) pool in SGW
|
||||||
|
# - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes
|
||||||
|
#
|
||||||
|
# packet: 65536
|
||||||
|
#
|
||||||
|
pool:
|
||||||
|
|
||||||
|
#
|
||||||
|
# time:
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (Disabled)
|
||||||
|
# nf_instance:
|
||||||
|
# heartbeat: 0
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (5 seconds)
|
||||||
|
# nf_instance:
|
||||||
|
# heartbeat: 5
|
||||||
|
time:
|
|
@ -27,6 +27,9 @@ open5gs_conf = '''
|
||||||
pcrf.yaml
|
pcrf.yaml
|
||||||
|
|
||||||
nrf.yaml
|
nrf.yaml
|
||||||
|
udr.yaml
|
||||||
|
udm.yaml
|
||||||
|
ausf.yaml
|
||||||
upf.yaml
|
upf.yaml
|
||||||
smf.yaml
|
smf.yaml
|
||||||
amf.yaml
|
amf.yaml
|
||||||
|
|
|
@ -102,6 +102,8 @@ parameter:
|
||||||
# gnb: 32
|
# gnb: 32
|
||||||
# o Maximum Number of UE per gNB
|
# o Maximum Number of UE per gNB
|
||||||
# ue: 128
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
#
|
#
|
||||||
max:
|
max:
|
||||||
|
|
||||||
|
|
|
@ -277,6 +277,8 @@ parameter:
|
||||||
# gnb: 32
|
# gnb: 32
|
||||||
# o Maximum Number of UE per gNB
|
# o Maximum Number of UE per gNB
|
||||||
# ue: 128
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
#
|
#
|
||||||
max:
|
max:
|
||||||
|
|
||||||
|
|
|
@ -0,0 +1,179 @@
|
||||||
|
#
|
||||||
|
# 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,pfcp,fd,gtp,udm,event,tlv,mem,sock
|
||||||
|
#
|
||||||
|
logger:
|
||||||
|
file: @localstatedir@/log/open5gs/udm.log
|
||||||
|
#
|
||||||
|
# udm:
|
||||||
|
#
|
||||||
|
# <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: udm.key
|
||||||
|
# pem: udm.pem
|
||||||
|
#
|
||||||
|
# o SBI Server(https://127.0.0.6:443, http://[::1]:80)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.6
|
||||||
|
# tls:
|
||||||
|
# key: udm.key
|
||||||
|
# pem: udm.pem
|
||||||
|
# - addr: ::1
|
||||||
|
#
|
||||||
|
# o SBI Server(http://udm.open5gs.org:80)
|
||||||
|
# sbi:
|
||||||
|
# name: udm.open5gs.org
|
||||||
|
#
|
||||||
|
# o SBI Server(http://127.0.0.6:7777)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.6
|
||||||
|
# port: 7777
|
||||||
|
#
|
||||||
|
# o SBI Server(http://<eth0 IP address>:80)
|
||||||
|
# sbi:
|
||||||
|
# dev: eth0
|
||||||
|
#
|
||||||
|
udm:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.6
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
#
|
||||||
|
# nrf:
|
||||||
|
#
|
||||||
|
# <SBI Client>>
|
||||||
|
#
|
||||||
|
# o SBI Client(http://127.0.0.1:7777)
|
||||||
|
# sbi:
|
||||||
|
# addr: 127.0.0.1
|
||||||
|
# port: 7777
|
||||||
|
#
|
||||||
|
# o SBI Client(https://127.0.0.1:443, http://nrf.open5gs.org:80)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.1
|
||||||
|
# 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.1:80 is selected.
|
||||||
|
#
|
||||||
|
# sbi:
|
||||||
|
# addr:
|
||||||
|
# - 127.0.0.1
|
||||||
|
# - fe80::1%@loopback_devname@
|
||||||
|
#
|
||||||
|
nrf:
|
||||||
|
sbi:
|
||||||
|
- addr:
|
||||||
|
- 127.0.0.1
|
||||||
|
- ::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 gNB per AMF
|
||||||
|
# gnb: 32
|
||||||
|
# o Maximum Number of UE per gNB
|
||||||
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
|
#
|
||||||
|
max:
|
||||||
|
|
||||||
|
#
|
||||||
|
# pool:
|
||||||
|
#
|
||||||
|
# o The Number of Default Memory Pool Size
|
||||||
|
#
|
||||||
|
# - Pool-size 128 => 8192 Number
|
||||||
|
# - Pool-size 256 => 4096 Number
|
||||||
|
# - Pool-size 512 => 2048 Number
|
||||||
|
# - Pool-size 1024 => 1024 Number
|
||||||
|
# - Pool-size 2048 => 512 Number
|
||||||
|
# - Pool-size 8192 => 128 Number
|
||||||
|
# - Pool-size 1024*1024 => 8 Number
|
||||||
|
#
|
||||||
|
# 128: 8192
|
||||||
|
# 256: 4096
|
||||||
|
# 512: 2048
|
||||||
|
# 1024: 1024
|
||||||
|
# 2048: 512
|
||||||
|
# 8192: 128
|
||||||
|
# big: 8
|
||||||
|
#
|
||||||
|
# o Memory of Packet Buffering in SGW
|
||||||
|
# - Maximum Number of packet(SDU size = 8Kbytes) pool in SGW
|
||||||
|
# - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes
|
||||||
|
#
|
||||||
|
# packet: 65536
|
||||||
|
#
|
||||||
|
pool:
|
||||||
|
|
||||||
|
#
|
||||||
|
# time:
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (Disabled)
|
||||||
|
# nf_instance:
|
||||||
|
# heartbeat: 0
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (5 seconds)
|
||||||
|
# nf_instance:
|
||||||
|
# heartbeat: 5
|
||||||
|
time:
|
|
@ -0,0 +1,181 @@
|
||||||
|
db_uri: mongodb://localhost/open5gs
|
||||||
|
|
||||||
|
#
|
||||||
|
# logger:
|
||||||
|
#
|
||||||
|
# o Set OGS_LOG_INFO to all domain level
|
||||||
|
# - If `level` is omitted, the default level is OGS_LOG_INFO)
|
||||||
|
# - If `domain` is omitted, the all domain level is set from 'level'
|
||||||
|
# (Nothing is needed)
|
||||||
|
#
|
||||||
|
# o Set OGS_LOG_ERROR to all domain level
|
||||||
|
# - `level` can be set with none, fatal, error, warn, info, debug, trace
|
||||||
|
# level: error
|
||||||
|
#
|
||||||
|
# o Set OGS_LOG_DEBUG to mme/emm domain level
|
||||||
|
# level: debug
|
||||||
|
# domain: mme,emm
|
||||||
|
#
|
||||||
|
# o Set OGS_LOG_TRACE to all domain level
|
||||||
|
# level: trace
|
||||||
|
# domain: core,pfcp,fd,gtp,udr,event,tlv,mem,sock
|
||||||
|
#
|
||||||
|
logger:
|
||||||
|
file: @localstatedir@/log/open5gs/udr.log
|
||||||
|
#
|
||||||
|
# udr:
|
||||||
|
#
|
||||||
|
# <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: udr.key
|
||||||
|
# pem: udr.pem
|
||||||
|
#
|
||||||
|
# o SBI Server(https://127.0.0.7:443, http://[::1]:80)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.7
|
||||||
|
# tls:
|
||||||
|
# key: udr.key
|
||||||
|
# pem: udr.pem
|
||||||
|
# - addr: ::1
|
||||||
|
#
|
||||||
|
# o SBI Server(http://udr.open5gs.org:80)
|
||||||
|
# sbi:
|
||||||
|
# name: udr.open5gs.org
|
||||||
|
#
|
||||||
|
# o SBI Server(http://127.0.0.7:7777)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.7
|
||||||
|
# port: 7777
|
||||||
|
#
|
||||||
|
# o SBI Server(http://<eth0 IP address>:80)
|
||||||
|
# sbi:
|
||||||
|
# dev: eth0
|
||||||
|
#
|
||||||
|
udr:
|
||||||
|
sbi:
|
||||||
|
- addr: 127.0.0.7
|
||||||
|
port: 7777
|
||||||
|
|
||||||
|
#
|
||||||
|
# nrf:
|
||||||
|
#
|
||||||
|
# <SBI Client>>
|
||||||
|
#
|
||||||
|
# o SBI Client(http://127.0.0.1:7777)
|
||||||
|
# sbi:
|
||||||
|
# addr: 127.0.0.1
|
||||||
|
# port: 7777
|
||||||
|
#
|
||||||
|
# o SBI Client(https://127.0.0.1:443, http://nrf.open5gs.org:80)
|
||||||
|
# sbi:
|
||||||
|
# - addr: 127.0.0.1
|
||||||
|
# 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.1:80 is selected.
|
||||||
|
#
|
||||||
|
# sbi:
|
||||||
|
# addr:
|
||||||
|
# - 127.0.0.1
|
||||||
|
# - fe80::1%@loopback_devname@
|
||||||
|
#
|
||||||
|
nrf:
|
||||||
|
sbi:
|
||||||
|
- addr:
|
||||||
|
- 127.0.0.1
|
||||||
|
- ::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 gNB per AMF
|
||||||
|
# gnb: 32
|
||||||
|
# o Maximum Number of UE per gNB
|
||||||
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
|
#
|
||||||
|
max:
|
||||||
|
|
||||||
|
#
|
||||||
|
# pool:
|
||||||
|
#
|
||||||
|
# o The Number of Default Memory Pool Size
|
||||||
|
#
|
||||||
|
# - Pool-size 128 => 8192 Number
|
||||||
|
# - Pool-size 256 => 4096 Number
|
||||||
|
# - Pool-size 512 => 2048 Number
|
||||||
|
# - Pool-size 1024 => 1024 Number
|
||||||
|
# - Pool-size 2048 => 512 Number
|
||||||
|
# - Pool-size 8192 => 128 Number
|
||||||
|
# - Pool-size 1024*1024 => 8 Number
|
||||||
|
#
|
||||||
|
# 128: 8192
|
||||||
|
# 256: 4096
|
||||||
|
# 512: 2048
|
||||||
|
# 1024: 1024
|
||||||
|
# 2048: 512
|
||||||
|
# 8192: 128
|
||||||
|
# big: 8
|
||||||
|
#
|
||||||
|
# o Memory of Packet Buffering in SGW
|
||||||
|
# - Maximum Number of packet(SDU size = 8Kbytes) pool in SGW
|
||||||
|
# - SGW Memory Usage : 65536 * 8Kbytes = 512Mbytes
|
||||||
|
#
|
||||||
|
# packet: 65536
|
||||||
|
#
|
||||||
|
pool:
|
||||||
|
|
||||||
|
#
|
||||||
|
# time:
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (Default : 3 seconds)
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (Disabled)
|
||||||
|
# nf_instance:
|
||||||
|
# heartbeat: 0
|
||||||
|
#
|
||||||
|
# o NF Instance Heartbeat (5 seconds)
|
||||||
|
# nf_instance:
|
||||||
|
# heartbeat: 5
|
||||||
|
time:
|
|
@ -111,6 +111,8 @@ parameter:
|
||||||
# gnb: 32
|
# gnb: 32
|
||||||
# o Maximum Number of UE per gNB
|
# o Maximum Number of UE per gNB
|
||||||
# ue: 128
|
# ue: 128
|
||||||
|
# o Maximum Number of NF Instance
|
||||||
|
# nf: 512
|
||||||
#
|
#
|
||||||
max:
|
max:
|
||||||
|
|
||||||
|
|
|
@ -60,6 +60,15 @@ void pcrf_terminate(void);
|
||||||
int nrf_initialize(void);
|
int nrf_initialize(void);
|
||||||
void nrf_terminate(void);
|
void nrf_terminate(void);
|
||||||
|
|
||||||
|
int udr_initialize(void);
|
||||||
|
void udr_terminate(void);
|
||||||
|
|
||||||
|
int udm_initialize(void);
|
||||||
|
void udm_terminate(void);
|
||||||
|
|
||||||
|
int ausf_initialize(void);
|
||||||
|
void ausf_terminate(void);
|
||||||
|
|
||||||
int upf_initialize(void);
|
int upf_initialize(void);
|
||||||
void upf_terminate(void);
|
void upf_terminate(void);
|
||||||
|
|
||||||
|
|
|
@ -137,14 +137,21 @@ static void recalculate_pool_size(void)
|
||||||
#define MAX_NUM_OF_BEARER 4 /* Num of Bearer per APN(Session) */
|
#define MAX_NUM_OF_BEARER 4 /* Num of Bearer per APN(Session) */
|
||||||
#define MAX_NUM_OF_TUNNEL 3 /* Num of Tunnel per Bearer */
|
#define MAX_NUM_OF_TUNNEL 3 /* Num of Tunnel per Bearer */
|
||||||
#define MAX_NUM_OF_PF 16 /* Num of PacketFilter per Bearer */
|
#define MAX_NUM_OF_PF 16 /* Num of PacketFilter per Bearer */
|
||||||
|
#define MAX_NUM_OF_NF_SERVICE 16 /* Num of NF Service per NF Instance */
|
||||||
|
#define MAX_NUM_OF_SBI_MESSAGE 8 /* Num of HTTP(s) Request/Response per NF */
|
||||||
|
#define MAX_NUM_OF_NF_SUBSCRIPTION 4 /* Num of Subscription per NF */
|
||||||
|
#define MAX_NUM_OF_AUTH 4 /* Num of Subscription per UE */
|
||||||
|
|
||||||
self.pool.ue = self.max.ue * self.max.gnb;
|
self.pool.ue = self.max.ue * self.max.gnb;
|
||||||
|
self.pool.auth = self.pool.ue * MAX_NUM_OF_AUTH;
|
||||||
self.pool.pfcp = ogs_max(self.max.smf, self.max.upf);
|
self.pool.pfcp = ogs_max(self.max.smf, self.max.upf);
|
||||||
self.pool.sbi = self.pool.pfcp;
|
|
||||||
self.pool.sess = self.pool.ue * OGS_MAX_NUM_OF_SESS;
|
self.pool.sess = self.pool.ue * OGS_MAX_NUM_OF_SESS;
|
||||||
self.pool.bearer = self.pool.sess * MAX_NUM_OF_BEARER;
|
self.pool.bearer = self.pool.sess * MAX_NUM_OF_BEARER;
|
||||||
self.pool.tunnel = self.pool.bearer * MAX_NUM_OF_TUNNEL;
|
self.pool.tunnel = self.pool.bearer * MAX_NUM_OF_TUNNEL;
|
||||||
self.pool.pf = self.pool.bearer * MAX_NUM_OF_PF;
|
self.pool.pf = self.pool.bearer * MAX_NUM_OF_PF;
|
||||||
|
self.pool.nf_service = self.max.nf * MAX_NUM_OF_NF_SERVICE;
|
||||||
|
self.pool.sbi_message = self.max.nf * MAX_NUM_OF_SBI_MESSAGE;
|
||||||
|
self.pool.nf_subscription = self.max.nf * MAX_NUM_OF_NF_SUBSCRIPTION;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int config_prepare(void)
|
static int config_prepare(void)
|
||||||
|
@ -161,6 +168,7 @@ static int config_prepare(void)
|
||||||
#define MAX_NUM_OF_SMF 32 /* Num of SMF per AMF */
|
#define MAX_NUM_OF_SMF 32 /* Num of SMF per AMF */
|
||||||
#define MAX_NUM_OF_UPF 32 /* Num of PGW per AMF */
|
#define MAX_NUM_OF_UPF 32 /* Num of PGW per AMF */
|
||||||
#define MAX_NUM_OF_GNB 32 /* Num of gNB per AMF */
|
#define MAX_NUM_OF_GNB 32 /* Num of gNB per AMF */
|
||||||
|
#define MAX_NUM_OF_NF 512 /* Num of NF Instance */
|
||||||
self.max.sgw = MAX_NUM_OF_SGW;
|
self.max.sgw = MAX_NUM_OF_SGW;
|
||||||
self.max.pgw = MAX_NUM_OF_PGW;
|
self.max.pgw = MAX_NUM_OF_PGW;
|
||||||
self.max.vlr = MAX_NUM_OF_VLR;
|
self.max.vlr = MAX_NUM_OF_VLR;
|
||||||
|
@ -170,6 +178,7 @@ static int config_prepare(void)
|
||||||
self.max.ue = MAX_NUM_OF_UE;
|
self.max.ue = MAX_NUM_OF_UE;
|
||||||
self.max.smf = MAX_NUM_OF_SMF;
|
self.max.smf = MAX_NUM_OF_SMF;
|
||||||
self.max.upf = MAX_NUM_OF_UPF;
|
self.max.upf = MAX_NUM_OF_UPF;
|
||||||
|
self.max.nf = MAX_NUM_OF_NF;
|
||||||
|
|
||||||
#define MAX_NUM_OF_PACKET_POOL 65536
|
#define MAX_NUM_OF_PACKET_POOL 65536
|
||||||
self.pool.packet = MAX_NUM_OF_PACKET_POOL;
|
self.pool.packet = MAX_NUM_OF_PACKET_POOL;
|
||||||
|
@ -259,6 +268,21 @@ int ogs_config_parse()
|
||||||
} else if (!strcmp(parameter_key, "no_pcrf")) {
|
} else if (!strcmp(parameter_key, "no_pcrf")) {
|
||||||
self.parameter.no_pcrf =
|
self.parameter.no_pcrf =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
|
} else if (!strcmp(parameter_key, "no_upf")) {
|
||||||
|
self.parameter.no_upf =
|
||||||
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
|
} else if (!strcmp(parameter_key, "no_smf")) {
|
||||||
|
self.parameter.no_smf =
|
||||||
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
|
} else if (!strcmp(parameter_key, "no_ausf")) {
|
||||||
|
self.parameter.no_ausf =
|
||||||
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
|
} else if (!strcmp(parameter_key, "no_udm")) {
|
||||||
|
self.parameter.no_udm =
|
||||||
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
|
} else if (!strcmp(parameter_key, "no_udr")) {
|
||||||
|
self.parameter.no_udr =
|
||||||
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
} else if (!strcmp(parameter_key, "no_ipv4")) {
|
} else if (!strcmp(parameter_key, "no_ipv4")) {
|
||||||
self.parameter.no_ipv4 =
|
self.parameter.no_ipv4 =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
|
@ -329,6 +353,9 @@ int ogs_config_parse()
|
||||||
!strcmp(max_key, "enb")) {
|
!strcmp(max_key, "enb")) {
|
||||||
const char *v = ogs_yaml_iter_value(&max_iter);
|
const char *v = ogs_yaml_iter_value(&max_iter);
|
||||||
if (v) self.max.gnb = atoi(v);
|
if (v) self.max.gnb = atoi(v);
|
||||||
|
} else if (!strcmp(max_key, "nf")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&max_iter);
|
||||||
|
if (v) self.max.nf = atoi(v);
|
||||||
} else
|
} else
|
||||||
ogs_warn("unknown key `%s`", max_key);
|
ogs_warn("unknown key `%s`", max_key);
|
||||||
}
|
}
|
||||||
|
|
|
@ -51,6 +51,9 @@ typedef struct ogs_config_s {
|
||||||
int no_amf;
|
int no_amf;
|
||||||
int no_smf;
|
int no_smf;
|
||||||
int no_upf;
|
int no_upf;
|
||||||
|
int no_ausf;
|
||||||
|
int no_udm;
|
||||||
|
int no_udr;
|
||||||
int no_nrf;
|
int no_nrf;
|
||||||
|
|
||||||
/* Network */
|
/* Network */
|
||||||
|
@ -76,6 +79,7 @@ typedef struct ogs_config_s {
|
||||||
int smf;
|
int smf;
|
||||||
int upf;
|
int upf;
|
||||||
int gnb;
|
int gnb;
|
||||||
|
int nf;
|
||||||
} max;
|
} max;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
@ -83,12 +87,15 @@ typedef struct ogs_config_s {
|
||||||
int packet;
|
int packet;
|
||||||
|
|
||||||
int ue;
|
int ue;
|
||||||
|
int auth;
|
||||||
int pfcp;
|
int pfcp;
|
||||||
int sbi;
|
|
||||||
int sess;
|
int sess;
|
||||||
int bearer;
|
int bearer;
|
||||||
int tunnel;
|
int tunnel;
|
||||||
int pf;
|
int pf;
|
||||||
|
int nf_service;
|
||||||
|
int nf_subscription;
|
||||||
|
int sbi_message;
|
||||||
} pool;
|
} pool;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
|
|
@ -22,6 +22,8 @@
|
||||||
void ogs_asn_uint8_to_OCTET_STRING(
|
void ogs_asn_uint8_to_OCTET_STRING(
|
||||||
uint8_t uint8, OCTET_STRING_t *octet_string)
|
uint8_t uint8, OCTET_STRING_t *octet_string)
|
||||||
{
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
|
||||||
octet_string->size = 1;
|
octet_string->size = 1;
|
||||||
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
||||||
|
|
||||||
|
@ -31,6 +33,8 @@ void ogs_asn_uint8_to_OCTET_STRING(
|
||||||
void ogs_asn_uint16_to_OCTET_STRING(
|
void ogs_asn_uint16_to_OCTET_STRING(
|
||||||
uint16_t uint16, OCTET_STRING_t *octet_string)
|
uint16_t uint16, OCTET_STRING_t *octet_string)
|
||||||
{
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
|
||||||
octet_string->size = 2;
|
octet_string->size = 2;
|
||||||
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
||||||
|
|
||||||
|
@ -41,6 +45,8 @@ void ogs_asn_uint16_to_OCTET_STRING(
|
||||||
void ogs_asn_uint24_to_OCTET_STRING(
|
void ogs_asn_uint24_to_OCTET_STRING(
|
||||||
ogs_uint24_t uint24, OCTET_STRING_t *octet_string)
|
ogs_uint24_t uint24, OCTET_STRING_t *octet_string)
|
||||||
{
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
|
||||||
octet_string->size = 3;
|
octet_string->size = 3;
|
||||||
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
||||||
|
|
||||||
|
@ -52,6 +58,8 @@ void ogs_asn_uint24_to_OCTET_STRING(
|
||||||
void ogs_asn_uint32_to_OCTET_STRING(
|
void ogs_asn_uint32_to_OCTET_STRING(
|
||||||
uint32_t uint32, OCTET_STRING_t *octet_string)
|
uint32_t uint32, OCTET_STRING_t *octet_string)
|
||||||
{
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
|
||||||
octet_string->size = 4;
|
octet_string->size = 4;
|
||||||
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
octet_string->buf = CALLOC(octet_string->size, sizeof(uint8_t));
|
||||||
|
|
||||||
|
@ -61,6 +69,41 @@ void ogs_asn_uint32_to_OCTET_STRING(
|
||||||
octet_string->buf[3] = uint32;
|
octet_string->buf[3] = uint32;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint8(
|
||||||
|
OCTET_STRING_t *octet_string, uint8_t *uint8)
|
||||||
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
ogs_assert(uint8);
|
||||||
|
|
||||||
|
*uint8 = octet_string->buf[0];
|
||||||
|
}
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint16(
|
||||||
|
OCTET_STRING_t *octet_string, uint16_t *uint16)
|
||||||
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
ogs_assert(uint16);
|
||||||
|
|
||||||
|
*uint16 = (octet_string->buf[0] << 8) + octet_string->buf[1];
|
||||||
|
}
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint24(
|
||||||
|
OCTET_STRING_t *octet_string, ogs_uint24_t *uint24)
|
||||||
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
ogs_assert(uint24);
|
||||||
|
|
||||||
|
memcpy(uint24, octet_string->buf, sizeof(ogs_uint24_t));
|
||||||
|
*uint24 = ogs_be24toh(*uint24);
|
||||||
|
}
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint32(
|
||||||
|
OCTET_STRING_t *octet_string, uint32_t *uint32)
|
||||||
|
{
|
||||||
|
ogs_assert(octet_string);
|
||||||
|
ogs_assert(uint32);
|
||||||
|
|
||||||
|
*uint32 = (octet_string->buf[0] << 24) + (octet_string->buf[1] << 16) +
|
||||||
|
(octet_string->buf[2] << 8) + octet_string->buf[3];
|
||||||
|
}
|
||||||
|
|
||||||
void ogs_asn_buffer_to_OCTET_STRING(
|
void ogs_asn_buffer_to_OCTET_STRING(
|
||||||
void *buf, int size, OCTET_STRING_t *octet_string)
|
void *buf, int size, OCTET_STRING_t *octet_string)
|
||||||
{
|
{
|
||||||
|
@ -70,6 +113,16 @@ void ogs_asn_buffer_to_OCTET_STRING(
|
||||||
memcpy(octet_string->buf, buf, size);
|
memcpy(octet_string->buf, buf, size);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ogs_asn_buffer_to_BIT_STRING(
|
||||||
|
void *buf, int size, int unused, BIT_STRING_t *bit_string)
|
||||||
|
{
|
||||||
|
bit_string->size = size;
|
||||||
|
bit_string->buf = CALLOC(bit_string->size, sizeof(uint8_t));
|
||||||
|
bit_string->bits_unused = unused;
|
||||||
|
|
||||||
|
memcpy(bit_string->buf, buf, size);
|
||||||
|
}
|
||||||
|
|
||||||
int ogs_asn_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ogs_ip_t *ip)
|
int ogs_asn_BIT_STRING_to_ip(BIT_STRING_t *bit_string, ogs_ip_t *ip)
|
||||||
{
|
{
|
||||||
char buf[OGS_ADDRSTRLEN], buf2[OGS_ADDRSTRLEN];
|
char buf[OGS_ADDRSTRLEN], buf2[OGS_ADDRSTRLEN];
|
||||||
|
|
|
@ -58,8 +58,20 @@ void ogs_asn_uint24_to_OCTET_STRING(
|
||||||
ogs_uint24_t uint24, OCTET_STRING_t *octet_string);
|
ogs_uint24_t uint24, OCTET_STRING_t *octet_string);
|
||||||
void ogs_asn_uint32_to_OCTET_STRING(
|
void ogs_asn_uint32_to_OCTET_STRING(
|
||||||
uint32_t uint32, OCTET_STRING_t *octet_string);
|
uint32_t uint32, OCTET_STRING_t *octet_string);
|
||||||
|
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint8(
|
||||||
|
OCTET_STRING_t *octet_string, uint8_t *uint8);
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint16(
|
||||||
|
OCTET_STRING_t *octet_string, uint16_t *uint16);
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint24(
|
||||||
|
OCTET_STRING_t *octet_string, ogs_uint24_t *uint24);
|
||||||
|
void ogs_asn_OCTET_STRING_to_uint32(
|
||||||
|
OCTET_STRING_t *octet_string, uint32_t *uint32);
|
||||||
|
|
||||||
void ogs_asn_buffer_to_OCTET_STRING(
|
void ogs_asn_buffer_to_OCTET_STRING(
|
||||||
void *buf, int size, OCTET_STRING_t *octet_string);
|
void *buf, int size, OCTET_STRING_t *octet_string);
|
||||||
|
void ogs_asn_buffer_to_BIT_STRING(
|
||||||
|
void *buf, int size, int unused, BIT_STRING_t *bit_string);
|
||||||
|
|
||||||
int ogs_asn_BIT_STRING_to_ip(
|
int ogs_asn_BIT_STRING_to_ip(
|
||||||
BIT_STRING_t *bit_string, ogs_ip_t *ip);
|
BIT_STRING_t *bit_string, ogs_ip_t *ip);
|
||||||
|
|
|
@ -64,6 +64,14 @@ void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id,
|
||||||
return plmn_id;
|
return plmn_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *ogs_plmn_id_string(ogs_plmn_id_t *plmn_id)
|
||||||
|
{
|
||||||
|
ogs_assert(plmn_id);
|
||||||
|
|
||||||
|
return ogs_msprintf("5G:mnc%03d.mcc%03d.3gppnetwork.org",
|
||||||
|
ogs_plmn_id_mnc(plmn_id), ogs_plmn_id_mcc(plmn_id));
|
||||||
|
}
|
||||||
|
|
||||||
uint32_t ogs_amf_id_hexdump(ogs_amf_id_t *amf_id)
|
uint32_t ogs_amf_id_hexdump(ogs_amf_id_t *amf_id)
|
||||||
{
|
{
|
||||||
uint32_t hex;
|
uint32_t hex;
|
||||||
|
@ -95,17 +103,11 @@ ogs_amf_id_t *ogs_amf_id_from_string(ogs_amf_id_t *amf_id, const char *hex)
|
||||||
|
|
||||||
char *ogs_amf_id_to_string(ogs_amf_id_t *amf_id, char *buf)
|
char *ogs_amf_id_to_string(ogs_amf_id_t *amf_id, char *buf)
|
||||||
{
|
{
|
||||||
int i;
|
|
||||||
ogs_assert(amf_id);
|
ogs_assert(amf_id);
|
||||||
ogs_assert(buf);
|
ogs_assert(buf);
|
||||||
|
|
||||||
ogs_hex_to_ascii(amf_id, sizeof(ogs_amf_id_t), buf, OGS_AMFIDSTRLEN);
|
ogs_hex_to_ascii(amf_id, sizeof(ogs_amf_id_t), buf, OGS_AMFIDSTRLEN);
|
||||||
|
|
||||||
/* I'd just like to use lower character */
|
|
||||||
for (i = 0; buf[i]; i++)
|
|
||||||
if (buf[i] >= 'A' && buf[i] <= 'Z')
|
|
||||||
buf[i] = buf[i] + 'a' - 'A';
|
|
||||||
|
|
||||||
return buf;
|
return buf;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -140,6 +142,68 @@ ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id,
|
||||||
return amf_id;
|
return amf_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
char *ogs_supi_from_suci(char *suci)
|
||||||
|
{
|
||||||
|
#define MAX_SUCI_TOKEN 16
|
||||||
|
char *array[MAX_SUCI_TOKEN];
|
||||||
|
char *saveptr = NULL;
|
||||||
|
char *p, *tmp;
|
||||||
|
int i;
|
||||||
|
char *supi = NULL;
|
||||||
|
|
||||||
|
ogs_assert(suci);
|
||||||
|
tmp = ogs_strdup(suci);
|
||||||
|
|
||||||
|
p = strtok_r(tmp, "-", &saveptr);
|
||||||
|
|
||||||
|
memset(array, 0, sizeof(array));
|
||||||
|
for (i = 0; i < MAX_SUCI_TOKEN && p; i++) {
|
||||||
|
array[i] = p;
|
||||||
|
p = strtok_r(NULL, "-", &saveptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
SWITCH(array[0])
|
||||||
|
CASE("suci")
|
||||||
|
SWITCH(array[1])
|
||||||
|
CASE("0") /* SUPI format : IMSI */
|
||||||
|
if (array[2] && array[3] && array[7])
|
||||||
|
supi = ogs_msprintf("imsi-%s%s%s",
|
||||||
|
array[2], array[3], array[7]);
|
||||||
|
|
||||||
|
break;
|
||||||
|
DEFAULT
|
||||||
|
ogs_error("Not implemented [%s]", array[1]);
|
||||||
|
break;
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
DEFAULT
|
||||||
|
ogs_error("Not implemented [%s]", array[0]);
|
||||||
|
break;
|
||||||
|
END
|
||||||
|
|
||||||
|
ogs_free(tmp);
|
||||||
|
return supi;
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ogs_ueid_from_supi(char *supi)
|
||||||
|
{
|
||||||
|
char *saveptr = NULL;
|
||||||
|
char *p, *tmp;
|
||||||
|
char *ueid = NULL;
|
||||||
|
|
||||||
|
ogs_assert(supi);
|
||||||
|
tmp = ogs_strdup(supi);
|
||||||
|
|
||||||
|
p = strtok_r(tmp, "-", &saveptr);
|
||||||
|
ogs_assert(p);
|
||||||
|
p = strtok_r(NULL, "-", &saveptr);
|
||||||
|
ogs_assert(p);
|
||||||
|
ueid = ogs_strdup(p);
|
||||||
|
|
||||||
|
ogs_free(tmp);
|
||||||
|
return ueid;
|
||||||
|
}
|
||||||
|
|
||||||
int ogs_fqdn_build(char *dst, char *src, int length)
|
int ogs_fqdn_build(char *dst, char *src, int length)
|
||||||
{
|
{
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
|
|
|
@ -33,6 +33,7 @@ extern "C" {
|
||||||
|
|
||||||
#define OGS_MAX_SDU_LEN 8192
|
#define OGS_MAX_SDU_LEN 8192
|
||||||
#define OGS_PLMN_ID_LEN 3
|
#define OGS_PLMN_ID_LEN 3
|
||||||
|
#define OGS_MAX_PLMN_ID_BCD_LEN 6
|
||||||
|
|
||||||
#define OGS_BCD_TO_BUFFER_LEN(x) (((x)+1)/2)
|
#define OGS_BCD_TO_BUFFER_LEN(x) (((x)+1)/2)
|
||||||
#define OGS_MAX_IMSI_BCD_LEN 15
|
#define OGS_MAX_IMSI_BCD_LEN 15
|
||||||
|
@ -126,6 +127,8 @@ uint16_t ogs_plmn_id_mnc_len(ogs_plmn_id_t *plmn_id);
|
||||||
void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id,
|
void *ogs_plmn_id_build(ogs_plmn_id_t *plmn_id,
|
||||||
uint16_t mcc, uint16_t mnc, uint16_t mnc_len);
|
uint16_t mcc, uint16_t mnc, uint16_t mnc_len);
|
||||||
|
|
||||||
|
char *ogs_plmn_id_string(ogs_plmn_id_t *plmn_id);
|
||||||
|
|
||||||
/************************************
|
/************************************
|
||||||
* AMF_ID Structure */
|
* AMF_ID Structure */
|
||||||
typedef struct ogs_amf_id_s {
|
typedef struct ogs_amf_id_s {
|
||||||
|
@ -148,6 +151,11 @@ uint8_t ogs_amf_pointer(ogs_amf_id_t *amf_id);
|
||||||
ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id,
|
ogs_amf_id_t *ogs_amf_id_build(ogs_amf_id_t *amf_id,
|
||||||
uint8_t region, uint16_t set, uint8_t pointer);
|
uint8_t region, uint16_t set, uint8_t pointer);
|
||||||
|
|
||||||
|
/************************************
|
||||||
|
* SUPI/SUCI */
|
||||||
|
char *ogs_supi_from_suci(char *suci);
|
||||||
|
char *ogs_ueid_from_supi(char *supi);
|
||||||
|
|
||||||
/************************************
|
/************************************
|
||||||
* TAI Structure */
|
* TAI Structure */
|
||||||
#define OGS_MAX_NUM_OF_TAI 16
|
#define OGS_MAX_NUM_OF_TAI 16
|
||||||
|
@ -166,6 +174,11 @@ typedef struct ogs_e_cgi_s {
|
||||||
uint32_t cell_id; /* 28 bit */
|
uint32_t cell_id; /* 28 bit */
|
||||||
} __attribute__ ((packed)) ogs_e_cgi_t;
|
} __attribute__ ((packed)) ogs_e_cgi_t;
|
||||||
|
|
||||||
|
typedef struct ogs_nr_cgi_s {
|
||||||
|
ogs_plmn_id_t plmn_id;
|
||||||
|
uint64_t cell_id; /* 36 bit */
|
||||||
|
} __attribute__ ((packed)) ogs_nr_cgi_t;
|
||||||
|
|
||||||
/************************************
|
/************************************
|
||||||
* S-NSSAI Structure */
|
* S-NSSAI Structure */
|
||||||
#define OGS_MAX_NUM_OF_S_NSSAI 8
|
#define OGS_MAX_NUM_OF_S_NSSAI 8
|
||||||
|
|
|
@ -58,8 +58,7 @@ void *ogs_hex_to_ascii(void *in, int in_len, void *out, int out_len)
|
||||||
|
|
||||||
l = (in_len - off) > out_len ? out_len : in_len - off;
|
l = (in_len - off) > out_len ? out_len : in_len - off;
|
||||||
for (i = 0; i < l; i++) {
|
for (i = 0; i < l; i++) {
|
||||||
p += sprintf(p, "%02X", ((char*)in)[off+i] & 0xff);
|
p += sprintf(p, "%02x", ((char*)in)[off+i] & 0xff);
|
||||||
if ((i & 0x3) == 3 && (i != (l-1))) p += sprintf(p, " ");
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return out;
|
return out;
|
||||||
|
|
|
@ -39,8 +39,7 @@ void ogs_fsm_init(void *sm, void *event)
|
||||||
ogs_fsm_t *s = sm;
|
ogs_fsm_t *s = sm;
|
||||||
fsm_event_t *e = event;
|
fsm_event_t *e = event;
|
||||||
|
|
||||||
if (s->init != NULL)
|
if (s->init != NULL) {
|
||||||
{
|
|
||||||
(*s->init)(s, e);
|
(*s->init)(s, e);
|
||||||
if (s->init != s->state) {
|
if (s->init != s->state) {
|
||||||
if (e) {
|
if (e) {
|
||||||
|
@ -59,7 +58,9 @@ void ogs_fsm_dispatch(void *sm, void *event)
|
||||||
fsm_event_t *e = event;
|
fsm_event_t *e = event;
|
||||||
ogs_fsm_handler_t tmp = s->state;
|
ogs_fsm_handler_t tmp = s->state;
|
||||||
|
|
||||||
|
if (e)
|
||||||
(*tmp)(s, e);
|
(*tmp)(s, e);
|
||||||
|
|
||||||
if (s->state != tmp) {
|
if (s->state != tmp) {
|
||||||
if (e) {
|
if (e) {
|
||||||
e->id = OGS_FSM_EXIT_SIG;
|
e->id = OGS_FSM_EXIT_SIG;
|
||||||
|
|
|
@ -167,7 +167,9 @@ extern "C" {
|
||||||
#ifndef SWITCH_CASE_INIT
|
#ifndef SWITCH_CASE_INIT
|
||||||
#define SWITCH_CASE_INIT
|
#define SWITCH_CASE_INIT
|
||||||
#define SWITCH(X) {char *__switch_p__, __switch_next__; \
|
#define SWITCH(X) {char *__switch_p__, __switch_next__; \
|
||||||
for (__switch_p__ = (char *)X, __switch_next__ = 1; \
|
for (__switch_p__ = \
|
||||||
|
X ? (char *)X : (char *)"OGS_SWITCH_NULL", \
|
||||||
|
__switch_next__ = 1; \
|
||||||
__switch_p__; \
|
__switch_p__; \
|
||||||
__switch_p__ = 0, __switch_next__ = 1) { {
|
__switch_p__ = 0, __switch_next__ = 1) { {
|
||||||
#define CASE(X) } if (!__switch_next__ || \
|
#define CASE(X) } if (!__switch_next__ || \
|
||||||
|
|
|
@ -28,6 +28,7 @@ libcrypt_sources = files('''
|
||||||
snow-3g.h
|
snow-3g.h
|
||||||
zuc.h
|
zuc.h
|
||||||
kasumi.h
|
kasumi.h
|
||||||
|
ogs-kdf.h
|
||||||
|
|
||||||
ogs-aes.c
|
ogs-aes.c
|
||||||
ogs-aes-cmac.c
|
ogs-aes-cmac.c
|
||||||
|
@ -39,6 +40,8 @@ libcrypt_sources = files('''
|
||||||
snow-3g.c
|
snow-3g.c
|
||||||
zuc.c
|
zuc.c
|
||||||
kasumi.c
|
kasumi.c
|
||||||
|
|
||||||
|
ogs-kdf.c
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
||||||
libcrypt_inc = include_directories('.')
|
libcrypt_inc = include_directories('.')
|
||||||
|
|
|
@ -36,17 +36,28 @@
|
||||||
#include "crypt/zuc.h"
|
#include "crypt/zuc.h"
|
||||||
#include "crypt/kasumi.h"
|
#include "crypt/kasumi.h"
|
||||||
|
|
||||||
|
#include "crypt/ogs-kdf.h"
|
||||||
|
|
||||||
#undef OGS_CRYPT_INSIDE
|
#undef OGS_CRYPT_INSIDE
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define OGS_KEY_LEN 16
|
||||||
|
#define OGS_AMF_LEN 2
|
||||||
#define OGS_RAND_LEN 16
|
#define OGS_RAND_LEN 16
|
||||||
#define OGS_AUTN_LEN 16
|
#define OGS_AUTN_LEN 16
|
||||||
#define OGS_AUTS_LEN 14
|
#define OGS_AUTS_LEN 14
|
||||||
#define OGS_MAX_RES_LEN 16
|
#define OGS_MAX_RES_LEN 16
|
||||||
|
|
||||||
|
#define OGS_SQN_XOR_AK_LEN 6
|
||||||
|
#define OGS_AK_LEN 6
|
||||||
|
#define OGS_SQN_LEN 6
|
||||||
|
#define OGS_MAX_SQN 0xffffffffffff
|
||||||
|
|
||||||
|
#define OGS_KEYSTRLEN(x) ((x*2)+1)
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,311 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Open5GS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ogs-crypt.h"
|
||||||
|
|
||||||
|
#define MAX_NUM_OF_KDF_PARAM 16
|
||||||
|
|
||||||
|
#define FC_FOR_CK_PRIME_IK_PRIME_DERIVATION 0x20
|
||||||
|
#define FC_FOR_5GS_ALGORITHM_KEY_DERIVATION 0x69
|
||||||
|
#define FC_FOR_KAUSF_DERIVATION 0x6A
|
||||||
|
#define FC_FOR_RES_STAR_XRES_STAR_DERIVATION 0x6B
|
||||||
|
#define FC_FOR_KSEAF_DERIVATION 0x6C
|
||||||
|
#define FC_FOR_KAMF_DERIVATION 0x6D
|
||||||
|
#define FC_FOR_KGNB_KN3IWF_DERIVATION 0x6E
|
||||||
|
#define FC_FOR_NH_GNB_DERIVATION 0x6F
|
||||||
|
|
||||||
|
#define FC_FOR_KENB_DERIVATION 0x11
|
||||||
|
#define FC_FOR_NH_ENB_DERIVATION 0x12
|
||||||
|
#define FC_FOR_EPS_ALGORITHM_KEY_DERIVATION 0x15
|
||||||
|
|
||||||
|
typedef struct kdf_param_s {
|
||||||
|
uint8_t *buf;
|
||||||
|
uint16_t len;
|
||||||
|
} kdf_param_t[MAX_NUM_OF_KDF_PARAM];
|
||||||
|
|
||||||
|
/* KDF function : TS.33220 cluase B.2.0 */
|
||||||
|
static void ogs_kdf_common(uint8_t *key, uint32_t key_size,
|
||||||
|
uint8_t fc, kdf_param_t param, uint8_t *output)
|
||||||
|
{
|
||||||
|
int i = 0, pos;
|
||||||
|
uint8_t *s = NULL;
|
||||||
|
|
||||||
|
ogs_assert(key);
|
||||||
|
ogs_assert(key_size);
|
||||||
|
ogs_assert(fc);
|
||||||
|
ogs_assert(param[0].buf);
|
||||||
|
ogs_assert(param[0].len);
|
||||||
|
ogs_assert(output);
|
||||||
|
|
||||||
|
pos = 1; /* FC Value */
|
||||||
|
|
||||||
|
/* Calculate buffer length */
|
||||||
|
for (i = 0; i < MAX_NUM_OF_KDF_PARAM && param[i].buf && param[i].len; i++) {
|
||||||
|
pos += (param[i].len + 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
s = ogs_calloc(1, pos);
|
||||||
|
ogs_assert(s);
|
||||||
|
|
||||||
|
/* Copy buffer from param */
|
||||||
|
pos = 0;
|
||||||
|
s[pos++] = fc;
|
||||||
|
for (i = 0; i < MAX_NUM_OF_KDF_PARAM && param[i].buf && param[i].len; i++) {
|
||||||
|
uint16_t len;
|
||||||
|
|
||||||
|
memcpy(&s[pos], param[i].buf, param[i].len);
|
||||||
|
pos += param[i].len;
|
||||||
|
len = htobe16(param[i].len);
|
||||||
|
memcpy(&s[pos], &len, sizeof(len));
|
||||||
|
pos += 2;
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_hmac_sha256(key, key_size, s, pos, output, OGS_SHA256_DIGEST_SIZE);
|
||||||
|
|
||||||
|
ogs_free(s);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.2 : Kausf derviation function */
|
||||||
|
void ogs_kdf_kausf(
|
||||||
|
uint8_t *ck, uint8_t *ik,
|
||||||
|
char *serving_network_name, uint8_t *autn,
|
||||||
|
uint8_t *kausf)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
uint8_t key[OGS_KEY_LEN*2];
|
||||||
|
|
||||||
|
ogs_assert(ck);
|
||||||
|
ogs_assert(ik);
|
||||||
|
ogs_assert(serving_network_name);
|
||||||
|
ogs_assert(autn);
|
||||||
|
ogs_assert(kausf);
|
||||||
|
|
||||||
|
memcpy(key, ck, OGS_KEY_LEN);
|
||||||
|
memcpy(key+OGS_KEY_LEN, ik, OGS_KEY_LEN);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = (uint8_t *)serving_network_name;
|
||||||
|
param[0].len = strlen(serving_network_name);
|
||||||
|
param[1].buf = autn;
|
||||||
|
param[1].len = OGS_SQN_XOR_AK_LEN;
|
||||||
|
|
||||||
|
ogs_kdf_common(key, OGS_KEY_LEN*2,
|
||||||
|
FC_FOR_KAUSF_DERIVATION, param, kausf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.4 : RES* and XRES* derivation function */
|
||||||
|
void ogs_kdf_xres_star(
|
||||||
|
uint8_t *ck, uint8_t *ik,
|
||||||
|
char *serving_network_name, uint8_t *rand,
|
||||||
|
uint8_t *xres, size_t xres_len,
|
||||||
|
uint8_t *xres_star)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
uint8_t key[OGS_KEY_LEN*2];
|
||||||
|
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||||
|
|
||||||
|
ogs_assert(ck);
|
||||||
|
ogs_assert(ik);
|
||||||
|
ogs_assert(serving_network_name);
|
||||||
|
ogs_assert(rand);
|
||||||
|
ogs_assert(xres);
|
||||||
|
ogs_assert(xres_len);
|
||||||
|
|
||||||
|
memcpy(key, ck, OGS_KEY_LEN);
|
||||||
|
memcpy(key+OGS_KEY_LEN, ik, OGS_KEY_LEN);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = (uint8_t *)serving_network_name;
|
||||||
|
param[0].len = strlen(serving_network_name);
|
||||||
|
param[1].buf = rand;
|
||||||
|
param[1].len = OGS_RAND_LEN;
|
||||||
|
param[2].buf = xres;
|
||||||
|
param[2].len = xres_len;
|
||||||
|
|
||||||
|
ogs_kdf_common(key, OGS_KEY_LEN*2,
|
||||||
|
FC_FOR_RES_STAR_XRES_STAR_DERIVATION, param, output);
|
||||||
|
|
||||||
|
memcpy(xres_star, output+OGS_KEY_LEN, OGS_KEY_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.5 : HRES* and HXRES* derivation function */
|
||||||
|
void ogs_kdf_hxres_star(uint8_t *rand, uint8_t *xres_star, uint8_t *hxres_star)
|
||||||
|
{
|
||||||
|
uint8_t message[OGS_RAND_LEN + OGS_KEY_LEN];
|
||||||
|
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||||
|
|
||||||
|
ogs_assert(rand);
|
||||||
|
ogs_assert(xres_star);
|
||||||
|
ogs_assert(hxres_star);
|
||||||
|
|
||||||
|
memcpy(message, rand, OGS_RAND_LEN);
|
||||||
|
memcpy(message+OGS_RAND_LEN, xres_star, OGS_KEY_LEN);
|
||||||
|
|
||||||
|
ogs_sha256(message, OGS_RAND_LEN+OGS_KEY_LEN, output);
|
||||||
|
|
||||||
|
memcpy(hxres_star, output+OGS_KEY_LEN, OGS_KEY_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.6 : Kseaf derivation function */
|
||||||
|
void ogs_kdf_kseaf(char *serving_network_name, uint8_t *kausf, uint8_t *kseaf)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
|
||||||
|
ogs_assert(serving_network_name);
|
||||||
|
ogs_assert(kausf);
|
||||||
|
ogs_assert(kseaf);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = (uint8_t *)serving_network_name;
|
||||||
|
param[0].len = strlen(serving_network_name);
|
||||||
|
|
||||||
|
ogs_kdf_common(kausf, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_KSEAF_DERIVATION, param, kseaf);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.7 : Kamf derivation function */
|
||||||
|
void ogs_kdf_kamf(char *supi, uint8_t *abba, uint8_t abba_len,
|
||||||
|
uint8_t *kseaf, uint8_t *kamf)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
char *ueid = NULL;
|
||||||
|
|
||||||
|
ogs_assert(supi);
|
||||||
|
ogs_assert(abba);
|
||||||
|
ogs_assert(abba_len);
|
||||||
|
ogs_assert(kseaf);
|
||||||
|
ogs_assert(kamf);
|
||||||
|
|
||||||
|
ueid = ogs_ueid_from_supi(supi);
|
||||||
|
ogs_assert(ueid);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = (uint8_t *)ueid;
|
||||||
|
param[0].len = strlen(ueid);
|
||||||
|
param[1].buf = abba;
|
||||||
|
param[1].len = abba_len;
|
||||||
|
|
||||||
|
ogs_kdf_common(kseaf, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_KAMF_DERIVATION, param, kamf);
|
||||||
|
|
||||||
|
ogs_free(ueid);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.8 : Algorithm key derivation functions */
|
||||||
|
void ogs_kdf_nas_5gs(uint8_t algorithm_type_distinguishers,
|
||||||
|
uint8_t algorithm_identity, uint8_t *kamf, uint8_t *knas)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||||
|
|
||||||
|
ogs_assert(kamf);
|
||||||
|
ogs_assert(knas);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = &algorithm_type_distinguishers;
|
||||||
|
param[0].len = 1;
|
||||||
|
param[1].buf = &algorithm_identity;
|
||||||
|
param[1].len = 1;
|
||||||
|
|
||||||
|
ogs_kdf_common(kamf, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_5GS_ALGORITHM_KEY_DERIVATION, param, output);
|
||||||
|
memcpy(knas, output+16, 16);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.9 KgNB and Kn3iwf derivation function */
|
||||||
|
void ogs_kdf_kgnb_and_kn3iwf(uint8_t *kamf, uint32_t ul_count,
|
||||||
|
uint8_t access_type_distinguisher, uint8_t *kgnb)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
|
||||||
|
ogs_assert(kamf);
|
||||||
|
ogs_assert(kgnb);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
ul_count = htobe32(ul_count);
|
||||||
|
param[0].buf = (uint8_t *)&ul_count;
|
||||||
|
param[0].len = 4;
|
||||||
|
param[0].buf = &access_type_distinguisher;
|
||||||
|
param[0].len = 1;
|
||||||
|
|
||||||
|
ogs_kdf_common(kamf, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_KGNB_KN3IWF_DERIVATION, param, kgnb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.10 NH derivation function */
|
||||||
|
void ogs_kdf_nh_gnb(uint8_t *kamf, uint8_t *sync_input, uint8_t *kgnb)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
|
||||||
|
ogs_assert(kamf);
|
||||||
|
ogs_assert(kgnb);
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = sync_input;
|
||||||
|
param[0].len = OGS_SHA256_DIGEST_SIZE;
|
||||||
|
|
||||||
|
ogs_kdf_common(kamf, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_NH_GNB_DERIVATION, param, kgnb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.401 Annex A.3 KeNB derivation function */
|
||||||
|
void ogs_kdf_kenb(uint8_t *kasme, uint32_t ul_count, uint8_t *kenb)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
ul_count = htobe32(ul_count);
|
||||||
|
param[0].buf = (uint8_t *)&ul_count;
|
||||||
|
param[0].len = 4;
|
||||||
|
|
||||||
|
ogs_kdf_common(kasme, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_KENB_DERIVATION, param, kenb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.401 Annex A.4 NH derivation function */
|
||||||
|
void ogs_kdf_nh_enb(uint8_t *kasme, uint8_t *sync_input, uint8_t *kenb)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = sync_input;
|
||||||
|
param[0].len = OGS_SHA256_DIGEST_SIZE;
|
||||||
|
|
||||||
|
ogs_kdf_common(kasme, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_NH_ENB_DERIVATION, param, kenb);
|
||||||
|
}
|
||||||
|
|
||||||
|
/* TS33.401 Annex A.7 Algorithm key derivation functions */
|
||||||
|
void ogs_kdf_nas_eps(uint8_t algorithm_type_distinguishers,
|
||||||
|
uint8_t algorithm_identity, uint8_t *kasme, uint8_t *knas)
|
||||||
|
{
|
||||||
|
kdf_param_t param;
|
||||||
|
uint8_t output[OGS_SHA256_DIGEST_SIZE];
|
||||||
|
|
||||||
|
memset(param, 0, sizeof(param));
|
||||||
|
param[0].buf = &algorithm_type_distinguishers;
|
||||||
|
param[0].len = 1;
|
||||||
|
param[1].buf = &algorithm_identity;
|
||||||
|
param[1].len = 1;
|
||||||
|
|
||||||
|
ogs_kdf_common(kasme, OGS_SHA256_DIGEST_SIZE,
|
||||||
|
FC_FOR_EPS_ALGORITHM_KEY_DERIVATION, param, output);
|
||||||
|
memcpy(knas, output+16, 16);
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,99 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Open5GS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(OGS_CRYPT_INSIDE) && !defined(OGS_CRYPT_COMPILATION)
|
||||||
|
#error "This header cannot be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OGS_KDF_H
|
||||||
|
#define OGS_KDF_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.2 : Kausf derviation function */
|
||||||
|
void ogs_kdf_kausf(
|
||||||
|
uint8_t *ck, uint8_t *ik,
|
||||||
|
char *serving_network_name, uint8_t *autn,
|
||||||
|
uint8_t *kausf);
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.4 : RES* and XRES* derivation function */
|
||||||
|
void ogs_kdf_xres_star(
|
||||||
|
uint8_t *ck, uint8_t *ik,
|
||||||
|
char *serving_network_name, uint8_t *rand,
|
||||||
|
uint8_t *xres, size_t xres_len,
|
||||||
|
uint8_t *xres_star);
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.5 : HRES* and HXRES* derivation function */
|
||||||
|
void ogs_kdf_hxres_star(uint8_t *rand, uint8_t *xres_star, uint8_t *hxres_star);
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.6 : Kseaf derivation function */
|
||||||
|
void ogs_kdf_kseaf(char *serving_network_name, uint8_t *kausf, uint8_t *kseaf);
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.7 : Kamf derivation function */
|
||||||
|
void ogs_kdf_kamf(char *supi, uint8_t *abba, uint8_t abba_len,
|
||||||
|
uint8_t *kseaf, uint8_t *kamf);
|
||||||
|
|
||||||
|
/* Algorithm Type Distinguishers */
|
||||||
|
#define OGS_KDF_NAS_ENC_ALG 0x01
|
||||||
|
#define OGS_KDF_NAS_INT_ALG 0x02
|
||||||
|
|
||||||
|
/* Algorithm Identity defined in lib/nas/common/types.h
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_NIA0 0
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NIA1 1
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NIA1 2
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NIA3 3
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_NEA0 0
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NEA1 1
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NEA2 2
|
||||||
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NEA3 3
|
||||||
|
*/
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.8 : Algorithm key derivation functions */
|
||||||
|
void ogs_kdf_nas_5gs(uint8_t algorithm_type_distinguishers,
|
||||||
|
uint8_t algorithm_identity, uint8_t *kamf, uint8_t *knas);
|
||||||
|
|
||||||
|
/* Access Type Distinguishers */
|
||||||
|
#define OGS_KDF_ACCESS_TYPE_3GPP 0x01
|
||||||
|
#define OGS_KDF_ACCESS_TYPE_NON_3GPP 0x02
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.9 KgNB and Kn3iwf derivation function */
|
||||||
|
void ogs_kdf_kgnb_and_kn3iwf(uint8_t *kamf, uint32_t ul_count,
|
||||||
|
uint8_t access_type_distinguisher, uint8_t *kgnb);
|
||||||
|
|
||||||
|
/* TS33.501 Annex A.10 NH derivation function */
|
||||||
|
void ogs_kdf_nh_gnb(uint8_t *kamf, uint8_t *sync_input, uint8_t *kgnb);
|
||||||
|
|
||||||
|
/* TS33.401 Annex A.3 KeNB derivation function */
|
||||||
|
void ogs_kdf_kenb(uint8_t *kasme, uint32_t ul_count, uint8_t *kenb);
|
||||||
|
|
||||||
|
/* TS33.401 Annex A.4 NH derivation function */
|
||||||
|
void ogs_kdf_nh_enb(uint8_t *kasme, uint8_t *sync_input, uint8_t *kenb);
|
||||||
|
|
||||||
|
/* TS33.401 Annex A.7 Algorithm key derivation functions */
|
||||||
|
void ogs_kdf_nas_eps(uint8_t algorithm_type_distinguishers,
|
||||||
|
uint8_t algorithm_identity, uint8_t *kasme, uint8_t *knas);
|
||||||
|
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OGS_KDF_H */
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
# Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
|
||||||
# This file is part of Open5GS.
|
# This file is part of Open5GS.
|
||||||
|
|
||||||
|
@ -21,6 +21,7 @@ libdbi_sources = files('''
|
||||||
ogs-mongoc.h
|
ogs-mongoc.h
|
||||||
|
|
||||||
ogs-mongoc.c
|
ogs-mongoc.c
|
||||||
|
subscription.c
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
||||||
libmongoc_dep = dependency('libmongoc-1.0')
|
libmongoc_dep = dependency('libmongoc-1.0')
|
||||||
|
@ -32,10 +33,10 @@ libdbi = library('ogsdbi',
|
||||||
version : libogslib_version,
|
version : libogslib_version,
|
||||||
c_args : '-DOGS_DBI_COMPILATION',
|
c_args : '-DOGS_DBI_COMPILATION',
|
||||||
include_directories : [libdbi_inc, libinc],
|
include_directories : [libdbi_inc, libinc],
|
||||||
dependencies : [libcore_dep, libmongoc_dep],
|
dependencies : [libcrypt_dep, libmongoc_dep],
|
||||||
install : true)
|
install : true)
|
||||||
|
|
||||||
libdbi_dep = declare_dependency(
|
libdbi_dep = declare_dependency(
|
||||||
link_with : libdbi,
|
link_with : libdbi,
|
||||||
include_directories : [libdbi_inc, libinc],
|
include_directories : [libdbi_inc, libinc],
|
||||||
dependencies : [libcore_dep, libmongoc_dep])
|
dependencies : [libcrypt_dep, libmongoc_dep])
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -17,14 +17,16 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef OGS_DB_H
|
#ifndef OGS_DBI_H
|
||||||
#define OGS_DB_H
|
#define OGS_DBI_H
|
||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
|
#include "ogs-crypt.h"
|
||||||
|
|
||||||
#define OGS_DBI_INSIDE
|
#define OGS_DBI_INSIDE
|
||||||
|
|
||||||
#include "dbi/ogs-mongoc.h"
|
#include "dbi/ogs-mongoc.h"
|
||||||
|
#include "dbi/subscription.h"
|
||||||
|
|
||||||
#undef OGS_DBI_INSIDE
|
#undef OGS_DBI_INSIDE
|
||||||
|
|
||||||
|
@ -41,4 +43,4 @@ extern int __ogs_dbi_domain;
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif /* OGS_DB_H */
|
#endif /* OGS_DBI_H */
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -122,3 +122,30 @@ ogs_mongoc_t *ogs_mongoc(void)
|
||||||
{
|
{
|
||||||
return &self;
|
return &self;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
int ogs_dbi_init(const char *db_uri)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
|
||||||
|
ogs_assert(db_uri);
|
||||||
|
|
||||||
|
rv = ogs_mongoc_init(db_uri);
|
||||||
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
|
if (ogs_mongoc()->client && ogs_mongoc()->name) {
|
||||||
|
self.collection.subscriber = mongoc_client_get_collection(
|
||||||
|
ogs_mongoc()->client, ogs_mongoc()->name, "subscribers");
|
||||||
|
ogs_assert(self.collection.subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
return OGS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogs_dbi_final()
|
||||||
|
{
|
||||||
|
if (self.collection.subscriber) {
|
||||||
|
mongoc_collection_destroy(self.collection.subscriber);
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_mongoc_final();
|
||||||
|
}
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -36,12 +36,19 @@ typedef struct ogs_mongoc_s {
|
||||||
void *uri;
|
void *uri;
|
||||||
void *client;
|
void *client;
|
||||||
void *database;
|
void *database;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
void *subscriber;
|
||||||
|
} collection;
|
||||||
} ogs_mongoc_t;
|
} ogs_mongoc_t;
|
||||||
|
|
||||||
int ogs_mongoc_init(const char *db_uri);
|
int ogs_mongoc_init(const char *db_uri);
|
||||||
void ogs_mongoc_final(void);
|
void ogs_mongoc_final(void);
|
||||||
ogs_mongoc_t *ogs_mongoc(void);
|
ogs_mongoc_t *ogs_mongoc(void);
|
||||||
|
|
||||||
|
int ogs_dbi_init(const char *db_uri);
|
||||||
|
void ogs_dbi_final(void);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -0,0 +1,422 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Open5GS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ogs-dbi.h"
|
||||||
|
|
||||||
|
int ogs_dbi_auth_info(const char *id_type, const char *ue_id,
|
||||||
|
ogs_dbi_auth_info_t *auth_info)
|
||||||
|
{
|
||||||
|
int rv = OGS_OK;
|
||||||
|
mongoc_cursor_t *cursor = NULL;
|
||||||
|
bson_t *query = NULL;
|
||||||
|
bson_error_t error;
|
||||||
|
const bson_t *document;
|
||||||
|
bson_iter_t iter;
|
||||||
|
bson_iter_t inner_iter;
|
||||||
|
char buf[OGS_KEY_LEN];
|
||||||
|
char *utf8 = NULL;
|
||||||
|
uint32_t length = 0;
|
||||||
|
|
||||||
|
ogs_assert(id_type);
|
||||||
|
ogs_assert(ue_id);
|
||||||
|
ogs_assert(auth_info);
|
||||||
|
|
||||||
|
query = BCON_NEW(id_type, BCON_UTF8(ue_id));
|
||||||
|
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
|
||||||
|
cursor = mongoc_collection_find_with_opts(
|
||||||
|
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
|
||||||
|
#else
|
||||||
|
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_warn("Cannot find IMSI in DB : %s-%s", id_type, ue_id);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mongoc_cursor_error(cursor, &error)) {
|
||||||
|
ogs_error("Cursor Failure: %s", error.message);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bson_iter_init_find(&iter, document, "security")) {
|
||||||
|
ogs_error("No 'security' field in this document");
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(auth_info, 0, sizeof(ogs_dbi_auth_info_t));
|
||||||
|
bson_iter_recurse(&iter, &inner_iter);
|
||||||
|
while (bson_iter_next(&inner_iter)) {
|
||||||
|
const char *key = bson_iter_key(&inner_iter);
|
||||||
|
|
||||||
|
if (!strcmp(key, "k") && BSON_ITER_HOLDS_UTF8(&inner_iter)) {
|
||||||
|
utf8 = (char *)bson_iter_utf8(&inner_iter, &length);
|
||||||
|
memcpy(auth_info->k, OGS_HEX(utf8, length, buf), OGS_KEY_LEN);
|
||||||
|
} else if (!strcmp(key, "opc") && BSON_ITER_HOLDS_UTF8(&inner_iter)) {
|
||||||
|
utf8 = (char *)bson_iter_utf8(&inner_iter, &length);
|
||||||
|
auth_info->use_opc = 1;
|
||||||
|
memcpy(auth_info->opc, OGS_HEX(utf8, length, buf), OGS_KEY_LEN);
|
||||||
|
} else if (!strcmp(key, "op") && BSON_ITER_HOLDS_UTF8(&inner_iter)) {
|
||||||
|
utf8 = (char *)bson_iter_utf8(&inner_iter, &length);
|
||||||
|
memcpy(auth_info->op, OGS_HEX(utf8, length, buf), OGS_KEY_LEN);
|
||||||
|
} else if (!strcmp(key, "amf") && BSON_ITER_HOLDS_UTF8(&inner_iter)) {
|
||||||
|
utf8 = (char *)bson_iter_utf8(&inner_iter, &length);
|
||||||
|
memcpy(auth_info->amf, OGS_HEX(utf8, length, buf), OGS_AMF_LEN);
|
||||||
|
} else if (!strcmp(key, "rand") && BSON_ITER_HOLDS_UTF8(&inner_iter)) {
|
||||||
|
utf8 = (char *)bson_iter_utf8(&inner_iter, &length);
|
||||||
|
memcpy(auth_info->rand, OGS_HEX(utf8, length, buf), OGS_RAND_LEN);
|
||||||
|
} else if (!strcmp(key, "sqn") && BSON_ITER_HOLDS_INT64(&inner_iter)) {
|
||||||
|
auth_info->sqn = bson_iter_int64(&inner_iter);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (query) bson_destroy(query);
|
||||||
|
if (cursor) mongoc_cursor_destroy(cursor);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ogs_dbi_update_sqn(const char *id_type, const char *ue_id, uint64_t sqn)
|
||||||
|
{
|
||||||
|
int rv = OGS_OK;
|
||||||
|
bson_t *query = NULL;
|
||||||
|
bson_t *update = NULL;
|
||||||
|
bson_error_t error;
|
||||||
|
char printable_rand[OGS_KEYSTRLEN(OGS_RAND_LEN)];
|
||||||
|
|
||||||
|
ogs_assert(id_type);
|
||||||
|
ogs_assert(ue_id);
|
||||||
|
ogs_hex_to_ascii(rand,
|
||||||
|
OGS_RAND_LEN, printable_rand, sizeof(printable_rand));
|
||||||
|
|
||||||
|
query = BCON_NEW(id_type, BCON_UTF8(ue_id));
|
||||||
|
update = BCON_NEW("$set",
|
||||||
|
"{",
|
||||||
|
"security.sqn", BCON_INT64(sqn),
|
||||||
|
"}");
|
||||||
|
|
||||||
|
if (!mongoc_collection_update(ogs_mongoc()->collection.subscriber,
|
||||||
|
MONGOC_UPDATE_NONE, query, update, NULL, &error)) {
|
||||||
|
ogs_error("mongoc_collection_update() failure: %s", error.message);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (query) bson_destroy(query);
|
||||||
|
if (update) bson_destroy(update);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ogs_dbi_increment_sqn(const char *id_type, const char *ue_id)
|
||||||
|
{
|
||||||
|
int rv = OGS_OK;
|
||||||
|
bson_t *query = NULL;
|
||||||
|
bson_t *update = NULL;
|
||||||
|
bson_error_t error;
|
||||||
|
uint64_t max_sqn = OGS_MAX_SQN;
|
||||||
|
|
||||||
|
ogs_assert(id_type);
|
||||||
|
ogs_assert(ue_id);
|
||||||
|
|
||||||
|
query = BCON_NEW(id_type, BCON_UTF8(ue_id));
|
||||||
|
update = BCON_NEW("$inc",
|
||||||
|
"{",
|
||||||
|
"security.sqn", BCON_INT64(32),
|
||||||
|
"}");
|
||||||
|
if (!mongoc_collection_update(ogs_mongoc()->collection.subscriber,
|
||||||
|
MONGOC_UPDATE_NONE, query, update, NULL, &error)) {
|
||||||
|
ogs_error("mongoc_collection_update() failure: %s", error.message);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
bson_destroy(update);
|
||||||
|
|
||||||
|
update = BCON_NEW("$bit",
|
||||||
|
"{",
|
||||||
|
"security.sqn",
|
||||||
|
"{", "and", BCON_INT64(max_sqn), "}",
|
||||||
|
"}");
|
||||||
|
if (!mongoc_collection_update(ogs_mongoc()->collection.subscriber,
|
||||||
|
MONGOC_UPDATE_NONE, query, update, NULL, &error)) {
|
||||||
|
ogs_error("mongoc_collection_update() failure: %s", error.message);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (query) bson_destroy(query);
|
||||||
|
if (update) bson_destroy(update);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
||||||
|
|
||||||
|
int ogs_dbi_subscription_data(const char *id_type, const char *ue_id,
|
||||||
|
ogs_dbi_subscription_data_t *subscription_data)
|
||||||
|
{
|
||||||
|
int rv = OGS_OK;
|
||||||
|
mongoc_cursor_t *cursor = NULL;
|
||||||
|
bson_t *query = NULL;
|
||||||
|
bson_error_t error;
|
||||||
|
const bson_t *document;
|
||||||
|
bson_iter_t iter;
|
||||||
|
bson_iter_t child1_iter, child2_iter, child3_iter, child4_iter;
|
||||||
|
const char *utf8 = NULL;
|
||||||
|
uint32_t length = 0;
|
||||||
|
|
||||||
|
ogs_assert(id_type);
|
||||||
|
ogs_assert(ue_id);
|
||||||
|
ogs_assert(subscription_data);
|
||||||
|
|
||||||
|
query = BCON_NEW(id_type, BCON_UTF8(ue_id));
|
||||||
|
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
|
||||||
|
cursor = mongoc_collection_find_with_opts(
|
||||||
|
ogs_mongoc()->collection.subscriber, query, NULL, NULL);
|
||||||
|
#else
|
||||||
|
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 in DB : %s-%s", id_type, ue_id);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mongoc_cursor_error(cursor, &error)) {
|
||||||
|
ogs_error("Cursor Failure: %s", error.message);
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!bson_iter_init(&iter, document)) {
|
||||||
|
ogs_error("bson_iter_init failed in this document");
|
||||||
|
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
goto out;
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(subscription_data, 0, sizeof(ogs_dbi_subscription_data_t));
|
||||||
|
while (bson_iter_next(&iter)) {
|
||||||
|
const char *key = bson_iter_key(&iter);
|
||||||
|
if (!strcmp(key, "access_restriction_data") &&
|
||||||
|
BSON_ITER_HOLDS_INT32(&iter)) {
|
||||||
|
subscription_data->access_restriction_data =
|
||||||
|
bson_iter_int32(&iter);
|
||||||
|
|
||||||
|
} else if (!strcmp(key, "subscriber_status") &&
|
||||||
|
BSON_ITER_HOLDS_INT32(&iter)) {
|
||||||
|
subscription_data->subscriber_status =
|
||||||
|
bson_iter_int32(&iter);
|
||||||
|
} else if (!strcmp(key, "network_access_mode") &&
|
||||||
|
BSON_ITER_HOLDS_INT32(&iter)) {
|
||||||
|
subscription_data->network_access_mode =
|
||||||
|
bson_iter_int32(&iter);
|
||||||
|
} else if (!strcmp(key, "subscribed_rau_tau_timer") &&
|
||||||
|
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)) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
} else if (!strcmp(key, "pdn") &&
|
||||||
|
BSON_ITER_HOLDS_ARRAY(&iter)) {
|
||||||
|
int pdn_index = 0;
|
||||||
|
|
||||||
|
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_assert(child1_key);
|
||||||
|
pdn_index = atoi(child1_key);
|
||||||
|
ogs_assert(pdn_index < OGS_MAX_NUM_OF_SESS);
|
||||||
|
|
||||||
|
pdn = &subscription_data->pdn[pdn_index];
|
||||||
|
|
||||||
|
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") &&
|
||||||
|
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)) {
|
||||||
|
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, "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.both.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.both.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) {
|
||||||
|
if (pdn->paa.pdn_type ==
|
||||||
|
OGS_GTP_PDN_TYPE_IPV6) {
|
||||||
|
pdn->paa.pdn_type =
|
||||||
|
OGS_GTP_PDN_TYPE_IPV4V6;
|
||||||
|
} else {
|
||||||
|
pdn->paa.pdn_type =
|
||||||
|
OGS_GTP_PDN_TYPE_IPV4;
|
||||||
|
}
|
||||||
|
pdn->paa.both.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) {
|
||||||
|
if (pdn->paa.pdn_type ==
|
||||||
|
OGS_GTP_PDN_TYPE_IPV4) {
|
||||||
|
pdn->paa.pdn_type =
|
||||||
|
OGS_GTP_PDN_TYPE_IPV4V6;
|
||||||
|
} else {
|
||||||
|
pdn->paa.pdn_type =
|
||||||
|
OGS_GTP_PDN_TYPE_IPV6;
|
||||||
|
}
|
||||||
|
memcpy(&(pdn->paa.both.addr6),
|
||||||
|
ipsub.sub, OGS_IPV6_LEN);
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
pdn_index++;
|
||||||
|
}
|
||||||
|
subscription_data->num_of_pdn = pdn_index;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
out:
|
||||||
|
if (query) bson_destroy(query);
|
||||||
|
if (cursor) mongoc_cursor_destroy(cursor);
|
||||||
|
|
||||||
|
return rv;
|
||||||
|
}
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Open5GS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(OGS_DBI_INSIDE) && !defined(OGS_DBI_COMPILATION)
|
||||||
|
#error "This header cannot be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OGS_DBI_SUBSCRIPTION_H
|
||||||
|
#define OGS_DBI_SUBSCRIPTION_H
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#define OGS_DBI_UE_ID_TYPE_IMSI "imsi"
|
||||||
|
|
||||||
|
typedef struct ogs_dbi_subscription_data_s {
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_UTRAN_NOT_ALLOWED (1)
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_GERAN_NOT_ALLOWED (1<<1)
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_GAN_NOT_ALLOWED (1<<2)
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_I_HSPA_EVOLUTION_NOT_ALLOWED (1<<3)
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_WB_E_UTRAN_NOT_ALLOWED (1<<4)
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_HO_TO_NON_3GPP_ACCESS_NOT_ALLOWED (1<<5)
|
||||||
|
#define OGS_DBI_ACCESS_RESTRICTION_NB_IOT_NOT_ALLOWED (1<<6)
|
||||||
|
uint32_t access_restriction_data;
|
||||||
|
#define OGS_DBI_SUBSCRIBER_STATUS_SERVICE_GRANTED 0
|
||||||
|
#define OGS_DBI_SUBSCRIBER_STATUS_OPERATOR_DETERMINED_BARRING 1
|
||||||
|
uint32_t subscriber_status;
|
||||||
|
#define OGS_DBI_NETWORK_ACCESS_MODE_PACKET_AND_CIRCUIT 0
|
||||||
|
#define OGS_DBI_NETWORK_ACCESS_MODE_RESERVED 1
|
||||||
|
#define OGS_DBI_NETWORK_ACCESS_MODE_ONLY_PACKET 2
|
||||||
|
uint32_t network_access_mode;
|
||||||
|
|
||||||
|
ogs_bitrate_t ambr; /* UE-AMBR */
|
||||||
|
|
||||||
|
#define OGS_DBI_RAU_TAU_DEFAULT_TIME (12*60) /* 12 min */
|
||||||
|
uint32_t subscribed_rau_tau_timer; /* unit : seconds */
|
||||||
|
|
||||||
|
ogs_pdn_t pdn[OGS_MAX_NUM_OF_SESS];
|
||||||
|
int num_of_pdn;
|
||||||
|
} ogs_dbi_subscription_data_t;
|
||||||
|
|
||||||
|
typedef struct ogs_dbi_auth_info_s {
|
||||||
|
uint8_t k[OGS_KEY_LEN];
|
||||||
|
uint8_t use_opc;
|
||||||
|
uint8_t opc[OGS_KEY_LEN];
|
||||||
|
uint8_t op[OGS_KEY_LEN];
|
||||||
|
uint8_t amf[OGS_AMF_LEN];
|
||||||
|
uint8_t rand[OGS_RAND_LEN];
|
||||||
|
uint64_t sqn;
|
||||||
|
} ogs_dbi_auth_info_t;
|
||||||
|
|
||||||
|
int ogs_dbi_auth_info(const char *id_type, const char *ue_id,
|
||||||
|
ogs_dbi_auth_info_t *auth_info);
|
||||||
|
int ogs_dbi_update_sqn(const char *id_type, const char *ue_id, uint64_t sqn);
|
||||||
|
int ogs_dbi_increment_sqn(const char *id_type, const char *ue_id);
|
||||||
|
|
||||||
|
int ogs_dbi_subscription_data(const char *id_type, const char *ue_id,
|
||||||
|
ogs_dbi_subscription_data_t *subscription_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OGS_DBI_SUBSCRIPTION_H */
|
|
@ -0,0 +1,111 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Open5GS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include "ogs-nas-5gs.h"
|
||||||
|
|
||||||
|
void ogs_nas_5gs_imsi_to_bcd(
|
||||||
|
ogs_nas_5gs_mobile_identity_t *mobile_identity, char *imsi_bcd)
|
||||||
|
{
|
||||||
|
ogs_nas_5gs_mobile_identity_imsi_t *mobile_identity_imsi = NULL;
|
||||||
|
ogs_plmn_id_t plmn_id;
|
||||||
|
char tmp[OGS_MAX_IMSI_BCD_LEN+1];
|
||||||
|
char *p, *last;
|
||||||
|
|
||||||
|
ogs_assert(mobile_identity);
|
||||||
|
ogs_assert(imsi_bcd);
|
||||||
|
|
||||||
|
p = imsi_bcd;
|
||||||
|
last = imsi_bcd + OGS_MAX_IMSI_BCD_LEN + 1;
|
||||||
|
|
||||||
|
mobile_identity_imsi =
|
||||||
|
(ogs_nas_5gs_mobile_identity_imsi_t *)mobile_identity->buffer;
|
||||||
|
ogs_assert(mobile_identity_imsi);
|
||||||
|
|
||||||
|
ogs_nas_to_plmn_id(&plmn_id, &mobile_identity_imsi->nas_plmn_id);
|
||||||
|
if (ogs_plmn_id_mnc_len(&plmn_id) == 2)
|
||||||
|
p = ogs_slprintf(p, last, "%03d%02d",
|
||||||
|
ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id));
|
||||||
|
else
|
||||||
|
p = ogs_slprintf(p, last, "%03d%03d",
|
||||||
|
ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id));
|
||||||
|
|
||||||
|
ogs_assert(mobile_identity->length > 8);
|
||||||
|
ogs_buffer_to_bcd(mobile_identity_imsi->scheme_output,
|
||||||
|
mobile_identity->length - 8, tmp);
|
||||||
|
p = ogs_slprintf(p, last, "%s", tmp);
|
||||||
|
}
|
||||||
|
|
||||||
|
char *ogs_nas_5gs_ueid_from_mobile_identity(
|
||||||
|
ogs_nas_5gs_mobile_identity_t *mobile_identity)
|
||||||
|
{
|
||||||
|
ogs_nas_5gs_mobile_identity_imsi_t *mobile_identity_imsi = NULL;
|
||||||
|
ogs_plmn_id_t plmn_id;
|
||||||
|
char tmp[OGS_MAX_IMSI_BCD_LEN+1];
|
||||||
|
char routing_indicator[5];
|
||||||
|
char *ueid = NULL;
|
||||||
|
|
||||||
|
ogs_assert(mobile_identity);
|
||||||
|
|
||||||
|
mobile_identity_imsi =
|
||||||
|
(ogs_nas_5gs_mobile_identity_imsi_t *)mobile_identity->buffer;
|
||||||
|
ogs_assert(mobile_identity_imsi);
|
||||||
|
|
||||||
|
ueid = ogs_msprintf("suci-%d-", mobile_identity_imsi->h.supi_format);
|
||||||
|
ogs_assert(ueid);
|
||||||
|
|
||||||
|
ogs_nas_to_plmn_id(&plmn_id, &mobile_identity_imsi->nas_plmn_id);
|
||||||
|
if (ogs_plmn_id_mnc_len(&plmn_id) == 2) {
|
||||||
|
ueid = ogs_mstrcatf(ueid, "%03d-%02d-",
|
||||||
|
ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id));
|
||||||
|
ogs_assert(ueid);
|
||||||
|
} else {
|
||||||
|
ueid = ogs_mstrcatf(ueid, "%03d-%03d-",
|
||||||
|
ogs_plmn_id_mcc(&plmn_id), ogs_plmn_id_mnc(&plmn_id));
|
||||||
|
ogs_assert(ueid);
|
||||||
|
}
|
||||||
|
|
||||||
|
memset(routing_indicator, 0, sizeof(routing_indicator));
|
||||||
|
if (mobile_identity_imsi->routing_indicator1 != 0xf) {
|
||||||
|
routing_indicator[0] =
|
||||||
|
mobile_identity_imsi->routing_indicator1 + '0';
|
||||||
|
if (mobile_identity_imsi->routing_indicator2 != 0xf) {
|
||||||
|
routing_indicator[1] =
|
||||||
|
mobile_identity_imsi->routing_indicator2 + '0';
|
||||||
|
if (mobile_identity_imsi->routing_indicator3 != 0xf) {
|
||||||
|
routing_indicator[2] =
|
||||||
|
mobile_identity_imsi->routing_indicator3 + '0';
|
||||||
|
if (mobile_identity_imsi->routing_indicator4 != 0xf)
|
||||||
|
routing_indicator[3] =
|
||||||
|
mobile_identity_imsi->routing_indicator4 + '0';
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_assert(mobile_identity->length > 8);
|
||||||
|
ogs_buffer_to_bcd(mobile_identity_imsi->scheme_output,
|
||||||
|
mobile_identity->length - 8, tmp);
|
||||||
|
|
||||||
|
ueid = ogs_mstrcatf(ueid, "%s-%d-%d-%s",
|
||||||
|
routing_indicator,
|
||||||
|
mobile_identity_imsi->protection_scheme_id,
|
||||||
|
mobile_identity_imsi->home_network_pki_value,
|
||||||
|
tmp);
|
||||||
|
|
||||||
|
return ueid;
|
||||||
|
}
|
|
@ -0,0 +1,44 @@
|
||||||
|
/*
|
||||||
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
*
|
||||||
|
* This file is part of Open5GS.
|
||||||
|
*
|
||||||
|
* This program is free software: you can redistribute it and/or modify
|
||||||
|
* it under the terms of the GNU Affero General Public License as published by
|
||||||
|
* the Free Software Foundation, either version 3 of the License, or
|
||||||
|
* (at your option) any later version.
|
||||||
|
*
|
||||||
|
* This program is distributed in the hope that it will be useful,
|
||||||
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
|
* GNU General Public License for more details.
|
||||||
|
*
|
||||||
|
* You should have received a copy of the GNU General Public License
|
||||||
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
|
||||||
|
#error "This header cannot be included directly."
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#ifndef OGS_NAS_5GS_CONV_H
|
||||||
|
#define OGS_NAS_5GS_CONV_H
|
||||||
|
|
||||||
|
#include "ogs-nas-common.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
void ogs_nas_5gs_imsi_to_bcd(
|
||||||
|
ogs_nas_5gs_mobile_identity_t *mobile_identity, char *bcd);
|
||||||
|
|
||||||
|
char *ogs_nas_5gs_ueid_from_mobile_identity(
|
||||||
|
ogs_nas_5gs_mobile_identity_t *mobile_identity);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* OGS_NAS_5GS_CONV_H */
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas-message.py script v0.2.0
|
* This file had been created by nas-message.py script v0.2.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2020-05-24 17:29:31.606634 by acetcom
|
* Created on: 2020-06-03 23:05:14.877346 by acetcom
|
||||||
* from 24501-g41.docx
|
* from 24501-g41.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas-message.py script v0.2.0
|
* This file had been created by nas-message.py script v0.2.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2020-05-24 17:29:31.617845 by acetcom
|
* Created on: 2020-06-03 23:05:14.888322 by acetcom
|
||||||
* from 24501-g41.docx
|
* from 24501-g41.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
@ -3177,10 +3177,10 @@ ogs_pkbuf_t *ogs_nas_5gs_plain_encode(ogs_nas_5gs_message_t *message)
|
||||||
message->gsm.h.extended_protocol_discriminator);
|
message->gsm.h.extended_protocol_discriminator);
|
||||||
|
|
||||||
if (message->gmm.h.extended_protocol_discriminator ==
|
if (message->gmm.h.extended_protocol_discriminator ==
|
||||||
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM)
|
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM)
|
||||||
return ogs_nas_5gmm_encode(message);
|
return ogs_nas_5gmm_encode(message);
|
||||||
else if (message->gmm.h.extended_protocol_discriminator ==
|
else if (message->gmm.h.extended_protocol_discriminator ==
|
||||||
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM)
|
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM)
|
||||||
return ogs_nas_5gsm_encode(message);
|
return ogs_nas_5gsm_encode(message);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas-message.py script v0.2.0
|
* This file had been created by nas-message.py script v0.2.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2020-05-24 17:29:31.588956 by acetcom
|
* Created on: 2020-06-03 23:05:14.860106 by acetcom
|
||||||
* from 24501-g41.docx
|
* from 24501-g41.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
@ -630,12 +630,15 @@ int ogs_nas_5gs_encode_authentication_response_parameter(ogs_pkbuf_t *pkbuf, ogs
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_configuration_update_indication(ogs_nas_configuration_update_indication_t *configuration_update_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_configuration_update_indication(ogs_nas_configuration_update_indication_t *configuration_update_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(configuration_update_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_configuration_update_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(configuration_update_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" CONFIGURATION_UPDATE_INDICATION - ");
|
ogs_trace(" CONFIGURATION_UPDATE_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_configuration_update_indication(ogs_pkbuf_t *pkbuf, ogs_nas_configuration_update_indication_t *configuration_update_indication)
|
int ogs_nas_5gs_encode_configuration_update_indication(ogs_pkbuf_t *pkbuf, ogs_nas_configuration_update_indication_t *configuration_update_indication)
|
||||||
|
@ -1113,12 +1116,15 @@ int ogs_nas_5gs_encode_extended_drx_parameters(ogs_pkbuf_t *pkbuf, ogs_nas_exten
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_imeisv_request(ogs_nas_imeisv_request_t *imeisv_request, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_imeisv_request(ogs_nas_imeisv_request_t *imeisv_request, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(imeisv_request, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_imeisv_request_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(imeisv_request, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" IMEISV_REQUEST - ");
|
ogs_trace(" IMEISV_REQUEST - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_imeisv_request(ogs_pkbuf_t *pkbuf, ogs_nas_imeisv_request_t *imeisv_request)
|
int ogs_nas_5gs_encode_imeisv_request(ogs_pkbuf_t *pkbuf, ogs_nas_imeisv_request_t *imeisv_request)
|
||||||
|
@ -1286,12 +1292,15 @@ int ogs_nas_5gs_encode_ladn_information(ogs_pkbuf_t *pkbuf, ogs_nas_ladn_informa
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_mico_indication(ogs_nas_mico_indication_t *mico_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_mico_indication(ogs_nas_mico_indication_t *mico_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(mico_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_mico_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(mico_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" MICO_INDICATION - ");
|
ogs_trace(" MICO_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_mico_indication(ogs_pkbuf_t *pkbuf, ogs_nas_mico_indication_t *mico_indication)
|
int ogs_nas_5gs_encode_mico_indication(ogs_pkbuf_t *pkbuf, ogs_nas_mico_indication_t *mico_indication)
|
||||||
|
@ -1311,12 +1320,15 @@ int ogs_nas_5gs_encode_mico_indication(ogs_pkbuf_t *pkbuf, ogs_nas_mico_indicati
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_ma_pdu_session_information(ogs_nas_ma_pdu_session_information_t *ma_pdu_session_information, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_ma_pdu_session_information(ogs_nas_ma_pdu_session_information_t *ma_pdu_session_information, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(ma_pdu_session_information, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_ma_pdu_session_information_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(ma_pdu_session_information, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" MA_PDU_SESSION_INFORMATION - ");
|
ogs_trace(" MA_PDU_SESSION_INFORMATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_ma_pdu_session_information(ogs_pkbuf_t *pkbuf, ogs_nas_ma_pdu_session_information_t *ma_pdu_session_information)
|
int ogs_nas_5gs_encode_ma_pdu_session_information(ogs_pkbuf_t *pkbuf, ogs_nas_ma_pdu_session_information_t *ma_pdu_session_information)
|
||||||
|
@ -1404,12 +1416,15 @@ int ogs_nas_5gs_encode_mobile_station_classmark_2(ogs_pkbuf_t *pkbuf, ogs_nas_mo
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_key_set_identifier(ogs_nas_key_set_identifier_t *key_set_identifier, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_key_set_identifier(ogs_nas_key_set_identifier_t *key_set_identifier, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(key_set_identifier, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_key_set_identifier_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(key_set_identifier, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" KEY_SET_IDENTIFIER - ");
|
ogs_trace(" KEY_SET_IDENTIFIER - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_key_set_identifier(ogs_pkbuf_t *pkbuf, ogs_nas_key_set_identifier_t *key_set_identifier)
|
int ogs_nas_5gs_encode_key_set_identifier(ogs_pkbuf_t *pkbuf, ogs_nas_key_set_identifier_t *key_set_identifier)
|
||||||
|
@ -1535,12 +1550,15 @@ int ogs_nas_5gs_encode_network_name(ogs_pkbuf_t *pkbuf, ogs_nas_network_name_t *
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_network_slicing_indication(ogs_nas_network_slicing_indication_t *network_slicing_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_network_slicing_indication(ogs_nas_network_slicing_indication_t *network_slicing_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(network_slicing_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_network_slicing_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(network_slicing_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" NETWORK_SLICING_INDICATION - ");
|
ogs_trace(" NETWORK_SLICING_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_network_slicing_indication(ogs_pkbuf_t *pkbuf, ogs_nas_network_slicing_indication_t *network_slicing_indication)
|
int ogs_nas_5gs_encode_network_slicing_indication(ogs_pkbuf_t *pkbuf, ogs_nas_network_slicing_indication_t *network_slicing_indication)
|
||||||
|
@ -1560,12 +1578,15 @@ int ogs_nas_5gs_encode_network_slicing_indication(ogs_pkbuf_t *pkbuf, ogs_nas_ne
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_non_3gpp_nw_provided_policies(ogs_nas_non_3gpp_nw_provided_policies_t *non_3gpp_nw_provided_policies, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_non_3gpp_nw_provided_policies(ogs_nas_non_3gpp_nw_provided_policies_t *non_3gpp_nw_provided_policies, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(non_3gpp_nw_provided_policies, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_non_3gpp_nw_provided_policies_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(non_3gpp_nw_provided_policies, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" NON_3GPP_NW_PROVIDED_POLICIES - ");
|
ogs_trace(" NON_3GPP_NW_PROVIDED_POLICIES - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_non_3gpp_nw_provided_policies(ogs_pkbuf_t *pkbuf, ogs_nas_non_3gpp_nw_provided_policies_t *non_3gpp_nw_provided_policies)
|
int ogs_nas_5gs_encode_non_3gpp_nw_provided_policies(ogs_pkbuf_t *pkbuf, ogs_nas_non_3gpp_nw_provided_policies_t *non_3gpp_nw_provided_policies)
|
||||||
|
@ -1619,12 +1640,15 @@ int ogs_nas_5gs_encode_nssai(ogs_pkbuf_t *pkbuf, ogs_nas_nssai_t *nssai)
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_nssai_inclusion_mode(ogs_nas_nssai_inclusion_mode_t *nssai_inclusion_mode, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_nssai_inclusion_mode(ogs_nas_nssai_inclusion_mode_t *nssai_inclusion_mode, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(nssai_inclusion_mode, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_nssai_inclusion_mode_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(nssai_inclusion_mode, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" NSSAI_INCLUSION_MODE - ");
|
ogs_trace(" NSSAI_INCLUSION_MODE - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_nssai_inclusion_mode(ogs_pkbuf_t *pkbuf, ogs_nas_nssai_inclusion_mode_t *nssai_inclusion_mode)
|
int ogs_nas_5gs_encode_nssai_inclusion_mode(ogs_pkbuf_t *pkbuf, ogs_nas_nssai_inclusion_mode_t *nssai_inclusion_mode)
|
||||||
|
@ -1731,57 +1755,54 @@ int ogs_nas_5gs_decode_5gs_mobile_identity(ogs_nas_5gs_mobile_identity_t *mobile
|
||||||
uint16_t size = 0;
|
uint16_t size = 0;
|
||||||
ogs_nas_5gs_mobile_identity_t *source = (ogs_nas_5gs_mobile_identity_t *)pkbuf->data;
|
ogs_nas_5gs_mobile_identity_t *source = (ogs_nas_5gs_mobile_identity_t *)pkbuf->data;
|
||||||
|
|
||||||
mobile_identity->length = source->length;
|
mobile_identity->length = be16toh(source->length);
|
||||||
size = mobile_identity->length + sizeof(mobile_identity->length);
|
size = mobile_identity->length + sizeof(mobile_identity->length);
|
||||||
|
|
||||||
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
memcpy(mobile_identity, pkbuf->data - size, size);
|
mobile_identity->buffer = pkbuf->data - size + sizeof(mobile_identity->length);
|
||||||
|
|
||||||
if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {
|
|
||||||
mobile_identity->guti.m_tmsi = be32toh(mobile_identity->guti.m_tmsi);
|
|
||||||
} else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {
|
|
||||||
mobile_identity->s_tmsi.m_tmsi = be32toh(mobile_identity->s_tmsi.m_tmsi);
|
|
||||||
}
|
|
||||||
|
|
||||||
ogs_trace(" 5GS_MOBILE_IDENTITY - ");
|
ogs_trace(" 5GS_MOBILE_IDENTITY - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
ogs_log_hexdump(OGS_LOG_TRACE, (void*)mobile_identity->buffer, mobile_identity->length);
|
||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_5gs_mobile_identity(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_mobile_identity_t *mobile_identity)
|
int ogs_nas_5gs_encode_5gs_mobile_identity(ogs_pkbuf_t *pkbuf, ogs_nas_5gs_mobile_identity_t *mobile_identity)
|
||||||
{
|
{
|
||||||
uint16_t size = mobile_identity->length + sizeof(mobile_identity->length);
|
uint16_t size = 0;
|
||||||
ogs_nas_5gs_mobile_identity_t target;
|
uint16_t target;
|
||||||
|
|
||||||
memcpy(&target, mobile_identity, sizeof(ogs_nas_5gs_mobile_identity_t));
|
ogs_assert(mobile_identity);
|
||||||
if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {
|
ogs_assert(mobile_identity->buffer);
|
||||||
target.guti.m_tmsi = htobe32(mobile_identity->guti.m_tmsi);
|
|
||||||
target.guti._0xf = 0xf;
|
|
||||||
} else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {
|
|
||||||
target.s_tmsi.m_tmsi = htobe32(mobile_identity->s_tmsi.m_tmsi);
|
|
||||||
target.s_tmsi._0xf = 0xf;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
size = sizeof(mobile_identity->length);
|
||||||
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
target = htobe16(mobile_identity->length);
|
||||||
memcpy(pkbuf->data - size, &target, size);
|
memcpy(pkbuf->data - size, &target, size);
|
||||||
|
|
||||||
|
size = mobile_identity->length;
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(pkbuf->data - size, mobile_identity->buffer, size);
|
||||||
|
|
||||||
ogs_trace(" 5GS_MOBILE_IDENTITY - ");
|
ogs_trace(" 5GS_MOBILE_IDENTITY - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return size;
|
return mobile_identity->length + sizeof(mobile_identity->length);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* 9.11.3.40 Payload container type
|
/* 9.11.3.40 Payload container type
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_payload_container_type(ogs_nas_payload_container_type_t *payload_container_type, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_payload_container_type(ogs_nas_payload_container_type_t *payload_container_type, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(payload_container_type, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_payload_container_type_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(payload_container_type, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" PAYLOAD_CONTAINER_TYPE - ");
|
ogs_trace(" PAYLOAD_CONTAINER_TYPE - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_payload_container_type(ogs_pkbuf_t *pkbuf, ogs_nas_payload_container_type_t *payload_container_type)
|
int ogs_nas_5gs_encode_payload_container_type(ogs_pkbuf_t *pkbuf, ogs_nas_payload_container_type_t *payload_container_type)
|
||||||
|
@ -2009,12 +2030,15 @@ int ogs_nas_5gs_encode_rejected_nssai(ogs_pkbuf_t *pkbuf, ogs_nas_rejected_nssai
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_release_assistance_indication(ogs_nas_release_assistance_indication_t *release_assistance_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_release_assistance_indication(ogs_nas_release_assistance_indication_t *release_assistance_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(release_assistance_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_release_assistance_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(release_assistance_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" RELEASE_ASSISTANCE_INDICATION - ");
|
ogs_trace(" RELEASE_ASSISTANCE_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_release_assistance_indication(ogs_pkbuf_t *pkbuf, ogs_nas_release_assistance_indication_t *release_assistance_indication)
|
int ogs_nas_5gs_encode_release_assistance_indication(ogs_pkbuf_t *pkbuf, ogs_nas_release_assistance_indication_t *release_assistance_indication)
|
||||||
|
@ -2034,12 +2058,15 @@ int ogs_nas_5gs_encode_release_assistance_indication(ogs_pkbuf_t *pkbuf, ogs_nas
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_request_type(ogs_nas_request_type_t *request_type, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_request_type(ogs_nas_request_type_t *request_type, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(request_type, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_request_type_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(request_type, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" REQUEST_TYPE - ");
|
ogs_trace(" REQUEST_TYPE - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_request_type(ogs_pkbuf_t *pkbuf, ogs_nas_request_type_t *request_type)
|
int ogs_nas_5gs_encode_request_type(ogs_pkbuf_t *pkbuf, ogs_nas_request_type_t *request_type)
|
||||||
|
@ -2195,12 +2222,15 @@ int ogs_nas_5gs_encode_5gs_network_feature_support(ogs_pkbuf_t *pkbuf, ogs_nas_5
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_sms_indication(ogs_nas_sms_indication_t *sms_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_sms_indication(ogs_nas_sms_indication_t *sms_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(sms_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_sms_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(sms_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" SMS_INDICATION - ");
|
ogs_trace(" SMS_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_sms_indication(ogs_pkbuf_t *pkbuf, ogs_nas_sms_indication_t *sms_indication)
|
int ogs_nas_5gs_encode_sms_indication(ogs_pkbuf_t *pkbuf, ogs_nas_sms_indication_t *sms_indication)
|
||||||
|
@ -2560,12 +2590,15 @@ int ogs_nas_5gs_encode_ue_radio_capability_id(ogs_pkbuf_t *pkbuf, ogs_nas_ue_rad
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_ue_radio_capability_id_deletion_indication(ogs_nas_ue_radio_capability_id_deletion_indication_t *ue_radio_capability_id_deletion_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_ue_radio_capability_id_deletion_indication(ogs_nas_ue_radio_capability_id_deletion_indication_t *ue_radio_capability_id_deletion_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(ue_radio_capability_id_deletion_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_ue_radio_capability_id_deletion_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(ue_radio_capability_id_deletion_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" UE_RADIO_CAPABILITY_ID_DELETION_INDICATION - ");
|
ogs_trace(" UE_RADIO_CAPABILITY_ID_DELETION_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_ue_radio_capability_id_deletion_indication(ogs_pkbuf_t *pkbuf, ogs_nas_ue_radio_capability_id_deletion_indication_t *ue_radio_capability_id_deletion_indication)
|
int ogs_nas_5gs_encode_ue_radio_capability_id_deletion_indication(ogs_pkbuf_t *pkbuf, ogs_nas_ue_radio_capability_id_deletion_indication_t *ue_radio_capability_id_deletion_indication)
|
||||||
|
@ -2683,12 +2716,15 @@ int ogs_nas_5gs_encode_wus_assistance_information(ogs_pkbuf_t *pkbuf, ogs_nas_wu
|
||||||
* O T 1 */
|
* O T 1 */
|
||||||
int ogs_nas_5gs_decode_n5gc_indication(ogs_nas_n5gc_indication_t *n5gc_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_n5gc_indication(ogs_nas_n5gc_indication_t *n5gc_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(n5gc_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_n5gc_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(n5gc_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" N5GC_INDICATION - ");
|
ogs_trace(" N5GC_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_n5gc_indication(ogs_pkbuf_t *pkbuf, ogs_nas_n5gc_indication_t *n5gc_indication)
|
int ogs_nas_5gs_encode_n5gc_indication(ogs_pkbuf_t *pkbuf, ogs_nas_n5gc_indication_t *n5gc_indication)
|
||||||
|
@ -2878,12 +2914,15 @@ int ogs_nas_5gs_encode_pdu_address(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_address_t *pd
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_pdu_session_type(ogs_nas_pdu_session_type_t *pdu_session_type, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_pdu_session_type(ogs_nas_pdu_session_type_t *pdu_session_type, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(pdu_session_type, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_pdu_session_type_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(pdu_session_type, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" PDU_SESSION_TYPE - ");
|
ogs_trace(" PDU_SESSION_TYPE - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_pdu_session_type(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_type_t *pdu_session_type)
|
int ogs_nas_5gs_encode_pdu_session_type(ogs_pkbuf_t *pkbuf, ogs_nas_pdu_session_type_t *pdu_session_type)
|
||||||
|
@ -3055,12 +3094,15 @@ int ogs_nas_5gs_encode_sm_pdu_dn_request_container(ogs_pkbuf_t *pkbuf, ogs_nas_s
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_ssc_mode(ogs_nas_ssc_mode_t *ssc_mode, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_ssc_mode(ogs_nas_ssc_mode_t *ssc_mode, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(ssc_mode, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_ssc_mode_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(ssc_mode, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" SSC_MODE - ");
|
ogs_trace(" SSC_MODE - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_ssc_mode(ogs_pkbuf_t *pkbuf, ogs_nas_ssc_mode_t *ssc_mode)
|
int ogs_nas_5gs_encode_ssc_mode(ogs_pkbuf_t *pkbuf, ogs_nas_ssc_mode_t *ssc_mode)
|
||||||
|
@ -3288,12 +3330,15 @@ int ogs_nas_5gs_encode_atsss_container(ogs_pkbuf_t *pkbuf, ogs_nas_atsss_contain
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_control_plane_only_indication(ogs_nas_control_plane_only_indication_t *control_plane_only_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_control_plane_only_indication(ogs_nas_control_plane_only_indication_t *control_plane_only_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(control_plane_only_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_control_plane_only_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(control_plane_only_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" CONTROL_PLANE_ONLY_INDICATION - ");
|
ogs_trace(" CONTROL_PLANE_ONLY_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_control_plane_only_indication(ogs_pkbuf_t *pkbuf, ogs_nas_control_plane_only_indication_t *control_plane_only_indication)
|
int ogs_nas_5gs_encode_control_plane_only_indication(ogs_pkbuf_t *pkbuf, ogs_nas_control_plane_only_indication_t *control_plane_only_indication)
|
||||||
|
@ -3461,12 +3506,15 @@ int ogs_nas_5gs_encode_port_management_information_container(ogs_pkbuf_t *pkbuf,
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_always_on_pdu_session_indication(ogs_nas_always_on_pdu_session_indication_t *always_on_pdu_session_indication, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_always_on_pdu_session_indication(ogs_nas_always_on_pdu_session_indication_t *always_on_pdu_session_indication, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(always_on_pdu_session_indication, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_always_on_pdu_session_indication_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(always_on_pdu_session_indication, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" ALWAYS_ON_PDU_SESSION_INDICATION - ");
|
ogs_trace(" ALWAYS_ON_PDU_SESSION_INDICATION - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_always_on_pdu_session_indication(ogs_pkbuf_t *pkbuf, ogs_nas_always_on_pdu_session_indication_t *always_on_pdu_session_indication)
|
int ogs_nas_5gs_encode_always_on_pdu_session_indication(ogs_pkbuf_t *pkbuf, ogs_nas_always_on_pdu_session_indication_t *always_on_pdu_session_indication)
|
||||||
|
@ -3486,12 +3534,15 @@ int ogs_nas_5gs_encode_always_on_pdu_session_indication(ogs_pkbuf_t *pkbuf, ogs_
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_always_on_pdu_session_requested(ogs_nas_always_on_pdu_session_requested_t *always_on_pdu_session_requested, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_always_on_pdu_session_requested(ogs_nas_always_on_pdu_session_requested_t *always_on_pdu_session_requested, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(always_on_pdu_session_requested, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_always_on_pdu_session_requested_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(always_on_pdu_session_requested, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" ALWAYS_ON_PDU_SESSION_REQUESTED - ");
|
ogs_trace(" ALWAYS_ON_PDU_SESSION_REQUESTED - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_always_on_pdu_session_requested(ogs_pkbuf_t *pkbuf, ogs_nas_always_on_pdu_session_requested_t *always_on_pdu_session_requested)
|
int ogs_nas_5gs_encode_always_on_pdu_session_requested(ogs_pkbuf_t *pkbuf, ogs_nas_always_on_pdu_session_requested_t *always_on_pdu_session_requested)
|
||||||
|
@ -3511,12 +3562,15 @@ int ogs_nas_5gs_encode_always_on_pdu_session_requested(ogs_pkbuf_t *pkbuf, ogs_n
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
int ogs_nas_5gs_decode_allowed_ssc_mode(ogs_nas_allowed_ssc_mode_t *allowed_ssc_mode, ogs_pkbuf_t *pkbuf)
|
int ogs_nas_5gs_decode_allowed_ssc_mode(ogs_nas_allowed_ssc_mode_t *allowed_ssc_mode, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
memcpy(allowed_ssc_mode, pkbuf->data - 1, 1);
|
uint16_t size = sizeof(ogs_nas_allowed_ssc_mode_t);
|
||||||
|
|
||||||
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
|
memcpy(allowed_ssc_mode, pkbuf->data - size, size);
|
||||||
|
|
||||||
ogs_trace(" ALLOWED_SSC_MODE - ");
|
ogs_trace(" ALLOWED_SSC_MODE - ");
|
||||||
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);
|
ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);
|
||||||
|
|
||||||
return 0;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
int ogs_nas_5gs_encode_allowed_ssc_mode(ogs_pkbuf_t *pkbuf, ogs_nas_allowed_ssc_mode_t *allowed_ssc_mode)
|
int ogs_nas_5gs_encode_allowed_ssc_mode(ogs_pkbuf_t *pkbuf, ogs_nas_allowed_ssc_mode_t *allowed_ssc_mode)
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas-message.py script v0.2.0
|
* This file had been created by nas-message.py script v0.2.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2020-05-24 17:29:31.586197 by acetcom
|
* Created on: 2020-06-03 23:05:14.857252 by acetcom
|
||||||
* from 24501-g41.docx
|
* from 24501-g41.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
# Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
|
||||||
# This file is part of Open5GS.
|
# This file is part of Open5GS.
|
||||||
|
|
||||||
|
@ -17,6 +17,7 @@
|
||||||
|
|
||||||
libnas_5gs_sources = files('''
|
libnas_5gs_sources = files('''
|
||||||
types.c
|
types.c
|
||||||
|
conv.c
|
||||||
ies.c
|
ies.c
|
||||||
decoder.c
|
decoder.c
|
||||||
encoder.c
|
encoder.c
|
||||||
|
|
|
@ -28,7 +28,7 @@
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas-message.py script v0.2.0
|
* This file had been created by nas-message.py script v0.2.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2020-05-24 17:29:31.598549 by acetcom
|
* Created on: 2020-06-03 23:05:14.869400 by acetcom
|
||||||
* from 24501-g41.docx
|
* from 24501-g41.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
|
@ -43,8 +43,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM 0x2e
|
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM 0x2e
|
||||||
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM 0x7e
|
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM 0x7e
|
||||||
|
|
||||||
#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0
|
#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -25,6 +25,7 @@
|
||||||
#define OGS_NAS_INSIDE
|
#define OGS_NAS_INSIDE
|
||||||
|
|
||||||
#include "nas/5gs/types.h"
|
#include "nas/5gs/types.h"
|
||||||
|
#include "nas/5gs/conv.h"
|
||||||
#include "nas/5gs/ies.h"
|
#include "nas/5gs/ies.h"
|
||||||
#include "nas/5gs/message.h"
|
#include "nas/5gs/message.h"
|
||||||
|
|
||||||
|
|
|
@ -385,10 +385,14 @@ for (k, v) in sorted_type_list:
|
||||||
if (type_list[k]["format"] == "TV" or type_list[k]["format"] == "T") and type_list[k]["length"] == "1":
|
if (type_list[k]["format"] == "TV" or type_list[k]["format"] == "T") and type_list[k]["length"] == "1":
|
||||||
f.write("int ogs_nas_5gs_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
|
f.write("int ogs_nas_5gs_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
|
||||||
f.write("{\n")
|
f.write("{\n")
|
||||||
f.write(" memcpy(%s, pkbuf->data - 1, 1);\n\n" % get_value(k))
|
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
|
||||||
|
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
|
||||||
|
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
|
||||||
|
if "decode" in type_list[k]:
|
||||||
|
f.write("%s" % type_list[k]["decode"])
|
||||||
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
|
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
|
||||||
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);\n\n");
|
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
|
||||||
f.write(" return 0;\n")
|
f.write(" return size;\n")
|
||||||
f.write("}\n\n")
|
f.write("}\n\n")
|
||||||
f.write("int ogs_nas_5gs_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
|
f.write("int ogs_nas_5gs_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
|
||||||
f.write("{\n")
|
f.write("{\n")
|
||||||
|
@ -430,7 +434,7 @@ for (k, v) in sorted_type_list:
|
||||||
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
|
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
|
||||||
f.write(" return size;\n")
|
f.write(" return size;\n")
|
||||||
f.write("}\n\n")
|
f.write("}\n\n")
|
||||||
elif (type_list[k]["format"] == "LV-E" or type_list[k]["format"] == "TLV-E") and type_list[k]["value"] != "5GS mobile identity":
|
elif type_list[k]["format"] == "LV-E" or type_list[k]["format"] == "TLV-E":
|
||||||
f.write("int ogs_nas_5gs_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
|
f.write("int ogs_nas_5gs_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
|
||||||
f.write("{\n")
|
f.write("{\n")
|
||||||
f.write(" uint16_t size = 0;\n")
|
f.write(" uint16_t size = 0;\n")
|
||||||
|
@ -503,8 +507,8 @@ f.write("""#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM 0x2e
|
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM 0x2e
|
||||||
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM 0x7e
|
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM 0x7e
|
||||||
|
|
||||||
#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0
|
#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0
|
||||||
|
|
||||||
|
@ -939,10 +943,10 @@ ogs_pkbuf_t *ogs_nas_5gs_plain_encode(ogs_nas_5gs_message_t *message)
|
||||||
message->gsm.h.extended_protocol_discriminator);
|
message->gsm.h.extended_protocol_discriminator);
|
||||||
|
|
||||||
if (message->gmm.h.extended_protocol_discriminator ==
|
if (message->gmm.h.extended_protocol_discriminator ==
|
||||||
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM)
|
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GMM)
|
||||||
return ogs_nas_5gmm_encode(message);
|
return ogs_nas_5gmm_encode(message);
|
||||||
else if (message->gmm.h.extended_protocol_discriminator ==
|
else if (message->gmm.h.extended_protocol_discriminator ==
|
||||||
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM)
|
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_5GSM)
|
||||||
return ogs_nas_5gsm_encode(message);
|
return ogs_nas_5gsm_encode(message);
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
|
|
|
@ -21,21 +21,6 @@ type_list["5GS tracking area identity"]["decode"] = \
|
||||||
type_list["5GS tracking area identity"]["encode"] = \
|
type_list["5GS tracking area identity"]["encode"] = \
|
||||||
" target.tac = ogs_htobe24(tracking_area_identity->tac);\n\n"
|
" target.tac = ogs_htobe24(tracking_area_identity->tac);\n\n"
|
||||||
|
|
||||||
type_list["5GS mobile identity"]["decode"] = \
|
|
||||||
" if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {\n" \
|
|
||||||
" mobile_identity->guti.m_tmsi = be32toh(mobile_identity->guti.m_tmsi);\n" \
|
|
||||||
" } else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {\n" \
|
|
||||||
" mobile_identity->s_tmsi.m_tmsi = be32toh(mobile_identity->s_tmsi.m_tmsi);\n" \
|
|
||||||
" }\n\n"
|
|
||||||
type_list["5GS mobile identity"]["encode"] = \
|
|
||||||
" if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {\n" \
|
|
||||||
" target.guti.m_tmsi = htobe32(mobile_identity->guti.m_tmsi);\n" \
|
|
||||||
" target.guti._0xf = 0xf;\n" \
|
|
||||||
" } else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {\n" \
|
|
||||||
" target.s_tmsi.m_tmsi = htobe32(mobile_identity->s_tmsi.m_tmsi);\n" \
|
|
||||||
" target.s_tmsi._0xf = 0xf;\n" \
|
|
||||||
" }\n\n"
|
|
||||||
|
|
||||||
type_list["Header compression configuration"]["decode"] = \
|
type_list["Header compression configuration"]["decode"] = \
|
||||||
" header_compression_configuration->max_cid = be16toh(header_compression_configuration->max_cid);\n\n"
|
" header_compression_configuration->max_cid = be16toh(header_compression_configuration->max_cid);\n\n"
|
||||||
type_list["Header compression configuration"]["encode"] = \
|
type_list["Header compression configuration"]["encode"] = \
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -67,49 +67,49 @@ typedef struct ogs_nas_s_nssai_s {
|
||||||
typedef struct ogs_nas_5gmm_capability_s {
|
typedef struct ogs_nas_5gmm_capability_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED4(uint8_t spare:5;,
|
ED4(uint8_t spare:5;,
|
||||||
uint8_t lpp:1;,
|
uint8_t lte_positioning_protocol_capability:1;,
|
||||||
uint8_t ho:1;,
|
uint8_t ho_attach:1;,
|
||||||
uint8_t s1:1;)
|
uint8_t s1_mode:1;)
|
||||||
} __attribute__ ((packed)) ogs_nas_5gmm_capability_t;
|
} __attribute__ ((packed)) ogs_nas_5gmm_capability_t;
|
||||||
|
|
||||||
/* 9.11.3.2 5GMM cause
|
/* 9.11.3.2 5GMM cause
|
||||||
* M V 1 */
|
* M V 1 */
|
||||||
#define OGS_NAS_GMM_ILLEGAL_UE 3
|
#define OGS_5GMM_CAUSE_ILLEGAL_UE 3
|
||||||
#define OGS_NAS_GMM_PEI_NOT_ACCEPTED 5
|
#define OGS_5GMM_CAUSE_PEI_NOT_ACCEPTED 5
|
||||||
#define OGS_NAS_GMM_ILLEGAL_ME 6
|
#define OGS_5GMM_CAUSE_ILLEGAL_ME 6
|
||||||
#define OGS_NAS_GMM_5GS_SERVICES_NOT_ALLOWED 7
|
#define OGS_5GMM_CAUSE_5GS_SERVICES_NOT_ALLOWED 7
|
||||||
#define OGS_NAS_GMM_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 9
|
#define OGS_5GMM_CAUSE_UE_IDENTITY_CANNOT_BE_DERIVED_BY_THE_NETWORK 9
|
||||||
#define OGS_NAS_GMM_IMPLICITLY_DE_REGISTERED 10
|
#define OGS_5GMM_CAUSE_IMPLICITLY_DE_REGISTERED 10
|
||||||
#define OGS_NAS_GMM_PLMN_NOT_ALLOWED 11
|
#define OGS_5GMM_CAUSE_PLMN_NOT_ALLOWED 11
|
||||||
#define OGS_NAS_GMM_TRACKING_AREA_NOT_ALLOWED 12
|
#define OGS_5GMM_CAUSE_TRACKING_AREA_NOT_ALLOWED 12
|
||||||
#define OGS_NAS_GMM_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 13
|
#define OGS_5GMM_CAUSE_ROAMING_NOT_ALLOWED_IN_THIS_TRACKING_AREA 13
|
||||||
#define OGS_NAS_GMM_NO_SUITABLE_CELLS_IN_TRACKING_AREA 15
|
#define OGS_5GMM_CAUSE_NO_SUITABLE_CELLS_IN_TRACKING_AREA 15
|
||||||
#define OGS_NAS_GMM_MAC_FAILURE 20
|
#define OGS_5GMM_CAUSE_MAC_FAILURE 20
|
||||||
#define OGS_NAS_GMM_SYNCH_FAILURE 21
|
#define OGS_5GMM_CAUSE_SYNCH_FAILURE 21
|
||||||
#define OGS_NAS_GMM_CONGESTION 22
|
#define OGS_5GMM_CAUSE_CONGESTION 22
|
||||||
#define OGS_NAS_GMM_UE_SECURITY_CAPABILITIES_MISMATCH 23
|
#define OGS_5GMM_CAUSE_UE_SECURITY_CAPABILITIES_MISMATCH 23
|
||||||
#define OGS_NAS_GMM_SECURITY_MODE_REJECTED_UNSPECIFIED 24
|
#define OGS_5GMM_CAUSE_SECURITY_MODE_REJECTED_UNSPECIFIED 24
|
||||||
#define OGS_NAS_GMM_NON_5G_AUTHENTICATION_UNACCEPTABLE 26
|
#define OGS_5GMM_CAUSE_NON_5G_AUTHENTICATION_UNACCEPTABLE 26
|
||||||
#define OGS_NAS_GMM_N1_MODE_NOT_ALLOWED 27
|
#define OGS_5GMM_CAUSE_N1_MODE_NOT_ALLOWED 27
|
||||||
#define OGS_NAS_GMM_RESTRICTED_SERVICE_AREA 28
|
#define OGS_5GMM_CAUSE_RESTRICTED_SERVICE_AREA 28
|
||||||
#define OGS_NAS_GMM_LADN_NOT_AVAILABLE 43
|
#define OGS_5GMM_CAUSE_LADN_NOT_AVAILABLE 43
|
||||||
#define OGS_NAS_GMM_MAXIMUM_NUMBER_OF_PDU_SESSIONS_REACHED 65
|
#define OGS_5GMM_CAUSE_MAXIMUM_NUMBER_OF_PDU_SESSIONS_REACHED 65
|
||||||
#define OGS_NAS_GMM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67
|
#define OGS_5GMM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67
|
||||||
#define OGS_NAS_GMM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69
|
#define OGS_5GMM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69
|
||||||
#define OGS_NAS_GMM_NGKSI_ALREADY_IN_USE 71
|
#define OGS_5GMM_CAUSE_NGKSI_ALREADY_IN_USE 71
|
||||||
#define OGS_NAS_GMM_NON_3GPP_ACCESS_TO_5GCN_NOT_ALLOWED 72
|
#define OGS_5GMM_CAUSE_NON_3GPP_ACCESS_TO_5GCN_NOT_ALLOWED 72
|
||||||
#define OGS_NAS_GMM_SERVING_NETWORK_NOT_AUTHORIZED 73
|
#define OGS_5GMM_CAUSE_SERVING_NETWORK_NOT_AUTHORIZED 73
|
||||||
#define OGS_NAS_GMM_PAYLOAD_WAS_NOT_FORWARDED 90
|
#define OGS_5GMM_CAUSE_PAYLOAD_WAS_NOT_FORWARDED 90
|
||||||
#define OGS_NAS_GMM_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE 91
|
#define OGS_5GMM_CAUSE_DNN_NOT_SUPPORTED_OR_NOT_SUBSCRIBED_IN_THE_SLICE 91
|
||||||
#define OGS_NAS_GMM_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION 92
|
#define OGS_5GMM_CAUSE_INSUFFICIENT_USER_PLANE_RESOURCES_FOR_THE_PDU_SESSION 92
|
||||||
#define OGS_NAS_GMM_SEMANTICALLY_INCORRECT_MESSAGE 95
|
#define OGS_5GMM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95
|
||||||
#define OGS_NAS_GMM_INVALID_MANDATORY_INFORMATION 96
|
#define OGS_5GMM_CAUSE_INVALID_MANDATORY_INFORMATION 96
|
||||||
#define OGS_NAS_GMM_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97
|
#define OGS_5GMM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97
|
||||||
#define OGS_NAS_GMM_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98
|
#define OGS_5GMM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98
|
||||||
#define OGS_NAS_GMM_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99
|
#define OGS_5GMM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT_IMPLEMENTED 99
|
||||||
#define OGS_NAS_GMM_CONDITIONAL_IE_ERROR 100
|
#define OGS_5GMM_CAUSE_CONDITIONAL_IE_ERROR 100
|
||||||
#define OGS_NAS_GMM_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101
|
#define OGS_5GMM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101
|
||||||
#define OGS_NAS_GMM_PROTOCOL_ERROR_UNSPECIFIED 111
|
#define OGS_5GMM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111
|
||||||
typedef uint8_t ogs_nas_5gmm_cause_t;
|
typedef uint8_t ogs_nas_5gmm_cause_t;
|
||||||
|
|
||||||
/* 9.11.3.2A 5GS DRX parameters
|
/* 9.11.3.2A 5GS DRX parameters
|
||||||
|
@ -140,36 +140,44 @@ ED3(uint8_t type:4;,
|
||||||
|
|
||||||
/* 9.11.3.4 5GS mobile identity
|
/* 9.11.3.4 5GS mobile identity
|
||||||
* M LV-E 6-n */
|
* M LV-E 6-n */
|
||||||
typedef struct ogs_nas_5gs_mobile_identity_guti_s {
|
#define OGS_NAS_MAX_SCHEME_OUTPUT_LEN 64
|
||||||
ED3(uint8_t _0xf:4;,
|
typedef struct ogs_nas_5gs_mobile_identity_header_s {
|
||||||
|
ED4(uint8_t spare1:1;,
|
||||||
|
#define OGS_NAS_5GS_SUPI_FORMAT_IMSI 0
|
||||||
|
#define OGS_NAS_5GS_SUPI_FORMAT_NETWORK_SPECIFIC_IDENTIFIER 1
|
||||||
|
uint8_t supi_format:3;,
|
||||||
uint8_t spare:1;,
|
uint8_t spare:1;,
|
||||||
uint8_t type:3;)
|
uint8_t type:3;)
|
||||||
|
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_header_t;
|
||||||
|
typedef struct ogs_nas_5gs_mobile_identity_imsi_s {
|
||||||
|
ogs_nas_5gs_mobile_identity_header_t h;
|
||||||
ogs_nas_plmn_id_t nas_plmn_id;
|
ogs_nas_plmn_id_t nas_plmn_id;
|
||||||
uint8_t amf_region_id;
|
ED2(uint8_t routing_indicator2:4;,
|
||||||
uint8_t amf_set_id1;
|
uint8_t routing_indicator1:4;)
|
||||||
ED2(uint8_t amf_set_id2:2;,
|
ED2(uint8_t routing_indicator4:4;,
|
||||||
uint8_t amf_pointer:6;)
|
uint8_t routing_indicator3:4;)
|
||||||
|
ED2(uint8_t spare3:4;,
|
||||||
|
#define OGS_NAS_5GS_NULL_SCHEME 0
|
||||||
|
#define OGS_NAS_5GS_ECIES_SCHEME_PROFILE_A 1
|
||||||
|
#define OGS_NAS_5GS_ECIES_SCHEME_PROFILE_B 2
|
||||||
|
uint8_t protection_scheme_id:4;)
|
||||||
|
uint8_t home_network_pki_value;
|
||||||
|
uint8_t scheme_output[OGS_NAS_MAX_SCHEME_OUTPUT_LEN];
|
||||||
|
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_imsi_t;
|
||||||
|
typedef struct ogs_nas_5gs_mobile_identity_guti_s {
|
||||||
|
ogs_nas_5gs_mobile_identity_header_t h;
|
||||||
|
ogs_nas_plmn_id_t nas_plmn_id;
|
||||||
|
ogs_amf_id_t amf_id;
|
||||||
uint32_t m_tmsi;
|
uint32_t m_tmsi;
|
||||||
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_guti_t;
|
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_guti_t;
|
||||||
typedef struct ogs_nas_5gs_mobile_identity_s_tmsi_s {
|
typedef struct ogs_nas_5gs_mobile_identity_s_tmsi_s {
|
||||||
ED3(uint8_t _0xf:4;,
|
ogs_nas_5gs_mobile_identity_header_t h;
|
||||||
uint8_t spare:1;,
|
ogs_amf_id_t amf_id;
|
||||||
uint8_t type:3;)
|
|
||||||
uint8_t amf_region_id;
|
|
||||||
uint8_t amf_set_id1;
|
|
||||||
ED2(uint8_t amf_set_id2:2;,
|
|
||||||
uint8_t amf_pointer:6;)
|
|
||||||
uint32_t m_tmsi;
|
uint32_t m_tmsi;
|
||||||
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_s_tmsi_t;
|
} __attribute__ ((packed)) ogs_nas_5gs_mobile_identity_s_tmsi_t;
|
||||||
typedef struct ogs_nas_5gs_mobile_identity_s {
|
typedef struct ogs_nas_5gs_mobile_identity_s {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
union {
|
uint8_t *buffer;
|
||||||
ogs_nas_mobile_identity_imsi_t imsi;
|
|
||||||
ogs_nas_5gs_mobile_identity_guti_t guti;
|
|
||||||
ogs_nas_5gs_mobile_identity_s_tmsi_t s_tmsi;
|
|
||||||
ogs_nas_mobile_identity_imei_t imei;
|
|
||||||
ogs_nas_mobile_identity_imeisv_t imeisv;
|
|
||||||
};
|
|
||||||
} ogs_nas_5gs_mobile_identity_t;
|
} ogs_nas_5gs_mobile_identity_t;
|
||||||
|
|
||||||
/* 9.11.3.5 5GS network feature support
|
/* 9.11.3.5 5GS network feature support
|
||||||
|
@ -276,10 +284,10 @@ ED6(uint8_t spare:2;,
|
||||||
|
|
||||||
/* 9.11.3.10 ABBA
|
/* 9.11.3.10 ABBA
|
||||||
* M LV 3-n */
|
* M LV 3-n */
|
||||||
#define OGS_NAS_ABBA_LEN 255
|
#define OGS_NAS_MAX_ABBA_LEN 255
|
||||||
typedef struct ogs_nas_abba_s {
|
typedef struct ogs_nas_abba_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t abba[OGS_NAS_ABBA_LEN];
|
uint8_t value[OGS_NAS_MAX_ABBA_LEN];
|
||||||
} ogs_nas_abba_t;
|
} ogs_nas_abba_t;
|
||||||
|
|
||||||
/* 9.11.3.11 Access Type
|
/* 9.11.3.11 Access Type
|
||||||
|
@ -342,7 +350,7 @@ ED4(uint8_t type:4;,
|
||||||
/* 9.11.3.18A CAG information list
|
/* 9.11.3.18A CAG information list
|
||||||
* O TLV-E 3-n */
|
* O TLV-E 3-n */
|
||||||
typedef struct ogs_nas_cag_information_list_s {
|
typedef struct ogs_nas_cag_information_list_s {
|
||||||
uint8_t length;
|
uint16_t length;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
} ogs_nas_cag_information_list_t;
|
} ogs_nas_cag_information_list_t;
|
||||||
|
|
||||||
|
@ -360,7 +368,7 @@ ED3(uint8_t data_type:3;,
|
||||||
/* 9.11.3.18C Ciphering key data
|
/* 9.11.3.18C Ciphering key data
|
||||||
* O TLV-E x-n */
|
* O TLV-E x-n */
|
||||||
typedef struct ogs_nas_ciphering_key_data_s {
|
typedef struct ogs_nas_ciphering_key_data_s {
|
||||||
uint8_t length;
|
uint16_t length;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
} ogs_nas_ciphering_key_data_t;
|
} ogs_nas_ciphering_key_data_t;
|
||||||
|
|
||||||
|
@ -500,7 +508,7 @@ typedef ogs_nas_allowed_pdu_session_status_t ogs_nas_pdu_session_reactivation_re
|
||||||
/* 9.11.3.43 PDU session reactivation result error cause
|
/* 9.11.3.43 PDU session reactivation result error cause
|
||||||
* O TLV-E 5-515 */
|
* O TLV-E 5-515 */
|
||||||
typedef struct ogs_nas_pdu_session_reactivation_result_error_cause_s {
|
typedef struct ogs_nas_pdu_session_reactivation_result_error_cause_s {
|
||||||
uint8_t length;
|
uint16_t length;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
} ogs_nas_pdu_session_reactivation_result_error_cause_t;
|
} ogs_nas_pdu_session_reactivation_result_error_cause_t;
|
||||||
|
|
||||||
|
@ -622,44 +630,44 @@ ED3(uint8_t spare:6;,
|
||||||
|
|
||||||
/* 9.11.4.2 5GSM cause
|
/* 9.11.4.2 5GSM cause
|
||||||
* O TV 2 */
|
* O TV 2 */
|
||||||
#define OGS_NAS_GSM_OPERATOR_DETERMINED_BARRING 8
|
#define OGS_5GSM_CAUSE_OPERATOR_DETERMINED_BARRING 8
|
||||||
#define OGS_NAS_GSM_INSUFFICIENT_RESOURCES 26
|
#define OGS_5GSM_CAUSE_INSUFFICIENT_RESOURCES 26
|
||||||
#define OGS_NAS_GSM_MISSING_OR_UNKNOWN_DNN 27
|
#define OGS_5GSM_CAUSE_MISSING_OR_UNKNOWN_DNN 27
|
||||||
#define OGS_NAS_GSM_UNKNOWN_PDU_SESSION_TYPE 28
|
#define OGS_5GSM_CAUSE_UNKNOWN_PDU_SESSION_TYPE 28
|
||||||
#define OGS_NAS_GSM_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED 29
|
#define OGS_5GSM_CAUSE_USER_AUTHENTICATION_OR_AUTHORIZATION_FAILED 29
|
||||||
#define OGS_NAS_GSM_REQUEST_REJECTED_UNSPECIFIED 31
|
#define OGS_5GSM_CAUSE_REQUEST_REJECTED_UNSPECIFIED 31
|
||||||
#define OGS_NAS_GSM_SERVICE_OPTION_NOT_SUPPORTED 32
|
#define OGS_5GSM_CAUSE_SERVICE_OPTION_NOT_SUPPORTED 32
|
||||||
#define OGS_NAS_GSM_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33
|
#define OGS_5GSM_CAUSE_REQUESTED_SERVICE_OPTION_NOT_SUBSCRIBED 33
|
||||||
#define OGS_NAS_GSM_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34
|
#define OGS_5GSM_CAUSE_SERVICE_OPTION_TEMPORARILY_OUT_OF_ORDER 34
|
||||||
#define OGS_NAS_GSM_PTI_ALREADY_IN_USE 35
|
#define OGS_5GSM_CAUSE_PTI_ALREADY_IN_USE 35
|
||||||
#define OGS_NAS_GSM_REGULAR_DEACTIVATION 36
|
#define OGS_5GSM_CAUSE_REGULAR_DEACTIVATION 36
|
||||||
#define OGS_NAS_GSM_NETWORK_FAILURE 38
|
#define OGS_5GSM_CAUSE_NETWORK_FAILURE 38
|
||||||
#define OGS_NAS_GSM_REACTIVATION_REQUESTED 39
|
#define OGS_5GSM_CAUSE_REACTIVATION_REQUESTED 39
|
||||||
#define OGS_NAS_GSM_INVALID_PDU_SESSION_IDENTITY 43
|
#define OGS_5GSM_CAUSE_INVALID_PDU_SESSION_IDENTITY 43
|
||||||
#define OGS_NAS_GSM_SEMANTIC_ERRORS_IN_PACKET_FILTERS 44
|
#define OGS_5GSM_CAUSE_SEMANTIC_ERRORS_IN_PACKET_FILTERS 44
|
||||||
#define OGS_NAS_GSM_SYNTACTICAL_ERROR_IN_PACKET_FILTERS 45
|
#define OGS_5GSM_CAUSE_SYNTACTICAL_ERROR_IN_PACKET_FILTERS 45
|
||||||
#define OGS_NAS_GSM_OUT_OF_LADN_SERVICE_AREA 46
|
#define OGS_5GSM_CAUSE_OUT_OF_LADN_SERVICE_AREA 46
|
||||||
#define OGS_NAS_GSM_PTI_MISMATCH 47
|
#define OGS_5GSM_CAUSE_PTI_MISMATCH 47
|
||||||
#define OGS_NAS_GSM_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED 50
|
#define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_IPV4_ONLY_ALLOWED 50
|
||||||
#define OGS_NAS_GSM_PDU_SESSION_TYPE_IPV6_ONLY_ALLOWED 51
|
#define OGS_5GSM_CAUSE_PDU_SESSION_TYPE_IPV6_ONLY_ALLOWED 51
|
||||||
#define OGS_NAS_GSM_PDU_SESSION_DOES_NOT_EXIST 54
|
#define OGS_5GSM_CAUSE_PDU_SESSION_DOES_NOT_EXIST 54
|
||||||
#define OGS_NAS_GSM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67
|
#define OGS_5GSM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE_AND_DNN 67
|
||||||
#define OGS_NAS_GSM_NOT_SUPPORTED_SSC_MODE 68
|
#define OGS_5GSM_CAUSE_NOT_SUPPORTED_SSC_MODE 68
|
||||||
#define OGS_NAS_GSM_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69
|
#define OGS_5GSM_CAUSE_INSUFFICIENT_RESOURCES_FOR_SPECIFIC_SLICE 69
|
||||||
#define OGS_NAS_GSM_MISSING_OR_UNKNOWN_DNN_IN_A_SLICE 70
|
#define OGS_5GSM_CAUSE_MISSING_OR_UNKNOWN_DNN_IN_A_SLICE 70
|
||||||
#define OGS_NAS_GSM_INVALID_PTI_VALUE 81
|
#define OGS_5GSM_CAUSE_INVALID_PTI_VALUE 81
|
||||||
#define OGS_NAS_GSM_MAXIMUM_DATA_RATE_PER_UE_FOR_USER_PLANE_INTEGRITY_PROTECTION_IS_TOO_LOW 82
|
#define OGS_5GSM_CAUSE_MAXIMUM_DATA_RATE_PER_UE_FOR_USER_PLANE_INTEGRITY_PROTECTION_IS_TOO_LOW 82
|
||||||
#define OGS_NAS_GSM_SEMANTIC_ERROR_IN_THE_QOS_OPERATION 83
|
#define OGS_5GSM_CAUSE_SEMANTIC_ERROR_IN_THE_QOS_OPERATION 83
|
||||||
#define OGS_NAS_GSM_SYNTACTICAL_ERROR_IN_THE_QOS_OPERATION 84
|
#define OGS_5GSM_CAUSE_SYNTACTICAL_ERROR_IN_THE_QOS_OPERATION 84
|
||||||
#define OGS_NAS_GSM_INVALID_MAPPED_EPS_BEARER_IDENTITY 85
|
#define OGS_5GSM_CAUSE_INVALID_MAPPED_EPS_BEARER_IDENTITY 85
|
||||||
#define OGS_NAS_GSM_SEMANTICALLY_INCORRECT_MESSAGE 95
|
#define OGS_5GSM_CAUSE_SEMANTICALLY_INCORRECT_MESSAGE 95
|
||||||
#define OGS_NAS_GSM_INVALID_MANDATORY_INFORMATION 96
|
#define OGS_5GSM_CAUSE_INVALID_MANDATORY_INFORMATION 96
|
||||||
#define OGS_NAS_GSM_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97
|
#define OGS_5GSM_CAUSE_MESSAGE_TYPE_NON_EXISTENT_OR_NOT_IMPLEMENTED 97
|
||||||
#define OGS_NAS_GSM_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98
|
#define OGS_5GSM_CAUSE_MESSAGE_TYPE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 98
|
||||||
#define OGS_NAS_GSM_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT IMPLEMENTED 99
|
#define OGS_5GSM_CAUSE_INFORMATION_ELEMENT_NON_EXISTENT_OR_NOT IMPLEMENTED 99
|
||||||
#define OGS_NAS_GSM_CONDITIONAL_IE_ERROR 100
|
#define OGS_5GSM_CAUSE_CONDITIONAL_IE_ERROR 100
|
||||||
#define OGS_NAS_GSM_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101
|
#define OGS_5GSM_CAUSE_MESSAGE_NOT_COMPATIBLE_WITH_THE_PROTOCOL_STATE 101
|
||||||
#define OGS_NAS_GSM_PROTOCOL_ERROR_UNSPECIFIED 111
|
#define OGS_5GSM_CAUSE_PROTOCOL_ERROR_UNSPECIFIED 111
|
||||||
typedef uint8_t ogs_nas_5gsm_cause_t;
|
typedef uint8_t ogs_nas_5gsm_cause_t;
|
||||||
|
|
||||||
/* 9.11.4.21 5GSM congestion re-attempt indicator
|
/* 9.11.4.21 5GSM congestion re-attempt indicator
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -19,7 +19,7 @@
|
||||||
|
|
||||||
#include "ogs-nas-common.h"
|
#include "ogs-nas-common.h"
|
||||||
|
|
||||||
void ogs_nas_imsi_to_bcd(
|
void ogs_nas_eps_imsi_to_bcd(
|
||||||
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd)
|
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd)
|
||||||
{
|
{
|
||||||
int bcd_len;
|
int bcd_len;
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -34,7 +34,7 @@ void ogs_nas_imsi_to_buffer(
|
||||||
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len,
|
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len,
|
||||||
uint8_t *buf, uint8_t *buf_len);
|
uint8_t *buf, uint8_t *buf_len);
|
||||||
|
|
||||||
void ogs_nas_imsi_to_bcd(
|
void ogs_nas_eps_imsi_to_bcd(
|
||||||
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd);
|
ogs_nas_mobile_identity_imsi_t *imsi, uint8_t imsi_len, char *bcd);
|
||||||
|
|
||||||
void ogs_nas_imeisv_to_bcd(
|
void ogs_nas_imeisv_to_bcd(
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
# Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
# Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
|
|
||||||
# This file is part of Open5GS.
|
# This file is part of Open5GS.
|
||||||
|
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -21,7 +21,8 @@
|
||||||
|
|
||||||
int __ogs_nas_domain;
|
int __ogs_nas_domain;
|
||||||
|
|
||||||
void *ogs_nas_from_plmn_id(ogs_nas_plmn_id_t *ogs_nas_plmn_id, ogs_plmn_id_t *plmn_id)
|
void *ogs_nas_from_plmn_id(
|
||||||
|
ogs_nas_plmn_id_t *ogs_nas_plmn_id, ogs_plmn_id_t *plmn_id)
|
||||||
{
|
{
|
||||||
memcpy(ogs_nas_plmn_id, plmn_id, OGS_PLMN_ID_LEN);
|
memcpy(ogs_nas_plmn_id, plmn_id, OGS_PLMN_ID_LEN);
|
||||||
if (plmn_id->mnc1 != 0xf) {
|
if (plmn_id->mnc1 != 0xf) {
|
||||||
|
@ -31,7 +32,8 @@ void *ogs_nas_from_plmn_id(ogs_nas_plmn_id_t *ogs_nas_plmn_id, ogs_plmn_id_t *pl
|
||||||
}
|
}
|
||||||
return ogs_nas_plmn_id;
|
return ogs_nas_plmn_id;
|
||||||
}
|
}
|
||||||
void *ogs_nas_to_plmn_id(ogs_plmn_id_t *plmn_id, ogs_nas_plmn_id_t *ogs_nas_plmn_id)
|
void *ogs_nas_to_plmn_id(
|
||||||
|
ogs_plmn_id_t *plmn_id, ogs_nas_plmn_id_t *ogs_nas_plmn_id)
|
||||||
{
|
{
|
||||||
memcpy(plmn_id, ogs_nas_plmn_id, OGS_PLMN_ID_LEN);
|
memcpy(plmn_id, ogs_nas_plmn_id, OGS_PLMN_ID_LEN);
|
||||||
if (plmn_id->mnc1 != 0xf) {
|
if (plmn_id->mnc1 != 0xf) {
|
||||||
|
|
|
@ -1,5 +1,5 @@
|
||||||
/*
|
/*
|
||||||
* Copyright (C) 2019 by Sukchan Lee <acetcom@gmail.com>
|
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
|
||||||
*
|
*
|
||||||
* This file is part of Open5GS.
|
* This file is part of Open5GS.
|
||||||
*
|
*
|
||||||
|
@ -388,22 +388,22 @@ ED3(uint8_t type:4;,
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA1 1
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA1 1
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA2 2
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA2 2
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA3 3
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_EEA3 3
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_IA0 0
|
#define OGS_NAS_SECURITY_ALGORITHMS_NIA0 0
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_IA1 1
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NIA1 1
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_IA2 2
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NIA2 2
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_IA3 3
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NIA3 3
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_IA4 4
|
#define OGS_NAS_SECURITY_ALGORITHMS_NIA4 4
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_IA5 5
|
#define OGS_NAS_SECURITY_ALGORITHMS_NIA5 5
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_IA6 6
|
#define OGS_NAS_SECURITY_ALGORITHMS_NIA6 6
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_IA7 7
|
#define OGS_NAS_SECURITY_ALGORITHMS_NIA7 7
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_EA0 0
|
#define OGS_NAS_SECURITY_ALGORITHMS_NEA0 0
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_EA1 1
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NEA1 1
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_EA2 2
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NEA2 2
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_128_EA3 3
|
#define OGS_NAS_SECURITY_ALGORITHMS_128_NEA3 3
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_EA4 4
|
#define OGS_NAS_SECURITY_ALGORITHMS_NEA4 4
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_EA5 5
|
#define OGS_NAS_SECURITY_ALGORITHMS_NEA5 5
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_EA6 6
|
#define OGS_NAS_SECURITY_ALGORITHMS_NEA6 6
|
||||||
#define OGS_NAS_SECURITY_ALGORITHMS_EA7 7
|
#define OGS_NAS_SECURITY_ALGORITHMS_NEA7 7
|
||||||
typedef struct ogs_nas_security_algorithms_s {
|
typedef struct ogs_nas_security_algorithms_s {
|
||||||
ED2(uint8_t type_of_ciphering_algorithm:4;,
|
ED2(uint8_t type_of_ciphering_algorithm:4;,
|
||||||
uint8_t type_of_integrity_protection_algorithm:4;)
|
uint8_t type_of_integrity_protection_algorithm:4;)
|
||||||
|
@ -565,16 +565,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||||
uint8_t eea;
|
uint8_t eea;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ED8(uint8_t ea0_5g:1;,
|
ED8(uint8_t nea0:1;,
|
||||||
uint8_t ea1_5g_128:1;,
|
uint8_t nea1:1;,
|
||||||
uint8_t ea2_5g_128:1;,
|
uint8_t nea2:1;,
|
||||||
uint8_t ea3_5g_128:1;,
|
uint8_t nea3:1;,
|
||||||
uint8_t ea4_5g:1;,
|
uint8_t nea4:1;,
|
||||||
uint8_t ea5_5g:1;,
|
uint8_t nea5:1;,
|
||||||
uint8_t ea6_5g:1;,
|
uint8_t nea6:1;,
|
||||||
uint8_t ea7_5g:1;)
|
uint8_t nea7:1;)
|
||||||
};
|
};
|
||||||
uint8_t ea_5g;
|
uint8_t nea;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
@ -590,16 +590,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||||
uint8_t eia;
|
uint8_t eia;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ED8(uint8_t ia0_5g:1;,
|
ED8(uint8_t nia0:1;,
|
||||||
uint8_t ia1_5g_128:1;,
|
uint8_t nia1:1;,
|
||||||
uint8_t ia2_5g_128:1;,
|
uint8_t nia2:1;,
|
||||||
uint8_t ia3_5g_128:1;,
|
uint8_t nia3:1;,
|
||||||
uint8_t ia4_5g:1;,
|
uint8_t nia4:1;,
|
||||||
uint8_t ia5_5g:1;,
|
uint8_t nia5:1;,
|
||||||
uint8_t ia6_5g:1;,
|
uint8_t nia6:1;,
|
||||||
uint8_t ia7_5g:1;)
|
uint8_t nia7:1;)
|
||||||
};
|
};
|
||||||
uint8_t ia_5g;
|
uint8_t nia;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
@ -615,16 +615,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||||
uint8_t uea;
|
uint8_t uea;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ED8(uint8_t ea0:1;,
|
ED8(uint8_t eps_ea0:1;,
|
||||||
uint8_t ea1_128:1;,
|
uint8_t eps_ea1:1;,
|
||||||
uint8_t ea2_128:1;,
|
uint8_t eps_ea2:1;,
|
||||||
uint8_t ea3_128:1;,
|
uint8_t eps_ea3:1;,
|
||||||
uint8_t ea4:1;,
|
uint8_t eps_ea4:1;,
|
||||||
uint8_t ea5:1;,
|
uint8_t eps_ea5:1;,
|
||||||
uint8_t ea6:1;,
|
uint8_t eps_ea6:1;,
|
||||||
uint8_t ea7:1;)
|
uint8_t eps_ea7:1;)
|
||||||
};
|
};
|
||||||
uint8_t ea;
|
uint8_t eps_ea;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
@ -640,16 +640,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||||
uint8_t uia;
|
uint8_t uia;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
ED8(uint8_t ia0:1;,
|
ED8(uint8_t eps_ia0:1;,
|
||||||
uint8_t ia1_128:1;,
|
uint8_t eps_ia1:1;,
|
||||||
uint8_t ia2_128:1;,
|
uint8_t eps_ia2:1;,
|
||||||
uint8_t ia3_128:1;,
|
uint8_t eps_ia3:1;,
|
||||||
uint8_t ia4:1;,
|
uint8_t eps_ia4:1;,
|
||||||
uint8_t ia5:1;,
|
uint8_t eps_ia5:1;,
|
||||||
uint8_t ia6:1;,
|
uint8_t eps_ia6:1;,
|
||||||
uint8_t ia7:1;)
|
uint8_t eps_ia7:1;)
|
||||||
};
|
};
|
||||||
uint8_t ia;
|
uint8_t eps_ia;
|
||||||
};
|
};
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
|
@ -664,6 +664,7 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||||
};
|
};
|
||||||
uint8_t gea;
|
uint8_t gea;
|
||||||
};
|
};
|
||||||
|
char spare[3];
|
||||||
} __attribute__ ((packed)) ogs_nas_ue_security_capability_t;
|
} __attribute__ ((packed)) ogs_nas_ue_security_capability_t;
|
||||||
|
|
||||||
/* 9.9.3.62 WUS assistance information
|
/* 9.9.3.62 WUS assistance information
|
||||||
|
|
|
@ -25,10 +25,10 @@ void ogs_ngap_uint32_to_GNB_ID(uint32_t gnb_id, NGAP_GNB_ID_t *gNB_ID)
|
||||||
|
|
||||||
ogs_assert(gNB_ID);
|
ogs_assert(gNB_ID);
|
||||||
|
|
||||||
|
gNB_ID->present = NGAP_GNB_ID_PR_gNB_ID;
|
||||||
bit_string = &gNB_ID->choice.gNB_ID;
|
bit_string = &gNB_ID->choice.gNB_ID;
|
||||||
ogs_assert(bit_string);
|
ogs_assert(bit_string);
|
||||||
|
|
||||||
gNB_ID->present = NGAP_GNB_ID_PR_gNB_ID;
|
|
||||||
bit_string->size = 3;
|
bit_string->size = 3;
|
||||||
bit_string->buf = CALLOC(bit_string->size, sizeof(uint8_t));
|
bit_string->buf = CALLOC(bit_string->size, sizeof(uint8_t));
|
||||||
|
|
||||||
|
@ -60,7 +60,7 @@ void ogs_ngap_uint8_to_AMFRegionID(
|
||||||
|
|
||||||
aMFRegionID->buf[0] = region;
|
aMFRegionID->buf[0] = region;
|
||||||
}
|
}
|
||||||
void ogs_ngap_uint16_to_NGAP_AMFSetID(
|
void ogs_ngap_uint16_to_AMFSetID(
|
||||||
uint16_t set, NGAP_AMFSetID_t *aMFSetID)
|
uint16_t set, NGAP_AMFSetID_t *aMFSetID)
|
||||||
{
|
{
|
||||||
ogs_assert(aMFSetID);
|
ogs_assert(aMFSetID);
|
||||||
|
@ -72,7 +72,7 @@ void ogs_ngap_uint16_to_NGAP_AMFSetID(
|
||||||
aMFSetID->buf[0] = (set >> 2);
|
aMFSetID->buf[0] = (set >> 2);
|
||||||
aMFSetID->buf[1] = ((set & 0x03) << 6);
|
aMFSetID->buf[1] = ((set & 0x03) << 6);
|
||||||
}
|
}
|
||||||
void ogs_ngap_uint8_to_NGAP_NGAP_AMFPointer(
|
void ogs_ngap_uint8_to_AMFPointer(
|
||||||
uint8_t pointer, NGAP_AMFPointer_t *aMFPointer)
|
uint8_t pointer, NGAP_AMFPointer_t *aMFPointer)
|
||||||
{
|
{
|
||||||
ogs_assert(aMFPointer);
|
ogs_assert(aMFPointer);
|
||||||
|
@ -83,3 +83,88 @@ void ogs_ngap_uint8_to_NGAP_NGAP_AMFPointer(
|
||||||
|
|
||||||
aMFPointer->buf[0] = (pointer << 2);
|
aMFPointer->buf[0] = (pointer << 2);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void ogs_ngap_AMFRegionID_to_uint8(
|
||||||
|
NGAP_AMFRegionID_t *aMFRegionID, uint8_t *region)
|
||||||
|
{
|
||||||
|
uint8_t *buf = NULL;
|
||||||
|
|
||||||
|
ogs_assert(aMFRegionID);
|
||||||
|
ogs_assert(region);
|
||||||
|
|
||||||
|
buf = aMFRegionID->buf;
|
||||||
|
ogs_assert(buf);
|
||||||
|
|
||||||
|
*region = buf[0];
|
||||||
|
}
|
||||||
|
void ogs_ngap_AMFSetID_to_uint16(
|
||||||
|
NGAP_AMFSetID_t *aMFSetID, uint16_t *set)
|
||||||
|
{
|
||||||
|
uint8_t *buf = NULL;
|
||||||
|
|
||||||
|
ogs_assert(aMFSetID);
|
||||||
|
ogs_assert(set);
|
||||||
|
|
||||||
|
buf = aMFSetID->buf;
|
||||||
|
ogs_assert(buf);
|
||||||
|
|
||||||
|
*set = (buf[0] << 2) + ((buf[1] >> 6) & 0x03);
|
||||||
|
}
|
||||||
|
void ogs_ngap_AMFPointer_to_uint8(
|
||||||
|
NGAP_AMFPointer_t *aMFPointer, uint8_t *pointer)
|
||||||
|
{
|
||||||
|
uint8_t *buf = NULL;
|
||||||
|
|
||||||
|
ogs_assert(aMFPointer);
|
||||||
|
ogs_assert(pointer);
|
||||||
|
|
||||||
|
buf = aMFPointer->buf;
|
||||||
|
ogs_assert(buf);
|
||||||
|
|
||||||
|
*pointer = (buf[0] >> 2);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogs_ngap_nr_cgi_to_ASN(ogs_nr_cgi_t *cgi, NGAP_NR_CGI_t *nR_CGI)
|
||||||
|
{
|
||||||
|
char buf[5];
|
||||||
|
|
||||||
|
ogs_assert(cgi);
|
||||||
|
ogs_assert(nR_CGI);
|
||||||
|
|
||||||
|
ogs_asn_buffer_to_OCTET_STRING(
|
||||||
|
&cgi->plmn_id, OGS_PLMN_ID_LEN, &nR_CGI->pLMNIdentity);
|
||||||
|
|
||||||
|
/* CellIdentity : 36bit */
|
||||||
|
ogs_uint64_to_buffer((cgi->cell_id << 4), 5, buf);
|
||||||
|
ogs_asn_buffer_to_BIT_STRING(buf, 5, 4, &nR_CGI->nRCellIdentity);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogs_ngap_ASN_to_nr_cgi(NGAP_NR_CGI_t *nR_CGI, ogs_nr_cgi_t *cgi)
|
||||||
|
{
|
||||||
|
ogs_assert(cgi);
|
||||||
|
ogs_assert(nR_CGI);
|
||||||
|
|
||||||
|
memcpy(&cgi->plmn_id, nR_CGI->pLMNIdentity.buf, OGS_PLMN_ID_LEN);
|
||||||
|
|
||||||
|
/* CellIdentity : 36bit */
|
||||||
|
cgi->cell_id = (ogs_buffer_to_uint64(nR_CGI->nRCellIdentity.buf, 5) >> 4);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogs_ngap_5gs_tai_to_ASN(ogs_5gs_tai_t *tai, NGAP_TAI_t *tAI)
|
||||||
|
{
|
||||||
|
ogs_assert(tai);
|
||||||
|
ogs_assert(tAI);
|
||||||
|
|
||||||
|
ogs_asn_buffer_to_OCTET_STRING(
|
||||||
|
&tai->plmn_id, OGS_PLMN_ID_LEN, &tAI->pLMNIdentity);
|
||||||
|
ogs_asn_uint24_to_OCTET_STRING(tai->tac, &tAI->tAC);
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogs_ngap_ASN_to_5gs_tai(NGAP_TAI_t *tAI, ogs_5gs_tai_t *tai)
|
||||||
|
{
|
||||||
|
ogs_assert(tai);
|
||||||
|
ogs_assert(tAI);
|
||||||
|
|
||||||
|
memcpy(&tai->plmn_id, tAI->pLMNIdentity.buf, OGS_PLMN_ID_LEN);
|
||||||
|
ogs_asn_OCTET_STRING_to_uint24(&tAI->tAC, &tai->tac);
|
||||||
|
}
|
||||||
|
|
|
@ -33,10 +33,22 @@ void ogs_ngap_GNB_ID_to_uint32(NGAP_GNB_ID_t *gNB_ID, uint32_t *gnb_id);
|
||||||
|
|
||||||
void ogs_ngap_uint8_to_AMFRegionID(
|
void ogs_ngap_uint8_to_AMFRegionID(
|
||||||
uint8_t region, NGAP_AMFRegionID_t *aMFRegionID);
|
uint8_t region, NGAP_AMFRegionID_t *aMFRegionID);
|
||||||
void ogs_ngap_uint16_to_NGAP_AMFSetID(
|
void ogs_ngap_uint16_to_AMFSetID(
|
||||||
uint16_t set, NGAP_AMFSetID_t *aMFSetID);
|
uint16_t set, NGAP_AMFSetID_t *aMFSetID);
|
||||||
void ogs_ngap_uint8_to_NGAP_NGAP_AMFPointer(
|
void ogs_ngap_uint8_to_AMFPointer(
|
||||||
uint8_t pointer, NGAP_AMFPointer_t *aMFPointer);
|
uint8_t pointer, NGAP_AMFPointer_t *aMFPointer);
|
||||||
|
void ogs_ngap_AMFRegionID_to_uint8(
|
||||||
|
NGAP_AMFRegionID_t *aMFRegionID, uint8_t *region);
|
||||||
|
void ogs_ngap_AMFSetID_to_uint16(
|
||||||
|
NGAP_AMFSetID_t *aMFSetID, uint16_t *set);
|
||||||
|
void ogs_ngap_AMFPointer_to_uint8(
|
||||||
|
NGAP_AMFPointer_t *aMFPointer, uint8_t *pointer);
|
||||||
|
|
||||||
|
void ogs_ngap_nr_cgi_to_ASN(ogs_nr_cgi_t *cgi, NGAP_NR_CGI_t *nR_CGI);
|
||||||
|
void ogs_ngap_ASN_to_nr_cgi(NGAP_NR_CGI_t *nR_CGI, ogs_nr_cgi_t *cgi);
|
||||||
|
|
||||||
|
void ogs_ngap_5gs_tai_to_ASN(ogs_5gs_tai_t *tai, NGAP_TAI_t *tAI);
|
||||||
|
void ogs_ngap_ASN_to_5gs_tai(NGAP_TAI_t *tAI, ogs_5gs_tai_t *tai);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
|
|
115
lib/sbi/client.c
115
lib/sbi/client.c
|
@ -45,6 +45,8 @@ typedef struct connection_s {
|
||||||
char *memory;
|
char *memory;
|
||||||
size_t size;
|
size_t size;
|
||||||
|
|
||||||
|
char *location;
|
||||||
|
|
||||||
ogs_timer_t *timer;
|
ogs_timer_t *timer;
|
||||||
CURL *easy;
|
CURL *easy;
|
||||||
char error[CURL_ERROR_SIZE];
|
char error[CURL_ERROR_SIZE];
|
||||||
|
@ -57,6 +59,7 @@ static OGS_POOL(sockinfo_pool, sockinfo_t);
|
||||||
static OGS_POOL(connection_pool, connection_t);
|
static OGS_POOL(connection_pool, connection_t);
|
||||||
|
|
||||||
static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data);
|
static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data);
|
||||||
|
static size_t header_cb(void *ptr, size_t size, size_t nmemb, void *data);
|
||||||
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp);
|
static int sock_cb(CURL *e, curl_socket_t s, int what, void *cbp, void *sockp);
|
||||||
static int multi_timer_cb(CURLM *multi, long timeout_ms, void *cbp);
|
static int multi_timer_cb(CURLM *multi, long timeout_ms, void *cbp);
|
||||||
static void multi_timer_expired(void *data);
|
static void multi_timer_expired(void *data);
|
||||||
|
@ -68,7 +71,7 @@ void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool)
|
||||||
curl_global_init(CURL_GLOBAL_DEFAULT);
|
curl_global_init(CURL_GLOBAL_DEFAULT);
|
||||||
|
|
||||||
ogs_list_init(&ogs_sbi_self()->client_list);
|
ogs_list_init(&ogs_sbi_self()->client_list);
|
||||||
ogs_pool_init(&client_pool, ogs_config()->pool.sbi);
|
ogs_pool_init(&client_pool, ogs_config()->max.nf);
|
||||||
|
|
||||||
ogs_pool_init(&sockinfo_pool, num_of_sockinfo_pool);
|
ogs_pool_init(&sockinfo_pool, num_of_sockinfo_pool);
|
||||||
ogs_pool_init(&connection_pool, num_of_connection_pool);
|
ogs_pool_init(&connection_pool, num_of_connection_pool);
|
||||||
|
@ -76,8 +79,6 @@ void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool)
|
||||||
}
|
}
|
||||||
void ogs_sbi_client_final(void)
|
void ogs_sbi_client_final(void)
|
||||||
{
|
{
|
||||||
ogs_sbi_client_remove_all();
|
|
||||||
|
|
||||||
ogs_pool_final(&client_pool);
|
ogs_pool_final(&client_pool);
|
||||||
ogs_pool_final(&sockinfo_pool);
|
ogs_pool_final(&sockinfo_pool);
|
||||||
ogs_pool_final(&connection_pool);
|
ogs_pool_final(&connection_pool);
|
||||||
|
@ -115,70 +116,17 @@ ogs_sbi_client_t *ogs_sbi_client_add(ogs_sockaddr_t *addr)
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_client_t *ogs_sbi_client_find_or_add(char *url)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
|
|
||||||
ogs_sbi_client_t *client = NULL;
|
|
||||||
struct yuarel yuarel;
|
|
||||||
char *p = ogs_strdup(url);
|
|
||||||
int port;
|
|
||||||
|
|
||||||
ogs_sockaddr_t *addr = NULL;
|
|
||||||
|
|
||||||
rv = yuarel_parse(&yuarel, p);
|
|
||||||
if (rv != OGS_OK) {
|
|
||||||
ogs_free(p);
|
|
||||||
ogs_error("yuarel_parse() failed [%s]", url);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!yuarel.scheme) {
|
|
||||||
ogs_error("No http.scheme found [%s]", url);
|
|
||||||
ogs_free(p);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (strcmp(yuarel.scheme, "https") == 0) {
|
|
||||||
port = OGS_SBI_HTTPS_PORT;
|
|
||||||
} else if (strcmp(yuarel.scheme, "http") == 0) {
|
|
||||||
port = OGS_SBI_HTTP_PORT;
|
|
||||||
} else {
|
|
||||||
ogs_error("Invalid http.scheme [%s:%s]", yuarel.scheme, url);
|
|
||||||
ogs_free(p);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!yuarel.host) {
|
|
||||||
ogs_error("No http.host found [%s]", url);
|
|
||||||
ogs_free(p);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (yuarel.port) port = yuarel.port;
|
|
||||||
|
|
||||||
rv = ogs_getaddrinfo(&addr, AF_UNSPEC, yuarel.host, port, 0);
|
|
||||||
if (rv != OGS_OK) {
|
|
||||||
ogs_error("ogs_getaddrinfo() failed [%s]", url);
|
|
||||||
ogs_free(p);
|
|
||||||
}
|
|
||||||
|
|
||||||
client = ogs_sbi_client_find(addr);
|
|
||||||
if (!client) {
|
|
||||||
client = ogs_sbi_client_add(addr);
|
|
||||||
ogs_assert(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
ogs_freeaddrinfo(addr);
|
|
||||||
ogs_free(p);
|
|
||||||
|
|
||||||
return client;
|
|
||||||
}
|
|
||||||
|
|
||||||
void ogs_sbi_client_remove(ogs_sbi_client_t *client)
|
void ogs_sbi_client_remove(ogs_sbi_client_t *client)
|
||||||
{
|
{
|
||||||
ogs_assert(client);
|
ogs_assert(client);
|
||||||
|
|
||||||
|
/* ogs_sbi_client_t is always created with reference context */
|
||||||
|
ogs_assert(client->reference_count > 0);
|
||||||
|
|
||||||
|
client->reference_count--;
|
||||||
|
if (client->reference_count > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
ogs_list_remove(&ogs_sbi_self()->client_list, client);
|
ogs_list_remove(&ogs_sbi_self()->client_list, client);
|
||||||
|
|
||||||
connection_remove_all(client);
|
connection_remove_all(client);
|
||||||
|
@ -195,14 +143,6 @@ void ogs_sbi_client_remove(ogs_sbi_client_t *client)
|
||||||
ogs_pool_free(&client_pool, client);
|
ogs_pool_free(&client_pool, client);
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogs_sbi_client_remove_all(void)
|
|
||||||
{
|
|
||||||
ogs_sbi_client_t *client = NULL, *next_client = NULL;
|
|
||||||
|
|
||||||
ogs_list_for_each_safe(&ogs_sbi_self()->client_list, next_client, client)
|
|
||||||
ogs_sbi_client_remove(client);
|
|
||||||
}
|
|
||||||
|
|
||||||
ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr)
|
ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr)
|
||||||
{
|
{
|
||||||
ogs_sbi_client_t *client = NULL;
|
ogs_sbi_client_t *client = NULL;
|
||||||
|
@ -210,7 +150,8 @@ ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr)
|
||||||
ogs_assert(addr);
|
ogs_assert(addr);
|
||||||
|
|
||||||
ogs_list_for_each(&ogs_sbi_self()->client_list, client) {
|
ogs_list_for_each(&ogs_sbi_self()->client_list, client) {
|
||||||
if (ogs_sockaddr_is_equal(client->addr, addr) == true)
|
if (ogs_sockaddr_is_equal(client->addr, addr) == true &&
|
||||||
|
OGS_PORT(client->addr) == OGS_PORT(addr))
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -338,12 +279,13 @@ static connection_t *connection_add(ogs_sbi_client_t *client,
|
||||||
|
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_CUSTOMREQUEST, request->h.method);
|
curl_easy_setopt(conn->easy, CURLOPT_CUSTOMREQUEST, request->h.method);
|
||||||
if (request->http.content) {
|
if (request->http.content) {
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_HTTPHEADER, conn->header_list);
|
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_POSTFIELDS,
|
curl_easy_setopt(conn->easy, CURLOPT_POSTFIELDS,
|
||||||
request->http.content);
|
request->http.content);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
curl_easy_setopt(conn->easy, CURLOPT_HTTPHEADER, conn->header_list);
|
||||||
|
|
||||||
if (ogs_hash_count(request->http.params)) {
|
if (ogs_hash_count(request->http.params)) {
|
||||||
request->h.url = add_params_to_url(conn->easy,
|
request->h.url = add_params_to_url(conn->easy,
|
||||||
request->h.url, request->http.params);
|
request->h.url, request->http.params);
|
||||||
|
@ -354,6 +296,8 @@ static connection_t *connection_add(ogs_sbi_client_t *client,
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
|
curl_easy_setopt(conn->easy, CURLOPT_PRIVATE, conn);
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb);
|
curl_easy_setopt(conn->easy, CURLOPT_WRITEFUNCTION, write_cb);
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, conn);
|
curl_easy_setopt(conn->easy, CURLOPT_WRITEDATA, conn);
|
||||||
|
curl_easy_setopt(conn->easy, CURLOPT_HEADERFUNCTION, header_cb);
|
||||||
|
curl_easy_setopt(conn->easy, CURLOPT_HEADERDATA, conn);
|
||||||
curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
|
curl_easy_setopt(conn->easy, CURLOPT_ERRORBUFFER, conn->error);
|
||||||
|
|
||||||
ogs_assert(client->multi);
|
ogs_assert(client->multi);
|
||||||
|
@ -390,6 +334,9 @@ static void connection_remove(connection_t *conn)
|
||||||
ogs_assert(conn->method);
|
ogs_assert(conn->method);
|
||||||
ogs_free(conn->method);
|
ogs_free(conn->method);
|
||||||
|
|
||||||
|
if (conn->location)
|
||||||
|
ogs_free(conn->location);
|
||||||
|
|
||||||
if (conn->num_of_header) {
|
if (conn->num_of_header) {
|
||||||
for (i = 0; i < conn->num_of_header; i++)
|
for (i = 0; i < conn->num_of_header; i++)
|
||||||
ogs_free(conn->headers[i]);
|
ogs_free(conn->headers[i]);
|
||||||
|
@ -473,7 +420,10 @@ static void check_multi_info(ogs_sbi_client_t *client)
|
||||||
|
|
||||||
if (content_type)
|
if (content_type)
|
||||||
ogs_sbi_header_set(response->http.headers,
|
ogs_sbi_header_set(response->http.headers,
|
||||||
"Content-Type", content_type);
|
OGS_SBI_CONTENT_TYPE, content_type);
|
||||||
|
if (conn->location)
|
||||||
|
ogs_sbi_header_set(response->http.headers,
|
||||||
|
OGS_SBI_LOCATION, conn->location);
|
||||||
|
|
||||||
if (client->cb)
|
if (client->cb)
|
||||||
client->cb(response, conn->data);
|
client->cb(response, conn->data);
|
||||||
|
@ -503,9 +453,7 @@ void ogs_sbi_client_send_request(
|
||||||
ogs_assert(request);
|
ogs_assert(request);
|
||||||
|
|
||||||
if (request->h.url == NULL) {
|
if (request->h.url == NULL) {
|
||||||
request->h.url = ogs_sbi_client_uri(client,
|
request->h.url = ogs_sbi_client_uri(client, &request->h);
|
||||||
request->h.service.name, request->h.api.version,
|
|
||||||
request->h.resource.name, request->h.resource.id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
conn = connection_add(client, request, data);
|
conn = connection_add(client, request, data);
|
||||||
|
@ -537,6 +485,19 @@ static size_t write_cb(void *contents, size_t size, size_t nmemb, void *data)
|
||||||
return realsize;
|
return realsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static size_t header_cb(void *ptr, size_t size, size_t nmemb, void *data)
|
||||||
|
{
|
||||||
|
connection_t *conn = NULL;
|
||||||
|
|
||||||
|
conn = data;
|
||||||
|
ogs_assert(conn);
|
||||||
|
|
||||||
|
if (strncmp(ptr, OGS_SBI_LOCATION, strlen(OGS_SBI_LOCATION)) == 0)
|
||||||
|
conn->location = ogs_strdup((char *)ptr + strlen(OGS_SBI_LOCATION) + 2);
|
||||||
|
|
||||||
|
return (nmemb*size);
|
||||||
|
}
|
||||||
|
|
||||||
static void event_cb(short when, ogs_socket_t fd, void *data)
|
static void event_cb(short when, ogs_socket_t fd, void *data)
|
||||||
{
|
{
|
||||||
sockinfo_t *sockinfo = NULL;
|
sockinfo_t *sockinfo = NULL;
|
||||||
|
|
|
@ -32,6 +32,8 @@ extern "C" {
|
||||||
do { \
|
do { \
|
||||||
ogs_assert((__cTX)); \
|
ogs_assert((__cTX)); \
|
||||||
ogs_assert((__pCLIENT)); \
|
ogs_assert((__pCLIENT)); \
|
||||||
|
if ((__cTX)->client != __pCLIENT) \
|
||||||
|
__pCLIENT->reference_count++; \
|
||||||
(__cTX)->client = __pCLIENT; \
|
(__cTX)->client = __pCLIENT; \
|
||||||
} while(0)
|
} while(0)
|
||||||
typedef struct ogs_sbi_client_s {
|
typedef struct ogs_sbi_client_s {
|
||||||
|
@ -51,15 +53,15 @@ typedef struct ogs_sbi_client_s {
|
||||||
|
|
||||||
void *multi; /* CURL multi handle */
|
void *multi; /* CURL multi handle */
|
||||||
int still_running; /* number of running CURL handle */
|
int still_running; /* number of running CURL handle */
|
||||||
|
|
||||||
|
unsigned int reference_count; /* reference count for memory free */
|
||||||
} ogs_sbi_client_t;
|
} ogs_sbi_client_t;
|
||||||
|
|
||||||
void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool);
|
void ogs_sbi_client_init(int num_of_sockinfo_pool, int num_of_connection_pool);
|
||||||
void ogs_sbi_client_final(void);
|
void ogs_sbi_client_final(void);
|
||||||
|
|
||||||
ogs_sbi_client_t *ogs_sbi_client_add(ogs_sockaddr_t *addr);
|
ogs_sbi_client_t *ogs_sbi_client_add(ogs_sockaddr_t *addr);
|
||||||
ogs_sbi_client_t *ogs_sbi_client_find_or_add(char *uri);
|
|
||||||
void ogs_sbi_client_remove(ogs_sbi_client_t *client);
|
void ogs_sbi_client_remove(ogs_sbi_client_t *client);
|
||||||
void ogs_sbi_client_remove_all(void);
|
|
||||||
ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr);
|
ogs_sbi_client_t *ogs_sbi_client_find(ogs_sockaddr_t *addr);
|
||||||
|
|
||||||
void ogs_sbi_client_send_request(
|
void ogs_sbi_client_send_request(
|
||||||
|
|
|
@ -44,17 +44,17 @@ void ogs_sbi_context_init(ogs_pollset_t *pollset, ogs_timer_mgr_t *timer_mgr)
|
||||||
|
|
||||||
ogs_log_install_domain(&__ogs_sbi_domain, "sbi", ogs_core()->log.level);
|
ogs_log_install_domain(&__ogs_sbi_domain, "sbi", ogs_core()->log.level);
|
||||||
|
|
||||||
/* FIXME : number of pool size */
|
ogs_sbi_message_init(
|
||||||
ogs_sbi_message_init(32, 32);
|
ogs_config()->pool.sbi_message, ogs_config()->pool.sbi_message);
|
||||||
ogs_sbi_server_init(32);
|
ogs_sbi_server_init(ogs_config()->max.nf);
|
||||||
ogs_sbi_client_init(512, 512);
|
ogs_sbi_client_init(ogs_config()->max.nf, ogs_config()->max.nf);
|
||||||
|
|
||||||
ogs_list_init(&self.nf_instance_list);
|
ogs_list_init(&self.nf_instance_list);
|
||||||
ogs_pool_init(&nf_instance_pool, ogs_config()->pool.sbi);
|
ogs_pool_init(&nf_instance_pool, ogs_config()->max.nf);
|
||||||
ogs_pool_init(&nf_service_pool, ogs_config()->pool.sbi);
|
ogs_pool_init(&nf_service_pool, ogs_config()->pool.nf_service);
|
||||||
|
|
||||||
ogs_list_init(&self.subscription_list);
|
ogs_list_init(&self.subscription_list);
|
||||||
ogs_pool_init(&subscription_pool, ogs_config()->pool.sbi);
|
ogs_pool_init(&subscription_pool, ogs_config()->pool.nf_subscription);
|
||||||
|
|
||||||
ogs_uuid_get(&self.uuid);
|
ogs_uuid_get(&self.uuid);
|
||||||
ogs_uuid_format(self.nf_instance_id, &self.uuid);
|
ogs_uuid_format(self.nf_instance_id, &self.uuid);
|
||||||
|
@ -303,6 +303,7 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
|
||||||
ogs_yaml_iter_t sbi_array, sbi_iter;
|
ogs_yaml_iter_t sbi_array, sbi_iter;
|
||||||
ogs_yaml_iter_recurse(&remote_iter, &sbi_array);
|
ogs_yaml_iter_recurse(&remote_iter, &sbi_array);
|
||||||
do {
|
do {
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||||
ogs_sbi_client_t *client = NULL;
|
ogs_sbi_client_t *client = NULL;
|
||||||
ogs_sockaddr_t *addr = NULL;
|
ogs_sockaddr_t *addr = NULL;
|
||||||
int family = AF_UNSPEC;
|
int family = AF_UNSPEC;
|
||||||
|
@ -400,6 +401,12 @@ int ogs_sbi_context_parse_config(const char *local, const char *remote)
|
||||||
client = ogs_sbi_client_add(addr);
|
client = ogs_sbi_client_add(addr);
|
||||||
ogs_assert(client);
|
ogs_assert(client);
|
||||||
|
|
||||||
|
nf_instance = ogs_sbi_nf_instance_add(
|
||||||
|
ogs_sbi_self()->nf_instance_id);
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
OGS_SETUP_SBI_CLIENT(nf_instance, client);
|
||||||
|
|
||||||
if (key) client->tls.key = key;
|
if (key) client->tls.key = key;
|
||||||
if (pem) client->tls.pem = pem;
|
if (pem) client->tls.pem = pem;
|
||||||
|
|
||||||
|
@ -428,6 +435,8 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_add(char *id)
|
||||||
ogs_assert(nf_instance);
|
ogs_assert(nf_instance);
|
||||||
memset(nf_instance, 0, sizeof(ogs_sbi_nf_instance_t));
|
memset(nf_instance, 0, sizeof(ogs_sbi_nf_instance_t));
|
||||||
|
|
||||||
|
nf_instance->reference_count++;
|
||||||
|
|
||||||
nf_instance->id = ogs_strdup(id);
|
nf_instance->id = ogs_strdup(id);
|
||||||
ogs_assert(nf_instance->id);
|
ogs_assert(nf_instance->id);
|
||||||
|
|
||||||
|
@ -453,7 +462,6 @@ void ogs_sbi_nf_instance_clear(ogs_sbi_nf_instance_t *nf_instance)
|
||||||
ogs_freeaddrinfo(nf_instance->ipv6[i]);
|
ogs_freeaddrinfo(nf_instance->ipv6[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
ogs_sbi_nf_service_remove_all(nf_instance);
|
ogs_sbi_nf_service_remove_all(nf_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -461,6 +469,10 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
|
||||||
{
|
{
|
||||||
ogs_assert(nf_instance);
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
nf_instance->reference_count--;
|
||||||
|
if (nf_instance->reference_count > 0)
|
||||||
|
return;
|
||||||
|
|
||||||
ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance);
|
ogs_list_remove(&ogs_sbi_self()->nf_instance_list, nf_instance);
|
||||||
|
|
||||||
ogs_sbi_subscription_remove_all_by_nf_instance_id(nf_instance->id);
|
ogs_sbi_subscription_remove_all_by_nf_instance_id(nf_instance->id);
|
||||||
|
@ -470,6 +482,9 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
|
||||||
|
|
||||||
ogs_sbi_nf_instance_clear(nf_instance);
|
ogs_sbi_nf_instance_clear(nf_instance);
|
||||||
|
|
||||||
|
if (nf_instance->client)
|
||||||
|
ogs_sbi_client_remove(nf_instance->client);
|
||||||
|
|
||||||
ogs_pool_free(&nf_instance_pool, nf_instance);
|
ogs_pool_free(&nf_instance_pool, nf_instance);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -497,53 +512,6 @@ ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find(char *id)
|
||||||
return nf_instance;
|
return nf_instance;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_build_default(
|
|
||||||
OpenAPI_nf_type_e nf_type, ogs_sbi_client_t *client)
|
|
||||||
{
|
|
||||||
ogs_sbi_server_t *server = NULL;
|
|
||||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
|
||||||
char *hostname = NULL;
|
|
||||||
|
|
||||||
nf_instance = ogs_sbi_nf_instance_add(ogs_sbi_self()->nf_instance_id);
|
|
||||||
ogs_assert(nf_instance);
|
|
||||||
|
|
||||||
nf_instance->nf_type = nf_type;
|
|
||||||
nf_instance->nf_status = OpenAPI_nf_status_REGISTERED;
|
|
||||||
OGS_SETUP_SBI_CLIENT(nf_instance, client);
|
|
||||||
|
|
||||||
hostname = NULL;
|
|
||||||
ogs_list_for_each(&ogs_sbi_self()->server_list, server) {
|
|
||||||
ogs_assert(server->addr);
|
|
||||||
|
|
||||||
/* First FQDN is selected */
|
|
||||||
if (!hostname) {
|
|
||||||
hostname = ogs_gethostname(server->addr);
|
|
||||||
if (hostname)
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
|
|
||||||
ogs_sockaddr_t *addr = NULL;
|
|
||||||
ogs_copyaddrinfo(&addr, server->addr);
|
|
||||||
ogs_assert(addr);
|
|
||||||
|
|
||||||
if (addr->ogs_sa_family == AF_INET) {
|
|
||||||
nf_instance->ipv4[nf_instance->num_of_ipv4] = addr;
|
|
||||||
nf_instance->num_of_ipv4++;
|
|
||||||
} else if (addr->ogs_sa_family == AF_INET6) {
|
|
||||||
nf_instance->ipv6[nf_instance->num_of_ipv6] = addr;
|
|
||||||
nf_instance->num_of_ipv6++;
|
|
||||||
} else
|
|
||||||
ogs_assert_if_reached();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (hostname)
|
|
||||||
strcpy(nf_instance->fqdn, hostname);
|
|
||||||
|
|
||||||
return nf_instance;
|
|
||||||
}
|
|
||||||
|
|
||||||
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(ogs_sbi_nf_instance_t *nf_instance,
|
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)
|
char *id, char *name, OpenAPI_uri_scheme_e scheme)
|
||||||
{
|
{
|
||||||
|
@ -592,21 +560,14 @@ void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
void ogs_sbi_nf_service_remove(ogs_sbi_nf_instance_t *nf_instance,
|
void ogs_sbi_nf_service_clear(ogs_sbi_nf_service_t *nf_service)
|
||||||
ogs_sbi_nf_service_t *nf_service)
|
|
||||||
{
|
{
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
ogs_assert(nf_instance);
|
|
||||||
ogs_assert(nf_service);
|
ogs_assert(nf_service);
|
||||||
|
nf_instance = nf_service->nf_instance;
|
||||||
ogs_list_remove(&nf_instance->nf_service_list, nf_service);
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
ogs_assert(nf_service->id);
|
|
||||||
ogs_free(nf_service->id);
|
|
||||||
|
|
||||||
ogs_assert(nf_service->name);
|
|
||||||
ogs_free(nf_service->name);
|
|
||||||
|
|
||||||
for (i = 0; i < nf_service->num_of_version; i++) {
|
for (i = 0; i < nf_service->num_of_version; i++) {
|
||||||
if (nf_service->versions[i].in_uri)
|
if (nf_service->versions[i].in_uri)
|
||||||
|
@ -623,6 +584,28 @@ void ogs_sbi_nf_service_remove(ogs_sbi_nf_instance_t *nf_instance,
|
||||||
if (nf_service->addr[i].ipv6)
|
if (nf_service->addr[i].ipv6)
|
||||||
ogs_freeaddrinfo(nf_service->addr[i].ipv6);
|
ogs_freeaddrinfo(nf_service->addr[i].ipv6);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
void ogs_sbi_nf_service_remove(ogs_sbi_nf_service_t *nf_service)
|
||||||
|
{
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
||||||
|
|
||||||
|
ogs_assert(nf_service);
|
||||||
|
nf_instance = nf_service->nf_instance;
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
ogs_list_remove(&nf_instance->nf_service_list, nf_service);
|
||||||
|
|
||||||
|
ogs_assert(nf_service->id);
|
||||||
|
ogs_free(nf_service->id);
|
||||||
|
|
||||||
|
ogs_assert(nf_service->name);
|
||||||
|
ogs_free(nf_service->name);
|
||||||
|
|
||||||
|
ogs_sbi_nf_service_clear(nf_service);
|
||||||
|
|
||||||
|
if (nf_service->client)
|
||||||
|
ogs_sbi_client_remove(nf_service->client);
|
||||||
|
|
||||||
ogs_pool_free(&nf_service_pool, nf_service);
|
ogs_pool_free(&nf_service_pool, nf_service);
|
||||||
}
|
}
|
||||||
|
@ -635,7 +618,7 @@ void ogs_sbi_nf_service_remove_all(ogs_sbi_nf_instance_t *nf_instance)
|
||||||
|
|
||||||
ogs_list_for_each_safe(&nf_instance->nf_service_list,
|
ogs_list_for_each_safe(&nf_instance->nf_service_list,
|
||||||
next_nf_service, nf_service)
|
next_nf_service, nf_service)
|
||||||
ogs_sbi_nf_service_remove(nf_instance, nf_service);
|
ogs_sbi_nf_service_remove(nf_service);
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_nf_service_t *ogs_sbi_nf_service_find(
|
ogs_sbi_nf_service_t *ogs_sbi_nf_service_find(
|
||||||
|
@ -655,11 +638,53 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_find(
|
||||||
return nf_service;
|
return nf_service;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
|
void ogs_sbi_nf_instance_build_default(
|
||||||
ogs_sbi_nf_instance_t *nf_instance,
|
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type)
|
||||||
char *name, ogs_sbi_client_t *client)
|
|
||||||
{
|
{
|
||||||
ogs_sbi_server_t *server = NULL;
|
ogs_sbi_server_t *server = NULL;
|
||||||
|
char *hostname = NULL;
|
||||||
|
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
nf_instance->nf_type = nf_type;
|
||||||
|
nf_instance->nf_status = OpenAPI_nf_status_REGISTERED;
|
||||||
|
|
||||||
|
hostname = NULL;
|
||||||
|
ogs_list_for_each(&ogs_sbi_self()->server_list, server) {
|
||||||
|
ogs_assert(server->addr);
|
||||||
|
|
||||||
|
/* First FQDN is selected */
|
||||||
|
if (!hostname) {
|
||||||
|
hostname = ogs_gethostname(server->addr);
|
||||||
|
if (hostname)
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nf_instance->num_of_ipv4 < OGS_SBI_MAX_NUM_OF_IP_ADDRESS) {
|
||||||
|
ogs_sockaddr_t *addr = NULL;
|
||||||
|
ogs_copyaddrinfo(&addr, server->addr);
|
||||||
|
ogs_assert(addr);
|
||||||
|
|
||||||
|
if (addr->ogs_sa_family == AF_INET) {
|
||||||
|
nf_instance->ipv4[nf_instance->num_of_ipv4] = addr;
|
||||||
|
nf_instance->num_of_ipv4++;
|
||||||
|
} else if (addr->ogs_sa_family == AF_INET6) {
|
||||||
|
nf_instance->ipv6[nf_instance->num_of_ipv6] = addr;
|
||||||
|
nf_instance->num_of_ipv6++;
|
||||||
|
} else
|
||||||
|
ogs_assert_if_reached();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (hostname)
|
||||||
|
strcpy(nf_instance->fqdn, hostname);
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance, char *name)
|
||||||
|
{
|
||||||
|
ogs_sbi_server_t *server = NULL;
|
||||||
|
ogs_sbi_client_t *client = NULL;
|
||||||
ogs_sbi_nf_service_t *nf_service = NULL;
|
ogs_sbi_nf_service_t *nf_service = NULL;
|
||||||
ogs_uuid_t uuid;
|
ogs_uuid_t uuid;
|
||||||
char id[OGS_UUID_FORMATTED_LENGTH + 1];
|
char id[OGS_UUID_FORMATTED_LENGTH + 1];
|
||||||
|
@ -667,11 +692,13 @@ ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
|
||||||
|
|
||||||
ogs_assert(nf_instance);
|
ogs_assert(nf_instance);
|
||||||
ogs_assert(name);
|
ogs_assert(name);
|
||||||
ogs_assert(client);
|
|
||||||
|
|
||||||
ogs_uuid_get(&uuid);
|
ogs_uuid_get(&uuid);
|
||||||
ogs_uuid_format(id, &uuid);
|
ogs_uuid_format(id, &uuid);
|
||||||
|
|
||||||
|
client = nf_instance->client;
|
||||||
|
ogs_assert(client);
|
||||||
|
|
||||||
nf_service = ogs_sbi_nf_service_add(nf_instance, id, name,
|
nf_service = ogs_sbi_nf_service_add(nf_instance, id, name,
|
||||||
(client->tls.key && client->tls.pem) ?
|
(client->tls.key && client->tls.pem) ?
|
||||||
OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http);
|
OpenAPI_uri_scheme_https : OpenAPI_uri_scheme_http);
|
||||||
|
@ -744,7 +771,7 @@ static ogs_sbi_client_t *find_client_by_fqdn(char *fqdn, int port)
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_client_t *ogs_sbi_nf_instance_find_client(
|
static ogs_sbi_client_t *nf_instance_find_client(
|
||||||
ogs_sbi_nf_instance_t *nf_instance)
|
ogs_sbi_nf_instance_t *nf_instance)
|
||||||
{
|
{
|
||||||
ogs_sbi_client_t *client = NULL;
|
ogs_sbi_client_t *client = NULL;
|
||||||
|
@ -767,13 +794,10 @@ ogs_sbi_client_t *ogs_sbi_nf_instance_find_client(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_nf_service_find_client_all(nf_instance);
|
|
||||||
|
|
||||||
return client;
|
return client;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_client_t *ogs_sbi_nf_service_find_client(
|
static void nf_service_associate_client(ogs_sbi_nf_service_t *nf_service)
|
||||||
ogs_sbi_nf_service_t *nf_service)
|
|
||||||
{
|
{
|
||||||
ogs_sbi_client_t *client = NULL;
|
ogs_sbi_client_t *client = NULL;
|
||||||
ogs_sockaddr_t *addr = NULL;
|
ogs_sockaddr_t *addr = NULL;
|
||||||
|
@ -798,24 +822,121 @@ ogs_sbi_client_t *ogs_sbi_nf_service_find_client(
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!client) {
|
if (client) {
|
||||||
ogs_sbi_nf_instance_t *nf_instance = NULL;
|
if (nf_service->client && nf_service->client != client) {
|
||||||
nf_instance = nf_service->nf_instance;
|
ogs_warn("NF EndPoint updated [%s]", nf_service->id);
|
||||||
ogs_assert(nf_instance);
|
ogs_sbi_client_remove(nf_service->client);
|
||||||
client = nf_instance->client;
|
}
|
||||||
|
OGS_SETUP_SBI_CLIENT(nf_service, client);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return client;
|
static void nf_service_associate_client_all(ogs_sbi_nf_instance_t *nf_instance)
|
||||||
}
|
|
||||||
|
|
||||||
void ogs_sbi_nf_service_find_client_all(ogs_sbi_nf_instance_t *nf_instance)
|
|
||||||
{
|
{
|
||||||
ogs_sbi_nf_service_t *nf_service = NULL;
|
ogs_sbi_nf_service_t *nf_service = NULL;
|
||||||
|
|
||||||
ogs_assert(nf_instance);
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
ogs_list_for_each(&nf_instance->nf_service_list, nf_service)
|
ogs_list_for_each(&nf_instance->nf_service_list, nf_service)
|
||||||
ogs_sbi_nf_service_find_client(nf_service);
|
nf_service_associate_client(nf_service);
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ogs_sbi_nf_types_associate(
|
||||||
|
ogs_sbi_nf_types_t nf_types, OpenAPI_nf_type_e nf_type, 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_types, 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_types[OpenAPI_nf_type_NRF].nf_instance);
|
||||||
|
}
|
||||||
|
OGS_SETUP_SBI_NF_INSTANCE(
|
||||||
|
&nf_types[OpenAPI_nf_type_NRF], nf_instance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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_types, nf_type)) {
|
||||||
|
ogs_warn("%s-EndPoint updated [%s]",
|
||||||
|
OpenAPI_nf_type_ToString(nf_type),
|
||||||
|
nf_instance->id);
|
||||||
|
ogs_sbi_nf_instance_remove(
|
||||||
|
nf_types[nf_type].nf_instance);
|
||||||
|
}
|
||||||
|
OGS_SETUP_SBI_NF_INSTANCE(
|
||||||
|
&nf_types[nf_type], nf_instance);
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance)
|
||||||
|
{
|
||||||
|
ogs_sbi_client_t *client = NULL;
|
||||||
|
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
client = nf_instance_find_client(nf_instance);
|
||||||
|
if (!client) return false;
|
||||||
|
|
||||||
|
if (nf_instance->client && nf_instance->client != client) {
|
||||||
|
ogs_warn("NF EndPoint updated [%s]", nf_instance->id);
|
||||||
|
ogs_sbi_client_remove(nf_instance->client);
|
||||||
|
}
|
||||||
|
|
||||||
|
OGS_SETUP_SBI_CLIENT(nf_instance, client);
|
||||||
|
|
||||||
|
nf_service_associate_client_all(nf_instance);
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance, char *name)
|
||||||
|
{
|
||||||
|
ogs_sbi_nf_service_t *nf_service = NULL;
|
||||||
|
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
ogs_assert(name);
|
||||||
|
|
||||||
|
ogs_list_for_each(&nf_instance->nf_service_list, nf_service) {
|
||||||
|
ogs_assert(nf_service->name);
|
||||||
|
if (strcmp(nf_service->name, name) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (nf_service)
|
||||||
|
return nf_service->client;
|
||||||
|
else
|
||||||
|
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;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void)
|
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void)
|
||||||
|
@ -860,6 +981,9 @@ void ogs_sbi_subscription_remove(ogs_sbi_subscription_t *subscription)
|
||||||
if (subscription->t_validity)
|
if (subscription->t_validity)
|
||||||
ogs_timer_delete(subscription->t_validity);
|
ogs_timer_delete(subscription->t_validity);
|
||||||
|
|
||||||
|
if (subscription->client)
|
||||||
|
ogs_sbi_client_remove(subscription->client);
|
||||||
|
|
||||||
ogs_pool_free(&subscription_pool, subscription);
|
ogs_pool_free(&subscription_pool, subscription);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -28,6 +28,8 @@
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#define OGS_SBI_MAX_NF_TYPE 64
|
||||||
|
|
||||||
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
|
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
|
||||||
typedef struct ogs_sbi_context_s {
|
typedef struct ogs_sbi_context_s {
|
||||||
ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */
|
ogs_pollset_t *pollset; /* Poll Set for I/O Multiplexing */
|
||||||
|
@ -48,6 +50,14 @@ typedef struct ogs_sbi_context_s {
|
||||||
const char *content_encoding;
|
const char *content_encoding;
|
||||||
} ogs_sbi_context_t;
|
} 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) \
|
||||||
|
__pNF_INSTANCE->reference_count++; \
|
||||||
|
(__cTX)->nf_instance = __pNF_INSTANCE; \
|
||||||
|
} while(0)
|
||||||
typedef struct ogs_sbi_nf_instance_s {
|
typedef struct ogs_sbi_nf_instance_s {
|
||||||
ogs_lnode_t lnode;
|
ogs_lnode_t lnode;
|
||||||
|
|
||||||
|
@ -85,8 +95,15 @@ typedef struct ogs_sbi_nf_instance_s {
|
||||||
ogs_list_t nf_service_list;
|
ogs_list_t nf_service_list;
|
||||||
|
|
||||||
void *client; /* only used in CLIENT */
|
void *client; /* only used in CLIENT */
|
||||||
|
unsigned int reference_count; /* reference count for memory free */
|
||||||
} ogs_sbi_nf_instance_t;
|
} ogs_sbi_nf_instance_t;
|
||||||
|
|
||||||
|
#define OGS_SBI_NF_INSTANCE_GET(__aRRAY, __nFType) \
|
||||||
|
((__aRRAY)[__nFType].nf_instance)
|
||||||
|
typedef struct ogs_sbi_nf_types_s {
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance;
|
||||||
|
} ogs_sbi_nf_types_t[OGS_SBI_MAX_NF_TYPE];
|
||||||
|
|
||||||
typedef struct ogs_sbi_nf_service_s {
|
typedef struct ogs_sbi_nf_service_s {
|
||||||
ogs_lnode_t lnode;
|
ogs_lnode_t lnode;
|
||||||
|
|
||||||
|
@ -145,28 +162,30 @@ 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(ogs_sbi_nf_instance_t *nf_instance);
|
||||||
void ogs_sbi_nf_instance_remove_all(void);
|
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(char *id);
|
||||||
|
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_find_by_nf_type(
|
||||||
ogs_sbi_nf_instance_t *ogs_sbi_nf_instance_build_default(
|
OpenAPI_nf_type_e nf_type);
|
||||||
OpenAPI_nf_type_e nf_type, ogs_sbi_client_t *client);
|
|
||||||
|
|
||||||
ogs_sbi_nf_service_t *ogs_sbi_nf_service_add(ogs_sbi_nf_instance_t *nf_instance,
|
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);
|
char *id, char *name, OpenAPI_uri_scheme_e scheme);
|
||||||
void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service,
|
void ogs_sbi_nf_service_add_version(ogs_sbi_nf_service_t *nf_service,
|
||||||
char *in_uri, char *full, char *expiry);
|
char *in_uri, char *full, char *expiry);
|
||||||
void ogs_sbi_nf_service_remove(ogs_sbi_nf_instance_t *nf_instance,
|
void ogs_sbi_nf_service_clear(ogs_sbi_nf_service_t *nf_service);
|
||||||
ogs_sbi_nf_service_t *nf_service);
|
void ogs_sbi_nf_service_remove(ogs_sbi_nf_service_t *nf_service);
|
||||||
void ogs_sbi_nf_service_remove_all(ogs_sbi_nf_instance_t *nf_instance);
|
void ogs_sbi_nf_service_remove_all(ogs_sbi_nf_instance_t *nf_instance);
|
||||||
ogs_sbi_nf_service_t *ogs_sbi_nf_service_find(
|
ogs_sbi_nf_service_t *ogs_sbi_nf_service_find(
|
||||||
ogs_sbi_nf_instance_t *nf_instance, char *name);
|
ogs_sbi_nf_instance_t *nf_instance, char *name);
|
||||||
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
|
|
||||||
ogs_sbi_nf_instance_t *nf_instance,
|
|
||||||
char *name, ogs_sbi_client_t *client);
|
|
||||||
|
|
||||||
ogs_sbi_client_t *ogs_sbi_nf_instance_find_client(
|
void ogs_sbi_nf_instance_build_default(
|
||||||
ogs_sbi_nf_instance_t *nf_instance);
|
ogs_sbi_nf_instance_t *nf_instance, OpenAPI_nf_type_e nf_type);
|
||||||
ogs_sbi_client_t *ogs_sbi_nf_service_find_client(
|
ogs_sbi_nf_service_t *ogs_sbi_nf_service_build_default(
|
||||||
ogs_sbi_nf_service_t *nf_service);
|
ogs_sbi_nf_instance_t *nf_instance, char *name);
|
||||||
void ogs_sbi_nf_service_find_client_all(ogs_sbi_nf_instance_t *nf_instance);
|
|
||||||
|
ogs_sbi_client_t *ogs_sbi_client_find_by_service_name(
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance, char *name);
|
||||||
|
|
||||||
|
bool ogs_sbi_client_associate(ogs_sbi_nf_instance_t *nf_instance);
|
||||||
|
bool ogs_sbi_nf_types_associate(
|
||||||
|
ogs_sbi_nf_types_t nf_types, OpenAPI_nf_type_e nf_type, void *state);
|
||||||
|
|
||||||
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void);
|
ogs_sbi_subscription_t *ogs_sbi_subscription_add(void);
|
||||||
void ogs_sbi_subscription_set_id(
|
void ogs_sbi_subscription_set_id(
|
||||||
|
|
|
@ -21,18 +21,15 @@
|
||||||
|
|
||||||
#include "sbi-private.h"
|
#include "sbi-private.h"
|
||||||
|
|
||||||
static char *ogs_uridup(bool https, ogs_sockaddr_t *addr,
|
static char *ogs_uridup(bool https, ogs_sockaddr_t *addr, ogs_sbi_header_t *h)
|
||||||
const char *service_name, const char *api_version,
|
|
||||||
const char *resource_name, const char *resource_id)
|
|
||||||
{
|
{
|
||||||
char buf[OGS_ADDRSTRLEN];
|
char buf[OGS_ADDRSTRLEN];
|
||||||
char url[OGS_HUGE_LEN];
|
char url[OGS_HUGE_LEN];
|
||||||
char *p, *last;
|
char *p, *last;
|
||||||
|
int i;
|
||||||
|
|
||||||
ogs_assert(addr);
|
ogs_assert(addr);
|
||||||
ogs_assert(service_name);
|
ogs_assert(h);
|
||||||
ogs_assert(api_version);
|
|
||||||
ogs_assert(resource_name);
|
|
||||||
|
|
||||||
p = url;
|
p = url;
|
||||||
last = url + OGS_HUGE_LEN;
|
last = url + OGS_HUGE_LEN;
|
||||||
|
@ -55,42 +52,44 @@ static char *ogs_uridup(bool https, ogs_sockaddr_t *addr,
|
||||||
}
|
}
|
||||||
|
|
||||||
/* API */
|
/* API */
|
||||||
ogs_assert(service_name);
|
ogs_assert(h->service.name);
|
||||||
p = ogs_slprintf(p, last, "/%s", service_name);
|
p = ogs_slprintf(p, last, "/%s", h->service.name);
|
||||||
ogs_assert(api_version);
|
ogs_assert(h->api.version);
|
||||||
p = ogs_slprintf(p, last, "/%s", api_version);
|
p = ogs_slprintf(p, last, "/%s", h->api.version);
|
||||||
|
|
||||||
/* Resource */
|
/* Resource */
|
||||||
ogs_assert(resource_name);
|
ogs_assert(h->resource.component[0]);
|
||||||
p = ogs_slprintf(p, last, "/%s", resource_name);
|
for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT &&
|
||||||
if (resource_id)
|
h->resource.component[i]; i++)
|
||||||
p = ogs_slprintf(p, last, "/%s", resource_id);
|
p = ogs_slprintf(p, last, "/%s", h->resource.component[i]);
|
||||||
|
|
||||||
return ogs_strdup(url);
|
return ogs_strdup(url);
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ogs_sbi_server_uri(ogs_sbi_server_t *server,
|
char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h)
|
||||||
const char *service_name, const char *api_version,
|
|
||||||
const char *resource_name, const char *resource_id)
|
|
||||||
{
|
{
|
||||||
bool https = false;
|
bool https = false;
|
||||||
|
|
||||||
|
ogs_assert(server);
|
||||||
|
ogs_assert(h);
|
||||||
|
|
||||||
if (server->tls.key && server->tls.pem)
|
if (server->tls.key && server->tls.pem)
|
||||||
https = true;
|
https = true;
|
||||||
|
|
||||||
return ogs_uridup(https, server->addr, service_name, api_version,
|
return ogs_uridup(https, server->addr, h);
|
||||||
resource_name, resource_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
char *ogs_sbi_client_uri(ogs_sbi_client_t *client,
|
char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h)
|
||||||
const char *service_name, const char *api_version,
|
|
||||||
const char *resource_name, const char *resource_id)
|
|
||||||
{
|
{
|
||||||
bool https = false;
|
bool https = false;
|
||||||
|
|
||||||
|
ogs_assert(client);
|
||||||
|
ogs_assert(h);
|
||||||
|
|
||||||
if (client->tls.key && client->tls.pem)
|
if (client->tls.key && client->tls.pem)
|
||||||
https = true;
|
https = true;
|
||||||
|
|
||||||
return ogs_uridup(https, client->addr, service_name, api_version,
|
return ogs_uridup(https, client->addr, h);
|
||||||
resource_name, resource_id);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -30,14 +30,10 @@ extern "C" {
|
||||||
|
|
||||||
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
|
typedef struct ogs_sbi_server_s ogs_sbi_server_t;
|
||||||
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
|
typedef struct ogs_sbi_client_s ogs_sbi_client_t;
|
||||||
|
typedef struct ogs_sbi_header_s ogs_sbi_header_t;
|
||||||
|
|
||||||
char *ogs_sbi_server_uri(ogs_sbi_server_t *server,
|
char *ogs_sbi_server_uri(ogs_sbi_server_t *server, ogs_sbi_header_t *h);
|
||||||
const char *service_name, const char *api_version,
|
char *ogs_sbi_client_uri(ogs_sbi_client_t *client, ogs_sbi_header_t *h);
|
||||||
const char *resource_name, const char *resource_id);
|
|
||||||
|
|
||||||
char *ogs_sbi_client_uri(ogs_sbi_client_t *client,
|
|
||||||
const char *service_name, const char *api_version,
|
|
||||||
const char *resource_name, const char *resource_id);
|
|
||||||
|
|
||||||
char *ogs_sbi_parse_url(char *url, const char *delim, char **saveptr);
|
char *ogs_sbi_parse_url(char *url, const char *delim, char **saveptr);
|
||||||
ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri);
|
ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri);
|
||||||
|
|
|
@ -30,6 +30,7 @@ libsbi_sources = files('''
|
||||||
|
|
||||||
nnrf-build.c
|
nnrf-build.c
|
||||||
nnrf-handler.c
|
nnrf-handler.c
|
||||||
|
path.c
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
||||||
libsbi_inc = include_directories('.')
|
libsbi_inc = include_directories('.')
|
||||||
|
|
|
@ -57,6 +57,26 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message)
|
||||||
OpenAPI_notification_data_free(message->NotificationData);
|
OpenAPI_notification_data_free(message->NotificationData);
|
||||||
if (message->SearchResult)
|
if (message->SearchResult)
|
||||||
OpenAPI_search_result_free(message->SearchResult);
|
OpenAPI_search_result_free(message->SearchResult);
|
||||||
|
if (message->AuthenticationInfo)
|
||||||
|
OpenAPI_authentication_info_free(message->AuthenticationInfo);
|
||||||
|
if (message->AuthenticationInfoRequest)
|
||||||
|
OpenAPI_authentication_info_request_free(
|
||||||
|
message->AuthenticationInfoRequest);
|
||||||
|
if (message->AuthenticationInfoResult)
|
||||||
|
OpenAPI_authentication_info_result_free(
|
||||||
|
message->AuthenticationInfoResult);
|
||||||
|
if (message->AuthenticationSubscription)
|
||||||
|
OpenAPI_authentication_subscription_free(
|
||||||
|
message->AuthenticationSubscription);
|
||||||
|
if (message->UeAuthenticationCtx)
|
||||||
|
OpenAPI_ue_authentication_ctx_free(message->UeAuthenticationCtx);
|
||||||
|
if (message->ConfirmationData)
|
||||||
|
OpenAPI_confirmation_data_free(message->ConfirmationData);
|
||||||
|
if (message->ConfirmationDataResponse)
|
||||||
|
OpenAPI_confirmation_data_response_free(
|
||||||
|
message->ConfirmationDataResponse);
|
||||||
|
if (message->AuthEvent)
|
||||||
|
OpenAPI_auth_event_free(message->AuthEvent);
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_request_t *ogs_sbi_request_new(void)
|
ogs_sbi_request_t *ogs_sbi_request_new(void)
|
||||||
|
@ -119,13 +139,16 @@ void ogs_sbi_response_free(ogs_sbi_response_t *response)
|
||||||
|
|
||||||
static void sbi_header_free(ogs_sbi_header_t *h)
|
static void sbi_header_free(ogs_sbi_header_t *h)
|
||||||
{
|
{
|
||||||
|
int i;
|
||||||
ogs_assert(h);
|
ogs_assert(h);
|
||||||
|
|
||||||
if (h->method) ogs_free(h->method);
|
if (h->method) ogs_free(h->method);
|
||||||
if (h->service.name) ogs_free(h->service.name);
|
if (h->service.name) ogs_free(h->service.name);
|
||||||
if (h->api.version) ogs_free(h->api.version);
|
if (h->api.version) ogs_free(h->api.version);
|
||||||
if (h->resource.name) ogs_free(h->resource.name);
|
|
||||||
if (h->resource.id) ogs_free(h->resource.id);
|
for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT &&
|
||||||
|
h->resource.component[i]; i++)
|
||||||
|
ogs_free(h->resource.component[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void http_message_free(http_message_t *http)
|
static void http_message_free(http_message_t *http)
|
||||||
|
@ -168,14 +191,18 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
||||||
if (message->h.url) {
|
if (message->h.url) {
|
||||||
request->h.url = ogs_strdup(message->h.url);
|
request->h.url = ogs_strdup(message->h.url);
|
||||||
} else {
|
} else {
|
||||||
|
int i;
|
||||||
|
|
||||||
ogs_assert(message->h.service.name);
|
ogs_assert(message->h.service.name);
|
||||||
request->h.service.name = ogs_strdup(message->h.service.name);
|
request->h.service.name = ogs_strdup(message->h.service.name);
|
||||||
ogs_assert(message->h.api.version);
|
ogs_assert(message->h.api.version);
|
||||||
request->h.api.version = ogs_strdup(message->h.api.version);
|
request->h.api.version = ogs_strdup(message->h.api.version);
|
||||||
ogs_assert(message->h.resource.name);
|
|
||||||
request->h.resource.name = ogs_strdup(message->h.resource.name);
|
ogs_assert(message->h.resource.component[0]);
|
||||||
if (message->h.resource.id)
|
for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT &&
|
||||||
request->h.resource.id = ogs_strdup(message->h.resource.id);
|
message->h.resource.component[i]; i++)
|
||||||
|
request->h.resource.component[i] = ogs_strdup(
|
||||||
|
message->h.resource.component[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
/* URL Param */
|
/* URL Param */
|
||||||
|
@ -213,6 +240,22 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
||||||
OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE);
|
OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (message->http.accept) {
|
||||||
|
ogs_sbi_header_set(request->http.headers, OGS_SBI_ACCEPT,
|
||||||
|
message->http.accept);
|
||||||
|
} else {
|
||||||
|
SWITCH(message->h.method)
|
||||||
|
CASE(OGS_SBI_HTTP_METHOD_DELETE)
|
||||||
|
ogs_sbi_header_set(request->http.headers, OGS_SBI_ACCEPT,
|
||||||
|
OGS_SBI_CONTENT_PROBLEM_TYPE);
|
||||||
|
break;
|
||||||
|
DEFAULT
|
||||||
|
ogs_sbi_header_set(request->http.headers, OGS_SBI_ACCEPT,
|
||||||
|
OGS_SBI_CONTENT_JSON_TYPE "," OGS_SBI_CONTENT_PROBLEM_TYPE);
|
||||||
|
break;
|
||||||
|
END
|
||||||
|
}
|
||||||
|
|
||||||
if (message->http.content_encoding)
|
if (message->http.content_encoding)
|
||||||
ogs_sbi_header_set(request->http.headers,
|
ogs_sbi_header_set(request->http.headers,
|
||||||
OGS_SBI_ACCEPT_ENCODING, message->http.content_encoding);
|
OGS_SBI_ACCEPT_ENCODING, message->http.content_encoding);
|
||||||
|
@ -220,7 +263,8 @@ ogs_sbi_request_t *ogs_sbi_build_request(ogs_sbi_message_t *message)
|
||||||
return request;
|
return request;
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_sbi_response_t *ogs_sbi_build_response(ogs_sbi_message_t *message)
|
ogs_sbi_response_t *ogs_sbi_build_response(
|
||||||
|
ogs_sbi_message_t *message, int status)
|
||||||
{
|
{
|
||||||
ogs_sbi_response_t *response = NULL;
|
ogs_sbi_response_t *response = NULL;
|
||||||
|
|
||||||
|
@ -229,7 +273,10 @@ ogs_sbi_response_t *ogs_sbi_build_response(ogs_sbi_message_t *message)
|
||||||
response = ogs_sbi_response_new();
|
response = ogs_sbi_response_new();
|
||||||
ogs_assert(response);
|
ogs_assert(response);
|
||||||
|
|
||||||
|
response->status = status;
|
||||||
|
|
||||||
/* HTTP Message */
|
/* HTTP Message */
|
||||||
|
if (response->status != OGS_SBI_HTTP_STATUS_NO_CONTENT) {
|
||||||
response->http.content = build_content(message);
|
response->http.content = build_content(message);
|
||||||
if (response->http.content) {
|
if (response->http.content) {
|
||||||
if (message->http.content_type)
|
if (message->http.content_type)
|
||||||
|
@ -239,9 +286,12 @@ ogs_sbi_response_t *ogs_sbi_build_response(ogs_sbi_message_t *message)
|
||||||
ogs_sbi_header_set(response->http.headers,
|
ogs_sbi_header_set(response->http.headers,
|
||||||
OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE);
|
OGS_SBI_CONTENT_TYPE, OGS_SBI_CONTENT_JSON_TYPE);
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if (message->http.location == true)
|
if (message->http.location) {
|
||||||
ogs_sbi_header_set(response->http.headers, "Location", message->h.url);
|
ogs_sbi_header_set(response->http.headers, "Location",
|
||||||
|
message->http.location);
|
||||||
|
}
|
||||||
if (message->http.cache_control)
|
if (message->http.cache_control)
|
||||||
ogs_sbi_header_set(response->http.headers, "Cache-Control",
|
ogs_sbi_header_set(response->http.headers, "Cache-Control",
|
||||||
message->http.cache_control);
|
message->http.cache_control);
|
||||||
|
@ -286,6 +336,37 @@ static char *build_content(ogs_sbi_message_t *message)
|
||||||
} else if (message->links) {
|
} else if (message->links) {
|
||||||
item = ogs_sbi_links_convertToJSON(message->links);
|
item = ogs_sbi_links_convertToJSON(message->links);
|
||||||
ogs_assert(item);
|
ogs_assert(item);
|
||||||
|
} else if (message->AuthenticationInfo) {
|
||||||
|
item = OpenAPI_authentication_info_convertToJSON(
|
||||||
|
message->AuthenticationInfo);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->AuthenticationInfoRequest) {
|
||||||
|
item = OpenAPI_authentication_info_request_convertToJSON(
|
||||||
|
message->AuthenticationInfoRequest);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->AuthenticationInfoResult) {
|
||||||
|
item = OpenAPI_authentication_info_result_convertToJSON(
|
||||||
|
message->AuthenticationInfoResult);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->AuthenticationSubscription) {
|
||||||
|
item = OpenAPI_authentication_subscription_convertToJSON(
|
||||||
|
message->AuthenticationSubscription);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->UeAuthenticationCtx) {
|
||||||
|
item = OpenAPI_ue_authentication_ctx_convertToJSON(
|
||||||
|
message->UeAuthenticationCtx);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->ConfirmationData) {
|
||||||
|
item = OpenAPI_confirmation_data_convertToJSON(
|
||||||
|
message->ConfirmationData);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->ConfirmationDataResponse) {
|
||||||
|
item = OpenAPI_confirmation_data_response_convertToJSON(
|
||||||
|
message->ConfirmationDataResponse);
|
||||||
|
ogs_assert(item);
|
||||||
|
} else if (message->AuthEvent) {
|
||||||
|
item = OpenAPI_auth_event_convertToJSON(message->AuthEvent);
|
||||||
|
ogs_assert(item);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (item) {
|
if (item) {
|
||||||
|
@ -341,6 +422,8 @@ int ogs_sbi_parse_request(
|
||||||
message->http.content_encoding = ogs_hash_this_val(hi);
|
message->http.content_encoding = ogs_hash_this_val(hi);
|
||||||
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
|
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
|
||||||
message->http.content_type = ogs_hash_this_val(hi);
|
message->http.content_type = ogs_hash_this_val(hi);
|
||||||
|
} else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_ACCEPT)) {
|
||||||
|
message->http.accept = ogs_hash_this_val(hi);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -369,18 +452,19 @@ int ogs_sbi_parse_response(
|
||||||
|
|
||||||
for (hi = ogs_hash_first(response->http.headers);
|
for (hi = ogs_hash_first(response->http.headers);
|
||||||
hi; hi = ogs_hash_next(hi)) {
|
hi; hi = ogs_hash_next(hi)) {
|
||||||
if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE)) {
|
if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_CONTENT_TYPE))
|
||||||
message->http.content_type = ogs_hash_this_val(hi);
|
message->http.content_type = ogs_hash_this_val(hi);
|
||||||
|
else if (!strcmp(ogs_hash_this_key(hi), OGS_SBI_LOCATION))
|
||||||
|
message->http.location = ogs_hash_this_val(hi);
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
message->res_status = response->status;
|
||||||
|
|
||||||
if (parse_content(message, response->http.content) != OGS_OK) {
|
if (parse_content(message, response->http.content) != OGS_OK) {
|
||||||
ogs_error("parse_content() failed");
|
ogs_error("parse_content() failed");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
message->res_status = response->status;
|
|
||||||
|
|
||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -391,6 +475,9 @@ static int parse_sbi_header(
|
||||||
char *saveptr = NULL;
|
char *saveptr = NULL;
|
||||||
char *url = NULL, *p = NULL;;
|
char *url = NULL, *p = NULL;;
|
||||||
|
|
||||||
|
char *component = NULL;
|
||||||
|
int i = 0;
|
||||||
|
|
||||||
ogs_assert(message);
|
ogs_assert(message);
|
||||||
ogs_assert(header);
|
ogs_assert(header);
|
||||||
|
|
||||||
|
@ -432,16 +519,12 @@ static int parse_sbi_header(
|
||||||
}
|
}
|
||||||
message->h.api.version = header->api.version;
|
message->h.api.version = header->api.version;
|
||||||
|
|
||||||
header->resource.name = ogs_sbi_parse_url(NULL, "/", &saveptr);
|
for (i = 0; i < OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT &&
|
||||||
if (!header->resource.name) {
|
(component = ogs_sbi_parse_url(NULL, "/", &saveptr)) != NULL;
|
||||||
ogs_error("ogs_sbi_parse_url() failed");
|
i++) {
|
||||||
ogs_free(url);
|
header->resource.component[i] = component;
|
||||||
return OGS_ERROR;
|
message->h.resource.component[i] = component;
|
||||||
}
|
}
|
||||||
message->h.resource.name = header->resource.name;
|
|
||||||
|
|
||||||
header->resource.id = ogs_sbi_parse_url(NULL, "/", &saveptr);
|
|
||||||
message->h.resource.id = header->resource.id;
|
|
||||||
|
|
||||||
ogs_free(url);
|
ogs_free(url);
|
||||||
|
|
||||||
|
@ -495,9 +578,9 @@ static int parse_content(ogs_sbi_message_t *message, char *content)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
SWITCH(message->h.service.name)
|
SWITCH(message->h.service.name)
|
||||||
CASE(OGS_SBI_SERVICE_NAME_NRF_NFM)
|
CASE(OGS_SBI_SERVICE_NAME_NNRF_NFM)
|
||||||
|
|
||||||
SWITCH(message->h.resource.name)
|
SWITCH(message->h.resource.component[0])
|
||||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||||
message->NFProfile =
|
message->NFProfile =
|
||||||
OpenAPI_nf_profile_parseFromJSON(item);
|
OpenAPI_nf_profile_parseFromJSON(item);
|
||||||
|
@ -528,12 +611,12 @@ static int parse_content(ogs_sbi_message_t *message, char *content)
|
||||||
DEFAULT
|
DEFAULT
|
||||||
rv = OGS_ERROR;
|
rv = OGS_ERROR;
|
||||||
ogs_error("Unknown resource name [%s]",
|
ogs_error("Unknown resource name [%s]",
|
||||||
message->h.resource.name);
|
message->h.resource.component[0]);
|
||||||
END
|
END
|
||||||
break;
|
break;
|
||||||
|
|
||||||
CASE(OGS_SBI_SERVICE_NAME_NRF_DISC)
|
CASE(OGS_SBI_SERVICE_NAME_NNRF_DISC)
|
||||||
SWITCH(message->h.resource.name)
|
SWITCH(message->h.resource.component[0])
|
||||||
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
CASE(OGS_SBI_RESOURCE_NAME_NF_INSTANCES)
|
||||||
message->SearchResult =
|
message->SearchResult =
|
||||||
OpenAPI_search_result_parseFromJSON(item);
|
OpenAPI_search_result_parseFromJSON(item);
|
||||||
|
@ -546,10 +629,153 @@ static int parse_content(ogs_sbi_message_t *message, char *content)
|
||||||
DEFAULT
|
DEFAULT
|
||||||
rv = OGS_ERROR;
|
rv = OGS_ERROR;
|
||||||
ogs_error("Unknown resource name [%s]",
|
ogs_error("Unknown resource name [%s]",
|
||||||
message->h.resource.name);
|
message->h.resource.component[0]);
|
||||||
END
|
END
|
||||||
break;
|
break;
|
||||||
|
|
||||||
|
CASE(OGS_SBI_SERVICE_NAME_NAUSF_AUTH)
|
||||||
|
SWITCH(message->h.resource.component[0])
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS)
|
||||||
|
SWITCH(message->h.method)
|
||||||
|
CASE(OGS_SBI_HTTP_METHOD_POST)
|
||||||
|
if (message->res_status ==
|
||||||
|
OGS_SBI_HTTP_STATUS_CREATED) {
|
||||||
|
message->UeAuthenticationCtx =
|
||||||
|
OpenAPI_ue_authentication_ctx_parseFromJSON(item);
|
||||||
|
if (!message->UeAuthenticationCtx) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message->AuthenticationInfo =
|
||||||
|
OpenAPI_authentication_info_parseFromJSON(item);
|
||||||
|
if (!message->AuthenticationInfo) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
CASE(OGS_SBI_HTTP_METHOD_PUT)
|
||||||
|
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||||
|
message->ConfirmationDataResponse =
|
||||||
|
OpenAPI_confirmation_data_response_parseFromJSON(item);
|
||||||
|
if (!message->ConfirmationDataResponse) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message->ConfirmationData =
|
||||||
|
OpenAPI_confirmation_data_parseFromJSON(item);
|
||||||
|
if (!message->ConfirmationData) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown method [%s]", message->h.method);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown resource name [%s]",
|
||||||
|
message->h.resource.component[0]);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
CASE(OGS_SBI_SERVICE_NAME_NUDM_UEAU)
|
||||||
|
SWITCH(message->h.resource.component[1])
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION)
|
||||||
|
SWITCH(message->h.resource.component[2])
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_GENERATE_AUTH_DATA)
|
||||||
|
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||||
|
message->AuthenticationInfoResult =
|
||||||
|
OpenAPI_authentication_info_result_parseFromJSON(
|
||||||
|
item);
|
||||||
|
if (!message->AuthenticationInfoResult) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
message->AuthenticationInfoRequest =
|
||||||
|
OpenAPI_authentication_info_request_parseFromJSON(
|
||||||
|
item);
|
||||||
|
if (!message->AuthenticationInfoRequest) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown resource name [%s]",
|
||||||
|
message->h.resource.component[2]);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_AUTH_EVENTS)
|
||||||
|
message->AuthEvent = OpenAPI_auth_event_parseFromJSON(item);
|
||||||
|
if (!message->AuthEvent) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown resource name [%s]",
|
||||||
|
message->h.resource.component[1]);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
CASE(OGS_SBI_SERVICE_NAME_NUDR_DR)
|
||||||
|
SWITCH(message->h.resource.component[0])
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA)
|
||||||
|
SWITCH(message->h.resource.component[2])
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_DATA)
|
||||||
|
SWITCH(message->h.resource.component[3])
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_SUBSCRIPTION)
|
||||||
|
if (message->res_status == OGS_SBI_HTTP_STATUS_OK) {
|
||||||
|
message->AuthenticationSubscription =
|
||||||
|
OpenAPI_authentication_subscription_parseFromJSON(item);
|
||||||
|
if (!message->AuthenticationSubscription) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
CASE(OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS)
|
||||||
|
message->AuthEvent =
|
||||||
|
OpenAPI_auth_event_parseFromJSON(item);
|
||||||
|
if (!message->AuthEvent) {
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("JSON parse error");
|
||||||
|
}
|
||||||
|
break;
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown resource name [%s]",
|
||||||
|
message->h.resource.component[3]);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown resource name [%s]",
|
||||||
|
message->h.resource.component[2]);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
DEFAULT
|
||||||
|
rv = OGS_ERROR;
|
||||||
|
ogs_error("Unknown resource name [%s]",
|
||||||
|
message->h.resource.component[0]);
|
||||||
|
END
|
||||||
|
break;
|
||||||
|
|
||||||
|
|
||||||
DEFAULT
|
DEFAULT
|
||||||
rv = OGS_ERROR;
|
rv = OGS_ERROR;
|
||||||
ogs_error("Not implemented API name [%s]",
|
ogs_error("Not implemented API name [%s]",
|
||||||
|
|
|
@ -77,22 +77,45 @@ extern "C" {
|
||||||
|
|
||||||
#define OGS_SBI_API_VERSION "v1"
|
#define OGS_SBI_API_VERSION "v1"
|
||||||
#define OGS_SBI_API_FULL_VERSION "1.0.0"
|
#define OGS_SBI_API_FULL_VERSION "1.0.0"
|
||||||
#define OGS_SBI_SERVICE_NAME_NRF_NFM "nnrf-nfm"
|
|
||||||
#define OGS_SBI_SERVICE_NAME_NRF_DISC "nnrf-disc"
|
|
||||||
#define OGS_SBI_SERVICE_NAME_SMF_PDUSESSION "nsmf-pdusession"
|
|
||||||
#define OGS_SBI_SERVICE_NAME_SMF_EVENT_EXPOSURE "nsmf-event-exposure"
|
|
||||||
|
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NNRF_NFM "nnrf-nfm"
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NNRF_DISC "nnrf-disc"
|
||||||
#define OGS_SBI_RESOURCE_NAME_NF_INSTANCES "nf-instances"
|
#define OGS_SBI_RESOURCE_NAME_NF_INSTANCES "nf-instances"
|
||||||
#define OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS "subscriptions"
|
#define OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS "subscriptions"
|
||||||
#define OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY "nf-status-notify"
|
#define OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY "nf-status-notify"
|
||||||
|
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NAUSF_AUTH "nausf-auth"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_UE_AUTHENTICATIONS "ue-authentications"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_5G_AKA "5g-aka"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_5G_AKA_CONFIRMATION "5g-aka-confirmation"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_EAP_SESSION "eap-session"
|
||||||
|
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NUDM_SDM "nudm-sdm"
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NUDM_UECM "nudm-uecm"
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NUDM_UEAU "nudm-ueau"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_SECURITY_INFORMATION "security-information"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_GENERATE_AUTH_DATA "generate-auth-data"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_AUTH_EVENTS "auth-events"
|
||||||
|
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NUDR_DR "nudr-dr"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_SUBSCRIPTION_DATA "subscription-data"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_AUTHENTICATION_DATA "authentication-data"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_AUTHENTICATION_SUBSCRIPTION \
|
||||||
|
"authentication-subscription"
|
||||||
|
#define OGS_SBI_RESOURCE_NAME_AUTHENTICATION_STATUS "authentication-status"
|
||||||
|
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NSMF_PDUSESSION "nsmf-pdusession"
|
||||||
|
#define OGS_SBI_SERVICE_NAME_NSMF_EVENT_EXPOSURE "nsmf-event-exposure"
|
||||||
|
|
||||||
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
|
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
|
||||||
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
|
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
|
||||||
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"
|
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"
|
||||||
#define OGS_SBI_PARAM_LIMIT "limit"
|
#define OGS_SBI_PARAM_LIMIT "limit"
|
||||||
|
|
||||||
|
#define OGS_SBI_ACCEPT "Accept"
|
||||||
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
|
#define OGS_SBI_ACCEPT_ENCODING "Accept-Encoding"
|
||||||
#define OGS_SBI_CONTENT_TYPE "Content-Type"
|
#define OGS_SBI_CONTENT_TYPE "Content-Type"
|
||||||
|
#define OGS_SBI_LOCATION "Location"
|
||||||
#define OGS_SBI_CONTENT_JSON_TYPE "application/json"
|
#define OGS_SBI_CONTENT_JSON_TYPE "application/json"
|
||||||
#define OGS_SBI_CONTENT_PROBLEM_TYPE "application/problem+json"
|
#define OGS_SBI_CONTENT_PROBLEM_TYPE "application/problem+json"
|
||||||
#define OGS_SBI_CONTENT_PATCH_TYPE \
|
#define OGS_SBI_CONTENT_PATCH_TYPE \
|
||||||
|
@ -115,18 +138,20 @@ typedef struct ogs_sbi_header_s {
|
||||||
} api;
|
} api;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
char *name;
|
#define OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT 8
|
||||||
char *id;
|
char *component[OGS_SBI_MAX_NUM_OF_RESOURCE_COMPONENT];
|
||||||
} resource;
|
} resource;
|
||||||
|
|
||||||
} ogs_sbi_header_t;
|
} ogs_sbi_header_t;
|
||||||
|
|
||||||
typedef struct ogs_sbi_message_s {
|
typedef struct ogs_sbi_message_s {
|
||||||
ogs_sbi_header_t h;
|
ogs_sbi_header_t h;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
|
char *accept;
|
||||||
char *content_encoding;
|
char *content_encoding;
|
||||||
char *content_type;
|
char *content_type;
|
||||||
bool location;
|
char *location;
|
||||||
char *cache_control;
|
char *cache_control;
|
||||||
} http;
|
} http;
|
||||||
|
|
||||||
|
@ -146,6 +171,14 @@ typedef struct ogs_sbi_message_s {
|
||||||
OpenAPI_subscription_data_t *SubscriptionData;
|
OpenAPI_subscription_data_t *SubscriptionData;
|
||||||
OpenAPI_notification_data_t *NotificationData;
|
OpenAPI_notification_data_t *NotificationData;
|
||||||
OpenAPI_search_result_t *SearchResult;
|
OpenAPI_search_result_t *SearchResult;
|
||||||
|
OpenAPI_authentication_info_t *AuthenticationInfo;
|
||||||
|
OpenAPI_authentication_info_request_t *AuthenticationInfoRequest;
|
||||||
|
OpenAPI_authentication_info_result_t *AuthenticationInfoResult;
|
||||||
|
OpenAPI_authentication_subscription_t *AuthenticationSubscription;
|
||||||
|
OpenAPI_ue_authentication_ctx_t *UeAuthenticationCtx;
|
||||||
|
OpenAPI_confirmation_data_t *ConfirmationData;
|
||||||
|
OpenAPI_confirmation_data_response_t *ConfirmationDataResponse;
|
||||||
|
OpenAPI_auth_event_t *AuthEvent;
|
||||||
|
|
||||||
ogs_sbi_links_t *links;
|
ogs_sbi_links_t *links;
|
||||||
} ogs_sbi_message_t;
|
} ogs_sbi_message_t;
|
||||||
|
@ -163,7 +196,8 @@ int ogs_sbi_parse_request(
|
||||||
|
|
||||||
ogs_sbi_response_t *ogs_sbi_response_new(void);
|
ogs_sbi_response_t *ogs_sbi_response_new(void);
|
||||||
void ogs_sbi_response_free(ogs_sbi_response_t *response);
|
void ogs_sbi_response_free(ogs_sbi_response_t *response);
|
||||||
ogs_sbi_response_t *ogs_sbi_build_response(ogs_sbi_message_t *message);
|
ogs_sbi_response_t *ogs_sbi_build_response(
|
||||||
|
ogs_sbi_message_t *message, int status);
|
||||||
int ogs_sbi_parse_response(
|
int ogs_sbi_parse_response(
|
||||||
ogs_sbi_message_t *message, ogs_sbi_response_t *response);
|
ogs_sbi_message_t *message, ogs_sbi_response_t *response);
|
||||||
|
|
||||||
|
|
|
@ -17,9 +17,9 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nnrf-build.h"
|
#include "ogs-sbi.h"
|
||||||
|
|
||||||
OpenAPI_nf_profile_t *ogs_sbi_nnrf_build_nf_profile(
|
OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
||||||
ogs_sbi_nf_instance_t *nf_instance)
|
ogs_sbi_nf_instance_t *nf_instance)
|
||||||
{
|
{
|
||||||
ogs_sbi_nf_service_t *nf_service = NULL;
|
ogs_sbi_nf_service_t *nf_service = NULL;
|
||||||
|
@ -212,3 +212,198 @@ void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile)
|
||||||
|
|
||||||
ogs_free(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_VERSION;
|
||||||
|
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->heart_beat_timer = nf_instance->time.heartbeat;
|
||||||
|
|
||||||
|
message.NFProfile = NFProfile;
|
||||||
|
|
||||||
|
request = ogs_sbi_build_request(&message);
|
||||||
|
ogs_assert(request);
|
||||||
|
|
||||||
|
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;
|
||||||
|
ogs_sbi_request_t *request = NULL;
|
||||||
|
|
||||||
|
OpenAPI_list_t *PatchItemList;
|
||||||
|
OpenAPI_patch_item_t item;
|
||||||
|
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
memset(&message, 0, sizeof(message));
|
||||||
|
message.h.method = (char *)OGS_SBI_HTTP_METHOD_PATCH;
|
||||||
|
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
|
||||||
|
message.h.api.version = (char *)OGS_SBI_API_VERSION;
|
||||||
|
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_type = (char *)OGS_SBI_CONTENT_PATCH_TYPE;
|
||||||
|
|
||||||
|
PatchItemList = OpenAPI_list_create();
|
||||||
|
ogs_assert(PatchItemList);
|
||||||
|
|
||||||
|
memset(&item, 0, sizeof(item));
|
||||||
|
item.op = OpenAPI_patch_operation_replace;
|
||||||
|
item.path = (char *)"/nfStatus";
|
||||||
|
item.value = OpenAPI_nf_status_ToString(OpenAPI_nf_status_REGISTERED);
|
||||||
|
|
||||||
|
OpenAPI_list_add(PatchItemList, &item);
|
||||||
|
|
||||||
|
message.PatchItemList = PatchItemList;
|
||||||
|
|
||||||
|
request = ogs_sbi_build_request(&message);
|
||||||
|
ogs_assert(request);
|
||||||
|
|
||||||
|
OpenAPI_list_free(PatchItemList);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_nfm_build_de_register(
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance)
|
||||||
|
{
|
||||||
|
ogs_sbi_message_t message;
|
||||||
|
ogs_sbi_request_t *request = NULL;
|
||||||
|
|
||||||
|
ogs_assert(nf_instance);
|
||||||
|
|
||||||
|
memset(&message, 0, sizeof(message));
|
||||||
|
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
|
||||||
|
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
|
||||||
|
message.h.api.version = (char *)OGS_SBI_API_VERSION;
|
||||||
|
message.h.resource.component[0] =
|
||||||
|
(char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES;
|
||||||
|
message.h.resource.component[1] = nf_instance->id;
|
||||||
|
|
||||||
|
request = ogs_sbi_build_request(&message);
|
||||||
|
ogs_assert(request);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
||||||
|
ogs_sbi_subscription_t *subscription)
|
||||||
|
{
|
||||||
|
ogs_sbi_message_t message;
|
||||||
|
ogs_sbi_header_t header;
|
||||||
|
ogs_sbi_request_t *request = NULL;
|
||||||
|
ogs_sbi_server_t *server = NULL;
|
||||||
|
|
||||||
|
OpenAPI_subscription_data_t *SubscriptionData = NULL;
|
||||||
|
|
||||||
|
ogs_assert(subscription);
|
||||||
|
ogs_assert(subscription->nf_type);
|
||||||
|
|
||||||
|
memset(&message, 0, sizeof(message));
|
||||||
|
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||||
|
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
|
||||||
|
message.h.api.version = (char *)OGS_SBI_API_VERSION;
|
||||||
|
message.h.resource.component[0] =
|
||||||
|
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
|
||||||
|
|
||||||
|
SubscriptionData = ogs_calloc(1, sizeof(*SubscriptionData));
|
||||||
|
ogs_assert(SubscriptionData);
|
||||||
|
|
||||||
|
server = ogs_list_first(&ogs_sbi_self()->server_list);
|
||||||
|
ogs_assert(server);
|
||||||
|
|
||||||
|
memset(&header, 0, sizeof(header));
|
||||||
|
header.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
|
||||||
|
header.api.version = (char *)OGS_SBI_API_VERSION;
|
||||||
|
header.resource.component[0] =
|
||||||
|
(char *)OGS_SBI_RESOURCE_NAME_NF_STATUS_NOTIFY;
|
||||||
|
SubscriptionData->nf_status_notification_uri =
|
||||||
|
ogs_sbi_server_uri(server, &header);
|
||||||
|
ogs_assert(SubscriptionData->nf_status_notification_uri);
|
||||||
|
|
||||||
|
SubscriptionData->req_nf_type = subscription->nf_type;
|
||||||
|
SubscriptionData->req_nf_instance_id = subscription->nf_instance_id;
|
||||||
|
|
||||||
|
message.SubscriptionData = SubscriptionData;
|
||||||
|
|
||||||
|
request = ogs_sbi_build_request(&message);
|
||||||
|
ogs_assert(request);
|
||||||
|
|
||||||
|
ogs_free(SubscriptionData->nf_status_notification_uri);
|
||||||
|
ogs_free(SubscriptionData);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
||||||
|
ogs_sbi_subscription_t *subscription)
|
||||||
|
{
|
||||||
|
ogs_sbi_message_t message;
|
||||||
|
ogs_sbi_request_t *request = NULL;
|
||||||
|
|
||||||
|
ogs_assert(subscription);
|
||||||
|
|
||||||
|
memset(&message, 0, sizeof(message));
|
||||||
|
message.h.method = (char *)OGS_SBI_HTTP_METHOD_DELETE;
|
||||||
|
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_NFM;
|
||||||
|
message.h.api.version = (char *)OGS_SBI_API_VERSION;
|
||||||
|
message.h.resource.component[0] =
|
||||||
|
(char *)OGS_SBI_RESOURCE_NAME_SUBSCRIPTIONS;
|
||||||
|
message.h.resource.component[1] = subscription->id;
|
||||||
|
|
||||||
|
request = ogs_sbi_build_request(&message);
|
||||||
|
ogs_assert(request);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
|
||||||
|
OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type)
|
||||||
|
{
|
||||||
|
ogs_sbi_message_t message;
|
||||||
|
ogs_sbi_request_t *request = NULL;
|
||||||
|
|
||||||
|
ogs_assert(target_nf_type);
|
||||||
|
ogs_assert(requester_nf_type);
|
||||||
|
|
||||||
|
memset(&message, 0, sizeof(message));
|
||||||
|
message.h.method = (char *)OGS_SBI_HTTP_METHOD_GET;
|
||||||
|
message.h.service.name = (char *)OGS_SBI_SERVICE_NAME_NNRF_DISC;
|
||||||
|
message.h.api.version = (char *)OGS_SBI_API_VERSION;
|
||||||
|
message.h.resource.component[0] =
|
||||||
|
(char *)OGS_SBI_RESOURCE_NAME_NF_INSTANCES;
|
||||||
|
|
||||||
|
message.param.target_nf_type = target_nf_type;
|
||||||
|
message.param.requester_nf_type = requester_nf_type;
|
||||||
|
|
||||||
|
request = ogs_sbi_build_request(&message);
|
||||||
|
ogs_assert(request);
|
||||||
|
|
||||||
|
return request;
|
||||||
|
}
|
||||||
|
|
|
@ -20,17 +20,29 @@
|
||||||
#ifndef OGS_NNRF_BUILD_H
|
#ifndef OGS_NNRF_BUILD_H
|
||||||
#define OGS_NNRF_BUILD_H
|
#define OGS_NNRF_BUILD_H
|
||||||
|
|
||||||
#include "ogs-sbi.h"
|
|
||||||
#include "context.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
OpenAPI_nf_profile_t *ogs_sbi_nnrf_build_nf_profile(
|
OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
||||||
ogs_sbi_nf_instance_t *nf_instance);
|
ogs_sbi_nf_instance_t *nf_instance);
|
||||||
void ogs_sbi_nnrf_free_nf_profile(OpenAPI_nf_profile_t *NFProfile);
|
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(
|
||||||
|
ogs_sbi_nf_instance_t *nf_instance);
|
||||||
|
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
||||||
|
ogs_sbi_subscription_t *subscription);
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_nfm_build_status_unsubscribe(
|
||||||
|
ogs_sbi_subscription_t *subscription);
|
||||||
|
|
||||||
|
ogs_sbi_request_t *ogs_nnrf_disc_build_discover(
|
||||||
|
OpenAPI_nf_type_e target_nf_type, OpenAPI_nf_type_e requester_nf_type);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -17,7 +17,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nnrf-handler.h"
|
#include "ogs-sbi.h"
|
||||||
|
|
||||||
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
|
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
|
||||||
OpenAPI_nf_profile_t *NFProfile,
|
OpenAPI_nf_profile_t *NFProfile,
|
||||||
|
@ -113,14 +113,22 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
|
||||||
ogs_sbi_nf_service_t *nf_service = NULL;
|
ogs_sbi_nf_service_t *nf_service = NULL;
|
||||||
|
|
||||||
if (!NFService) continue;
|
if (!NFService) continue;
|
||||||
|
if (!NFService->service_instance_id) continue;
|
||||||
|
if (!NFService->service_name) continue;
|
||||||
|
|
||||||
VersionList = NFService->versions;
|
VersionList = NFService->versions;
|
||||||
IpEndPointList = NFService->ip_end_points;
|
IpEndPointList = NFService->ip_end_points;
|
||||||
|
|
||||||
|
nf_service = ogs_sbi_nf_service_find(nf_instance,
|
||||||
|
NFService->service_name);
|
||||||
|
if (!nf_service) {
|
||||||
nf_service = ogs_sbi_nf_service_add(nf_instance,
|
nf_service = ogs_sbi_nf_service_add(nf_instance,
|
||||||
NFService->service_instance_id,
|
NFService->service_instance_id,
|
||||||
NFService->service_name, NFService->scheme);
|
NFService->service_name, NFService->scheme);
|
||||||
ogs_assert(nf_service);
|
ogs_assert(nf_service);
|
||||||
|
}
|
||||||
|
|
||||||
|
ogs_sbi_nf_service_clear(nf_service);
|
||||||
|
|
||||||
OpenAPI_list_for_each(VersionList, node2) {
|
OpenAPI_list_for_each(VersionList, node2) {
|
||||||
OpenAPI_nf_service_version_t *NFServiceVersion = node2->data;
|
OpenAPI_nf_service_version_t *NFServiceVersion = node2->data;
|
||||||
|
@ -174,11 +182,11 @@ bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
|
||||||
ipv4 = addr;
|
ipv4 = addr;
|
||||||
nf_service->addr[nf_service->num_of_addr].
|
nf_service->addr[nf_service->num_of_addr].
|
||||||
ipv6 = addr6;
|
ipv6 = addr6;
|
||||||
}
|
|
||||||
nf_service->num_of_addr++;
|
nf_service->num_of_addr++;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,6 @@
|
||||||
#ifndef OGS_NNRF_HANDLER_H
|
#ifndef OGS_NNRF_HANDLER_H
|
||||||
#define OGS_NNRF_HANDLER_H
|
#define OGS_NNRF_HANDLER_H
|
||||||
|
|
||||||
#include "ogs-sbi.h"
|
|
||||||
#include "context.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -35,6 +35,14 @@
|
||||||
#include "model/subscription_data.h"
|
#include "model/subscription_data.h"
|
||||||
#include "model/notification_data.h"
|
#include "model/notification_data.h"
|
||||||
#include "model/search_result.h"
|
#include "model/search_result.h"
|
||||||
|
#include "model/authentication_info.h"
|
||||||
|
#include "model/authentication_info_request.h"
|
||||||
|
#include "model/authentication_info_result.h"
|
||||||
|
#include "model/authentication_subscription.h"
|
||||||
|
#include "model/ue_authentication_ctx.h"
|
||||||
|
#include "model/confirmation_data.h"
|
||||||
|
#include "model/confirmation_data_response.h"
|
||||||
|
#include "model/auth_event.h"
|
||||||
|
|
||||||
#include "custom/links.h"
|
#include "custom/links.h"
|
||||||
|
|
||||||
|
@ -53,6 +61,7 @@
|
||||||
|
|
||||||
#include "sbi/nnrf-build.h"
|
#include "sbi/nnrf-build.h"
|
||||||
#include "sbi/nnrf-handler.h"
|
#include "sbi/nnrf-handler.h"
|
||||||
|
#include "sbi/path.h"
|
||||||
|
|
||||||
#undef OGS_SBI_INSIDE
|
#undef OGS_SBI_INSIDE
|
||||||
|
|
||||||
|
|
|
@ -3,4 +3,6 @@ templateDir: "../openapi/.openapi-generator/templates"
|
||||||
reservedWordMappings:
|
reservedWordMappings:
|
||||||
3GPP_ACCESS: "3GPP_ACCESS"
|
3GPP_ACCESS: "3GPP_ACCESS"
|
||||||
5G_EIR: "5G_EIR"
|
5G_EIR: "5G_EIR"
|
||||||
|
5G_AKA: "5G_AKA"
|
||||||
|
5G_HE_AKA: "5G_HE_AKA"
|
||||||
5GMM: "5GMM"
|
5GMM: "5GMM"
|
||||||
|
|
|
@ -194,12 +194,22 @@ void OpenAPI_{{classname}}_free(OpenAPI_{{classname}}_t *{{classname}})
|
||||||
{{/isPrimitiveType}}
|
{{/isPrimitiveType}}
|
||||||
{{/isListContainer}}
|
{{/isListContainer}}
|
||||||
{{#isMapContainer}}
|
{{#isMapContainer}}
|
||||||
|
{{#isPrimitiveType}}
|
||||||
|
OpenAPI_list_for_each({{classname}}->{{name}}, node) {
|
||||||
|
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||||
|
ogs_free(localKeyValue->value);
|
||||||
|
ogs_free(localKeyValue);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free({{classname}}->{{name}});
|
||||||
|
{{/isPrimitiveType}}
|
||||||
|
{{^isPrimitiveType}}
|
||||||
OpenAPI_list_for_each({{classname}}->{{name}}, node) {
|
OpenAPI_list_for_each({{classname}}->{{name}}, node) {
|
||||||
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||||
OpenAPI_{{complexType}}_free(localKeyValue->value);
|
OpenAPI_{{complexType}}_free(localKeyValue->value);
|
||||||
ogs_free(localKeyValue);
|
ogs_free(localKeyValue);
|
||||||
}
|
}
|
||||||
OpenAPI_list_free({{classname}}->{{name}});
|
OpenAPI_list_free({{classname}}->{{name}});
|
||||||
|
{{/isPrimitiveType}}
|
||||||
{{/isMapContainer}}
|
{{/isMapContainer}}
|
||||||
{{/isContainer}}
|
{{/isContainer}}
|
||||||
{{/vars}}
|
{{/vars}}
|
||||||
|
@ -218,13 +228,20 @@ cJSON *OpenAPI_{{classname}}_convertToJSON(OpenAPI_{{classname}}_t *{{classname}
|
||||||
item = cJSON_CreateObject();
|
item = cJSON_CreateObject();
|
||||||
{{#vars}}
|
{{#vars}}
|
||||||
{{#required}}
|
{{#required}}
|
||||||
|
{{^isBoolean}}
|
||||||
if (!{{{classname}}}->{{{name}}}) {
|
if (!{{{classname}}}->{{{name}}}) {
|
||||||
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
ogs_error("OpenAPI_{{classname}}_convertToJSON() failed [{{{name}}}]");
|
||||||
goto end;
|
goto end;
|
||||||
}
|
}
|
||||||
|
{{/isBoolean}}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{^required}}
|
{{^required}}
|
||||||
|
{{#isBoolean}}
|
||||||
|
if ({{{classname}}}->{{{name}}} >= 0) {
|
||||||
|
{{/isBoolean}}
|
||||||
|
{{^isBoolean}}
|
||||||
if ({{{classname}}}->{{{name}}}) {
|
if ({{{classname}}}->{{{name}}}) {
|
||||||
|
{{/isBoolean}}
|
||||||
{{/required}}
|
{{/required}}
|
||||||
{{^isContainer}}
|
{{^isContainer}}
|
||||||
{{#isPrimitiveType}}
|
{{#isPrimitiveType}}
|
||||||
|
|
|
@ -100,6 +100,369 @@ libsbi_openapi_sources = files('''
|
||||||
model/search_result.c
|
model/search_result.c
|
||||||
model/stored_search_result.c
|
model/stored_search_result.c
|
||||||
|
|
||||||
|
model/af_event.c
|
||||||
|
model/af_event_exposure_data.c
|
||||||
|
model/an_node_type.c
|
||||||
|
model/external_client_type.c
|
||||||
|
model/gmlc_info.c
|
||||||
|
model/hss_info.c
|
||||||
|
model/imsi_range.c
|
||||||
|
model/internal_group_id_range.c
|
||||||
|
model/lmf_info.c
|
||||||
|
model/nef_info.c
|
||||||
|
model/nf_info.c
|
||||||
|
model/nf_service_set_cond.c
|
||||||
|
model/nf_set_cond.c
|
||||||
|
model/pcscf_info.c
|
||||||
|
model/pfd_data.c
|
||||||
|
model/plmn_id_nid.c
|
||||||
|
model/preferred_search.c
|
||||||
|
model/rat_type.c
|
||||||
|
model/tngf_info.c
|
||||||
|
model/twif_info.c
|
||||||
|
model/udsf_info.c
|
||||||
|
model/upf_cond.c
|
||||||
|
model/vendor_specific_feature.c
|
||||||
|
model/w_agf_info.c
|
||||||
|
|
||||||
|
model/auth_result.c
|
||||||
|
model/auth_type.c
|
||||||
|
model/authentication_info.c
|
||||||
|
model/av5g_aka.c
|
||||||
|
model/confirmation_data.c
|
||||||
|
model/confirmation_data_response.c
|
||||||
|
model/eap_session.c
|
||||||
|
model/resynchronization_info.c
|
||||||
|
model/rg_auth_ctx.c
|
||||||
|
model/rg_authentication_info.c
|
||||||
|
model/trace_data.c
|
||||||
|
model/trace_depth.c
|
||||||
|
model/ue_authentication_ctx.c
|
||||||
|
|
||||||
|
model/auth_event.c
|
||||||
|
model/authentication_info_request.c
|
||||||
|
model/authentication_info_result.c
|
||||||
|
model/authentication_vector.c
|
||||||
|
model/av5_g_he_aka.c
|
||||||
|
model/av_eap_aka_prime.c
|
||||||
|
model/av_eps_aka.c
|
||||||
|
model/av_ims_gba_eap_aka.c
|
||||||
|
model/av_type.c
|
||||||
|
model/hss_auth_type.c
|
||||||
|
model/hss_authentication_info_request.c
|
||||||
|
model/hss_authentication_info_result.c
|
||||||
|
model/hss_authentication_vectors.c
|
||||||
|
model/hss_av_type.c
|
||||||
|
|
||||||
|
model/amf3_gpp_access_registration.c
|
||||||
|
model/amf3_gpp_access_registration_modification.c
|
||||||
|
model/amf_dereg_info.c
|
||||||
|
model/amf_non3_gpp_access_registration.c
|
||||||
|
model/amf_non3_gpp_access_registration_modification.c
|
||||||
|
model/backup_amf_info.c
|
||||||
|
model/cm_info.c
|
||||||
|
model/cm_info_report.c
|
||||||
|
model/cm_state.c
|
||||||
|
model/deregistration_data.c
|
||||||
|
model/deregistration_reason.c
|
||||||
|
model/eps_interworking_info.c
|
||||||
|
model/eps_iwk_pgw.c
|
||||||
|
model/ims_vo_ps.c
|
||||||
|
model/location_info.c
|
||||||
|
model/network_node_diameter_address.c
|
||||||
|
model/patch_result.c
|
||||||
|
model/pcscf_restoration_notification.c
|
||||||
|
model/pei_update_info.c
|
||||||
|
model/registration_reason.c
|
||||||
|
model/report_item.c
|
||||||
|
model/smf_registration.c
|
||||||
|
model/smf_registration_info.c
|
||||||
|
model/smsf_registration.c
|
||||||
|
model/trigger_request.c
|
||||||
|
model/vgmlc_address.c
|
||||||
|
|
||||||
|
model/access_and_mobility_subscription_data.c
|
||||||
|
model/access_tech.c
|
||||||
|
model/acknowledge_info.c
|
||||||
|
model/acs_info.c
|
||||||
|
model/additional_snssai_data.c
|
||||||
|
model/af_external.c
|
||||||
|
model/af_non_external.c
|
||||||
|
model/ambr.c
|
||||||
|
model/ambr_rm.c
|
||||||
|
model/app_descriptor.c
|
||||||
|
model/app_port_id.c
|
||||||
|
model/area.c
|
||||||
|
model/arp.c
|
||||||
|
model/battery_indication.c
|
||||||
|
model/cag_data.c
|
||||||
|
model/cag_info.c
|
||||||
|
model/civic_address.c
|
||||||
|
model/code_word_ind.c
|
||||||
|
model/core_network_type.c
|
||||||
|
model/data_set_name.c
|
||||||
|
model/dnn_configuration.c
|
||||||
|
model/dnn_info.c
|
||||||
|
model/ec_restriction_data.c
|
||||||
|
model/ecgi.c
|
||||||
|
model/edrx_parameters.c
|
||||||
|
model/ellipsoid_arc.c
|
||||||
|
model/ellipsoid_arc_all_of.c
|
||||||
|
model/emergency_info.c
|
||||||
|
model/enhanced_coverage_restriction_data.c
|
||||||
|
model/expected_ue_behaviour_data.c
|
||||||
|
model/external_unrelated_class.c
|
||||||
|
model/frame_route_info.c
|
||||||
|
model/g_nb_id.c
|
||||||
|
model/gad_shape.c
|
||||||
|
model/geographic_area.c
|
||||||
|
model/geographical_coordinates.c
|
||||||
|
model/global_ran_node_id.c
|
||||||
|
model/group_identifiers.c
|
||||||
|
model/id_translation_result.c
|
||||||
|
model/ip_address.c
|
||||||
|
model/lcs_client_class.c
|
||||||
|
model/lcs_client_external.c
|
||||||
|
model/lcs_client_group_external.c
|
||||||
|
model/lcs_client_non_external.c
|
||||||
|
model/lcs_mo_data.c
|
||||||
|
model/lcs_mo_service_class.c
|
||||||
|
model/lcs_privacy_data.c
|
||||||
|
model/location_area.c
|
||||||
|
model/location_privacy_ind.c
|
||||||
|
model/lpi.c
|
||||||
|
model/lte_v2x_auth.c
|
||||||
|
model/maximum_latency.c
|
||||||
|
model/maximum_response_time.c
|
||||||
|
model/modification_notification.c
|
||||||
|
model/ncgi.c
|
||||||
|
model/network_area_info.c
|
||||||
|
model/nidd_information.c
|
||||||
|
model/non_external_unrelated_class.c
|
||||||
|
model/notify_item.c
|
||||||
|
model/nr_v2x_auth.c
|
||||||
|
model/nssai.c
|
||||||
|
model/null_value.c
|
||||||
|
model/odb_packet_services.c
|
||||||
|
model/operation_mode.c
|
||||||
|
model/pdu_session.c
|
||||||
|
model/pdu_session_continuity_ind.c
|
||||||
|
model/pdu_session_types.c
|
||||||
|
model/pgw_info.c
|
||||||
|
model/plmn_ec_info.c
|
||||||
|
model/plmn_operator_class.c
|
||||||
|
model/point.c
|
||||||
|
model/point_all_of.c
|
||||||
|
model/point_altitude.c
|
||||||
|
model/point_altitude_all_of.c
|
||||||
|
model/point_altitude_uncertainty.c
|
||||||
|
model/point_altitude_uncertainty_all_of.c
|
||||||
|
model/point_uncertainty_circle.c
|
||||||
|
model/point_uncertainty_circle_all_of.c
|
||||||
|
model/point_uncertainty_ellipse.c
|
||||||
|
model/point_uncertainty_ellipse_all_of.c
|
||||||
|
model/polygon.c
|
||||||
|
model/polygon_all_of.c
|
||||||
|
model/preemption_capability.c
|
||||||
|
model/preemption_vulnerability.c
|
||||||
|
model/privacy_check_related_action.c
|
||||||
|
model/ptw_parameters.c
|
||||||
|
model/restriction_type.c
|
||||||
|
model/scheduled_communication_time.c
|
||||||
|
model/scheduled_communication_type.c
|
||||||
|
model/sdm_subs_modification.c
|
||||||
|
model/sdm_subscription.c
|
||||||
|
model/service_area_restriction.c
|
||||||
|
model/service_type_unrelated_class.c
|
||||||
|
model/session_management_subscription_data.c
|
||||||
|
model/shared_data.c
|
||||||
|
model/smf_selection_subscription_data.c
|
||||||
|
model/sms_management_subscription_data.c
|
||||||
|
model/sms_subscription_data.c
|
||||||
|
model/smsf_info.c
|
||||||
|
model/snssai_info.c
|
||||||
|
model/sor_info.c
|
||||||
|
model/sor_update_indicator.c
|
||||||
|
model/sor_update_info.c
|
||||||
|
model/ssc_mode.c
|
||||||
|
model/ssc_modes.c
|
||||||
|
model/stationary_indication.c
|
||||||
|
model/steering_container.c
|
||||||
|
model/steering_info.c
|
||||||
|
model/subscribed_default_qos.c
|
||||||
|
model/subscription_data_sets.c
|
||||||
|
model/suggested_packet_num_dl.c
|
||||||
|
model/supported_gad_shapes.c
|
||||||
|
model/tmbr.c
|
||||||
|
model/trace_data_response.c
|
||||||
|
model/traffic_profile.c
|
||||||
|
model/ue_auth.c
|
||||||
|
model/ue_context_in_smf_data.c
|
||||||
|
model/ue_context_in_smsf_data.c
|
||||||
|
model/ue_id.c
|
||||||
|
model/uncertainty_ellipse.c
|
||||||
|
model/unrelated_class.c
|
||||||
|
model/up_confidentiality.c
|
||||||
|
model/up_integrity.c
|
||||||
|
model/up_security.c
|
||||||
|
model/upu_data.c
|
||||||
|
model/upu_info.c
|
||||||
|
model/valid_time_period.c
|
||||||
|
model/vn_group_data.c
|
||||||
|
|
||||||
|
model/access_and_mobility_data.c
|
||||||
|
model/acs_info_rm.c
|
||||||
|
model/amf_subscription_info.c
|
||||||
|
model/association_type.c
|
||||||
|
model/auth_method.c
|
||||||
|
model/authentication_subscription.c
|
||||||
|
model/authorization_data.c
|
||||||
|
model/battery_indication_rm.c
|
||||||
|
model/cag_ack_data.c
|
||||||
|
model/communication_characteristics.c
|
||||||
|
model/data_change_notify.c
|
||||||
|
model/datalink_reporting_configuration.c
|
||||||
|
model/ddd_traffic_descriptor.c
|
||||||
|
model/dl_data_delivery_status.c
|
||||||
|
model/domain_name_protocol.c
|
||||||
|
model/ec_restriction.c
|
||||||
|
model/ee_profile_data.c
|
||||||
|
model/ee_subscription.c
|
||||||
|
model/eutra_location.c
|
||||||
|
model/event_report_mode.c
|
||||||
|
model/event_type.c
|
||||||
|
model/expected_ue_behaviour.c
|
||||||
|
model/exposure_data_change_notification.c
|
||||||
|
model/exposure_data_subscription.c
|
||||||
|
model/hfc_node_id.c
|
||||||
|
model/identity_data.c
|
||||||
|
model/lcs_privacy.c
|
||||||
|
model/location_accuracy.c
|
||||||
|
model/location_reporting_configuration.c
|
||||||
|
model/model_5_g_vn_group_configuration.c
|
||||||
|
model/model_5_g_vn_group_data.c
|
||||||
|
model/monitoring_configuration.c
|
||||||
|
model/n3ga_location.c
|
||||||
|
model/nr_location.c
|
||||||
|
model/nssai_ack_data.c
|
||||||
|
model/odb_data.c
|
||||||
|
model/operator_specific_data_container.c
|
||||||
|
model/pdu_session_management_data.c
|
||||||
|
model/pdu_session_status.c
|
||||||
|
model/pfd_content.c
|
||||||
|
model/pfd_data_for_app.c
|
||||||
|
model/pfd_data_for_app_ext.c
|
||||||
|
model/pfd_data_for_app_ext_all_of.c
|
||||||
|
model/pp_active_time.c
|
||||||
|
model/pp_data.c
|
||||||
|
model/pp_dl_packet_count_ext.c
|
||||||
|
model/pp_maximum_latency.c
|
||||||
|
model/pp_maximum_response_time.c
|
||||||
|
model/pp_subs_reg_timer.c
|
||||||
|
model/problem_details_2.c
|
||||||
|
model/provisioned_data_sets.c
|
||||||
|
model/reporting_options.c
|
||||||
|
model/rm_info.c
|
||||||
|
model/rm_state.c
|
||||||
|
model/roaming_odb.c
|
||||||
|
model/route_information.c
|
||||||
|
model/route_to_location.c
|
||||||
|
model/scheduled_communication_time_rm.c
|
||||||
|
model/scheduled_communication_type_rm.c
|
||||||
|
model/sequence_number.c
|
||||||
|
model/sign.c
|
||||||
|
model/sms_support.c
|
||||||
|
model/sor_data.c
|
||||||
|
model/sqn_scheme.c
|
||||||
|
model/stationary_indication_rm.c
|
||||||
|
model/subscription_data_subscriptions.c
|
||||||
|
model/traffic_profile_rm.c
|
||||||
|
model/ue_reachability.c
|
||||||
|
model/ue_update_status.c
|
||||||
|
model/upu_data_2.c
|
||||||
|
model/user_identifier.c
|
||||||
|
model/user_location.c
|
||||||
|
|
||||||
|
model/access_right_status.c
|
||||||
|
model/am_policy_data.c
|
||||||
|
model/application_data_change_notif.c
|
||||||
|
model/application_data_subs.c
|
||||||
|
model/bdt_data.c
|
||||||
|
model/bdt_policy_data.c
|
||||||
|
model/bdt_policy_data_patch.c
|
||||||
|
model/charging_information.c
|
||||||
|
model/configuration_parameters_eutra.c
|
||||||
|
model/configuration_parameters_nr.c
|
||||||
|
model/context_data_set_name.c
|
||||||
|
model/context_data_sets.c
|
||||||
|
model/data_filter.c
|
||||||
|
model/data_ind.c
|
||||||
|
model/dnai_change_type.c
|
||||||
|
model/dnn_route_selection_descriptor.c
|
||||||
|
model/eth_flow_description.c
|
||||||
|
model/flow_direction.c
|
||||||
|
model/flow_info.c
|
||||||
|
model/iptv_config_data.c
|
||||||
|
model/iptv_config_data_patch.c
|
||||||
|
model/limit_id_to_monitoring_key.c
|
||||||
|
model/multicast_access_control.c
|
||||||
|
model/network_area_info_2.c
|
||||||
|
model/notification_item.c
|
||||||
|
model/operator_managed.c
|
||||||
|
model/parameter_over_pc5.c
|
||||||
|
model/parameter_over_uu.c
|
||||||
|
model/pc5_flow_bit_rates.c
|
||||||
|
model/pc5_qo_s_para.c
|
||||||
|
model/pc5_qos_flow_item.c
|
||||||
|
model/pc5_qos_mapping.c
|
||||||
|
model/periodicity.c
|
||||||
|
model/pfd_change_notification.c
|
||||||
|
model/plmn_rat_served.c
|
||||||
|
model/plmn_route_selection_descriptor.c
|
||||||
|
model/policy_data_change_notification.c
|
||||||
|
model/policy_data_subscription.c
|
||||||
|
model/pppp_to_pdb.c
|
||||||
|
model/presence_info.c
|
||||||
|
model/presence_state.c
|
||||||
|
model/privacy_parameter.c
|
||||||
|
model/radio_parameter_not_served.c
|
||||||
|
model/resource_item.c
|
||||||
|
model/service_application_server_address.c
|
||||||
|
model/service_id_to_frequency.c
|
||||||
|
model/service_id_to_layer2_id.c
|
||||||
|
model/service_id_to_pppr.c
|
||||||
|
model/service_parameter_data.c
|
||||||
|
model/service_to_pdu_session.c
|
||||||
|
model/service_to_tx.c
|
||||||
|
model/slrb_configurations.c
|
||||||
|
model/sm_policy_data.c
|
||||||
|
model/sm_policy_data_patch.c
|
||||||
|
model/sm_policy_dnn_data.c
|
||||||
|
model/sm_policy_dnn_data_patch.c
|
||||||
|
model/sm_policy_snssai_data.c
|
||||||
|
model/sm_policy_snssai_data_patch.c
|
||||||
|
model/snssai_route_selection_descriptor.c
|
||||||
|
model/sponsor_connectivity_data.c
|
||||||
|
model/subscribed_event.c
|
||||||
|
model/temporal_validity.c
|
||||||
|
model/time_period.c
|
||||||
|
model/time_window.c
|
||||||
|
model/traffic_influ_data.c
|
||||||
|
model/traffic_influ_data_notif.c
|
||||||
|
model/traffic_influ_data_patch.c
|
||||||
|
model/traffic_influ_sub.c
|
||||||
|
model/transfer_policy.c
|
||||||
|
model/ue_policy_section.c
|
||||||
|
model/ue_policy_set.c
|
||||||
|
model/ue_policy_set_patch.c
|
||||||
|
model/updated_item.c
|
||||||
|
model/usage_mon_data.c
|
||||||
|
model/usage_mon_data_limit.c
|
||||||
|
model/usage_mon_data_scope.c
|
||||||
|
model/usage_mon_level.c
|
||||||
|
model/usage_threshold.c
|
||||||
|
model/v2x_rat_type.c
|
||||||
|
|
||||||
'''.split())
|
'''.split())
|
||||||
|
|
||||||
libsbi_openapi_inc = include_directories('.')
|
libsbi_openapi_inc = include_directories('.')
|
||||||
|
|
|
@ -0,0 +1,537 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "access_and_mobility_data.h"
|
||||||
|
|
||||||
|
OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create(
|
||||||
|
OpenAPI_user_location_t *location,
|
||||||
|
char *location_ts,
|
||||||
|
char *time_zone,
|
||||||
|
char *time_zone_ts,
|
||||||
|
OpenAPI_access_type_e access_type,
|
||||||
|
OpenAPI_list_t *reg_states,
|
||||||
|
char *reg_states_ts,
|
||||||
|
OpenAPI_list_t *conn_states,
|
||||||
|
char *conn_states_ts,
|
||||||
|
OpenAPI_ue_reachability_t *reachability_status,
|
||||||
|
char *reachability_status_ts,
|
||||||
|
OpenAPI_sms_support_t *sms_over_nas_status,
|
||||||
|
char *sms_over_nas_status_ts,
|
||||||
|
int roaming_status,
|
||||||
|
char *roaming_status_ts,
|
||||||
|
OpenAPI_plmn_id_t *current_plmn,
|
||||||
|
char *current_plmn_ts,
|
||||||
|
OpenAPI_list_t *rat_type,
|
||||||
|
char *rat_types_ts
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_access_and_mobility_data_t *access_and_mobility_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_access_and_mobility_data_t));
|
||||||
|
if (!access_and_mobility_data_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
access_and_mobility_data_local_var->location = location;
|
||||||
|
access_and_mobility_data_local_var->location_ts = location_ts;
|
||||||
|
access_and_mobility_data_local_var->time_zone = time_zone;
|
||||||
|
access_and_mobility_data_local_var->time_zone_ts = time_zone_ts;
|
||||||
|
access_and_mobility_data_local_var->access_type = access_type;
|
||||||
|
access_and_mobility_data_local_var->reg_states = reg_states;
|
||||||
|
access_and_mobility_data_local_var->reg_states_ts = reg_states_ts;
|
||||||
|
access_and_mobility_data_local_var->conn_states = conn_states;
|
||||||
|
access_and_mobility_data_local_var->conn_states_ts = conn_states_ts;
|
||||||
|
access_and_mobility_data_local_var->reachability_status = reachability_status;
|
||||||
|
access_and_mobility_data_local_var->reachability_status_ts = reachability_status_ts;
|
||||||
|
access_and_mobility_data_local_var->sms_over_nas_status = sms_over_nas_status;
|
||||||
|
access_and_mobility_data_local_var->sms_over_nas_status_ts = sms_over_nas_status_ts;
|
||||||
|
access_and_mobility_data_local_var->roaming_status = roaming_status;
|
||||||
|
access_and_mobility_data_local_var->roaming_status_ts = roaming_status_ts;
|
||||||
|
access_and_mobility_data_local_var->current_plmn = current_plmn;
|
||||||
|
access_and_mobility_data_local_var->current_plmn_ts = current_plmn_ts;
|
||||||
|
access_and_mobility_data_local_var->rat_type = rat_type;
|
||||||
|
access_and_mobility_data_local_var->rat_types_ts = rat_types_ts;
|
||||||
|
|
||||||
|
return access_and_mobility_data_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_access_and_mobility_data_free(OpenAPI_access_and_mobility_data_t *access_and_mobility_data)
|
||||||
|
{
|
||||||
|
if (NULL == access_and_mobility_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
OpenAPI_user_location_free(access_and_mobility_data->location);
|
||||||
|
ogs_free(access_and_mobility_data->location_ts);
|
||||||
|
ogs_free(access_and_mobility_data->time_zone);
|
||||||
|
ogs_free(access_and_mobility_data->time_zone_ts);
|
||||||
|
OpenAPI_list_for_each(access_and_mobility_data->reg_states, node) {
|
||||||
|
OpenAPI_rm_info_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(access_and_mobility_data->reg_states);
|
||||||
|
ogs_free(access_and_mobility_data->reg_states_ts);
|
||||||
|
OpenAPI_list_for_each(access_and_mobility_data->conn_states, node) {
|
||||||
|
OpenAPI_cm_info_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(access_and_mobility_data->conn_states);
|
||||||
|
ogs_free(access_and_mobility_data->conn_states_ts);
|
||||||
|
OpenAPI_ue_reachability_free(access_and_mobility_data->reachability_status);
|
||||||
|
ogs_free(access_and_mobility_data->reachability_status_ts);
|
||||||
|
OpenAPI_sms_support_free(access_and_mobility_data->sms_over_nas_status);
|
||||||
|
ogs_free(access_and_mobility_data->sms_over_nas_status_ts);
|
||||||
|
ogs_free(access_and_mobility_data->roaming_status_ts);
|
||||||
|
OpenAPI_plmn_id_free(access_and_mobility_data->current_plmn);
|
||||||
|
ogs_free(access_and_mobility_data->current_plmn_ts);
|
||||||
|
OpenAPI_list_for_each(access_and_mobility_data->rat_type, node) {
|
||||||
|
OpenAPI_rat_type_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(access_and_mobility_data->rat_type);
|
||||||
|
ogs_free(access_and_mobility_data->rat_types_ts);
|
||||||
|
ogs_free(access_and_mobility_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobility_data_t *access_and_mobility_data)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (access_and_mobility_data == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [AccessAndMobilityData]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (access_and_mobility_data->location) {
|
||||||
|
cJSON *location_local_JSON = OpenAPI_user_location_convertToJSON(access_and_mobility_data->location);
|
||||||
|
if (location_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [location]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "location", location_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [location]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->location_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "locationTs", access_and_mobility_data->location_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [location_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->time_zone) {
|
||||||
|
if (cJSON_AddStringToObject(item, "timeZone", access_and_mobility_data->time_zone) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [time_zone]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->time_zone_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "timeZoneTs", access_and_mobility_data->time_zone_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [time_zone_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->access_type) {
|
||||||
|
if (cJSON_AddStringToObject(item, "accessType", OpenAPI_access_type_ToString(access_and_mobility_data->access_type)) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [access_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->reg_states) {
|
||||||
|
cJSON *reg_statesList = cJSON_AddArrayToObject(item, "regStates");
|
||||||
|
if (reg_statesList == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reg_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *reg_states_node;
|
||||||
|
if (access_and_mobility_data->reg_states) {
|
||||||
|
OpenAPI_list_for_each(access_and_mobility_data->reg_states, reg_states_node) {
|
||||||
|
cJSON *itemLocal = OpenAPI_rm_info_convertToJSON(reg_states_node->data);
|
||||||
|
if (itemLocal == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reg_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToArray(reg_statesList, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->reg_states_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "regStatesTs", access_and_mobility_data->reg_states_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reg_states_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->conn_states) {
|
||||||
|
cJSON *conn_statesList = cJSON_AddArrayToObject(item, "connStates");
|
||||||
|
if (conn_statesList == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [conn_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *conn_states_node;
|
||||||
|
if (access_and_mobility_data->conn_states) {
|
||||||
|
OpenAPI_list_for_each(access_and_mobility_data->conn_states, conn_states_node) {
|
||||||
|
cJSON *itemLocal = OpenAPI_cm_info_convertToJSON(conn_states_node->data);
|
||||||
|
if (itemLocal == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [conn_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToArray(conn_statesList, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->conn_states_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "connStatesTs", access_and_mobility_data->conn_states_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [conn_states_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->reachability_status) {
|
||||||
|
cJSON *reachability_status_local_JSON = OpenAPI_ue_reachability_convertToJSON(access_and_mobility_data->reachability_status);
|
||||||
|
if (reachability_status_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reachability_status]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "reachabilityStatus", reachability_status_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reachability_status]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->reachability_status_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "reachabilityStatusTs", access_and_mobility_data->reachability_status_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [reachability_status_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->sms_over_nas_status) {
|
||||||
|
cJSON *sms_over_nas_status_local_JSON = OpenAPI_sms_support_convertToJSON(access_and_mobility_data->sms_over_nas_status);
|
||||||
|
if (sms_over_nas_status_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [sms_over_nas_status]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "smsOverNasStatus", sms_over_nas_status_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [sms_over_nas_status]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->sms_over_nas_status_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "smsOverNasStatusTs", access_and_mobility_data->sms_over_nas_status_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [sms_over_nas_status_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->roaming_status >= 0) {
|
||||||
|
if (cJSON_AddBoolToObject(item, "roamingStatus", access_and_mobility_data->roaming_status) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [roaming_status]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->roaming_status_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "roamingStatusTs", access_and_mobility_data->roaming_status_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [roaming_status_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->current_plmn) {
|
||||||
|
cJSON *current_plmn_local_JSON = OpenAPI_plmn_id_convertToJSON(access_and_mobility_data->current_plmn);
|
||||||
|
if (current_plmn_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [current_plmn]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "currentPlmn", current_plmn_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [current_plmn]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->current_plmn_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "currentPlmnTs", access_and_mobility_data->current_plmn_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [current_plmn_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->rat_type) {
|
||||||
|
cJSON *rat_typeList = cJSON_AddArrayToObject(item, "ratType");
|
||||||
|
if (rat_typeList == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *rat_type_node;
|
||||||
|
if (access_and_mobility_data->rat_type) {
|
||||||
|
OpenAPI_list_for_each(access_and_mobility_data->rat_type, rat_type_node) {
|
||||||
|
cJSON *itemLocal = OpenAPI_rat_type_convertToJSON(rat_type_node->data);
|
||||||
|
if (itemLocal == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToArray(rat_typeList, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (access_and_mobility_data->rat_types_ts) {
|
||||||
|
if (cJSON_AddStringToObject(item, "ratTypesTs", access_and_mobility_data->rat_types_ts) == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_convertToJSON() failed [rat_types_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJSON(cJSON *access_and_mobility_dataJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_access_and_mobility_data_t *access_and_mobility_data_local_var = NULL;
|
||||||
|
cJSON *location = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "location");
|
||||||
|
|
||||||
|
OpenAPI_user_location_t *location_local_nonprim = NULL;
|
||||||
|
if (location) {
|
||||||
|
location_local_nonprim = OpenAPI_user_location_parseFromJSON(location);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *location_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "locationTs");
|
||||||
|
|
||||||
|
if (location_ts) {
|
||||||
|
if (!cJSON_IsString(location_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [location_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *time_zone = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "timeZone");
|
||||||
|
|
||||||
|
if (time_zone) {
|
||||||
|
if (!cJSON_IsString(time_zone)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [time_zone]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *time_zone_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "timeZoneTs");
|
||||||
|
|
||||||
|
if (time_zone_ts) {
|
||||||
|
if (!cJSON_IsString(time_zone_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [time_zone_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *access_type = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "accessType");
|
||||||
|
|
||||||
|
OpenAPI_access_type_e access_typeVariable;
|
||||||
|
if (access_type) {
|
||||||
|
if (!cJSON_IsString(access_type)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [access_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
access_typeVariable = OpenAPI_access_type_FromString(access_type->valuestring);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *reg_states = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "regStates");
|
||||||
|
|
||||||
|
OpenAPI_list_t *reg_statesList;
|
||||||
|
if (reg_states) {
|
||||||
|
cJSON *reg_states_local_nonprimitive;
|
||||||
|
if (!cJSON_IsArray(reg_states)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [reg_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
reg_statesList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(reg_states_local_nonprimitive, reg_states ) {
|
||||||
|
if (!cJSON_IsObject(reg_states_local_nonprimitive)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [reg_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_rm_info_t *reg_statesItem = OpenAPI_rm_info_parseFromJSON(reg_states_local_nonprimitive);
|
||||||
|
|
||||||
|
OpenAPI_list_add(reg_statesList, reg_statesItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *reg_states_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "regStatesTs");
|
||||||
|
|
||||||
|
if (reg_states_ts) {
|
||||||
|
if (!cJSON_IsString(reg_states_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [reg_states_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *conn_states = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "connStates");
|
||||||
|
|
||||||
|
OpenAPI_list_t *conn_statesList;
|
||||||
|
if (conn_states) {
|
||||||
|
cJSON *conn_states_local_nonprimitive;
|
||||||
|
if (!cJSON_IsArray(conn_states)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [conn_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
conn_statesList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(conn_states_local_nonprimitive, conn_states ) {
|
||||||
|
if (!cJSON_IsObject(conn_states_local_nonprimitive)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [conn_states]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_cm_info_t *conn_statesItem = OpenAPI_cm_info_parseFromJSON(conn_states_local_nonprimitive);
|
||||||
|
|
||||||
|
OpenAPI_list_add(conn_statesList, conn_statesItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *conn_states_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "connStatesTs");
|
||||||
|
|
||||||
|
if (conn_states_ts) {
|
||||||
|
if (!cJSON_IsString(conn_states_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [conn_states_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *reachability_status = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "reachabilityStatus");
|
||||||
|
|
||||||
|
OpenAPI_ue_reachability_t *reachability_status_local_nonprim = NULL;
|
||||||
|
if (reachability_status) {
|
||||||
|
reachability_status_local_nonprim = OpenAPI_ue_reachability_parseFromJSON(reachability_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *reachability_status_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "reachabilityStatusTs");
|
||||||
|
|
||||||
|
if (reachability_status_ts) {
|
||||||
|
if (!cJSON_IsString(reachability_status_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [reachability_status_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *sms_over_nas_status = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "smsOverNasStatus");
|
||||||
|
|
||||||
|
OpenAPI_sms_support_t *sms_over_nas_status_local_nonprim = NULL;
|
||||||
|
if (sms_over_nas_status) {
|
||||||
|
sms_over_nas_status_local_nonprim = OpenAPI_sms_support_parseFromJSON(sms_over_nas_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *sms_over_nas_status_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "smsOverNasStatusTs");
|
||||||
|
|
||||||
|
if (sms_over_nas_status_ts) {
|
||||||
|
if (!cJSON_IsString(sms_over_nas_status_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [sms_over_nas_status_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *roaming_status = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "roamingStatus");
|
||||||
|
|
||||||
|
if (roaming_status) {
|
||||||
|
if (!cJSON_IsBool(roaming_status)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [roaming_status]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *roaming_status_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "roamingStatusTs");
|
||||||
|
|
||||||
|
if (roaming_status_ts) {
|
||||||
|
if (!cJSON_IsString(roaming_status_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [roaming_status_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *current_plmn = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "currentPlmn");
|
||||||
|
|
||||||
|
OpenAPI_plmn_id_t *current_plmn_local_nonprim = NULL;
|
||||||
|
if (current_plmn) {
|
||||||
|
current_plmn_local_nonprim = OpenAPI_plmn_id_parseFromJSON(current_plmn);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *current_plmn_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "currentPlmnTs");
|
||||||
|
|
||||||
|
if (current_plmn_ts) {
|
||||||
|
if (!cJSON_IsString(current_plmn_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [current_plmn_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "ratType");
|
||||||
|
|
||||||
|
OpenAPI_list_t *rat_typeList;
|
||||||
|
if (rat_type) {
|
||||||
|
cJSON *rat_type_local_nonprimitive;
|
||||||
|
if (!cJSON_IsArray(rat_type)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
rat_typeList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(rat_type_local_nonprimitive, rat_type ) {
|
||||||
|
if (!cJSON_IsObject(rat_type_local_nonprimitive)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_rat_type_t *rat_typeItem = OpenAPI_rat_type_parseFromJSON(rat_type_local_nonprimitive);
|
||||||
|
|
||||||
|
OpenAPI_list_add(rat_typeList, rat_typeItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *rat_types_ts = cJSON_GetObjectItemCaseSensitive(access_and_mobility_dataJSON, "ratTypesTs");
|
||||||
|
|
||||||
|
if (rat_types_ts) {
|
||||||
|
if (!cJSON_IsString(rat_types_ts)) {
|
||||||
|
ogs_error("OpenAPI_access_and_mobility_data_parseFromJSON() failed [rat_types_ts]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
access_and_mobility_data_local_var = OpenAPI_access_and_mobility_data_create (
|
||||||
|
location ? location_local_nonprim : NULL,
|
||||||
|
location_ts ? ogs_strdup(location_ts->valuestring) : NULL,
|
||||||
|
time_zone ? ogs_strdup(time_zone->valuestring) : NULL,
|
||||||
|
time_zone_ts ? ogs_strdup(time_zone_ts->valuestring) : NULL,
|
||||||
|
access_type ? access_typeVariable : 0,
|
||||||
|
reg_states ? reg_statesList : NULL,
|
||||||
|
reg_states_ts ? ogs_strdup(reg_states_ts->valuestring) : NULL,
|
||||||
|
conn_states ? conn_statesList : NULL,
|
||||||
|
conn_states_ts ? ogs_strdup(conn_states_ts->valuestring) : NULL,
|
||||||
|
reachability_status ? reachability_status_local_nonprim : NULL,
|
||||||
|
reachability_status_ts ? ogs_strdup(reachability_status_ts->valuestring) : NULL,
|
||||||
|
sms_over_nas_status ? sms_over_nas_status_local_nonprim : NULL,
|
||||||
|
sms_over_nas_status_ts ? ogs_strdup(sms_over_nas_status_ts->valuestring) : NULL,
|
||||||
|
roaming_status ? roaming_status->valueint : 0,
|
||||||
|
roaming_status_ts ? ogs_strdup(roaming_status_ts->valuestring) : NULL,
|
||||||
|
current_plmn ? current_plmn_local_nonprim : NULL,
|
||||||
|
current_plmn_ts ? ogs_strdup(current_plmn_ts->valuestring) : NULL,
|
||||||
|
rat_type ? rat_typeList : NULL,
|
||||||
|
rat_types_ts ? ogs_strdup(rat_types_ts->valuestring) : NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
return access_and_mobility_data_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,81 @@
|
||||||
|
/*
|
||||||
|
* access_and_mobility_data.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_access_and_mobility_data_H_
|
||||||
|
#define _OpenAPI_access_and_mobility_data_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
#include "access_type.h"
|
||||||
|
#include "cm_info.h"
|
||||||
|
#include "plmn_id.h"
|
||||||
|
#include "rat_type.h"
|
||||||
|
#include "rm_info.h"
|
||||||
|
#include "sms_support.h"
|
||||||
|
#include "ue_reachability.h"
|
||||||
|
#include "user_location.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_access_and_mobility_data_s OpenAPI_access_and_mobility_data_t;
|
||||||
|
typedef struct OpenAPI_access_and_mobility_data_s {
|
||||||
|
struct OpenAPI_user_location_s *location;
|
||||||
|
char *location_ts;
|
||||||
|
char *time_zone;
|
||||||
|
char *time_zone_ts;
|
||||||
|
OpenAPI_access_type_e access_type;
|
||||||
|
OpenAPI_list_t *reg_states;
|
||||||
|
char *reg_states_ts;
|
||||||
|
OpenAPI_list_t *conn_states;
|
||||||
|
char *conn_states_ts;
|
||||||
|
struct OpenAPI_ue_reachability_s *reachability_status;
|
||||||
|
char *reachability_status_ts;
|
||||||
|
struct OpenAPI_sms_support_s *sms_over_nas_status;
|
||||||
|
char *sms_over_nas_status_ts;
|
||||||
|
int roaming_status;
|
||||||
|
char *roaming_status_ts;
|
||||||
|
struct OpenAPI_plmn_id_s *current_plmn;
|
||||||
|
char *current_plmn_ts;
|
||||||
|
OpenAPI_list_t *rat_type;
|
||||||
|
char *rat_types_ts;
|
||||||
|
} OpenAPI_access_and_mobility_data_t;
|
||||||
|
|
||||||
|
OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_create(
|
||||||
|
OpenAPI_user_location_t *location,
|
||||||
|
char *location_ts,
|
||||||
|
char *time_zone,
|
||||||
|
char *time_zone_ts,
|
||||||
|
OpenAPI_access_type_e access_type,
|
||||||
|
OpenAPI_list_t *reg_states,
|
||||||
|
char *reg_states_ts,
|
||||||
|
OpenAPI_list_t *conn_states,
|
||||||
|
char *conn_states_ts,
|
||||||
|
OpenAPI_ue_reachability_t *reachability_status,
|
||||||
|
char *reachability_status_ts,
|
||||||
|
OpenAPI_sms_support_t *sms_over_nas_status,
|
||||||
|
char *sms_over_nas_status_ts,
|
||||||
|
int roaming_status,
|
||||||
|
char *roaming_status_ts,
|
||||||
|
OpenAPI_plmn_id_t *current_plmn,
|
||||||
|
char *current_plmn_ts,
|
||||||
|
OpenAPI_list_t *rat_type,
|
||||||
|
char *rat_types_ts
|
||||||
|
);
|
||||||
|
void OpenAPI_access_and_mobility_data_free(OpenAPI_access_and_mobility_data_t *access_and_mobility_data);
|
||||||
|
OpenAPI_access_and_mobility_data_t *OpenAPI_access_and_mobility_data_parseFromJSON(cJSON *access_and_mobility_dataJSON);
|
||||||
|
cJSON *OpenAPI_access_and_mobility_data_convertToJSON(OpenAPI_access_and_mobility_data_t *access_and_mobility_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_access_and_mobility_data_H_ */
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
|
@ -0,0 +1,155 @@
|
||||||
|
/*
|
||||||
|
* access_and_mobility_subscription_data.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_access_and_mobility_subscription_data_H_
|
||||||
|
#define _OpenAPI_access_and_mobility_subscription_data_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
#include "ambr_rm.h"
|
||||||
|
#include "area.h"
|
||||||
|
#include "cag_data.h"
|
||||||
|
#include "core_network_type.h"
|
||||||
|
#include "ec_restriction_data.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 "nssai.h"
|
||||||
|
#include "odb_packet_services.h"
|
||||||
|
#include "ptw_parameters.h"
|
||||||
|
#include "rat_type.h"
|
||||||
|
#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"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_access_and_mobility_subscription_data_s OpenAPI_access_and_mobility_subscription_data_t;
|
||||||
|
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;
|
||||||
|
OpenAPI_list_t *rat_restrictions;
|
||||||
|
OpenAPI_list_t *forbidden_areas;
|
||||||
|
struct OpenAPI_service_area_restriction_s *service_area_restriction;
|
||||||
|
OpenAPI_list_t *core_network_type_restrictions;
|
||||||
|
int rfsp_index;
|
||||||
|
int subs_reg_timer;
|
||||||
|
int ue_usage_type;
|
||||||
|
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;
|
||||||
|
OpenAPI_list_t *sor_update_indicator_list;
|
||||||
|
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_list_t *subscribed_dnn_list;
|
||||||
|
int service_gap_time;
|
||||||
|
struct OpenAPI_trace_data_s *trace_data;
|
||||||
|
struct OpenAPI_cag_data_s *cag_data;
|
||||||
|
char *stn_sr;
|
||||||
|
char *c_msisdn;
|
||||||
|
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_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_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,
|
||||||
|
OpenAPI_list_t *rat_restrictions,
|
||||||
|
OpenAPI_list_t *forbidden_areas,
|
||||||
|
OpenAPI_service_area_restriction_t *service_area_restriction,
|
||||||
|
OpenAPI_list_t *core_network_type_restrictions,
|
||||||
|
int rfsp_index,
|
||||||
|
int subs_reg_timer,
|
||||||
|
int ue_usage_type,
|
||||||
|
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,
|
||||||
|
OpenAPI_list_t *sor_update_indicator_list,
|
||||||
|
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_list_t *subscribed_dnn_list,
|
||||||
|
int service_gap_time,
|
||||||
|
OpenAPI_trace_data_t *trace_data,
|
||||||
|
OpenAPI_cag_data_t *cag_data,
|
||||||
|
char *stn_sr,
|
||||||
|
char *c_msisdn,
|
||||||
|
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_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
|
||||||
|
);
|
||||||
|
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);
|
||||||
|
cJSON *OpenAPI_access_and_mobility_subscription_data_convertToJSON(OpenAPI_access_and_mobility_subscription_data_t *access_and_mobility_subscription_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_access_and_mobility_subscription_data_H_ */
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "access_right_status.h"
|
||||||
|
|
||||||
|
OpenAPI_access_right_status_t *OpenAPI_access_right_status_create(
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_access_right_status_t *access_right_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_access_right_status_t));
|
||||||
|
if (!access_right_status_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return access_right_status_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_access_right_status_free(OpenAPI_access_right_status_t *access_right_status)
|
||||||
|
{
|
||||||
|
if (NULL == access_right_status) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(access_right_status);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_access_right_status_convertToJSON(OpenAPI_access_right_status_t *access_right_status)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (access_right_status == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_right_status_convertToJSON() failed [AccessRightStatus]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_access_right_status_t *OpenAPI_access_right_status_parseFromJSON(cJSON *access_right_statusJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_access_right_status_t *access_right_status_local_var = NULL;
|
||||||
|
access_right_status_local_var = OpenAPI_access_right_status_create (
|
||||||
|
);
|
||||||
|
|
||||||
|
return access_right_status_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* access_right_status.h
|
||||||
|
*
|
||||||
|
* Possible values are - FULLY_ALLOWED: The User is fully allowed to access to the channel. - PREVIEW_ALLOWED: The User is preview allowed to access to the channel. - NO_ALLOWED: The User is not allowed to access to the channel.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_access_right_status_H_
|
||||||
|
#define _OpenAPI_access_right_status_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_access_right_status_s OpenAPI_access_right_status_t;
|
||||||
|
typedef struct OpenAPI_access_right_status_s {
|
||||||
|
} OpenAPI_access_right_status_t;
|
||||||
|
|
||||||
|
OpenAPI_access_right_status_t *OpenAPI_access_right_status_create(
|
||||||
|
);
|
||||||
|
void OpenAPI_access_right_status_free(OpenAPI_access_right_status_t *access_right_status);
|
||||||
|
OpenAPI_access_right_status_t *OpenAPI_access_right_status_parseFromJSON(cJSON *access_right_statusJSON);
|
||||||
|
cJSON *OpenAPI_access_right_status_convertToJSON(OpenAPI_access_right_status_t *access_right_status);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_access_right_status_H_ */
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "access_tech.h"
|
||||||
|
|
||||||
|
OpenAPI_access_tech_t *OpenAPI_access_tech_create(
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_access_tech_t *access_tech_local_var = OpenAPI_malloc(sizeof(OpenAPI_access_tech_t));
|
||||||
|
if (!access_tech_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return access_tech_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_access_tech_free(OpenAPI_access_tech_t *access_tech)
|
||||||
|
{
|
||||||
|
if (NULL == access_tech) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(access_tech);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_access_tech_convertToJSON(OpenAPI_access_tech_t *access_tech)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (access_tech == NULL) {
|
||||||
|
ogs_error("OpenAPI_access_tech_convertToJSON() failed [AccessTech]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_access_tech_t *OpenAPI_access_tech_parseFromJSON(cJSON *access_techJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_access_tech_t *access_tech_local_var = NULL;
|
||||||
|
access_tech_local_var = OpenAPI_access_tech_create (
|
||||||
|
);
|
||||||
|
|
||||||
|
return access_tech_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* access_tech.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_access_tech_H_
|
||||||
|
#define _OpenAPI_access_tech_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_access_tech_s OpenAPI_access_tech_t;
|
||||||
|
typedef struct OpenAPI_access_tech_s {
|
||||||
|
} OpenAPI_access_tech_t;
|
||||||
|
|
||||||
|
OpenAPI_access_tech_t *OpenAPI_access_tech_create(
|
||||||
|
);
|
||||||
|
void OpenAPI_access_tech_free(OpenAPI_access_tech_t *access_tech);
|
||||||
|
OpenAPI_access_tech_t *OpenAPI_access_tech_parseFromJSON(cJSON *access_techJSON);
|
||||||
|
cJSON *OpenAPI_access_tech_convertToJSON(OpenAPI_access_tech_t *access_tech);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_access_tech_H_ */
|
||||||
|
|
|
@ -0,0 +1,136 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "acknowledge_info.h"
|
||||||
|
|
||||||
|
OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_create(
|
||||||
|
char *sor_mac_iue,
|
||||||
|
char *upu_mac_iue,
|
||||||
|
char *secured_packet,
|
||||||
|
char *provisioning_time
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_acknowledge_info_t *acknowledge_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_acknowledge_info_t));
|
||||||
|
if (!acknowledge_info_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
acknowledge_info_local_var->sor_mac_iue = sor_mac_iue;
|
||||||
|
acknowledge_info_local_var->upu_mac_iue = upu_mac_iue;
|
||||||
|
acknowledge_info_local_var->secured_packet = secured_packet;
|
||||||
|
acknowledge_info_local_var->provisioning_time = provisioning_time;
|
||||||
|
|
||||||
|
return acknowledge_info_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_acknowledge_info_free(OpenAPI_acknowledge_info_t *acknowledge_info)
|
||||||
|
{
|
||||||
|
if (NULL == acknowledge_info) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(acknowledge_info->sor_mac_iue);
|
||||||
|
ogs_free(acknowledge_info->upu_mac_iue);
|
||||||
|
ogs_free(acknowledge_info->secured_packet);
|
||||||
|
ogs_free(acknowledge_info->provisioning_time);
|
||||||
|
ogs_free(acknowledge_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_acknowledge_info_convertToJSON(OpenAPI_acknowledge_info_t *acknowledge_info)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (acknowledge_info == NULL) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [AcknowledgeInfo]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (acknowledge_info->sor_mac_iue) {
|
||||||
|
if (cJSON_AddStringToObject(item, "sorMacIue", acknowledge_info->sor_mac_iue) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [sor_mac_iue]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acknowledge_info->upu_mac_iue) {
|
||||||
|
if (cJSON_AddStringToObject(item, "upuMacIue", acknowledge_info->upu_mac_iue) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [upu_mac_iue]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acknowledge_info->secured_packet) {
|
||||||
|
if (cJSON_AddStringToObject(item, "securedPacket", acknowledge_info->secured_packet) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [secured_packet]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!acknowledge_info->provisioning_time) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [provisioning_time]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "provisioningTime", acknowledge_info->provisioning_time) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_convertToJSON() failed [provisioning_time]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknowledge_infoJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_acknowledge_info_t *acknowledge_info_local_var = NULL;
|
||||||
|
cJSON *sor_mac_iue = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "sorMacIue");
|
||||||
|
|
||||||
|
if (sor_mac_iue) {
|
||||||
|
if (!cJSON_IsString(sor_mac_iue)) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [sor_mac_iue]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *upu_mac_iue = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "upuMacIue");
|
||||||
|
|
||||||
|
if (upu_mac_iue) {
|
||||||
|
if (!cJSON_IsString(upu_mac_iue)) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [upu_mac_iue]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *secured_packet = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "securedPacket");
|
||||||
|
|
||||||
|
if (secured_packet) {
|
||||||
|
if (!cJSON_IsString(secured_packet)) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [secured_packet]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *provisioning_time = cJSON_GetObjectItemCaseSensitive(acknowledge_infoJSON, "provisioningTime");
|
||||||
|
if (!provisioning_time) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [provisioning_time]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(provisioning_time)) {
|
||||||
|
ogs_error("OpenAPI_acknowledge_info_parseFromJSON() failed [provisioning_time]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
acknowledge_info_local_var = OpenAPI_acknowledge_info_create (
|
||||||
|
sor_mac_iue ? ogs_strdup(sor_mac_iue->valuestring) : NULL,
|
||||||
|
upu_mac_iue ? ogs_strdup(upu_mac_iue->valuestring) : NULL,
|
||||||
|
secured_packet ? ogs_strdup(secured_packet->valuestring) : NULL,
|
||||||
|
ogs_strdup(provisioning_time->valuestring)
|
||||||
|
);
|
||||||
|
|
||||||
|
return acknowledge_info_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* acknowledge_info.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_acknowledge_info_H_
|
||||||
|
#define _OpenAPI_acknowledge_info_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_acknowledge_info_s OpenAPI_acknowledge_info_t;
|
||||||
|
typedef struct OpenAPI_acknowledge_info_s {
|
||||||
|
char *sor_mac_iue;
|
||||||
|
char *upu_mac_iue;
|
||||||
|
char *secured_packet;
|
||||||
|
char *provisioning_time;
|
||||||
|
} OpenAPI_acknowledge_info_t;
|
||||||
|
|
||||||
|
OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_create(
|
||||||
|
char *sor_mac_iue,
|
||||||
|
char *upu_mac_iue,
|
||||||
|
char *secured_packet,
|
||||||
|
char *provisioning_time
|
||||||
|
);
|
||||||
|
void OpenAPI_acknowledge_info_free(OpenAPI_acknowledge_info_t *acknowledge_info);
|
||||||
|
OpenAPI_acknowledge_info_t *OpenAPI_acknowledge_info_parseFromJSON(cJSON *acknowledge_infoJSON);
|
||||||
|
cJSON *OpenAPI_acknowledge_info_convertToJSON(OpenAPI_acknowledge_info_t *acknowledge_info);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_acknowledge_info_H_ */
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "acs_info.h"
|
||||||
|
|
||||||
|
OpenAPI_acs_info_t *OpenAPI_acs_info_create(
|
||||||
|
char *acs_url,
|
||||||
|
char *acs_ipv4_addr,
|
||||||
|
char *acs_ipv6_addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_acs_info_t *acs_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_acs_info_t));
|
||||||
|
if (!acs_info_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
acs_info_local_var->acs_url = acs_url;
|
||||||
|
acs_info_local_var->acs_ipv4_addr = acs_ipv4_addr;
|
||||||
|
acs_info_local_var->acs_ipv6_addr = acs_ipv6_addr;
|
||||||
|
|
||||||
|
return acs_info_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_acs_info_free(OpenAPI_acs_info_t *acs_info)
|
||||||
|
{
|
||||||
|
if (NULL == acs_info) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(acs_info->acs_url);
|
||||||
|
ogs_free(acs_info->acs_ipv4_addr);
|
||||||
|
ogs_free(acs_info->acs_ipv6_addr);
|
||||||
|
ogs_free(acs_info);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_acs_info_convertToJSON(OpenAPI_acs_info_t *acs_info)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (acs_info == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_convertToJSON() failed [AcsInfo]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (acs_info->acs_url) {
|
||||||
|
if (cJSON_AddStringToObject(item, "acsUrl", acs_info->acs_url) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_convertToJSON() failed [acs_url]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acs_info->acs_ipv4_addr) {
|
||||||
|
if (cJSON_AddStringToObject(item, "acsIpv4Addr", acs_info->acs_ipv4_addr) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_convertToJSON() failed [acs_ipv4_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acs_info->acs_ipv6_addr) {
|
||||||
|
if (cJSON_AddStringToObject(item, "acsIpv6Addr", acs_info->acs_ipv6_addr) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_convertToJSON() failed [acs_ipv6_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_acs_info_t *OpenAPI_acs_info_parseFromJSON(cJSON *acs_infoJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_acs_info_t *acs_info_local_var = NULL;
|
||||||
|
cJSON *acs_url = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsUrl");
|
||||||
|
|
||||||
|
if (acs_url) {
|
||||||
|
if (!cJSON_IsString(acs_url)) {
|
||||||
|
ogs_error("OpenAPI_acs_info_parseFromJSON() failed [acs_url]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *acs_ipv4_addr = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsIpv4Addr");
|
||||||
|
|
||||||
|
if (acs_ipv4_addr) {
|
||||||
|
if (!cJSON_IsString(acs_ipv4_addr)) {
|
||||||
|
ogs_error("OpenAPI_acs_info_parseFromJSON() failed [acs_ipv4_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *acs_ipv6_addr = cJSON_GetObjectItemCaseSensitive(acs_infoJSON, "acsIpv6Addr");
|
||||||
|
|
||||||
|
if (acs_ipv6_addr) {
|
||||||
|
if (!cJSON_IsString(acs_ipv6_addr)) {
|
||||||
|
ogs_error("OpenAPI_acs_info_parseFromJSON() failed [acs_ipv6_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
acs_info_local_var = OpenAPI_acs_info_create (
|
||||||
|
acs_url ? ogs_strdup(acs_url->valuestring) : NULL,
|
||||||
|
acs_ipv4_addr ? ogs_strdup(acs_ipv4_addr->valuestring) : NULL,
|
||||||
|
acs_ipv6_addr ? ogs_strdup(acs_ipv6_addr->valuestring) : NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
return acs_info_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,41 @@
|
||||||
|
/*
|
||||||
|
* acs_info.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_acs_info_H_
|
||||||
|
#define _OpenAPI_acs_info_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_acs_info_s OpenAPI_acs_info_t;
|
||||||
|
typedef struct OpenAPI_acs_info_s {
|
||||||
|
char *acs_url;
|
||||||
|
char *acs_ipv4_addr;
|
||||||
|
char *acs_ipv6_addr;
|
||||||
|
} OpenAPI_acs_info_t;
|
||||||
|
|
||||||
|
OpenAPI_acs_info_t *OpenAPI_acs_info_create(
|
||||||
|
char *acs_url,
|
||||||
|
char *acs_ipv4_addr,
|
||||||
|
char *acs_ipv6_addr
|
||||||
|
);
|
||||||
|
void OpenAPI_acs_info_free(OpenAPI_acs_info_t *acs_info);
|
||||||
|
OpenAPI_acs_info_t *OpenAPI_acs_info_parseFromJSON(cJSON *acs_infoJSON);
|
||||||
|
cJSON *OpenAPI_acs_info_convertToJSON(OpenAPI_acs_info_t *acs_info);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_acs_info_H_ */
|
||||||
|
|
|
@ -0,0 +1,111 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "acs_info_rm.h"
|
||||||
|
|
||||||
|
OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_create(
|
||||||
|
char *acs_url,
|
||||||
|
char *acs_ipv4_addr,
|
||||||
|
char *acs_ipv6_addr
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_acs_info_rm_t *acs_info_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_acs_info_rm_t));
|
||||||
|
if (!acs_info_rm_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
acs_info_rm_local_var->acs_url = acs_url;
|
||||||
|
acs_info_rm_local_var->acs_ipv4_addr = acs_ipv4_addr;
|
||||||
|
acs_info_rm_local_var->acs_ipv6_addr = acs_ipv6_addr;
|
||||||
|
|
||||||
|
return acs_info_rm_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_acs_info_rm_free(OpenAPI_acs_info_rm_t *acs_info_rm)
|
||||||
|
{
|
||||||
|
if (NULL == acs_info_rm) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(acs_info_rm->acs_url);
|
||||||
|
ogs_free(acs_info_rm->acs_ipv4_addr);
|
||||||
|
ogs_free(acs_info_rm->acs_ipv6_addr);
|
||||||
|
ogs_free(acs_info_rm);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_acs_info_rm_convertToJSON(OpenAPI_acs_info_rm_t *acs_info_rm)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (acs_info_rm == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_convertToJSON() failed [AcsInfoRm]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (acs_info_rm->acs_url) {
|
||||||
|
if (cJSON_AddStringToObject(item, "acsUrl", acs_info_rm->acs_url) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_convertToJSON() failed [acs_url]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acs_info_rm->acs_ipv4_addr) {
|
||||||
|
if (cJSON_AddStringToObject(item, "acsIpv4Addr", acs_info_rm->acs_ipv4_addr) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_convertToJSON() failed [acs_ipv4_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (acs_info_rm->acs_ipv6_addr) {
|
||||||
|
if (cJSON_AddStringToObject(item, "acsIpv6Addr", acs_info_rm->acs_ipv6_addr) == NULL) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_convertToJSON() failed [acs_ipv6_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_parseFromJSON(cJSON *acs_info_rmJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_acs_info_rm_t *acs_info_rm_local_var = NULL;
|
||||||
|
cJSON *acs_url = cJSON_GetObjectItemCaseSensitive(acs_info_rmJSON, "acsUrl");
|
||||||
|
|
||||||
|
if (acs_url) {
|
||||||
|
if (!cJSON_IsString(acs_url)) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_parseFromJSON() failed [acs_url]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *acs_ipv4_addr = cJSON_GetObjectItemCaseSensitive(acs_info_rmJSON, "acsIpv4Addr");
|
||||||
|
|
||||||
|
if (acs_ipv4_addr) {
|
||||||
|
if (!cJSON_IsString(acs_ipv4_addr)) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_parseFromJSON() failed [acs_ipv4_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *acs_ipv6_addr = cJSON_GetObjectItemCaseSensitive(acs_info_rmJSON, "acsIpv6Addr");
|
||||||
|
|
||||||
|
if (acs_ipv6_addr) {
|
||||||
|
if (!cJSON_IsString(acs_ipv6_addr)) {
|
||||||
|
ogs_error("OpenAPI_acs_info_rm_parseFromJSON() failed [acs_ipv6_addr]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
acs_info_rm_local_var = OpenAPI_acs_info_rm_create (
|
||||||
|
acs_url ? ogs_strdup(acs_url->valuestring) : NULL,
|
||||||
|
acs_ipv4_addr ? ogs_strdup(acs_ipv4_addr->valuestring) : NULL,
|
||||||
|
acs_ipv6_addr ? ogs_strdup(acs_ipv6_addr->valuestring) : NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
return acs_info_rm_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* acs_info_rm.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_acs_info_rm_H_
|
||||||
|
#define _OpenAPI_acs_info_rm_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
#include "acs_info.h"
|
||||||
|
#include "null_value.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_acs_info_rm_s OpenAPI_acs_info_rm_t;
|
||||||
|
typedef struct OpenAPI_acs_info_rm_s {
|
||||||
|
char *acs_url;
|
||||||
|
char *acs_ipv4_addr;
|
||||||
|
char *acs_ipv6_addr;
|
||||||
|
} OpenAPI_acs_info_rm_t;
|
||||||
|
|
||||||
|
OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_create(
|
||||||
|
char *acs_url,
|
||||||
|
char *acs_ipv4_addr,
|
||||||
|
char *acs_ipv6_addr
|
||||||
|
);
|
||||||
|
void OpenAPI_acs_info_rm_free(OpenAPI_acs_info_rm_t *acs_info_rm);
|
||||||
|
OpenAPI_acs_info_rm_t *OpenAPI_acs_info_rm_parseFromJSON(cJSON *acs_info_rmJSON);
|
||||||
|
cJSON *OpenAPI_acs_info_rm_convertToJSON(OpenAPI_acs_info_rm_t *acs_info_rm);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_acs_info_rm_H_ */
|
||||||
|
|
|
@ -0,0 +1,70 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "additional_snssai_data.h"
|
||||||
|
|
||||||
|
OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_create(
|
||||||
|
int required_authn_authz
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_additional_snssai_data_t *additional_snssai_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_additional_snssai_data_t));
|
||||||
|
if (!additional_snssai_data_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
additional_snssai_data_local_var->required_authn_authz = required_authn_authz;
|
||||||
|
|
||||||
|
return additional_snssai_data_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_additional_snssai_data_free(OpenAPI_additional_snssai_data_t *additional_snssai_data)
|
||||||
|
{
|
||||||
|
if (NULL == additional_snssai_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(additional_snssai_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_additional_snssai_data_convertToJSON(OpenAPI_additional_snssai_data_t *additional_snssai_data)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (additional_snssai_data == NULL) {
|
||||||
|
ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [AdditionalSnssaiData]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (additional_snssai_data->required_authn_authz >= 0) {
|
||||||
|
if (cJSON_AddBoolToObject(item, "requiredAuthnAuthz", additional_snssai_data->required_authn_authz) == NULL) {
|
||||||
|
ogs_error("OpenAPI_additional_snssai_data_convertToJSON() failed [required_authn_authz]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_parseFromJSON(cJSON *additional_snssai_dataJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_additional_snssai_data_t *additional_snssai_data_local_var = NULL;
|
||||||
|
cJSON *required_authn_authz = cJSON_GetObjectItemCaseSensitive(additional_snssai_dataJSON, "requiredAuthnAuthz");
|
||||||
|
|
||||||
|
if (required_authn_authz) {
|
||||||
|
if (!cJSON_IsBool(required_authn_authz)) {
|
||||||
|
ogs_error("OpenAPI_additional_snssai_data_parseFromJSON() failed [required_authn_authz]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
additional_snssai_data_local_var = OpenAPI_additional_snssai_data_create (
|
||||||
|
required_authn_authz ? required_authn_authz->valueint : 0
|
||||||
|
);
|
||||||
|
|
||||||
|
return additional_snssai_data_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* additional_snssai_data.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_additional_snssai_data_H_
|
||||||
|
#define _OpenAPI_additional_snssai_data_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_additional_snssai_data_s OpenAPI_additional_snssai_data_t;
|
||||||
|
typedef struct OpenAPI_additional_snssai_data_s {
|
||||||
|
int required_authn_authz;
|
||||||
|
} OpenAPI_additional_snssai_data_t;
|
||||||
|
|
||||||
|
OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_create(
|
||||||
|
int required_authn_authz
|
||||||
|
);
|
||||||
|
void OpenAPI_additional_snssai_data_free(OpenAPI_additional_snssai_data_t *additional_snssai_data);
|
||||||
|
OpenAPI_additional_snssai_data_t *OpenAPI_additional_snssai_data_parseFromJSON(cJSON *additional_snssai_dataJSON);
|
||||||
|
cJSON *OpenAPI_additional_snssai_data_convertToJSON(OpenAPI_additional_snssai_data_t *additional_snssai_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_additional_snssai_data_H_ */
|
||||||
|
|
|
@ -0,0 +1,51 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "af_event.h"
|
||||||
|
|
||||||
|
OpenAPI_af_event_t *OpenAPI_af_event_create(
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_af_event_t *af_event_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_event_t));
|
||||||
|
if (!af_event_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
return af_event_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_af_event_free(OpenAPI_af_event_t *af_event)
|
||||||
|
{
|
||||||
|
if (NULL == af_event) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(af_event);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_af_event_convertToJSON(OpenAPI_af_event_t *af_event)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (af_event == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_convertToJSON() failed [AfEvent]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_af_event_t *OpenAPI_af_event_parseFromJSON(cJSON *af_eventJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_af_event_t *af_event_local_var = NULL;
|
||||||
|
af_event_local_var = OpenAPI_af_event_create (
|
||||||
|
);
|
||||||
|
|
||||||
|
return af_event_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* af_event.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_af_event_H_
|
||||||
|
#define _OpenAPI_af_event_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_af_event_s OpenAPI_af_event_t;
|
||||||
|
typedef struct OpenAPI_af_event_s {
|
||||||
|
} OpenAPI_af_event_t;
|
||||||
|
|
||||||
|
OpenAPI_af_event_t *OpenAPI_af_event_create(
|
||||||
|
);
|
||||||
|
void OpenAPI_af_event_free(OpenAPI_af_event_t *af_event);
|
||||||
|
OpenAPI_af_event_t *OpenAPI_af_event_parseFromJSON(cJSON *af_eventJSON);
|
||||||
|
cJSON *OpenAPI_af_event_convertToJSON(OpenAPI_af_event_t *af_event);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_af_event_H_ */
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "af_event_exposure_data.h"
|
||||||
|
|
||||||
|
OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_create(
|
||||||
|
OpenAPI_list_t *af_events,
|
||||||
|
OpenAPI_list_t *af_ids,
|
||||||
|
OpenAPI_list_t *app_ids
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_af_event_exposure_data_t *af_event_exposure_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_event_exposure_data_t));
|
||||||
|
if (!af_event_exposure_data_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
af_event_exposure_data_local_var->af_events = af_events;
|
||||||
|
af_event_exposure_data_local_var->af_ids = af_ids;
|
||||||
|
af_event_exposure_data_local_var->app_ids = app_ids;
|
||||||
|
|
||||||
|
return af_event_exposure_data_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_af_event_exposure_data_free(OpenAPI_af_event_exposure_data_t *af_event_exposure_data)
|
||||||
|
{
|
||||||
|
if (NULL == af_event_exposure_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
OpenAPI_list_for_each(af_event_exposure_data->af_events, node) {
|
||||||
|
OpenAPI_af_event_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(af_event_exposure_data->af_events);
|
||||||
|
OpenAPI_list_for_each(af_event_exposure_data->af_ids, node) {
|
||||||
|
ogs_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(af_event_exposure_data->af_ids);
|
||||||
|
OpenAPI_list_for_each(af_event_exposure_data->app_ids, node) {
|
||||||
|
ogs_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(af_event_exposure_data->app_ids);
|
||||||
|
ogs_free(af_event_exposure_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_af_event_exposure_data_convertToJSON(OpenAPI_af_event_exposure_data_t *af_event_exposure_data)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (af_event_exposure_data == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [AfEventExposureData]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (!af_event_exposure_data->af_events) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [af_events]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON *af_eventsList = cJSON_AddArrayToObject(item, "afEvents");
|
||||||
|
if (af_eventsList == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [af_events]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *af_events_node;
|
||||||
|
if (af_event_exposure_data->af_events) {
|
||||||
|
OpenAPI_list_for_each(af_event_exposure_data->af_events, af_events_node) {
|
||||||
|
cJSON *itemLocal = OpenAPI_af_event_convertToJSON(af_events_node->data);
|
||||||
|
if (itemLocal == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [af_events]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToArray(af_eventsList, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (af_event_exposure_data->af_ids) {
|
||||||
|
cJSON *af_ids = cJSON_AddArrayToObject(item, "afIds");
|
||||||
|
if (af_ids == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [af_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *af_ids_node;
|
||||||
|
OpenAPI_list_for_each(af_event_exposure_data->af_ids, af_ids_node) {
|
||||||
|
if (cJSON_AddStringToObject(af_ids, "", (char*)af_ids_node->data) == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [af_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (af_event_exposure_data->app_ids) {
|
||||||
|
cJSON *app_ids = cJSON_AddArrayToObject(item, "appIds");
|
||||||
|
if (app_ids == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [app_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *app_ids_node;
|
||||||
|
OpenAPI_list_for_each(af_event_exposure_data->app_ids, app_ids_node) {
|
||||||
|
if (cJSON_AddStringToObject(app_ids, "", (char*)app_ids_node->data) == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_convertToJSON() failed [app_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_parseFromJSON(cJSON *af_event_exposure_dataJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_af_event_exposure_data_t *af_event_exposure_data_local_var = NULL;
|
||||||
|
cJSON *af_events = cJSON_GetObjectItemCaseSensitive(af_event_exposure_dataJSON, "afEvents");
|
||||||
|
if (!af_events) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [af_events]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_list_t *af_eventsList;
|
||||||
|
|
||||||
|
cJSON *af_events_local_nonprimitive;
|
||||||
|
if (!cJSON_IsArray(af_events)) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [af_events]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
af_eventsList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(af_events_local_nonprimitive, af_events ) {
|
||||||
|
if (!cJSON_IsObject(af_events_local_nonprimitive)) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [af_events]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_af_event_t *af_eventsItem = OpenAPI_af_event_parseFromJSON(af_events_local_nonprimitive);
|
||||||
|
|
||||||
|
OpenAPI_list_add(af_eventsList, af_eventsItem);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *af_ids = cJSON_GetObjectItemCaseSensitive(af_event_exposure_dataJSON, "afIds");
|
||||||
|
|
||||||
|
OpenAPI_list_t *af_idsList;
|
||||||
|
if (af_ids) {
|
||||||
|
cJSON *af_ids_local;
|
||||||
|
if (!cJSON_IsArray(af_ids)) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [af_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
af_idsList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(af_ids_local, af_ids) {
|
||||||
|
if (!cJSON_IsString(af_ids_local)) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [af_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_list_add(af_idsList, ogs_strdup(af_ids_local->valuestring));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *app_ids = cJSON_GetObjectItemCaseSensitive(af_event_exposure_dataJSON, "appIds");
|
||||||
|
|
||||||
|
OpenAPI_list_t *app_idsList;
|
||||||
|
if (app_ids) {
|
||||||
|
cJSON *app_ids_local;
|
||||||
|
if (!cJSON_IsArray(app_ids)) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [app_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
app_idsList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(app_ids_local, app_ids) {
|
||||||
|
if (!cJSON_IsString(app_ids_local)) {
|
||||||
|
ogs_error("OpenAPI_af_event_exposure_data_parseFromJSON() failed [app_ids]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_list_add(app_idsList, ogs_strdup(app_ids_local->valuestring));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
af_event_exposure_data_local_var = OpenAPI_af_event_exposure_data_create (
|
||||||
|
af_eventsList,
|
||||||
|
af_ids ? af_idsList : NULL,
|
||||||
|
app_ids ? app_idsList : NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
return af_event_exposure_data_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,42 @@
|
||||||
|
/*
|
||||||
|
* af_event_exposure_data.h
|
||||||
|
*
|
||||||
|
* AF Event Exposure data managed by a given NEF Instance
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_af_event_exposure_data_H_
|
||||||
|
#define _OpenAPI_af_event_exposure_data_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
#include "af_event.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_af_event_exposure_data_s OpenAPI_af_event_exposure_data_t;
|
||||||
|
typedef struct OpenAPI_af_event_exposure_data_s {
|
||||||
|
OpenAPI_list_t *af_events;
|
||||||
|
OpenAPI_list_t *af_ids;
|
||||||
|
OpenAPI_list_t *app_ids;
|
||||||
|
} OpenAPI_af_event_exposure_data_t;
|
||||||
|
|
||||||
|
OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_create(
|
||||||
|
OpenAPI_list_t *af_events,
|
||||||
|
OpenAPI_list_t *af_ids,
|
||||||
|
OpenAPI_list_t *app_ids
|
||||||
|
);
|
||||||
|
void OpenAPI_af_event_exposure_data_free(OpenAPI_af_event_exposure_data_t *af_event_exposure_data);
|
||||||
|
OpenAPI_af_event_exposure_data_t *OpenAPI_af_event_exposure_data_parseFromJSON(cJSON *af_event_exposure_dataJSON);
|
||||||
|
cJSON *OpenAPI_af_event_exposure_data_convertToJSON(OpenAPI_af_event_exposure_data_t *af_event_exposure_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_af_event_exposure_data_H_ */
|
||||||
|
|
|
@ -0,0 +1,166 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "af_external.h"
|
||||||
|
|
||||||
|
OpenAPI_af_external_t *OpenAPI_af_external_create(
|
||||||
|
char *af_id,
|
||||||
|
OpenAPI_list_t *allowed_geographic_area,
|
||||||
|
OpenAPI_privacy_check_related_action_e privacy_check_related_action,
|
||||||
|
OpenAPI_valid_time_period_t *valid_time_period
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_af_external_t *af_external_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_external_t));
|
||||||
|
if (!af_external_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
af_external_local_var->af_id = af_id;
|
||||||
|
af_external_local_var->allowed_geographic_area = allowed_geographic_area;
|
||||||
|
af_external_local_var->privacy_check_related_action = privacy_check_related_action;
|
||||||
|
af_external_local_var->valid_time_period = valid_time_period;
|
||||||
|
|
||||||
|
return af_external_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_af_external_free(OpenAPI_af_external_t *af_external)
|
||||||
|
{
|
||||||
|
if (NULL == af_external) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(af_external->af_id);
|
||||||
|
OpenAPI_list_for_each(af_external->allowed_geographic_area, node) {
|
||||||
|
OpenAPI_geographic_area_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(af_external->allowed_geographic_area);
|
||||||
|
OpenAPI_valid_time_period_free(af_external->valid_time_period);
|
||||||
|
ogs_free(af_external);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_af_external_convertToJSON(OpenAPI_af_external_t *af_external)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (af_external == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_external_convertToJSON() failed [AfExternal]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (af_external->af_id) {
|
||||||
|
if (cJSON_AddStringToObject(item, "afId", af_external->af_id) == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_external_convertToJSON() failed [af_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (af_external->allowed_geographic_area) {
|
||||||
|
cJSON *allowed_geographic_areaList = cJSON_AddArrayToObject(item, "allowedGeographicArea");
|
||||||
|
if (allowed_geographic_areaList == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_external_convertToJSON() failed [allowed_geographic_area]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *allowed_geographic_area_node;
|
||||||
|
if (af_external->allowed_geographic_area) {
|
||||||
|
OpenAPI_list_for_each(af_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_external_convertToJSON() failed [allowed_geographic_area]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToArray(allowed_geographic_areaList, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (af_external->privacy_check_related_action) {
|
||||||
|
if (cJSON_AddStringToObject(item, "privacyCheckRelatedAction", OpenAPI_privacy_check_related_action_ToString(af_external->privacy_check_related_action)) == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_external_convertToJSON() failed [privacy_check_related_action]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (af_external->valid_time_period) {
|
||||||
|
cJSON *valid_time_period_local_JSON = OpenAPI_valid_time_period_convertToJSON(af_external->valid_time_period);
|
||||||
|
if (valid_time_period_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_af_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_external_convertToJSON() failed [valid_time_period]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_af_external_t *OpenAPI_af_external_parseFromJSON(cJSON *af_externalJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_af_external_t *af_external_local_var = NULL;
|
||||||
|
cJSON *af_id = cJSON_GetObjectItemCaseSensitive(af_externalJSON, "afId");
|
||||||
|
|
||||||
|
if (af_id) {
|
||||||
|
if (!cJSON_IsString(af_id)) {
|
||||||
|
ogs_error("OpenAPI_af_external_parseFromJSON() failed [af_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *allowed_geographic_area = cJSON_GetObjectItemCaseSensitive(af_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_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_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_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_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 *valid_time_period = cJSON_GetObjectItemCaseSensitive(af_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_external_local_var = OpenAPI_af_external_create (
|
||||||
|
af_id ? ogs_strdup(af_id->valuestring) : NULL,
|
||||||
|
allowed_geographic_area ? allowed_geographic_areaList : NULL,
|
||||||
|
privacy_check_related_action ? privacy_check_related_actionVariable : 0,
|
||||||
|
valid_time_period ? valid_time_period_local_nonprim : NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
return af_external_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,46 @@
|
||||||
|
/*
|
||||||
|
* af_external.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_af_external_H_
|
||||||
|
#define _OpenAPI_af_external_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.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_external_s OpenAPI_af_external_t;
|
||||||
|
typedef struct OpenAPI_af_external_s {
|
||||||
|
char *af_id;
|
||||||
|
OpenAPI_list_t *allowed_geographic_area;
|
||||||
|
OpenAPI_privacy_check_related_action_e privacy_check_related_action;
|
||||||
|
struct OpenAPI_valid_time_period_s *valid_time_period;
|
||||||
|
} OpenAPI_af_external_t;
|
||||||
|
|
||||||
|
OpenAPI_af_external_t *OpenAPI_af_external_create(
|
||||||
|
char *af_id,
|
||||||
|
OpenAPI_list_t *allowed_geographic_area,
|
||||||
|
OpenAPI_privacy_check_related_action_e privacy_check_related_action,
|
||||||
|
OpenAPI_valid_time_period_t *valid_time_period
|
||||||
|
);
|
||||||
|
void OpenAPI_af_external_free(OpenAPI_af_external_t *af_external);
|
||||||
|
OpenAPI_af_external_t *OpenAPI_af_external_parseFromJSON(cJSON *af_externalJSON);
|
||||||
|
cJSON *OpenAPI_af_external_convertToJSON(OpenAPI_af_external_t *af_external);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_af_external_H_ */
|
||||||
|
|
|
@ -0,0 +1,192 @@
|
||||||
|
|
||||||
|
#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;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,49 @@
|
||||||
|
/*
|
||||||
|
* 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);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_af_non_external_H_ */
|
||||||
|
|
|
@ -0,0 +1,147 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "am_policy_data.h"
|
||||||
|
|
||||||
|
OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_create(
|
||||||
|
OpenAPI_list_t* pra_infos,
|
||||||
|
OpenAPI_list_t *subsc_cats
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_am_policy_data_t *am_policy_data_local_var = OpenAPI_malloc(sizeof(OpenAPI_am_policy_data_t));
|
||||||
|
if (!am_policy_data_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
am_policy_data_local_var->pra_infos = pra_infos;
|
||||||
|
am_policy_data_local_var->subsc_cats = subsc_cats;
|
||||||
|
|
||||||
|
return am_policy_data_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_am_policy_data_free(OpenAPI_am_policy_data_t *am_policy_data)
|
||||||
|
{
|
||||||
|
if (NULL == am_policy_data) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
OpenAPI_list_for_each(am_policy_data->pra_infos, node) {
|
||||||
|
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)node->data;
|
||||||
|
OpenAPI_presence_info_free(localKeyValue->value);
|
||||||
|
ogs_free(localKeyValue);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(am_policy_data->pra_infos);
|
||||||
|
OpenAPI_list_for_each(am_policy_data->subsc_cats, node) {
|
||||||
|
ogs_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(am_policy_data->subsc_cats);
|
||||||
|
ogs_free(am_policy_data);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_am_policy_data_convertToJSON(OpenAPI_am_policy_data_t *am_policy_data)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (am_policy_data == NULL) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_convertToJSON() failed [AmPolicyData]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (am_policy_data->pra_infos) {
|
||||||
|
cJSON *pra_infos = cJSON_AddObjectToObject(item, "praInfos");
|
||||||
|
if (pra_infos == NULL) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_convertToJSON() failed [pra_infos]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON *localMapObject = pra_infos;
|
||||||
|
OpenAPI_lnode_t *pra_infos_node;
|
||||||
|
if (am_policy_data->pra_infos) {
|
||||||
|
OpenAPI_list_for_each(am_policy_data->pra_infos, pra_infos_node) {
|
||||||
|
OpenAPI_map_t *localKeyValue = (OpenAPI_map_t*)pra_infos_node->data;
|
||||||
|
cJSON *itemLocal = OpenAPI_presence_info_convertToJSON(localKeyValue->value);
|
||||||
|
if (itemLocal == NULL) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_convertToJSON() failed [pra_infos]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(pra_infos, localKeyValue->key, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (am_policy_data->subsc_cats) {
|
||||||
|
cJSON *subsc_cats = cJSON_AddArrayToObject(item, "subscCats");
|
||||||
|
if (subsc_cats == NULL) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_convertToJSON() failed [subsc_cats]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *subsc_cats_node;
|
||||||
|
OpenAPI_list_for_each(am_policy_data->subsc_cats, subsc_cats_node) {
|
||||||
|
if (cJSON_AddStringToObject(subsc_cats, "", (char*)subsc_cats_node->data) == NULL) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_convertToJSON() failed [subsc_cats]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_parseFromJSON(cJSON *am_policy_dataJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_am_policy_data_t *am_policy_data_local_var = NULL;
|
||||||
|
cJSON *pra_infos = cJSON_GetObjectItemCaseSensitive(am_policy_dataJSON, "praInfos");
|
||||||
|
|
||||||
|
OpenAPI_list_t *pra_infosList;
|
||||||
|
if (pra_infos) {
|
||||||
|
cJSON *pra_infos_local_map;
|
||||||
|
if (!cJSON_IsObject(pra_infos)) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_parseFromJSON() failed [pra_infos]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
pra_infosList = OpenAPI_list_create();
|
||||||
|
OpenAPI_map_t *localMapKeyPair = NULL;
|
||||||
|
cJSON_ArrayForEach(pra_infos_local_map, pra_infos) {
|
||||||
|
cJSON *localMapObject = pra_infos_local_map;
|
||||||
|
if (!cJSON_IsObject(pra_infos_local_map)) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_parseFromJSON() failed [pra_infos]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
localMapKeyPair = OpenAPI_map_create(
|
||||||
|
localMapObject->string, OpenAPI_presence_info_parseFromJSON(localMapObject));
|
||||||
|
OpenAPI_list_add(pra_infosList, localMapKeyPair);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *subsc_cats = cJSON_GetObjectItemCaseSensitive(am_policy_dataJSON, "subscCats");
|
||||||
|
|
||||||
|
OpenAPI_list_t *subsc_catsList;
|
||||||
|
if (subsc_cats) {
|
||||||
|
cJSON *subsc_cats_local;
|
||||||
|
if (!cJSON_IsArray(subsc_cats)) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_parseFromJSON() failed [subsc_cats]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
subsc_catsList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(subsc_cats_local, subsc_cats) {
|
||||||
|
if (!cJSON_IsString(subsc_cats_local)) {
|
||||||
|
ogs_error("OpenAPI_am_policy_data_parseFromJSON() failed [subsc_cats]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_list_add(subsc_catsList, ogs_strdup(subsc_cats_local->valuestring));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
am_policy_data_local_var = OpenAPI_am_policy_data_create (
|
||||||
|
pra_infos ? pra_infosList : NULL,
|
||||||
|
subsc_cats ? subsc_catsList : NULL
|
||||||
|
);
|
||||||
|
|
||||||
|
return am_policy_data_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,40 @@
|
||||||
|
/*
|
||||||
|
* am_policy_data.h
|
||||||
|
*
|
||||||
|
* Contains the AM policy data for a given subscriber.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_am_policy_data_H_
|
||||||
|
#define _OpenAPI_am_policy_data_H_
|
||||||
|
|
||||||
|
#include <string.h>
|
||||||
|
#include "../external/cJSON.h"
|
||||||
|
#include "../include/list.h"
|
||||||
|
#include "../include/keyValuePair.h"
|
||||||
|
#include "../include/binary.h"
|
||||||
|
#include "presence_info.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef struct OpenAPI_am_policy_data_s OpenAPI_am_policy_data_t;
|
||||||
|
typedef struct OpenAPI_am_policy_data_s {
|
||||||
|
OpenAPI_list_t* pra_infos;
|
||||||
|
OpenAPI_list_t *subsc_cats;
|
||||||
|
} OpenAPI_am_policy_data_t;
|
||||||
|
|
||||||
|
OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_create(
|
||||||
|
OpenAPI_list_t* pra_infos,
|
||||||
|
OpenAPI_list_t *subsc_cats
|
||||||
|
);
|
||||||
|
void OpenAPI_am_policy_data_free(OpenAPI_am_policy_data_t *am_policy_data);
|
||||||
|
OpenAPI_am_policy_data_t *OpenAPI_am_policy_data_parseFromJSON(cJSON *am_policy_dataJSON);
|
||||||
|
cJSON *OpenAPI_am_policy_data_convertToJSON(OpenAPI_am_policy_data_t *am_policy_data);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_am_policy_data_H_ */
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ambr.h"
|
||||||
|
|
||||||
|
OpenAPI_ambr_t *OpenAPI_ambr_create(
|
||||||
|
char *uplink,
|
||||||
|
char *downlink
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_ambr_t *ambr_local_var = OpenAPI_malloc(sizeof(OpenAPI_ambr_t));
|
||||||
|
if (!ambr_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ambr_local_var->uplink = uplink;
|
||||||
|
ambr_local_var->downlink = downlink;
|
||||||
|
|
||||||
|
return ambr_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_ambr_free(OpenAPI_ambr_t *ambr)
|
||||||
|
{
|
||||||
|
if (NULL == ambr) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(ambr->uplink);
|
||||||
|
ogs_free(ambr->downlink);
|
||||||
|
ogs_free(ambr);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_ambr_convertToJSON(OpenAPI_ambr_t *ambr)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (ambr == NULL) {
|
||||||
|
ogs_error("OpenAPI_ambr_convertToJSON() failed [Ambr]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (!ambr->uplink) {
|
||||||
|
ogs_error("OpenAPI_ambr_convertToJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "uplink", ambr->uplink) == NULL) {
|
||||||
|
ogs_error("OpenAPI_ambr_convertToJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ambr->downlink) {
|
||||||
|
ogs_error("OpenAPI_ambr_convertToJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "downlink", ambr->downlink) == NULL) {
|
||||||
|
ogs_error("OpenAPI_ambr_convertToJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_ambr_t *OpenAPI_ambr_parseFromJSON(cJSON *ambrJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_ambr_t *ambr_local_var = NULL;
|
||||||
|
cJSON *uplink = cJSON_GetObjectItemCaseSensitive(ambrJSON, "uplink");
|
||||||
|
if (!uplink) {
|
||||||
|
ogs_error("OpenAPI_ambr_parseFromJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(uplink)) {
|
||||||
|
ogs_error("OpenAPI_ambr_parseFromJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *downlink = cJSON_GetObjectItemCaseSensitive(ambrJSON, "downlink");
|
||||||
|
if (!downlink) {
|
||||||
|
ogs_error("OpenAPI_ambr_parseFromJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(downlink)) {
|
||||||
|
ogs_error("OpenAPI_ambr_parseFromJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
ambr_local_var = OpenAPI_ambr_create (
|
||||||
|
ogs_strdup(uplink->valuestring),
|
||||||
|
ogs_strdup(downlink->valuestring)
|
||||||
|
);
|
||||||
|
|
||||||
|
return ambr_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* ambr.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_ambr_H_
|
||||||
|
#define _OpenAPI_ambr_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_ambr_s OpenAPI_ambr_t;
|
||||||
|
typedef struct OpenAPI_ambr_s {
|
||||||
|
char *uplink;
|
||||||
|
char *downlink;
|
||||||
|
} OpenAPI_ambr_t;
|
||||||
|
|
||||||
|
OpenAPI_ambr_t *OpenAPI_ambr_create(
|
||||||
|
char *uplink,
|
||||||
|
char *downlink
|
||||||
|
);
|
||||||
|
void OpenAPI_ambr_free(OpenAPI_ambr_t *ambr);
|
||||||
|
OpenAPI_ambr_t *OpenAPI_ambr_parseFromJSON(cJSON *ambrJSON);
|
||||||
|
cJSON *OpenAPI_ambr_convertToJSON(OpenAPI_ambr_t *ambr);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_ambr_H_ */
|
||||||
|
|
|
@ -0,0 +1,101 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "ambr_rm.h"
|
||||||
|
|
||||||
|
OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_create(
|
||||||
|
char *uplink,
|
||||||
|
char *downlink
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_ambr_rm_t *ambr_rm_local_var = OpenAPI_malloc(sizeof(OpenAPI_ambr_rm_t));
|
||||||
|
if (!ambr_rm_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
ambr_rm_local_var->uplink = uplink;
|
||||||
|
ambr_rm_local_var->downlink = downlink;
|
||||||
|
|
||||||
|
return ambr_rm_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_ambr_rm_free(OpenAPI_ambr_rm_t *ambr_rm)
|
||||||
|
{
|
||||||
|
if (NULL == ambr_rm) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(ambr_rm->uplink);
|
||||||
|
ogs_free(ambr_rm->downlink);
|
||||||
|
ogs_free(ambr_rm);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_ambr_rm_convertToJSON(OpenAPI_ambr_rm_t *ambr_rm)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (ambr_rm == NULL) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [AmbrRm]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (!ambr_rm->uplink) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "uplink", ambr_rm->uplink) == NULL) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!ambr_rm->downlink) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "downlink", ambr_rm->downlink) == NULL) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_convertToJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_parseFromJSON(cJSON *ambr_rmJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_ambr_rm_t *ambr_rm_local_var = NULL;
|
||||||
|
cJSON *uplink = cJSON_GetObjectItemCaseSensitive(ambr_rmJSON, "uplink");
|
||||||
|
if (!uplink) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(uplink)) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [uplink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *downlink = cJSON_GetObjectItemCaseSensitive(ambr_rmJSON, "downlink");
|
||||||
|
if (!downlink) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(downlink)) {
|
||||||
|
ogs_error("OpenAPI_ambr_rm_parseFromJSON() failed [downlink]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
ambr_rm_local_var = OpenAPI_ambr_rm_create (
|
||||||
|
ogs_strdup(uplink->valuestring),
|
||||||
|
ogs_strdup(downlink->valuestring)
|
||||||
|
);
|
||||||
|
|
||||||
|
return ambr_rm_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* ambr_rm.h
|
||||||
|
*
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef _OpenAPI_ambr_rm_H_
|
||||||
|
#define _OpenAPI_ambr_rm_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_ambr_rm_s OpenAPI_ambr_rm_t;
|
||||||
|
typedef struct OpenAPI_ambr_rm_s {
|
||||||
|
char *uplink;
|
||||||
|
char *downlink;
|
||||||
|
} OpenAPI_ambr_rm_t;
|
||||||
|
|
||||||
|
OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_create(
|
||||||
|
char *uplink,
|
||||||
|
char *downlink
|
||||||
|
);
|
||||||
|
void OpenAPI_ambr_rm_free(OpenAPI_ambr_rm_t *ambr_rm);
|
||||||
|
OpenAPI_ambr_rm_t *OpenAPI_ambr_rm_parseFromJSON(cJSON *ambr_rmJSON);
|
||||||
|
cJSON *OpenAPI_ambr_rm_convertToJSON(OpenAPI_ambr_rm_t *ambr_rm);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* _OpenAPI_ambr_rm_H_ */
|
||||||
|
|
|
@ -0,0 +1,548 @@
|
||||||
|
|
||||||
|
#include <stdlib.h>
|
||||||
|
#include <string.h>
|
||||||
|
#include <stdio.h>
|
||||||
|
#include "amf3_gpp_access_registration.h"
|
||||||
|
|
||||||
|
OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_create(
|
||||||
|
char *amf_instance_id,
|
||||||
|
char *supported_features,
|
||||||
|
int purge_flag,
|
||||||
|
char *pei,
|
||||||
|
OpenAPI_ims_vo_ps_t *ims_vo_ps,
|
||||||
|
char *dereg_callback_uri,
|
||||||
|
char *amf_service_name_dereg,
|
||||||
|
char *pcscf_restoration_callback_uri,
|
||||||
|
char *amf_service_name_pcscf_rest,
|
||||||
|
int initial_registration_ind,
|
||||||
|
OpenAPI_guami_t *guami,
|
||||||
|
OpenAPI_list_t *backup_amf_info,
|
||||||
|
int dr_flag,
|
||||||
|
OpenAPI_rat_type_t *rat_type,
|
||||||
|
int urrp_indicator,
|
||||||
|
char *amf_ee_subscription_id,
|
||||||
|
int ue_srvcc_capability,
|
||||||
|
char *nid,
|
||||||
|
char *registration_time,
|
||||||
|
char *vgmlc_address_ipv4,
|
||||||
|
char *vgmlc_address_ipv6,
|
||||||
|
char *vgmlc_fqdn
|
||||||
|
)
|
||||||
|
{
|
||||||
|
OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration_local_var = OpenAPI_malloc(sizeof(OpenAPI_amf3_gpp_access_registration_t));
|
||||||
|
if (!amf3_gpp_access_registration_local_var) {
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
amf3_gpp_access_registration_local_var->amf_instance_id = amf_instance_id;
|
||||||
|
amf3_gpp_access_registration_local_var->supported_features = supported_features;
|
||||||
|
amf3_gpp_access_registration_local_var->purge_flag = purge_flag;
|
||||||
|
amf3_gpp_access_registration_local_var->pei = pei;
|
||||||
|
amf3_gpp_access_registration_local_var->ims_vo_ps = ims_vo_ps;
|
||||||
|
amf3_gpp_access_registration_local_var->dereg_callback_uri = dereg_callback_uri;
|
||||||
|
amf3_gpp_access_registration_local_var->amf_service_name_dereg = amf_service_name_dereg;
|
||||||
|
amf3_gpp_access_registration_local_var->pcscf_restoration_callback_uri = pcscf_restoration_callback_uri;
|
||||||
|
amf3_gpp_access_registration_local_var->amf_service_name_pcscf_rest = amf_service_name_pcscf_rest;
|
||||||
|
amf3_gpp_access_registration_local_var->initial_registration_ind = initial_registration_ind;
|
||||||
|
amf3_gpp_access_registration_local_var->guami = guami;
|
||||||
|
amf3_gpp_access_registration_local_var->backup_amf_info = backup_amf_info;
|
||||||
|
amf3_gpp_access_registration_local_var->dr_flag = dr_flag;
|
||||||
|
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->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;
|
||||||
|
|
||||||
|
return amf3_gpp_access_registration_local_var;
|
||||||
|
}
|
||||||
|
|
||||||
|
void OpenAPI_amf3_gpp_access_registration_free(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration)
|
||||||
|
{
|
||||||
|
if (NULL == amf3_gpp_access_registration) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
OpenAPI_lnode_t *node;
|
||||||
|
ogs_free(amf3_gpp_access_registration->amf_instance_id);
|
||||||
|
ogs_free(amf3_gpp_access_registration->supported_features);
|
||||||
|
ogs_free(amf3_gpp_access_registration->pei);
|
||||||
|
OpenAPI_ims_vo_ps_free(amf3_gpp_access_registration->ims_vo_ps);
|
||||||
|
ogs_free(amf3_gpp_access_registration->dereg_callback_uri);
|
||||||
|
ogs_free(amf3_gpp_access_registration->amf_service_name_dereg);
|
||||||
|
ogs_free(amf3_gpp_access_registration->pcscf_restoration_callback_uri);
|
||||||
|
ogs_free(amf3_gpp_access_registration->amf_service_name_pcscf_rest);
|
||||||
|
OpenAPI_guami_free(amf3_gpp_access_registration->guami);
|
||||||
|
OpenAPI_list_for_each(amf3_gpp_access_registration->backup_amf_info, node) {
|
||||||
|
OpenAPI_backup_amf_info_free(node->data);
|
||||||
|
}
|
||||||
|
OpenAPI_list_free(amf3_gpp_access_registration->backup_amf_info);
|
||||||
|
OpenAPI_rat_type_free(amf3_gpp_access_registration->rat_type);
|
||||||
|
ogs_free(amf3_gpp_access_registration->amf_ee_subscription_id);
|
||||||
|
ogs_free(amf3_gpp_access_registration->nid);
|
||||||
|
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);
|
||||||
|
ogs_free(amf3_gpp_access_registration);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *OpenAPI_amf3_gpp_access_registration_convertToJSON(OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration)
|
||||||
|
{
|
||||||
|
cJSON *item = NULL;
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [Amf3GppAccessRegistration]");
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
||||||
|
item = cJSON_CreateObject();
|
||||||
|
if (!amf3_gpp_access_registration->amf_instance_id) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [amf_instance_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "amfInstanceId", amf3_gpp_access_registration->amf_instance_id) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [amf_instance_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->supported_features) {
|
||||||
|
if (cJSON_AddStringToObject(item, "supportedFeatures", amf3_gpp_access_registration->supported_features) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [supported_features]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->purge_flag >= 0) {
|
||||||
|
if (cJSON_AddBoolToObject(item, "purgeFlag", amf3_gpp_access_registration->purge_flag) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [purge_flag]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->pei) {
|
||||||
|
if (cJSON_AddStringToObject(item, "pei", amf3_gpp_access_registration->pei) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [pei]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->ims_vo_ps) {
|
||||||
|
cJSON *ims_vo_ps_local_JSON = OpenAPI_ims_vo_ps_convertToJSON(amf3_gpp_access_registration->ims_vo_ps);
|
||||||
|
if (ims_vo_ps_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ims_vo_ps]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "imsVoPs", ims_vo_ps_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [ims_vo_ps]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!amf3_gpp_access_registration->dereg_callback_uri) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [dereg_callback_uri]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
if (cJSON_AddStringToObject(item, "deregCallbackUri", amf3_gpp_access_registration->dereg_callback_uri) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [dereg_callback_uri]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->amf_service_name_dereg) {
|
||||||
|
if (cJSON_AddStringToObject(item, "amfServiceNameDereg", amf3_gpp_access_registration->amf_service_name_dereg) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [amf_service_name_dereg]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->pcscf_restoration_callback_uri) {
|
||||||
|
if (cJSON_AddStringToObject(item, "pcscfRestorationCallbackUri", amf3_gpp_access_registration->pcscf_restoration_callback_uri) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [pcscf_restoration_callback_uri]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->amf_service_name_pcscf_rest) {
|
||||||
|
if (cJSON_AddStringToObject(item, "amfServiceNamePcscfRest", amf3_gpp_access_registration->amf_service_name_pcscf_rest) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [amf_service_name_pcscf_rest]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->initial_registration_ind >= 0) {
|
||||||
|
if (cJSON_AddBoolToObject(item, "initialRegistrationInd", amf3_gpp_access_registration->initial_registration_ind) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [initial_registration_ind]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!amf3_gpp_access_registration->guami) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [guami]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON *guami_local_JSON = OpenAPI_guami_convertToJSON(amf3_gpp_access_registration->guami);
|
||||||
|
if (guami_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [guami]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "guami", guami_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [guami]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->backup_amf_info) {
|
||||||
|
cJSON *backup_amf_infoList = cJSON_AddArrayToObject(item, "backupAmfInfo");
|
||||||
|
if (backup_amf_infoList == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [backup_amf_info]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_lnode_t *backup_amf_info_node;
|
||||||
|
if (amf3_gpp_access_registration->backup_amf_info) {
|
||||||
|
OpenAPI_list_for_each(amf3_gpp_access_registration->backup_amf_info, backup_amf_info_node) {
|
||||||
|
cJSON *itemLocal = OpenAPI_backup_amf_info_convertToJSON(backup_amf_info_node->data);
|
||||||
|
if (itemLocal == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [backup_amf_info]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToArray(backup_amf_infoList, itemLocal);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->dr_flag >= 0) {
|
||||||
|
if (cJSON_AddBoolToObject(item, "drFlag", amf3_gpp_access_registration->dr_flag) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [dr_flag]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!amf3_gpp_access_registration->rat_type) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON *rat_type_local_JSON = OpenAPI_rat_type_convertToJSON(amf3_gpp_access_registration->rat_type);
|
||||||
|
if (rat_type_local_JSON == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
cJSON_AddItemToObject(item, "ratType", rat_type_local_JSON);
|
||||||
|
if (item->child == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->urrp_indicator >= 0) {
|
||||||
|
if (cJSON_AddBoolToObject(item, "urrpIndicator", amf3_gpp_access_registration->urrp_indicator) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [urrp_indicator]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->amf_ee_subscription_id) {
|
||||||
|
if (cJSON_AddStringToObject(item, "amfEeSubscriptionId", amf3_gpp_access_registration->amf_ee_subscription_id) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [amf_ee_subscription_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->ue_srvcc_capability >= 0) {
|
||||||
|
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;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if (amf3_gpp_access_registration->registration_time) {
|
||||||
|
if (cJSON_AddStringToObject(item, "registrationTime", amf3_gpp_access_registration->registration_time) == NULL) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_convertToJSON() failed [registration_time]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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]");
|
||||||
|
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]");
|
||||||
|
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]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
end:
|
||||||
|
return item;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_amf3_gpp_access_registration_t *OpenAPI_amf3_gpp_access_registration_parseFromJSON(cJSON *amf3_gpp_access_registrationJSON)
|
||||||
|
{
|
||||||
|
OpenAPI_amf3_gpp_access_registration_t *amf3_gpp_access_registration_local_var = NULL;
|
||||||
|
cJSON *amf_instance_id = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "amfInstanceId");
|
||||||
|
if (!amf_instance_id) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [amf_instance_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(amf_instance_id)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [amf_instance_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *supported_features = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "supportedFeatures");
|
||||||
|
|
||||||
|
if (supported_features) {
|
||||||
|
if (!cJSON_IsString(supported_features)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [supported_features]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *purge_flag = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "purgeFlag");
|
||||||
|
|
||||||
|
if (purge_flag) {
|
||||||
|
if (!cJSON_IsBool(purge_flag)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [purge_flag]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *pei = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "pei");
|
||||||
|
|
||||||
|
if (pei) {
|
||||||
|
if (!cJSON_IsString(pei)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [pei]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *ims_vo_ps = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "imsVoPs");
|
||||||
|
|
||||||
|
OpenAPI_ims_vo_ps_t *ims_vo_ps_local_nonprim = NULL;
|
||||||
|
if (ims_vo_ps) {
|
||||||
|
ims_vo_ps_local_nonprim = OpenAPI_ims_vo_ps_parseFromJSON(ims_vo_ps);
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *dereg_callback_uri = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "deregCallbackUri");
|
||||||
|
if (!dereg_callback_uri) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [dereg_callback_uri]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
if (!cJSON_IsString(dereg_callback_uri)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [dereg_callback_uri]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *amf_service_name_dereg = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "amfServiceNameDereg");
|
||||||
|
|
||||||
|
if (amf_service_name_dereg) {
|
||||||
|
if (!cJSON_IsString(amf_service_name_dereg)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [amf_service_name_dereg]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *pcscf_restoration_callback_uri = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "pcscfRestorationCallbackUri");
|
||||||
|
|
||||||
|
if (pcscf_restoration_callback_uri) {
|
||||||
|
if (!cJSON_IsString(pcscf_restoration_callback_uri)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [pcscf_restoration_callback_uri]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *amf_service_name_pcscf_rest = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "amfServiceNamePcscfRest");
|
||||||
|
|
||||||
|
if (amf_service_name_pcscf_rest) {
|
||||||
|
if (!cJSON_IsString(amf_service_name_pcscf_rest)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [amf_service_name_pcscf_rest]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *initial_registration_ind = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "initialRegistrationInd");
|
||||||
|
|
||||||
|
if (initial_registration_ind) {
|
||||||
|
if (!cJSON_IsBool(initial_registration_ind)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [initial_registration_ind]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *guami = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "guami");
|
||||||
|
if (!guami) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [guami]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_guami_t *guami_local_nonprim = NULL;
|
||||||
|
|
||||||
|
guami_local_nonprim = OpenAPI_guami_parseFromJSON(guami);
|
||||||
|
|
||||||
|
cJSON *backup_amf_info = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "backupAmfInfo");
|
||||||
|
|
||||||
|
OpenAPI_list_t *backup_amf_infoList;
|
||||||
|
if (backup_amf_info) {
|
||||||
|
cJSON *backup_amf_info_local_nonprimitive;
|
||||||
|
if (!cJSON_IsArray(backup_amf_info)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [backup_amf_info]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
backup_amf_infoList = OpenAPI_list_create();
|
||||||
|
|
||||||
|
cJSON_ArrayForEach(backup_amf_info_local_nonprimitive, backup_amf_info ) {
|
||||||
|
if (!cJSON_IsObject(backup_amf_info_local_nonprimitive)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [backup_amf_info]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
OpenAPI_backup_amf_info_t *backup_amf_infoItem = OpenAPI_backup_amf_info_parseFromJSON(backup_amf_info_local_nonprimitive);
|
||||||
|
|
||||||
|
OpenAPI_list_add(backup_amf_infoList, backup_amf_infoItem);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *dr_flag = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "drFlag");
|
||||||
|
|
||||||
|
if (dr_flag) {
|
||||||
|
if (!cJSON_IsBool(dr_flag)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [dr_flag]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *rat_type = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "ratType");
|
||||||
|
if (!rat_type) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [rat_type]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
|
||||||
|
OpenAPI_rat_type_t *rat_type_local_nonprim = NULL;
|
||||||
|
|
||||||
|
rat_type_local_nonprim = OpenAPI_rat_type_parseFromJSON(rat_type);
|
||||||
|
|
||||||
|
cJSON *urrp_indicator = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "urrpIndicator");
|
||||||
|
|
||||||
|
if (urrp_indicator) {
|
||||||
|
if (!cJSON_IsBool(urrp_indicator)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [urrp_indicator]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *amf_ee_subscription_id = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "amfEeSubscriptionId");
|
||||||
|
|
||||||
|
if (amf_ee_subscription_id) {
|
||||||
|
if (!cJSON_IsString(amf_ee_subscription_id)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [amf_ee_subscription_id]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *ue_srvcc_capability = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "ueSrvccCapability");
|
||||||
|
|
||||||
|
if (ue_srvcc_capability) {
|
||||||
|
if (!cJSON_IsBool(ue_srvcc_capability)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [ue_srvcc_capability]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
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) {
|
||||||
|
if (!cJSON_IsString(registration_time)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [registration_time]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *vgmlc_address_ipv4 = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddressIpv4");
|
||||||
|
|
||||||
|
if (vgmlc_address_ipv4) {
|
||||||
|
if (!cJSON_IsString(vgmlc_address_ipv4)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv4]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *vgmlc_address_ipv6 = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcAddressIpv6");
|
||||||
|
|
||||||
|
if (vgmlc_address_ipv6) {
|
||||||
|
if (!cJSON_IsString(vgmlc_address_ipv6)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_address_ipv6]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cJSON *vgmlc_fqdn = cJSON_GetObjectItemCaseSensitive(amf3_gpp_access_registrationJSON, "vgmlcFqdn");
|
||||||
|
|
||||||
|
if (vgmlc_fqdn) {
|
||||||
|
if (!cJSON_IsString(vgmlc_fqdn)) {
|
||||||
|
ogs_error("OpenAPI_amf3_gpp_access_registration_parseFromJSON() failed [vgmlc_fqdn]");
|
||||||
|
goto end;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
amf3_gpp_access_registration_local_var = OpenAPI_amf3_gpp_access_registration_create (
|
||||||
|
ogs_strdup(amf_instance_id->valuestring),
|
||||||
|
supported_features ? ogs_strdup(supported_features->valuestring) : NULL,
|
||||||
|
purge_flag ? purge_flag->valueint : 0,
|
||||||
|
pei ? ogs_strdup(pei->valuestring) : NULL,
|
||||||
|
ims_vo_ps ? ims_vo_ps_local_nonprim : NULL,
|
||||||
|
ogs_strdup(dereg_callback_uri->valuestring),
|
||||||
|
amf_service_name_dereg ? ogs_strdup(amf_service_name_dereg->valuestring) : NULL,
|
||||||
|
pcscf_restoration_callback_uri ? ogs_strdup(pcscf_restoration_callback_uri->valuestring) : NULL,
|
||||||
|
amf_service_name_pcscf_rest ? ogs_strdup(amf_service_name_pcscf_rest->valuestring) : NULL,
|
||||||
|
initial_registration_ind ? initial_registration_ind->valueint : 0,
|
||||||
|
guami_local_nonprim,
|
||||||
|
backup_amf_info ? backup_amf_infoList : NULL,
|
||||||
|
dr_flag ? dr_flag->valueint : 0,
|
||||||
|
rat_type_local_nonprim,
|
||||||
|
urrp_indicator ? urrp_indicator->valueint : 0,
|
||||||
|
amf_ee_subscription_id ? ogs_strdup(amf_ee_subscription_id->valuestring) : 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
|
||||||
|
);
|
||||||
|
|
||||||
|
return amf3_gpp_access_registration_local_var;
|
||||||
|
end:
|
||||||
|
return NULL;
|
||||||
|
}
|
||||||
|
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue