mirror of
https://github.com/open5gs/open5gs.git
synced 2025-10-24 08:33:48 +00:00
Compare commits
40 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
0552bc49c9 | ||
|
|
c9363b1320 | ||
|
|
408c378b94 | ||
|
|
bfa6eae71c | ||
|
|
55e9f08430 | ||
|
|
1c13d7f5ec | ||
|
|
8d0ce5b03c | ||
|
|
5fb0611cb2 | ||
|
|
d6ed13968d | ||
|
|
f15d2c96fe | ||
|
|
508a78d43b | ||
|
|
f250b6e411 | ||
|
|
d17ea0f135 | ||
|
|
b4358fe703 | ||
|
|
e531ccab5a | ||
|
|
a0ebf20c88 | ||
|
|
31cc259ee4 | ||
|
|
e803b01d9c | ||
|
|
0c61e7b70b | ||
|
|
80e337b465 | ||
|
|
6946dc4998 | ||
|
|
7b29cdf898 | ||
|
|
7dd4609c0f | ||
|
|
060d2a08f5 | ||
|
|
c9cfc4cf6e | ||
|
|
a96d3ca0fa | ||
|
|
1238b30526 | ||
|
|
70a7bac6b2 | ||
|
|
b329b09573 | ||
|
|
88346c0141 | ||
|
|
b35eb9fcf4 | ||
|
|
79b0552bb0 | ||
|
|
235a041b8d | ||
|
|
65aea5ebf2 | ||
|
|
4115799c2a | ||
|
|
efd1780745 | ||
|
|
dcec18a3d8 | ||
|
|
371e22c96b | ||
|
|
171f15f684 | ||
|
|
ef3e7b2528 |
23
README.md
23
README.md
@@ -3,13 +3,22 @@
|
||||
If you find Open5GS useful for work, please consider supporting this Open Source project by [Becoming a sponsor](https://github.com/sponsors/acetcom). To manage the funding transactions transparently, you can donate through [OpenCollective](https://opencollective.com/open5gs).
|
||||
|
||||
<h3 align="center">Special Sponsor</h3>
|
||||
<!--special start-->
|
||||
|
||||
<p align="center">
|
||||
<table>
|
||||
<tbody>
|
||||
<tr>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://nextepc.com/" target="_blank">
|
||||
<img width="260px" src="https://open5gs.org/assets/img/nextepc_logo.jpg">
|
||||
</a>
|
||||
</p>
|
||||
</td>
|
||||
<td align="center" valign="middle">
|
||||
<a href="https://sdr.eee.strath.ac.uk/" target="_blank">
|
||||
<img width="260px" src="https://open5gs.org/assets/img/strath.png">
|
||||
</a>
|
||||
</td>
|
||||
</tr>
|
||||
</tbody>
|
||||
</table>
|
||||
|
||||
<h3 align="center">Sponsors</h3>
|
||||
<table>
|
||||
@@ -38,9 +47,11 @@ If you find Open5GS useful for work, please consider supporting this Open Source
|
||||
|
||||
If you don't understand something about Open5GS, the [https://open5gs.org/open5gs/docs/](https://open5gs.org/open5gs/docs/) is a great place to look for answers.
|
||||
|
||||
## Technical Discussion
|
||||
## Community
|
||||
|
||||
Problem with Open5GS can be filed as [issues](https://github.com/open5gs/open5gs/issues) in this repository. Voice and text chat are available in Open5GS's [Discord](https://discordapp.com/) workspace. Use [this link](https://discord.gg/GreNkuc) to get started.
|
||||
- Problem with Open5GS can be filed as [issues](https://github.com/open5gs/open5gs/issues) in this repository.
|
||||
- Other topics related to this project are happening on the [discussions](https://github.com/open5gs/open5gs/discussions).
|
||||
- Voice and text chat are available in Open5GS's [Discord](https://discordapp.com/) workspace. Use [this link](https://discord.gg/GreNkuc) to get started.
|
||||
|
||||
## Contributing
|
||||
|
||||
|
||||
@@ -9,6 +9,7 @@ parameter:
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
|
||||
@@ -9,6 +9,7 @@ parameter:
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
@@ -97,9 +98,9 @@ sgwc:
|
||||
- addr: 127.0.0.3
|
||||
|
||||
smf:
|
||||
sbi:
|
||||
- addr: 127.0.0.4
|
||||
port: 7777
|
||||
# sbi:
|
||||
# - addr: 127.0.0.4
|
||||
# port: 7777
|
||||
gtpc:
|
||||
- addr: 127.0.0.4
|
||||
- addr: ::1
|
||||
@@ -211,12 +212,12 @@ pcrf:
|
||||
- identity: smf.localdomain
|
||||
addr: 127.0.0.4
|
||||
|
||||
nrf:
|
||||
sbi:
|
||||
- addr:
|
||||
- 127.0.0.10
|
||||
- ::1
|
||||
port: 7777
|
||||
#nrf:
|
||||
# sbi:
|
||||
# - addr:
|
||||
# - 127.0.0.10
|
||||
# - ::1
|
||||
# port: 7777
|
||||
|
||||
ausf:
|
||||
sbi:
|
||||
|
||||
@@ -38,6 +38,7 @@ example_conf = '''
|
||||
310014.yaml
|
||||
csfb.yaml
|
||||
volte.yaml
|
||||
vonr.yaml
|
||||
minimal.yaml
|
||||
srslte.yaml
|
||||
sample.yaml
|
||||
|
||||
@@ -9,6 +9,7 @@ parameter:
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
|
||||
@@ -260,19 +260,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -283,15 +284,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
# o NF Instance Heartbeat (Default : 0)
|
||||
# NFs will not send heart-beat timer in NFProfile
|
||||
# NRF will send heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
# o NF Instance Heartbeat (20 seconds)
|
||||
# NFs will send heart-beat timer (20 seconds) in NFProfile
|
||||
# NRF can change heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
# heartbeat: 20
|
||||
#
|
||||
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
|
||||
#
|
||||
|
||||
@@ -136,19 +136,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -159,15 +160,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
# o NF Instance Heartbeat (Default : 0)
|
||||
# NFs will not send heart-beat timer in NFProfile
|
||||
# NRF will send heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
# o NF Instance Heartbeat (20 seconds)
|
||||
# NFs will send heart-beat timer (20 seconds) in NFProfile
|
||||
# NRF can change heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
# heartbeat: 20
|
||||
#
|
||||
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
|
||||
#
|
||||
|
||||
@@ -62,19 +62,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
|
||||
@@ -369,19 +369,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
|
||||
@@ -108,19 +108,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -131,6 +132,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
#
|
||||
# o NF Instance Heartbeat (5 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 5
|
||||
#
|
||||
# o NF Instance Validity (Default : 3600 seconds = 1 hour)
|
||||
#
|
||||
# o NF Instance Validity (10 seconds)
|
||||
|
||||
@@ -138,19 +138,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -161,15 +162,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
# o NF Instance Heartbeat (Default : 0)
|
||||
# NFs will not send heart-beat timer in NFProfile
|
||||
# NRF will send heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
# o NF Instance Heartbeat (20 seconds)
|
||||
# NFs will send heart-beat timer (20 seconds) in NFProfile
|
||||
# NRF can change heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
# heartbeat: 20
|
||||
#
|
||||
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
|
||||
#
|
||||
|
||||
@@ -46,6 +46,10 @@ pcrf:
|
||||
# o Disable Stateless Address Autoconfiguration for IPv6
|
||||
# no_slaac: true
|
||||
#
|
||||
# o Legacy support for pre-release LTE 11 devices to do calling
|
||||
# - Replace IPv4/v6 local addr field in AAR Media-Subcomponent AVP by any
|
||||
# no_ipv4v6_local_addr_in_packet_filter: true
|
||||
#
|
||||
parameter:
|
||||
|
||||
#
|
||||
@@ -61,19 +65,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
|
||||
@@ -143,19 +143,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
|
||||
@@ -134,19 +134,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
|
||||
@@ -313,19 +313,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -336,15 +337,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
# o NF Instance Heartbeat (Default : 0)
|
||||
# NFs will not send heart-beat timer in NFProfile
|
||||
# NRF will send heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
# o NF Instance Heartbeat (20 seconds)
|
||||
# NFs will send heart-beat timer (20 seconds) in NFProfile
|
||||
# NRF can change heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
# heartbeat: 20
|
||||
#
|
||||
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
|
||||
#
|
||||
|
||||
@@ -136,19 +136,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -159,15 +160,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
# o NF Instance Heartbeat (Default : 0)
|
||||
# NFs will not send heart-beat timer in NFProfile
|
||||
# NRF will send heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
# heartbeat: 0
|
||||
# o NF Instance Heartbeat (20 seconds)
|
||||
# NFs will send heart-beat timer (20 seconds) in NFProfile
|
||||
# NRF can change heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (10 seconds)
|
||||
# nf_instance:
|
||||
# heartbeat: 10
|
||||
# heartbeat: 20
|
||||
#
|
||||
# o Message Wait Duration (Default : 10,000 ms = 10 seconds)
|
||||
#
|
||||
|
||||
@@ -138,19 +138,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
@@ -161,7 +162,16 @@ pool:
|
||||
#
|
||||
# time:
|
||||
#
|
||||
# o NF Instance Heartbeat (Default : 10 seconds)
|
||||
# o NF Instance Heartbeat (Default : 0)
|
||||
# NFs will not send heart-beat timer in NFProfile
|
||||
# NRF will send heart-beat timer in NFProfile
|
||||
#
|
||||
# o NF Instance Heartbeat (20 seconds)
|
||||
# NFs will send heart-beat timer (20 seconds) in NFProfile
|
||||
# NRF can change heart-beat timer in NFProfile
|
||||
#
|
||||
# nf_instance:
|
||||
# heartbeat: 20
|
||||
#
|
||||
# o NF Instance Heartbeat (Disabled)
|
||||
# nf_instance:
|
||||
|
||||
@@ -219,19 +219,20 @@ max:
|
||||
#
|
||||
# pool:
|
||||
#
|
||||
# o The Number of Default Memory Pool Size
|
||||
# o The default memory pool size was set assuming 1024 UEs.
|
||||
# To connect more UEs, you need to increase the size further.
|
||||
#
|
||||
# - Pool-size 128 => 32768 Number
|
||||
# - Pool-size 256 => 4096 Number
|
||||
# - Pool-size 512 => 2048 Number
|
||||
# - Pool-size 128 => 65536 Number
|
||||
# - Pool-size 256 => 8192 Number
|
||||
# - Pool-size 512 => 4096 Number
|
||||
# - Pool-size 1024 => 1024 Number
|
||||
# - Pool-size 2048 => 512 Number
|
||||
# - Pool-size 8192 => 128 Number
|
||||
# - Pool-size 1024*1024 => 8 Number
|
||||
#
|
||||
# 128: 32768
|
||||
# 256: 4096
|
||||
# 512: 2048
|
||||
# 128: 65536
|
||||
# 256: 8192
|
||||
# 512: 4096
|
||||
# 1024: 1024
|
||||
# 2048: 512
|
||||
# 8192: 128
|
||||
|
||||
@@ -9,6 +9,7 @@ parameter:
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
|
||||
@@ -9,6 +9,7 @@ parameter:
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
@@ -63,9 +64,9 @@ sgwc:
|
||||
- addr: 127.0.0.3
|
||||
|
||||
smf:
|
||||
sbi:
|
||||
- addr: 127.0.0.4
|
||||
port: 7777
|
||||
# sbi:
|
||||
# - addr: 127.0.0.4
|
||||
# port: 7777
|
||||
gtpc:
|
||||
- addr: 127.0.0.4
|
||||
- addr: ::1
|
||||
@@ -177,12 +178,12 @@ pcrf:
|
||||
- identity: smf.localdomain
|
||||
addr: 127.0.0.4
|
||||
|
||||
nrf:
|
||||
sbi:
|
||||
- addr:
|
||||
- 127.0.0.10
|
||||
- ::1
|
||||
port: 7777
|
||||
#nrf:
|
||||
# sbi:
|
||||
# - addr:
|
||||
# - 127.0.0.10
|
||||
# - ::1
|
||||
# port: 7777
|
||||
|
||||
ausf:
|
||||
sbi:
|
||||
|
||||
@@ -9,6 +9,7 @@ parameter:
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
@@ -63,9 +64,9 @@ sgwc:
|
||||
- addr: 127.0.0.3
|
||||
|
||||
smf:
|
||||
sbi:
|
||||
- addr: 127.0.0.4
|
||||
port: 7777
|
||||
# sbi:
|
||||
# - addr: 127.0.0.4
|
||||
# port: 7777
|
||||
gtpc:
|
||||
- addr: 127.0.0.4
|
||||
- addr: ::1
|
||||
@@ -182,12 +183,12 @@ pcrf:
|
||||
- identity: pcscf.localdomain
|
||||
addr: 127.0.0.1
|
||||
|
||||
nrf:
|
||||
sbi:
|
||||
- addr:
|
||||
- 127.0.0.10
|
||||
- ::1
|
||||
port: 7777
|
||||
#nrf:
|
||||
# sbi:
|
||||
# - addr:
|
||||
# - 127.0.0.10
|
||||
# - ::1
|
||||
# port: 7777
|
||||
|
||||
ausf:
|
||||
sbi:
|
||||
|
||||
211
configs/vonr.yaml.in
Normal file
211
configs/vonr.yaml.in
Normal file
@@ -0,0 +1,211 @@
|
||||
db_uri: mongodb://localhost/open5gs
|
||||
|
||||
logger:
|
||||
|
||||
parameter:
|
||||
# no_nrf: true
|
||||
# no_amf: true
|
||||
# no_smf: true
|
||||
# no_upf: true
|
||||
# no_ausf: true
|
||||
# no_udm: true
|
||||
# no_pcf: true
|
||||
# no_udr: true
|
||||
# no_mme: true
|
||||
# no_sgwc: true
|
||||
# no_sgwu: true
|
||||
# no_pcrf: true
|
||||
# no_hss: true
|
||||
|
||||
mme:
|
||||
freeDiameter:
|
||||
identity: mme.localdomain
|
||||
realm: localdomain
|
||||
listen_on: 127.0.0.2
|
||||
load_extension:
|
||||
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
|
||||
conf: 0x8888
|
||||
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
|
||||
connect:
|
||||
- identity: hss.localdomain
|
||||
addr: 127.0.0.8
|
||||
|
||||
s1ap:
|
||||
- addr: 127.0.0.2
|
||||
gtpc:
|
||||
- addr: 127.0.0.2
|
||||
gummei:
|
||||
plmn_id:
|
||||
mcc: 901
|
||||
mnc: 70
|
||||
mme_gid: 2
|
||||
mme_code: 1
|
||||
tai:
|
||||
plmn_id:
|
||||
mcc: 901
|
||||
mnc: 70
|
||||
tac: 1
|
||||
security:
|
||||
integrity_order : [ EIA2, EIA1, EIA0 ]
|
||||
ciphering_order : [ EEA0, EEA1, EEA2 ]
|
||||
|
||||
network_name:
|
||||
full: Open5GS
|
||||
|
||||
sgwc:
|
||||
gtpc:
|
||||
- addr: 127.0.0.3
|
||||
pfcp:
|
||||
- addr: 127.0.0.3
|
||||
|
||||
smf:
|
||||
sbi:
|
||||
- addr: 127.0.0.4
|
||||
port: 7777
|
||||
gtpc:
|
||||
- addr: 127.0.0.4
|
||||
- addr: ::1
|
||||
pfcp:
|
||||
- addr: 127.0.0.4
|
||||
pdn:
|
||||
- addr: 10.45.0.1/16
|
||||
- addr: cafe::1/64
|
||||
dns:
|
||||
- 8.8.8.8
|
||||
- 8.8.4.4
|
||||
- 2001:4860:4860::8888
|
||||
- 2001:4860:4860::8844
|
||||
p-cscf:
|
||||
- 127.0.0.1
|
||||
- ::1
|
||||
mtu: 1400
|
||||
freeDiameter:
|
||||
identity: smf.localdomain
|
||||
realm: localdomain
|
||||
listen_on: 127.0.0.4
|
||||
load_extension:
|
||||
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
|
||||
conf: 0x8888
|
||||
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
|
||||
connect:
|
||||
- identity: pcrf.localdomain
|
||||
addr: 127.0.0.9
|
||||
amf:
|
||||
sbi:
|
||||
- addr: 127.0.0.5
|
||||
port: 7777
|
||||
ngap:
|
||||
- addr: 127.0.0.5
|
||||
guami:
|
||||
- plmn_id:
|
||||
mcc: 901
|
||||
mnc: 70
|
||||
amf_id:
|
||||
region: 2
|
||||
set: 1
|
||||
tai:
|
||||
- plmn_id:
|
||||
mcc: 901
|
||||
mnc: 70
|
||||
tac: 1
|
||||
plmn_support:
|
||||
- plmn_id:
|
||||
mcc: 901
|
||||
mnc: 70
|
||||
s_nssai:
|
||||
- sst: 1
|
||||
security:
|
||||
integrity_order : [ NIA2, NIA1, NIA0 ]
|
||||
ciphering_order : [ NEA0, NEA1, NEA2 ]
|
||||
network_name:
|
||||
full: Open5GS
|
||||
amf_name: open5gs-amf0
|
||||
|
||||
sgwu:
|
||||
gtpu:
|
||||
- addr: 127.0.0.6
|
||||
pfcp:
|
||||
- addr: 127.0.0.6
|
||||
|
||||
upf:
|
||||
pfcp:
|
||||
- addr: 127.0.0.7
|
||||
gtpu:
|
||||
- addr: 127.0.0.7
|
||||
pdn:
|
||||
- addr: 10.45.0.1/16
|
||||
- addr: cafe::1/64
|
||||
|
||||
hss:
|
||||
freeDiameter:
|
||||
identity: hss.localdomain
|
||||
realm: localdomain
|
||||
listen_on: 127.0.0.8
|
||||
load_extension:
|
||||
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
|
||||
conf: 0x8888
|
||||
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
|
||||
connect:
|
||||
- identity: mme.localdomain
|
||||
addr: 127.0.0.2
|
||||
pcrf:
|
||||
freeDiameter:
|
||||
identity: pcrf.localdomain
|
||||
realm: localdomain
|
||||
listen_on: 127.0.0.9
|
||||
load_extension:
|
||||
- module: @freediameter_extensions_builddir@/dbg_msg_dumps.fdx
|
||||
conf: 0x8888
|
||||
- module: @freediameter_extensions_builddir@/dict_rfc5777.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_mip6i.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nasreq.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_nas_mipv6.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca.fdx
|
||||
- module: @freediameter_extensions_builddir@/dict_dcca_3gpp.fdx
|
||||
connect:
|
||||
- identity: smf.localdomain
|
||||
addr: 127.0.0.4
|
||||
- identity: pcscf.localdomain
|
||||
addr: 127.0.0.1
|
||||
|
||||
nrf:
|
||||
sbi:
|
||||
- addr:
|
||||
- 127.0.0.10
|
||||
- ::1
|
||||
port: 7777
|
||||
|
||||
ausf:
|
||||
sbi:
|
||||
- addr: 127.0.0.11
|
||||
port: 7777
|
||||
|
||||
udm:
|
||||
sbi:
|
||||
- addr: 127.0.0.12
|
||||
port: 7777
|
||||
|
||||
pcf:
|
||||
sbi:
|
||||
- addr: 127.0.0.13
|
||||
port: 7777
|
||||
|
||||
udr:
|
||||
sbi:
|
||||
- addr: 127.0.0.20
|
||||
port: 7777
|
||||
54
debian/changelog
vendored
54
debian/changelog
vendored
@@ -1,3 +1,57 @@
|
||||
open5gs (2.1.4) unstable; urgency=medium
|
||||
|
||||
* Paging was added
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Jan 2021 19:14:26 -0500
|
||||
|
||||
open5gs (2.1.4~bionic) bionic; urgency=medium
|
||||
|
||||
* Paging was added
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Jan 2021 19:13:26 -0500
|
||||
|
||||
open5gs (2.1.4~focal) focal; urgency=medium
|
||||
|
||||
* Paging was added
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Mon, 18 Jan 2021 19:12:06 -0500
|
||||
|
||||
open5gs (2.1.3) unstable; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Fri, 08 Jan 2021 23:20:33 -0500
|
||||
|
||||
open5gs (2.1.3~bionic1) bionic; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Fri, 08 Jan 2021 23:19:22 -0500
|
||||
|
||||
open5gs (2.1.3~focal1) focal; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Fri, 08 Jan 2021 23:17:48 -0500
|
||||
|
||||
open5gs (2.1.2) unstable; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Fri, 08 Jan 2021 00:28:16 -0500
|
||||
|
||||
open5gs (2.1.2~bionic1) bionic; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Fri, 08 Jan 2021 00:27:09 -0500
|
||||
|
||||
open5gs (2.1.2~focal1) focal; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
-- Sukchan Lee <acetcom@gmail.com> Fri, 08 Jan 2021 00:25:31 -0500
|
||||
|
||||
open5gs (2.1.1) unstable; urgency=medium
|
||||
|
||||
* Bug Fixed
|
||||
|
||||
2
debian/rules
vendored
2
debian/rules
vendored
@@ -14,4 +14,4 @@ override_dh_install:
|
||||
dh_install --sourcedir=obj-$(DEB_HOST_GNU_TYPE)
|
||||
|
||||
override_dh_auto_test:
|
||||
cd obj-$(DEB_HOST_GNU_TYPE) && meson test --suite unit
|
||||
cd obj-$(DEB_HOST_GNU_TYPE) && meson test -v --suite unit
|
||||
|
||||
@@ -2,11 +2,72 @@
|
||||
title: Quickstart
|
||||
---
|
||||
|
||||
**Note:** Open5GS supports installation of packages in *Debian/Ubuntu and openSUSE* environments. *CentOS, Fedora, and Mac OSX* require you to [build with source code]({{ site.url }}{{ site.baseurl }}/docs/guide/02-building-open5gs-from-sources)
|
||||
## 1. Introduction to Open5GS
|
||||
---
|
||||
|
||||
Welcome! If you want to set up your first Open5GS core you have come to the right place. Before we get started, we'll spend a moment to understand the basic architecture of the software.
|
||||
|
||||
**TL;DR:** Open5GS contains a series of software components and network functions that implement the 4G/ 5G NSA and 5G SA core functions. If you know what each of these do already and how they interface with each other, skip to section 2.
|
||||
{: .notice--info}
|
||||
|
||||
<style>
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||

|
||||
|
||||
[[Higher quality PDF diagram available HERE]]({{ site.url }}{{ site.baseurl }}/assets/images/Open5GS_CUPS-01.pdf)
|
||||
|
||||
#### 4G/ 5G NSA Core
|
||||
|
||||
The Open5GS 4G/ 5G NSA Core contains the following components:
|
||||
* MME - Mobility Management Entity
|
||||
* HSS - Home Subscriber Server
|
||||
* PCRF - Policy and Charging Rules Function
|
||||
* SGWC - Serving Gateway Control Plane
|
||||
* SGWU - Serving Gateway User Plane
|
||||
* PGWC/SMF - Packet Gateway Control Plane / (component contained in Open5GS SMF)
|
||||
* PGWU/UPF - Packet Gateway User Plane / (component contained in Open5GS UPF)
|
||||
|
||||
The core has two main planes: the control plane and the user plane. These are physically separated in Open5GS as CUPS (control/ user plane separation) is implemented.
|
||||
|
||||
The MME is the main **control plane** hub of the core. It primarily manages sessions, mobilty, paging and bearers. It links to the HSS, which generates SIM authentication vectors and holds the subscriber profile; and also to the SGWC and PGWC/SMF, which are the control planes of the gateway servers. All the eNBs in the mobile network (4G basestations) connect to the MME. The final element of the control plane is the PCRF, which sits in-between the PGWC/SMF and the HSS, and handles charging and enforces subscriber policies.
|
||||
|
||||
The **user plane** carries user data packets between the eNB/ NSA gNB (5G NSA basestations) and the external WAN. The two user plane core components are the SGWU and PGWU/UPF. Each of these connect back to their control plane counterparts. eNBs/ NSA gNBs connect to the SGWU, which connects to the PGWU/UPF, and on to the WAN. *By having the control and user planes physically separated like this, it means you can deploy multiple user plane servers in the field (eg somewhere with a high speed Internet connection), whilst keeping control functionality centralised. This enables support of MEC use cases, for example.*
|
||||
|
||||
All of these Open5GS components have config files. Each config file contains the component's IP bind addresses/ local Interface names **and** the IP addresses/ DNS names of the other components it needs to connect to. We'll come back to this in Section 3.
|
||||
|
||||
|
||||
#### 5G SA Core
|
||||
|
||||
The Open5GS 5G SA Core contains the following functions:
|
||||
* AMF - Access and Mobility Management Function
|
||||
* SMF - Session Management Function
|
||||
* UPF - User Plane Function
|
||||
* AUSF - Authentication Server Function
|
||||
* NRF - NF Repository Function
|
||||
* UDM - Unified Data Management
|
||||
* UDR - Unified Data Repository
|
||||
* PCF - Policy and Charging Function
|
||||
|
||||
The 5G SA core works in a different way to the 4G core - it uses a **Service Based Architecture** (SBI). **Control plane** functions are configured to register with the NRF, and the NRF then helps them discover the other core functions. Running through the other functions: The AMF handles connection and mobility management; a subset of what the 4G MME is tasked with. gNBs (5G basestations) connect to the AMF. The UDM, AUSF and UDR carry out similar operations as the 4G HSS, generating SIM authentication vectors and holding the subscriber profile. Session management is all handled by the SMF (previously the responsibility of the 4G MME/ SGWC/ PGWC). Finally there is the PCF, used for charging and enforcing subscriber policies.
|
||||
|
||||
The 5G SA core **user plane** is much simpler, as it only contains a single function. The UPF carries user data packets between the gNB and the external WAN. It connects back to the SMF too.
|
||||
|
||||
With the exception of the SMF and UPF, all config files for the 5G SA core functions only contain the function's IP bind addresses/ local Interface names and the IP address/ DNS name of the NRF.
|
||||
|
||||
|
||||
## 2. Install Open5GS with a Package Manager
|
||||
---
|
||||
|
||||
**Note:** Package managers can be used to install Open5GS in *Debian/Ubuntu and openSUSE* environments (for major and minor builds). *CentOS, Fedora, and Mac OSX* require you to [build with source code]({{ site.url }}{{ site.baseurl }}/docs/guide/02-building-open5gs-from-sources).
|
||||
{: .notice--warning}
|
||||
**Note:** Nighly builds are offered by [Osmocom](https://osmocom.org) on [OBS](https://build.opensuse.org/package/show/network:osmocom:nightly/open5gs). Scroll down to use a nightly build package.
|
||||
{: .notice--warning}
|
||||
|
||||
### Install Open5GS with a Package Manager
|
||||
---
|
||||
|
||||
#### Ubuntu
|
||||
|
||||
@@ -51,11 +112,21 @@ https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbunt
|
||||
https://download.opensuse.org/repositories/home:/acetcom:/open5gs:/latest/xUbuntu_20.10/
|
||||
```
|
||||
|
||||
#### openSUSE
|
||||
|
||||
[Martin Hauke](https://build.opensuse.org/user/show/mnhauke) packaged Open5GS for *openSUSE* on [OBS](https://build.opensuse.org/package/show/home:mnhauke:open5gs/open5gs).
|
||||
|
||||
```bash
|
||||
$ sudo zypper addrepo -f obs://home:mnhauke:open5gs home:mnhauke:open5gs
|
||||
$ sudo zypper install mongodb-server mongodb-shell
|
||||
$ sudo zypper install open5gs
|
||||
```
|
||||
|
||||
#### Nightly Builds
|
||||
|
||||
Nightly bulit package are provided by [Osmocom](https://osmocom.org) on [OBS](https://build.opensuse.org/package/show/network:osmocom:nightly/open5gs). On *Ubuntu 20.04* you can install it like this:
|
||||
|
||||
```
|
||||
```bash
|
||||
$ sudo apt update
|
||||
$ sudo apt install wget gnupg
|
||||
$ wget -qO - https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_20.04/Release.key | sudo apt-key add -
|
||||
@@ -78,144 +149,14 @@ https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_20.
|
||||
https://download.opensuse.org/repositories/network:/osmocom:/nightly/xUbuntu_20.10/
|
||||
```
|
||||
|
||||
#### openSUSE
|
||||
|
||||
[Martin Hauke](https://build.opensuse.org/user/show/mnhauke) packaged Open5GS for *openSUSE* on [OBS](https://build.opensuse.org/package/show/home:mnhauke:open5gs/open5gs).
|
||||
|
||||
```bash
|
||||
$ sudo zypper addrepo -f obs://home:mnhauke:open5gs home:mnhauke:open5gs
|
||||
$ sudo zypper install mongodb-server mongodb-shell
|
||||
$ sudo zypper install open5gs
|
||||
```
|
||||
|
||||
### Configure Open5GS
|
||||
## 3. Install the WebUI of Open5GS
|
||||
---
|
||||
|
||||
##### 5G Core
|
||||
The WebUI allows you to interactively edit subscriber data. While it is not essential to use this, it makes things easier when you are just starting out on your Open5GS adventure. (A [command line tool](https://github.com/{{ site.github_username }}/open5gs/blob/master/misc/db/open5gs-dbctl) is available for advanced users).
|
||||
|
||||
Modify [install/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
|
||||
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
|
||||
--- amf.yaml 2020-09-05 20:52:28.652234967 -0400
|
||||
+++ amf.yaml.new 2020-09-05 20:55:07.453114885 -0400
|
||||
@@ -165,23 +165,23 @@
|
||||
- addr: 127.0.0.5
|
||||
port: 7777
|
||||
ngap:
|
||||
- - addr: 127.0.0.5
|
||||
+ - addr: 10.10.0.5
|
||||
guami:
|
||||
- plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
+ mcc: 001
|
||||
+ mnc: 01
|
||||
amf_id:
|
||||
region: 2
|
||||
set: 1
|
||||
tai:
|
||||
- plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
- tac: 1
|
||||
+ mcc: 001
|
||||
+ mnc: 01
|
||||
+ tac: 2
|
||||
plmn:
|
||||
- plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
+ mcc: 001
|
||||
+ mnc: 01
|
||||
s_nssai:
|
||||
- sst: 1
|
||||
security:
|
||||
```
|
||||
|
||||
Modify [install/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U and PFCP IP address.
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
|
||||
--- upf.yaml 2020-09-05 20:52:28.652234967 -0400
|
||||
+++ upf.yaml.new 2020-09-05 20:52:55.279052142 -0400
|
||||
@@ -137,9 +137,7 @@
|
||||
pfcp:
|
||||
- addr: 127.0.0.7
|
||||
gtpu:
|
||||
- - addr:
|
||||
- - 127.0.0.7
|
||||
- - ::1
|
||||
+ - addr: 10.11.0.7
|
||||
pdn:
|
||||
- addr: 10.45.0.1/16
|
||||
- addr: cafe::1/64
|
||||
```
|
||||
##### 4G EPC
|
||||
|
||||
Modify [install/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
|
||||
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
|
||||
--- mme.yaml 2020-09-05 20:52:28.648235143 -0400
|
||||
+++ mme.yaml.new 2020-09-05 20:56:05.434484208 -0400
|
||||
@@ -204,20 +204,20 @@
|
||||
mme:
|
||||
freeDiameter: /home/acetcom/Documents/git/open5gs/install/etc/freeDiameter/mme.conf
|
||||
s1ap:
|
||||
- addr: 127.0.0.2
|
||||
+ addr: 10.10.0.2
|
||||
gtpc:
|
||||
addr: 127.0.0.2
|
||||
gummei:
|
||||
plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
+ mcc: 001
|
||||
+ mnc: 01
|
||||
mme_gid: 2
|
||||
mme_code: 1
|
||||
tai:
|
||||
plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
- tac: 1
|
||||
+ mcc: 001
|
||||
+ mnc: 01
|
||||
+ tac: 2
|
||||
security:
|
||||
integrity_order : [ EIA1, EIA2, EIA0 ]
|
||||
ciphering_order : [ EEA0, EEA1, EEA2 ]
|
||||
```
|
||||
|
||||
Modify [install/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
|
||||
--- sgwu.yaml 2020-09-05 20:50:39.393022566 -0400
|
||||
+++ sgwu.yaml.new 2020-09-05 20:51:06.667838823 -0400
|
||||
@@ -51,7 +51,7 @@
|
||||
#
|
||||
sgwu:
|
||||
gtpu:
|
||||
- addr: 127.0.0.6
|
||||
+ addr: 10.11.0.6
|
||||
pfcp:
|
||||
addr: 127.0.0.6
|
||||
|
||||
```
|
||||
|
||||
After changing conf files, please restart Open5GS daemons.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl restart open5gs-amfd.service
|
||||
$ sudo systemctl restart open5gs-upfd.service
|
||||
$ sudo systemctl restart open5gs-mmed.service
|
||||
$ sudo systemctl restart open5gs-sgwud.service
|
||||
```
|
||||
|
||||
### Install WebUI of Open5GS
|
||||
---
|
||||
|
||||
[Node.js](https://nodejs.org/) is required to install WebUI of Open5GS
|
||||
[Node.js](https://nodejs.org/) is required to install the WebUI of Open5GS
|
||||
|
||||
1. *Debian and Ubuntu* based Linux distributions can install [Node.js](https://nodejs.org/) as follows:
|
||||
|
||||
@@ -238,7 +179,180 @@ You can now install WebUI of Open5GS.
|
||||
$ curl -sL {{ site.url }}{{ site.baseurl }}/assets/webui/install | sudo -E bash -
|
||||
```
|
||||
|
||||
### Register Subscriber Information
|
||||
## 4. Configure Open5GS
|
||||
---
|
||||
|
||||
Okay - you have installed the software, now what to do with it? Well, there are some tweaks you will need to make to the config files, and you will need to enter subscriber data into your HSS/ UDR. You will also need to set some IP Table rules to bridge the PGWU/UPF to the WAN.
|
||||
|
||||
Out of the box, the default configurations see all of the Open5GS components fully configured for use on a single computer. They are set to communicate with each other using the local loopback address space (`127.0.0.X`). The default addresses for each of the bind interfaces for these components and functions are as follows:
|
||||
|
||||
```
|
||||
MongoDB = 127.0.0.1 (subscriber data) - http://localhost:3000
|
||||
|
||||
MME-s1ap = 127.0.0.2 :36412 for S1-MME
|
||||
MME-gtpc = 127.0.0.2 :2123 for S11
|
||||
MME-frDi = 127.0.0.2 :3868 for S6a auth
|
||||
|
||||
SGWC-gtpc = 127.0.0.3 :2123 for S11
|
||||
SGWC-pfcp = 127.0.0.3 :8805 for Sxa
|
||||
|
||||
SMF-gtpc = 127.0.0.4 :2123 for S5/8c, N11
|
||||
SMF-pfcp = 127.0.0.4 :8805 for N4
|
||||
SMF-frDi = 127.0.0.4 :3868 for Gx auth
|
||||
SMF-sbi = 127.0.0.4 :7777 for 5G SBI (N7,N10,N11)
|
||||
|
||||
AMF-ngap = 127.0.0.5 :38412 for N2
|
||||
AMF-sbi = 127.0.0.5 :7777 for 5G SBI (N8,N12,N11)
|
||||
|
||||
SGWU-pfcp = 127.0.0.6 :8805 for Sxa
|
||||
SGWU-gtpu = 127.0.0.6 :2152 for S1-U, S5/8u
|
||||
|
||||
UPF-pfcp = 127.0.0.7 :8805 for N4
|
||||
UPF-gtpu = 127.0.0.7 :2152 for S5/8u, N3
|
||||
|
||||
HSS-frDi = 127.0.0.8 :3868 for S6a auth
|
||||
|
||||
PCRF-frDi = 127.0.0.9 :3868 for Gx auth
|
||||
|
||||
NRF-sbi = 127.0.0.10:7777 for 5G SBI
|
||||
AUSF-sbi = 127.0.0.11:7777 for 5G SBI
|
||||
UDM-sbi = 127.0.0.12:7777 for 5G SBI
|
||||
PCF-sbi = 127.0.0.13:7777 for 5G SBI
|
||||
UDR-sbi = 127.0.0.20:7777 for 5G SBI
|
||||
```
|
||||
|
||||
#### Setup a 4G/ 5G NSA Core
|
||||
|
||||
You will need to modify your 4G MME config to support your PLMN and TAC. The international test PLMN is 001/01, and the international private network PLMN is 999/99. You should stick to using either of these PLMNs unless you have been issued a PLMN by your national regulator. (This PLMN will need to be configured in your eNB).
|
||||
|
||||
If you are aiming to connect an external eNB to your core, you will also need to change the S1AP bind address of the MME **and** the GTP-U bind address of the SGWU. If you are running an eNB stack locally, you will not need to make these changes.
|
||||
|
||||
|
||||
Modify [/etc/open5gs/mme.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/mme.yaml.in) to set the S1AP IP address, PLMN ID, and TAC.
|
||||
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/mme.yaml.old /etc/open5gs/mme.yaml
|
||||
|
||||
mme:
|
||||
freeDiameter: /etc/freeDiameter/mme.conf
|
||||
s1ap:
|
||||
- addr: 127.0.0.2
|
||||
+ addr: 10.10.0.2 # for external eNB - a local address that can be reached by the eNB
|
||||
gtpc:
|
||||
addr: 127.0.0.2
|
||||
gummei:
|
||||
plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
+ mcc: 001 # set your PLMN-MCC
|
||||
+ mnc: 01 # set your PLMN-MNC
|
||||
mme_gid: 2
|
||||
mme_code: 1
|
||||
tai:
|
||||
plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
- tac: 1
|
||||
+ mcc: 001 # set your PLMN-MCC
|
||||
+ mnc: 01 # set your PLMN-MNC
|
||||
+ tac: 2 # should match the TAC used by your eNB
|
||||
security:
|
||||
|
||||
```
|
||||
|
||||
Modify [/etc/open5gs/sgwu.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/sgwu.yaml.in) to set the GTP-U IP address.
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/sgwu.yaml.old /etc/open5gs/sgwu.yaml
|
||||
|
||||
sgwu:
|
||||
gtpu:
|
||||
- addr: 127.0.0.6
|
||||
+ addr: 10.11.0.6 # for external eNB - a local address that can be reached by the eNB
|
||||
pfcp:
|
||||
addr: 127.0.0.6
|
||||
|
||||
```
|
||||
|
||||
After changing config files, please restart Open5GS daemons.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl restart open5gs-mmed
|
||||
$ sudo systemctl restart open5gs-sgwud
|
||||
```
|
||||
|
||||
#### Setup a 5G Core
|
||||
|
||||
You will need to modify your 5G AMF config to support your PLMN and TAC. The international test PLMN is 001/01, and the international private network PLMN is 999/99. You should stick to using either of these PLMNs unless you have been issued a PLMN by your national regulator. (This PLMN will need to be configured in your gNB).
|
||||
|
||||
If you are aiming to connect an external gNB to your core, you will also need to change the NGAP bind address of the AMF **and** the GTPU bind address of the UPF. If you are running an gNB stack locally, you will not need to make these changes.
|
||||
|
||||
|
||||
Modify [/etc/open5gs/amf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/amf.yaml.in) to set the NGAP IP address, PLMN ID, TAC and NSSAI.
|
||||
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/amf.yaml.old /etc/open5gs/amf.yaml
|
||||
|
||||
amf:
|
||||
sbi:
|
||||
- addr: 127.0.0.5
|
||||
port: 7777
|
||||
ngap:
|
||||
- - addr: 127.0.0.5
|
||||
+ - addr: 10.10.0.5 # for external gNB - a local address that can be reached by the gNB
|
||||
guami:
|
||||
- plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
+ mcc: 001 # set your PLMN-MCC
|
||||
+ mnc: 01 # set your PLMN-MNC
|
||||
amf_id:
|
||||
region: 2
|
||||
set: 1
|
||||
tai:
|
||||
- plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
- tac: 1
|
||||
+ mcc: 001 # set your PLMN-MCC
|
||||
+ mnc: 01 # set your PLMN-MNC
|
||||
+ tac: 2 # should match the TAC used by your gNB
|
||||
plmn:
|
||||
- plmn_id:
|
||||
- mcc: 901
|
||||
- mnc: 70
|
||||
+ mcc: 001 # set your PLMN-MCC
|
||||
+ mnc: 01 # set your PLMN-MNC
|
||||
s_nssai:
|
||||
- sst: 1
|
||||
security:
|
||||
|
||||
```
|
||||
|
||||
Modify [/etc/open5gs/upf.yaml](https://github.com/{{ site.github_username }}/open5gs/blob/master/configs/open5gs/upf.yaml.in) to set the GTP-U address.
|
||||
```diff
|
||||
$ diff -u /etc/open5gs/upf.yaml.old /etc/open5gs/upf.yaml
|
||||
|
||||
upf:
|
||||
pfcp:
|
||||
- addr: 127.0.0.7
|
||||
gtpu:
|
||||
- - addr: 127.0.0.7
|
||||
+ - addr: 10.11.0.7 # for external gNB - a local address that can be reached by the gNB
|
||||
pdn:
|
||||
- addr: 10.45.0.1/16
|
||||
- addr: cafe::1/64
|
||||
|
||||
```
|
||||
|
||||
After changing config files, please restart Open5GS daemons.
|
||||
|
||||
```bash
|
||||
$ sudo systemctl restart open5gs-amfd
|
||||
$ sudo systemctl restart open5gs-upfd
|
||||
```
|
||||
|
||||
|
||||
#### Register Subscriber Information
|
||||
---
|
||||
|
||||
Connect to `http://localhost:3000` and login with **admin** account.
|
||||
@@ -256,15 +370,21 @@ To add subscriber information, you can do WebUI operations in the following orde
|
||||
3. Fill the IMSI, security context(K, OPc, AMF), and APN of the subscriber.
|
||||
4. Click `SAVE` Button
|
||||
|
||||
**Tip:** This addition immediately affects Open5GS without restaring any daemon.
|
||||
Enter the subscriber details of your SIM cards using this tool, to save the subscriber profile in the HSS and UDR MongoDB database backend. If you are using test SIMs, the details are normally printed on the card.
|
||||
|
||||
**Tip:** Subscribers added with this tool immediately register in the Open5GS HSS/ UDR without the need to restart any daemon.
|
||||
{: .notice--info}
|
||||
|
||||
|
||||
### Adding a route for UE to have Internet connectivity {#UEInternet}
|
||||
#### Adding a route for the UE to have WAN connectivity {#UEInternet}
|
||||
---
|
||||
|
||||
If your phone can connect to internet, you must run the following command in Open5GS-PGW installed host.
|
||||
In order to bridge between the PGWU/UPF and WAN (Internet), you must enable IP forwarding and add a NAT rule to your IP Tables.
|
||||
|
||||
**Note:** For the first run, it makes things simpler if you do not have any rules in the IP/NAT tables. If a program such as docker has already set up a rule, you will need to add rules differently.
|
||||
{: .notice--danger}
|
||||
|
||||
You can check your current IP Table rules with the following commands (these tables are empty):
|
||||
```bash
|
||||
### Check IP Tables
|
||||
$ sudo iptables -L
|
||||
@@ -290,7 +410,10 @@ target prot opt source destination
|
||||
|
||||
Chain POSTROUTING (policy ACCEPT)
|
||||
target prot opt source destination
|
||||
```
|
||||
|
||||
To enable forwarding and add the NAT rule, enter
|
||||
```bash
|
||||
### Enable IPv4 Forwarding
|
||||
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||
|
||||
@@ -298,19 +421,71 @@ $ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||
$ sudo iptables -t nat -A POSTROUTING -s 10.45.0.0/16 ! -o ogstun -j MASQUERADE
|
||||
```
|
||||
|
||||
**Note:** For the first time, it is a good condition if you do not have any rules in the IP/NAT tables. If a program such as docker has already set up a rule, you will need to add a rule differently.
|
||||
{: .notice--danger}
|
||||
|
||||
### Turn on your gNB/eNB and Phone
|
||||
## 5. Turn on your eNB/gNB and UE
|
||||
---
|
||||
- Connect your gNB/eNB to the IP of your server via the standard NGAP/S1AP port of SCTP 38412/36412 (for AMF/MME)
|
||||
- You can see actual traffic through wireshark -- [[srsenb.pcapng]]({{ site.url }}{{ site.baseurl }}/assets/pcapng/srsenb.pcapng).
|
||||
- You can view the log at `/var/log/open5gs/*.log`.
|
||||
|
||||
First, connect your eNB/gNB to the Open5GS core:
|
||||
* Make sure the PLMN and TAC of the eNB/gNB matches the settings in your MME/AMF
|
||||
* Connect your eNB/gNB to the IP of your server via the standard S1AP/NGAP SCTP port 36412/38412 (for MME/AMF)
|
||||
* Your eNB/gNB should report a successful S1/NG connection - congrats, your core is fully working!
|
||||
* You can see actual traffic through wireshark -- [[srsenb.pcapng]]({{ site.url }}{{ site.baseurl }}/assets/pcapng/srsenb.pcapng).
|
||||
* You can view the log at `/var/log/open5gs/*.log`, eg:
|
||||
```bash
|
||||
### Watch the live MME log
|
||||
tail -f /var/log/open5gs/mme.log
|
||||
```
|
||||
|
||||
Next, try to attach a UE to the basestation:
|
||||
* Insert your SIM card to the UE
|
||||
* Set the UE's APN to match the APN you configured in the Open5GS WebUI
|
||||
* Toggle the UE in and out of flight mode
|
||||
* If it doesn't automatically connect, try manually searching for a network
|
||||
* If the PLMN set on the SIM card does not match the PLMN being used by the radio, you will need to ensure 'data roaming' on the UE is switched on
|
||||
|
||||
## 6. Starting and Stopping Open5GS
|
||||
---
|
||||
|
||||
When you install the software using the package manager, it is setup to run as a systemd service. You can stop and restart the components and network functions as follows:
|
||||
|
||||
```bash
|
||||
$ sudo systemctl stop open5gs-mmed
|
||||
$ sudo systemctl stop open5gs-sgwcd
|
||||
$ sudo systemctl stop open5gs-smfd
|
||||
$ sudo systemctl stop open5gs-amfd
|
||||
$ sudo systemctl stop open5gs-sgwud
|
||||
$ sudo systemctl stop open5gs-upfd
|
||||
$ sudo systemctl stop open5gs-hssd
|
||||
$ sudo systemctl stop open5gs-pcrfd
|
||||
$ sudo systemctl stop open5gs-nrfd
|
||||
$ sudo systemctl stop open5gs-ausfd
|
||||
$ sudo systemctl stop open5gs-udmd
|
||||
$ sudo systemctl stop open5gs-pcfd
|
||||
$ sudo systemctl stop open5gs-udrd
|
||||
$ sudo systemctl stop open5gs-webui
|
||||
```
|
||||
|
||||
```bash
|
||||
$ sudo systemctl restart open5gs-mmed
|
||||
$ sudo systemctl restart open5gs-sgwcd
|
||||
$ sudo systemctl restart open5gs-smfd
|
||||
$ sudo systemctl restart open5gs-amfd
|
||||
$ sudo systemctl restart open5gs-sgwud
|
||||
$ sudo systemctl restart open5gs-upfd
|
||||
$ sudo systemctl restart open5gs-hssd
|
||||
$ sudo systemctl restart open5gs-pcrfd
|
||||
$ sudo systemctl restart open5gs-nrfd
|
||||
$ sudo systemctl restart open5gs-ausfd
|
||||
$ sudo systemctl restart open5gs-udmd
|
||||
$ sudo systemctl restart open5gs-pcfd
|
||||
$ sudo systemctl restart open5gs-udrd
|
||||
$ sudo systemctl restart open5gs-webui
|
||||
```
|
||||
|
||||
|
||||
### Uninstall Open5GS and WebUI
|
||||
## 7. Uninstall Open5GS and WebUI
|
||||
|
||||
How to remove Open5GS package:
|
||||
To remove the Open5GS packages:
|
||||
|
||||
1. On *Ubuntu/Debian*:
|
||||
|
||||
|
||||
@@ -3,6 +3,13 @@ title: Now in the Github Issue
|
||||
head_inline: "<style> .blue { color: blue; } </style>"
|
||||
---
|
||||
|
||||
<style>
|
||||
img {
|
||||
max-width: 100%;
|
||||
height: auto;
|
||||
}
|
||||
</style>
|
||||
|
||||
#### Cannot open shared object file when running daemon
|
||||
|
||||
An error occurred when running as follows.
|
||||
@@ -176,15 +183,15 @@ $ sudo systemctl restart open5gs-upfd.service
|
||||
|
||||
By default, wireshark cannot decode NAS-5GS message when the security header type is "Integrity protected and ciphered".
|
||||
|
||||
{: height="100%" width="100%"}
|
||||

|
||||
|
||||
You need to turn on "Try to detect and decode 5G-EA0 ciphered messages" in the wireshark perference menu.
|
||||
|
||||
{: height="100%" width="100%"}
|
||||

|
||||
|
||||
Now, you can see the NAS-5GS message in the wireshark.
|
||||
|
||||
{: height="100%" width="100%"}
|
||||

|
||||
|
||||
#### Test failed (e.g. `meson test -v`)
|
||||
|
||||
|
||||
@@ -13,8 +13,8 @@ Open5GS is a C-language Open Source implementation of 5GC and EPC, i.e. the core
|
||||
- AES, Snow3G, ZUC algorithms for encryption
|
||||
- Support of USIM cards using Milenage
|
||||
- IPv6 support
|
||||
- Multiple PDU session resource(EPC only)
|
||||
- S1/X2 Handover(EPC only)
|
||||
- Multiple PDU session
|
||||
- S1/X2 and Xn Handover
|
||||
- CSFB(Circuit Switched Fall Back) and SMSoS(SMS Over SGs)
|
||||
- VoLTE(Voice over LTE)
|
||||
|
||||
|
||||
16
docs/_posts/2020-12-16-release-v2.1.1.md
Normal file
16
docs/_posts/2020-12-16-release-v2.1.1.md
Normal file
@@ -0,0 +1,16 @@
|
||||
---
|
||||
title: "v2.1.1 - 4G EPC Hotfix"
|
||||
date: 2020-12-16 11:08:00 -0500
|
||||
categories:
|
||||
- Release
|
||||
tags:
|
||||
- News
|
||||
- Release
|
||||
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
|
||||
---
|
||||
|
||||
#### Bug Fixes
|
||||
- Fix the assertion BUG with Unexpected PDN Type ([#721](https://github.com/open5gs/open5gs/issues/721)) -- [cecrevier](https://github.com/cecrevier)
|
||||
|
||||
Download -- [v2.1.1.tar.gz](https://github.com/open5gs/open5gs/archive/v2.1.1.tar.gz)
|
||||
{: .notice--info}
|
||||
35
docs/_posts/2021-01-08-release-v2.1.3.md
Normal file
35
docs/_posts/2021-01-08-release-v2.1.3.md
Normal file
@@ -0,0 +1,35 @@
|
||||
---
|
||||
title: "v2.1.3 - 5GC improvements"
|
||||
date: 2021-01-08 22:50:00 -0500
|
||||
categories:
|
||||
- Release
|
||||
tags:
|
||||
- News
|
||||
- Release
|
||||
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
|
||||
---
|
||||
|
||||
#### New features
|
||||
- [5GC] Dedicated QoS flow & Multiple PDU session ([235a041](https://github.com/open5gs/open5gs/commit/235a041b8d7638db931114ace49e4f771508830f), [a96d3ca](https://github.com/open5gs/open5gs/commit/a96d3ca0fa88828f4efb1135ebcb8a88d8bdc66c))
|
||||
- [5GC] Xn Handover ([#726](https://github.com/open5gs/open5gs/pull/726)) -- [lester-001](https://github.com/lester-001)
|
||||
|
||||
#### Test
|
||||
- [5GC] 1024 UEs Registration ([#753](https://github.com/open5gs/open5gs/issues/753)) -- [mmailand](https://github.com/mmailand)
|
||||
|
||||
#### Enhancement
|
||||
- [AMF] Handling UEContextRequest of InitialUEMessage ([7b29cdf](https://github.com/open5gs/open5gs/commit/7b29cdf89871be0a00c0dd907ae5da7bcf88e305))
|
||||
|
||||
#### Bug Fixes
|
||||
- [SBI] Time string conversion error on 32bit machine ([a0ebf20](https://github.com/open5gs/open5gs/commit/e531ccab5a82698dad46d5d9d41a0e0c496b5ed6))
|
||||
- [MME] Add handler for NAS EPS activate_dedicated EPS bearer context reject ([#755](https://github.com/open5gs/open5gs/pull/755)) -- [herlesupreeth](https://github.com/herlesupreeth)
|
||||
- [PFCP] Remvoe repeated QER in handling Create-PDR ([#749](https://github.com/open5gs/open5gs/pull/749)) -- [zhonglin6666](https://github.com/zhonglin6666)
|
||||
- [AMF] Re-add SCTP ppid and stream-no ([#743](https://github.com/open5gs/open5gs/issues/743)) -- [aligungr](https://github.com/aligungr)
|
||||
- [5GC] Fix wrong usage of SBI heartbeat timer ([#741](https://github.com/open5gs/open5gs/issues/741)) -- [fatihozer90](https://github.com/fatihozer90)
|
||||
- [5GC] Fix the problem of receiving large HTTP2 message(Max: 8,192 bytes) ([#738](https://github.com/open5gs/open5gs/issues/738)) -- [fatihozer90](https://github.com/fatihozer90)
|
||||
- [NRF] Support subscrCond ([#730](https://github.com/open5gs/open5gs/issues/730)) -- [fatihozer90](https://github.com/fatihozer90)
|
||||
- [NRF] Many BUG fixes ([#727](https://github.com/open5gs/open5gs/issues/727), [#728](https://github.com/open5gs/open5gs/issues/728), [#729](https://github.com/open5gs/open5gs/issues/729), [#737](https://github.com/open5gs/open5gs/issues/737)) -- [fatihozer90](https://github.com/fatihozer90)
|
||||
- [AMF] AMF sets default DNN if UE does not sent it
|
||||
- [MME] Fix the MME crash ([#708](https://github.com/open5gs/open5gs/issues/708), [#721](https://github.com/open5gs/open5gs/issues/721)) -- [cecrevier](https://github.com/cecrevier)
|
||||
|
||||
Download -- [v2.1.3.tar.gz](https://github.com/open5gs/open5gs/archive/v2.1.3.tar.gz)
|
||||
{: .notice--info}
|
||||
BIN
docs/assets/images/Open5GS_CUPS-01.jpg
Normal file
BIN
docs/assets/images/Open5GS_CUPS-01.jpg
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 300 KiB |
1336
docs/assets/images/Open5GS_CUPS-01.pdf
Normal file
1336
docs/assets/images/Open5GS_CUPS-01.pdf
Normal file
File diff suppressed because one or more lines are too long
@@ -183,8 +183,8 @@ static void app_context_prepare(void)
|
||||
|
||||
recalculate_pool_size();
|
||||
|
||||
/* 10 second */
|
||||
self.time.nf_instance.heartbeat_interval = 10;
|
||||
/* <Heartbeat Checking Interval>
|
||||
* Heartbeat Interval(e.g: 10 seconds) + No Heartbeat Margin(1 second) */
|
||||
self.time.nf_instance.no_heartbeat_margin = 1;
|
||||
|
||||
/* 3600 seconds = 1 hour */
|
||||
@@ -327,6 +327,10 @@ int ogs_app_context_parse_config(void)
|
||||
} else if (!strcmp(parameter_key, "use_openair")) {
|
||||
self.parameter.use_openair =
|
||||
ogs_yaml_iter_bool(¶meter_iter);
|
||||
} else if (!strcmp(
|
||||
parameter_key, "no_ipv4v6_local_addr_in_packet_filter")) {
|
||||
self.parameter.no_ipv4v6_local_addr_in_packet_filter =
|
||||
ogs_yaml_iter_bool(¶meter_iter);
|
||||
} else
|
||||
ogs_warn("unknown key `%s`", parameter_key);
|
||||
}
|
||||
|
||||
@@ -74,6 +74,7 @@ typedef struct ogs_app_context_s {
|
||||
int no_slaac;
|
||||
|
||||
int use_openair;
|
||||
int no_ipv4v6_local_addr_in_packet_filter;
|
||||
} parameter;
|
||||
|
||||
ogs_sockopt_t sockopt;
|
||||
|
||||
@@ -138,7 +138,7 @@ typedef asn_type_selector_result_t(asn_type_selector_f)(
|
||||
const void *parent_structure_ptr);
|
||||
|
||||
/*
|
||||
* Generalized functions for dealing with the speciic type.
|
||||
* Generalized functions for dealing with the specific type.
|
||||
* May be directly invoked by applications.
|
||||
*/
|
||||
typedef struct asn_TYPE_operation_s {
|
||||
|
||||
@@ -41,7 +41,7 @@ ogs_pkbuf_t *ogs_asn_encode(const asn_TYPE_descriptor_t *td, void *sptr)
|
||||
return NULL;
|
||||
}
|
||||
|
||||
ogs_pkbuf_trim(pkbuf, (enc_ret.encoded >> 3));
|
||||
ogs_pkbuf_trim(pkbuf, ((enc_ret.encoded + 7) >> 3));
|
||||
|
||||
return pkbuf;
|
||||
}
|
||||
|
||||
@@ -255,7 +255,7 @@ char *ogs_s_nssai_sd_to_string(ogs_uint24_t sd)
|
||||
if (sd.v == OGS_S_NSSAI_NO_SD_VALUE)
|
||||
return NULL;
|
||||
|
||||
return ogs_uint24_to_string(sd);
|
||||
return ogs_uint24_to_0string(sd);
|
||||
}
|
||||
|
||||
ogs_uint24_t ogs_s_nssai_sd_from_string(const char *hex)
|
||||
@@ -472,3 +472,13 @@ char *ogs_ipv6_to_string(uint8_t *addr6)
|
||||
|
||||
return (char *)OGS_INET6_NTOP(addr6, buf);
|
||||
}
|
||||
|
||||
void ogs_session_data_free(ogs_session_data_t *session_data)
|
||||
{
|
||||
int i;
|
||||
|
||||
ogs_assert(session_data);
|
||||
|
||||
for (i = 0; i < session_data->num_of_pcc_rule; i++)
|
||||
OGS_PCC_RULE_FREE(&session_data->pcc_rule[i]);
|
||||
}
|
||||
|
||||
@@ -330,8 +330,8 @@ typedef struct ogs_pcc_rule_s {
|
||||
#define OGS_PCC_RULE_TYPE_REMOVE 2
|
||||
uint8_t type;
|
||||
|
||||
#define OGS_MAX_PCC_RULE_NAME_LEN 256
|
||||
char *name;
|
||||
char *id; /* 5GC */
|
||||
char *name; /* EPC */
|
||||
|
||||
/* Num of Flow per PCC Rule */
|
||||
#define OGS_MAX_NUM_OF_FLOW 8
|
||||
@@ -359,10 +359,14 @@ typedef struct ogs_pcc_rule_s {
|
||||
if ((__sRC)->name) { \
|
||||
(__dST)->name = ogs_strdup((__sRC)->name); \
|
||||
ogs_assert((__dST)->name); \
|
||||
} else \
|
||||
ogs_assert_if_reached(); \
|
||||
} \
|
||||
if ((__sRC)->id) { \
|
||||
(__dST)->id = ogs_strdup((__sRC)->id); \
|
||||
ogs_assert((__dST)->id); \
|
||||
} \
|
||||
for (__iNDEX = 0; __iNDEX < (__sRC)->num_of_flow; __iNDEX++) { \
|
||||
(__dST)->flow[__iNDEX].direction = (__sRC)->flow[__iNDEX].direction; \
|
||||
(__dST)->flow[__iNDEX].direction = \
|
||||
(__sRC)->flow[__iNDEX].direction; \
|
||||
(__dST)->flow[__iNDEX].description = \
|
||||
ogs_strdup((__sRC)->flow[__iNDEX].description); \
|
||||
ogs_assert((__dST)->flow[__iNDEX].description); \
|
||||
@@ -377,6 +381,8 @@ typedef struct ogs_pcc_rule_s {
|
||||
do { \
|
||||
int __pCCrULE_iNDEX; \
|
||||
ogs_assert((__pCCrULE)); \
|
||||
if ((__pCCrULE)->id) \
|
||||
ogs_free((__pCCrULE)->id); \
|
||||
if ((__pCCrULE)->name) \
|
||||
ogs_free((__pCCrULE)->name); \
|
||||
for (__pCCrULE_iNDEX = 0; \
|
||||
@@ -507,6 +513,15 @@ typedef struct ogs_subscription_data_s {
|
||||
} msisdn[OGS_MAX_NUM_OF_MSISDN];
|
||||
} ogs_subscription_data_t;
|
||||
|
||||
typedef struct ogs_session_data_s {
|
||||
ogs_pdn_t pdn;
|
||||
#define OGS_MAX_NUM_OF_PCC_RULE 8 /* Num of PCC Rule */
|
||||
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
|
||||
int num_of_pcc_rule;
|
||||
} ogs_session_data_t;
|
||||
|
||||
void ogs_session_data_free(ogs_session_data_t *session_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -23,6 +23,10 @@
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_LIMITS_H
|
||||
#include <limits.h>
|
||||
#endif
|
||||
|
||||
#include "ogs-core.h"
|
||||
|
||||
void *ogs_ascii_to_hex(char *in, int in_len, void *out, int out_len)
|
||||
@@ -156,64 +160,73 @@ char ogs_from_hex(char ch)
|
||||
return isdigit(ch) ? ch - '0' : tolower(ch) - 'a' + 10;
|
||||
}
|
||||
|
||||
char *ogs_uint24_to_string(ogs_uint24_t x)
|
||||
char *ogs_uint24_to_0string(ogs_uint24_t x)
|
||||
{
|
||||
return ogs_msprintf("%06x", x.v);
|
||||
}
|
||||
|
||||
char *ogs_uint28_to_string(uint32_t x)
|
||||
char *ogs_uint28_to_0string(uint32_t x)
|
||||
{
|
||||
return ogs_msprintf("%07x", x);
|
||||
}
|
||||
|
||||
char *ogs_uint32_to_string(uint32_t x)
|
||||
char *ogs_uint32_to_0string(uint32_t x)
|
||||
{
|
||||
return ogs_msprintf("%08x", x);
|
||||
}
|
||||
|
||||
char *ogs_uint36_to_string(uint64_t x)
|
||||
char *ogs_uint36_to_0string(uint64_t x)
|
||||
{
|
||||
return ogs_msprintf("%09llx", (long long)x);
|
||||
}
|
||||
|
||||
char *ogs_uint64_to_0string(uint64_t x)
|
||||
{
|
||||
return ogs_msprintf("%016llx", (long long)x);
|
||||
}
|
||||
|
||||
char *ogs_uint64_to_string(uint64_t x)
|
||||
{
|
||||
char *str, *p;
|
||||
|
||||
str = ogs_uint64_to_0string(x);
|
||||
ogs_assert(str);
|
||||
|
||||
p = ogs_left_trimcharacter(str, '0');
|
||||
ogs_assert(p);
|
||||
|
||||
ogs_free(str);
|
||||
return ogs_strdup(p);
|
||||
}
|
||||
|
||||
ogs_uint24_t ogs_uint24_from_string(char *str)
|
||||
{
|
||||
ogs_uint24_t x;
|
||||
|
||||
ogs_assert(str);
|
||||
ogs_ascii_to_hex(str, strlen(str), &x, 3);
|
||||
return ogs_be24toh(x);
|
||||
|
||||
x.v = ogs_uint64_from_string(str);
|
||||
return x;
|
||||
}
|
||||
|
||||
uint32_t ogs_uint28_from_string(char *str)
|
||||
{
|
||||
uint32_t x;
|
||||
|
||||
ogs_assert(str);
|
||||
|
||||
x = 0;
|
||||
ogs_ascii_to_hex(str, strlen(str), &x, 4);
|
||||
|
||||
return be32toh(x) >> 4;
|
||||
}
|
||||
|
||||
uint32_t ogs_uint32_from_string(char *str)
|
||||
{
|
||||
uint32_t x;
|
||||
|
||||
ogs_assert(str);
|
||||
ogs_ascii_to_hex(str, strlen(str), &x, 4);
|
||||
return be32toh(x);
|
||||
}
|
||||
|
||||
uint64_t ogs_uint36_from_string(char *str)
|
||||
uint64_t ogs_uint64_from_string(char *str)
|
||||
{
|
||||
uint64_t x;
|
||||
|
||||
ogs_assert(str);
|
||||
|
||||
x = 0;
|
||||
ogs_ascii_to_hex(str, strlen(str), &x, 5);
|
||||
if (strlen(str) == 0)
|
||||
return 0;
|
||||
|
||||
return be64toh(x) >> 28;
|
||||
errno = 0;
|
||||
x = strtoll(str, NULL, 16);
|
||||
|
||||
if ((errno == ERANGE && (x == LONG_MAX || x == LONG_MIN)) ||
|
||||
(errno != 0 && x == 0)) {
|
||||
ogs_log_message(OGS_LOG_FATAL, ogs_errno, "strtoll()) failed [%lld]",
|
||||
(long long)x);
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
|
||||
return x;
|
||||
}
|
||||
|
||||
@@ -39,15 +39,15 @@ void *ogs_buffer_to_bcd(uint8_t *in, int in_len, void *out);
|
||||
|
||||
char ogs_from_hex(char ch);
|
||||
|
||||
char *ogs_uint24_to_string(ogs_uint24_t x);
|
||||
char *ogs_uint28_to_string(uint32_t x);
|
||||
char *ogs_uint32_to_string(uint32_t x);
|
||||
char *ogs_uint36_to_string(uint64_t x);
|
||||
char *ogs_uint24_to_0string(ogs_uint24_t x);
|
||||
char *ogs_uint28_to_0string(uint32_t x);
|
||||
char *ogs_uint32_to_0string(uint32_t x);
|
||||
char *ogs_uint36_to_0string(uint64_t x);
|
||||
char *ogs_uint64_to_0string(uint64_t x);
|
||||
char *ogs_uint64_to_string(uint64_t x);
|
||||
|
||||
ogs_uint24_t ogs_uint24_from_string(char *str);
|
||||
uint32_t ogs_uint28_from_string(char *str);
|
||||
uint32_t ogs_uint32_from_string(char *str);
|
||||
uint64_t ogs_uint36_from_string(char *str);
|
||||
uint64_t ogs_uint64_from_string(char *str);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -92,9 +92,9 @@ void ogs_pkbuf_default_init(ogs_pkbuf_config_t *config)
|
||||
ogs_assert(config);
|
||||
memset(config, 0, sizeof *config);
|
||||
|
||||
config->cluster_128_pool = 32768;
|
||||
config->cluster_256_pool = 4096;
|
||||
config->cluster_512_pool = 2048;
|
||||
config->cluster_128_pool = 65536;
|
||||
config->cluster_256_pool = 8192;
|
||||
config->cluster_512_pool = 4096;
|
||||
config->cluster_1024_pool = 1024;
|
||||
config->cluster_2048_pool = 512;
|
||||
config->cluster_8192_pool = 128;
|
||||
|
||||
@@ -53,6 +53,10 @@
|
||||
#include <stdarg.h>
|
||||
#endif
|
||||
|
||||
#if HAVE_CTYPE_H
|
||||
#include <ctype.h>
|
||||
#endif
|
||||
|
||||
#include "ogs-core.h"
|
||||
|
||||
int ogs_vsnprintf(char *str, size_t size, const char *format, va_list ap)
|
||||
@@ -254,3 +258,64 @@ char *ogs_mstrcatf(char *source, const char *message, ...)
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
char *ogs_trimwhitespace(char *str)
|
||||
{
|
||||
char *end;
|
||||
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
} else if (*str == 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
while (isspace((unsigned char)*str)) str++;
|
||||
|
||||
end = str + strlen(str) - 1;
|
||||
while(end > str && isspace((unsigned char)*end)) {
|
||||
end--;
|
||||
}
|
||||
|
||||
*(end+1) = 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
char *ogs_left_trimcharacter(char *str, char to_remove)
|
||||
{
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
} else if (*str == 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
while(*str == to_remove) str++;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
char *ogs_right_trimcharacter(char *str, char to_remove)
|
||||
{
|
||||
char *end;
|
||||
|
||||
if (str == NULL) {
|
||||
return NULL;
|
||||
} else if (*str == 0) {
|
||||
return str;
|
||||
}
|
||||
|
||||
end = str + strlen(str) - 1;
|
||||
while(end > str && (*end == to_remove)) {
|
||||
end--;
|
||||
}
|
||||
|
||||
*(end+1) = 0;
|
||||
|
||||
return str;
|
||||
}
|
||||
|
||||
char *ogs_trimcharacter(char *str, char to_remove)
|
||||
{
|
||||
return ogs_right_trimcharacter(
|
||||
ogs_left_trimcharacter(str, to_remove), to_remove);
|
||||
}
|
||||
|
||||
@@ -96,6 +96,12 @@ char *ogs_msprintf(const char *message, ...)
|
||||
char *ogs_mstrcatf(char *source, const char *message, ...)
|
||||
OGS_GNUC_PRINTF(2, 3);
|
||||
|
||||
char *ogs_trimwhitespace(char *str);
|
||||
|
||||
char *ogs_left_trimcharacter(char *str, char to_remove);
|
||||
char *ogs_right_trimcharacter(char *str, char to_remove);
|
||||
char *ogs_trimcharacter(char *str, char to_remove);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -22,6 +22,7 @@ libdbi_sources = files('''
|
||||
|
||||
ogs-mongoc.c
|
||||
subscription.c
|
||||
session.c
|
||||
'''.split())
|
||||
|
||||
libmongoc_dep = dependency('libmongoc-1.0')
|
||||
|
||||
@@ -27,6 +27,7 @@
|
||||
|
||||
#include "dbi/ogs-mongoc.h"
|
||||
#include "dbi/subscription.h"
|
||||
#include "dbi/session.h"
|
||||
|
||||
#undef OGS_DBI_INSIDE
|
||||
|
||||
|
||||
383
lib/dbi/session.c
Normal file
383
lib/dbi/session.c
Normal file
@@ -0,0 +1,383 @@
|
||||
/*
|
||||
* 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_session_data(char *supi, char *dnn,
|
||||
ogs_session_data_t *session_data)
|
||||
{
|
||||
int rv = OGS_OK;
|
||||
mongoc_cursor_t *cursor = NULL;
|
||||
bson_t *query = NULL;
|
||||
bson_t *opts = NULL;
|
||||
bson_error_t error;
|
||||
const bson_t *document;
|
||||
bson_iter_t iter;
|
||||
bson_iter_t child1_iter, child2_iter, child3_iter;
|
||||
bson_iter_t child4_iter, child5_iter, child6_iter;
|
||||
const char *utf8 = NULL;
|
||||
uint32_t length = 0;
|
||||
|
||||
char *supi_type = NULL;
|
||||
char *supi_id = NULL;
|
||||
|
||||
ogs_session_data_t zero_data;
|
||||
|
||||
ogs_assert(supi);
|
||||
ogs_assert(dnn);
|
||||
ogs_assert(session_data);
|
||||
|
||||
memset(&zero_data, 0, sizeof(zero_data));
|
||||
|
||||
/* session_data should be initialized to zero */
|
||||
ogs_assert(memcmp(session_data, &zero_data, sizeof(zero_data)) == 0);
|
||||
|
||||
supi_type = ogs_id_get_type(supi);
|
||||
ogs_assert(supi_type);
|
||||
supi_id = ogs_id_get_value(supi);
|
||||
ogs_assert(supi_id);
|
||||
|
||||
query = BCON_NEW(
|
||||
supi_type, BCON_UTF8(supi_id),
|
||||
"pdn.apn", BCON_UTF8(dnn));
|
||||
#if MONGOC_MAJOR_VERSION >= 1 && MONGOC_MINOR_VERSION >= 5
|
||||
opts = BCON_NEW(
|
||||
"projection", "{",
|
||||
supi_type, BCON_INT64(1),
|
||||
"pdn.$", BCON_INT64(1),
|
||||
"}"
|
||||
);
|
||||
cursor = mongoc_collection_find_with_opts(
|
||||
ogs_mongoc()->collection.subscriber, query, opts, NULL);
|
||||
#else
|
||||
asdklfjasdf
|
||||
opts = BCON_NEW(
|
||||
supi_type, BCON_INT64(1),
|
||||
"pdn.$", BCON_INT64(1)
|
||||
);
|
||||
cursor = mongoc_collection_find(self.subscriberCollection,
|
||||
MONGOC_QUERY_NONE, 0, 0, 0, query, opts, NULL);
|
||||
#endif
|
||||
|
||||
if (!mongoc_cursor_next(cursor, &document)) {
|
||||
ogs_error("Cannot find IMSI(%s)+APN(%s) in DB", supi_id, dnn);
|
||||
|
||||
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;
|
||||
}
|
||||
|
||||
while (bson_iter_next(&iter)) {
|
||||
const char *key = bson_iter_key(&iter);
|
||||
if (!strcmp(key, "pdn") &&
|
||||
BSON_ITER_HOLDS_ARRAY(&iter)) {
|
||||
int pdn_index = 0;
|
||||
|
||||
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 == 0);
|
||||
|
||||
pdn = &session_data->pdn;
|
||||
bson_iter_recurse(&child1_iter, &child2_iter);
|
||||
while (bson_iter_next(&child2_iter)) {
|
||||
const char *child2_key = bson_iter_key(&child2_iter);
|
||||
if ((!strcmp(child2_key, "apn") ||
|
||||
!strcmp(child2_key, "dnn")) &&
|
||||
BSON_ITER_HOLDS_UTF8(&child2_iter)) {
|
||||
utf8 = bson_iter_utf8(&child2_iter, &length);
|
||||
ogs_cpystrn(pdn->dnn, utf8,
|
||||
ogs_min(length, OGS_MAX_APN_LEN)+1);
|
||||
} else if (!strcmp(child2_key, "type") &&
|
||||
BSON_ITER_HOLDS_INT32(&child2_iter)) {
|
||||
pdn->pdn_type = bson_iter_int32(&child2_iter);
|
||||
} else if (!strcmp(child2_key, "qos") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
|
||||
bson_iter_recurse(&child2_iter, &child3_iter);
|
||||
while (bson_iter_next(&child3_iter)) {
|
||||
const char *child3_key =
|
||||
bson_iter_key(&child3_iter);
|
||||
if (!strcmp(child3_key, "qci") &&
|
||||
BSON_ITER_HOLDS_INT32(&child3_iter)) {
|
||||
pdn->qos.qci = bson_iter_int32(&child3_iter);
|
||||
} else if (!strcmp(child3_key, "arp") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(&child3_iter)) {
|
||||
bson_iter_recurse(&child3_iter, &child4_iter);
|
||||
while (bson_iter_next(&child4_iter)) {
|
||||
const char *child4_key =
|
||||
bson_iter_key(&child4_iter);
|
||||
if (!strcmp(child4_key, "priority_level") &&
|
||||
BSON_ITER_HOLDS_INT32(&child4_iter)) {
|
||||
pdn->qos.arp.priority_level =
|
||||
bson_iter_int32(&child4_iter);
|
||||
} else if (!strcmp(child4_key,
|
||||
"pre_emption_capability") &&
|
||||
BSON_ITER_HOLDS_INT32(&child4_iter)) {
|
||||
pdn->qos.arp.pre_emption_capability =
|
||||
bson_iter_int32(&child4_iter);
|
||||
} else if (!strcmp(child4_key,
|
||||
"pre_emption_vulnerability") &&
|
||||
BSON_ITER_HOLDS_INT32(&child4_iter)) {
|
||||
pdn->qos.arp.pre_emption_vulnerability =
|
||||
bson_iter_int32(&child4_iter);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(child2_key, "ambr") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(&child2_iter)) {
|
||||
bson_iter_recurse(&child2_iter, &child3_iter);
|
||||
while (bson_iter_next(&child3_iter)) {
|
||||
const char *child3_key =
|
||||
bson_iter_key(&child3_iter);
|
||||
if (!strcmp(child3_key, "uplink") &&
|
||||
BSON_ITER_HOLDS_INT64(&child3_iter)) {
|
||||
pdn->ambr.uplink =
|
||||
bson_iter_int64(&child3_iter) * 1024;
|
||||
} else if (!strcmp(child3_key, "downlink") &&
|
||||
BSON_ITER_HOLDS_INT64(&child3_iter)) {
|
||||
pdn->ambr.downlink =
|
||||
bson_iter_int64(&child3_iter) * 1024;
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(child2_key, "pcc_rule") &&
|
||||
BSON_ITER_HOLDS_ARRAY(&child2_iter)) {
|
||||
int pcc_rule_index = 0;
|
||||
|
||||
bson_iter_recurse(&child2_iter, &child3_iter);
|
||||
while (bson_iter_next(&child3_iter)) {
|
||||
const char *child3_key =
|
||||
bson_iter_key(&child3_iter);
|
||||
ogs_pcc_rule_t *pcc_rule = NULL;
|
||||
|
||||
ogs_assert(child3_key);
|
||||
pcc_rule_index = atoi(child3_key);
|
||||
ogs_assert(pcc_rule_index <
|
||||
OGS_MAX_NUM_OF_PCC_RULE);
|
||||
|
||||
pcc_rule = &session_data->pcc_rule[pcc_rule_index];
|
||||
bson_iter_recurse(&child3_iter, &child4_iter);
|
||||
while (bson_iter_next(&child4_iter)) {
|
||||
const char *child4_key =
|
||||
bson_iter_key(&child4_iter);
|
||||
|
||||
if (!strcmp(child4_key, "qos") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(&child4_iter)) {
|
||||
bson_iter_recurse(
|
||||
&child4_iter, &child5_iter);
|
||||
while (bson_iter_next(&child5_iter)) {
|
||||
const char *child5_key =
|
||||
bson_iter_key(&child5_iter);
|
||||
if (!strcmp(child5_key, "qci") &&
|
||||
BSON_ITER_HOLDS_INT32(
|
||||
&child5_iter)) {
|
||||
pcc_rule->qos.qci =
|
||||
bson_iter_int32(&child5_iter);
|
||||
} else if (!strcmp(child5_key, "arp") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(
|
||||
&child5_iter)) {
|
||||
bson_iter_recurse(
|
||||
&child5_iter, &child6_iter);
|
||||
while (bson_iter_next(
|
||||
&child6_iter)) {
|
||||
const char *child6_key =
|
||||
bson_iter_key(&child6_iter);
|
||||
if (!strcmp(child6_key,
|
||||
"priority_level") &&
|
||||
BSON_ITER_HOLDS_INT32(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.arp.
|
||||
priority_level =
|
||||
bson_iter_int32(
|
||||
&child6_iter);
|
||||
} else if (!strcmp(child6_key,
|
||||
"pre_emption_capability") &&
|
||||
BSON_ITER_HOLDS_INT32(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.arp.
|
||||
pre_emption_capability =
|
||||
bson_iter_int32(
|
||||
&child6_iter);
|
||||
} else if (!strcmp(child6_key,
|
||||
"pre_emption_vulnerability")
|
||||
&& BSON_ITER_HOLDS_INT32(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.arp.
|
||||
pre_emption_vulnerability =
|
||||
bson_iter_int32(
|
||||
&child6_iter);
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(child5_key, "mbr") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(
|
||||
&child5_iter)) {
|
||||
bson_iter_recurse(
|
||||
&child5_iter, &child6_iter);
|
||||
while (bson_iter_next(
|
||||
&child6_iter)) {
|
||||
const char *child6_key =
|
||||
bson_iter_key(&child6_iter);
|
||||
if (!strcmp(child6_key,
|
||||
"downlink") &&
|
||||
BSON_ITER_HOLDS_INT64(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.mbr.downlink =
|
||||
bson_iter_int64(
|
||||
&child6_iter) * 1024;
|
||||
} else if (!strcmp(child6_key,
|
||||
"uplink") &&
|
||||
BSON_ITER_HOLDS_INT64(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.mbr.uplink =
|
||||
bson_iter_int64(
|
||||
&child6_iter) * 1024;
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(child5_key, "gbr") &&
|
||||
BSON_ITER_HOLDS_DOCUMENT(
|
||||
&child5_iter)) {
|
||||
bson_iter_recurse(&child5_iter,
|
||||
&child6_iter);
|
||||
while (bson_iter_next(
|
||||
&child6_iter)) {
|
||||
const char *child6_key =
|
||||
bson_iter_key(&child6_iter);
|
||||
if (!strcmp(child6_key,
|
||||
"downlink") &&
|
||||
BSON_ITER_HOLDS_INT64(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.gbr.downlink =
|
||||
bson_iter_int64(
|
||||
&child6_iter) * 1024;
|
||||
} else if (!strcmp(child6_key,
|
||||
"uplink") &&
|
||||
BSON_ITER_HOLDS_INT64(
|
||||
&child6_iter)) {
|
||||
pcc_rule->qos.gbr.uplink =
|
||||
bson_iter_int64(
|
||||
&child6_iter) * 1024;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (!strcmp(child4_key, "flow") &&
|
||||
BSON_ITER_HOLDS_ARRAY(&child4_iter)) {
|
||||
int flow_index = 0;
|
||||
|
||||
bson_iter_recurse(&child4_iter,
|
||||
&child5_iter);
|
||||
while (bson_iter_next(&child5_iter)) {
|
||||
const char *child5_key =
|
||||
bson_iter_key(&child5_iter);
|
||||
ogs_flow_t *flow = NULL;
|
||||
|
||||
ogs_assert(child5_key);
|
||||
flow_index = atoi(child5_key);
|
||||
ogs_assert(
|
||||
flow_index < OGS_MAX_NUM_OF_FLOW);
|
||||
|
||||
flow = &pcc_rule->flow[flow_index];
|
||||
bson_iter_recurse(
|
||||
&child5_iter, &child6_iter);
|
||||
while (bson_iter_next(&child6_iter)) {
|
||||
const char *child6_key =
|
||||
bson_iter_key(&child6_iter);
|
||||
if (!strcmp(child6_key,
|
||||
"direction") &&
|
||||
BSON_ITER_HOLDS_INT32(
|
||||
&child6_iter)) {
|
||||
flow->direction =
|
||||
bson_iter_int32(
|
||||
&child6_iter);
|
||||
} else if (!strcmp(child6_key,
|
||||
"description") &&
|
||||
BSON_ITER_HOLDS_UTF8(
|
||||
&child6_iter)) {
|
||||
utf8 = bson_iter_utf8(
|
||||
&child6_iter, &length);
|
||||
flow->description =
|
||||
ogs_malloc(length+1);
|
||||
ogs_cpystrn(
|
||||
(char*)flow->description,
|
||||
utf8, length+1);
|
||||
}
|
||||
}
|
||||
flow_index++;
|
||||
}
|
||||
pcc_rule->num_of_flow = flow_index;
|
||||
}
|
||||
}
|
||||
|
||||
/* EPC: Charing-Rule-Name */
|
||||
if (pcc_rule->name) {
|
||||
ogs_error(
|
||||
"PCC Rule Name has already been defined");
|
||||
ogs_free(pcc_rule->name);
|
||||
}
|
||||
pcc_rule->name = ogs_msprintf(
|
||||
"%s%d", dnn, pcc_rule_index+1);
|
||||
ogs_assert(pcc_rule->name);
|
||||
|
||||
/* 5GC: PCC-Rule-Id */
|
||||
if (pcc_rule->id) {
|
||||
ogs_error(
|
||||
"PCC Rule Id has already been defined");
|
||||
ogs_free(pcc_rule->id);
|
||||
}
|
||||
pcc_rule->id = ogs_msprintf("%d", pcc_rule_index+1);
|
||||
ogs_assert(pcc_rule->id);
|
||||
|
||||
pcc_rule->precedence = pcc_rule_index+1;
|
||||
pcc_rule->flow_status = OGS_FLOW_STATUS_ENABLED;
|
||||
pcc_rule_index++;
|
||||
}
|
||||
session_data->num_of_pcc_rule = pcc_rule_index;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
out:
|
||||
if (query) bson_destroy(query);
|
||||
if (opts) bson_destroy(opts);
|
||||
if (cursor) mongoc_cursor_destroy(cursor);
|
||||
|
||||
ogs_free(supi_type);
|
||||
ogs_free(supi_id);
|
||||
|
||||
return rv;
|
||||
}
|
||||
38
lib/dbi/session.h
Normal file
38
lib/dbi/session.h
Normal file
@@ -0,0 +1,38 @@
|
||||
/*
|
||||
* 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_SESSION_H
|
||||
#define OGS_DBI_SESSION_H
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int ogs_dbi_session_data(char *supi, char *dnn,
|
||||
ogs_session_data_t *session_data);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* OGS_DBI_SESSION_H */
|
||||
@@ -35,8 +35,6 @@
|
||||
|
||||
#include "ogs-core.h"
|
||||
|
||||
#define OGS_MAX_NUM_OF_PCC_RULE 8 /* Num of PCC Rule */
|
||||
|
||||
#define OGS_DIAMETER_INSIDE
|
||||
|
||||
#include "diameter/common/message.h"
|
||||
|
||||
@@ -157,14 +157,3 @@ int ogs_diam_gx_init(void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
void ogs_diam_gx_message_free(ogs_diam_gx_message_t *gx_message)
|
||||
{
|
||||
int i;
|
||||
|
||||
ogs_assert(gx_message);
|
||||
|
||||
for (i = 0; i < gx_message->num_of_pcc_rule; i++) {
|
||||
OGS_PCC_RULE_FREE(&gx_message->pcc_rule[i]);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -155,13 +155,10 @@ typedef struct ogs_diam_gx_message_s {
|
||||
#define OGS_DIAM_GX_CC_REQUEST_TYPE_EVENT_REQUEST 4
|
||||
uint32_t cc_request_type;
|
||||
|
||||
ogs_pdn_t pdn;
|
||||
ogs_pcc_rule_t pcc_rule[OGS_MAX_NUM_OF_PCC_RULE];
|
||||
int num_of_pcc_rule;
|
||||
ogs_session_data_t session_data;
|
||||
} ogs_diam_gx_message_t;
|
||||
|
||||
int ogs_diam_gx_init(void);
|
||||
void ogs_diam_gx_message_free(ogs_diam_gx_message_t *gx_message);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define OGS_GTP_H
|
||||
|
||||
#include "ogs-core.h"
|
||||
#include "ipfw/ogs-ipfw.h"
|
||||
#include "ogs-app.h"
|
||||
|
||||
#define OGS_GTPV1_U_UDP_PORT 2152
|
||||
|
||||
288
lib/gtp/types.c
288
lib/gtp/types.c
@@ -318,121 +318,125 @@ int16_t ogs_gtp_parse_tft(ogs_gtp_tft_t *tft, ogs_tlv_octet_t *octet)
|
||||
sizeof(tft->pf[i].precedence));
|
||||
size += sizeof(tft->pf[i].precedence);
|
||||
|
||||
ogs_assert(size+sizeof(tft->pf[i].length) <= octet->len);
|
||||
memcpy(&tft->pf[i].length, (unsigned char *)octet->data+size,
|
||||
sizeof(tft->pf[i].length));
|
||||
size += sizeof(tft->pf[i].length);
|
||||
ogs_assert(size+sizeof(tft->pf[i].content.length) <= octet->len);
|
||||
memcpy(&tft->pf[i].content.length, (unsigned char *)octet->data+size,
|
||||
sizeof(tft->pf[i].content.length));
|
||||
size += sizeof(tft->pf[i].content.length);
|
||||
|
||||
j = 0; len = 0;
|
||||
while(len < tft->pf[i].length) {
|
||||
ogs_assert(size+len+sizeof(tft->pf[i].component[j].type) <=
|
||||
while(len < tft->pf[i].content.length) {
|
||||
ogs_assert(size+len+sizeof(tft->pf[i].content.component[j].type) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].type,
|
||||
memcpy(&tft->pf[i].content.component[j].type,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].type));
|
||||
len += sizeof(tft->pf[i].component[j].type);
|
||||
switch(tft->pf[i].component[j].type) {
|
||||
case GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
|
||||
ogs_assert(size+len+sizeof(tft->pf[i].component[j].proto) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].proto,
|
||||
sizeof(tft->pf[i].content.component[j].type));
|
||||
len += sizeof(tft->pf[i].content.component[j].type);
|
||||
switch(tft->pf[i].content.component[j].type) {
|
||||
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].content.component[j].proto) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].content.component[j].proto,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].proto));
|
||||
len += sizeof(tft->pf[i].component[j].proto);
|
||||
sizeof(tft->pf[i].content.component[j].proto));
|
||||
len += sizeof(tft->pf[i].content.component[j].proto);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
|
||||
case GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].ipv4.addr) <= octet->len);
|
||||
memcpy(&tft->pf[i].component[j].ipv4.addr,
|
||||
sizeof(tft->pf[i].content.component[j].ipv4.addr) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].content.component[j].ipv4.addr,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].ipv4.addr));
|
||||
len += sizeof(tft->pf[i].component[j].ipv4.addr);
|
||||
sizeof(tft->pf[i].content.component[j].ipv4.addr));
|
||||
len += sizeof(tft->pf[i].content.component[j].ipv4.addr);
|
||||
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].ipv4.mask) <= octet->len);
|
||||
memcpy(&tft->pf[i].component[j].ipv4.mask,
|
||||
sizeof(tft->pf[i].content.component[j].ipv4.mask) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].content.component[j].ipv4.mask,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].ipv4.mask));
|
||||
len += sizeof(tft->pf[i].component[j].ipv4.mask);
|
||||
sizeof(tft->pf[i].content.component[j].ipv4.mask));
|
||||
len += sizeof(tft->pf[i].content.component[j].ipv4.mask);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].ipv6.addr) <= octet->len);
|
||||
memcpy(&tft->pf[i].component[j].ipv6.addr,
|
||||
sizeof(tft->pf[i].content.component[j].ipv6.addr) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].content.component[j].ipv6.addr,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].ipv6.addr));
|
||||
len += sizeof(tft->pf[i].component[j].ipv6.addr);
|
||||
sizeof(tft->pf[i].content.component[j].ipv6.addr));
|
||||
len += sizeof(tft->pf[i].content.component[j].ipv6.addr);
|
||||
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].ipv6.prefixlen) <=
|
||||
sizeof(tft->pf[i].content.component[j].ipv6.prefixlen) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].ipv6.prefixlen,
|
||||
memcpy(&tft->pf[i].content.component[j].ipv6.prefixlen,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].ipv6.prefixlen));
|
||||
len += sizeof(tft->pf[i].component[j].ipv6.prefixlen);
|
||||
sizeof(tft->pf[i].content.component[j].ipv6.prefixlen));
|
||||
len += sizeof(tft->pf[i].content.component[j].ipv6.prefixlen);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
|
||||
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].ipv6_mask.addr) <=
|
||||
sizeof(tft->pf[i].content.component[j].ipv6_mask.addr) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].ipv6_mask.addr,
|
||||
memcpy(&tft->pf[i].content.component[j].ipv6_mask.addr,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].ipv6_mask.addr));
|
||||
len += sizeof(tft->pf[i].component[j].ipv6_mask.addr);
|
||||
sizeof(tft->pf[i].content.component[j].ipv6_mask.addr));
|
||||
len += sizeof(tft->pf[i].content.component[j].ipv6_mask.addr);
|
||||
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].ipv6_mask.mask) <=
|
||||
sizeof(tft->pf[i].content.component[j].ipv6_mask.mask) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].ipv6_mask.mask,
|
||||
memcpy(&tft->pf[i].content.component[j].ipv6_mask.mask,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].ipv6_mask.mask));
|
||||
len += sizeof(tft->pf[i].component[j].ipv6_mask.mask);
|
||||
sizeof(tft->pf[i].content.component[j].ipv6_mask.mask));
|
||||
len += sizeof(tft->pf[i].content.component[j].ipv6_mask.mask);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
|
||||
case GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
|
||||
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
|
||||
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].port.low) <=
|
||||
sizeof(tft->pf[i].content.component[j].port.low) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].port.low,
|
||||
memcpy(&tft->pf[i].content.component[j].port.low,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].port.low));
|
||||
tft->pf[i].component[j].port.low =
|
||||
htobe16(tft->pf[i].component[j].port.low);
|
||||
len += sizeof(tft->pf[i].component[j].port.low);
|
||||
sizeof(tft->pf[i].content.component[j].port.low));
|
||||
tft->pf[i].content.component[j].port.low =
|
||||
htobe16(tft->pf[i].content.component[j].port.low);
|
||||
len += sizeof(tft->pf[i].content.component[j].port.low);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
|
||||
case GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
|
||||
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
|
||||
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].port.low) <=
|
||||
sizeof(tft->pf[i].content.component[j].port.low) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].port.low,
|
||||
memcpy(&tft->pf[i].content.component[j].port.low,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].port.low));
|
||||
tft->pf[i].component[j].port.low =
|
||||
htobe16(tft->pf[i].component[j].port.low);
|
||||
len += sizeof(tft->pf[i].component[j].port.low);
|
||||
sizeof(tft->pf[i].content.component[j].port.low));
|
||||
tft->pf[i].content.component[j].port.low =
|
||||
htobe16(tft->pf[i].content.component[j].port.low);
|
||||
len += sizeof(tft->pf[i].content.component[j].port.low);
|
||||
|
||||
ogs_assert(size+len+
|
||||
sizeof(tft->pf[i].component[j].port.high) <=
|
||||
sizeof(tft->pf[i].content.component[j].port.high) <=
|
||||
octet->len);
|
||||
memcpy(&tft->pf[i].component[j].port.high,
|
||||
memcpy(&tft->pf[i].content.component[j].port.high,
|
||||
(unsigned char *)octet->data+size+len,
|
||||
sizeof(tft->pf[i].component[j].port.high));
|
||||
tft->pf[i].component[j].port.high =
|
||||
htobe16(tft->pf[i].component[j].port.high);
|
||||
len += sizeof(tft->pf[i].component[j].port.high);
|
||||
sizeof(tft->pf[i].content.component[j].port.high));
|
||||
tft->pf[i].content.component[j].port.high =
|
||||
htobe16(tft->pf[i].content.component[j].port.high);
|
||||
len += sizeof(tft->pf[i].content.component[j].port.high);
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown Packet Filter Type(%d)",
|
||||
tft->pf[i].component[j].type);
|
||||
tft->pf[i].content.component[j].type);
|
||||
return -1;
|
||||
}
|
||||
j++;
|
||||
}
|
||||
tft->pf[i].num_of_component = j;
|
||||
tft->pf[i].content.num_of_component = j;
|
||||
size += len;
|
||||
}
|
||||
|
||||
@@ -480,118 +484,124 @@ int16_t ogs_gtp_build_tft(
|
||||
sizeof(target.pf[i].precedence));
|
||||
size += sizeof(target.pf[i].precedence);
|
||||
|
||||
ogs_assert(size + sizeof(target.pf[i].length) <= data_len);
|
||||
memcpy((unsigned char *)octet->data + size, &target.pf[i].length,
|
||||
sizeof(target.pf[i].length));
|
||||
size += sizeof(target.pf[i].length);
|
||||
ogs_assert(size + sizeof(target.pf[i].content.length) <= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].content.length,
|
||||
sizeof(target.pf[i].content.length));
|
||||
size += sizeof(target.pf[i].content.length);
|
||||
|
||||
for (j = 0; j < target.pf[i].num_of_component; j++) {
|
||||
for (j = 0; j < target.pf[i].content.num_of_component; j++) {
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].type) <= data_len);
|
||||
sizeof(target.pf[i].content.component[j].type) <= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].type,
|
||||
sizeof(target.pf[i].component[j].type));
|
||||
size += sizeof(target.pf[i].component[j].type);
|
||||
switch(target.pf[i].component[j].type) {
|
||||
case GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].proto) <= data_len);
|
||||
&target.pf[i].content.component[j].type,
|
||||
sizeof(target.pf[i].content.component[j].type));
|
||||
size += sizeof(target.pf[i].content.component[j].type);
|
||||
switch(target.pf[i].content.component[j].type) {
|
||||
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
|
||||
ogs_assert(size + sizeof(
|
||||
target.pf[i].content.component[j].proto) <= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].proto,
|
||||
sizeof(target.pf[i].component[j].proto));
|
||||
size += sizeof(target.pf[i].component[j].proto);
|
||||
&target.pf[i].content.component[j].proto,
|
||||
sizeof(target.pf[i].content.component[j].proto));
|
||||
size += sizeof(target.pf[i].content.component[j].proto);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
|
||||
case GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].ipv4.addr)
|
||||
sizeof(target.pf[i].content.component[j].ipv4.addr)
|
||||
<= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].ipv4.addr,
|
||||
sizeof(target.pf[i].component[j].ipv4.addr));
|
||||
size += sizeof(target.pf[i].component[j].ipv4.addr);
|
||||
&target.pf[i].content.component[j].ipv4.addr,
|
||||
sizeof(target.pf[i].content.component[j].ipv4.addr));
|
||||
size += sizeof(target.pf[i].content.component[j].ipv4.addr);
|
||||
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].ipv4.mask)
|
||||
sizeof(target.pf[i].content.component[j].ipv4.mask)
|
||||
<= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].ipv4.mask,
|
||||
sizeof(target.pf[i].component[j].ipv4.mask));
|
||||
size += sizeof(target.pf[i].component[j].ipv4.mask);
|
||||
&target.pf[i].content.component[j].ipv4.mask,
|
||||
sizeof(target.pf[i].content.component[j].ipv4.mask));
|
||||
size += sizeof(target.pf[i].content.component[j].ipv4.mask);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].ipv6.addr)
|
||||
sizeof(target.pf[i].content.component[j].ipv6.addr)
|
||||
<= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].ipv6.addr,
|
||||
sizeof(target.pf[i].component[j].ipv6.addr));
|
||||
size += sizeof(target.pf[i].component[j].ipv6.addr);
|
||||
&target.pf[i].content.component[j].ipv6.addr,
|
||||
sizeof(target.pf[i].content.component[j].ipv6.addr));
|
||||
size += sizeof(target.pf[i].content.component[j].ipv6.addr);
|
||||
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].ipv6.prefixlen)
|
||||
sizeof(target.pf[i].content.component[j].ipv6.prefixlen)
|
||||
<= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].ipv6.prefixlen,
|
||||
sizeof(target.pf[i].component[j].ipv6.prefixlen));
|
||||
size += sizeof(target.pf[i].component[j].ipv6.prefixlen);
|
||||
&target.pf[i].content.component[j].ipv6.prefixlen,
|
||||
sizeof(target.pf[i].content.component[j].ipv6.prefixlen));
|
||||
size += sizeof(
|
||||
target.pf[i].content.component[j].ipv6.prefixlen);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
|
||||
case GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].ipv6_mask.addr)
|
||||
sizeof(target.pf[i].content.component[j].ipv6_mask.addr)
|
||||
<= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].ipv6_mask.addr,
|
||||
sizeof(target.pf[i].component[j].ipv6_mask.addr));
|
||||
size += sizeof(target.pf[i].component[j].ipv6_mask.addr);
|
||||
&target.pf[i].content.component[j].ipv6_mask.addr,
|
||||
sizeof(
|
||||
target.pf[i].content.component[j].ipv6_mask.addr));
|
||||
size += sizeof(
|
||||
target.pf[i].content.component[j].ipv6_mask.addr);
|
||||
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].ipv6_mask.mask)
|
||||
sizeof(target.pf[i].content.component[j].ipv6_mask.mask)
|
||||
<= data_len);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].ipv6_mask.mask,
|
||||
sizeof(target.pf[i].component[j].ipv6_mask.mask));
|
||||
size += sizeof(target.pf[i].component[j].ipv6_mask.mask);
|
||||
&target.pf[i].content.component[j].ipv6_mask.mask,
|
||||
sizeof(
|
||||
target.pf[i].content.component[j].ipv6_mask.mask));
|
||||
size += sizeof(
|
||||
target.pf[i].content.component[j].ipv6_mask.mask);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
|
||||
case GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
|
||||
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
|
||||
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].port.low)
|
||||
sizeof(target.pf[i].content.component[j].port.low)
|
||||
<= data_len);
|
||||
target.pf[i].component[j].port.low =
|
||||
htobe16(target.pf[i].component[j].port.low);
|
||||
target.pf[i].content.component[j].port.low =
|
||||
htobe16(target.pf[i].content.component[j].port.low);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].port.low,
|
||||
sizeof(target.pf[i].component[j].port.low));
|
||||
size += sizeof(target.pf[i].component[j].port.low);
|
||||
&target.pf[i].content.component[j].port.low,
|
||||
sizeof(target.pf[i].content.component[j].port.low));
|
||||
size += sizeof(target.pf[i].content.component[j].port.low);
|
||||
break;
|
||||
case GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
|
||||
case GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
|
||||
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
|
||||
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].port.low)
|
||||
sizeof(target.pf[i].content.component[j].port.low)
|
||||
<= data_len);
|
||||
target.pf[i].component[j].port.low =
|
||||
htobe16(target.pf[i].component[j].port.low);
|
||||
target.pf[i].content.component[j].port.low =
|
||||
htobe16(target.pf[i].content.component[j].port.low);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].port.low,
|
||||
sizeof(target.pf[i].component[j].port.low));
|
||||
size += sizeof(target.pf[i].component[j].port.low);
|
||||
&target.pf[i].content.component[j].port.low,
|
||||
sizeof(target.pf[i].content.component[j].port.low));
|
||||
size += sizeof(target.pf[i].content.component[j].port.low);
|
||||
|
||||
ogs_assert(size +
|
||||
sizeof(target.pf[i].component[j].port.high)
|
||||
sizeof(target.pf[i].content.component[j].port.high)
|
||||
<= data_len);
|
||||
target.pf[i].component[j].port.high =
|
||||
htobe16(target.pf[i].component[j].port.high);
|
||||
target.pf[i].content.component[j].port.high =
|
||||
htobe16(target.pf[i].content.component[j].port.high);
|
||||
memcpy((unsigned char *)octet->data + size,
|
||||
&target.pf[i].component[j].port.high,
|
||||
sizeof(target.pf[i].component[j].port.high));
|
||||
size += sizeof(target.pf[i].component[j].port.high);
|
||||
&target.pf[i].content.component[j].port.high,
|
||||
sizeof(target.pf[i].content.component[j].port.high));
|
||||
size += sizeof(target.pf[i].content.component[j].port.high);
|
||||
break;
|
||||
default:
|
||||
ogs_error("Unknown Packet Filter Type(%d)",
|
||||
target.pf[i].component[j].type);
|
||||
target.pf[i].content.component[j].type);
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -275,7 +275,6 @@ int16_t ogs_gtp_build_flow_qos(ogs_tlv_octet_t *octet,
|
||||
* See subclause 10.5.6.12 in 3GPP TS 24.008 [13]. */
|
||||
#define OGS_GTP_MAX_TRAFFIC_FLOW_TEMPLATE 255
|
||||
|
||||
#define OGS_GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16
|
||||
typedef struct ogs_gtp_tft_s {
|
||||
union {
|
||||
struct {
|
||||
@@ -302,44 +301,7 @@ ED3(uint8_t code:3;,
|
||||
uint8_t flags;
|
||||
};
|
||||
uint8_t precedence;
|
||||
uint8_t length;
|
||||
#define GTP_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48
|
||||
#define GTP_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16
|
||||
#define GTP_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17
|
||||
#define GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32
|
||||
#define GTP_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33
|
||||
#define GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34
|
||||
#define GTP_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35
|
||||
#define GTP_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64
|
||||
#define GTP_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65
|
||||
#define GTP_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80
|
||||
#define GTP_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81
|
||||
#define GTP_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96
|
||||
#define GTP_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112
|
||||
#define GTP_PACKET_FILTER_FLOW_LABEL_TYPE 128
|
||||
struct {
|
||||
uint8_t type;
|
||||
union {
|
||||
uint8_t proto;
|
||||
struct {
|
||||
uint32_t addr;
|
||||
uint32_t mask;
|
||||
} ipv4;
|
||||
struct {
|
||||
uint32_t addr[4];
|
||||
uint8_t prefixlen;
|
||||
} ipv6;
|
||||
struct {
|
||||
uint32_t addr[4];
|
||||
uint32_t mask[4];
|
||||
} ipv6_mask;
|
||||
struct {
|
||||
uint16_t low;
|
||||
uint16_t high;
|
||||
} port;
|
||||
};
|
||||
} component[OGS_GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT];
|
||||
uint8_t num_of_component;
|
||||
ogs_pf_content_t content;
|
||||
} pf[OGS_MAX_NUM_OF_PACKET_FILTER];
|
||||
} ogs_gtp_tft_t;
|
||||
|
||||
|
||||
@@ -365,3 +365,123 @@ void ogs_ipfw_rule_swap(ogs_ipfw_rule_t *ipfw_rule)
|
||||
ogs_ipfw_copy_and_swap(&dst, ipfw_rule);
|
||||
memcpy(ipfw_rule, &dst, sizeof(ogs_ipfw_rule_t));
|
||||
}
|
||||
|
||||
void ogs_pf_content_from_ipfw_rule(
|
||||
uint8_t direction, ogs_pf_content_t *content, ogs_ipfw_rule_t *rule)
|
||||
{
|
||||
int j, len;
|
||||
|
||||
ogs_assert(content);
|
||||
ogs_assert(rule);
|
||||
|
||||
j = 0, len = 0;
|
||||
if (rule->proto) {
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE;
|
||||
content->component[j].proto = rule->proto;
|
||||
j++; len += 2;
|
||||
}
|
||||
|
||||
if (rule->ipv4_src) {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
|
||||
content->component[j].ipv4.addr = rule->ip.src.addr[0];
|
||||
content->component[j].ipv4.mask = rule->ip.src.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (rule->ipv4_dst) {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE;
|
||||
|
||||
content->component[j].ipv4.addr = rule->ip.dst.addr[0];
|
||||
content->component[j].ipv4.mask = rule->ip.dst.mask[0];
|
||||
j++; len += 9;
|
||||
}
|
||||
|
||||
if (rule->ipv6_src) {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(content->component[j].ipv6.addr,
|
||||
rule->ip.src.addr, sizeof rule->ip.src.addr);
|
||||
content->component[j].ipv6.prefixlen =
|
||||
contigmask((uint8_t *)rule->ip.src.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (rule->ipv6_dst) {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE;
|
||||
memcpy(content->component[j].ipv6.addr,
|
||||
rule->ip.dst.addr, sizeof rule->ip.dst.addr);
|
||||
content->component[j].ipv6.prefixlen =
|
||||
contigmask((uint8_t *)rule->ip.dst.mask, 128);
|
||||
j++; len += 18;
|
||||
}
|
||||
|
||||
if (rule->port.src.low) {
|
||||
if (rule->port.src.low == rule->port.src.high) {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
|
||||
content->component[j].port.low = rule->port.src.low;
|
||||
j++; len += 3;
|
||||
} else {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
|
||||
content->component[j].port.low = rule->port.src.low;
|
||||
content->component[j].port.high = rule->port.src.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
if (rule->port.dst.low) {
|
||||
if (rule->port.dst.low == rule->port.dst.high) {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE;
|
||||
content->component[j].port.low = rule->port.dst.low;
|
||||
j++; len += 3;
|
||||
} else {
|
||||
if (direction == OGS_FLOW_DOWNLINK_ONLY)
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE;
|
||||
else
|
||||
content->component[j].type =
|
||||
OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE;
|
||||
content->component[j].port.low = rule->port.dst.low;
|
||||
content->component[j].port.high = rule->port.dst.high;
|
||||
j++; len += 5;
|
||||
}
|
||||
}
|
||||
|
||||
content->num_of_component = j;
|
||||
content->length = len;
|
||||
}
|
||||
|
||||
|
||||
@@ -86,6 +86,52 @@ ogs_ipfw_rule_t *ogs_ipfw_copy_and_swap(
|
||||
ogs_ipfw_rule_t *dst, ogs_ipfw_rule_t *src);
|
||||
void ogs_ipfw_rule_swap(ogs_ipfw_rule_t *ipfw_rule);
|
||||
|
||||
#define OGS_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16
|
||||
typedef struct ogs_pf_content_s {
|
||||
uint8_t length;
|
||||
#define OGS_PACKET_FILTER_MATCH_ALL 1
|
||||
#define OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48
|
||||
#define OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16
|
||||
#define OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17
|
||||
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32
|
||||
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33
|
||||
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34
|
||||
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35
|
||||
#define OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64
|
||||
#define OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65
|
||||
#define OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80
|
||||
#define OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81
|
||||
#define OGS_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96
|
||||
#define OGS_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112
|
||||
#define OGS_PACKET_FILTER_FLOW_LABEL_TYPE 128
|
||||
struct {
|
||||
uint8_t type;
|
||||
union {
|
||||
uint8_t proto;
|
||||
struct {
|
||||
uint32_t addr;
|
||||
uint32_t mask;
|
||||
} ipv4;
|
||||
struct {
|
||||
uint32_t addr[4];
|
||||
uint8_t prefixlen;
|
||||
} ipv6;
|
||||
struct {
|
||||
uint32_t addr[4];
|
||||
uint32_t mask[4];
|
||||
} ipv6_mask;
|
||||
struct {
|
||||
uint16_t low;
|
||||
uint16_t high;
|
||||
} port;
|
||||
};
|
||||
} component[OGS_MAX_NUM_OF_PACKET_FILTER_COMPONENT];
|
||||
uint8_t num_of_component;
|
||||
} ogs_pf_content_t;
|
||||
|
||||
void ogs_pf_content_from_ipfw_rule(
|
||||
uint8_t direction, ogs_pf_content_t *content, ogs_ipfw_rule_t *rule);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,6 +21,7 @@
|
||||
#define OGS_NAS_5GS_H
|
||||
|
||||
#include "ogs-nas-common.h"
|
||||
#include "ipfw/ogs-ipfw.h"
|
||||
|
||||
#define OGS_NAS_INSIDE
|
||||
|
||||
|
||||
@@ -246,10 +246,84 @@ int ogs_nas_parse_nssai(ogs_s_nssai_t *s_nssai, ogs_nas_nssai_t *nas_nssai)
|
||||
return num_of_s_nssai;
|
||||
}
|
||||
|
||||
void ogs_nas_build_qos_flow_descriptions(
|
||||
ogs_nas_qos_flow_descriptions_t *flow_descriptions,
|
||||
ogs_nas_qos_flow_description_t *flow_description,
|
||||
int num_of_flow_description)
|
||||
{
|
||||
int i, j;
|
||||
char *buffer;
|
||||
uint16_t length;
|
||||
ogs_nas_qos_flow_description_t target;
|
||||
|
||||
ogs_assert(flow_descriptions);
|
||||
ogs_assert(flow_description);
|
||||
ogs_assert(num_of_flow_description);
|
||||
|
||||
buffer = ogs_calloc(1, OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
ogs_assert(buffer);
|
||||
length = 0;
|
||||
|
||||
for (i = 0; i < num_of_flow_description; i++) {
|
||||
memcpy(&target, flow_description + i,
|
||||
sizeof(ogs_nas_qos_flow_description_t));
|
||||
|
||||
ogs_assert(length + 3 <= OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
memcpy(buffer + length, &target, 3);
|
||||
length += 3;
|
||||
|
||||
for (j = 0; j < target.num_of_parameter; j++) {
|
||||
ogs_assert(length + sizeof(target.param[j].identifier) <=
|
||||
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
memcpy(buffer + length, &target.param[j].identifier,
|
||||
sizeof(target.param[j].identifier));
|
||||
length += sizeof(target.param[j].identifier);
|
||||
|
||||
ogs_assert(length + sizeof(target.param[j].len) <=
|
||||
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
memcpy(buffer + length, &target.param[j].len,
|
||||
sizeof(target.param[j].len));
|
||||
length += sizeof(target.param[j].len);
|
||||
|
||||
switch(target.param[j].identifier) {
|
||||
case OGS_NAX_QOS_FLOW_PARAMETER_ID_5QI:
|
||||
ogs_assert(target.param[j].len == 1);
|
||||
ogs_assert(length + target.param[j].len <=
|
||||
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
memcpy(buffer + length, &target.param[j].qci,
|
||||
target.param[j].len);
|
||||
length += target.param[j].len;
|
||||
break;
|
||||
|
||||
case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_UPLINK:
|
||||
case OGS_NAX_QOS_FLOW_PARAMETER_ID_GFBR_DOWNLINK:
|
||||
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_UPLINK:
|
||||
case OGS_NAX_QOS_FLOW_PARAMETER_ID_MFBR_DOWNLINK:
|
||||
ogs_assert(target.param[j].len == 3);
|
||||
ogs_assert(length + target.param[j].len <=
|
||||
OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN);
|
||||
target.param[j].br.bitrate =
|
||||
htobe16(target.param[j].br.bitrate);
|
||||
memcpy(buffer + length, &target.param[j].br,
|
||||
target.param[j].len);
|
||||
length += target.param[j].len;
|
||||
break;
|
||||
default:
|
||||
ogs_fatal("Unknown qos_flow parameter identifier [%d]",
|
||||
target.param[j].identifier);
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
flow_descriptions->buffer = buffer;
|
||||
flow_descriptions->length = length;
|
||||
}
|
||||
|
||||
void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
|
||||
ogs_nas_qos_rule_t *rule, int num_of_rule)
|
||||
{
|
||||
int i, j;
|
||||
int i, j, k;
|
||||
char *buffer;
|
||||
uint16_t length;
|
||||
ogs_nas_qos_rule_t target;
|
||||
@@ -263,6 +337,8 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
|
||||
length = 0;
|
||||
|
||||
for (i = 0; i < num_of_rule; i++) {
|
||||
char *rule_length = NULL;
|
||||
|
||||
memcpy(&target, rule + i, sizeof(ogs_nas_qos_rule_t));
|
||||
|
||||
ogs_assert(length + sizeof(target.identifier) <=
|
||||
@@ -270,10 +346,13 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
|
||||
memcpy(buffer + length, &target.identifier, sizeof(target.identifier));
|
||||
length += sizeof(target.identifier);
|
||||
|
||||
|
||||
ogs_assert(length + sizeof(target.length) <=
|
||||
OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
target.length = htobe16(target.length);
|
||||
memcpy(buffer + length, &target.length, sizeof(target.length));
|
||||
|
||||
/* Just store the location of the QoS rule length */
|
||||
rule_length = buffer+length;
|
||||
|
||||
length += sizeof(target.length);
|
||||
|
||||
ogs_assert(length + sizeof(target.flags) <= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
@@ -287,126 +366,137 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
|
||||
sizeof(target.pf[j].flags));
|
||||
length += sizeof(target.pf[j].flags);
|
||||
|
||||
ogs_assert(length + sizeof(target.pf[j].length) <=
|
||||
ogs_assert(length + sizeof(target.pf[j].content.length) <=
|
||||
OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length, &target.pf[j].length,
|
||||
sizeof(target.pf[j].length));
|
||||
length += sizeof(target.pf[j].length);
|
||||
memcpy(buffer + length, &target.pf[j].content.length,
|
||||
sizeof(target.pf[j].content.length));
|
||||
length += sizeof(target.pf[j].content.length);
|
||||
|
||||
for (j = 0; j < target.pf[j].num_of_component; j++) {
|
||||
ogs_assert(length + sizeof(target.pf[j].component[j].type) <=
|
||||
for (k = 0; k < target.pf[j].content.num_of_component; k++) {
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].content.component[k].type) <=
|
||||
OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].type,
|
||||
sizeof(target.pf[j].component[j].type));
|
||||
length += sizeof(target.pf[j].component[j].type);
|
||||
switch(target.pf[j].component[j].type) {
|
||||
memcpy(buffer + length, &target.pf[j].content.component[k].type,
|
||||
sizeof(target.pf[j].content.component[k].type));
|
||||
length += sizeof(target.pf[j].content.component[k].type);
|
||||
switch(target.pf[j].content.component[k].type) {
|
||||
case OGS_PACKET_FILTER_MATCH_ALL:
|
||||
break;
|
||||
case OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE:
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].proto) <=
|
||||
sizeof(target.pf[j].content.component[k].proto) <=
|
||||
OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].proto,
|
||||
sizeof(target.pf[j].component[j].proto));
|
||||
length += sizeof(target.pf[j].component[j].proto);
|
||||
&target.pf[j].content.component[k].proto,
|
||||
sizeof(target.pf[j].content.component[k].proto));
|
||||
length += sizeof(target.pf[j].content.component[k].proto);
|
||||
break;
|
||||
case OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE:
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].ipv4.addr)
|
||||
sizeof(target.pf[j].content.component[k].ipv4.addr)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].ipv4.addr,
|
||||
sizeof(target.pf[j].component[j].ipv4.addr));
|
||||
length += sizeof(target.pf[j].component[j].ipv4.addr);
|
||||
&target.pf[j].content.component[k].ipv4.addr,
|
||||
sizeof(target.pf[j].content.component[k].ipv4.addr));
|
||||
length +=
|
||||
sizeof(target.pf[j].content.component[k].ipv4.addr);
|
||||
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].ipv4.mask)
|
||||
sizeof(target.pf[j].content.component[k].ipv4.mask)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].ipv4.mask,
|
||||
sizeof(target.pf[j].component[j].ipv4.mask));
|
||||
length += sizeof(target.pf[j].component[j].ipv4.mask);
|
||||
&target.pf[j].content.component[k].ipv4.mask,
|
||||
sizeof(target.pf[j].content.component[k].ipv4.mask));
|
||||
length +=
|
||||
sizeof(target.pf[j].content.component[k].ipv4.mask);
|
||||
break;
|
||||
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE:
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].ipv6.addr)
|
||||
sizeof(target.pf[j].content.component[k].ipv6.addr)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].ipv6.addr,
|
||||
sizeof(target.pf[j].component[j].ipv6.addr));
|
||||
length += sizeof(target.pf[j].component[j].ipv6.addr);
|
||||
&target.pf[j].content.component[k].ipv6.addr,
|
||||
sizeof(target.pf[j].content.component[k].ipv6.addr));
|
||||
length +=
|
||||
sizeof(target.pf[j].content.component[k].ipv6.addr);
|
||||
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].ipv6.prefixlen)
|
||||
sizeof(target.pf[j].content.component[k].ipv6.prefixlen)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].ipv6.prefixlen,
|
||||
sizeof(target.pf[j].component[j].ipv6.prefixlen));
|
||||
length += sizeof(target.pf[j].component[j].ipv6.prefixlen);
|
||||
&target.pf[j].content.component[k].ipv6.prefixlen,
|
||||
sizeof(
|
||||
target.pf[j].content.component[k].ipv6.prefixlen));
|
||||
length += sizeof(
|
||||
target.pf[j].content.component[k].ipv6.prefixlen);
|
||||
break;
|
||||
case OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE:
|
||||
case OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE:
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].ipv6_mask.addr)
|
||||
sizeof(target.pf[j].content.component[k].ipv6_mask.addr)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].ipv6_mask.addr,
|
||||
sizeof(target.pf[j].component[j].ipv6_mask.addr));
|
||||
length += sizeof(target.pf[j].component[j].ipv6_mask.addr);
|
||||
&target.pf[j].content.component[k].ipv6_mask.addr,
|
||||
sizeof(
|
||||
target.pf[j].content.component[k].ipv6_mask.addr));
|
||||
length += sizeof(
|
||||
target.pf[j].content.component[k].ipv6_mask.addr);
|
||||
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].ipv6_mask.mask)
|
||||
sizeof(target.pf[j].content.component[k].ipv6_mask.mask)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].ipv6_mask.mask,
|
||||
sizeof(target.pf[j].component[j].ipv6_mask.mask));
|
||||
length += sizeof(target.pf[j].component[j].ipv6_mask.mask);
|
||||
&target.pf[j].content.component[k].ipv6_mask.mask,
|
||||
sizeof(
|
||||
target.pf[j].content.component[k].ipv6_mask.mask));
|
||||
length += sizeof(
|
||||
target.pf[j].content.component[k].ipv6_mask.mask);
|
||||
break;
|
||||
case OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE:
|
||||
case OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE:
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].port.low)
|
||||
sizeof(target.pf[j].content.component[k].port.low)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
target.pf[j].component[j].port.low =
|
||||
htobe16(target.pf[j].component[j].port.low);
|
||||
target.pf[j].content.component[k].port.low =
|
||||
htobe16(target.pf[j].content.component[k].port.low);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].port.low,
|
||||
sizeof(target.pf[j].component[j].port.low));
|
||||
length += sizeof(target.pf[j].component[j].port.low);
|
||||
&target.pf[j].content.component[k].port.low,
|
||||
sizeof(target.pf[j].content.component[k].port.low));
|
||||
length +=
|
||||
sizeof(target.pf[j].content.component[k].port.low);
|
||||
break;
|
||||
case OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE:
|
||||
case OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE:
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].port.low)
|
||||
sizeof(target.pf[j].content.component[k].port.low)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
target.pf[j].component[j].port.low =
|
||||
htobe16(target.pf[j].component[j].port.low);
|
||||
target.pf[j].content.component[k].port.low =
|
||||
htobe16(target.pf[j].content.component[k].port.low);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].port.low,
|
||||
sizeof(target.pf[j].component[j].port.low));
|
||||
length += sizeof(target.pf[j].component[j].port.low);
|
||||
&target.pf[j].content.component[k].port.low,
|
||||
sizeof(target.pf[j].content.component[k].port.low));
|
||||
length +=
|
||||
sizeof(target.pf[j].content.component[k].port.low);
|
||||
|
||||
ogs_assert(length +
|
||||
sizeof(target.pf[j].component[j].port.high)
|
||||
sizeof(target.pf[j].content.component[k].port.high)
|
||||
<= OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
target.pf[j].component[j].port.high =
|
||||
htobe16(target.pf[j].component[j].port.high);
|
||||
target.pf[j].content.component[k].port.high =
|
||||
htobe16(target.pf[j].content.component[k].port.high);
|
||||
memcpy(buffer + length,
|
||||
&target.pf[j].component[j].port.high,
|
||||
sizeof(target.pf[j].component[j].port.high));
|
||||
length += sizeof(target.pf[j].component[j].port.high);
|
||||
&target.pf[j].content.component[k].port.high,
|
||||
sizeof(target.pf[j].content.component[k].port.high));
|
||||
length +=
|
||||
sizeof(target.pf[j].content.component[k].port.high);
|
||||
break;
|
||||
default:
|
||||
ogs_fatal("Unknown Packet Filter Type(%d)",
|
||||
target.pf[j].component[j].type);
|
||||
target.pf[j].content.component[k].type);
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
ogs_assert(length + sizeof(target.precedence) <=
|
||||
@@ -417,6 +507,11 @@ void ogs_nas_build_qos_rules(ogs_nas_qos_rules_t *rules,
|
||||
OGS_NAS_MAX_QOS_RULES_LEN);
|
||||
memcpy(buffer + length, &target.flow.flags, sizeof(target.precedence));
|
||||
length += sizeof(target.flow.flags);
|
||||
|
||||
/* Update QoS Rule Length */
|
||||
target.length = htobe16(
|
||||
buffer+length - rule_length - sizeof(target.length));
|
||||
memcpy(rule_length, &target.length, sizeof(target.length));
|
||||
}
|
||||
|
||||
rules->buffer = buffer;
|
||||
|
||||
@@ -707,10 +707,14 @@ typedef struct ogs_nas_qos_flow_parameter_s {
|
||||
#define OGS_NAX_QOS_FLOW_PARAMETER_ID_EPS_BEARER_IDENTITY 7
|
||||
uint8_t identifier;
|
||||
uint8_t len;
|
||||
#define OGS_NAS_MAX_QOS_FLOW_PARAEMTER_LEN 255
|
||||
uint8_t content[OGS_NAS_MAX_QOS_FLOW_PARAEMTER_LEN];
|
||||
union {
|
||||
uint8_t qci;
|
||||
ogs_nas_bitrate_t br;
|
||||
};
|
||||
} ogs_nas_qos_flow_parameter_t;
|
||||
|
||||
#define OGS_NAS_MAX_NUM_OF_QOS_FLOW_DESCRIPTION 8
|
||||
#define OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER 8
|
||||
typedef struct ogs_nas_qos_flow_description_s {
|
||||
ED2(uint8_t spare1:2;,
|
||||
uint8_t identifier:6;)
|
||||
@@ -734,18 +738,23 @@ ED3(uint8_t spare3:1;,
|
||||
* 0 extension of previously provided parameters
|
||||
* 1 replacement of all previously provided parameters
|
||||
*/
|
||||
uint8_t E:1;,
|
||||
uint8_t E_bit:1;,
|
||||
uint8_t num_of_parameter:6;)
|
||||
|
||||
#define OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER 8
|
||||
ogs_nas_qos_flow_parameter_t param[OGS_NAS_MAX_NUM_OF_QOS_FLOW_PARAMETER];
|
||||
} ogs_nas_qos_flow_description_t;
|
||||
|
||||
#define OGS_NAS_MAX_QOS_FLOW_DESCRIPTIONS_LEN 65535
|
||||
typedef struct ogs_nas_qos_flow_descriptions_s {
|
||||
uint16_t length;
|
||||
void *buffer;
|
||||
} ogs_nas_qos_flow_descriptions_t;
|
||||
|
||||
void ogs_nas_build_qos_flow_descriptions(
|
||||
ogs_nas_qos_flow_descriptions_t *flow_descriptions,
|
||||
ogs_nas_qos_flow_description_t *flow_description,
|
||||
int num_of_flow_description);
|
||||
|
||||
/* 9.11.4.13 QoS rules
|
||||
* M LV-E 6-65535 */
|
||||
#define OGS_NAS_MAX_NUM_OF_QOS_RULE 8
|
||||
@@ -775,49 +784,11 @@ typedef struct ogs_nas_qos_rule_s {
|
||||
#define OGS_NAS_QOS_DIRECTION_UPLINK 2
|
||||
#define OGS_NAS_QOS_DIRECTION_BIDIRECTIONAL 3
|
||||
uint8_t direction:2;,
|
||||
uint8_t pf_identifier:4;)
|
||||
uint8_t identifier:4;)
|
||||
};
|
||||
uint8_t flags;
|
||||
};
|
||||
uint8_t length;
|
||||
#define OGS_PACKET_FILTER_MATCH_ALL 1
|
||||
#define OGS_PACKET_FILTER_PROTOCOL_IDENTIFIER_NEXT_HEADER_TYPE 48
|
||||
#define OGS_PACKET_FILTER_IPV4_REMOTE_ADDRESS_TYPE 16
|
||||
#define OGS_PACKET_FILTER_IPV4_LOCAL_ADDRESS_TYPE 17
|
||||
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_TYPE 32
|
||||
#define OGS_PACKET_FILTER_IPV6_REMOTE_ADDRESS_PREFIX_LENGTH_TYPE 33
|
||||
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_TYPE 34
|
||||
#define OGS_PACKET_FILTER_IPV6_LOCAL_ADDRESS_PREFIX_LENGTH_TYPE 35
|
||||
#define OGS_PACKET_FILTER_SINGLE_LOCAL_PORT_TYPE 64
|
||||
#define OGS_PACKET_FILTER_LOCAL_PORT_RANGE_TYPE 65
|
||||
#define OGS_PACKET_FILTER_SINGLE_REMOTE_PORT_TYPE 80
|
||||
#define OGS_PACKET_FILTER_REMOTE_PORT_RANGE_TYPE 81
|
||||
#define OGS_PACKET_FILTER_SECURITY_PARAMETER_INDEX_TYPE 96
|
||||
#define OGS_PACKET_FILTER_TOS_TRAFFIC_CLASS_TYPE 112
|
||||
#define OGS_PACKET_FILTER_FLOW_LABEL_TYPE 128
|
||||
struct {
|
||||
uint8_t type;
|
||||
union {
|
||||
uint8_t proto;
|
||||
struct {
|
||||
uint32_t addr;
|
||||
uint32_t mask;
|
||||
} ipv4;
|
||||
struct {
|
||||
uint32_t addr[4];
|
||||
uint8_t prefixlen;
|
||||
} ipv6;
|
||||
struct {
|
||||
uint32_t addr[4];
|
||||
uint32_t mask[4];
|
||||
} ipv6_mask;
|
||||
struct {
|
||||
uint16_t low;
|
||||
uint16_t high;
|
||||
} port;
|
||||
};
|
||||
} component[OGS_NAS_MAX_NUM_OF_PACKET_FILTER_COMPONENT];
|
||||
uint8_t num_of_component;
|
||||
ogs_pf_content_t content;
|
||||
} pf[OGS_MAX_NUM_OF_PACKET_FILTER];
|
||||
|
||||
uint8_t precedence;
|
||||
|
||||
@@ -346,12 +346,27 @@ ED2(uint8_t type_of_ciphering_algorithm:4;,
|
||||
uint8_t type_of_integrity_protection_algorithm:4;)
|
||||
} __attribute__ ((packed)) ogs_nas_security_algorithms_t;
|
||||
|
||||
/* 9.9.3.27 Service type
|
||||
* M V 1/2
|
||||
* 9.9.3.21 NAS key set identifier
|
||||
/* 9.9.3.21 NAS key set identifier
|
||||
* M V 1/2
|
||||
*
|
||||
* 9.9.3.27 Service type
|
||||
* M V 1/2
|
||||
* In lib/nas/eps/types.h
|
||||
* #define OGS_NAS_SERVICE_TYPE_CS_FALLBACK_FROM_UE 0
|
||||
* #define OGS_NAS_SERVICE_TYPE_CS_FALLBACK_TO_UE 1
|
||||
* #define OGS_NAS_SERVICE_TYPE_CS_FALLBACK_EMERGENCY_CALL_FROM_UE 2
|
||||
*
|
||||
* 9.11.3.50 Service type
|
||||
* M V 1/2 */
|
||||
* M V 1/2
|
||||
* In lib/nas/5gs/types.h
|
||||
* #define OGS_NAS_SERVICE_TYPE_SIGNALLING 0
|
||||
* #define OGS_NAS_SERVICE_TYPE_DATA 1
|
||||
* #define OGS_NAS_SERVICE_TYPE_MOBILE_TERMINATED_SERVICES 2
|
||||
* #define OGS_NAS_SERVICE_TYPE_EMERGENCY_SERVICES 3
|
||||
* #define OGS_NAS_SERVICE_TYPE_EMERGENCY_SERVICES_FALLBACK 4
|
||||
* #define OGS_NAS_SERVICE_TYPE_HIGH_PRIORITY_ACCESS 5
|
||||
* #define OGS_NAS_SERVICE_TYPE_ELEVATED_SIGNALLING 6
|
||||
*/
|
||||
typedef struct ogs_nas_service_type_s {
|
||||
ED3(uint8_t tsc:1;,
|
||||
uint8_t nas_key_set_identifier:3;,
|
||||
@@ -405,9 +420,20 @@ typedef struct ogs_nas_time_zone_and_time_s {
|
||||
#define OGS_TAI2_TYPE 2
|
||||
|
||||
/* 9.9.3.34 UE network capability
|
||||
* M LV 3-14
|
||||
* M LV 3-14 in Attach request
|
||||
* O TLV 4-15 in TAU request
|
||||
* 9.11.3.48 S1 UE network capability
|
||||
* O TLV 4-15 */
|
||||
* O TLV 4-15 in Registration request
|
||||
*
|
||||
* NOTE 1: For a UE supporting dual connectivity with NR, if the UE supports
|
||||
* one of the encryption algorithms for E-UTRAN (bits 8 to 5 of octet 3),
|
||||
* it shall support the same algorithm for NR-PDCP as specified
|
||||
* in 3GPP TS 33.401 [19]. The NR-PDCP is specified in 3GPP TS 38.323 [53].
|
||||
* NOTE 2: For a UE supporting dual connectivity with NR, if the UE supports
|
||||
* one of the integrity algorithms for E-UTRAN (bits 8 to 5 of octet 4),
|
||||
* it shall support the same algorithm for NR-PDCP as specified
|
||||
* in 3GPP TS 33.401 [19].
|
||||
*/
|
||||
typedef struct ogs_nas_ue_network_capability_s {
|
||||
uint8_t length;
|
||||
union {
|
||||
@@ -489,9 +515,29 @@ ED8(uint8_t signalling_for_a_maximum_number_of_15_eps_bearer_contexts:1;,
|
||||
} __attribute__ ((packed)) ogs_nas_ue_network_capability_t;
|
||||
|
||||
/* 9.9.3.36 UE security capability
|
||||
* M LV 3-6
|
||||
* 9.11.3.48A UE security capability
|
||||
* O TLV 4-10 */
|
||||
* M LV 3-6 in Security mode command
|
||||
* 9.11.3.48A S1 UE security capability
|
||||
* O TLV 4-7 in Security mode command
|
||||
* 9.11.3.54 UE security capability
|
||||
* M LV 3-9 in Security mode command
|
||||
* O TLV 4-10 in Registration request
|
||||
*
|
||||
* NOTE 1: The code points in octet 3 are used to indicate support
|
||||
* for 5GS encryption algorithms for NAS security in N1 mode and
|
||||
* support for 5GS encryption algorithms for AS security over NR.
|
||||
* NOTE 2: The code points in octet 4 are used to indicate support
|
||||
* for 5GS integrity algorithms for NAS security in N1 mode and support
|
||||
* for 5GS integrity algorithms for AS security over NR.
|
||||
* NOTE 3: The code points in octet 5 are used to indicate support
|
||||
* for EPS encryption algorithms for AS security over E-UTRA connected
|
||||
* to 5GCN.
|
||||
* NOTE 4: The code points in octet 6 are used to indicate support
|
||||
* for EPS integrity algorithms for AS security over E-UTRA connected
|
||||
* to 5GCN.
|
||||
* NOTE 5: The AMF can receive this information element also
|
||||
* from another AMF or MME during N1 mode to N1 mode or
|
||||
* S1 mode to N1 mode handover preparation.
|
||||
*/
|
||||
typedef struct ogs_nas_ue_security_capability_s {
|
||||
uint8_t length;
|
||||
union {
|
||||
@@ -508,16 +554,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||
uint8_t eea;
|
||||
|
||||
struct {
|
||||
ED8(uint8_t nea0:1;,
|
||||
uint8_t nea1:1;,
|
||||
uint8_t nea2:1;,
|
||||
uint8_t nea3:1;,
|
||||
uint8_t nea4:1;,
|
||||
uint8_t nea5:1;,
|
||||
uint8_t nea6:1;,
|
||||
uint8_t nea7:1;)
|
||||
ED8(uint8_t nr_ea0:1;,
|
||||
uint8_t nr_ea1:1;,
|
||||
uint8_t nr_ea2:1;,
|
||||
uint8_t nr_ea3:1;,
|
||||
uint8_t nr_ea4:1;,
|
||||
uint8_t nr_ea5:1;,
|
||||
uint8_t nr_ea6:1;,
|
||||
uint8_t nr_ea7:1;)
|
||||
};
|
||||
uint8_t nea;
|
||||
uint8_t nr_ea;
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
@@ -533,16 +579,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||
uint8_t eia;
|
||||
|
||||
struct {
|
||||
ED8(uint8_t nia0:1;,
|
||||
uint8_t nia1:1;,
|
||||
uint8_t nia2:1;,
|
||||
uint8_t nia3:1;,
|
||||
uint8_t nia4:1;,
|
||||
uint8_t nia5:1;,
|
||||
uint8_t nia6:1;,
|
||||
uint8_t nia7:1;)
|
||||
ED8(uint8_t nr_ia0:1;,
|
||||
uint8_t nr_ia1:1;,
|
||||
uint8_t nr_ia2:1;,
|
||||
uint8_t nr_ia3:1;,
|
||||
uint8_t nr_ia4:1;,
|
||||
uint8_t nr_ia5:1;,
|
||||
uint8_t nr_ia6:1;,
|
||||
uint8_t nr_ia7:1;)
|
||||
};
|
||||
uint8_t nia;
|
||||
uint8_t nr_ia;
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
@@ -558,16 +604,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||
uint8_t uea;
|
||||
|
||||
struct {
|
||||
ED8(uint8_t eps_ea0:1;,
|
||||
uint8_t eps_ea1:1;,
|
||||
uint8_t eps_ea2:1;,
|
||||
uint8_t eps_ea3:1;,
|
||||
uint8_t eps_ea4:1;,
|
||||
uint8_t eps_ea5:1;,
|
||||
uint8_t eps_ea6:1;,
|
||||
uint8_t eps_ea7:1;)
|
||||
ED8(uint8_t eutra_ea0:1;,
|
||||
uint8_t eutra_ea1:1;,
|
||||
uint8_t eutra_ea2:1;,
|
||||
uint8_t eutra_ea3:1;,
|
||||
uint8_t eutra_ea4:1;,
|
||||
uint8_t eutra_ea5:1;,
|
||||
uint8_t eutra_ea6:1;,
|
||||
uint8_t eutra_ea7:1;)
|
||||
};
|
||||
uint8_t eps_ea;
|
||||
uint8_t eutra_ea;
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
@@ -583,16 +629,16 @@ typedef struct ogs_nas_ue_security_capability_s {
|
||||
uint8_t uia;
|
||||
|
||||
struct {
|
||||
ED8(uint8_t eps_ia0:1;,
|
||||
uint8_t eps_ia1:1;,
|
||||
uint8_t eps_ia2:1;,
|
||||
uint8_t eps_ia3:1;,
|
||||
uint8_t eps_ia4:1;,
|
||||
uint8_t eps_ia5:1;,
|
||||
uint8_t eps_ia6:1;,
|
||||
uint8_t eps_ia7:1;)
|
||||
ED8(uint8_t eutra_ia0:1;,
|
||||
uint8_t eutra_ia1:1;,
|
||||
uint8_t eutra_ia2:1;,
|
||||
uint8_t eutra_ia3:1;,
|
||||
uint8_t eutra_ia4:1;,
|
||||
uint8_t eutra_ia5:1;,
|
||||
uint8_t eutra_ia6:1;,
|
||||
uint8_t eutra_ia7:1;)
|
||||
};
|
||||
uint8_t eps_ia;
|
||||
uint8_t eutra_ia;
|
||||
};
|
||||
union {
|
||||
struct {
|
||||
@@ -782,9 +828,10 @@ ED2(uint8_t reserved:5;,
|
||||
#define OGS_NAS_EPS_PDN_TYPE_NON_IP 5
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_INITIAL 1
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_EXISTING_PDU_SESSION 2
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_INITIAL_EMERGENCY 3
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_EXISTING_PDU_SESSION_EMERGENCY 4
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_MODIFICATION 5
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_INITIAL_EMERGENCY_REQUEST 3
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_EXISTING_EMERGENCY_PDU_SESSION 4
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_MODIFICATION_REQUEST 5
|
||||
#define OGS_NAS_5GS_REQUEST_TYPE_MA_PDU_REQUEST 6
|
||||
typedef struct ogs_nas_request_type_s {
|
||||
ED3(uint8_t type:4;,
|
||||
uint8_t spare:1;,
|
||||
|
||||
@@ -509,7 +509,7 @@ void ogs_pfcp_build_update_far_activate(
|
||||
message->far_id.presence = 1;
|
||||
message->far_id.u32 = far->id;
|
||||
|
||||
ogs_assert(far->apply_action == OGS_PFCP_APPLY_ACTION_FORW);
|
||||
ogs_assert(far->apply_action & OGS_PFCP_APPLY_ACTION_FORW);
|
||||
|
||||
message->apply_action.presence = 1;
|
||||
message->apply_action.u8 = far->apply_action;
|
||||
|
||||
@@ -544,7 +544,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
|
||||
v = ogs_yaml_iter_value(&e_cell_id_iter);
|
||||
if (v) {
|
||||
e_cell_id[num_of_e_cell_id]
|
||||
= ogs_uint28_from_string((char*)v);
|
||||
= ogs_uint64_from_string((char*)v);
|
||||
num_of_e_cell_id++;
|
||||
}
|
||||
} while (
|
||||
@@ -572,7 +572,7 @@ int ogs_pfcp_context_parse_config(const char *local, const char *remote)
|
||||
v = ogs_yaml_iter_value(&nr_cell_id_iter);
|
||||
if (v) {
|
||||
nr_cell_id[num_of_nr_cell_id]
|
||||
= ogs_uint36_from_string((char*)v);
|
||||
= ogs_uint64_from_string((char*)v);
|
||||
num_of_nr_cell_id++;
|
||||
}
|
||||
} while (
|
||||
|
||||
@@ -421,12 +421,6 @@ ogs_pfcp_pdr_t *ogs_pfcp_handle_create_pdr(ogs_pfcp_sess_t *sess,
|
||||
ogs_pfcp_pdr_associate_qer(pdr, qer);
|
||||
}
|
||||
|
||||
if (message->qer_id.presence) {
|
||||
qer = ogs_pfcp_qer_find_or_add(sess, message->qer_id.u32);
|
||||
ogs_assert(qer);
|
||||
ogs_pfcp_pdr_associate_qer(pdr, qer);
|
||||
}
|
||||
|
||||
return pdr;
|
||||
}
|
||||
|
||||
|
||||
@@ -486,6 +486,7 @@ ED5(uint8_t spare1:4;,
|
||||
uint8_t ipv6:1;,
|
||||
uint8_t ipv4:1;)
|
||||
union {
|
||||
#define OGS_PFCP_DEFAULT_CHOOSE_ID 5
|
||||
struct {
|
||||
ED4(uint8_t choose_id;,
|
||||
uint8_t spare2;,
|
||||
|
||||
@@ -80,6 +80,7 @@ typedef struct ogs_pfcp_xact_s {
|
||||
#define OGS_PFCP_MODIFY_DEACTIVATE ((uint64_t)1<<9)
|
||||
#define OGS_PFCP_MODIFY_END_MARKER ((uint64_t)1<<10)
|
||||
#define OGS_PFCP_MODIFY_ERROR_INDICATION ((uint64_t)1<<11)
|
||||
#define OGS_PFCP_MODIFY_PATH_SWITCH ((uint64_t)1<<12)
|
||||
uint64_t modify_flags;
|
||||
|
||||
#define OGS_PFCP_DELETE_TRIGGER_UE_REQUESTED 1
|
||||
|
||||
@@ -305,6 +305,9 @@ static connection_t *connection_add(
|
||||
#else
|
||||
curl_easy_setopt(conn->easy, CURLOPT_EXPECT_100_TIMEOUT_MS, 0L);
|
||||
#endif
|
||||
ogs_debug("SENDING...[%d]", (int)request->http.content_length);
|
||||
if (request->http.content_length)
|
||||
ogs_debug("%s", request->http.content);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -439,9 +442,16 @@ static void check_multi_info(ogs_sbi_client_t *client)
|
||||
/* remove https://localhost:8000 */
|
||||
response->h.uri = ogs_strdup(url);
|
||||
|
||||
ogs_debug("[%d:%s] %s",
|
||||
response->status, response->h.method, response->h.uri);
|
||||
|
||||
response->http.content = ogs_memdup(conn->memory, conn->size);
|
||||
response->http.content_length = conn->size;
|
||||
|
||||
ogs_debug("RECEIVED[%d]", (int)response->http.content_length);
|
||||
if (response->http.content_length && response->http.content)
|
||||
ogs_debug("%s", response->http.content);
|
||||
|
||||
if (content_type)
|
||||
ogs_sbi_header_set(response->http.headers,
|
||||
OGS_SBI_CONTENT_TYPE, content_type);
|
||||
|
||||
@@ -516,6 +516,9 @@ void ogs_sbi_nf_instance_remove(ogs_sbi_nf_instance_t *nf_instance)
|
||||
if (nf_instance->client)
|
||||
ogs_sbi_client_remove(nf_instance->client);
|
||||
|
||||
if (nf_instance->nf_profile)
|
||||
OpenAPI_nf_profile_free(nf_instance->nf_profile);
|
||||
|
||||
ogs_pool_free(&nf_instance_pool, nf_instance);
|
||||
}
|
||||
|
||||
@@ -993,9 +996,10 @@ void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object)
|
||||
}
|
||||
}
|
||||
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
|
||||
ogs_sbi_object_t *sbi_object, void *data,
|
||||
ogs_sbi_build_f build, void (*timer_cb)(void *data))
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_add(
|
||||
OpenAPI_nf_type_e target_nf_type, ogs_sbi_object_t *sbi_object,
|
||||
ogs_sbi_build_f build, void *context, void *data,
|
||||
void (*timer_cb)(void *data))
|
||||
{
|
||||
ogs_sbi_xact_t *xact = NULL;
|
||||
|
||||
@@ -1008,7 +1012,7 @@ ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
|
||||
xact->target_nf_type = target_nf_type;
|
||||
xact->sbi_object = sbi_object;
|
||||
|
||||
xact->request = (*build)(sbi_object, data);
|
||||
xact->request = (*build)(context, data);
|
||||
ogs_assert(xact->request);
|
||||
|
||||
xact->t_response = ogs_timer_add(
|
||||
@@ -1089,8 +1093,8 @@ void ogs_sbi_subscription_remove(ogs_sbi_subscription_t *subscription)
|
||||
if (subscription->notification_uri)
|
||||
ogs_free(subscription->notification_uri);
|
||||
|
||||
if (subscription->nf_instance_id)
|
||||
ogs_free(subscription->nf_instance_id);
|
||||
if (subscription->req_nf_instance_id)
|
||||
ogs_free(subscription->req_nf_instance_id);
|
||||
|
||||
if (subscription->t_validity)
|
||||
ogs_timer_delete(subscription->t_validity);
|
||||
@@ -1109,8 +1113,8 @@ void ogs_sbi_subscription_remove_all_by_nf_instance_id(char *nf_instance_id)
|
||||
|
||||
ogs_list_for_each_safe(&ogs_sbi_self()->subscription_list,
|
||||
next_subscription, subscription) {
|
||||
if (subscription->nf_instance_id &&
|
||||
strcmp(subscription->nf_instance_id, nf_instance_id) == 0) {
|
||||
if (subscription->req_nf_instance_id &&
|
||||
strcmp(subscription->req_nf_instance_id, nf_instance_id) == 0) {
|
||||
ogs_sbi_subscription_remove(subscription);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -94,6 +94,8 @@ typedef struct ogs_sbi_nf_instance_s {
|
||||
|
||||
void *client; /* only used in CLIENT */
|
||||
unsigned int reference_count; /* reference count for memory free */
|
||||
|
||||
OpenAPI_nf_profile_t *nf_profile; /* stored NF Profile */
|
||||
} ogs_sbi_nf_instance_t;
|
||||
|
||||
#define OGS_SBI_NF_INSTANCE_GET(__aRRAY, __nFType) \
|
||||
@@ -123,7 +125,7 @@ typedef struct ogs_sbi_object_s {
|
||||
} ogs_sbi_object_t;
|
||||
|
||||
typedef ogs_sbi_request_t *(*ogs_sbi_build_f)(
|
||||
ogs_sbi_object_t *sbi_object, void *data);
|
||||
void *context, void *data);
|
||||
|
||||
typedef struct ogs_sbi_xact_s {
|
||||
ogs_lnode_t lnode;
|
||||
@@ -179,11 +181,15 @@ typedef struct ogs_sbi_subscription_s {
|
||||
ogs_timer_t *t_validity; /* check validation */
|
||||
|
||||
char *id; /* SubscriptionId */
|
||||
char *nf_instance_id; /* NFInstanceId */
|
||||
OpenAPI_nf_type_e nf_type;
|
||||
char *req_nf_instance_id; /* reqNfInstanceId */
|
||||
OpenAPI_nf_type_e req_nf_type; /* reqNfType */
|
||||
OpenAPI_nf_status_e nf_status;
|
||||
char *notification_uri;
|
||||
|
||||
struct {
|
||||
OpenAPI_nf_type_e nf_type; /* nfType */
|
||||
} subscr_cond;
|
||||
|
||||
void *client; /* only used in SERVER */
|
||||
} ogs_sbi_subscription_t;
|
||||
|
||||
@@ -224,9 +230,10 @@ bool ogs_sbi_nf_instance_associate(ogs_sbi_nf_type_array_t nf_type_array,
|
||||
|
||||
void ogs_sbi_object_free(ogs_sbi_object_t *sbi_object);
|
||||
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_add(OpenAPI_nf_type_e target_nf_type,
|
||||
ogs_sbi_object_t *sbi_object, void *data,
|
||||
ogs_sbi_build_f build, void (*timer_cb)(void *data));
|
||||
ogs_sbi_xact_t *ogs_sbi_xact_add(
|
||||
OpenAPI_nf_type_e target_nf_type, ogs_sbi_object_t *sbi_object,
|
||||
ogs_sbi_build_f build, void *context, void *data,
|
||||
void (*timer_cb)(void *data));
|
||||
void ogs_sbi_xact_remove(ogs_sbi_xact_t *xact);
|
||||
void ogs_sbi_xact_remove_all(ogs_sbi_object_t *sbi_object);
|
||||
|
||||
|
||||
@@ -233,19 +233,48 @@ uint64_t ogs_sbi_bitrate_from_string(char *str)
|
||||
|
||||
#define MAX_TIMESTR_LEN 128
|
||||
|
||||
int ogs_strftimezone(char *str, size_t size, int tm_gmtoff)
|
||||
{
|
||||
uint8_t off_sign;
|
||||
int off;
|
||||
|
||||
ogs_assert(str);
|
||||
ogs_assert(size);
|
||||
|
||||
off_sign = '+';
|
||||
off = tm_gmtoff;
|
||||
if (tm_gmtoff < 0) {
|
||||
off_sign = '-';
|
||||
off = -off;
|
||||
}
|
||||
|
||||
return ogs_snprintf(str, size, "%c%02d:%02d",
|
||||
off_sign, off / 3600, off % 3600);
|
||||
}
|
||||
|
||||
#define USE_MILLISECONDS_IN_RFC3339 0
|
||||
|
||||
char *ogs_sbi_localtime_string(ogs_time_t timestamp)
|
||||
{
|
||||
struct tm tm;
|
||||
|
||||
char datetime[MAX_TIMESTR_LEN];
|
||||
char timezone[MAX_TIMESTR_LEN];
|
||||
int len;
|
||||
|
||||
ogs_localtime(ogs_time_sec(timestamp), &tm);
|
||||
ogs_strftime(datetime, sizeof datetime, "%Y-%m-%dT%H:%M:%S", &tm);
|
||||
ogs_strftime(timezone, sizeof timezone, "%z", &tm);
|
||||
|
||||
len = ogs_strftimezone(timezone, MAX_TIMESTR_LEN, tm.tm_gmtoff);
|
||||
ogs_assert(len == 6);
|
||||
|
||||
#if USE_MILLISECONDS_IN_RFC3339
|
||||
return ogs_msprintf("%s.%03lld%s",
|
||||
datetime, (long long)ogs_time_msec(timestamp), timezone);
|
||||
#else
|
||||
return ogs_msprintf("%s.%06lld%s",
|
||||
datetime, (long long)ogs_time_usec(timestamp), timezone);
|
||||
#endif
|
||||
}
|
||||
|
||||
char *ogs_sbi_gmtime_string(ogs_time_t timestamp)
|
||||
@@ -257,19 +286,22 @@ char *ogs_sbi_gmtime_string(ogs_time_t timestamp)
|
||||
ogs_gmtime(ogs_time_sec(timestamp), &tm);
|
||||
ogs_strftime(datetime, sizeof datetime, "%Y-%m-%dT%H:%M:%S", &tm);
|
||||
|
||||
#if USE_MILLISECONDS_IN_RFC3339
|
||||
return ogs_msprintf("%s.%03lldZ",
|
||||
datetime, (long long)ogs_time_msec(timestamp));
|
||||
#else
|
||||
return ogs_msprintf("%s.%06lldZ",
|
||||
datetime, (long long)ogs_time_usec(timestamp));
|
||||
#endif
|
||||
}
|
||||
|
||||
char *ogs_sbi_timezone_string(int tm_gmtoff)
|
||||
{
|
||||
struct tm tm;
|
||||
|
||||
char timezone[MAX_TIMESTR_LEN];
|
||||
int len;
|
||||
|
||||
ogs_localtime(ogs_time_now(), &tm);
|
||||
tm.tm_gmtoff = tm_gmtoff;
|
||||
ogs_strftime(timezone, sizeof timezone, "%z", &tm);
|
||||
len = ogs_strftimezone(timezone, MAX_TIMESTR_LEN, tm_gmtoff);
|
||||
ogs_assert(len == 6);
|
||||
|
||||
return ogs_msprintf("%s", timezone);
|
||||
}
|
||||
@@ -297,15 +329,27 @@ bool ogs_sbi_time_from_string(ogs_time_t *timestamp, char *str)
|
||||
else if (is_seconds == false && (str[i] < '0' || str[i] > '9'))
|
||||
is_seconds = true;
|
||||
|
||||
if (is_seconds == true) seconds[j++] = str[i];
|
||||
else subsecs[k++] = str[i];
|
||||
if (is_seconds == true) {
|
||||
if (str[i] == ':' && i >= 3 &&
|
||||
(str[i-3] == '+' || str[i-3] == '-')) {
|
||||
/* skip timezone ':' character */
|
||||
} else {
|
||||
seconds[j++] = str[i];
|
||||
}
|
||||
} else {
|
||||
subsecs[k++] = str[i];
|
||||
}
|
||||
|
||||
i++;
|
||||
}
|
||||
|
||||
memset(&tm, 0, sizeof(tm));
|
||||
ogs_strptime(seconds, "%Y-%m-%dT%H:%M:%S%z", &tm);
|
||||
usecs = (ogs_time_t)(atof(subsecs) * 1000000);
|
||||
#if USE_MATH
|
||||
usecs = (ogs_time_t)floor(atof(subsecs) * 1000000.0 + 0.5);
|
||||
#else
|
||||
usecs = (ogs_time_t)((atof(subsecs) * 10000000 + 5) / 10);
|
||||
#endif
|
||||
|
||||
rv = ogs_time_from_gmt(timestamp, &tm, usecs);
|
||||
if (rv != OGS_OK) {
|
||||
@@ -506,12 +550,12 @@ OpenAPI_nr_location_t *ogs_sbi_build_nr_location(
|
||||
Tai = ogs_calloc(1, sizeof(*Tai));
|
||||
ogs_assert(Tai);
|
||||
Tai->plmn_id = ogs_sbi_build_plmn_id(&tai->plmn_id);
|
||||
Tai->tac = ogs_uint24_to_string(tai->tac);
|
||||
Tai->tac = ogs_uint24_to_0string(tai->tac);
|
||||
|
||||
Ncgi = ogs_calloc(1, sizeof(*Ncgi));
|
||||
ogs_assert(Ncgi);
|
||||
Ncgi->plmn_id = ogs_sbi_build_plmn_id(&nr_cgi->plmn_id);
|
||||
Ncgi->nr_cell_id = ogs_uint36_to_string(nr_cgi->cell_id);
|
||||
Ncgi->nr_cell_id = ogs_uint36_to_0string(nr_cgi->cell_id);
|
||||
|
||||
NrLocation = ogs_calloc(1, sizeof(*NrLocation));
|
||||
ogs_assert(NrLocation);
|
||||
@@ -544,7 +588,7 @@ bool ogs_sbi_parse_nr_location(ogs_5gs_tai_t *tai, ogs_nr_cgi_t *nr_cgi,
|
||||
if (Ncgi->plmn_id)
|
||||
ogs_sbi_parse_plmn_id(&nr_cgi->plmn_id, Ncgi->plmn_id);
|
||||
if (Ncgi->nr_cell_id)
|
||||
nr_cgi->cell_id = ogs_uint36_from_string(Ncgi->nr_cell_id);
|
||||
nr_cgi->cell_id = ogs_uint64_from_string(Ncgi->nr_cell_id);
|
||||
|
||||
}
|
||||
|
||||
|
||||
@@ -46,6 +46,7 @@ ogs_sockaddr_t *ogs_sbi_getaddr_from_uri(char *uri);
|
||||
char *ogs_sbi_bitrate_to_string(uint64_t bitrate, int unit);
|
||||
uint64_t ogs_sbi_bitrate_from_string(char *str);
|
||||
|
||||
int ogs_strftimezone(char *str, size_t size, int tm_gmtoff);
|
||||
char *ogs_sbi_localtime_string(ogs_time_t time);
|
||||
char *ogs_sbi_gmtime_string(ogs_time_t time);
|
||||
char *ogs_sbi_timezone_string(int tm_offset);
|
||||
|
||||
@@ -133,6 +133,9 @@ void ogs_sbi_message_free(ogs_sbi_message_t *message)
|
||||
if (message->N1N2MessageTransferRspData)
|
||||
OpenAPI_n1_n2_message_transfer_rsp_data_free(
|
||||
message->N1N2MessageTransferRspData);
|
||||
if (message->N1N2MsgTxfrFailureNotification)
|
||||
OpenAPI_n1_n2_msg_txfr_failure_notification_free(
|
||||
message->N1N2MsgTxfrFailureNotification);
|
||||
if (message->SmContextStatusNotification)
|
||||
OpenAPI_sm_context_status_notification_free(
|
||||
message->SmContextStatusNotification);
|
||||
@@ -507,8 +510,7 @@ ogs_pkbuf_t *ogs_sbi_find_part_by_content_id(
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int ogs_sbi_parse_header(
|
||||
ogs_sbi_message_t *message, ogs_sbi_header_t *header)
|
||||
int ogs_sbi_parse_header(ogs_sbi_message_t *message, ogs_sbi_header_t *header)
|
||||
{
|
||||
struct yuarel yuarel;
|
||||
char *saveptr = NULL;
|
||||
@@ -525,8 +527,6 @@ int ogs_sbi_parse_header(
|
||||
message->h.method = header->method;
|
||||
message->h.uri = header->uri;
|
||||
ogs_assert(message->h.uri);
|
||||
ogs_debug("[%s] %s", message->h.method ? message->h.method : "Notify",
|
||||
message->h.uri);
|
||||
|
||||
uri = ogs_strdup(header->uri);
|
||||
ogs_assert(uri);
|
||||
@@ -715,6 +715,10 @@ static char *build_json(ogs_sbi_message_t *message)
|
||||
item = OpenAPI_n1_n2_message_transfer_rsp_data_convertToJSON(
|
||||
message->N1N2MessageTransferRspData);
|
||||
ogs_assert(item);
|
||||
} else if (message->N1N2MsgTxfrFailureNotification) {
|
||||
item = OpenAPI_n1_n2_msg_txfr_failure_notification_convertToJSON(
|
||||
message->N1N2MsgTxfrFailureNotification);
|
||||
ogs_assert(item);
|
||||
} else if (message->SmContextStatusNotification) {
|
||||
item = OpenAPI_sm_context_status_notification_convertToJSON(
|
||||
message->SmContextStatusNotification);
|
||||
@@ -1384,6 +1388,25 @@ static int parse_json(ogs_sbi_message_t *message,
|
||||
END
|
||||
break;
|
||||
|
||||
CASE(OGS_SBI_SERVICE_NAME_NSMF_CALLBACK)
|
||||
SWITCH(message->h.resource.component[0])
|
||||
CASE(OGS_SBI_RESOURCE_NAME_N1_N2_FAILURE_NOTIFY)
|
||||
message->N1N2MsgTxfrFailureNotification =
|
||||
OpenAPI_n1_n2_msg_txfr_failure_notification_parseFromJSON(
|
||||
item);
|
||||
if (!message->N1N2MsgTxfrFailureNotification) {
|
||||
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;
|
||||
|
||||
DEFAULT
|
||||
rv = OGS_ERROR;
|
||||
ogs_error("Not implemented API name [%s]",
|
||||
|
||||
@@ -125,6 +125,7 @@ extern "C" {
|
||||
|
||||
#define OGS_SBI_SERVICE_NAME_NSMF_CALLBACK "nsmf-callback"
|
||||
#define OGS_SBI_RESOURCE_NAME_SM_POLICY_NOTIFY "sm-policy-notify"
|
||||
#define OGS_SBI_RESOURCE_NAME_N1_N2_FAILURE_NOTIFY "n1-n2-failure-notify"
|
||||
|
||||
#define OGS_SBI_SERVICE_NAME_NAMF_COMM "namf-comm"
|
||||
#define OGS_SBI_RESOURCE_NAME_UE_CONTEXTS "ue-contexts"
|
||||
@@ -140,6 +141,57 @@ extern "C" {
|
||||
#define OGS_SBI_SERVICE_NAME_NPCF_SMPOLICYCONTROL "npcf-smpolicycontrol"
|
||||
#define OGS_SBI_RESOURCE_NAME_SM_POLICIES "sm-policies"
|
||||
|
||||
#define OGS_SBI_FEATURES_IS_SET(__fEATURES, __n) \
|
||||
(__fEATURES & (1 << ((__n)-1)))
|
||||
#define OGS_SBI_FEATURES_SET(__fEATURES, __n) \
|
||||
__fEATURES |= (1 << ((__n)-1))
|
||||
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_SLICE_SUPPORT 1
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_PENDING_TRANSACTION 2
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_UE_AMBR_AUTHORIZATION 3
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_DNN_REPLACEMENT_CONTROL 4
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_MULTIPLE_ACCESS_TYPES 5
|
||||
#define OGS_SBI_NPCF_AM_POLICY_CONTROL_WIRELINE_WIRELESS_CONVERGE 6
|
||||
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_TSC 1
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RES_SHARE 2
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_3GPP_PS_DATA_OFF 3
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ADC 4
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_UMC 5
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_NET_LOC 6
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RAN_NAS_CAUSE 7
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PROV_AF_SIGNAL_FLOW 8
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PCSCF_RESTORATION_ENHANCEMENT 9
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PRA 10
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RULE_VERSIONING 11
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_SPONSORED_CONNECTIVITY 12
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RAN_SUPPORT_INFO 13
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_POLICY_UPDATE_WHEN_UE_SUSPENDS 14
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ACCESS_TYPE_CONDITION 15
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_MULTI_IPV6_ADDR_PREFIX 16
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_SESSION_RULE_ERROR_HANDLING 17
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_AF_CHARGING_IDENTIFIER 18
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ATSSS 19
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PENDING_TRANSACTION 20
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_URLLC 21
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_MAC_ADDRESS_RANGE 22
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_WWC 23
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_QOS_MONITORING 24
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_AUTHORIZATION_WITH_REQUIRED_QOS 25
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ENHANCED_BACKGROUND_DATA_TRANSFER 26
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DN_AUTHORIZATION 27
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_PDU_SESSION_REL_CAUSE 28
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_SAME_PCF 29
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_ADC_MULTI_REDIRECTION 30
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_RESP_BASED_SESSION_REL 31
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_TIME_SENSITIVE_NETWORKING 32
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_EMDBV 33
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DNN_SELECTION_MODE 34
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_EPS_FALLBACK_REPORT 35
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_POLICY_DECISION_ERROR_HANDLING 36
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_DDN_EVENT_POLICY_CONTROL 37
|
||||
#define OGS_SBI_NPCF_SMPOLICYCONTROL_REALLOCATION_OF_CREDIT 38
|
||||
|
||||
#define OGS_SBI_PARAM_NF_TYPE "nf-type"
|
||||
#define OGS_SBI_PARAM_TARGET_NF_TYPE "target-nf-type"
|
||||
#define OGS_SBI_PARAM_REQUESTER_NF_TYPE "requester-nf-type"
|
||||
@@ -270,6 +322,8 @@ typedef struct ogs_sbi_message_s {
|
||||
SessionManagementSubscriptionData;
|
||||
OpenAPI_n1_n2_message_transfer_req_data_t *N1N2MessageTransferReqData;
|
||||
OpenAPI_n1_n2_message_transfer_rsp_data_t *N1N2MessageTransferRspData;
|
||||
OpenAPI_n1_n2_msg_txfr_failure_notification_t
|
||||
*N1N2MsgTxfrFailureNotification;
|
||||
OpenAPI_sm_context_status_notification_t *SmContextStatusNotification;
|
||||
OpenAPI_policy_association_request_t *PolicyAssociationRequest;
|
||||
OpenAPI_policy_association_t *PolicyAssociation;
|
||||
@@ -340,8 +394,7 @@ void *ogs_sbi_header_get(ogs_hash_t *ht, const void *key);
|
||||
ogs_pkbuf_t *ogs_sbi_find_part_by_content_id(
|
||||
ogs_sbi_message_t *message, char *content_id);
|
||||
|
||||
int ogs_sbi_parse_header(
|
||||
ogs_sbi_message_t *message, ogs_sbi_header_t *header);
|
||||
int ogs_sbi_parse_header(ogs_sbi_message_t *message, ogs_sbi_header_t *header);
|
||||
void ogs_sbi_header_free(ogs_sbi_header_t *h);
|
||||
|
||||
#ifdef __cplusplus
|
||||
|
||||
@@ -332,12 +332,17 @@ static void server_send_response(
|
||||
add_header(&nva[i++], ogs_hash_this_key(hi), ogs_hash_this_val(hi));
|
||||
}
|
||||
|
||||
ogs_debug("STATUS [%d]", response->status);
|
||||
|
||||
if (response->http.content && response->http.content_length) {
|
||||
nghttp2_data_provider data_prd;
|
||||
|
||||
data_prd.source.ptr = response;
|
||||
data_prd.read_callback = response_read_callback;
|
||||
|
||||
ogs_debug("SENDING...: %d", (int)response->http.content_length);
|
||||
ogs_debug("%s", response->http.content);
|
||||
|
||||
rv = nghttp2_submit_response(sbi_sess->session,
|
||||
stream->stream_id, nva, nvlen, &data_prd);
|
||||
} else {
|
||||
@@ -749,6 +754,13 @@ static int on_frame_recv(nghttp2_session *session,
|
||||
/* HEADERS or DATA frame with +END_STREAM flag */
|
||||
if (frame->hd.flags & NGHTTP2_FLAG_END_STREAM) {
|
||||
|
||||
ogs_debug("[%s] %s", request->h.method, request->h.uri);
|
||||
|
||||
if (request->http.content_length && request->http.content) {
|
||||
ogs_debug("RECEIVED: %d", (int)request->http.content_length);
|
||||
ogs_debug("%s", request->http.content);
|
||||
}
|
||||
|
||||
if (server->cb(request, stream) != OGS_OK) {
|
||||
ogs_warn("server callback error");
|
||||
ogs_sbi_server_send_error(stream,
|
||||
@@ -786,6 +798,7 @@ static int on_stream_close(nghttp2_session *session, int32_t stream_id,
|
||||
session, NGHTTP2_FLAG_NONE, stream_id, error_code);
|
||||
}
|
||||
|
||||
ogs_debug("STREAM closed [%d]", stream_id);
|
||||
stream_remove(stream);
|
||||
return 0;
|
||||
}
|
||||
@@ -896,6 +909,8 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
||||
ogs_sbi_stream_t *stream = NULL;
|
||||
ogs_sbi_request_t *request = NULL;
|
||||
|
||||
size_t offset = 0;
|
||||
|
||||
ogs_assert(session);
|
||||
|
||||
stream = nghttp2_session_get_stream_user_data(session, stream_id);
|
||||
@@ -909,12 +924,26 @@ static int on_data_chunk_recv(nghttp2_session *session, uint8_t flags,
|
||||
|
||||
ogs_assert(data);
|
||||
ogs_assert(len);
|
||||
ogs_assert(request->http.content == NULL);
|
||||
|
||||
request->http.content_length = len;
|
||||
request->http.content = (char*)ogs_malloc(request->http.content_length + 1);
|
||||
ogs_assert(request->http.content);
|
||||
memcpy(request->http.content, data, len);
|
||||
if (request->http.content == NULL) {
|
||||
request->http.content_length = len;
|
||||
request->http.content =
|
||||
(char*)ogs_malloc(request->http.content_length + 1);
|
||||
ogs_assert(request->http.content);
|
||||
} else {
|
||||
offset = request->http.content_length;
|
||||
if ((request->http.content_length + len) > OGS_HUGE_LEN) {
|
||||
ogs_error("Overflow : Content-Length[%d], len[%d]",
|
||||
(int)request->http.content_length, (int)len);
|
||||
ogs_assert_if_reached();
|
||||
}
|
||||
request->http.content_length += len;
|
||||
request->http.content = (char *)ogs_realloc(
|
||||
request->http.content, request->http.content_length + 1);
|
||||
ogs_assert(request->http.content);
|
||||
}
|
||||
|
||||
memcpy(request->http.content + offset, data, len);
|
||||
request->http.content[request->http.content_length] = '\0';
|
||||
|
||||
return 0;
|
||||
@@ -1030,6 +1059,7 @@ static int on_begin_headers(nghttp2_session *session,
|
||||
|
||||
stream = stream_add(sbi_sess, frame->hd.stream_id);
|
||||
ogs_assert(stream);
|
||||
ogs_debug("STREAM added [%d]", frame->hd.stream_id);
|
||||
|
||||
nghttp2_session_set_stream_user_data(session, frame->hd.stream_id, stream);
|
||||
|
||||
@@ -1204,6 +1234,8 @@ static void session_write_callback(short when, ogs_socket_t fd, void *data)
|
||||
ogs_list_remove(&sbi_sess->write_queue, pkbuf);
|
||||
|
||||
ogs_send(fd, pkbuf->data, pkbuf->len, 0);
|
||||
ogs_log_hexdump(OGS_LOG_DEBUG, pkbuf->data, pkbuf->len);
|
||||
|
||||
ogs_pkbuf_free(pkbuf);
|
||||
}
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "ogs-sbi.h"
|
||||
#include "ogs-app.h"
|
||||
|
||||
OpenAPI_nf_profile_t *ogs_nnrf_nfm_build_nf_profile(
|
||||
ogs_sbi_nf_instance_t *nf_instance)
|
||||
@@ -259,7 +260,9 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_register(
|
||||
NFProfile = ogs_nnrf_nfm_build_nf_profile(nf_instance);
|
||||
ogs_assert(NFProfile);
|
||||
|
||||
NFProfile->heart_beat_timer = nf_instance->time.heartbeat_interval;
|
||||
NFProfile->nf_profile_changes_support_ind = true;
|
||||
nf_instance->time.heartbeat_interval = NFProfile->heart_beat_timer =
|
||||
ogs_app()->time.nf_instance.heartbeat_interval;
|
||||
|
||||
message.NFProfile = NFProfile;
|
||||
|
||||
@@ -341,9 +344,10 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
||||
ogs_sbi_server_t *server = NULL;
|
||||
|
||||
OpenAPI_subscription_data_t *SubscriptionData = NULL;
|
||||
OpenAPI_subscription_data_subscr_cond_t SubscrCond;
|
||||
|
||||
ogs_assert(subscription);
|
||||
ogs_assert(subscription->nf_type);
|
||||
ogs_assert(subscription->req_nf_type);
|
||||
|
||||
memset(&message, 0, sizeof(message));
|
||||
message.h.method = (char *)OGS_SBI_HTTP_METHOD_POST;
|
||||
@@ -367,8 +371,14 @@ ogs_sbi_request_t *ogs_nnrf_nfm_build_status_subscribe(
|
||||
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;
|
||||
SubscriptionData->req_nf_type = subscription->req_nf_type;
|
||||
SubscriptionData->req_nf_instance_id = subscription->req_nf_instance_id;
|
||||
|
||||
memset(&SubscrCond, 0, sizeof(SubscrCond));
|
||||
if (subscription->subscr_cond.nf_type) {
|
||||
SubscrCond.nf_type = subscription->subscr_cond.nf_type;
|
||||
SubscriptionData->subscr_cond = &SubscrCond;
|
||||
}
|
||||
|
||||
message.SubscriptionData = SubscriptionData;
|
||||
|
||||
|
||||
@@ -18,6 +18,7 @@
|
||||
*/
|
||||
|
||||
#include "ogs-sbi.h"
|
||||
#include "ogs-app.h"
|
||||
|
||||
bool ogs_sbi_nnrf_handle_nf_profile(ogs_sbi_nf_instance_t *nf_instance,
|
||||
OpenAPI_nf_profile_t *NFProfile,
|
||||
|
||||
@@ -58,6 +58,7 @@
|
||||
#include "model/session_management_subscription_data.h"
|
||||
#include "model/n1_n2_message_transfer_req_data.h"
|
||||
#include "model/n1_n2_message_transfer_rsp_data.h"
|
||||
#include "model/n1_n2_msg_txfr_failure_notification.h"
|
||||
#include "model/sm_context_status_notification.h"
|
||||
#include "model/policy_association.h"
|
||||
#include "model/am_policy_data.h"
|
||||
|
||||
@@ -726,6 +726,7 @@ libsbi_openapi_sources = files('''
|
||||
model/wireline_area.c
|
||||
model/wireline_service_area_restriction.c
|
||||
|
||||
model/subscription_data_subscr_cond.c
|
||||
'''.split())
|
||||
|
||||
libsbi_openapi_inc = include_directories('.')
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "af_sig_protocol.h"
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
|
||||
)
|
||||
char* OpenAPI_af_sig_protocol_ToString(OpenAPI_af_sig_protocol_e af_sig_protocol)
|
||||
{
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = OpenAPI_malloc(sizeof(OpenAPI_af_sig_protocol_t));
|
||||
if (!af_sig_protocol_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return af_sig_protocol_local_var;
|
||||
const char *af_sig_protocolArray[] = { "NULL", "NO_INFORMATION", "SIP" };
|
||||
size_t sizeofArray = sizeof(af_sig_protocolArray) / sizeof(af_sig_protocolArray[0]);
|
||||
if (af_sig_protocol < sizeofArray)
|
||||
return (char *)af_sig_protocolArray[af_sig_protocol];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol)
|
||||
OpenAPI_af_sig_protocol_e OpenAPI_af_sig_protocol_FromString(char* af_sig_protocol)
|
||||
{
|
||||
if (NULL == af_sig_protocol) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *af_sig_protocolArray[] = { "NULL", "NO_INFORMATION", "SIP" };
|
||||
size_t sizeofArray = sizeof(af_sig_protocolArray) / sizeof(af_sig_protocolArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(af_sig_protocol, af_sig_protocolArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(af_sig_protocol);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (af_sig_protocol == NULL) {
|
||||
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed [AfSigProtocol]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON)
|
||||
{
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_var = NULL;
|
||||
af_sig_protocol_local_var = OpenAPI_af_sig_protocol_create (
|
||||
);
|
||||
|
||||
return af_sig_protocol_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_af_sig_protocol_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_af_sig_protocol_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_af_sig_protocol_free(dst);
|
||||
dst = OpenAPI_af_sig_protocol_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* af_sig_protocol.h
|
||||
*
|
||||
* Possible values are - NO_INFORMATION: Indicate that no information about the AF signalling protocol is being provided. - SIP: Indicate that the signalling protocol is Session Initiation Protocol.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_af_sig_protocol_H_
|
||||
@@ -12,22 +12,16 @@
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "null_value.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_af_sig_protocol_s OpenAPI_af_sig_protocol_t;
|
||||
typedef struct OpenAPI_af_sig_protocol_s {
|
||||
} OpenAPI_af_sig_protocol_t;
|
||||
typedef enum { OpenAPI_af_sig_protocol_NULL = 0, OpenAPI_af_sig_protocol_NO_INFORMATION, OpenAPI_af_sig_protocol_SIP } OpenAPI_af_sig_protocol_e;
|
||||
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_create(
|
||||
);
|
||||
void OpenAPI_af_sig_protocol_free(OpenAPI_af_sig_protocol_t *af_sig_protocol);
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_parseFromJSON(cJSON *af_sig_protocolJSON);
|
||||
cJSON *OpenAPI_af_sig_protocol_convertToJSON(OpenAPI_af_sig_protocol_t *af_sig_protocol);
|
||||
OpenAPI_af_sig_protocol_t *OpenAPI_af_sig_protocol_copy(OpenAPI_af_sig_protocol_t *dst, OpenAPI_af_sig_protocol_t *src);
|
||||
char* OpenAPI_af_sig_protocol_ToString(OpenAPI_af_sig_protocol_e af_sig_protocol);
|
||||
|
||||
OpenAPI_af_sig_protocol_e OpenAPI_af_sig_protocol_FromString(char* af_sig_protocol);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -6,12 +6,12 @@
|
||||
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
|
||||
char *chg_id,
|
||||
OpenAPI_metering_method_t *metering_method,
|
||||
OpenAPI_metering_method_e metering_method,
|
||||
int offline,
|
||||
int online,
|
||||
int sdf_handl,
|
||||
int rating_group,
|
||||
OpenAPI_reporting_level_t *reporting_level,
|
||||
OpenAPI_reporting_level_e reporting_level,
|
||||
int service_id,
|
||||
char *sponsor_id,
|
||||
char *app_svc_prov_id,
|
||||
@@ -46,8 +46,6 @@ void OpenAPI_charging_data_free(OpenAPI_charging_data_t *charging_data)
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(charging_data->chg_id);
|
||||
OpenAPI_metering_method_free(charging_data->metering_method);
|
||||
OpenAPI_reporting_level_free(charging_data->reporting_level);
|
||||
ogs_free(charging_data->sponsor_id);
|
||||
ogs_free(charging_data->app_svc_prov_id);
|
||||
ogs_free(charging_data->af_charg_id);
|
||||
@@ -74,13 +72,7 @@ cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_dat
|
||||
}
|
||||
|
||||
if (charging_data->metering_method) {
|
||||
cJSON *metering_method_local_JSON = OpenAPI_metering_method_convertToJSON(charging_data->metering_method);
|
||||
if (metering_method_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "meteringMethod", metering_method_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "meteringMethod", OpenAPI_metering_method_ToString(charging_data->metering_method)) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [metering_method]");
|
||||
goto end;
|
||||
}
|
||||
@@ -115,13 +107,7 @@ cJSON *OpenAPI_charging_data_convertToJSON(OpenAPI_charging_data_t *charging_dat
|
||||
}
|
||||
|
||||
if (charging_data->reporting_level) {
|
||||
cJSON *reporting_level_local_JSON = OpenAPI_reporting_level_convertToJSON(charging_data->reporting_level);
|
||||
if (reporting_level_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "reportingLevel", reporting_level_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "reportingLevel", OpenAPI_reporting_level_ToString(charging_data->reporting_level)) == NULL) {
|
||||
ogs_error("OpenAPI_charging_data_convertToJSON() failed [reporting_level]");
|
||||
goto end;
|
||||
}
|
||||
@@ -183,9 +169,13 @@ OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dat
|
||||
|
||||
cJSON *metering_method = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "meteringMethod");
|
||||
|
||||
OpenAPI_metering_method_t *metering_method_local_nonprim = NULL;
|
||||
OpenAPI_metering_method_e metering_methodVariable;
|
||||
if (metering_method) {
|
||||
metering_method_local_nonprim = OpenAPI_metering_method_parseFromJSON(metering_method);
|
||||
if (!cJSON_IsString(metering_method)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [metering_method]");
|
||||
goto end;
|
||||
}
|
||||
metering_methodVariable = OpenAPI_metering_method_FromString(metering_method->valuestring);
|
||||
}
|
||||
|
||||
cJSON *offline = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "offline");
|
||||
@@ -226,9 +216,13 @@ OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dat
|
||||
|
||||
cJSON *reporting_level = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "reportingLevel");
|
||||
|
||||
OpenAPI_reporting_level_t *reporting_level_local_nonprim = NULL;
|
||||
OpenAPI_reporting_level_e reporting_levelVariable;
|
||||
if (reporting_level) {
|
||||
reporting_level_local_nonprim = OpenAPI_reporting_level_parseFromJSON(reporting_level);
|
||||
if (!cJSON_IsString(reporting_level)) {
|
||||
ogs_error("OpenAPI_charging_data_parseFromJSON() failed [reporting_level]");
|
||||
goto end;
|
||||
}
|
||||
reporting_levelVariable = OpenAPI_reporting_level_FromString(reporting_level->valuestring);
|
||||
}
|
||||
|
||||
cJSON *service_id = cJSON_GetObjectItemCaseSensitive(charging_dataJSON, "serviceId");
|
||||
@@ -278,12 +272,12 @@ OpenAPI_charging_data_t *OpenAPI_charging_data_parseFromJSON(cJSON *charging_dat
|
||||
|
||||
charging_data_local_var = OpenAPI_charging_data_create (
|
||||
ogs_strdup(chg_id->valuestring),
|
||||
metering_method ? metering_method_local_nonprim : NULL,
|
||||
metering_method ? metering_methodVariable : 0,
|
||||
offline ? offline->valueint : 0,
|
||||
online ? online->valueint : 0,
|
||||
sdf_handl ? sdf_handl->valueint : 0,
|
||||
rating_group ? rating_group->valuedouble : 0,
|
||||
reporting_level ? reporting_level_local_nonprim : NULL,
|
||||
reporting_level ? reporting_levelVariable : 0,
|
||||
service_id ? service_id->valuedouble : 0,
|
||||
sponsor_id ? ogs_strdup(sponsor_id->valuestring) : NULL,
|
||||
app_svc_prov_id ? ogs_strdup(app_svc_prov_id->valuestring) : NULL,
|
||||
|
||||
@@ -22,12 +22,12 @@ extern "C" {
|
||||
typedef struct OpenAPI_charging_data_s OpenAPI_charging_data_t;
|
||||
typedef struct OpenAPI_charging_data_s {
|
||||
char *chg_id;
|
||||
struct OpenAPI_metering_method_s *metering_method;
|
||||
OpenAPI_metering_method_e metering_method;
|
||||
int offline;
|
||||
int online;
|
||||
int sdf_handl;
|
||||
int rating_group;
|
||||
struct OpenAPI_reporting_level_s *reporting_level;
|
||||
OpenAPI_reporting_level_e reporting_level;
|
||||
int service_id;
|
||||
char *sponsor_id;
|
||||
char *app_svc_prov_id;
|
||||
@@ -37,12 +37,12 @@ typedef struct OpenAPI_charging_data_s {
|
||||
|
||||
OpenAPI_charging_data_t *OpenAPI_charging_data_create(
|
||||
char *chg_id,
|
||||
OpenAPI_metering_method_t *metering_method,
|
||||
OpenAPI_metering_method_e metering_method,
|
||||
int offline,
|
||||
int online,
|
||||
int sdf_handl,
|
||||
int rating_group,
|
||||
OpenAPI_reporting_level_t *reporting_level,
|
||||
OpenAPI_reporting_level_e reporting_level,
|
||||
int service_id,
|
||||
char *sponsor_id,
|
||||
char *app_svc_prov_id,
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "credit_management_status.h"
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
|
||||
)
|
||||
char* OpenAPI_credit_management_status_ToString(OpenAPI_credit_management_status_e credit_management_status)
|
||||
{
|
||||
OpenAPI_credit_management_status_t *credit_management_status_local_var = OpenAPI_malloc(sizeof(OpenAPI_credit_management_status_t));
|
||||
if (!credit_management_status_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return credit_management_status_local_var;
|
||||
const char *credit_management_statusArray[] = { "NULL", "END_USER_SER_DENIED", "CREDIT_CTRL_NOT_APP", "AUTH_REJECTED", "USER_UNKNOWN", "RATING_FAILED" };
|
||||
size_t sizeofArray = sizeof(credit_management_statusArray) / sizeof(credit_management_statusArray[0]);
|
||||
if (credit_management_status < sizeofArray)
|
||||
return (char *)credit_management_statusArray[credit_management_status];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status)
|
||||
OpenAPI_credit_management_status_e OpenAPI_credit_management_status_FromString(char* credit_management_status)
|
||||
{
|
||||
if (NULL == credit_management_status) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *credit_management_statusArray[] = { "NULL", "END_USER_SER_DENIED", "CREDIT_CTRL_NOT_APP", "AUTH_REJECTED", "USER_UNKNOWN", "RATING_FAILED" };
|
||||
size_t sizeofArray = sizeof(credit_management_statusArray) / sizeof(credit_management_statusArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(credit_management_status, credit_management_statusArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(credit_management_status);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (credit_management_status == NULL) {
|
||||
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed [CreditManagementStatus]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON)
|
||||
{
|
||||
OpenAPI_credit_management_status_t *credit_management_status_local_var = NULL;
|
||||
credit_management_status_local_var = OpenAPI_credit_management_status_create (
|
||||
);
|
||||
|
||||
return credit_management_status_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_credit_management_status_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_credit_management_status_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_credit_management_status_free(dst);
|
||||
dst = OpenAPI_credit_management_status_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,16 +17,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_credit_management_status_s OpenAPI_credit_management_status_t;
|
||||
typedef struct OpenAPI_credit_management_status_s {
|
||||
} OpenAPI_credit_management_status_t;
|
||||
typedef enum { OpenAPI_credit_management_status_NULL = 0, OpenAPI_credit_management_status_END_USER_SER_DENIED, OpenAPI_credit_management_status_CREDIT_CTRL_NOT_APP, OpenAPI_credit_management_status_AUTH_REJECTED, OpenAPI_credit_management_status_USER_UNKNOWN, OpenAPI_credit_management_status_RATING_FAILED } OpenAPI_credit_management_status_e;
|
||||
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_create(
|
||||
);
|
||||
void OpenAPI_credit_management_status_free(OpenAPI_credit_management_status_t *credit_management_status);
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_parseFromJSON(cJSON *credit_management_statusJSON);
|
||||
cJSON *OpenAPI_credit_management_status_convertToJSON(OpenAPI_credit_management_status_t *credit_management_status);
|
||||
OpenAPI_credit_management_status_t *OpenAPI_credit_management_status_copy(OpenAPI_credit_management_status_t *dst, OpenAPI_credit_management_status_t *src);
|
||||
char* OpenAPI_credit_management_status_ToString(OpenAPI_credit_management_status_e credit_management_status);
|
||||
|
||||
OpenAPI_credit_management_status_e OpenAPI_credit_management_status_FromString(char* credit_management_status);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -8,7 +8,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_create(
|
||||
char *dest_mac_addr,
|
||||
char *eth_type,
|
||||
char *f_desc,
|
||||
OpenAPI_flow_direction_t *f_dir,
|
||||
OpenAPI_flow_direction_e f_dir,
|
||||
char *source_mac_addr,
|
||||
OpenAPI_list_t *vlan_tags,
|
||||
char *src_mac_addr_end,
|
||||
@@ -40,7 +40,6 @@ void OpenAPI_eth_flow_description_free(OpenAPI_eth_flow_description_t *eth_flow_
|
||||
ogs_free(eth_flow_description->dest_mac_addr);
|
||||
ogs_free(eth_flow_description->eth_type);
|
||||
ogs_free(eth_flow_description->f_desc);
|
||||
OpenAPI_flow_direction_free(eth_flow_description->f_dir);
|
||||
ogs_free(eth_flow_description->source_mac_addr);
|
||||
OpenAPI_list_for_each(eth_flow_description->vlan_tags, node) {
|
||||
ogs_free(node->data);
|
||||
@@ -85,13 +84,7 @@ cJSON *OpenAPI_eth_flow_description_convertToJSON(OpenAPI_eth_flow_description_t
|
||||
}
|
||||
|
||||
if (eth_flow_description->f_dir) {
|
||||
cJSON *f_dir_local_JSON = OpenAPI_flow_direction_convertToJSON(eth_flow_description->f_dir);
|
||||
if (f_dir_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_eth_flow_description_convertToJSON() failed [f_dir]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "fDir", f_dir_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "fDir", OpenAPI_flow_direction_ToString(eth_flow_description->f_dir)) == NULL) {
|
||||
ogs_error("OpenAPI_eth_flow_description_convertToJSON() failed [f_dir]");
|
||||
goto end;
|
||||
}
|
||||
@@ -173,9 +166,13 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_parseFromJSON(cJSON
|
||||
|
||||
cJSON *f_dir = cJSON_GetObjectItemCaseSensitive(eth_flow_descriptionJSON, "fDir");
|
||||
|
||||
OpenAPI_flow_direction_t *f_dir_local_nonprim = NULL;
|
||||
OpenAPI_flow_direction_e f_dirVariable;
|
||||
if (f_dir) {
|
||||
f_dir_local_nonprim = OpenAPI_flow_direction_parseFromJSON(f_dir);
|
||||
if (!cJSON_IsString(f_dir)) {
|
||||
ogs_error("OpenAPI_eth_flow_description_parseFromJSON() failed [f_dir]");
|
||||
goto end;
|
||||
}
|
||||
f_dirVariable = OpenAPI_flow_direction_FromString(f_dir->valuestring);
|
||||
}
|
||||
|
||||
cJSON *source_mac_addr = cJSON_GetObjectItemCaseSensitive(eth_flow_descriptionJSON, "sourceMacAddr");
|
||||
@@ -229,7 +226,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_parseFromJSON(cJSON
|
||||
dest_mac_addr ? ogs_strdup(dest_mac_addr->valuestring) : NULL,
|
||||
ogs_strdup(eth_type->valuestring),
|
||||
f_desc ? ogs_strdup(f_desc->valuestring) : NULL,
|
||||
f_dir ? f_dir_local_nonprim : NULL,
|
||||
f_dir ? f_dirVariable : 0,
|
||||
source_mac_addr ? ogs_strdup(source_mac_addr->valuestring) : NULL,
|
||||
vlan_tags ? vlan_tagsList : NULL,
|
||||
src_mac_addr_end ? ogs_strdup(src_mac_addr_end->valuestring) : NULL,
|
||||
|
||||
@@ -23,7 +23,7 @@ typedef struct OpenAPI_eth_flow_description_s {
|
||||
char *dest_mac_addr;
|
||||
char *eth_type;
|
||||
char *f_desc;
|
||||
struct OpenAPI_flow_direction_s *f_dir;
|
||||
OpenAPI_flow_direction_e f_dir;
|
||||
char *source_mac_addr;
|
||||
OpenAPI_list_t *vlan_tags;
|
||||
char *src_mac_addr_end;
|
||||
@@ -34,7 +34,7 @@ OpenAPI_eth_flow_description_t *OpenAPI_eth_flow_description_create(
|
||||
char *dest_mac_addr,
|
||||
char *eth_type,
|
||||
char *f_desc,
|
||||
OpenAPI_flow_direction_t *f_dir,
|
||||
OpenAPI_flow_direction_e f_dir,
|
||||
char *source_mac_addr,
|
||||
OpenAPI_list_t *vlan_tags,
|
||||
char *src_mac_addr_end,
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "failure_cause.h"
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
|
||||
)
|
||||
char* OpenAPI_failure_cause_ToString(OpenAPI_failure_cause_e failure_cause)
|
||||
{
|
||||
OpenAPI_failure_cause_t *failure_cause_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_cause_t));
|
||||
if (!failure_cause_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return failure_cause_local_var;
|
||||
const char *failure_causeArray[] = { "NULL", "PCC_RULE_EVENT", "PCC_QOS_FLOW_EVENT", "RULE_PERMANENT_ERROR", "RULE_TEMPORARY_ERROR" };
|
||||
size_t sizeofArray = sizeof(failure_causeArray) / sizeof(failure_causeArray[0]);
|
||||
if (failure_cause < sizeofArray)
|
||||
return (char *)failure_causeArray[failure_cause];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause)
|
||||
OpenAPI_failure_cause_e OpenAPI_failure_cause_FromString(char* failure_cause)
|
||||
{
|
||||
if (NULL == failure_cause) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *failure_causeArray[] = { "NULL", "PCC_RULE_EVENT", "PCC_QOS_FLOW_EVENT", "RULE_PERMANENT_ERROR", "RULE_TEMPORARY_ERROR" };
|
||||
size_t sizeofArray = sizeof(failure_causeArray) / sizeof(failure_causeArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(failure_cause, failure_causeArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(failure_cause);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (failure_cause == NULL) {
|
||||
ogs_error("OpenAPI_failure_cause_convertToJSON() failed [FailureCause]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON)
|
||||
{
|
||||
OpenAPI_failure_cause_t *failure_cause_local_var = NULL;
|
||||
failure_cause_local_var = OpenAPI_failure_cause_create (
|
||||
);
|
||||
|
||||
return failure_cause_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_failure_cause_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_failure_cause_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_free(dst);
|
||||
dst = OpenAPI_failure_cause_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,16 +17,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_failure_cause_s OpenAPI_failure_cause_t;
|
||||
typedef struct OpenAPI_failure_cause_s {
|
||||
} OpenAPI_failure_cause_t;
|
||||
typedef enum { OpenAPI_failure_cause_NULL = 0, OpenAPI_failure_cause_PCC_RULE_EVENT, OpenAPI_failure_cause_PCC_QOS_FLOW_EVENT, OpenAPI_failure_cause_RULE_PERMANENT_ERROR, OpenAPI_failure_cause_RULE_TEMPORARY_ERROR } OpenAPI_failure_cause_e;
|
||||
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_create(
|
||||
);
|
||||
void OpenAPI_failure_cause_free(OpenAPI_failure_cause_t *failure_cause);
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_parseFromJSON(cJSON *failure_causeJSON);
|
||||
cJSON *OpenAPI_failure_cause_convertToJSON(OpenAPI_failure_cause_t *failure_cause);
|
||||
OpenAPI_failure_cause_t *OpenAPI_failure_cause_copy(OpenAPI_failure_cause_t *dst, OpenAPI_failure_cause_t *src);
|
||||
char* OpenAPI_failure_cause_ToString(OpenAPI_failure_cause_e failure_cause);
|
||||
|
||||
OpenAPI_failure_cause_e OpenAPI_failure_cause_FromString(char* failure_cause);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "failure_code.h"
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
|
||||
)
|
||||
char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code)
|
||||
{
|
||||
OpenAPI_failure_code_t *failure_code_local_var = OpenAPI_malloc(sizeof(OpenAPI_failure_code_t));
|
||||
if (!failure_code_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return failure_code_local_var;
|
||||
const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP" };
|
||||
size_t sizeofArray = sizeof(failure_codeArray) / sizeof(failure_codeArray[0]);
|
||||
if (failure_code < sizeofArray)
|
||||
return (char *)failure_codeArray[failure_code];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code)
|
||||
OpenAPI_failure_code_e OpenAPI_failure_code_FromString(char* failure_code)
|
||||
{
|
||||
if (NULL == failure_code) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *failure_codeArray[] = { "NULL", "UNK_RULE_ID", "RA_GR_ERR", "SER_ID_ERR", "NF_MAL", "RES_LIM", "MAX_NR_QoS_FLOW", "MISS_FLOW_INFO", "RES_ALLO_FAIL", "UNSUCC_QOS_VAL", "INCOR_FLOW_INFO", "PS_TO_CS_HAN", "APP_ID_ERR", "NO_QOS_FLOW_BOUND", "FILTER_RES", "MISS_REDI_SER_ADDR", "CM_END_USER_SER_DENIED", "CM_CREDIT_CON_NOT_APP", "CM_AUTH_REJ", "CM_USER_UNK", "CM_RAT_FAILED", "UE_STA_SUSP" };
|
||||
size_t sizeofArray = sizeof(failure_codeArray) / sizeof(failure_codeArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(failure_code, failure_codeArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(failure_code);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (failure_code == NULL) {
|
||||
ogs_error("OpenAPI_failure_code_convertToJSON() failed [FailureCode]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON)
|
||||
{
|
||||
OpenAPI_failure_code_t *failure_code_local_var = NULL;
|
||||
failure_code_local_var = OpenAPI_failure_code_create (
|
||||
);
|
||||
|
||||
return failure_code_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_failure_code_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_failure_code_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_failure_code_free(dst);
|
||||
dst = OpenAPI_failure_code_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* failure_code.h
|
||||
*
|
||||
* Possible values are - UNK_RULE_ID: Indicates that the pre-provisioned PCC rule could not be successfully activated because the PCC rule identifier is unknown to the SMF. - RA_GR_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Rating Group specified within the Charging Data policy decision which the PCC rule refers to is unknown or, invalid. - SER_ID_ERR: Indicate that the PCC rule could not be successfully installed or enforced because the Service Identifier specified within the Charging Data policy decision which the PCC rule refers to is invalid, unknown, or not applicable to the service being charged. - NF_MAL: Indicate that the PCC rule could not be successfully installed (for those provisioned from the PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to SMF/UPF malfunction. - RES_LIM: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to a limitation of resources at the SMF/UPF. - MAX_NR_QoS_FLOW: Indicate that the PCC rule could not be successfully installed (for those provisioned from PCF) or activated (for those pre-defined in SMF) or enforced (for those already successfully installed) due to the fact that the maximum number of QoS flows has been reached for the PDU session. - MISS_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or enforced because neither the \"flowInfos\" attribute nor the \"appId\" attribute is specified within the PccRule data structure by the PCF during the first install request of the PCC rule. - RES_ALLO_FAIL: Indicate that the PCC rule could not be successfully installed or maintained since the QoS flow establishment/modification failed, or the QoS flow was released. - UNSUCC_QOS_VAL: indicate that the QoS validation has failed or when Guaranteed Bandwidth > Max-Requested-Bandwidth. - INCOR_FLOW_INFO: Indicate that the PCC rule could not be successfully installed or modified at the SMF because the provided flow information is not supported by the network (e.g. the provided IP address(es) or Ipv6 prefix(es) do not correspond to an IP version applicable for the PDU session). - PS_TO_CS_HAN: Indicate that the PCC rule could not be maintained because of PS to CS handover. - APP_ID_ERR: Indicate that the rule could not be successfully installed or enforced because the Application Identifier is invalid, unknown, or not applicable to the application required for detection. - NO_QOS_FLOW_BOUND: Indicate that there is no QoS flow which the SMF can bind the PCC rule(s) to. - FILTER_RES: Indicate that the Flow Information within the \"flowInfos\" attribute cannot be handled by the SMF because any of the restrictions defined in subclause 5.4.2 of 3GPP TS 29.212 was not met. - MISS_REDI_SER_ADDR: Indicate that the PCC rule could not be successfully installed or enforced at the SMF because there is no valid Redirect Server Address within the Traffic Control Data policy decision which the PCC rule refers to provided by the PCF and no preconfigured redirection address for this PCC rule at the SMF. - CM_END_USER_SER_DENIED: Indicate that the charging system denied the service request due to service restrictions (e.g. terminate rating group) or limitations related to the end-user, for example the end-user's account could not cover the requested service. - CM_CREDIT_CON_NOT_APP: Indicate that the charging system determined that the service can be granted to the end user but no further credit control is needed for the service (e.g. service is free of charge or is treated for offline charging). - CM_AUTH_REJ: Indicate that the charging system denied the service request in order to terminate the service for which credit is requested. - CM_USER_UNK: Indicate that the specified end user could not be found in the charging system. - CM_RAT_FAILED: Indicate that the charging system cannot rate the service request due to insufficient rating input, incorrect AVP combination or due to an attribute or an attribute value that is not recognized or supported in the rating. - UE_STA_SUSP: Indicates that the UE is in suspend state.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_failure_code_H_
|
||||
@@ -17,16 +17,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_failure_code_s OpenAPI_failure_code_t;
|
||||
typedef struct OpenAPI_failure_code_s {
|
||||
} OpenAPI_failure_code_t;
|
||||
typedef enum { OpenAPI_failure_code_NULL = 0, OpenAPI_failure_code_UNK_RULE_ID, OpenAPI_failure_code_RA_GR_ERR, OpenAPI_failure_code_SER_ID_ERR, OpenAPI_failure_code_NF_MAL, OpenAPI_failure_code_RES_LIM, OpenAPI_failure_code_MAX_NR_QoS_FLOW, OpenAPI_failure_code_MISS_FLOW_INFO, OpenAPI_failure_code_RES_ALLO_FAIL, OpenAPI_failure_code_UNSUCC_QOS_VAL, OpenAPI_failure_code_INCOR_FLOW_INFO, OpenAPI_failure_code_PS_TO_CS_HAN, OpenAPI_failure_code_APP_ID_ERR, OpenAPI_failure_code_NO_QOS_FLOW_BOUND, OpenAPI_failure_code_FILTER_RES, OpenAPI_failure_code_MISS_REDI_SER_ADDR, OpenAPI_failure_code_CM_END_USER_SER_DENIED, OpenAPI_failure_code_CM_CREDIT_CON_NOT_APP, OpenAPI_failure_code_CM_AUTH_REJ, OpenAPI_failure_code_CM_USER_UNK, OpenAPI_failure_code_CM_RAT_FAILED, OpenAPI_failure_code_UE_STA_SUSP } OpenAPI_failure_code_e;
|
||||
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_create(
|
||||
);
|
||||
void OpenAPI_failure_code_free(OpenAPI_failure_code_t *failure_code);
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_parseFromJSON(cJSON *failure_codeJSON);
|
||||
cJSON *OpenAPI_failure_code_convertToJSON(OpenAPI_failure_code_t *failure_code);
|
||||
OpenAPI_failure_code_t *OpenAPI_failure_code_copy(OpenAPI_failure_code_t *dst, OpenAPI_failure_code_t *src);
|
||||
char* OpenAPI_failure_code_ToString(OpenAPI_failure_code_e failure_code);
|
||||
|
||||
OpenAPI_failure_code_e OpenAPI_failure_code_FromString(char* failure_code);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "flow_direction.h"
|
||||
|
||||
OpenAPI_flow_direction_t *OpenAPI_flow_direction_create(
|
||||
)
|
||||
char* OpenAPI_flow_direction_ToString(OpenAPI_flow_direction_e flow_direction)
|
||||
{
|
||||
OpenAPI_flow_direction_t *flow_direction_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_direction_t));
|
||||
if (!flow_direction_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return flow_direction_local_var;
|
||||
const char *flow_directionArray[] = { "NULL", "DOWNLINK", "UPLINK", "BIDIRECTIONAL", "UNSPECIFIED" };
|
||||
size_t sizeofArray = sizeof(flow_directionArray) / sizeof(flow_directionArray[0]);
|
||||
if (flow_direction < sizeofArray)
|
||||
return (char *)flow_directionArray[flow_direction];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_flow_direction_free(OpenAPI_flow_direction_t *flow_direction)
|
||||
OpenAPI_flow_direction_e OpenAPI_flow_direction_FromString(char* flow_direction)
|
||||
{
|
||||
if (NULL == flow_direction) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *flow_directionArray[] = { "NULL", "DOWNLINK", "UPLINK", "BIDIRECTIONAL", "UNSPECIFIED" };
|
||||
size_t sizeofArray = sizeof(flow_directionArray) / sizeof(flow_directionArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(flow_direction, flow_directionArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(flow_direction);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_flow_direction_convertToJSON(OpenAPI_flow_direction_t *flow_direction)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (flow_direction == NULL) {
|
||||
ogs_error("OpenAPI_flow_direction_convertToJSON() failed [FlowDirection]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_flow_direction_t *OpenAPI_flow_direction_parseFromJSON(cJSON *flow_directionJSON)
|
||||
{
|
||||
OpenAPI_flow_direction_t *flow_direction_local_var = NULL;
|
||||
flow_direction_local_var = OpenAPI_flow_direction_create (
|
||||
);
|
||||
|
||||
return flow_direction_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_direction_t *OpenAPI_flow_direction_copy(OpenAPI_flow_direction_t *dst, OpenAPI_flow_direction_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_flow_direction_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_flow_direction_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_flow_direction_free(dst);
|
||||
dst = OpenAPI_flow_direction_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* flow_direction.h
|
||||
*
|
||||
* Possible values are - DOWNLINK: The corresponding filter applies for traffic to the UE. - UPLINK: The corresponding filter applies for traffic from the UE. - BIDIRECTIONAL: The corresponding filter applies for traffic both to and from the UE. - UNSPECIFIED: The corresponding filter applies for traffic to the UE (downlink), but has no specific direction declared. The service data flow detection shall apply the filter for uplink traffic as if the filter was bidirectional. The PCF shall not use the value UNSPECIFIED in filters created by the network in NW-initiated procedures. The PCF shall only include the value UNSPECIFIED in filters in UE-initiated procedures if the same value is received from the SMF.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_flow_direction_H_
|
||||
@@ -17,16 +17,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_flow_direction_s OpenAPI_flow_direction_t;
|
||||
typedef struct OpenAPI_flow_direction_s {
|
||||
} OpenAPI_flow_direction_t;
|
||||
typedef enum { OpenAPI_flow_direction_NULL = 0, OpenAPI_flow_direction_DOWNLINK, OpenAPI_flow_direction_UPLINK, OpenAPI_flow_direction_BIDIRECTIONAL, OpenAPI_flow_direction_UNSPECIFIED } OpenAPI_flow_direction_e;
|
||||
|
||||
OpenAPI_flow_direction_t *OpenAPI_flow_direction_create(
|
||||
);
|
||||
void OpenAPI_flow_direction_free(OpenAPI_flow_direction_t *flow_direction);
|
||||
OpenAPI_flow_direction_t *OpenAPI_flow_direction_parseFromJSON(cJSON *flow_directionJSON);
|
||||
cJSON *OpenAPI_flow_direction_convertToJSON(OpenAPI_flow_direction_t *flow_direction);
|
||||
OpenAPI_flow_direction_t *OpenAPI_flow_direction_copy(OpenAPI_flow_direction_t *dst, OpenAPI_flow_direction_t *src);
|
||||
char* OpenAPI_flow_direction_ToString(OpenAPI_flow_direction_e flow_direction);
|
||||
|
||||
OpenAPI_flow_direction_e OpenAPI_flow_direction_FromString(char* flow_direction);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -12,7 +12,7 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_create(
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_rm_t *flow_direction
|
||||
OpenAPI_flow_direction_e flow_direction
|
||||
)
|
||||
{
|
||||
OpenAPI_flow_information_t *flow_information_local_var = OpenAPI_malloc(sizeof(OpenAPI_flow_information_t));
|
||||
@@ -43,7 +43,6 @@ void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information)
|
||||
ogs_free(flow_information->tos_traffic_class);
|
||||
ogs_free(flow_information->spi);
|
||||
ogs_free(flow_information->flow_label);
|
||||
OpenAPI_flow_direction_rm_free(flow_information->flow_direction);
|
||||
ogs_free(flow_information);
|
||||
}
|
||||
|
||||
@@ -113,13 +112,7 @@ cJSON *OpenAPI_flow_information_convertToJSON(OpenAPI_flow_information_t *flow_i
|
||||
}
|
||||
|
||||
if (flow_information->flow_direction) {
|
||||
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_rm_convertToJSON(flow_information->flow_direction);
|
||||
if (flow_direction_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "flowDirection", OpenAPI_flow_direction_ToString(flow_information->flow_direction)) == NULL) {
|
||||
ogs_error("OpenAPI_flow_information_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
@@ -195,9 +188,13 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_i
|
||||
|
||||
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(flow_informationJSON, "flowDirection");
|
||||
|
||||
OpenAPI_flow_direction_rm_t *flow_direction_local_nonprim = NULL;
|
||||
OpenAPI_flow_direction_e flow_directionVariable;
|
||||
if (flow_direction) {
|
||||
flow_direction_local_nonprim = OpenAPI_flow_direction_rm_parseFromJSON(flow_direction);
|
||||
if (!cJSON_IsString(flow_direction)) {
|
||||
ogs_error("OpenAPI_flow_information_parseFromJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
flow_directionVariable = OpenAPI_flow_direction_FromString(flow_direction->valuestring);
|
||||
}
|
||||
|
||||
flow_information_local_var = OpenAPI_flow_information_create (
|
||||
@@ -208,7 +205,7 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_i
|
||||
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
|
||||
spi ? ogs_strdup(spi->valuestring) : NULL,
|
||||
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
|
||||
flow_direction ? flow_direction_local_nonprim : NULL
|
||||
flow_direction ? flow_directionVariable : 0
|
||||
);
|
||||
|
||||
return flow_information_local_var;
|
||||
|
||||
@@ -13,7 +13,7 @@
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "eth_flow_description.h"
|
||||
#include "flow_direction_rm.h"
|
||||
#include "flow_direction.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
@@ -28,7 +28,7 @@ typedef struct OpenAPI_flow_information_s {
|
||||
char *tos_traffic_class;
|
||||
char *spi;
|
||||
char *flow_label;
|
||||
struct OpenAPI_flow_direction_rm_s *flow_direction;
|
||||
OpenAPI_flow_direction_e flow_direction;
|
||||
} OpenAPI_flow_information_t;
|
||||
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_create(
|
||||
@@ -39,7 +39,7 @@ OpenAPI_flow_information_t *OpenAPI_flow_information_create(
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_rm_t *flow_direction
|
||||
OpenAPI_flow_direction_e flow_direction
|
||||
);
|
||||
void OpenAPI_flow_information_free(OpenAPI_flow_information_t *flow_information);
|
||||
OpenAPI_flow_information_t *OpenAPI_flow_information_parseFromJSON(cJSON *flow_informationJSON);
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "ma_pdu_indication.h"
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
|
||||
)
|
||||
char* OpenAPI_ma_pdu_indication_ToString(OpenAPI_ma_pdu_indication_e ma_pdu_indication)
|
||||
{
|
||||
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = OpenAPI_malloc(sizeof(OpenAPI_ma_pdu_indication_t));
|
||||
if (!ma_pdu_indication_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return ma_pdu_indication_local_var;
|
||||
const char *ma_pdu_indicationArray[] = { "NULL", "MA_PDU_REQUEST", "MA_PDU_NETWORK_UPGRADE_ALLOWED" };
|
||||
size_t sizeofArray = sizeof(ma_pdu_indicationArray) / sizeof(ma_pdu_indicationArray[0]);
|
||||
if (ma_pdu_indication < sizeofArray)
|
||||
return (char *)ma_pdu_indicationArray[ma_pdu_indication];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
|
||||
OpenAPI_ma_pdu_indication_e OpenAPI_ma_pdu_indication_FromString(char* ma_pdu_indication)
|
||||
{
|
||||
if (NULL == ma_pdu_indication) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *ma_pdu_indicationArray[] = { "NULL", "MA_PDU_REQUEST", "MA_PDU_NETWORK_UPGRADE_ALLOWED" };
|
||||
size_t sizeofArray = sizeof(ma_pdu_indicationArray) / sizeof(ma_pdu_indicationArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(ma_pdu_indication, ma_pdu_indicationArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(ma_pdu_indication);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (ma_pdu_indication == NULL) {
|
||||
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed [MaPduIndication]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON)
|
||||
{
|
||||
OpenAPI_ma_pdu_indication_t *ma_pdu_indication_local_var = NULL;
|
||||
ma_pdu_indication_local_var = OpenAPI_ma_pdu_indication_create (
|
||||
);
|
||||
|
||||
return ma_pdu_indication_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_ma_pdu_indication_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_ma_pdu_indication_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_ma_pdu_indication_free(dst);
|
||||
dst = OpenAPI_ma_pdu_indication_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -17,16 +17,11 @@
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_ma_pdu_indication_s OpenAPI_ma_pdu_indication_t;
|
||||
typedef struct OpenAPI_ma_pdu_indication_s {
|
||||
} OpenAPI_ma_pdu_indication_t;
|
||||
typedef enum { OpenAPI_ma_pdu_indication_NULL = 0, OpenAPI_ma_pdu_indication_MA_PDU_REQUEST, OpenAPI_ma_pdu_indication_MA_PDU_NETWORK_UPGRADE_ALLOWED } OpenAPI_ma_pdu_indication_e;
|
||||
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_create(
|
||||
);
|
||||
void OpenAPI_ma_pdu_indication_free(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_parseFromJSON(cJSON *ma_pdu_indicationJSON);
|
||||
cJSON *OpenAPI_ma_pdu_indication_convertToJSON(OpenAPI_ma_pdu_indication_t *ma_pdu_indication);
|
||||
OpenAPI_ma_pdu_indication_t *OpenAPI_ma_pdu_indication_copy(OpenAPI_ma_pdu_indication_t *dst, OpenAPI_ma_pdu_indication_t *src);
|
||||
char* OpenAPI_ma_pdu_indication_ToString(OpenAPI_ma_pdu_indication_e ma_pdu_indication);
|
||||
|
||||
OpenAPI_ma_pdu_indication_e OpenAPI_ma_pdu_indication_FromString(char* ma_pdu_indication);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -4,82 +4,27 @@
|
||||
#include <stdio.h>
|
||||
#include "metering_method.h"
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
|
||||
)
|
||||
char* OpenAPI_metering_method_ToString(OpenAPI_metering_method_e metering_method)
|
||||
{
|
||||
OpenAPI_metering_method_t *metering_method_local_var = OpenAPI_malloc(sizeof(OpenAPI_metering_method_t));
|
||||
if (!metering_method_local_var) {
|
||||
return NULL;
|
||||
}
|
||||
|
||||
return metering_method_local_var;
|
||||
const char *metering_methodArray[] = { "NULL", "DURATION", "VOLUME", "DURATION_VOLUME", "EVENT" };
|
||||
size_t sizeofArray = sizeof(metering_methodArray) / sizeof(metering_methodArray[0]);
|
||||
if (metering_method < sizeofArray)
|
||||
return (char *)metering_methodArray[metering_method];
|
||||
else
|
||||
return (char *)"Unknown";
|
||||
}
|
||||
|
||||
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method)
|
||||
OpenAPI_metering_method_e OpenAPI_metering_method_FromString(char* metering_method)
|
||||
{
|
||||
if (NULL == metering_method) {
|
||||
return;
|
||||
int stringToReturn = 0;
|
||||
const char *metering_methodArray[] = { "NULL", "DURATION", "VOLUME", "DURATION_VOLUME", "EVENT" };
|
||||
size_t sizeofArray = sizeof(metering_methodArray) / sizeof(metering_methodArray[0]);
|
||||
while (stringToReturn < sizeofArray) {
|
||||
if (strcmp(metering_method, metering_methodArray[stringToReturn]) == 0) {
|
||||
return stringToReturn;
|
||||
}
|
||||
stringToReturn++;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
ogs_free(metering_method);
|
||||
}
|
||||
|
||||
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
|
||||
if (metering_method == NULL) {
|
||||
ogs_error("OpenAPI_metering_method_convertToJSON() failed [MeteringMethod]");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_CreateObject();
|
||||
end:
|
||||
return item;
|
||||
}
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON)
|
||||
{
|
||||
OpenAPI_metering_method_t *metering_method_local_var = NULL;
|
||||
metering_method_local_var = OpenAPI_metering_method_create (
|
||||
);
|
||||
|
||||
return metering_method_local_var;
|
||||
end:
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src)
|
||||
{
|
||||
cJSON *item = NULL;
|
||||
char *content = NULL;
|
||||
|
||||
ogs_assert(src);
|
||||
item = OpenAPI_metering_method_convertToJSON(src);
|
||||
if (!item) {
|
||||
ogs_error("OpenAPI_metering_method_convertToJSON() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
content = cJSON_Print(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
if (!content) {
|
||||
ogs_error("cJSON_Print() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
item = cJSON_Parse(content);
|
||||
ogs_free(content);
|
||||
if (!item) {
|
||||
ogs_error("cJSON_Parse() failed");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
OpenAPI_metering_method_free(dst);
|
||||
dst = OpenAPI_metering_method_parseFromJSON(item);
|
||||
cJSON_Delete(item);
|
||||
|
||||
return dst;
|
||||
return 0;
|
||||
}
|
||||
|
||||
|
||||
@@ -1,7 +1,7 @@
|
||||
/*
|
||||
* metering_method.h
|
||||
*
|
||||
* Possible values are - DURATION: Indicates that the duration of the service data flow traffic shall be metered. - VOLUME: Indicates that volume of the service data flow traffic shall be metered. - DURATION_VOLUME: Indicates that the duration and the volume of the service data flow traffic shall be metered. - EVENT: Indicates that events of the service data flow traffic shall be metered.
|
||||
*
|
||||
*/
|
||||
|
||||
#ifndef _OpenAPI_metering_method_H_
|
||||
@@ -12,22 +12,16 @@
|
||||
#include "../include/list.h"
|
||||
#include "../include/keyValuePair.h"
|
||||
#include "../include/binary.h"
|
||||
#include "null_value.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
typedef struct OpenAPI_metering_method_s OpenAPI_metering_method_t;
|
||||
typedef struct OpenAPI_metering_method_s {
|
||||
} OpenAPI_metering_method_t;
|
||||
typedef enum { OpenAPI_metering_method_NULL = 0, OpenAPI_metering_method_DURATION, OpenAPI_metering_method_VOLUME, OpenAPI_metering_method_DURATION_VOLUME, OpenAPI_metering_method_EVENT } OpenAPI_metering_method_e;
|
||||
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_create(
|
||||
);
|
||||
void OpenAPI_metering_method_free(OpenAPI_metering_method_t *metering_method);
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_parseFromJSON(cJSON *metering_methodJSON);
|
||||
cJSON *OpenAPI_metering_method_convertToJSON(OpenAPI_metering_method_t *metering_method);
|
||||
OpenAPI_metering_method_t *OpenAPI_metering_method_copy(OpenAPI_metering_method_t *dst, OpenAPI_metering_method_t *src);
|
||||
char* OpenAPI_metering_method_ToString(OpenAPI_metering_method_e metering_method);
|
||||
|
||||
OpenAPI_metering_method_e OpenAPI_metering_method_FromString(char* metering_method);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
|
||||
@@ -10,7 +10,7 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_t *flow_direction
|
||||
OpenAPI_flow_direction_e flow_direction
|
||||
)
|
||||
{
|
||||
OpenAPI_packet_filter_info_t *packet_filter_info_local_var = OpenAPI_malloc(sizeof(OpenAPI_packet_filter_info_t));
|
||||
@@ -38,7 +38,6 @@ void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter
|
||||
ogs_free(packet_filter_info->tos_traffic_class);
|
||||
ogs_free(packet_filter_info->spi);
|
||||
ogs_free(packet_filter_info->flow_label);
|
||||
OpenAPI_flow_direction_free(packet_filter_info->flow_direction);
|
||||
ogs_free(packet_filter_info);
|
||||
}
|
||||
|
||||
@@ -88,13 +87,7 @@ cJSON *OpenAPI_packet_filter_info_convertToJSON(OpenAPI_packet_filter_info_t *pa
|
||||
}
|
||||
|
||||
if (packet_filter_info->flow_direction) {
|
||||
cJSON *flow_direction_local_JSON = OpenAPI_flow_direction_convertToJSON(packet_filter_info->flow_direction);
|
||||
if (flow_direction_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "flowDirection", flow_direction_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "flowDirection", OpenAPI_flow_direction_ToString(packet_filter_info->flow_direction)) == NULL) {
|
||||
ogs_error("OpenAPI_packet_filter_info_convertToJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
@@ -154,9 +147,13 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *pa
|
||||
|
||||
cJSON *flow_direction = cJSON_GetObjectItemCaseSensitive(packet_filter_infoJSON, "flowDirection");
|
||||
|
||||
OpenAPI_flow_direction_t *flow_direction_local_nonprim = NULL;
|
||||
OpenAPI_flow_direction_e flow_directionVariable;
|
||||
if (flow_direction) {
|
||||
flow_direction_local_nonprim = OpenAPI_flow_direction_parseFromJSON(flow_direction);
|
||||
if (!cJSON_IsString(flow_direction)) {
|
||||
ogs_error("OpenAPI_packet_filter_info_parseFromJSON() failed [flow_direction]");
|
||||
goto end;
|
||||
}
|
||||
flow_directionVariable = OpenAPI_flow_direction_FromString(flow_direction->valuestring);
|
||||
}
|
||||
|
||||
packet_filter_info_local_var = OpenAPI_packet_filter_info_create (
|
||||
@@ -165,7 +162,7 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *pa
|
||||
tos_traffic_class ? ogs_strdup(tos_traffic_class->valuestring) : NULL,
|
||||
spi ? ogs_strdup(spi->valuestring) : NULL,
|
||||
flow_label ? ogs_strdup(flow_label->valuestring) : NULL,
|
||||
flow_direction ? flow_direction_local_nonprim : NULL
|
||||
flow_direction ? flow_directionVariable : 0
|
||||
);
|
||||
|
||||
return packet_filter_info_local_var;
|
||||
|
||||
@@ -25,7 +25,7 @@ typedef struct OpenAPI_packet_filter_info_s {
|
||||
char *tos_traffic_class;
|
||||
char *spi;
|
||||
char *flow_label;
|
||||
struct OpenAPI_flow_direction_s *flow_direction;
|
||||
OpenAPI_flow_direction_e flow_direction;
|
||||
} OpenAPI_packet_filter_info_t;
|
||||
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
|
||||
@@ -34,7 +34,7 @@ OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_create(
|
||||
char *tos_traffic_class,
|
||||
char *spi,
|
||||
char *flow_label,
|
||||
OpenAPI_flow_direction_t *flow_direction
|
||||
OpenAPI_flow_direction_e flow_direction
|
||||
);
|
||||
void OpenAPI_packet_filter_info_free(OpenAPI_packet_filter_info_t *packet_filter_info);
|
||||
OpenAPI_packet_filter_info_t *OpenAPI_packet_filter_info_parseFromJSON(cJSON *packet_filter_infoJSON);
|
||||
|
||||
@@ -5,7 +5,7 @@
|
||||
#include "partial_success_report.h"
|
||||
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
|
||||
OpenAPI_failure_cause_t *failure_cause,
|
||||
OpenAPI_failure_cause_e failure_cause,
|
||||
OpenAPI_list_t *rule_reports,
|
||||
OpenAPI_list_t *sess_rule_reports,
|
||||
OpenAPI_ue_camping_rep_t *ue_camping_rep
|
||||
@@ -29,7 +29,6 @@ void OpenAPI_partial_success_report_free(OpenAPI_partial_success_report_t *parti
|
||||
return;
|
||||
}
|
||||
OpenAPI_lnode_t *node;
|
||||
OpenAPI_failure_cause_free(partial_success_report->failure_cause);
|
||||
OpenAPI_list_for_each(partial_success_report->rule_reports, node) {
|
||||
OpenAPI_rule_report_free(node->data);
|
||||
}
|
||||
@@ -56,13 +55,7 @@ cJSON *OpenAPI_partial_success_report_convertToJSON(OpenAPI_partial_success_repo
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
cJSON *failure_cause_local_JSON = OpenAPI_failure_cause_convertToJSON(partial_success_report->failure_cause);
|
||||
if (failure_cause_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "failureCause", failure_cause_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "failureCause", OpenAPI_failure_cause_ToString(partial_success_report->failure_cause)) == NULL) {
|
||||
ogs_error("OpenAPI_partial_success_report_convertToJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
@@ -133,9 +126,13 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(c
|
||||
goto end;
|
||||
}
|
||||
|
||||
OpenAPI_failure_cause_t *failure_cause_local_nonprim = NULL;
|
||||
OpenAPI_failure_cause_e failure_causeVariable;
|
||||
|
||||
failure_cause_local_nonprim = OpenAPI_failure_cause_parseFromJSON(failure_cause);
|
||||
if (!cJSON_IsString(failure_cause)) {
|
||||
ogs_error("OpenAPI_partial_success_report_parseFromJSON() failed [failure_cause]");
|
||||
goto end;
|
||||
}
|
||||
failure_causeVariable = OpenAPI_failure_cause_FromString(failure_cause->valuestring);
|
||||
|
||||
cJSON *rule_reports = cJSON_GetObjectItemCaseSensitive(partial_success_reportJSON, "ruleReports");
|
||||
|
||||
@@ -191,7 +188,7 @@ OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_parseFromJSON(c
|
||||
}
|
||||
|
||||
partial_success_report_local_var = OpenAPI_partial_success_report_create (
|
||||
failure_cause_local_nonprim,
|
||||
failure_causeVariable,
|
||||
rule_reports ? rule_reportsList : NULL,
|
||||
sess_rule_reports ? sess_rule_reportsList : NULL,
|
||||
ue_camping_rep ? ue_camping_rep_local_nonprim : NULL
|
||||
|
||||
@@ -23,14 +23,14 @@ extern "C" {
|
||||
|
||||
typedef struct OpenAPI_partial_success_report_s OpenAPI_partial_success_report_t;
|
||||
typedef struct OpenAPI_partial_success_report_s {
|
||||
struct OpenAPI_failure_cause_s *failure_cause;
|
||||
OpenAPI_failure_cause_e failure_cause;
|
||||
OpenAPI_list_t *rule_reports;
|
||||
OpenAPI_list_t *sess_rule_reports;
|
||||
struct OpenAPI_ue_camping_rep_s *ue_camping_rep;
|
||||
} OpenAPI_partial_success_report_t;
|
||||
|
||||
OpenAPI_partial_success_report_t *OpenAPI_partial_success_report_create(
|
||||
OpenAPI_failure_cause_t *failure_cause,
|
||||
OpenAPI_failure_cause_e failure_cause,
|
||||
OpenAPI_list_t *rule_reports,
|
||||
OpenAPI_list_t *sess_rule_reports,
|
||||
OpenAPI_ue_camping_rep_t *ue_camping_rep
|
||||
|
||||
@@ -10,7 +10,7 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_create(
|
||||
int cont_ver,
|
||||
char *pcc_rule_id,
|
||||
int precedence,
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol,
|
||||
OpenAPI_af_sig_protocol_e af_sig_protocol,
|
||||
int app_reloc,
|
||||
OpenAPI_list_t *ref_qos_data,
|
||||
OpenAPI_list_t *ref_alt_qos_params,
|
||||
@@ -65,7 +65,6 @@ void OpenAPI_pcc_rule_free(OpenAPI_pcc_rule_t *pcc_rule)
|
||||
OpenAPI_list_free(pcc_rule->flow_infos);
|
||||
ogs_free(pcc_rule->app_id);
|
||||
ogs_free(pcc_rule->pcc_rule_id);
|
||||
OpenAPI_af_sig_protocol_free(pcc_rule->af_sig_protocol);
|
||||
OpenAPI_list_for_each(pcc_rule->ref_qos_data, node) {
|
||||
ogs_free(node->data);
|
||||
}
|
||||
@@ -165,13 +164,7 @@ cJSON *OpenAPI_pcc_rule_convertToJSON(OpenAPI_pcc_rule_t *pcc_rule)
|
||||
}
|
||||
|
||||
if (pcc_rule->af_sig_protocol) {
|
||||
cJSON *af_sig_protocol_local_JSON = OpenAPI_af_sig_protocol_convertToJSON(pcc_rule->af_sig_protocol);
|
||||
if (af_sig_protocol_local_JSON == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
|
||||
goto end;
|
||||
}
|
||||
cJSON_AddItemToObject(item, "afSigProtocol", af_sig_protocol_local_JSON);
|
||||
if (item->child == NULL) {
|
||||
if (cJSON_AddStringToObject(item, "afSigProtocol", OpenAPI_af_sig_protocol_ToString(pcc_rule->af_sig_protocol)) == NULL) {
|
||||
ogs_error("OpenAPI_pcc_rule_convertToJSON() failed [af_sig_protocol]");
|
||||
goto end;
|
||||
}
|
||||
@@ -423,9 +416,13 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON)
|
||||
|
||||
cJSON *af_sig_protocol = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "afSigProtocol");
|
||||
|
||||
OpenAPI_af_sig_protocol_t *af_sig_protocol_local_nonprim = NULL;
|
||||
OpenAPI_af_sig_protocol_e af_sig_protocolVariable;
|
||||
if (af_sig_protocol) {
|
||||
af_sig_protocol_local_nonprim = OpenAPI_af_sig_protocol_parseFromJSON(af_sig_protocol);
|
||||
if (!cJSON_IsString(af_sig_protocol)) {
|
||||
ogs_error("OpenAPI_pcc_rule_parseFromJSON() failed [af_sig_protocol]");
|
||||
goto end;
|
||||
}
|
||||
af_sig_protocolVariable = OpenAPI_af_sig_protocol_FromString(af_sig_protocol->valuestring);
|
||||
}
|
||||
|
||||
cJSON *app_reloc = cJSON_GetObjectItemCaseSensitive(pcc_ruleJSON, "appReloc");
|
||||
@@ -635,7 +632,7 @@ OpenAPI_pcc_rule_t *OpenAPI_pcc_rule_parseFromJSON(cJSON *pcc_ruleJSON)
|
||||
cont_ver ? cont_ver->valuedouble : 0,
|
||||
ogs_strdup(pcc_rule_id->valuestring),
|
||||
precedence ? precedence->valuedouble : 0,
|
||||
af_sig_protocol ? af_sig_protocol_local_nonprim : NULL,
|
||||
af_sig_protocol ? af_sig_protocolVariable : 0,
|
||||
app_reloc ? app_reloc->valueint : 0,
|
||||
ref_qos_data ? ref_qos_dataList : NULL,
|
||||
ref_alt_qos_params ? ref_alt_qos_paramsList : NULL,
|
||||
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user