mirror of
https://github.com/open5gs/open5gs.git
synced 2025-11-06 15:03:24 +00:00
Compare commits
142 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
2ac74ef6ac | ||
|
|
aeedf01d6a | ||
|
|
8902411afe | ||
|
|
1a26354f29 | ||
|
|
712b9c8334 | ||
|
|
693afa922f | ||
|
|
058ebc747d | ||
|
|
5ca6d79590 | ||
|
|
652cfa70d5 | ||
|
|
bbc594330b | ||
|
|
c284ef7429 | ||
|
|
95586eaf09 | ||
|
|
eca47a2773 | ||
|
|
0e0a69ed7c | ||
|
|
5ce95f94ee | ||
|
|
6b0561681f | ||
|
|
d0417d353a | ||
|
|
4013d9203c | ||
|
|
fba54b09eb | ||
|
|
8a711191b3 | ||
|
|
f53e80eec7 | ||
|
|
fa454209a9 | ||
|
|
7ee0b3324b | ||
|
|
bfa526d221 | ||
|
|
6816400247 | ||
|
|
3b26983db9 | ||
|
|
eab4958a81 | ||
|
|
e2aa8ec198 | ||
|
|
ec7d9f2917 | ||
|
|
0be339e52d | ||
|
|
fa81c86e22 | ||
|
|
1f838c0f68 | ||
|
|
aa0001c78b | ||
|
|
c49bda5173 | ||
|
|
bb703243c6 | ||
|
|
f3a6620a65 | ||
|
|
cb00bf848e | ||
|
|
343c72b288 | ||
|
|
bcd784b1f0 | ||
|
|
c855546d77 | ||
|
|
f550919df1 | ||
|
|
f6a8985267 | ||
|
|
1542d70af6 | ||
|
|
3d154cc423 | ||
|
|
fbc73230b0 | ||
|
|
55164b4a1f | ||
|
|
c52cf33c3c | ||
|
|
eb0d8075ef | ||
|
|
d3476eca6d | ||
|
|
9e3ebf9a16 | ||
|
|
88217ff11e | ||
|
|
a550cf5b1d | ||
|
|
d7131dc2e1 | ||
|
|
22c3d66bc3 | ||
|
|
f28f3003c5 | ||
|
|
c530e1cbcf | ||
|
|
3c61858f21 | ||
|
|
477f16ad0b | ||
|
|
75a18a30cf | ||
|
|
a32465ed07 | ||
|
|
7bc245028a | ||
|
|
56567fec12 | ||
|
|
dc7f9d8e12 | ||
|
|
57af70fab9 | ||
|
|
71f1b1cfa4 | ||
|
|
60dc4402c6 | ||
|
|
d4f00da662 | ||
|
|
0ff388fb19 | ||
|
|
ca742661f6 | ||
|
|
c849cc802c | ||
|
|
4fc1e0e22c | ||
|
|
d41ce4d8b1 | ||
|
|
8dc5211448 | ||
|
|
24da20bdc8 | ||
|
|
70b2e51f79 | ||
|
|
9e4d3cb824 | ||
|
|
10675caf89 | ||
|
|
fb1908410e | ||
|
|
b9c0feb40e | ||
|
|
29a50892b5 | ||
|
|
f7ef0f3aab | ||
|
|
5f4b42cbfc | ||
|
|
681a7c87a4 | ||
|
|
a03df8d656 | ||
|
|
a7053eb926 | ||
|
|
fe91a72271 | ||
|
|
5693c0c730 | ||
|
|
eb8b7e96d7 | ||
|
|
85bedf1e35 | ||
|
|
8f8caf5177 | ||
|
|
756859d05c | ||
|
|
d4023da087 | ||
|
|
f384bdef3d | ||
|
|
4cdc891898 | ||
|
|
7abd6b5ab9 | ||
|
|
8a7634d00c | ||
|
|
1f752e51e8 | ||
|
|
282936f215 | ||
|
|
60bfaa2c41 | ||
|
|
937f0319e3 | ||
|
|
32c9c512d8 | ||
|
|
163bc4a040 | ||
|
|
58faa7bcac | ||
|
|
61d0573686 | ||
|
|
f0c84d3037 | ||
|
|
69cfb3280c | ||
|
|
d597912abb | ||
|
|
34e2b4d44a | ||
|
|
241efaf581 | ||
|
|
335e8513e9 | ||
|
|
cbb819f6b9 | ||
|
|
2267a59cc3 | ||
|
|
550be1cd95 | ||
|
|
338f359285 | ||
|
|
3da632dd1e | ||
|
|
8b782eb370 | ||
|
|
5bca0920b9 | ||
|
|
bd1c505024 | ||
|
|
1ed22fe7b2 | ||
|
|
71367627a8 | ||
|
|
88d0a53956 | ||
|
|
4d7b6c04c5 | ||
|
|
e032565991 | ||
|
|
f19f714136 | ||
|
|
94797e7d7a | ||
|
|
581f4feb97 | ||
|
|
7c1c320141 | ||
|
|
244770de65 | ||
|
|
68ac111bd5 | ||
|
|
56556195a9 | ||
|
|
9be8d1fd00 | ||
|
|
cdffdcaa78 | ||
|
|
ed803b27cb | ||
|
|
314642fe1a | ||
|
|
d58ddcb3ae | ||
|
|
60277dcf05 | ||
|
|
77b8656dc3 | ||
|
|
0f892f6e84 | ||
|
|
8ae096f77e | ||
|
|
6c99b7c187 | ||
|
|
fe68841456 | ||
|
|
314a1cd4be |
19
.gitignore
vendored
19
.gitignore
vendored
@@ -46,17 +46,18 @@ m4/*.m4
|
|||||||
.version
|
.version
|
||||||
|
|
||||||
# autotest
|
# autotest
|
||||||
test/package.m4
|
tests/package.m4
|
||||||
test/atconfig
|
tests/atconfig
|
||||||
test/testsuite
|
tests/testsuite
|
||||||
test/testsuite.dir/
|
tests/testsuite.dir/
|
||||||
test/testsuite.log
|
tests/testsuite.log
|
||||||
|
|
||||||
# executables
|
# executables
|
||||||
test/testunit
|
tests/testunit
|
||||||
test/testsimple
|
tests/testsimple
|
||||||
test/testcomplex
|
tests/testcomplex
|
||||||
test/testvolte
|
tests/testvolte
|
||||||
|
tests/testcsfb
|
||||||
nextepc-mmed
|
nextepc-mmed
|
||||||
nextepc-pcrfd
|
nextepc-pcrfd
|
||||||
nextepc-pgwd
|
nextepc-pgwd
|
||||||
|
|||||||
@@ -18,7 +18,7 @@
|
|||||||
ACLOCAL_AMFLAGS = -I m4
|
ACLOCAL_AMFLAGS = -I m4
|
||||||
EXTRA_DIST = build/git-version-gen .version README.md LICENSE
|
EXTRA_DIST = build/git-version-gen .version README.md LICENSE
|
||||||
|
|
||||||
SUBDIRS = lib src support test
|
SUBDIRS = lib src support tests
|
||||||
|
|
||||||
bin_PROGRAMS = nextepc-mmed nextepc-hssd nextepc-sgwd nextepc-pgwd nextepc-pcrfd nextepc-epcd
|
bin_PROGRAMS = nextepc-mmed nextepc-hssd nextepc-sgwd nextepc-pgwd nextepc-pcrfd nextepc-epcd
|
||||||
|
|
||||||
|
|||||||
11
configure.ac
11
configure.ac
@@ -24,7 +24,7 @@ AC_INIT([NextEPC],
|
|||||||
|
|
||||||
AC_CONFIG_AUX_DIR([build])
|
AC_CONFIG_AUX_DIR([build])
|
||||||
AC_CONFIG_MACRO_DIR([m4])
|
AC_CONFIG_MACRO_DIR([m4])
|
||||||
AC_CONFIG_TESTDIR(test)
|
AC_CONFIG_TESTDIR(tests)
|
||||||
AC_CANONICAL_HOST
|
AC_CANONICAL_HOST
|
||||||
|
|
||||||
AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects])
|
AM_INIT_AUTOMAKE([1.10 -Wall -Werror foreign subdir-objects])
|
||||||
@@ -211,10 +211,11 @@ AC_CONFIG_FILES([support/logrotate/Makefile])
|
|||||||
AC_CONFIG_FILES([support/newsyslog/nextepc.conf])
|
AC_CONFIG_FILES([support/newsyslog/nextepc.conf])
|
||||||
AC_CONFIG_FILES([support/newsyslog/Makefile])
|
AC_CONFIG_FILES([support/newsyslog/Makefile])
|
||||||
AC_CONFIG_FILES([support/Makefile])
|
AC_CONFIG_FILES([support/Makefile])
|
||||||
AC_CONFIG_FILES([test/sample.conf])
|
AC_CONFIG_FILES([tests/sample.conf])
|
||||||
AC_CONFIG_FILES([test/sample-simple.conf])
|
AC_CONFIG_FILES([tests/sample-simple.conf])
|
||||||
AC_CONFIG_FILES([test/sample-volte.conf])
|
AC_CONFIG_FILES([tests/sample-volte.conf])
|
||||||
AC_CONFIG_FILES([test/Makefile])
|
AC_CONFIG_FILES([tests/sample-csfb.conf])
|
||||||
|
AC_CONFIG_FILES([tests/Makefile])
|
||||||
AC_CONFIG_FILES([Makefile])
|
AC_CONFIG_FILES([Makefile])
|
||||||
AC_OUTPUT
|
AC_OUTPUT
|
||||||
|
|
||||||
|
|||||||
36
debian/changelog
vendored
36
debian/changelog
vendored
@@ -1,3 +1,39 @@
|
|||||||
|
nextepc (0.4.3) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Bug Fixed
|
||||||
|
|
||||||
|
-- Sukchan Lee <acetcom@gmail.com> Sat, 22 Jun 2019 03:30:10 +0000
|
||||||
|
|
||||||
|
nextepc (0.4.2~xenial) xenial; urgency=medium
|
||||||
|
|
||||||
|
* Bug Fixed
|
||||||
|
|
||||||
|
-- Sukchan Lee <acetcom@gmail.com> Tue, 28 May 2019 20:11:51 +0900
|
||||||
|
|
||||||
|
nextepc (0.4.2~bionic) bionic; urgency=medium
|
||||||
|
|
||||||
|
* Bug Fixed
|
||||||
|
|
||||||
|
-- Sukchan Lee <acetcom@gmail.com> Tue, 28 May 2019 20:09:02 +0900
|
||||||
|
|
||||||
|
nextepc (0.4.2) unstable; urgency=medium
|
||||||
|
|
||||||
|
* Bug Fixed
|
||||||
|
|
||||||
|
-- Sukchan Lee <acetcom@gmail.com> Tue, 28 May 2019 20:04:53 +0900
|
||||||
|
|
||||||
|
nextepc (0.4.1~bionic) bionic; urgency=medium
|
||||||
|
|
||||||
|
* Bug Fixed
|
||||||
|
|
||||||
|
-- Sukchan Lee <acetcom@gmail.com> Sat, 18 May 2019 09:59:17 +0000
|
||||||
|
|
||||||
|
nextepc (0.4.1~xenial) xenial; urgency=medium
|
||||||
|
|
||||||
|
* Bug Fixed
|
||||||
|
|
||||||
|
-- Sukchan Lee <acetcom@gmail.com> Sat, 18 May 2019 09:57:44 +0000
|
||||||
|
|
||||||
nextepc (0.4.1) unstable; urgency=medium
|
nextepc (0.4.1) unstable; urgency=medium
|
||||||
|
|
||||||
* Bug Fixed
|
* Bug Fixed
|
||||||
|
|||||||
2
debian/rules
vendored
2
debian/rules
vendored
@@ -22,7 +22,7 @@ override_dh_auto_test:
|
|||||||
if ! cat /proc/net/protocols | grep SCTP > /dev/null; then \
|
if ! cat /proc/net/protocols | grep SCTP > /dev/null; then \
|
||||||
sctp_exclude_list="-x sctp-test"; \
|
sctp_exclude_list="-x sctp-test"; \
|
||||||
fi; \
|
fi; \
|
||||||
test/testunit -f test/sample.conf $$sctp_exclude_list || exit; \
|
tests/testunit -f ./tests/sample.conf $$sctp_exclude_list || exit; \
|
||||||
|
|
||||||
#override_dh_makeshlibs:
|
#override_dh_makeshlibs:
|
||||||
# dh_makeshlibs -V
|
# dh_makeshlibs -V
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
---
|
---
|
||||||
title: Qucikstart
|
title: Quickstart
|
||||||
---
|
---
|
||||||
|
|
||||||
**Note:** NextEPC supports installation of packages in *Debian/Ubuntu and openSUSE* environments. *CentOS, Fedora, FreeBSD, and Mac OSX* require you to [build with source code]({{ site.url }}{{ site.baseurl }}/docs/guide/02-building-nextepc-from-sources)
|
**Note:** NextEPC supports installation of packages in *Debian/Ubuntu and openSUSE* environments. *CentOS, Fedora, FreeBSD, and Mac OSX* require you to [build with source code]({{ site.url }}{{ site.baseurl }}/docs/guide/02-building-nextepc-from-sources)
|
||||||
@@ -121,7 +121,7 @@ $ sudo systemctl restart nextepc-sgwd
|
|||||||
```bash
|
```bash
|
||||||
$ sudo apt update
|
$ sudo apt update
|
||||||
$ sudo apt install curl
|
$ sudo apt install curl
|
||||||
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||||
$ sudo apt install nodejs
|
$ sudo apt install nodejs
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -165,17 +165,44 @@ To add subscriber information, you can do WebUI operations in the following orde
|
|||||||
If your phone can connect to internet, you must run the following command in NextEPC-PGW installed host.
|
If your phone can connect to internet, you must run the following command in NextEPC-PGW installed host.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
### Check IP Tables
|
||||||
|
$ sudo iptables -L
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain FORWARD (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Check NAT Tables
|
||||||
|
$ sudo iptables -L -t nat
|
||||||
|
Chain PREROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain POSTROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Enable IPv4 Forwarding
|
||||||
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||||
$ sudo iptables -t nat -A POSTROUTING -o 'interface-name' -j MASQUERADE
|
|
||||||
$ sudo iptables -I INPUT -i pgwtun -j ACCEPT
|
### Add NAT Rule
|
||||||
|
$ sudo iptables -t nat -A POSTROUTING -s 45.45.0.0/16 ! -o pgwtun -j MASQUERADE
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** In the above command, you should replace `'interface-name'` with your interface name that can connect to the internet. (For example, `enp0s25`, `wls3`, and so on).
|
**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}
|
{: .notice--danger}
|
||||||
|
|
||||||
### Turn on your eNodeB and Phone
|
### Turn on your eNodeB and Phone
|
||||||
---
|
---
|
||||||
|
- Connect your eNodeB to the IP of your server via the standard S1AP port of SCTP 36412 (for MME)
|
||||||
- You can see actual traffic through wireshark -- [[srsenb.pcapng]]({{ site.url }}{{ site.baseurl }}/assets/pcapng/srsenb.pcapng).
|
- 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/nextepc/*.log`.
|
- You can view the log at `/var/log/nextepc/*.log`.
|
||||||
|
|
||||||
@@ -217,7 +244,8 @@ How to remove NextEPC package:
|
|||||||
1. On *Ubuntu*:
|
1. On *Ubuntu*:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo apt purge nextepc*
|
$ sudo apt purge nextepc
|
||||||
|
$ sudo apt autoremove
|
||||||
```
|
```
|
||||||
|
|
||||||
2. On *openSUSE*:
|
2. On *openSUSE*:
|
||||||
|
|||||||
@@ -186,7 +186,7 @@ Arguments:
|
|||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ sudo apt install curl
|
$ sudo apt install curl
|
||||||
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||||
$ sudo apt install nodejs
|
$ sudo apt install nodejs
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -231,13 +231,39 @@ To add subscriber information, you can do WebUI operations in the following orde
|
|||||||
If your phone can connect to internet, you must run the following command in NextEPC-PGW installed host.
|
If your phone can connect to internet, you must run the following command in NextEPC-PGW installed host.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
### Check IP Tables
|
||||||
|
$ sudo iptables -L
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain FORWARD (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Check NAT Tables
|
||||||
|
$ sudo iptables -L -t nat
|
||||||
|
Chain PREROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain POSTROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Enable IPv4 Forwarding
|
||||||
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||||
$ sudo iptables -t nat -A POSTROUTING -o 'interface-name' -j MASQUERADE
|
|
||||||
$ sudo iptables -I INPUT -i pgwtun -j ACCEPT
|
### Add NAT Rule
|
||||||
|
$ sudo iptables -t nat -A POSTROUTING -s 45.45.0.0/16 ! -o pgwtun -j MASQUERADE
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** In the above command, you should replace `'interface-name'` with your interface name that can connect to the internet. (For example, `enp0s25`, `wls3`, and so on).
|
**Note:** 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 eNodeB and Phone
|
### Turn on your eNodeB and Phone
|
||||||
---
|
---
|
||||||
|
|||||||
@@ -75,8 +75,13 @@ To compile with autotools:
|
|||||||
➜ nextepc git:(master) ✗ make -j `nproc`
|
➜ nextepc git:(master) ✗ make -j `nproc`
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** On MAC OS X, the compilation check is not supported at this point.
|
Check whether the compilation is correct.
|
||||||
|
|
||||||
|
**Note:** This should require *sudo* due to access `/dev/tun0`.
|
||||||
{: .notice--danger}
|
{: .notice--danger}
|
||||||
|
```bash
|
||||||
|
➜ nextepc git:(master) ✗ sudo make check
|
||||||
|
```
|
||||||
|
|
||||||
You need to perform **the installation process**.
|
You need to perform **the installation process**.
|
||||||
```bash
|
```bash
|
||||||
|
|||||||
@@ -10,28 +10,105 @@ This post is the perfect starting point for learning to build your own LTE netwo
|
|||||||
|
|
||||||
First, you have to prepare USRP B200/B210 to run srsENB. However, please keep in mind that you would still need a fairly high-end PC (at least dual-core i5, better quad-core i7) with USB 3.0 to attach the USRP B200/B210.
|
First, you have to prepare USRP B200/B210 to run srsENB. However, please keep in mind that you would still need a fairly high-end PC (at least dual-core i5, better quad-core i7) with USB 3.0 to attach the USRP B200/B210.
|
||||||
|
|
||||||
Also, for USRP B200/B210 you will need a GPS antenna for clock synchronization. It is good to have a window near your desk where you can put the small GPS patch antenna. In my case, a 1 to 2 meters antenna cable is used between desk/computer and the window.
|
For USRP B200/B210, you can use a GPS antenna for clock synchronization. Of course, it can work without a GPS antenna, but if you have that antenna, it's a good to have a window near your desk where you can put the small GPS patch antenna. In my case, a 1 to 2 meters antenna cable is used between desk/computer and the window.
|
||||||
|
|
||||||
For stable operation of USRP B200/B210, I used 10Mhz GPS-DO(GPS disciplined oscillator). Of course, a USIM card(sysmoUSIM-SJS1) was also inserted into the phone.
|
This document will be described with the following equipment.
|
||||||
|
- i5-8500 PC with Ubuntu 18.04(bionic)
|
||||||
|
- USRP B200/B210 with USB 3.0
|
||||||
|
- iPhone XS
|
||||||
|
- sysmoUSIM-SJS1
|
||||||
|
- 10Mhz GPS-DO(Optional)
|
||||||
|
|
||||||
### Overall Physical Setup
|
### Overall Physical Setup
|
||||||
---
|
---
|
||||||
|
|
||||||
Setup your devices in the following order:
|
If you want to use GPS antenna, setup your devices in the following order:
|
||||||
|
|
||||||
1. GPS antenna near window
|
1. GPS antenna near window
|
||||||
2. GPS antenna connected to "GPS ANT" connector of GPS-DO (SMA)
|
2. GPS antenna connected to "GPS ANT" connector of GPS-DO (SMA)
|
||||||
3. 10MHz output (BNC) of GPS-DO connected to 10MHz input of USRP (SMA)
|
3. 10MHz output (BNC) of GPS-DO connected to 10MHz input of USRP (SMA)
|
||||||
4. GPS input of USRP open/unused!
|
4. GPS input of USRP open/unused!
|
||||||
5. 1PPS input of USRP open/unused!
|
5. 1PPS input of USRP open/unused!
|
||||||
6. 4x Small Antennas connected to USRP Rx/Tx ports (RF-A/RF-B)
|
6. GPS-DO powered via power supply
|
||||||
7. USRP powered via power supply or over USB
|
|
||||||
8. USRP USB port connected to your PC
|
|
||||||
9. GPS-DO powered via power supply
|
|
||||||
|
|
||||||
**Note:** When the GPS-DO acquires a lock on the GPS signal, a **GREEN** LED is displayed. GPS takes time to function normally. You also need to wait for the **RED** LED(ALARM) to turn off.
|
**Note:** When the GPS-DO acquires a lock on the GPS signal, a **GREEN** LED is displayed. GPS takes time to function normally. You also need to wait for the **RED** LED(ALARM) to turn off.
|
||||||
{: .notice--warning}
|
{: .notice--warning}
|
||||||
|
|
||||||
|
Then, setup the USRP B200/B210 as below:
|
||||||
|
1. **4x Small Antennas** should be connected to USRP Rx/Tx ports (RF-A/RF-B)
|
||||||
|
2. USRP powered via power supply or over **USB 3.0**
|
||||||
|
3. USRP **USB 3.0** port connected to your PC
|
||||||
|
|
||||||
|
### USIM Setup
|
||||||
|
---
|
||||||
|
|
||||||
|
Bascially, you can learn how to use it in the [sysmoUSIM manual](https://www.sysmocom.de/manuals/sysmousim-manual.pdf) or on the [official homepage of pysim project](http://osmocom.org/projects/pysim/wiki). Let's take a quickstart guide for this experiment.
|
||||||
|
|
||||||
|
###### Install dependencies:
|
||||||
|
```
|
||||||
|
$ sudo apt-get install pcscd pcsc-tools libccid libpcsclite-dev python-pyscard
|
||||||
|
```
|
||||||
|
- Connect SIM card reader to your computer and insert programmable SIM card to the reader.
|
||||||
|
|
||||||
|
###### Check the status of connection by entering the following command:
|
||||||
|
```
|
||||||
|
$ pcsc_scan
|
||||||
|
PC/SC device scanner
|
||||||
|
V 1.5.2 (c) 2001-2017, Ludovic Rousseau <ludovic.rousseau@free.fr>
|
||||||
|
Using reader plug'n play mechanism
|
||||||
|
Scanning present readers...
|
||||||
|
0: HID Global OMNIKEY 3x21 Smart Card Reader [OMNIKEY 3x21 Smart Card Reader] 00
|
||||||
|
|
||||||
|
Sun May 26 14:26:12 2019
|
||||||
|
Reader 0: HID Global OMNIKEY 3x21 Smart Card Reader [OMNIKEY 3x21 Smart Card Re
|
||||||
|
Card state: Card inserted,
|
||||||
|
ATR: 3B 9F 96 80 1F C7 80 31 A0 73 BE 21 13 67 43 20 07 18 00 00 01 A5
|
||||||
|
...
|
||||||
|
```
|
||||||
|
- If SIM card reader is recognized then we can expect to print "Card inserted".
|
||||||
|
|
||||||
|
###### Get the code of PySIM with installing dependency:
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo apt-get install python-pyscard python-serial python-pip
|
||||||
|
$ pip install pytlv
|
||||||
|
$ git clone git://git.osmocom.org/pysim
|
||||||
|
```
|
||||||
|
|
||||||
|
###### Read your SIM card:
|
||||||
|
```
|
||||||
|
$ ./pySim-read.py -p0 or ./pySim-read.py -p1
|
||||||
|
Using PC/SC reader (dev=0) interface
|
||||||
|
Reading ...
|
||||||
|
ICCID: 8988211000000213010
|
||||||
|
IMSI: 310789012345301
|
||||||
|
SMSP: ffffffffffffffffffffffffffffffffffffffffffffffffe1ffffffffffffffffffffffff
|
||||||
|
...
|
||||||
|
```
|
||||||
|
|
||||||
|
###### Program your SIM card like the followings:
|
||||||
|
```
|
||||||
|
./pySim-prog.py -p 0 -n NextEPC -a 62416296 -s 8988211000000213010 -i 310789012345301 -x 310 -y 789 -k 82E9053A1882085FF2C020359938DAE9 -o BFD5771AAF4F6728E9BC6EF2C2533BDB
|
||||||
|
Using PC/SC reader (dev=0) interface
|
||||||
|
Insert card now (or CTRL-C to cancel)
|
||||||
|
Autodetected card type: sysmoUSIM-SJS1
|
||||||
|
Generated card parameters :
|
||||||
|
> Name : NextEPC
|
||||||
|
> SMSP : e1ffffffffffffffffffffffff0581005155f5ffffffffffff000000
|
||||||
|
> ICCID : 8988211000000213010
|
||||||
|
> MCC/MNC : 310/789
|
||||||
|
> IMSI : 310789012345301
|
||||||
|
> Ki : 82E9053A1882085FF2C020359938DAE9
|
||||||
|
> OPC : BFD5771AAF4F6728E9BC6EF2C2533BDB
|
||||||
|
> ACC : None
|
||||||
|
|
||||||
|
Programming ...
|
||||||
|
Done !
|
||||||
|
```
|
||||||
|
|
||||||
|
**Note:** You should use your ADM value to program USIM card, not my ADM(-a 62416296).
|
||||||
|
{: .notice--warning}
|
||||||
|
|
||||||
### Installation
|
### Installation
|
||||||
---
|
---
|
||||||
|
|
||||||
@@ -93,7 +170,7 @@ $ sudo apt install nextepc
|
|||||||
The following shows how to install the Web UI of NextEPC.
|
The following shows how to install the Web UI of NextEPC.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
$ curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
|
$ curl -sL https://deb.nodesource.com/setup_12.x | sudo -E bash -
|
||||||
$ sudo apt install nodejs
|
$ sudo apt install nodejs
|
||||||
$ curl -sL http://nextepc.org/static/webui/install | sudo -E bash -
|
$ curl -sL http://nextepc.org/static/webui/install | sudo -E bash -
|
||||||
```
|
```
|
||||||
@@ -116,11 +193,20 @@ IMSI ICCID ACC PIN1 PUK1 PIN2 PUK2 Ki OPC ADM1 KIC1 KID1
|
|||||||
Here's my subscriber information from above.
|
Here's my subscriber information from above.
|
||||||
|
|
||||||
```
|
```
|
||||||
|
MCC/MNC : 901/70
|
||||||
IMSI : 901700000017408
|
IMSI : 901700000017408
|
||||||
K : B1233463AB9BC2AD2DB1830EB6417E7B
|
K : B1233463AB9BC2AD2DB1830EB6417E7B
|
||||||
OPc : 625150E2A943E3353DD23554101CAFD4
|
OPc : 625150E2A943E3353DD23554101CAFD4
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you programmed USIM using a card reader like me, you should use your SIM information.
|
||||||
|
```
|
||||||
|
MCC/MNC : 310/789
|
||||||
|
IMSI : 310789012345301
|
||||||
|
K : 82E9053A1882085FF2C020359938DAE9
|
||||||
|
OPc : BFD5771AAF4F6728E9BC6EF2C2533BDB
|
||||||
|
```
|
||||||
|
|
||||||
Connect to `http://localhost:3000` and login with **admin** account.
|
Connect to `http://localhost:3000` and login with **admin** account.
|
||||||
|
|
||||||
> Username : admin
|
> Username : admin
|
||||||
@@ -150,8 +236,8 @@ diff -u mme.conf.old mme.conf
|
|||||||
plmn_id:
|
plmn_id:
|
||||||
- mcc: 001
|
- mcc: 001
|
||||||
- mnc: 01
|
- mnc: 01
|
||||||
+ mcc: 901
|
+ mcc: 310
|
||||||
+ mnc: 70
|
+ mnc: 789
|
||||||
mme_gid: 2
|
mme_gid: 2
|
||||||
mme_code: 1
|
mme_code: 1
|
||||||
tai:
|
tai:
|
||||||
@@ -159,8 +245,8 @@ diff -u mme.conf.old mme.conf
|
|||||||
- mcc: 001
|
- mcc: 001
|
||||||
- mnc: 01
|
- mnc: 01
|
||||||
- tac: 12345
|
- tac: 12345
|
||||||
+ mcc: 901
|
+ mcc: 310
|
||||||
+ mnc: 70
|
+ mnc: 789
|
||||||
+ tac: 7
|
+ tac: 7
|
||||||
security:
|
security:
|
||||||
integrity_order : [ EIA1, EIA2, EIA0 ]
|
integrity_order : [ EIA1, EIA2, EIA0 ]
|
||||||
@@ -172,7 +258,7 @@ S1AP/GTP-C IP address, PLMN ID, TAC are changed as follows.
|
|||||||
```
|
```
|
||||||
S1AP address : 127.0.1.100 - srsENB default value
|
S1AP address : 127.0.1.100 - srsENB default value
|
||||||
GTP-C address : 127.0.1.100 - Use loopback interface
|
GTP-C address : 127.0.1.100 - Use loopback interface
|
||||||
PLMN ID : MNC(901), MCC(70) - sysmoUSIM default value
|
PLMN ID : MNC(310), MCC(789) - Programmed USIM with a card reader
|
||||||
TAC : 7 - srsENB default value
|
TAC : 7 - srsENB default value
|
||||||
```
|
```
|
||||||
|
|
||||||
@@ -200,12 +286,39 @@ $ sudo systemctl restart nextepc-sgwd
|
|||||||
If your phone can connect to internet, you must run the following command in NextEPC-PGW installed host.
|
If your phone can connect to internet, you must run the following command in NextEPC-PGW installed host.
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
|
### Check IP Tables
|
||||||
|
$ sudo iptables -L
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain FORWARD (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Check NAT Tables
|
||||||
|
$ sudo iptables -L -t nat
|
||||||
|
Chain PREROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain POSTROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Enable IPv4 Forwarding
|
||||||
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||||
$ sudo iptables -t nat -A POSTROUTING -o 'interface-name' -j MASQUERADE
|
|
||||||
$ sudo iptables -I INPUT -i pgwtun -j ACCEPT
|
### Add NAT Rule
|
||||||
|
$ sudo iptables -t nat -A POSTROUTING -s 45.45.0.0/16 ! -o pgwtun -j MASQUERADE
|
||||||
```
|
```
|
||||||
|
|
||||||
**Note:** In the above command, you should replace `'interface-name'` with your interface name that can connect to the internet. (For example, `enp0s25`, `wls3`, and so on).
|
**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}
|
{: .notice--danger}
|
||||||
|
|
||||||
#### 2. srsENB
|
#### 2. srsENB
|
||||||
@@ -229,8 +342,8 @@ You should check your phone frequency. If your phone does not support Band-3, yo
|
|||||||
tac = 0x0007
|
tac = 0x0007
|
||||||
-mcc = 001
|
-mcc = 001
|
||||||
-mnc = 01
|
-mnc = 01
|
||||||
+mcc = 901
|
+mcc = 310
|
||||||
+mnc = 70
|
+mnc = 789
|
||||||
mme_addr = 127.0.1.100
|
mme_addr = 127.0.1.100
|
||||||
gtp_bind_addr = 127.0.1.1
|
gtp_bind_addr = 127.0.1.1
|
||||||
s1c_bind_addr = 127.0.1.1
|
s1c_bind_addr = 127.0.1.1
|
||||||
@@ -253,11 +366,20 @@ You should check your phone frequency. If your phone does not support Band-3, yo
|
|||||||
PLMN ID, DL EARFCN, and Device Argument are updated as belows.
|
PLMN ID, DL EARFCN, and Device Argument are updated as belows.
|
||||||
|
|
||||||
```
|
```
|
||||||
PLMN ID : MNC(901), MCC(70) sysmoUSIM default value
|
PLMN ID : MNC(310), MCC(789) programmed USIM with a card reader
|
||||||
DL EARFCN : Band-3 - from your Phone
|
DL EARFCN : Band-3 - from your Phone
|
||||||
Device Argument : Clock source from external GPS-DO
|
Device Argument : Clock source from external GPS-DO
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you do not use the GPS-DO, you should use:
|
||||||
|
```diff
|
||||||
|
#device_name = auto
|
||||||
|
-#device_args = auto
|
||||||
|
+device_args = auto
|
||||||
|
#time_adv_nsamples = auto
|
||||||
|
#burst_preamble_us = auto
|
||||||
|
```
|
||||||
|
|
||||||
Now, run the srsENB as follows:
|
Now, run the srsENB as follows:
|
||||||
|
|
||||||
```bash
|
```bash
|
||||||
@@ -272,7 +394,7 @@ Reading configuration file ./enb.conf...
|
|||||||
Opening USRP with args: "",master_clock_rate=30.72e6
|
Opening USRP with args: "",master_clock_rate=30.72e6
|
||||||
-- Detected Device: B200
|
-- Detected Device: B200
|
||||||
-- Loading FPGA image: /usr/share/uhd/images/usrp_b200_fpga.bin... done
|
-- Loading FPGA image: /usr/share/uhd/images/usrp_b200_fpga.bin... done
|
||||||
-- Operating over USB 3.
|
-- Operating over 'USB 2'.
|
||||||
-- Detecting internal GPSDO.... 'No GPSDO found'
|
-- Detecting internal GPSDO.... 'No GPSDO found'
|
||||||
-- Initialize CODEC control...
|
-- Initialize CODEC control...
|
||||||
-- Initialize Radio control...
|
-- Initialize Radio control...
|
||||||
@@ -287,8 +409,9 @@ Setting Sampling frequency 11.52 MHz
|
|||||||
==== eNodeB started ===
|
==== eNodeB started ===
|
||||||
Type <t> to view trace
|
Type <t> to view trace
|
||||||
```
|
```
|
||||||
|
|
||||||
If you see the `No GPSDO found`, please exit the program with Ctrl-C.
|
If you see the `No GPSDO found`, please exit the program with Ctrl-C.
|
||||||
|
And also, if you see the `USB 2`, it will not be working properly.
|
||||||
|
|
||||||
The following console output is the correct result of srsENB.
|
The following console output is the correct result of srsENB.
|
||||||
```bash
|
```bash
|
||||||
linux; GNU C++ version 6.2.0 20161027; Boost_106200; UHD_003.009.005-0-unknow
|
linux; GNU C++ version 6.2.0 20161027; Boost_106200; UHD_003.009.005-0-unknow
|
||||||
|
|||||||
@@ -4,6 +4,211 @@ title: FAQ
|
|||||||
permalink: /faq/
|
permalink: /faq/
|
||||||
---
|
---
|
||||||
|
|
||||||
|
#### Is it possible to setup IP/NAT table along with Docker?
|
||||||
|
|
||||||
|
The following is the default docker IP/NAT table.
|
||||||
|
|
||||||
|
```
|
||||||
|
$ sudo iptables-save
|
||||||
|
# Generated by iptables-save v1.6.1 on Sat Jun 1 23:43:50 2019
|
||||||
|
*nat
|
||||||
|
:PREROUTING ACCEPT [74:4820]
|
||||||
|
:INPUT ACCEPT [4:208]
|
||||||
|
:OUTPUT ACCEPT [49:3659]
|
||||||
|
:POSTROUTING ACCEPT [49:3659]
|
||||||
|
:DOCKER - [0:0]
|
||||||
|
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
|
||||||
|
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
|
||||||
|
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
|
||||||
|
-A DOCKER -i docker0 -j RETURN
|
||||||
|
COMMIT
|
||||||
|
# Completed on Sat Jun 1 23:43:50 2019
|
||||||
|
# Generated by iptables-save v1.6.1 on Sat Jun 1 23:43:50 2019
|
||||||
|
*filter
|
||||||
|
:INPUT ACCEPT [651:514108]
|
||||||
|
:FORWARD DROP [70:4612]
|
||||||
|
:OUTPUT ACCEPT [590:63846]
|
||||||
|
:DOCKER - [0:0]
|
||||||
|
:DOCKER-ISOLATION-STAGE-1 - [0:0]
|
||||||
|
:DOCKER-ISOLATION-STAGE-2 - [0:0]
|
||||||
|
:DOCKER-USER - [0:0]
|
||||||
|
-A FORWARD -j DOCKER-USER
|
||||||
|
-A FORWARD -j DOCKER-ISOLATION-STAGE-1
|
||||||
|
-A FORWARD -o docker0 -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||||
|
-A FORWARD -o docker0 -j DOCKER
|
||||||
|
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
|
||||||
|
-A FORWARD -i docker0 -o docker0 -j ACCEPT
|
||||||
|
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
|
||||||
|
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
|
||||||
|
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
|
||||||
|
-A DOCKER-ISOLATION-STAGE-2 -j RETURN
|
||||||
|
-A DOCKER-USER -j RETURN
|
||||||
|
COMMIT
|
||||||
|
# Completed on Sat Jun 1 23:43:50 2019
|
||||||
|
```
|
||||||
|
|
||||||
|
Create **newtables** file as below.
|
||||||
|
|
||||||
|
```diff
|
||||||
|
$ diff -u oldtables newtables
|
||||||
|
--- oldtables 2019-06-01 23:43:50.354974226 +0900
|
||||||
|
+++ newtables 2019-06-01 23:44:16.110931684 +0900
|
||||||
|
@@ -8,6 +8,7 @@
|
||||||
|
-A PREROUTING -m addrtype --dst-type LOCAL -j DOCKER
|
||||||
|
-A OUTPUT ! -d 127.0.0.0/8 -m addrtype --dst-type LOCAL -j DOCKER
|
||||||
|
-A POSTROUTING -s 172.17.0.0/16 ! -o docker0 -j MASQUERADE
|
||||||
|
+-A POSTROUTING -s 45.45.0.0/16 ! -o pgwtun -j MASQUERADE
|
||||||
|
-A DOCKER -i docker0 -j RETURN
|
||||||
|
COMMIT
|
||||||
|
# Completed on Sat Jun 1 23:43:50 2019
|
||||||
|
@@ -26,6 +27,10 @@
|
||||||
|
-A FORWARD -o docker0 -j DOCKER
|
||||||
|
-A FORWARD -i docker0 ! -o docker0 -j ACCEPT
|
||||||
|
-A FORWARD -i docker0 -o docker0 -j ACCEPT
|
||||||
|
+-A FORWARD -o pgwtun -m conntrack --ctstate RELATED,ESTABLISHED -j ACCEPT
|
||||||
|
+-A FORWARD -o pgwtun -j DOCKER
|
||||||
|
+-A FORWARD -i pgwtun ! -o pgwtun -j ACCEPT
|
||||||
|
+-A FORWARD -i pgwtun -o pgwtun -j ACCEPT
|
||||||
|
-A DOCKER-ISOLATION-STAGE-1 -i docker0 ! -o docker0 -j DOCKER-ISOLATION-STAGE-2
|
||||||
|
-A DOCKER-ISOLATION-STAGE-1 -j RETURN
|
||||||
|
-A DOCKER-ISOLATION-STAGE-2 -o docker0 -j DROP
|
||||||
|
```
|
||||||
|
|
||||||
|
And then, apply **newtables** as below.
|
||||||
|
```
|
||||||
|
$ sudo iptables-restore < newtables
|
||||||
|
```
|
||||||
|
|
||||||
|
The above operation is the same as described in the following manuals.
|
||||||
|
```
|
||||||
|
### Check IP Tables
|
||||||
|
$ sudo iptables -L
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain FORWARD (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Check NAT Tables
|
||||||
|
$ sudo iptables -L -t nat
|
||||||
|
Chain PREROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain INPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain OUTPUT (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
Chain POSTROUTING (policy ACCEPT)
|
||||||
|
target prot opt source destination
|
||||||
|
|
||||||
|
### Enable IPv4 Forwarding
|
||||||
|
$ sudo sh -c "echo 1 > /proc/sys/net/ipv4/ip_forward"
|
||||||
|
|
||||||
|
### Add NAT Rule
|
||||||
|
$ sudo iptables -t nat -A POSTROUTING -s 45.45.0.0/16 ! -o pgwtun -j MASQUERADE
|
||||||
|
```
|
||||||
|
|
||||||
|
#### How to use a different APN for each PGW
|
||||||
|
|
||||||
|
By default, MME selects the PGW as the first PGW node. To use a different APN for each PGW, specify gtpc.apn as the APN name. If the HSS uses WebUI to set the PGW IP for each UE, you can use a specific PGW node for each UE.
|
||||||
|
|
||||||
|
See the following example.
|
||||||
|
|
||||||
|
```
|
||||||
|
### For reference, see `nextepc.conf`
|
||||||
|
#------------------------ MME --------------------------
|
||||||
|
#
|
||||||
|
# o Two PGW are defined. 127.0.0.3:2123 is used.
|
||||||
|
# [fe80::3%lo]:2123 is ignored.
|
||||||
|
# gtpc:
|
||||||
|
# - addr: 127.0.0.3
|
||||||
|
# - addr: fe80::3%lo
|
||||||
|
#
|
||||||
|
# o One PGW is defined. if prefer_ipv4 is not true,
|
||||||
|
# [fe80::3%lo] is selected.
|
||||||
|
# gtpc:
|
||||||
|
# - addr:
|
||||||
|
# - 127.0.0.3
|
||||||
|
# - fe80::3%lo
|
||||||
|
#
|
||||||
|
# o Two PGW are defined with a different APN.
|
||||||
|
# - Note that if PGW IP for UE is configured in HSS,
|
||||||
|
# the following configurion for this UE is ignored.
|
||||||
|
# gtpc:
|
||||||
|
# - addr: 127.0.0.3
|
||||||
|
# apn: internet
|
||||||
|
# - addr: 127.0.0.5
|
||||||
|
# apn: volte
|
||||||
|
#
|
||||||
|
# o If APN is omitted, the default APN uses the first PGW node.
|
||||||
|
# gtpc:
|
||||||
|
# - addr: 127.0.0.3
|
||||||
|
# - addr: 127.0.0.5
|
||||||
|
# apn: volte
|
||||||
|
#
|
||||||
|
```
|
||||||
|
|
||||||
|
The IP address of the UE can also use a different UE pool depending on the APN.
|
||||||
|
|
||||||
|
```
|
||||||
|
### For reference, see `nextepc.conf`
|
||||||
|
#
|
||||||
|
# <UE Pool>
|
||||||
|
#
|
||||||
|
# o IPv4 Pool
|
||||||
|
# $ sudo ip addr add 45.45.0.1/16 dev pgwtun
|
||||||
|
#
|
||||||
|
# ue_pool:
|
||||||
|
# addr: 45.45.0.1/16
|
||||||
|
#
|
||||||
|
# o IPv4/IPv6 Pool
|
||||||
|
# $ sudo ip addr add 45.45.0.1/16 dev pgwtun
|
||||||
|
# $ sudo ip addr add cafe:1::1/64 dev pgwtun
|
||||||
|
#
|
||||||
|
# ue_pool:
|
||||||
|
# - addr: 45.45.0.1/16
|
||||||
|
# - addr: cafe:1::1/64
|
||||||
|
#
|
||||||
|
#
|
||||||
|
# o Specific APN(e.g 'volte') uses 45.46.0.1/16, cafe:2::1/64
|
||||||
|
# All other APNs use 45.45.0.1/16, cafe:1::1/64
|
||||||
|
# $ sudo ip addr add 45.45.0.1/16 dev pgwtun
|
||||||
|
# $ sudo ip addr add 45.46.0.1/16 dev pgwtun
|
||||||
|
# $ sudo ip addr add cafe:1::1/64 dev pgwtun
|
||||||
|
# $ sudo ip addr add cafe:2::1/64 dev pgwtun
|
||||||
|
#
|
||||||
|
# ue_pool:
|
||||||
|
# - addr: 45.45.0.1/16
|
||||||
|
# - addr: cafe:1::1/64
|
||||||
|
# - addr: 45.46.0.1/16
|
||||||
|
# apn: volte
|
||||||
|
# - addr: cafe:2::1/64
|
||||||
|
# apn: volte
|
||||||
|
#
|
||||||
|
# o Multiple Devices (default: pgwtun)
|
||||||
|
# $ sudo ip addr add 45.45.0.1/16 dev pgwtun
|
||||||
|
# $ sudo ip addr add cafe:1::1/64 dev pgwtun2
|
||||||
|
# $ sudo ip addr add 45.46.0.1/16 dev pgwtun3
|
||||||
|
# $ sudo ip addr add cafe:2::1/64 dev pgwtun3
|
||||||
|
#
|
||||||
|
# ue_pool:
|
||||||
|
# - addr: 45.45.0.1/16
|
||||||
|
# - addr: cafe:1::1/64
|
||||||
|
# dev: pgwtun2
|
||||||
|
# - addr: 45.46.0.1/16
|
||||||
|
# apn: volte
|
||||||
|
# dev: pgwtun3
|
||||||
|
# - addr: cafe:2::1/64
|
||||||
|
# apn: volte
|
||||||
|
# dev: pgwtun3
|
||||||
|
#
|
||||||
|
```
|
||||||
|
|
||||||
#### How to connect MongoDB server
|
#### How to connect MongoDB server
|
||||||
|
|
||||||
If you do not start MongoDB, you will get the following error:
|
If you do not start MongoDB, you will get the following error:
|
||||||
|
|||||||
24
docs/_posts/2019-05-18-release-v0.4.1.md
Normal file
24
docs/_posts/2019-05-18-release-v0.4.1.md
Normal file
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
title: "v0.4.1 - Bug fixes & minor changes"
|
||||||
|
date: 2019-05-18 19:06:00 +0900
|
||||||
|
categories:
|
||||||
|
- Release
|
||||||
|
tags:
|
||||||
|
- News
|
||||||
|
- Release
|
||||||
|
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
|
||||||
|
---
|
||||||
|
|
||||||
|
#### Minor changes
|
||||||
|
- Rearrange the initialization order [[2d74383](https://github.com/open5gs/nextepc/commit/2d7438313d7426ca3ad4591f090b7f8564257fb7)]
|
||||||
|
- Remove ____DATE____ and ____TIME____ from all source code to make the same binary. [[c8ed909](https://github.com/open5gs/nextepc/commit/c8ed909f4680225490ac23d2d56e7d8f8112d6f6)]
|
||||||
|
- Improve sanity checks when queues cannot be pushed [[bc180c3](https://github.com/open5gs/nextepc/commit/bc180c3ffc431a06a49e0de1af71098fd91d561b)]
|
||||||
|
- Update document to correct typo ([#176](https://github.com/open5gs/nextepc/issues/176)) -- [iman432](https://github.com/iman432)
|
||||||
|
- Add UE address to LOG ([#178](https://github.com/open5gs/nextepc/pull/178)) -- [medeiros405](https://github.com/medeiros405)
|
||||||
|
|
||||||
|
#### Bug fixes
|
||||||
|
- Fix CentOS compilation errors and segmentation fault in test programs ([#175](https://github.com/open5gs/nextepc/issues/175)) -- [fefer](https://github.com/fefer)
|
||||||
|
- Modify the test program on MacOSX [ab81e38](https://github.com/open5gs/nextepc/commit/ab81e384879fdf51c667344fc8be912254dbec75)
|
||||||
|
|
||||||
|
Download -- [v0.4.1.tar.gz](https://github.com/open5gs/nextepc/archive/v0.4.1.tar.gz)
|
||||||
|
{: .notice--info}
|
||||||
20
docs/_posts/2019-05-28-release-v0.4.2.md
Normal file
20
docs/_posts/2019-05-28-release-v0.4.2.md
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
---
|
||||||
|
title: "v0.4.2 - Stable version of v0.4.x"
|
||||||
|
date: 2019-05-28 21:13:00 +0900
|
||||||
|
categories:
|
||||||
|
- Release
|
||||||
|
tags:
|
||||||
|
- News
|
||||||
|
- Release
|
||||||
|
head_inline: "<style> ul { padding-bottom: 1em; } </style>"
|
||||||
|
---
|
||||||
|
|
||||||
|
#### Enhancement
|
||||||
|
- Support a different APN for each PGW ([#183](https://github.com/open5gs/nextepc/issues/183))
|
||||||
|
- Attach Reject for an invalid APN name ([#187](https://github.com/open5gs/nextepc/issues/187)) -- [ravens](https://github.com/ravens)
|
||||||
|
|
||||||
|
#### Bug fixes
|
||||||
|
- Fix the PIDFile path of the systemd service ([#182](https://github.com/open5gs/nextepc/issues/182)) -- [smoein](https://github.com/smoein)
|
||||||
|
|
||||||
|
Download -- [v0.4.2.tar.gz](https://github.com/open5gs/nextepc/archive/v0.4.2.tar.gz)
|
||||||
|
{: .notice--info}
|
||||||
Binary file not shown.
@@ -10,7 +10,7 @@
|
|||||||
#
|
#
|
||||||
|
|
||||||
PACKAGE="nextepc"
|
PACKAGE="nextepc"
|
||||||
VERSION="0.3.9"
|
VERSION="0.4.3"
|
||||||
|
|
||||||
print_status() {
|
print_status() {
|
||||||
echo
|
echo
|
||||||
|
|||||||
@@ -1127,8 +1127,8 @@ ASN_MODULE_CFLAGS=
|
|||||||
pkglib_LTLIBRARIES=libasn1c.la
|
pkglib_LTLIBRARIES=libasn1c.la
|
||||||
libasn1c_la_SOURCES= \
|
libasn1c_la_SOURCES= \
|
||||||
$(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS) \
|
$(ASN_MODULE_SRCS) $(ASN_MODULE_HDRS) \
|
||||||
s1ap_asn1c.h s1ap_message.h \
|
s1ap-asn1c.h s1ap-message.h \
|
||||||
s1ap_decoder.c s1ap_encoder.c s1ap_free.c \
|
s1ap-decoder.c s1ap-encoder.c s1ap-free.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libasn1c_la_DEPENDENCIES = \
|
libasn1c_la_DEPENDENCIES = \
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "s1ap_message.h"
|
#include "s1ap-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_s1ap_domain
|
#define OGS_LOG_DOMAIN __base_s1ap_domain
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "s1ap_message.h"
|
#include "s1ap-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_s1ap_domain
|
#define OGS_LOG_DOMAIN __base_s1ap_domain
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "s1ap_message.h"
|
#include "s1ap-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_s1ap_domain
|
#define OGS_LOG_DOMAIN __base_s1ap_domain
|
||||||
@@ -23,7 +23,7 @@
|
|||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
#include "base/types.h"
|
#include "base/types.h"
|
||||||
#include "base/context.h"
|
#include "base/context.h"
|
||||||
#include "s1ap_asn1c.h"
|
#include "s1ap-asn1c.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -23,11 +23,11 @@
|
|||||||
#define PLMN_ID_DIGIT2(x) (((x) / 10) % 10)
|
#define PLMN_ID_DIGIT2(x) (((x) / 10) % 10)
|
||||||
#define PLMN_ID_DIGIT3(x) ((x) % 10)
|
#define PLMN_ID_DIGIT3(x) ((x) % 10)
|
||||||
|
|
||||||
uint32_t plmn_id_hexdump(plmn_id_t *plmn_id)
|
uint32_t plmn_id_hexdump(void *plmn_id)
|
||||||
{
|
{
|
||||||
uint32_t hex;
|
uint32_t hex;
|
||||||
ogs_assert(plmn_id);
|
ogs_assert(plmn_id);
|
||||||
memcpy(&hex, plmn_id, sizeof *plmn_id);
|
memcpy(&hex, plmn_id, sizeof(plmn_id_t));
|
||||||
hex = ntohl(hex) >> 8;
|
hex = ntohl(hex) >> 8;
|
||||||
return hex;
|
return hex;
|
||||||
}
|
}
|
||||||
@@ -64,19 +64,15 @@ void *plmn_id_build(plmn_id_t *plmn_id,
|
|||||||
return plmn_id;
|
return plmn_id;
|
||||||
}
|
}
|
||||||
|
|
||||||
int apn_build(char *dst, char *src, int length)
|
int fqdn_build(char *dst, char *src, int length)
|
||||||
{
|
{
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
|
|
||||||
for (i = 0, j = 0; i < length; i++, j++)
|
for (i = 0, j = 0; i < length; i++, j++) {
|
||||||
{
|
if (src[i] == '.') {
|
||||||
if (src[i] == '.')
|
|
||||||
{
|
|
||||||
dst[i-j] = j;
|
dst[i-j] = j;
|
||||||
j = -1;
|
j = -1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
dst[i+1] = src[i];
|
dst[i+1] = src[i];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -85,13 +81,12 @@ int apn_build(char *dst, char *src, int length)
|
|||||||
return length+1;
|
return length+1;
|
||||||
}
|
}
|
||||||
|
|
||||||
int apn_parse(char *dst, char *src, int length)
|
int fqdn_parse(char *dst, char *src, int length)
|
||||||
{
|
{
|
||||||
int i = 0, j = 0;
|
int i = 0, j = 0;
|
||||||
uint8_t len = 0;
|
uint8_t len = 0;
|
||||||
|
|
||||||
do
|
do {
|
||||||
{
|
|
||||||
len = src[i++];
|
len = src[i++];
|
||||||
memcpy(&dst[j], &src[i], len);
|
memcpy(&dst[j], &src[i], len);
|
||||||
|
|
||||||
@@ -125,8 +120,7 @@ int pco_parse(pco_t *pco, void *data, int data_len)
|
|||||||
pco->configuration_protocol = source->configuration_protocol;
|
pco->configuration_protocol = source->configuration_protocol;
|
||||||
size++;
|
size++;
|
||||||
|
|
||||||
while(size < data_len && i < MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID)
|
while(size < data_len && i < MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID) {
|
||||||
{
|
|
||||||
pco_id_t *id = &pco->ids[i];
|
pco_id_t *id = &pco->ids[i];
|
||||||
ogs_assert(size + sizeof(id->id) <= data_len);
|
ogs_assert(size + sizeof(id->id) <= data_len);
|
||||||
memcpy(&id->id, data + size, sizeof(id->id));
|
memcpy(&id->id, data + size, sizeof(id->id));
|
||||||
@@ -164,8 +158,7 @@ int pco_build(void *data, int data_len, pco_t *pco)
|
|||||||
size += 1;
|
size += 1;
|
||||||
|
|
||||||
ogs_assert(target.num_of_id <= MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID);
|
ogs_assert(target.num_of_id <= MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID);
|
||||||
for (i = 0; i < target.num_of_id; i++)
|
for (i = 0; i < target.num_of_id; i++) {
|
||||||
{
|
|
||||||
pco_id_t *id = &target.ids[i];
|
pco_id_t *id = &target.ids[i];
|
||||||
|
|
||||||
ogs_assert(size + sizeof(id->id) <= data_len);
|
ogs_assert(size + sizeof(id->id) <= data_len);
|
||||||
@@ -184,4 +177,3 @@ int pco_build(void *data, int data_len, pco_t *pco)
|
|||||||
|
|
||||||
return size;
|
return size;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@@ -29,47 +29,37 @@ extern "C" {
|
|||||||
#define S1AP_SCTP_PORT 36412
|
#define S1AP_SCTP_PORT 36412
|
||||||
#define GTPV2_C_UDP_PORT 2123
|
#define GTPV2_C_UDP_PORT 2123
|
||||||
#define GTPV1_U_UDP_PORT 2152
|
#define GTPV1_U_UDP_PORT 2152
|
||||||
|
#define SGSAP_SCTP_PORT 29118
|
||||||
|
|
||||||
#define SCTP_S1AP_PPID 18
|
#define SCTP_S1AP_PPID 18
|
||||||
#define SCTP_X2AP_PPID 27
|
#define SCTP_X2AP_PPID 27
|
||||||
|
#define SCTP_SGSAP_PPID 0
|
||||||
|
|
||||||
#define MAX_NUM_OF_SGW 32
|
#define MAX_NUM_OF_SESS 4 /* Num of APN(Session) per UE */
|
||||||
#define MAX_NUM_OF_PGW 32
|
#define MAX_NUM_OF_BEARER 4 /* Num of Bearer per APN(Session) */
|
||||||
|
|
||||||
#define MAX_NUM_OF_ENB 128
|
|
||||||
#define MAX_NUM_OF_UE 128
|
|
||||||
#define MAX_NUM_OF_SESS 4
|
|
||||||
#define MAX_NUM_OF_BEARER 4
|
|
||||||
#define MAX_NUM_OF_TUNNEL 3 /* Num of Tunnel per Bearer */
|
#define MAX_NUM_OF_TUNNEL 3 /* Num of Tunnel per Bearer */
|
||||||
#define MAX_NUM_OF_PF 16 /* Num of Packet Filter per Bearer */
|
#define MAX_NUM_OF_PF 16 /* Num of Packet Filter per Bearer */
|
||||||
|
|
||||||
#define MAX_POOL_OF_UE (MAX_NUM_OF_ENB * MAX_NUM_OF_UE)
|
|
||||||
#define MAX_POOL_OF_SESS (MAX_POOL_OF_UE * MAX_NUM_OF_SESS)
|
|
||||||
#define MAX_POOL_OF_BEARER (MAX_POOL_OF_SESS * MAX_NUM_OF_BEARER)
|
|
||||||
#define MAX_POOL_OF_TUNNEL (MAX_POOL_OF_BEARER * MAX_NUM_OF_TUNNEL)
|
|
||||||
#define MAX_POOL_OF_PF (MAX_POOL_OF_BEARER * MAX_NUM_OF_PF)
|
|
||||||
#define MAX_POOL_OF_DIAMETER_SESS (MAX_POOL_OF_UE * MAX_NUM_OF_SESS)
|
|
||||||
|
|
||||||
#define MAX_NUM_OF_HOSTNAME 16
|
#define MAX_NUM_OF_HOSTNAME 16
|
||||||
#define MAX_NUM_OF_PCC_RULE 8
|
#define MAX_NUM_OF_PCC_RULE 8
|
||||||
#define MAX_NUM_OF_FLOW 8 /* Num of Flow per PCC Rule */
|
#define MAX_NUM_OF_FLOW 8 /* Num of Flow per PCC Rule */
|
||||||
#define MAX_NUM_OF_PACKET_FILTER 16 /* Num of Packet Filter per Bearer */
|
#define MAX_NUM_OF_PACKET_FILTER 16 /* Num of Packet Filter per Bearer */
|
||||||
|
|
||||||
#define MAX_SDU_LEN 8192
|
#define MAX_SDU_LEN 8192
|
||||||
#define PLMN_ID_LEN 3
|
#define PLMN_ID_LEN 3
|
||||||
|
|
||||||
#define BCD_TO_BUFFER_LEN(x) (((x)+1)/2)
|
#define BCD_TO_BUFFER_LEN(x) (((x)+1)/2)
|
||||||
#define MAX_IMSI_BCD_LEN 15
|
#define MAX_IMSI_BCD_LEN 15
|
||||||
#define MAX_IMSI_LEN BCD_TO_BUFFER_LEN(MAX_IMSI_BCD_LEN)
|
#define MAX_IMSI_LEN BCD_TO_BUFFER_LEN(MAX_IMSI_BCD_LEN)
|
||||||
|
|
||||||
#define RAND_LEN 16
|
#define RAND_LEN 16
|
||||||
#define AUTN_LEN 16
|
#define AUTN_LEN 16
|
||||||
#define AUTS_LEN 14
|
#define AUTS_LEN 14
|
||||||
#define MAX_RES_LEN 16
|
#define MAX_RES_LEN 16
|
||||||
|
|
||||||
#define MAX_APN_LEN 100
|
#define MAX_APN_LEN 100
|
||||||
#define MAX_PCO_LEN 251
|
#define MAX_PCO_LEN 251
|
||||||
#define MAX_FILEPATH_LEN 256
|
#define MAX_FILEPATH_LEN 256
|
||||||
|
|
||||||
#define NEXT_ID(__id, __min, __max) \
|
#define NEXT_ID(__id, __min, __max) \
|
||||||
((__id) = ((__id) == (__max) ? (__min) : ((__id) + 1)))
|
((__id) = ((__id) == (__max) ? (__min) : ((__id) + 1)))
|
||||||
@@ -82,7 +72,7 @@ extern "C" {
|
|||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* PLMN_ID Structure */
|
* PLMN_ID Structure */
|
||||||
typedef struct _plmn_id_t {
|
typedef struct plmn_id_s {
|
||||||
ED2(uint8_t mcc2:4;,
|
ED2(uint8_t mcc2:4;,
|
||||||
uint8_t mcc1:4;)
|
uint8_t mcc1:4;)
|
||||||
ED2(uint8_t mnc1:4;,
|
ED2(uint8_t mnc1:4;,
|
||||||
@@ -91,7 +81,7 @@ ED2(uint8_t mnc3:4;,
|
|||||||
uint8_t mnc2:4;)
|
uint8_t mnc2:4;)
|
||||||
} __attribute__ ((packed)) plmn_id_t;
|
} __attribute__ ((packed)) plmn_id_t;
|
||||||
|
|
||||||
uint32_t plmn_id_hexdump(plmn_id_t *plmn_id);
|
uint32_t plmn_id_hexdump(void *plmn_id);
|
||||||
|
|
||||||
uint16_t plmn_id_mcc(plmn_id_t *plmn_id);
|
uint16_t plmn_id_mcc(plmn_id_t *plmn_id);
|
||||||
uint16_t plmn_id_mnc(plmn_id_t *plmn_id);
|
uint16_t plmn_id_mnc(plmn_id_t *plmn_id);
|
||||||
@@ -102,12 +92,12 @@ void *plmn_id_build(plmn_id_t *plmn_id,
|
|||||||
|
|
||||||
#define MAX_NUM_OF_TAI 16
|
#define MAX_NUM_OF_TAI 16
|
||||||
|
|
||||||
typedef struct _tai_t {
|
typedef struct tai_s {
|
||||||
plmn_id_t plmn_id;
|
plmn_id_t plmn_id;
|
||||||
uint16_t tac;
|
uint16_t tac;
|
||||||
} __attribute__ ((packed)) tai_t;
|
} __attribute__ ((packed)) tai_t;
|
||||||
|
|
||||||
typedef struct _e_cgi_t {
|
typedef struct e_cgi_s {
|
||||||
plmn_id_t plmn_id;
|
plmn_id_t plmn_id;
|
||||||
uint32_t cell_id; /* 28 bit */
|
uint32_t cell_id; /* 28 bit */
|
||||||
} __attribute__ ((packed)) e_cgi_t;
|
} __attribute__ ((packed)) e_cgi_t;
|
||||||
@@ -119,7 +109,7 @@ typedef struct _e_cgi_t {
|
|||||||
#define IPV4_LEN 4
|
#define IPV4_LEN 4
|
||||||
#define IPV6_LEN 16
|
#define IPV6_LEN 16
|
||||||
#define IPV4V6_LEN 20
|
#define IPV4V6_LEN 20
|
||||||
typedef struct _ip_t {
|
typedef struct ip_s {
|
||||||
union {
|
union {
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
uint8_t addr6[IPV6_LEN];
|
uint8_t addr6[IPV6_LEN];
|
||||||
@@ -139,7 +129,7 @@ ED3(uint8_t ipv4:1;,
|
|||||||
#define PAA_IPV4_LEN 5
|
#define PAA_IPV4_LEN 5
|
||||||
#define PAA_IPV6_LEN 18
|
#define PAA_IPV6_LEN 18
|
||||||
#define PAA_IPV4V6_LEN 22
|
#define PAA_IPV4V6_LEN 22
|
||||||
typedef struct _paa_t {
|
typedef struct paa_s {
|
||||||
/* 8.34 PDN Type */
|
/* 8.34 PDN Type */
|
||||||
#define GTP_PDN_TYPE_IPV4 1
|
#define GTP_PDN_TYPE_IPV4 1
|
||||||
#define GTP_PDN_TYPE_IPV6 2
|
#define GTP_PDN_TYPE_IPV6 2
|
||||||
@@ -174,14 +164,14 @@ ED2(uint8_t spare:5;,
|
|||||||
|
|
||||||
#define MAX_BIT_RATE 10000000000UL
|
#define MAX_BIT_RATE 10000000000UL
|
||||||
|
|
||||||
typedef struct _bitrate_t {
|
typedef struct bitrate_s {
|
||||||
uint64_t downlink; /* bits per seconds */
|
uint64_t downlink; /* bits per seconds */
|
||||||
uint64_t uplink; /* bits per seconds */
|
uint64_t uplink; /* bits per seconds */
|
||||||
} bitrate_t;
|
} bitrate_t;
|
||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* QoS Structure */
|
* QoS Structure */
|
||||||
typedef struct _qos_t {
|
typedef struct qos_s {
|
||||||
#define PDN_QCI_1 1
|
#define PDN_QCI_1 1
|
||||||
#define PDN_QCI_2 2
|
#define PDN_QCI_2 2
|
||||||
#define PDN_QCI_3 3
|
#define PDN_QCI_3 3
|
||||||
@@ -195,21 +185,21 @@ typedef struct _qos_t {
|
|||||||
#define PDN_QCI_66 66
|
#define PDN_QCI_66 66
|
||||||
#define PDN_QCI_69 69
|
#define PDN_QCI_69 69
|
||||||
#define PDN_QCI_70 70
|
#define PDN_QCI_70 70
|
||||||
uint8_t qci;
|
uint8_t qci;
|
||||||
|
|
||||||
struct {
|
struct {
|
||||||
/* Values 1 to 8 should only be assigned for services that are
|
/* Values 1 to 8 should only be assigned for services that are
|
||||||
* authorized to receive prioritized treatment within an operator domain.
|
* authorized to receive prioritized treatment within an operator domain.
|
||||||
* Values 9 to 15 may be assigned to resources that are authorized
|
* Values 9 to 15 may be assigned to resources that are authorized
|
||||||
* by the home network and thus applicable when a UE is roaming. */
|
* by the home network and thus applicable when a UE is roaming. */
|
||||||
uint8_t priority_level;
|
uint8_t priority_level;
|
||||||
|
|
||||||
#define PDN_PRE_EMPTION_CAPABILITY_ENABLED 0
|
#define PDN_PRE_EMPTION_CAPABILITY_ENABLED 0
|
||||||
#define PDN_PRE_EMPTION_CAPABILITY_DISABLED 1
|
#define PDN_PRE_EMPTION_CAPABILITY_DISABLED 1
|
||||||
uint8_t pre_emption_capability;
|
uint8_t pre_emption_capability;
|
||||||
#define PDN_PRE_EMPTION_VULNERABILITY_ENABLED 0
|
#define PDN_PRE_EMPTION_VULNERABILITY_ENABLED 0
|
||||||
#define PDN_PRE_EMPTION_VULNERABILITY_DISABLED 1
|
#define PDN_PRE_EMPTION_VULNERABILITY_DISABLED 1
|
||||||
uint8_t pre_emption_vulnerability;
|
uint8_t pre_emption_vulnerability;
|
||||||
} arp;
|
} arp;
|
||||||
|
|
||||||
bitrate_t mbr; /* Maxmimum Bit Rate (MBR) */
|
bitrate_t mbr; /* Maxmimum Bit Rate (MBR) */
|
||||||
@@ -220,7 +210,7 @@ typedef struct _qos_t {
|
|||||||
* Flow Structure */
|
* Flow Structure */
|
||||||
#define FLOW_DOWNLINK_ONLY 1
|
#define FLOW_DOWNLINK_ONLY 1
|
||||||
#define FLOW_UPLINK_ONLY 2
|
#define FLOW_UPLINK_ONLY 2
|
||||||
typedef struct _flow_t {
|
typedef struct flow_s {
|
||||||
uint8_t direction;
|
uint8_t direction;
|
||||||
char *description;
|
char *description;
|
||||||
} flow_t;
|
} flow_t;
|
||||||
@@ -237,7 +227,7 @@ typedef struct _flow_t {
|
|||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* PCC Rule Structure */
|
* PCC Rule Structure */
|
||||||
typedef struct _pcc_rule_t {
|
typedef struct pcc_rule_s {
|
||||||
#define PCC_RULE_TYPE_INSTALL 1
|
#define PCC_RULE_TYPE_INSTALL 1
|
||||||
#define PCC_RULE_TYPE_REMOVE 2
|
#define PCC_RULE_TYPE_REMOVE 2
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
@@ -279,14 +269,14 @@ typedef struct _pcc_rule_t {
|
|||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* PDN Structure */
|
* PDN Structure */
|
||||||
typedef struct _pdn_t {
|
typedef struct pdn_s {
|
||||||
uint32_t context_identifier;
|
uint32_t context_identifier;
|
||||||
char apn[MAX_APN_LEN+1];
|
char apn[MAX_APN_LEN+1];
|
||||||
#define HSS_PDN_TYPE_IPV4 0
|
#define HSS_PDN_TYPE_IPV4 0
|
||||||
#define HSS_PDN_TYPE_IPV6 1
|
#define HSS_PDN_TYPE_IPV6 1
|
||||||
#define HSS_PDN_TYPE_IPV4V6 2
|
#define HSS_PDN_TYPE_IPV4V6 2
|
||||||
#define HSS_PDN_TYPE_IPV4_OR_IPV6 3
|
#define HSS_PDN_TYPE_IPV4_OR_IPV6 3
|
||||||
int pdn_type;
|
int pdn_type;
|
||||||
|
|
||||||
qos_t qos;
|
qos_t qos;
|
||||||
bitrate_t ambr; /* APN-AMBR */
|
bitrate_t ambr; /* APN-AMBR */
|
||||||
@@ -295,8 +285,8 @@ typedef struct _pdn_t {
|
|||||||
ip_t pgw_ip;
|
ip_t pgw_ip;
|
||||||
} pdn_t;
|
} pdn_t;
|
||||||
|
|
||||||
int apn_build(char *dst, char *src, int len);
|
int fqdn_build(char *dst, char *src, int len);
|
||||||
int apn_parse(char *dst, char *src, int len);
|
int fqdn_parse(char *dst, char *src, int len);
|
||||||
|
|
||||||
/**************************************************
|
/**************************************************
|
||||||
* Protocol Configuration Options Structure
|
* Protocol Configuration Options Structure
|
||||||
@@ -314,28 +304,28 @@ int apn_parse(char *dst, char *src, int len);
|
|||||||
#define PCO_ID_P_CSCF_IPV4_ADDRESS_REQUEST 0x000c
|
#define PCO_ID_P_CSCF_IPV4_ADDRESS_REQUEST 0x000c
|
||||||
#define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d
|
#define PCO_ID_DNS_SERVER_IPV4_ADDRESS_REQUEST 0x000d
|
||||||
#define PCO_ID_IPV4_LINK_MTU_REQUEST 0x0010
|
#define PCO_ID_IPV4_LINK_MTU_REQUEST 0x0010
|
||||||
typedef struct _pco_ipcp_options_t {
|
typedef struct pco_ipcp_options_s {
|
||||||
uint8_t type;
|
uint8_t type;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
uint32_t addr;
|
uint32_t addr;
|
||||||
} __attribute__ ((packed)) pco_ipcp_options_t;
|
} __attribute__ ((packed)) pco_ipcp_options_t;
|
||||||
|
|
||||||
#define PCO_MAX_NUM_OF_IPCO_OPTIONS 4
|
#define PCO_MAX_NUM_OF_IPCO_OPTIONS 4
|
||||||
typedef struct _pco_ipcp_t {
|
typedef struct pco_ipcp_s {
|
||||||
uint8_t code;
|
uint8_t code;
|
||||||
uint8_t identifier;
|
uint8_t identifier;
|
||||||
uint16_t len;
|
uint16_t len;
|
||||||
pco_ipcp_options_t options[PCO_MAX_NUM_OF_IPCO_OPTIONS];
|
pco_ipcp_options_t options[PCO_MAX_NUM_OF_IPCO_OPTIONS];
|
||||||
} __attribute__ ((packed)) pco_ipcp_t;
|
} __attribute__ ((packed)) pco_ipcp_t;
|
||||||
|
|
||||||
typedef struct _pco_id_t {
|
typedef struct pco_id_s {
|
||||||
uint16_t id;
|
uint16_t id;
|
||||||
uint8_t len;
|
uint8_t len;
|
||||||
void *data;
|
void *data;
|
||||||
} pco_id_t;
|
} pco_id_t;
|
||||||
|
|
||||||
#define MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID 8
|
#define MAX_NUM_OF_PROTOCOL_OR_CONTAINER_ID 8
|
||||||
typedef struct _pco_t {
|
typedef struct pco_s {
|
||||||
ED3(uint8_t ext:1;,
|
ED3(uint8_t ext:1;,
|
||||||
uint8_t spare:4;,
|
uint8_t spare:4;,
|
||||||
uint8_t configuration_protocol:3;)
|
uint8_t configuration_protocol:3;)
|
||||||
|
|||||||
@@ -18,17 +18,17 @@
|
|||||||
pkglib_LTLIBRARIES = libfd.la
|
pkglib_LTLIBRARIES = libfd.la
|
||||||
|
|
||||||
libfd_la_SOURCES = \
|
libfd_la_SOURCES = \
|
||||||
fd_message.h fd_logger.h fd_lib.h \
|
fd-message.h fd-logger.h fd-lib.h \
|
||||||
libapp_sip.c fd_message.c fd_logger.c fd_config.c fd_init.c \
|
libapp_sip.c fd-message.c fd-logger.c fd-config.c fd-init.c \
|
||||||
\
|
\
|
||||||
s6a/s6a_dict.h s6a/s6a_message.h \
|
s6a/s6a-dict.h s6a/s6a-message.h \
|
||||||
s6a/dict_init.c \
|
s6a/dict-init.c \
|
||||||
\
|
\
|
||||||
gx/gx_dict.h gx/gx_message.h \
|
gx/gx-dict.h gx/gx-message.h \
|
||||||
gx/dict_init.c gx/gx_message.c \
|
gx/dict-init.c gx/gx-message.c \
|
||||||
\
|
\
|
||||||
rx/rx_dict.h rx/rx_message.h \
|
rx/rx-dict.h rx/rx-message.h \
|
||||||
rx/dict_init.c rx/rx_message.c \
|
rx/dict-init.c rx/rx-message.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libfd_la_DEPENDENCIES = \
|
libfd_la_DEPENDENCIES = \
|
||||||
|
|||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fd_lib.h"
|
#include "fd-lib.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_fd_domain
|
#define OGS_LOG_DOMAIN __base_fd_domain
|
||||||
@@ -16,8 +16,9 @@
|
|||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
#include "fd_logger.h"
|
|
||||||
#include "fd_lib.h"
|
#include "fd-logger.h"
|
||||||
|
#include "fd-lib.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_fd_domain
|
#define OGS_LOG_DOMAIN __base_fd_domain
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __FD_LIB_H__
|
#ifndef FD_LIB_H
|
||||||
#define __FD_LIB_H__
|
#define FD_LIB_H
|
||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
|
|
||||||
@@ -27,16 +27,16 @@
|
|||||||
|
|
||||||
#include "base/context.h"
|
#include "base/context.h"
|
||||||
|
|
||||||
#include "fd_message.h"
|
#include "fd-message.h"
|
||||||
#include "fd_logger.h"
|
#include "fd-logger.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
/* This is default diameter configuration if there is no config file
|
/* This is default diameter configuration if there is no config file
|
||||||
* The Configuration : No TLS, Only TCP */
|
* The Configuration : No TLS, Only TCP */
|
||||||
typedef struct _fd_config_t {
|
typedef struct fd_config_s {
|
||||||
/* Diameter Identity of the local peer (FQDN -- ASCII) */
|
/* Diameter Identity of the local peer (FQDN -- ASCII) */
|
||||||
const char *cnf_diamid;
|
const char *cnf_diamid;
|
||||||
/* Diameter realm of the local peer, default to realm part of cnf_diamid */
|
/* Diameter realm of the local peer, default to realm part of cnf_diamid */
|
||||||
@@ -81,6 +81,6 @@ int fd_avp_search_avp ( struct avp * groupedavp,
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* ! __FD_LIB_H__ */
|
#endif /* FD_LIB_H */
|
||||||
@@ -19,7 +19,7 @@
|
|||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
#include "base/context.h"
|
#include "base/context.h"
|
||||||
#include "fd_logger.h"
|
#include "fd-logger.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_fd_domain
|
#define OGS_LOG_DOMAIN __base_fd_domain
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __FD_LOGGER_H__
|
#ifndef FD_LOGGER_H
|
||||||
#define __FD_LOGGER_H__
|
#define FD_LOGGER_H
|
||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
|
|
||||||
@@ -27,7 +27,7 @@
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
struct fd_logger_t {
|
struct fd_logger_t {
|
||||||
|
|
||||||
@@ -65,6 +65,6 @@ void fd_logger_unregister();
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* ! __FD_LOGGER_H__ */
|
#endif /* FD_LOGGER_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "fd_message.h"
|
#include "fd-message.h"
|
||||||
|
|
||||||
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
||||||
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
||||||
@@ -17,15 +17,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __FD_MESSAGE_H__
|
#ifndef FD_MESSAGE_H
|
||||||
#define __FD_MESSAGE_H__
|
#define FD_MESSAGE_H
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
#include "freeDiameter/freeDiameter-host.h"
|
||||||
#include "freeDiameter/libfdcore.h"
|
#include "freeDiameter/libfdcore.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#define FD_AVP_CODE_FRAME_IP_ADDRESS 8
|
#define FD_AVP_CODE_FRAME_IP_ADDRESS 8
|
||||||
#define FD_AVP_CODE_FRAME_IPV6_PREFIX 97
|
#define FD_AVP_CODE_FRAME_IPV6_PREFIX 97
|
||||||
@@ -73,6 +73,6 @@ int fd_message_vendor_specific_appid_set(struct msg *msg, uint32_t app_id);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* ! __FD_MESSAGE_H__ */
|
#endif /* FD_MESSAGE_H */
|
||||||
@@ -18,7 +18,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gx_dict.h"
|
#include "gx-dict.h"
|
||||||
|
|
||||||
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
||||||
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
||||||
@@ -17,15 +17,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GX_DICT_H__
|
#ifndef GX_DICT_H
|
||||||
#define __GX_DICT_H__
|
#define GX_DICT_H
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
#include "freeDiameter/freeDiameter-host.h"
|
||||||
#include "freeDiameter/libfdcore.h"
|
#include "freeDiameter/libfdcore.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#define GX_APPLICATION_ID 16777238
|
#define GX_APPLICATION_ID 16777238
|
||||||
|
|
||||||
@@ -130,6 +130,6 @@ int gx_dict_init(void);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GX_DICT_H__ */
|
#endif /* GX_DICT_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gx_message.h"
|
#include "gx-message.h"
|
||||||
|
|
||||||
void gx_message_free(gx_message_t *gx_message)
|
void gx_message_free(gx_message_t *gx_message)
|
||||||
{
|
{
|
||||||
@@ -17,19 +17,19 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GX_MESSAGE_H__
|
#ifndef GX_MESSAGE_H
|
||||||
#define __GX_MESSAGE_H__
|
#define GX_MESSAGE_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#include "base/types.h"
|
#include "base/types.h"
|
||||||
|
|
||||||
typedef struct _gx_message_t {
|
typedef struct _gx_message_t {
|
||||||
#define GX_CMD_CODE_CREDIT_CONTROL 272
|
#define GX_CMD_CODE_CREDIT_CONTROL 272
|
||||||
#define GX_CMD_RE_AUTH 258
|
#define GX_CMD_RE_AUTH 258
|
||||||
uint16_t cmd_code;
|
uint16_t cmd_code;
|
||||||
|
|
||||||
/* Experimental-Result-Codes */
|
/* Experimental-Result-Codes */
|
||||||
#define GX_DIAMETER_ERROR_LATE_OVERLAPPING_REQUEST 5453
|
#define GX_DIAMETER_ERROR_LATE_OVERLAPPING_REQUEST 5453
|
||||||
@@ -42,13 +42,13 @@ typedef struct _gx_message_t {
|
|||||||
#define GX_DIAMETER_ERROR_CONFLICTING_REQUEST 5147
|
#define GX_DIAMETER_ERROR_CONFLICTING_REQUEST 5147
|
||||||
#define GX_DIAMETER_ADC_RULE_EVENT 5148
|
#define GX_DIAMETER_ADC_RULE_EVENT 5148
|
||||||
#define GX_DIAMETER_ERROR_NBIFOM_NOT_AUTHORIZED 5149
|
#define GX_DIAMETER_ERROR_NBIFOM_NOT_AUTHORIZED 5149
|
||||||
uint32_t result_code;
|
uint32_t result_code;
|
||||||
|
|
||||||
#define GX_CC_REQUEST_TYPE_INITIAL_REQUEST 1
|
#define GX_CC_REQUEST_TYPE_INITIAL_REQUEST 1
|
||||||
#define GX_CC_REQUEST_TYPE_UPDATE_REQUEST 2
|
#define GX_CC_REQUEST_TYPE_UPDATE_REQUEST 2
|
||||||
#define GX_CC_REQUEST_TYPE_TERMINATION_REQUEST 3
|
#define GX_CC_REQUEST_TYPE_TERMINATION_REQUEST 3
|
||||||
#define GX_CC_REQUEST_TYPE_EVENT_REQUEST 4
|
#define GX_CC_REQUEST_TYPE_EVENT_REQUEST 4
|
||||||
uint32_t cc_request_type;
|
uint32_t cc_request_type;
|
||||||
|
|
||||||
pdn_t pdn;
|
pdn_t pdn;
|
||||||
pcc_rule_t pcc_rule[MAX_NUM_OF_PCC_RULE];
|
pcc_rule_t pcc_rule[MAX_NUM_OF_PCC_RULE];
|
||||||
@@ -59,6 +59,6 @@ void gx_message_free(gx_message_t *gx_message);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GX_MESSAGE_H__ */
|
#endif /* GX_MESSAGE_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rx_dict.h"
|
#include "rx-dict.h"
|
||||||
|
|
||||||
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
||||||
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
||||||
@@ -17,15 +17,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RX_DICT_H__
|
#ifndef RX_DICT_H
|
||||||
#define __RX_DICT_H__
|
#define RX_DICT_H
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
#include "freeDiameter/freeDiameter-host.h"
|
||||||
#include "freeDiameter/libfdcore.h"
|
#include "freeDiameter/libfdcore.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#define RX_APPLICATION_ID 16777236
|
#define RX_APPLICATION_ID 16777236
|
||||||
|
|
||||||
@@ -126,6 +126,6 @@ int rx_dict_init(void);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __RX_DICT_H__ */
|
#endif /* RX_DICT_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "rx_message.h"
|
#include "rx-message.h"
|
||||||
|
|
||||||
void rx_message_free(rx_message_t *rx_message)
|
void rx_message_free(rx_message_t *rx_message)
|
||||||
{
|
{
|
||||||
@@ -17,12 +17,12 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __RX_MESSAGE_H__
|
#ifndef RX_MESSAGE_H
|
||||||
#define __RX_MESSAGE_H__
|
#define RX_MESSAGE_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#include "base/types.h"
|
#include "base/types.h"
|
||||||
|
|
||||||
@@ -85,6 +85,6 @@ void rx_message_free(rx_message_t *rx_message);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __RX_MESSAGE_H__ */
|
#endif /* RX_MESSAGE_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "s6a_dict.h"
|
#include "s6a-dict.h"
|
||||||
|
|
||||||
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
#define CHECK_dict_search( _type, _criteria, _what, _result ) \
|
||||||
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
CHECK_FCT( fd_dict_search( fd_g_config->cnf_dict, (_type), (_criteria), (_what), (_result), ENOENT) );
|
||||||
@@ -17,15 +17,15 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __S6A_LIB_H__
|
#ifndef S6A_DICT_H
|
||||||
#define __S6A_LIB_H__
|
#define S6A_DICT_H
|
||||||
|
|
||||||
#include "freeDiameter/freeDiameter-host.h"
|
#include "freeDiameter/freeDiameter-host.h"
|
||||||
#include "freeDiameter/libfdcore.h"
|
#include "freeDiameter/libfdcore.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#define S6A_APPLICATION_ID 16777251
|
#define S6A_APPLICATION_ID 16777251
|
||||||
|
|
||||||
@@ -107,6 +107,6 @@ int s6a_dict_init(void);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* ! __S6A_LIB_H__ */
|
#endif /* S6A_DICT_H */
|
||||||
@@ -17,23 +17,23 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __S6A_MESSAGE_H__
|
#ifndef S6A_MESSAGE_H
|
||||||
#define __S6A_MESSAGE_H__
|
#define S6A_MESSAGE_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#include "ogs-crypt.h"
|
#include "ogs-crypt.h"
|
||||||
|
|
||||||
#include "base/types.h"
|
#include "base/types.h"
|
||||||
|
|
||||||
typedef struct _e_utran_vector_t {
|
typedef struct _e_utran_vector_t {
|
||||||
uint8_t xres[MAX_RES_LEN];
|
uint8_t xres[MAX_RES_LEN];
|
||||||
uint8_t xres_len;
|
uint8_t xres_len;
|
||||||
uint8_t kasme[OGS_SHA256_DIGEST_SIZE];
|
uint8_t kasme[OGS_SHA256_DIGEST_SIZE];
|
||||||
uint8_t rand[RAND_LEN];
|
uint8_t rand[RAND_LEN];
|
||||||
uint8_t autn[AUTN_LEN];
|
uint8_t autn[AUTN_LEN];
|
||||||
} e_utran_vector_t;
|
} e_utran_vector_t;
|
||||||
|
|
||||||
typedef struct _s6a_aia_message_t {
|
typedef struct _s6a_aia_message_t {
|
||||||
@@ -48,19 +48,19 @@ typedef struct _s6a_subscription_data_t {
|
|||||||
#define HSS_ACCESS_RESTRICTION_WB_E_UTRAN_NOT_ALLOWED (1<<4)
|
#define HSS_ACCESS_RESTRICTION_WB_E_UTRAN_NOT_ALLOWED (1<<4)
|
||||||
#define HSS_ACCESS_RESTRICTION_HO_TO_NON_3GPP_ACCESS_NOT_ALLOWED (1<<5)
|
#define HSS_ACCESS_RESTRICTION_HO_TO_NON_3GPP_ACCESS_NOT_ALLOWED (1<<5)
|
||||||
#define HSS_ACCESS_RESTRICTION_NB_IOT_NOT_ALLOWED (1<<6)
|
#define HSS_ACCESS_RESTRICTION_NB_IOT_NOT_ALLOWED (1<<6)
|
||||||
uint32_t access_restriction_data;
|
uint32_t access_restriction_data;
|
||||||
#define HSS_SUBSCRIBER_STATUS_SERVICE_GRANTED 0
|
#define HSS_SUBSCRIBER_STATUS_SERVICE_GRANTED 0
|
||||||
#define HSS_SUBSCRIBER_STATUS_OPERATOR_DETERMINED_BARRING 1
|
#define HSS_SUBSCRIBER_STATUS_OPERATOR_DETERMINED_BARRING 1
|
||||||
uint32_t subscriber_status;
|
uint32_t subscriber_status;
|
||||||
#define HSS_NETWORK_ACCESS_MODE_PACKET_AND_CIRCUIT 0
|
#define HSS_NETWORK_ACCESS_MODE_PACKET_AND_CIRCUIT 0
|
||||||
#define HSS_NETWORK_ACCESS_MODE_RESERVED 1
|
#define HSS_NETWORK_ACCESS_MODE_RESERVED 1
|
||||||
#define HSS_NETWORK_ACCESS_MODE_ONLY_PACKET 2
|
#define HSS_NETWORK_ACCESS_MODE_ONLY_PACKET 2
|
||||||
uint32_t network_access_mode;
|
uint32_t network_access_mode;
|
||||||
|
|
||||||
bitrate_t ambr; /* UE-AMBR */
|
bitrate_t ambr; /* UE-AMBR */
|
||||||
uint32_t subscribed_rau_tau_timer; /* unit : minutes */
|
uint32_t subscribed_rau_tau_timer; /* unit : minutes */
|
||||||
|
|
||||||
uint32_t context_identifier; /* default APN */
|
uint32_t context_identifier; /* default APN */
|
||||||
pdn_t pdn[MAX_NUM_OF_SESS];
|
pdn_t pdn[MAX_NUM_OF_SESS];
|
||||||
int num_of_pdn;
|
int num_of_pdn;
|
||||||
} s6a_subscription_data_t;
|
} s6a_subscription_data_t;
|
||||||
@@ -68,14 +68,14 @@ typedef struct _s6a_subscription_data_t {
|
|||||||
typedef struct _s6a_ula_message_t {
|
typedef struct _s6a_ula_message_t {
|
||||||
#define S6A_ULA_FLAGS_SEPARATION_INDICATION (0)
|
#define S6A_ULA_FLAGS_SEPARATION_INDICATION (0)
|
||||||
#define S6A_ULA_FLAGS_MME_REGISTERED_FOR_SMS (1)
|
#define S6A_ULA_FLAGS_MME_REGISTERED_FOR_SMS (1)
|
||||||
uint32_t ula_flags;
|
uint32_t ula_flags;
|
||||||
s6a_subscription_data_t subscription_data;
|
s6a_subscription_data_t subscription_data;
|
||||||
} s6a_ula_message_t;
|
} s6a_ula_message_t;
|
||||||
|
|
||||||
typedef struct _s6a_message_t {
|
typedef struct _s6a_message_t {
|
||||||
#define S6A_CMD_CODE_UPDATE_LOCATION 316
|
#define S6A_CMD_CODE_UPDATE_LOCATION 316
|
||||||
#define S6A_CMD_CODE_AUTHENTICATION_INFORMATION 318
|
#define S6A_CMD_CODE_AUTHENTICATION_INFORMATION 318
|
||||||
uint16_t cmd_code;
|
uint16_t cmd_code;
|
||||||
|
|
||||||
/* Experimental Result Code */
|
/* Experimental Result Code */
|
||||||
#define S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE 4181
|
#define S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE 4181
|
||||||
@@ -85,7 +85,7 @@ typedef struct _s6a_message_t {
|
|||||||
#define S6A_DIAMETER_ERROR_RAT_NOT_ALLOWED 5421
|
#define S6A_DIAMETER_ERROR_RAT_NOT_ALLOWED 5421
|
||||||
#define S6A_DIAMETER_ERROR_EQUIPMENT_UNKNOWN 5422
|
#define S6A_DIAMETER_ERROR_EQUIPMENT_UNKNOWN 5422
|
||||||
#define S6A_DIAMETER_ERROR_UNKOWN_SERVING_NODE 5423
|
#define S6A_DIAMETER_ERROR_UNKOWN_SERVING_NODE 5423
|
||||||
uint32_t result_code;
|
uint32_t result_code;
|
||||||
|
|
||||||
s6a_aia_message_t aia_message;
|
s6a_aia_message_t aia_message;
|
||||||
s6a_ula_message_t ula_message;
|
s6a_ula_message_t ula_message;
|
||||||
@@ -93,6 +93,6 @@ typedef struct _s6a_message_t {
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __S6A_MESSAGE_H__ */
|
#endif /* S6A_MESSAGE_H */
|
||||||
@@ -18,10 +18,10 @@
|
|||||||
pkglib_LTLIBRARIES = libgtp.la
|
pkglib_LTLIBRARIES = libgtp.la
|
||||||
|
|
||||||
libgtp_la_SOURCES = \
|
libgtp_la_SOURCES = \
|
||||||
gtp_tlv.h gtp_message.h gtp_types.h gtp_conv.h \
|
gtp-tlv.h gtp-message.h gtp-types.h gtp-conv.h \
|
||||||
gtp_node.h gtp_path.h gtp_xact.h \
|
gtp-node.h gtp-path.h gtp-xact.h \
|
||||||
gtp_tlv.c gtp_message.c gtp_types.c gtp_conv.c \
|
gtp-tlv.c gtp-message.c gtp-types.c gtp-conv.c \
|
||||||
gtp_node.c gtp_path.c gtp_xact.c \
|
gtp-node.c gtp-path.c gtp-xact.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libgtp_la_DEPENDENCIES = \
|
libgtp_la_DEPENDENCIES = \
|
||||||
|
|||||||
@@ -17,9 +17,9 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gtp_message.h"
|
#include "gtp-message.h"
|
||||||
#include "gtp_types.h"
|
#include "gtp-types.h"
|
||||||
#include "gtp_conv.h"
|
#include "gtp-conv.h"
|
||||||
|
|
||||||
void gtp_bearers_in_create_indirect_tunnel_request(
|
void gtp_bearers_in_create_indirect_tunnel_request(
|
||||||
tlv_bearer_context_t *bearers[][GTP_MAX_NUM_OF_INDIRECT_TUNNEL],
|
tlv_bearer_context_t *bearers[][GTP_MAX_NUM_OF_INDIRECT_TUNNEL],
|
||||||
@@ -66,13 +66,13 @@ int gtp_f_teid_to_sockaddr(
|
|||||||
|
|
||||||
addr = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
addr = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||||
ogs_assert(addr);
|
ogs_assert(addr);
|
||||||
addr->c_sa_family = AF_INET;
|
addr->ogs_sa_family = AF_INET;
|
||||||
addr->c_sa_port = htons(port);
|
addr->ogs_sin_port = htons(port);
|
||||||
|
|
||||||
addr6 = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
addr6 = ogs_calloc(1, sizeof(ogs_sockaddr_t));
|
||||||
ogs_assert(addr6);
|
ogs_assert(addr6);
|
||||||
addr6->c_sa_family = AF_INET6;
|
addr6->ogs_sa_family = AF_INET6;
|
||||||
addr6->c_sa_port = htons(port);
|
addr6->ogs_sin_port = htons(port);
|
||||||
|
|
||||||
if (f_teid->ipv4 && f_teid->ipv6)
|
if (f_teid->ipv4 && f_teid->ipv6)
|
||||||
{
|
{
|
||||||
@@ -17,17 +17,17 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTP_CONV_H__
|
#ifndef GTP_CONV_H
|
||||||
#define __GTP_CONV_H__
|
#define GTP_CONV_H
|
||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
|
|
||||||
typedef struct ogs_sockaddr_s ogs_sockaddr_t;
|
typedef struct ogs_sockaddr_s ogs_sockaddr_t;
|
||||||
typedef struct _tlv_bearer_context_t tlv_bearer_context_t;
|
typedef struct tlv_bearer_context_s tlv_bearer_context_t;
|
||||||
typedef struct _gtp_create_indirect_data_forwarding_tunnel_request_t gtp_create_indirect_data_forwarding_tunnel_request_t;
|
typedef struct gtp_create_indirect_data_forwarding_tunnel_request_s gtp_create_indirect_data_forwarding_tunnel_request_t;
|
||||||
typedef struct _gtp_create_indirect_data_forwarding_tunnel_response_t gtp_create_indirect_data_forwarding_tunnel_response_t;
|
typedef struct gtp_create_indirect_data_forwarding_tunnel_response_s gtp_create_indirect_data_forwarding_tunnel_response_t;
|
||||||
typedef struct _gtp_f_teid_t gtp_f_teid_t;
|
typedef struct gtp_f_teid_s gtp_f_teid_t;
|
||||||
typedef struct _ip_t ip_t;
|
typedef struct ip_s ip_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -54,5 +54,5 @@ int gtp_ip_to_f_teid(ip_t *ip, gtp_f_teid_t *f_teid, int *len);
|
|||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* __GTP_CONV_H__ */
|
#endif /* GTP_CONV_H */
|
||||||
|
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by gtp_tlv.py script v0.1.0
|
* This file had been created by gtp-tlv.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-06 12:20:52.446761 by acetcom
|
* Created on: 2019-06-11 17:35:40.953361 by acetcom
|
||||||
* from 29274-d80.docx
|
* from 29274-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "gtp_message.h"
|
#include "gtp-message.h"
|
||||||
|
|
||||||
tlv_desc_t tlv_desc_imsi_0 =
|
tlv_desc_t tlv_desc_imsi_0 =
|
||||||
{
|
{
|
||||||
1174
lib/gtp/gtp-message.h
Normal file
1174
lib/gtp/gtp-message.h
Normal file
File diff suppressed because it is too large
Load Diff
137
lib/gtp/gtp-node.c
Normal file
137
lib/gtp/gtp-node.c
Normal file
@@ -0,0 +1,137 @@
|
|||||||
|
/*
|
||||||
|
* 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 "gtp-conv.h"
|
||||||
|
#include "gtp-node.h"
|
||||||
|
#include "gtp-xact.h"
|
||||||
|
|
||||||
|
static OGS_POOL(pool, gtp_node_t);
|
||||||
|
|
||||||
|
int gtp_node_init(void)
|
||||||
|
{
|
||||||
|
ogs_pool_init(&pool, base_self()->gtp.node.pool);
|
||||||
|
|
||||||
|
return OGS_OK;
|
||||||
|
}
|
||||||
|
int gtp_node_final(void)
|
||||||
|
{
|
||||||
|
ogs_pool_final(&pool);
|
||||||
|
|
||||||
|
return OGS_OK;
|
||||||
|
}
|
||||||
|
|
||||||
|
gtp_node_t *gtp_node_new(ogs_sockaddr_t *addr)
|
||||||
|
{
|
||||||
|
gtp_node_t *node = NULL;
|
||||||
|
|
||||||
|
ogs_assert(addr);
|
||||||
|
|
||||||
|
ogs_pool_alloc(&pool, &node);
|
||||||
|
ogs_assert(node);
|
||||||
|
memset(node, 0, sizeof(gtp_node_t));
|
||||||
|
|
||||||
|
node->addr = addr;
|
||||||
|
|
||||||
|
ogs_list_init(&node->local_list);
|
||||||
|
ogs_list_init(&node->remote_list);
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gtp_node_free(gtp_node_t *node)
|
||||||
|
{
|
||||||
|
ogs_assert(node);
|
||||||
|
|
||||||
|
if (node->sock)
|
||||||
|
ogs_sock_destroy(node->sock);
|
||||||
|
|
||||||
|
gtp_xact_delete_all(node);
|
||||||
|
|
||||||
|
ogs_freeaddrinfo(node->addr);
|
||||||
|
ogs_pool_free(&pool, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtp_node_t *gtp_node_add(ogs_list_t *list, gtp_f_teid_t *f_teid,
|
||||||
|
uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
gtp_node_t *node = NULL;
|
||||||
|
ogs_sockaddr_t *addr = NULL;
|
||||||
|
|
||||||
|
ogs_assert(list);
|
||||||
|
ogs_assert(f_teid);
|
||||||
|
ogs_assert(port);
|
||||||
|
|
||||||
|
rv = gtp_f_teid_to_sockaddr(f_teid, port, &addr);
|
||||||
|
ogs_assert(rv == OGS_OK);
|
||||||
|
|
||||||
|
rv = ogs_filter_ip_version(&addr, no_ipv4, no_ipv6, prefer_ipv4);
|
||||||
|
ogs_assert(addr);
|
||||||
|
|
||||||
|
rv = ogs_socknode_fill_scope_id_in_local(addr);
|
||||||
|
ogs_assert(rv == OGS_OK);
|
||||||
|
|
||||||
|
node = gtp_node_new(addr);
|
||||||
|
ogs_assert(node);
|
||||||
|
|
||||||
|
rv = gtp_f_teid_to_ip(f_teid, &node->ip);
|
||||||
|
ogs_assert(rv == OGS_OK);
|
||||||
|
|
||||||
|
ogs_list_add(list, node);
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
|
|
||||||
|
void gtp_node_remove(ogs_list_t *list, gtp_node_t *node)
|
||||||
|
{
|
||||||
|
ogs_assert(node);
|
||||||
|
|
||||||
|
ogs_list_remove(list, node);
|
||||||
|
|
||||||
|
gtp_node_free(node);
|
||||||
|
}
|
||||||
|
|
||||||
|
void gtp_node_remove_all(ogs_list_t *list)
|
||||||
|
{
|
||||||
|
gtp_node_t *node = NULL, *next_node = NULL;
|
||||||
|
|
||||||
|
ogs_list_for_each_safe(list, next_node, node)
|
||||||
|
gtp_node_remove(list, node);
|
||||||
|
}
|
||||||
|
|
||||||
|
gtp_node_t *gtp_node_find(ogs_list_t *list, gtp_f_teid_t *f_teid)
|
||||||
|
{
|
||||||
|
int rv;
|
||||||
|
gtp_node_t *node = NULL;
|
||||||
|
ip_t ip;
|
||||||
|
|
||||||
|
ogs_assert(list);
|
||||||
|
ogs_assert(f_teid);
|
||||||
|
|
||||||
|
rv = gtp_f_teid_to_ip(f_teid, &ip);
|
||||||
|
ogs_assert(rv == OGS_OK);
|
||||||
|
|
||||||
|
ogs_list_for_each(list, node)
|
||||||
|
{
|
||||||
|
if (memcmp(&node->ip, &ip, ip.len) == 0)
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
|
||||||
|
return node;
|
||||||
|
}
|
||||||
@@ -17,14 +17,14 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTP_NODE_H__
|
#ifndef GTP_NODE_H
|
||||||
#define __GTP_NODE_H__
|
#define GTP_NODE_H
|
||||||
|
|
||||||
#include "gtp_types.h"
|
#include "gtp-types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#define SETUP_GTP_NODE(__cTX, __gNODE) \
|
#define SETUP_GTP_NODE(__cTX, __gNODE) \
|
||||||
do { \
|
do { \
|
||||||
@@ -36,10 +36,10 @@ extern "C" {
|
|||||||
/**
|
/**
|
||||||
* This structure represents the commonalities of GTP node such as MME, SGW,
|
* This structure represents the commonalities of GTP node such as MME, SGW,
|
||||||
* PGW gateway. Some of members may not be used by the specific type of node */
|
* PGW gateway. Some of members may not be used by the specific type of node */
|
||||||
typedef struct _gtp_node_t {
|
typedef struct gtp_node_s {
|
||||||
ogs_lnode_t node; /* A node of list_t */
|
ogs_lnode_t node; /* A node of list_t */
|
||||||
|
|
||||||
ogs_sockaddr_t *sa_list; /* Socket Address List */
|
ogs_sockaddr_t *addr; /* Socket Address List */
|
||||||
|
|
||||||
ogs_sock_t *sock; /* Socket instance */
|
ogs_sock_t *sock; /* Socket instance */
|
||||||
ip_t ip; /* Socket Address */
|
ip_t ip; /* Socket Address */
|
||||||
@@ -52,20 +52,19 @@ typedef struct _gtp_node_t {
|
|||||||
int gtp_node_init(void);
|
int gtp_node_init(void);
|
||||||
int gtp_node_final(void);
|
int gtp_node_final(void);
|
||||||
|
|
||||||
int gtp_create_node(gtp_node_t **node,
|
gtp_node_t *gtp_node_new(ogs_sockaddr_t *addr);
|
||||||
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
void gtp_node_free(gtp_node_t *node);
|
||||||
int gtp_delete_node(gtp_node_t *node);
|
|
||||||
|
|
||||||
gtp_node_t *gtp_add_node(
|
gtp_node_t *gtp_node_add(
|
||||||
ogs_list_t *list, gtp_f_teid_t *f_teid,
|
ogs_list_t *list, gtp_f_teid_t *f_teid,
|
||||||
uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4);
|
||||||
int gtp_remove_node(ogs_list_t *list, gtp_node_t *node);
|
void gtp_node_remove(ogs_list_t *list, gtp_node_t *node);
|
||||||
int gtp_remove_all_nodes(ogs_list_t *list);
|
void gtp_node_remove_all(ogs_list_t *list);
|
||||||
|
|
||||||
gtp_node_t *gtp_find_node(ogs_list_t *list, gtp_f_teid_t *f_teid);
|
gtp_node_t *gtp_node_find(ogs_list_t *list, gtp_f_teid_t *f_teid);
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GTP_NODE_H__ */
|
#endif /* GTP_NODE_H */
|
||||||
@@ -17,39 +17,25 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gtp_message.h"
|
#include "gtp-message.h"
|
||||||
#include "gtp_conv.h"
|
#include "gtp-conv.h"
|
||||||
#include "gtp_node.h"
|
#include "gtp-node.h"
|
||||||
|
|
||||||
#include "gtp_path.h"
|
#include "gtp-path.h"
|
||||||
|
|
||||||
int gtp_server(ogs_socknode_t *snode)
|
ogs_sock_t *gtp_server(ogs_socknode_t *node)
|
||||||
{
|
{
|
||||||
char buf[OGS_ADDRSTRLEN];
|
char buf[OGS_ADDRSTRLEN];
|
||||||
ogs_assert(snode);
|
ogs_sock_t *gtp;
|
||||||
|
ogs_assert(node);
|
||||||
|
|
||||||
snode->sock = ogs_udp_server(snode->list);
|
gtp = ogs_udp_server(node);
|
||||||
ogs_assert(snode->sock);
|
ogs_assert(gtp);
|
||||||
|
|
||||||
ogs_info("gtp_server() [%s]:%d",
|
ogs_info("gtp_server() [%s]:%d",
|
||||||
OGS_ADDR(snode->list, buf), OGS_PORT(snode->list));
|
OGS_ADDR(node->addr, buf), OGS_PORT(node->addr));
|
||||||
|
|
||||||
return OGS_OK;
|
return gtp;
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_client(gtp_node_t *gnode)
|
|
||||||
{
|
|
||||||
char buf[OGS_ADDRSTRLEN];
|
|
||||||
ogs_assert(gnode);
|
|
||||||
|
|
||||||
gnode->sock = ogs_udp_client(gnode->sa_list);
|
|
||||||
ogs_assert(gnode->sock);
|
|
||||||
memcpy(&gnode->conn, &gnode->sock->remote_addr, sizeof gnode->conn);
|
|
||||||
|
|
||||||
ogs_info("gtp_client() [%s]:%d",
|
|
||||||
OGS_ADDR(gnode->sa_list, buf), OGS_PORT(gnode->sa_list));
|
|
||||||
|
|
||||||
return OGS_OK;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode)
|
int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode)
|
||||||
@@ -59,20 +45,18 @@ int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode)
|
|||||||
|
|
||||||
ogs_assert(ipv4 || ipv6);
|
ogs_assert(ipv4 || ipv6);
|
||||||
ogs_assert(gnode);
|
ogs_assert(gnode);
|
||||||
ogs_assert(gnode->sa_list);
|
ogs_assert(gnode->addr);
|
||||||
|
|
||||||
addr = gnode->sa_list;
|
addr = gnode->addr;
|
||||||
while(addr)
|
while (addr) {
|
||||||
{
|
|
||||||
ogs_sock_t *sock = NULL;
|
ogs_sock_t *sock = NULL;
|
||||||
|
|
||||||
if (addr->c_sa_family == AF_INET) sock = ipv4;
|
if (addr->ogs_sa_family == AF_INET) sock = ipv4;
|
||||||
else if (addr->c_sa_family == AF_INET6) sock = ipv6;
|
else if (addr->ogs_sa_family == AF_INET6) sock = ipv6;
|
||||||
else
|
else
|
||||||
ogs_assert_if_reached();
|
ogs_assert_if_reached();
|
||||||
|
|
||||||
if (sock)
|
if (sock) {
|
||||||
{
|
|
||||||
ogs_info("gtp_connect() [%s]:%d",
|
ogs_info("gtp_connect() [%s]:%d",
|
||||||
OGS_ADDR(addr, buf), OGS_PORT(addr));
|
OGS_ADDR(addr, buf), OGS_PORT(addr));
|
||||||
|
|
||||||
@@ -84,11 +68,10 @@ int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode)
|
|||||||
addr = addr->next;
|
addr = addr->next;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (addr == NULL)
|
if (addr == NULL) {
|
||||||
{
|
|
||||||
ogs_log_message(OGS_LOG_WARN, ogs_socket_errno,
|
ogs_log_message(OGS_LOG_WARN, ogs_socket_errno,
|
||||||
"gtp_connect() [%s]:%d failed",
|
"gtp_connect() [%s]:%d failed",
|
||||||
OGS_ADDR(gnode->sa_list, buf), OGS_PORT(gnode->sa_list));
|
OGS_ADDR(gnode->addr, buf), OGS_PORT(gnode->addr));
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -100,8 +83,7 @@ ogs_sock_t *gtp_local_sock_first(ogs_list_t *list)
|
|||||||
ogs_socknode_t *snode = NULL;
|
ogs_socknode_t *snode = NULL;
|
||||||
|
|
||||||
ogs_assert(list);
|
ogs_assert(list);
|
||||||
ogs_list_for_each(list, snode)
|
ogs_list_for_each(list, snode) {
|
||||||
{
|
|
||||||
if (snode->sock)
|
if (snode->sock)
|
||||||
return snode->sock;
|
return snode->sock;
|
||||||
}
|
}
|
||||||
@@ -114,8 +96,7 @@ ogs_sockaddr_t *gtp_local_addr_first(ogs_list_t *list)
|
|||||||
ogs_socknode_t *snode = NULL;
|
ogs_socknode_t *snode = NULL;
|
||||||
|
|
||||||
ogs_assert(list);
|
ogs_assert(list);
|
||||||
ogs_list_for_each(list, snode)
|
ogs_list_for_each(list, snode) {
|
||||||
{
|
|
||||||
ogs_sock_t *sock = snode->sock;
|
ogs_sock_t *sock = snode->sock;
|
||||||
ogs_assert(snode->sock);
|
ogs_assert(snode->sock);
|
||||||
|
|
||||||
@@ -125,83 +106,6 @@ ogs_sockaddr_t *gtp_local_addr_first(ogs_list_t *list)
|
|||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
int gtp_recv(ogs_socket_t fd, ogs_pkbuf_t **pkbuf)
|
|
||||||
{
|
|
||||||
ssize_t size;
|
|
||||||
|
|
||||||
ogs_assert(fd != INVALID_SOCKET);
|
|
||||||
|
|
||||||
*pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN);
|
|
||||||
#if DEPRECATED
|
|
||||||
if ((*pkbuf) == NULL)
|
|
||||||
{
|
|
||||||
char tmp_buf[MAX_SDU_LEN];
|
|
||||||
|
|
||||||
ogs_error("Can't allocate pkbuf");
|
|
||||||
|
|
||||||
/* Read data from socket to exit from select */
|
|
||||||
ogs_recv(fd, tmp_buf, MAX_SDU_LEN, 0);
|
|
||||||
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN);
|
|
||||||
|
|
||||||
size = ogs_recv(fd, (*pkbuf)->data, (*pkbuf)->len, 0);
|
|
||||||
if (size <= 0)
|
|
||||||
{
|
|
||||||
ogs_pkbuf_free((*pkbuf));
|
|
||||||
ogs_error("ogs_recv failed");
|
|
||||||
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_pkbuf_trim(*pkbuf, size);
|
|
||||||
|
|
||||||
return OGS_OK;;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_recvfrom(ogs_socket_t fd, ogs_pkbuf_t **pkbuf, ogs_sockaddr_t *from)
|
|
||||||
{
|
|
||||||
ssize_t size;
|
|
||||||
|
|
||||||
ogs_assert(fd != INVALID_SOCKET);
|
|
||||||
ogs_assert(from);
|
|
||||||
|
|
||||||
*pkbuf = ogs_pkbuf_alloc(NULL, MAX_SDU_LEN);
|
|
||||||
#if DEPRECATED
|
|
||||||
if ((*pkbuf) == NULL)
|
|
||||||
{
|
|
||||||
char tmp_buf[MAX_SDU_LEN];
|
|
||||||
|
|
||||||
ogs_error("Can't allocate pkbuf");
|
|
||||||
|
|
||||||
/* Read data from socket to exit from select */
|
|
||||||
ogs_recv(fd, tmp_buf, MAX_SDU_LEN, 0);
|
|
||||||
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
ogs_pkbuf_put(*pkbuf, MAX_SDU_LEN);
|
|
||||||
|
|
||||||
size = ogs_recvfrom(fd, (*pkbuf)->data, (*pkbuf)->len, 0, from);
|
|
||||||
if (size <= 0)
|
|
||||||
{
|
|
||||||
ogs_pkbuf_free((*pkbuf));
|
|
||||||
ogs_error("ogs_recvfrom() failed");
|
|
||||||
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_pkbuf_trim(*pkbuf, size);
|
|
||||||
|
|
||||||
return OGS_OK;;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
|
int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
|
||||||
{
|
{
|
||||||
ssize_t sent;
|
ssize_t sent;
|
||||||
@@ -213,8 +117,7 @@ int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
|
|||||||
ogs_assert(sock);
|
ogs_assert(sock);
|
||||||
|
|
||||||
sent = ogs_send(sock->fd, pkbuf->data, pkbuf->len, 0);
|
sent = ogs_send(sock->fd, pkbuf->data, pkbuf->len, 0);
|
||||||
if (sent < 0 || sent != pkbuf->len)
|
if (sent < 0 || sent != pkbuf->len) {
|
||||||
{
|
|
||||||
ogs_error("ogs_send() failed");
|
ogs_error("ogs_send() failed");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -236,8 +139,7 @@ int gtp_sendto(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf)
|
|||||||
ogs_assert(conn);
|
ogs_assert(conn);
|
||||||
|
|
||||||
sent = ogs_sendto(sock->fd, pkbuf->data, pkbuf->len, 0, conn);
|
sent = ogs_sendto(sock->fd, pkbuf->data, pkbuf->len, 0, conn);
|
||||||
if (sent < 0 || sent != pkbuf->len)
|
if (sent < 0 || sent != pkbuf->len) {
|
||||||
{
|
|
||||||
ogs_error("ogs_send() failed");
|
ogs_error("ogs_send() failed");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -257,13 +159,11 @@ ogs_pkbuf_t *gtp_handle_echo_req(ogs_pkbuf_t *pkb)
|
|||||||
|
|
||||||
gtph = (gtp_header_t *)pkb->data;
|
gtph = (gtp_header_t *)pkb->data;
|
||||||
/* Check GTP version. Now only support GTPv1(version = 1) */
|
/* Check GTP version. Now only support GTPv1(version = 1) */
|
||||||
if ((gtph->flags >> 5) != 1)
|
if ((gtph->flags >> 5) != 1) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (gtph->type != GTPU_MSGTYPE_ECHO_REQ)
|
if (gtph->type != GTPU_MSGTYPE_ECHO_REQ) {
|
||||||
{
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -282,31 +182,24 @@ ogs_pkbuf_t *gtp_handle_echo_req(ogs_pkbuf_t *pkb)
|
|||||||
gtph_resp->teid = 0;
|
gtph_resp->teid = 0;
|
||||||
idx = 8;
|
idx = 8;
|
||||||
|
|
||||||
if (gtph->flags & (GTPU_FLAGS_PN | GTPU_FLAGS_S))
|
if (gtph->flags & (GTPU_FLAGS_PN | GTPU_FLAGS_S)) {
|
||||||
{
|
|
||||||
length += 4;
|
length += 4;
|
||||||
if (gtph->flags & GTPU_FLAGS_S)
|
if (gtph->flags & GTPU_FLAGS_S) {
|
||||||
{
|
|
||||||
/* sequence exists */
|
/* sequence exists */
|
||||||
gtph_resp->flags |= GTPU_FLAGS_S;
|
gtph_resp->flags |= GTPU_FLAGS_S;
|
||||||
*((uint8_t *)pkb_resp->data + idx) = *((uint8_t *)pkb->data + idx);
|
*((uint8_t *)pkb_resp->data + idx) = *((uint8_t *)pkb->data + idx);
|
||||||
*((uint8_t *)pkb_resp->data + idx + 1) =
|
*((uint8_t *)pkb_resp->data + idx + 1) =
|
||||||
*((uint8_t *)pkb->data + idx + 1);
|
*((uint8_t *)pkb->data + idx + 1);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*((uint8_t *)pkb_resp->data + idx) = 0;
|
*((uint8_t *)pkb_resp->data + idx) = 0;
|
||||||
*((uint8_t *)pkb_resp->data + idx + 1) = 0;
|
*((uint8_t *)pkb_resp->data + idx + 1) = 0;
|
||||||
}
|
}
|
||||||
idx += 2;
|
idx += 2;
|
||||||
if (gtph->flags & GTPU_FLAGS_PN)
|
if (gtph->flags & GTPU_FLAGS_PN) {
|
||||||
{
|
|
||||||
/* sequence exists */
|
/* sequence exists */
|
||||||
gtph_resp->flags |= GTPU_FLAGS_PN;
|
gtph_resp->flags |= GTPU_FLAGS_PN;
|
||||||
*((uint8_t *)pkb_resp->data + idx) = *((uint8_t *)pkb->data + idx);
|
*((uint8_t *)pkb_resp->data + idx) = *((uint8_t *)pkb->data + idx);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
*((uint8_t *)pkb_resp->data + idx) = 0;
|
*((uint8_t *)pkb_resp->data + idx) = 0;
|
||||||
}
|
}
|
||||||
idx++;
|
idx++;
|
||||||
@@ -17,24 +17,21 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTP_PATH_H__
|
#ifndef GTP_PATH_H
|
||||||
#define __GTP_PATH_H__
|
#define GTP_PATH_H
|
||||||
|
|
||||||
typedef struct _gtp_node_t gtp_node_t;
|
typedef struct gtp_node_s gtp_node_t;
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
int gtp_server(ogs_socknode_t *snode);
|
ogs_sock_t *gtp_server(ogs_socknode_t *node);
|
||||||
int gtp_client(gtp_node_t *gnode);
|
|
||||||
int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode);
|
int gtp_connect(ogs_sock_t *ipv4, ogs_sock_t *ipv6, gtp_node_t *gnode);
|
||||||
|
|
||||||
ogs_sock_t *gtp_local_sock_first(ogs_list_t *list);
|
ogs_sock_t *gtp_local_sock_first(ogs_list_t *list);
|
||||||
ogs_sockaddr_t *gtp_local_addr_first(ogs_list_t *list);
|
ogs_sockaddr_t *gtp_local_addr_first(ogs_list_t *list);
|
||||||
|
|
||||||
int gtp_recv(ogs_socket_t fd, ogs_pkbuf_t **pkbuf);
|
|
||||||
int gtp_recvfrom(ogs_socket_t fd, ogs_pkbuf_t **pkbuf, ogs_sockaddr_t *from);
|
|
||||||
int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf);
|
int gtp_send(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf);
|
||||||
int gtp_sendto(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf);
|
int gtp_sendto(gtp_node_t *gnode, ogs_pkbuf_t *pkbuf);
|
||||||
|
|
||||||
@@ -42,6 +39,6 @@ ogs_pkbuf_t *gtp_handle_echo_req(ogs_pkbuf_t *pkt);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GTP_PATH_H__ */
|
#endif /* GTP_PATH_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gtp_tlv.h"
|
#include "gtp-tlv.h"
|
||||||
|
|
||||||
tlv_desc_t tlv_desc_more1 = { TLV_MORE, "More", 0, 1, 0, 0, { NULL } };
|
tlv_desc_t tlv_desc_more1 = { TLV_MORE, "More", 0, 1, 0, 0, { NULL } };
|
||||||
tlv_desc_t tlv_desc_more2 = { TLV_MORE, "More", 0, 2, 0, 0, { NULL } };
|
tlv_desc_t tlv_desc_more2 = { TLV_MORE, "More", 0, 2, 0, 0, { NULL } };
|
||||||
@@ -31,113 +31,107 @@ tlv_desc_t tlv_desc_more8 = { TLV_MORE, "More", 0, 8, 0, 0, { NULL } };
|
|||||||
static ogs_tlv_t* tlv_add_leaf(
|
static ogs_tlv_t* tlv_add_leaf(
|
||||||
ogs_tlv_t *parent_tlv, ogs_tlv_t *tlv, tlv_desc_t *desc, void *msg)
|
ogs_tlv_t *parent_tlv, ogs_tlv_t *tlv, tlv_desc_t *desc, void *msg)
|
||||||
{
|
{
|
||||||
switch (desc->ctype)
|
switch (desc->ctype) {
|
||||||
|
case TLV_UINT8:
|
||||||
|
case TLV_INT8:
|
||||||
{
|
{
|
||||||
case TLV_UINT8:
|
tlv_uint8_t *v = (tlv_uint8_t *)msg;
|
||||||
case TLV_INT8:
|
if (parent_tlv)
|
||||||
{
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
tlv_uint8_t *v = (tlv_uint8_t *)msg;
|
desc->type, 1, desc->instance, &v->u8);
|
||||||
if (parent_tlv)
|
else
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_add(tlv, desc->type, 1, desc->instance, &v->u8);
|
||||||
desc->type, 1, desc->instance, (uint8_t*)&v->u8);
|
ogs_assert(tlv);
|
||||||
else
|
break;
|
||||||
tlv = ogs_tlv_add(tlv,
|
}
|
||||||
desc->type, 1, desc->instance, (uint8_t*)&v->u8);
|
case TLV_UINT16:
|
||||||
ogs_assert(tlv);
|
{
|
||||||
break;
|
tlv_uint16_t *v = (tlv_uint16_t *)msg;
|
||||||
}
|
|
||||||
case TLV_UINT16:
|
|
||||||
{
|
|
||||||
tlv_uint16_t *v = (tlv_uint16_t *)msg;
|
|
||||||
|
|
||||||
v->u16 = htons(v->u16);
|
v->u16 = htons(v->u16);
|
||||||
|
|
||||||
if (parent_tlv)
|
if (parent_tlv)
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
desc->type, 2, desc->instance, (uint8_t*)&v->u16);
|
desc->type, 2, desc->instance, &v->u16);
|
||||||
else
|
else
|
||||||
tlv = ogs_tlv_add(tlv,
|
tlv = ogs_tlv_add(tlv, desc->type, 2, desc->instance, &v->u16);
|
||||||
desc->type, 2, desc->instance, (uint8_t*)&v->u16);
|
ogs_assert(tlv);
|
||||||
ogs_assert(tlv);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case TLV_UINT24:
|
||||||
case TLV_UINT24:
|
case TLV_INT24:
|
||||||
case TLV_INT24:
|
{
|
||||||
{
|
tlv_uint24_t *v = (tlv_uint24_t *)msg;
|
||||||
tlv_uint24_t *v = (tlv_uint24_t *)msg;
|
|
||||||
|
|
||||||
v->u24 = v->u24 << 8;
|
v->u24 = v->u24 << 8;
|
||||||
v->u24 = htonl(v->u24);
|
v->u24 = htonl(v->u24);
|
||||||
|
|
||||||
if (parent_tlv)
|
if (parent_tlv)
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
desc->type, 3, desc->instance, (uint8_t*)&v->u24);
|
desc->type, 3, desc->instance, &v->u24);
|
||||||
else
|
else
|
||||||
tlv = ogs_tlv_add(tlv,
|
tlv = ogs_tlv_add(tlv, desc->type, 3, desc->instance, &v->u24);
|
||||||
desc->type, 3, desc->instance, (uint8_t*)&v->u24);
|
ogs_assert(tlv);
|
||||||
ogs_assert(tlv);
|
break;
|
||||||
break;
|
}
|
||||||
}
|
case TLV_UINT32:
|
||||||
case TLV_UINT32:
|
case TLV_INT32:
|
||||||
case TLV_INT32:
|
{
|
||||||
{
|
tlv_uint32_t *v = (tlv_uint32_t *)msg;
|
||||||
tlv_uint32_t *v = (tlv_uint32_t *)msg;
|
|
||||||
|
|
||||||
v->u32 = htonl(v->u32);
|
v->u32 = htonl(v->u32);
|
||||||
|
|
||||||
if (parent_tlv)
|
if (parent_tlv)
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
desc->type, 4, desc->instance, (uint8_t*)&v->u32);
|
desc->type, 4, desc->instance, &v->u32);
|
||||||
else
|
else
|
||||||
tlv = ogs_tlv_add(tlv,
|
tlv = ogs_tlv_add(tlv,
|
||||||
desc->type, 4, desc->instance, (uint8_t*)&v->u32);
|
desc->type, 4, desc->instance, &v->u32);
|
||||||
ogs_assert(tlv);
|
ogs_assert(tlv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TLV_FIXED_STR:
|
case TLV_FIXED_STR:
|
||||||
{
|
{
|
||||||
tlv_octet_t *v = (tlv_octet_t *)msg;
|
tlv_octet_t *v = (tlv_octet_t *)msg;
|
||||||
|
|
||||||
if (parent_tlv)
|
if (parent_tlv)
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
desc->type, desc->length, desc->instance, v->data);
|
desc->type, desc->length, desc->instance, v->data);
|
||||||
else
|
else
|
||||||
tlv = ogs_tlv_add(tlv,
|
tlv = ogs_tlv_add(tlv,
|
||||||
desc->type, desc->length, desc->instance, v->data);
|
desc->type, desc->length, desc->instance, v->data);
|
||||||
ogs_assert(tlv);
|
ogs_assert(tlv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TLV_VAR_STR:
|
case TLV_VAR_STR:
|
||||||
{
|
{
|
||||||
tlv_octet_t *v = (tlv_octet_t *)msg;
|
tlv_octet_t *v = (tlv_octet_t *)msg;
|
||||||
|
|
||||||
ogs_assert(v->len > 0);
|
ogs_assert(v->len > 0);
|
||||||
|
|
||||||
if (parent_tlv)
|
if (parent_tlv)
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
desc->type, v->len, desc->instance, v->data);
|
desc->type, v->len, desc->instance, v->data);
|
||||||
else
|
else
|
||||||
tlv = ogs_tlv_add(tlv,
|
tlv = ogs_tlv_add(tlv,
|
||||||
desc->type, v->len, desc->instance, v->data);
|
desc->type, v->len, desc->instance, v->data);
|
||||||
ogs_assert(tlv);
|
ogs_assert(tlv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case TLV_NULL:
|
case TLV_NULL:
|
||||||
{
|
{
|
||||||
if (parent_tlv)
|
if (parent_tlv)
|
||||||
tlv = ogs_tlv_embed(parent_tlv,
|
tlv = ogs_tlv_embed(parent_tlv,
|
||||||
desc->type, 0, desc->instance, NULL);
|
desc->type, 0, desc->instance, NULL);
|
||||||
else
|
else
|
||||||
tlv = ogs_tlv_add(tlv,
|
tlv = ogs_tlv_add(tlv,
|
||||||
desc->type, 0, desc->instance, NULL);
|
desc->type, 0, desc->instance, NULL);
|
||||||
ogs_assert(tlv);
|
ogs_assert(tlv);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
ogs_assert_if_reached();
|
||||||
ogs_assert_if_reached();
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return tlv;
|
return tlv;
|
||||||
@@ -164,21 +158,17 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||||||
*root = NULL;
|
*root = NULL;
|
||||||
|
|
||||||
for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL;
|
for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL;
|
||||||
i++, desc = parent_desc->child_descs[i])
|
i++, desc = parent_desc->child_descs[i]) {
|
||||||
{
|
|
||||||
next_desc = parent_desc->child_descs[i+1];
|
next_desc = parent_desc->child_descs[i+1];
|
||||||
if (next_desc != NULL && next_desc->ctype == TLV_MORE)
|
if (next_desc != NULL && next_desc->ctype == TLV_MORE) {
|
||||||
{
|
|
||||||
int offset2 = offset;
|
int offset2 = offset;
|
||||||
for (j = 0; j < next_desc->length; j++)
|
for (j = 0; j < next_desc->length; j++) {
|
||||||
{
|
|
||||||
presence_p = (tlv_presence_t *)(p + offset2);
|
presence_p = (tlv_presence_t *)(p + offset2);
|
||||||
|
|
||||||
if (*presence_p == 0)
|
if (*presence_p == 0)
|
||||||
break;
|
break;
|
||||||
|
|
||||||
if (desc->ctype == TLV_COMPOUND)
|
if (desc->ctype == TLV_COMPOUND) {
|
||||||
{
|
|
||||||
ogs_trace("BUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
|
ogs_trace("BUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
|
||||||
indent, i, desc->name, desc->type, desc->instance,
|
indent, i, desc->name, desc->type, desc->instance,
|
||||||
desc->vsize, p + offset2);
|
desc->vsize, p + offset2);
|
||||||
@@ -193,9 +183,7 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||||||
p + offset2 + sizeof(tlv_presence_t), depth + 1);
|
p + offset2 + sizeof(tlv_presence_t), depth + 1);
|
||||||
ogs_assert(r > 0 && emb_tlv);
|
ogs_assert(r > 0 && emb_tlv);
|
||||||
count += 1 + r;
|
count += 1 + r;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d "
|
ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d "
|
||||||
"(cls:%d vsz:%d) off:%p ",
|
"(cls:%d vsz:%d) off:%p ",
|
||||||
indent, i, desc->name, desc->type, desc->length,
|
indent, i, desc->name, desc->type, desc->length,
|
||||||
@@ -214,15 +202,11 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||||||
}
|
}
|
||||||
offset += desc->vsize * next_desc->length;
|
offset += desc->vsize * next_desc->length;
|
||||||
i++;
|
i++;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
presence_p = (tlv_presence_t *)(p + offset);
|
presence_p = (tlv_presence_t *)(p + offset);
|
||||||
|
|
||||||
if (*presence_p)
|
if (*presence_p) {
|
||||||
{
|
if (desc->ctype == TLV_COMPOUND) {
|
||||||
if (desc->ctype == TLV_COMPOUND)
|
|
||||||
{
|
|
||||||
ogs_trace("BUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
|
ogs_trace("BUILD %sC#%d [%s] T:%d I:%d (vsz=%d) off:%p ",
|
||||||
indent, i, desc->name, desc->type, desc->instance,
|
indent, i, desc->name, desc->type, desc->instance,
|
||||||
desc->vsize, p + offset);
|
desc->vsize, p + offset);
|
||||||
@@ -237,9 +221,7 @@ static uint32_t tlv_add_compound(ogs_tlv_t **root, ogs_tlv_t *parent_tlv,
|
|||||||
p + offset + sizeof(tlv_presence_t), depth + 1);
|
p + offset + sizeof(tlv_presence_t), depth + 1);
|
||||||
ogs_assert(r > 0 && emb_tlv);
|
ogs_assert(r > 0 && emb_tlv);
|
||||||
count += 1 + r;
|
count += 1 + r;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d "
|
ogs_trace("BUILD %sL#%d [%s] T:%d L:%d I:%d "
|
||||||
"(cls:%d vsz:%d) off:%p ",
|
"(cls:%d vsz:%d) off:%p ",
|
||||||
indent, i, desc->name, desc->type, desc->length,
|
indent, i, desc->name, desc->type, desc->length,
|
||||||
@@ -300,22 +282,17 @@ static tlv_desc_t* tlv_find_desc(uint8_t *desc_index,
|
|||||||
ogs_assert(tlv);
|
ogs_assert(tlv);
|
||||||
|
|
||||||
for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL;
|
for (i = 0, desc = parent_desc->child_descs[i]; desc != NULL;
|
||||||
i++, desc = parent_desc->child_descs[i])
|
i++, desc = parent_desc->child_descs[i]) {
|
||||||
{
|
if (desc->type == tlv->type && desc->instance == tlv->instance) {
|
||||||
if (desc->type == tlv->type && desc->instance == tlv->instance)
|
|
||||||
{
|
|
||||||
*desc_index = i;
|
*desc_index = i;
|
||||||
*tlv_offset = offset;
|
*tlv_offset = offset;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->ctype == TLV_MORE)
|
if (desc->ctype == TLV_MORE) {
|
||||||
{
|
|
||||||
ogs_assert(prev_desc && prev_desc->ctype != TLV_MORE);
|
ogs_assert(prev_desc && prev_desc->ctype != TLV_MORE);
|
||||||
offset += prev_desc->vsize * (desc->length - 1);
|
offset += prev_desc->vsize * (desc->length - 1);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
offset += desc->vsize;
|
offset += desc->vsize;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -331,101 +308,99 @@ static int tlv_parse_leaf(void *msg, tlv_desc_t *desc, ogs_tlv_t *tlv)
|
|||||||
ogs_assert(desc);
|
ogs_assert(desc);
|
||||||
ogs_assert(tlv);
|
ogs_assert(tlv);
|
||||||
|
|
||||||
switch (desc->ctype)
|
switch (desc->ctype) {
|
||||||
|
case TLV_UINT8:
|
||||||
|
case TLV_INT8:
|
||||||
{
|
{
|
||||||
case TLV_UINT8:
|
tlv_uint8_t *v = (tlv_uint8_t *)msg;
|
||||||
case TLV_INT8:
|
|
||||||
{
|
|
||||||
tlv_uint8_t *v = (tlv_uint8_t *)msg;
|
|
||||||
|
|
||||||
if (tlv->length != 1)
|
if (tlv->length != 1)
|
||||||
{
|
|
||||||
ogs_error("Invalid TLV length %d. It should be 1", tlv->length);
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
v->u8 = *(uint8_t*)(tlv->value);
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
case TLV_UINT16:
|
|
||||||
case TLV_INT16:
|
|
||||||
{
|
{
|
||||||
tlv_uint16_t *v = (tlv_uint16_t *)msg;
|
ogs_error("Invalid TLV length %d. It should be 1", tlv->length);
|
||||||
|
return OGS_ERROR;
|
||||||
if (tlv->length != 2)
|
|
||||||
{
|
|
||||||
ogs_error("Invalid TLV length %d. It should be 2", tlv->length);
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
v->u16 = ((((uint8_t*)tlv->value)[0]<< 8)&0xff00) |
|
|
||||||
((((uint8_t*)tlv->value)[1] )&0x00ff);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case TLV_UINT24:
|
v->u8 = *(uint8_t*)(tlv->value);
|
||||||
case TLV_INT24:
|
break;
|
||||||
|
}
|
||||||
|
case TLV_UINT16:
|
||||||
|
case TLV_INT16:
|
||||||
|
{
|
||||||
|
tlv_uint16_t *v = (tlv_uint16_t *)msg;
|
||||||
|
|
||||||
|
if (tlv->length != 2)
|
||||||
{
|
{
|
||||||
tlv_uint24_t *v = (tlv_uint24_t *)msg;
|
ogs_error("Invalid TLV length %d. It should be 2", tlv->length);
|
||||||
|
return OGS_ERROR;
|
||||||
if (tlv->length != 3)
|
|
||||||
{
|
|
||||||
ogs_error("Invalid TLV length %d. It should be 3", tlv->length);
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
v->u24 = ((((uint8_t*)tlv->value)[0]<<16)&0x00ff0000) |
|
|
||||||
((((uint8_t*)tlv->value)[1]<< 8)&0x0000ff00) |
|
|
||||||
((((uint8_t*)tlv->value)[2] )&0x000000ff);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case TLV_UINT32:
|
v->u16 = ((((uint8_t*)tlv->value)[0]<< 8)&0xff00) |
|
||||||
case TLV_INT32:
|
((((uint8_t*)tlv->value)[1] )&0x00ff);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TLV_UINT24:
|
||||||
|
case TLV_INT24:
|
||||||
|
{
|
||||||
|
tlv_uint24_t *v = (tlv_uint24_t *)msg;
|
||||||
|
|
||||||
|
if (tlv->length != 3)
|
||||||
{
|
{
|
||||||
tlv_uint32_t *v = (tlv_uint32_t *)msg;
|
ogs_error("Invalid TLV length %d. It should be 3", tlv->length);
|
||||||
|
return OGS_ERROR;
|
||||||
if (tlv->length != 4)
|
|
||||||
{
|
|
||||||
ogs_error("Invalid TLV length %d. It should be 4", tlv->length);
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
v->u32 = ((((uint8_t*)tlv->value)[0]<<24)&0xff000000) |
|
|
||||||
((((uint8_t*)tlv->value)[1]<<16)&0x00ff0000) |
|
|
||||||
((((uint8_t*)tlv->value)[2]<< 8)&0x0000ff00) |
|
|
||||||
((((uint8_t*)tlv->value)[3] )&0x000000ff);
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case TLV_FIXED_STR:
|
v->u24 = ((((uint8_t*)tlv->value)[0]<<16)&0x00ff0000) |
|
||||||
|
((((uint8_t*)tlv->value)[1]<< 8)&0x0000ff00) |
|
||||||
|
((((uint8_t*)tlv->value)[2] )&0x000000ff);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TLV_UINT32:
|
||||||
|
case TLV_INT32:
|
||||||
|
{
|
||||||
|
tlv_uint32_t *v = (tlv_uint32_t *)msg;
|
||||||
|
|
||||||
|
if (tlv->length != 4)
|
||||||
{
|
{
|
||||||
tlv_octet_t *v = (tlv_octet_t *)msg;
|
ogs_error("Invalid TLV length %d. It should be 4", tlv->length);
|
||||||
|
return OGS_ERROR;
|
||||||
if (tlv->length != desc->length)
|
|
||||||
{
|
|
||||||
ogs_error("Invalid TLV length %d. It should be %d",
|
|
||||||
tlv->length, desc->length);
|
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
|
|
||||||
v->data = tlv->value;
|
|
||||||
v->len = tlv->length;
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
case TLV_VAR_STR:
|
v->u32 = ((((uint8_t*)tlv->value)[0]<<24)&0xff000000) |
|
||||||
|
((((uint8_t*)tlv->value)[1]<<16)&0x00ff0000) |
|
||||||
|
((((uint8_t*)tlv->value)[2]<< 8)&0x0000ff00) |
|
||||||
|
((((uint8_t*)tlv->value)[3] )&0x000000ff);
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TLV_FIXED_STR:
|
||||||
|
{
|
||||||
|
tlv_octet_t *v = (tlv_octet_t *)msg;
|
||||||
|
|
||||||
|
if (tlv->length != desc->length)
|
||||||
{
|
{
|
||||||
tlv_octet_t *v = (tlv_octet_t *)msg;
|
ogs_error("Invalid TLV length %d. It should be %d",
|
||||||
|
tlv->length, desc->length);
|
||||||
|
return OGS_ERROR;
|
||||||
|
}
|
||||||
|
|
||||||
v->data = tlv->value;
|
v->data = tlv->value;
|
||||||
v->len = tlv->length;
|
v->len = tlv->length;
|
||||||
break;
|
break;
|
||||||
|
}
|
||||||
|
case TLV_VAR_STR:
|
||||||
|
{
|
||||||
|
tlv_octet_t *v = (tlv_octet_t *)msg;
|
||||||
|
|
||||||
|
v->data = tlv->value;
|
||||||
|
v->len = tlv->length;
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
case TLV_NULL:
|
||||||
|
{
|
||||||
|
if (tlv->length != 0) {
|
||||||
|
ogs_error("Invalid TLV length %d. It should be 0", tlv->length);
|
||||||
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
case TLV_NULL:
|
break;
|
||||||
{
|
}
|
||||||
if (tlv->length != 0)
|
default:
|
||||||
{
|
ogs_assert_if_reached();
|
||||||
ogs_error("Invalid TLV length %d. It should be 0", tlv->length);
|
break;
|
||||||
return OGS_ERROR;
|
|
||||||
}
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
default:
|
|
||||||
ogs_assert_if_reached();
|
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
@@ -452,11 +427,9 @@ static int tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
|
|||||||
indent[depth*2] = 0;
|
indent[depth*2] = 0;
|
||||||
|
|
||||||
tlv = parent_tlv;
|
tlv = parent_tlv;
|
||||||
while(tlv)
|
while (tlv) {
|
||||||
{
|
|
||||||
desc = tlv_find_desc(&index, &offset, parent_desc, tlv);
|
desc = tlv_find_desc(&index, &offset, parent_desc, tlv);
|
||||||
if (desc == NULL)
|
if (desc == NULL) {
|
||||||
{
|
|
||||||
ogs_error("Unexpected TLV type:%d", tlv->type);
|
ogs_error("Unexpected TLV type:%d", tlv->type);
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -465,19 +438,15 @@ static int tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
|
|||||||
|
|
||||||
/* Multiple of the same type TLV may be included */
|
/* Multiple of the same type TLV may be included */
|
||||||
next_desc = parent_desc->child_descs[index+1];
|
next_desc = parent_desc->child_descs[index+1];
|
||||||
if (next_desc != NULL && next_desc->ctype == TLV_MORE)
|
if (next_desc != NULL && next_desc->ctype == TLV_MORE) {
|
||||||
{
|
for (j = 0; j < next_desc->length; j++) {
|
||||||
for (j = 0; j < next_desc->length; j++)
|
|
||||||
{
|
|
||||||
presence_p = (tlv_presence_t *)(p + offset + desc->vsize * j);
|
presence_p = (tlv_presence_t *)(p + offset + desc->vsize * j);
|
||||||
if (*presence_p == 0)
|
if (*presence_p == 0) {
|
||||||
{
|
|
||||||
offset += desc->vsize * j;
|
offset += desc->vsize * j;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (j == next_desc->length)
|
if (j == next_desc->length) {
|
||||||
{
|
|
||||||
ogs_fatal("Multiple of the same type TLV need more room");
|
ogs_fatal("Multiple of the same type TLV need more room");
|
||||||
ogs_assert_if_reached();
|
ogs_assert_if_reached();
|
||||||
tlv = tlv->next;
|
tlv = tlv->next;
|
||||||
@@ -485,11 +454,9 @@ static int tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (desc->ctype == TLV_COMPOUND)
|
if (desc->ctype == TLV_COMPOUND) {
|
||||||
{
|
|
||||||
emb_tlv = ogs_tlv_parse_embedded_block(tlv, mode);
|
emb_tlv = ogs_tlv_parse_embedded_block(tlv, mode);
|
||||||
if (emb_tlv == NULL)
|
if (emb_tlv == NULL) {
|
||||||
{
|
|
||||||
ogs_error("Error while parse TLV");
|
ogs_error("Error while parse TLV");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -502,24 +469,20 @@ static int tlv_parse_compound(void *msg, tlv_desc_t *parent_desc,
|
|||||||
|
|
||||||
rv = tlv_parse_compound(
|
rv = tlv_parse_compound(
|
||||||
p + offset, desc, emb_tlv, depth + 1, mode);
|
p + offset, desc, emb_tlv, depth + 1, mode);
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK) {
|
||||||
{
|
|
||||||
ogs_error("Can't parse compound TLV");
|
ogs_error("Can't parse compound TLV");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
|
|
||||||
*presence_p = 1;
|
*presence_p = 1;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_trace("PARSE %sL#%d [%s] T:%d L:%d I:%d "
|
ogs_trace("PARSE %sL#%d [%s] T:%d L:%d I:%d "
|
||||||
"(cls:%d vsz:%d) off:%p ",
|
"(cls:%d vsz:%d) off:%p ",
|
||||||
indent, i++, desc->name, desc->type, desc->length,
|
indent, i++, desc->name, desc->type, desc->length,
|
||||||
desc->instance, desc->ctype, desc->vsize, p + offset);
|
desc->instance, desc->ctype, desc->vsize, p + offset);
|
||||||
|
|
||||||
rv = tlv_parse_leaf(p + offset, desc, tlv);
|
rv = tlv_parse_leaf(p + offset, desc, tlv);
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK) {
|
||||||
{
|
|
||||||
ogs_error("Can't parse leaf TLV");
|
ogs_error("Can't parse leaf TLV");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -546,8 +509,7 @@ int tlv_parse_msg(void *msg, tlv_desc_t *desc, ogs_pkbuf_t *pkbuf, int mode)
|
|||||||
ogs_assert(desc->child_descs[0]);
|
ogs_assert(desc->child_descs[0]);
|
||||||
|
|
||||||
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, mode);
|
root = ogs_tlv_parse_block(pkbuf->len, pkbuf->data, mode);
|
||||||
if (root == NULL)
|
if (root == NULL) {
|
||||||
{
|
|
||||||
ogs_error("Can't parse TLV message");
|
ogs_error("Can't parse TLV message");
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTP_TLV_H__
|
#ifndef GTP_TLV_H
|
||||||
#define __GTP_TLV_H__
|
#define GTP_TLV_H
|
||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
|
|
||||||
@@ -50,7 +50,7 @@ typedef enum {
|
|||||||
TLV_MESSAGE,
|
TLV_MESSAGE,
|
||||||
} tlv_type_e;
|
} tlv_type_e;
|
||||||
|
|
||||||
typedef struct _tlv_desc_t {
|
typedef struct tlv_desc_s {
|
||||||
tlv_type_e ctype;
|
tlv_type_e ctype;
|
||||||
char *name;
|
char *name;
|
||||||
uint16_t type;
|
uint16_t type;
|
||||||
@@ -72,49 +72,49 @@ extern tlv_desc_t tlv_desc_more8;
|
|||||||
typedef uint64_t tlv_presence_t;
|
typedef uint64_t tlv_presence_t;
|
||||||
|
|
||||||
/* 8-bit Unsigned integer */
|
/* 8-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint8_t {
|
typedef struct tlv_uint8_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint8_t u8;
|
uint8_t u8;
|
||||||
} tlv_uint8_t;
|
} tlv_uint8_t;
|
||||||
|
|
||||||
/* 16-bit Unsigned integer */
|
/* 16-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint16_t {
|
typedef struct tlv_uint16_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint16_t u16;
|
uint16_t u16;
|
||||||
} tlv_uint16_t;
|
} tlv_uint16_t;
|
||||||
|
|
||||||
/* 24-bit Unsigned integer */
|
/* 24-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint24_t {
|
typedef struct tlv_uint24_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint32_t u24; /* Only 3 bytes valid */
|
uint32_t u24; /* Only 3 bytes valid */
|
||||||
} tlv_uint24_t;
|
} tlv_uint24_t;
|
||||||
|
|
||||||
/* 32-bit Unsigned integer */
|
/* 32-bit Unsigned integer */
|
||||||
typedef struct _tlv_uint32_t {
|
typedef struct tlv_uint32_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
uint32_t u32;
|
uint32_t u32;
|
||||||
} tlv_uint32_t;
|
} tlv_uint32_t;
|
||||||
|
|
||||||
/* 8-bit Signed integer */
|
/* 8-bit Signed integer */
|
||||||
typedef struct _tlv_int8_t {
|
typedef struct tlv_int8_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int8_t i8;
|
int8_t i8;
|
||||||
} tlv_int8_t;
|
} tlv_int8_t;
|
||||||
|
|
||||||
/* 16-bit Signed integer */
|
/* 16-bit Signed integer */
|
||||||
typedef struct _tlv_int16t {
|
typedef struct tlv_int16_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int16_t i16;
|
int16_t i16;
|
||||||
} tlv_int16_t;
|
} tlv_int16_t;
|
||||||
|
|
||||||
/* 24-bit Signed integer */
|
/* 24-bit Signed integer */
|
||||||
typedef struct _tlv_int24_t {
|
typedef struct tlv_int24_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int32_t i24; /* Only 3 bytes valid */
|
int32_t i24; /* Only 3 bytes valid */
|
||||||
} tlv_int24_t;
|
} tlv_int24_t;
|
||||||
|
|
||||||
/* 32-bit Signed integer */
|
/* 32-bit Signed integer */
|
||||||
typedef struct _tlv_int32_t {
|
typedef struct tlv_int32_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
int32_t i32;
|
int32_t i32;
|
||||||
} tlv_int32_t;
|
} tlv_int32_t;
|
||||||
@@ -142,14 +142,14 @@ typedef struct _tlv_int32_t {
|
|||||||
(__dST)->data = ogs_calloc((__dST)->len, sizeof(uint8_t)); \
|
(__dST)->data = ogs_calloc((__dST)->len, sizeof(uint8_t)); \
|
||||||
memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \
|
memcpy((__dST)->data, (__sRC)->data, (__dST)->len); \
|
||||||
} while(0)
|
} while(0)
|
||||||
typedef struct _tlv_octet_t {
|
typedef struct tlv_octet_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
void *data;
|
void *data;
|
||||||
uint32_t len;
|
uint32_t len;
|
||||||
} tlv_octet_t;
|
} tlv_octet_t;
|
||||||
|
|
||||||
/* No value */
|
/* No value */
|
||||||
typedef struct _tlv_null {
|
typedef struct tlv_null_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
} tlv_null_t;
|
} tlv_null_t;
|
||||||
|
|
||||||
@@ -161,4 +161,4 @@ int tlv_parse_msg(void *msg, tlv_desc_t *desc, ogs_pkbuf_t *pkbuf, int mode);
|
|||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* __GTP_TLV_H__ */
|
#endif /* GTP_TLV_H */
|
||||||
@@ -17,8 +17,8 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gtp_types.h"
|
#include "gtp-types.h"
|
||||||
#include "gtp_message.h"
|
#include "gtp-message.h"
|
||||||
|
|
||||||
/* 8.13 Protocol Configuration Options (PCO)
|
/* 8.13 Protocol Configuration Options (PCO)
|
||||||
* 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 */
|
* 10.5.6.3 Protocol configuration options in 3GPP TS 24.008 */
|
||||||
@@ -17,21 +17,19 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTP_TYPES_H__
|
#ifndef GTP_TYPES_H
|
||||||
#define __GTP_TYPES_H__
|
#define GTP_TYPES_H
|
||||||
|
|
||||||
#include "base/types.h"
|
#include "base/types.h"
|
||||||
#include "base/context.h"
|
#include "base/context.h"
|
||||||
#include "gtp_tlv.h"
|
#include "gtp-tlv.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_gtp_domain
|
#define OGS_LOG_DOMAIN __base_gtp_domain
|
||||||
|
|
||||||
typedef struct c_sockaddr_t c_sockaddr_t;
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
/* 8.4 Cause */
|
/* 8.4 Cause */
|
||||||
#define GTP_CAUSE_LOCAL_DETACH 2
|
#define GTP_CAUSE_LOCAL_DETACH 2
|
||||||
@@ -112,7 +110,7 @@ extern "C" {
|
|||||||
#define GTP_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED 126
|
#define GTP_CAUSE_MULTIPLE_ACCESSES_TO_A_PDN_CONNECTION_NOT_ALLOWED 126
|
||||||
#define GTP_CAUSE_REQUEST_REJECTED_DUE_TO_UE_CAPABILITY 127
|
#define GTP_CAUSE_REQUEST_REJECTED_DUE_TO_UE_CAPABILITY 127
|
||||||
|
|
||||||
typedef struct _gtp_cause_t {
|
typedef struct gtp_cause_s {
|
||||||
uint8_t value;
|
uint8_t value;
|
||||||
ED4(uint8_t spare:5;,
|
ED4(uint8_t spare:5;,
|
||||||
uint8_t pce:1;,
|
uint8_t pce:1;,
|
||||||
@@ -121,13 +119,13 @@ ED4(uint8_t spare:5;,
|
|||||||
} __attribute__ ((packed)) gtp_cause_t;
|
} __attribute__ ((packed)) gtp_cause_t;
|
||||||
|
|
||||||
/* 8.7 Aggregate Maximum Bit Rate (AMBR) */
|
/* 8.7 Aggregate Maximum Bit Rate (AMBR) */
|
||||||
typedef struct _gtp_ambr_t {
|
typedef struct gtp_ambr_s {
|
||||||
uint32_t uplink;
|
uint32_t uplink;
|
||||||
uint32_t downlink;
|
uint32_t downlink;
|
||||||
} __attribute__ ((packed)) gtp_ambr_t;
|
} __attribute__ ((packed)) gtp_ambr_t;
|
||||||
|
|
||||||
/* 8.12 Indication */
|
/* 8.12 Indication */
|
||||||
typedef struct _gtp_indication_t {
|
typedef struct gtp_indication_s {
|
||||||
ED8(uint8_t daf:1;,
|
ED8(uint8_t daf:1;,
|
||||||
uint8_t dtf:1;,
|
uint8_t dtf:1;,
|
||||||
uint8_t hi:1;,
|
uint8_t hi:1;,
|
||||||
@@ -172,7 +170,7 @@ ED8(uint8_t spare1:1;,
|
|||||||
|
|
||||||
/* 8.15 Bearer Quality of Service (Bearer QoS) */
|
/* 8.15 Bearer Quality of Service (Bearer QoS) */
|
||||||
#define GTP_BEARER_QOS_LEN 22
|
#define GTP_BEARER_QOS_LEN 22
|
||||||
typedef struct _gtp_bearer_qos_t {
|
typedef struct gtp_bearer_qos_s {
|
||||||
ED5(uint8_t spare1:1;,
|
ED5(uint8_t spare1:1;,
|
||||||
/* See 3GPP TS 29.212[29], clause 5.3.46 Pre-emption-Capability AVP. */
|
/* See 3GPP TS 29.212[29], clause 5.3.46 Pre-emption-Capability AVP. */
|
||||||
uint8_t pre_emption_capability:1;,
|
uint8_t pre_emption_capability:1;,
|
||||||
@@ -215,7 +213,7 @@ int16_t gtp_build_bearer_qos(
|
|||||||
#define GTP_MAX_TRAFFIC_FLOW_TEMPLATE 255
|
#define GTP_MAX_TRAFFIC_FLOW_TEMPLATE 255
|
||||||
|
|
||||||
#define GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16
|
#define GTP_MAX_NUM_OF_PACKET_FILTER_COMPONENT 16
|
||||||
typedef struct _gtp_tft_t {
|
typedef struct gtp_tft_s {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
#define GTP_TFT_CODE_IGNORE_THIS_IE 0
|
#define GTP_TFT_CODE_IGNORE_THIS_IE 0
|
||||||
@@ -287,30 +285,30 @@ int16_t gtp_build_tft(
|
|||||||
|
|
||||||
/* 8.21 User Location Information (ULI) */
|
/* 8.21 User Location Information (ULI) */
|
||||||
#define GTP_MAX_ULI_LEN sizeof(gtp_uli_t)
|
#define GTP_MAX_ULI_LEN sizeof(gtp_uli_t)
|
||||||
typedef struct _gtp_uli_cgi_t {
|
typedef struct gtp_uli_cgi_s {
|
||||||
plmn_id_t plmn_id;
|
plmn_id_t plmn_id;
|
||||||
uint16_t lac;
|
uint16_t lac;
|
||||||
uint16_t ci;
|
uint16_t ci;
|
||||||
} __attribute__ ((packed)) gtp_uli_cgi_t;
|
} __attribute__ ((packed)) gtp_uli_cgi_t;
|
||||||
|
|
||||||
typedef struct _gtp_uli_sai_t {
|
typedef struct gtp_uli_sai_s {
|
||||||
plmn_id_t plmn_id;
|
plmn_id_t plmn_id;
|
||||||
uint16_t lac;
|
uint16_t lac;
|
||||||
uint16_t sac;
|
uint16_t sac;
|
||||||
} __attribute__ ((packed)) gtp_uli_sai_t;
|
} __attribute__ ((packed)) gtp_uli_sai_t;
|
||||||
|
|
||||||
typedef struct _gtp_uli_rai_t {
|
typedef struct gtp_uli_rai_s {
|
||||||
plmn_id_t plmn_id;
|
plmn_id_t plmn_id;
|
||||||
uint16_t lac;
|
uint16_t lac;
|
||||||
uint16_t rac;
|
uint16_t rac;
|
||||||
} __attribute__ ((packed)) gtp_uli_rai_t;
|
} __attribute__ ((packed)) gtp_uli_rai_t;
|
||||||
|
|
||||||
typedef struct _gtp_uli_lai_t {
|
typedef struct gtp_uli_lai_s {
|
||||||
plmn_id_t plmn_id;
|
plmn_id_t plmn_id;
|
||||||
uint16_t lac;
|
uint16_t lac;
|
||||||
} __attribute__ ((packed)) gtp_uli_lai_t;
|
} __attribute__ ((packed)) gtp_uli_lai_t;
|
||||||
|
|
||||||
typedef struct _gtp_uli_t {
|
typedef struct gtp_uli_s {
|
||||||
struct {
|
struct {
|
||||||
ED7(uint8_t spare:2;,
|
ED7(uint8_t spare:2;,
|
||||||
uint8_t lai:1;,
|
uint8_t lai:1;,
|
||||||
@@ -378,7 +376,7 @@ int16_t gtp_build_uli(
|
|||||||
#define GTP_F_TEID_IPV4_LEN IPV4_LEN+GTP_F_TEID_HDR_LEN
|
#define GTP_F_TEID_IPV4_LEN IPV4_LEN+GTP_F_TEID_HDR_LEN
|
||||||
#define GTP_F_TEID_IPV6_LEN IPV6_LEN+GTP_F_TEID_HDR_LEN
|
#define GTP_F_TEID_IPV6_LEN IPV6_LEN+GTP_F_TEID_HDR_LEN
|
||||||
#define GTP_F_TEID_IPV4V6_LEN IPV4V6_LEN+GTP_F_TEID_HDR_LEN
|
#define GTP_F_TEID_IPV4V6_LEN IPV4V6_LEN+GTP_F_TEID_HDR_LEN
|
||||||
typedef struct _gtp_f_teid_t {
|
typedef struct gtp_f_teid_s {
|
||||||
ED3(uint8_t ipv4:1;,
|
ED3(uint8_t ipv4:1;,
|
||||||
uint8_t ipv6:1;,
|
uint8_t ipv6:1;,
|
||||||
uint8_t interface_type:6;)
|
uint8_t interface_type:6;)
|
||||||
@@ -406,7 +404,7 @@ ED3(uint8_t ipv4:1;,
|
|||||||
* This field uses the same format as the Timezone field used in the
|
* This field uses the same format as the Timezone field used in the
|
||||||
* TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90],
|
* TP-Service-Centre-Time-Stamp, which is defined in 3GPP TS 23.040 [90],
|
||||||
* and its value shall be set as defined in 3GPP TS 22.042 */
|
* and its value shall be set as defined in 3GPP TS 22.042 */
|
||||||
typedef struct _gtp_ue_timezone_t {
|
typedef struct gtp_ue_timezone_s {
|
||||||
#define GTP_TIME_TO_BCD(x) TIME_TO_BCD(x)
|
#define GTP_TIME_TO_BCD(x) TIME_TO_BCD(x)
|
||||||
/* The Time Zone indicates the difference, expressed in quarters of an hour,
|
/* The Time Zone indicates the difference, expressed in quarters of an hour,
|
||||||
* between the local time and GMT. In the first of the two semi-octets,
|
* between the local time and GMT. In the first of the two semi-octets,
|
||||||
@@ -436,7 +434,7 @@ ED2(uint8_t spare:6;,
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GTP_TYPES_H__ */
|
#endif /* GTP_TYPES_H */
|
||||||
|
|
||||||
@@ -17,11 +17,11 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "gtp_message.h"
|
#include "gtp-message.h"
|
||||||
#include "gtp_node.h"
|
#include "gtp-node.h"
|
||||||
#include "gtp_path.h"
|
#include "gtp-path.h"
|
||||||
|
|
||||||
#include "gtp_xact.h"
|
#include "gtp-xact.h"
|
||||||
|
|
||||||
#define GTP_MIN_XACT_ID 1
|
#define GTP_MIN_XACT_ID 1
|
||||||
#define GTP_MAX_XACT_ID 0x800000
|
#define GTP_MAX_XACT_ID 0x800000
|
||||||
@@ -17,21 +17,21 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifndef __GTP_XACT_H__
|
#ifndef GTP_XACT_H
|
||||||
#define __GTP_XACT_H__
|
#define GTP_XACT_H
|
||||||
|
|
||||||
#include "gtp_message.h"
|
#include "gtp-message.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
typedef struct _gtp_node_t gtp_node_t;
|
typedef struct gtp_node_s gtp_node_t;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Transaction context
|
* Transaction context
|
||||||
*/
|
*/
|
||||||
typedef struct _gtp_xact_t {
|
typedef struct gtp_xact_s {
|
||||||
ogs_lnode_t node; /**< A node of list */
|
ogs_lnode_t node; /**< A node of list */
|
||||||
ogs_index_t index;
|
ogs_index_t index;
|
||||||
|
|
||||||
@@ -57,7 +57,7 @@ typedef struct _gtp_xact_t {
|
|||||||
ogs_timer_t *tm_holding; /**< Timer waiting for holding message */
|
ogs_timer_t *tm_holding; /**< Timer waiting for holding message */
|
||||||
uint8_t holding_rcount;
|
uint8_t holding_rcount;
|
||||||
|
|
||||||
struct _gtp_xact_t *assoc_xact; /**< Associated transaction */
|
struct gtp_xact_s *assoc_xact; /**< Associated transaction */
|
||||||
|
|
||||||
#define GTP_XACT_STORE_SESSION(xact, session) \
|
#define GTP_XACT_STORE_SESSION(xact, session) \
|
||||||
do { \
|
do { \
|
||||||
@@ -95,6 +95,6 @@ void gtp_xact_deassociate(gtp_xact_t *xact1, gtp_xact_t *xact2);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GTP_XACT_H__ */
|
#endif /* GTP_XACT_H */
|
||||||
@@ -20,7 +20,7 @@
|
|||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by gtp_tlv.py script v0.1.0
|
* This file had been created by gtp_tlv.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-06 12:20:52.420255 by acetcom
|
* Created on: 2019-05-28 16:37:12.761642 by acetcom
|
||||||
* from 29274-d80.docx
|
* from 29274-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
@@ -37,7 +37,7 @@ extern "C" {
|
|||||||
#define GTPV1U_HEADER_LEN 8
|
#define GTPV1U_HEADER_LEN 8
|
||||||
#define GTPV2C_HEADER_LEN 12
|
#define GTPV2C_HEADER_LEN 12
|
||||||
#define GTP_TEID_LEN 4
|
#define GTP_TEID_LEN 4
|
||||||
typedef struct _gtp_header_t {
|
typedef struct gtp_header_s {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
ED4(uint8_t version:3;,
|
ED4(uint8_t version:3;,
|
||||||
@@ -590,7 +590,7 @@ typedef tlv_octet_t tlv_serving_plmn_rate_control_t;
|
|||||||
typedef tlv_octet_t tlv_counter_t;
|
typedef tlv_octet_t tlv_counter_t;
|
||||||
|
|
||||||
/* Structure for Group Infomration Element */
|
/* Structure for Group Infomration Element */
|
||||||
typedef struct _tlv_bearer_context_t {
|
typedef struct tlv_bearer_context_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
tlv_ebi_t eps_bearer_id;
|
tlv_ebi_t eps_bearer_id;
|
||||||
tlv_bearer_tft_t tft;
|
tlv_bearer_tft_t tft;
|
||||||
@@ -619,11 +619,11 @@ typedef struct _tlv_bearer_context_t {
|
|||||||
tlv_packet_flow_id_t packet_flow_id;
|
tlv_packet_flow_id_t packet_flow_id;
|
||||||
} tlv_bearer_context_t;
|
} tlv_bearer_context_t;
|
||||||
|
|
||||||
typedef struct _tlv_pdn_connection_t {
|
typedef struct tlv_pdn_connection_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
} tlv_pdn_connection_t;
|
} tlv_pdn_connection_t;
|
||||||
|
|
||||||
typedef struct _tlv_overload_control_information_t {
|
typedef struct tlv_overload_control_information_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
tlv_sequence_number_t overload_control_sequence_number;
|
tlv_sequence_number_t overload_control_sequence_number;
|
||||||
tlv_metric_t overload_reduction_metric;
|
tlv_metric_t overload_reduction_metric;
|
||||||
@@ -631,20 +631,20 @@ typedef struct _tlv_overload_control_information_t {
|
|||||||
tlv_apn_t list_of_access_point_name;
|
tlv_apn_t list_of_access_point_name;
|
||||||
} tlv_overload_control_information_t;
|
} tlv_overload_control_information_t;
|
||||||
|
|
||||||
typedef struct _tlv_load_control_information_t {
|
typedef struct tlv_load_control_information_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
tlv_sequence_number_t load_control_sequence_number;
|
tlv_sequence_number_t load_control_sequence_number;
|
||||||
tlv_metric_t load_metric;
|
tlv_metric_t load_metric;
|
||||||
tlv_apn_and_relative_capacity_t list_of_apn_and_relative_capacity;
|
tlv_apn_and_relative_capacity_t list_of_apn_and_relative_capacity;
|
||||||
} tlv_load_control_information_t;
|
} tlv_load_control_information_t;
|
||||||
|
|
||||||
typedef struct _tlv_remote_ue_context_t {
|
typedef struct tlv_remote_ue_context_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
tlv_remote_user_id_t remote_user_id;
|
tlv_remote_user_id_t remote_user_id;
|
||||||
tlv_remote_ue_ip_information_t remote_ue_ip_information;
|
tlv_remote_ue_ip_information_t remote_ue_ip_information;
|
||||||
} tlv_remote_ue_context_t;
|
} tlv_remote_ue_context_t;
|
||||||
|
|
||||||
typedef struct _tlv_scef_pdn_connection_t {
|
typedef struct tlv_scef_pdn_connection_s {
|
||||||
tlv_presence_t presence;
|
tlv_presence_t presence;
|
||||||
tlv_apn_t apn;
|
tlv_apn_t apn;
|
||||||
tlv_ebi_t default_eps_bearer_id;
|
tlv_ebi_t default_eps_bearer_id;
|
||||||
@@ -652,17 +652,17 @@ typedef struct _tlv_scef_pdn_connection_t {
|
|||||||
} tlv_scef_pdn_connection_t;
|
} tlv_scef_pdn_connection_t;
|
||||||
|
|
||||||
/* Structure for Message */
|
/* Structure for Message */
|
||||||
typedef struct _gtp_echo_request_t {
|
typedef struct gtp_echo_request_s {
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
tlv_node_features_t sending_node_features;
|
tlv_node_features_t sending_node_features;
|
||||||
} gtp_echo_request_t;
|
} gtp_echo_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_echo_response_t {
|
typedef struct gtp_echo_response_s {
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
tlv_node_features_t sending_node_features;
|
tlv_node_features_t sending_node_features;
|
||||||
} gtp_echo_response_t;
|
} gtp_echo_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_create_session_request_t {
|
typedef struct gtp_create_session_request_s {
|
||||||
tlv_imsi_t imsi;
|
tlv_imsi_t imsi;
|
||||||
tlv_msisdn_t msisdn;
|
tlv_msisdn_t msisdn;
|
||||||
tlv_mei_t me_identity;
|
tlv_mei_t me_identity;
|
||||||
@@ -723,7 +723,7 @@ typedef struct _gtp_create_session_request_t {
|
|||||||
tlv_port_number_t ue_tcp_port;
|
tlv_port_number_t ue_tcp_port;
|
||||||
} gtp_create_session_request_t;
|
} gtp_create_session_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_create_session_response_t {
|
typedef struct gtp_create_session_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_change_reporting_action_t change_reporting_action_;
|
tlv_change_reporting_action_t change_reporting_action_;
|
||||||
tlv_csg_information_reporting_action_t csg_information_reporting_action;
|
tlv_csg_information_reporting_action_t csg_information_reporting_action;
|
||||||
@@ -759,7 +759,7 @@ typedef struct _gtp_create_session_response_t {
|
|||||||
tlv_epco_t extended_protocol_configuration_options;
|
tlv_epco_t extended_protocol_configuration_options;
|
||||||
} gtp_create_session_response_t;
|
} gtp_create_session_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_modify_bearer_request_t {
|
typedef struct gtp_modify_bearer_request_s {
|
||||||
tlv_mei_t me_identity;
|
tlv_mei_t me_identity;
|
||||||
tlv_uli_t user_location_information;
|
tlv_uli_t user_location_information;
|
||||||
tlv_serving_network_t serving_network;
|
tlv_serving_network_t serving_network;
|
||||||
@@ -790,7 +790,7 @@ typedef struct _gtp_modify_bearer_request_t {
|
|||||||
tlv_counter_t mo_exception_data_counter;
|
tlv_counter_t mo_exception_data_counter;
|
||||||
} gtp_modify_bearer_request_t;
|
} gtp_modify_bearer_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_modify_bearer_response_t {
|
typedef struct gtp_modify_bearer_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_msisdn_t msisdn;
|
tlv_msisdn_t msisdn;
|
||||||
tlv_ebi_t linked_eps_bearer_id;
|
tlv_ebi_t linked_eps_bearer_id;
|
||||||
@@ -818,7 +818,7 @@ typedef struct _gtp_modify_bearer_response_t {
|
|||||||
tlv_charging_id_t pdn_connection_charging_id;
|
tlv_charging_id_t pdn_connection_charging_id;
|
||||||
} gtp_modify_bearer_response_t;
|
} gtp_modify_bearer_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_session_request_t {
|
typedef struct gtp_delete_session_request_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_ebi_t linked_eps_bearer_id;
|
tlv_ebi_t linked_eps_bearer_id;
|
||||||
tlv_uli_t user_location_information;
|
tlv_uli_t user_location_information;
|
||||||
@@ -842,7 +842,7 @@ typedef struct _gtp_delete_session_request_t {
|
|||||||
tlv_port_number_t ue_tcp_port;
|
tlv_port_number_t ue_tcp_port;
|
||||||
} gtp_delete_session_request_t;
|
} gtp_delete_session_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_session_response_t {
|
typedef struct gtp_delete_session_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
tlv_pco_t protocol_configuration_options;
|
tlv_pco_t protocol_configuration_options;
|
||||||
@@ -855,7 +855,7 @@ typedef struct _gtp_delete_session_response_t {
|
|||||||
tlv_epco_t extended_protocol_configuration_options;
|
tlv_epco_t extended_protocol_configuration_options;
|
||||||
} gtp_delete_session_response_t;
|
} gtp_delete_session_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_modify_bearer_command_t {
|
typedef struct gtp_modify_bearer_command_s {
|
||||||
tlv_ambr_t apn_aggregate_maximum_bit_rate;
|
tlv_ambr_t apn_aggregate_maximum_bit_rate;
|
||||||
tlv_bearer_context_t bearer_context;
|
tlv_bearer_context_t bearer_context;
|
||||||
tlv_overload_control_information_t mme_s4_sgsn_s_overload_control_information;
|
tlv_overload_control_information_t mme_s4_sgsn_s_overload_control_information;
|
||||||
@@ -864,7 +864,7 @@ typedef struct _gtp_modify_bearer_command_t {
|
|||||||
tlv_f_teid_t sender_f_teid_for_control_plane;
|
tlv_f_teid_t sender_f_teid_for_control_plane;
|
||||||
} gtp_modify_bearer_command_t;
|
} gtp_modify_bearer_command_t;
|
||||||
|
|
||||||
typedef struct _gtp_modify_bearer_failure_indication_t {
|
typedef struct gtp_modify_bearer_failure_indication_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
tlv_indication_t indication_flags;
|
tlv_indication_t indication_flags;
|
||||||
@@ -872,7 +872,7 @@ typedef struct _gtp_modify_bearer_failure_indication_t {
|
|||||||
tlv_overload_control_information_t sgw_s_overload_control_information;
|
tlv_overload_control_information_t sgw_s_overload_control_information;
|
||||||
} gtp_modify_bearer_failure_indication_t;
|
} gtp_modify_bearer_failure_indication_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_bearer_command_t {
|
typedef struct gtp_delete_bearer_command_s {
|
||||||
tlv_bearer_context_t bearer_contexts;
|
tlv_bearer_context_t bearer_contexts;
|
||||||
tlv_uli_t user_location_information;
|
tlv_uli_t user_location_information;
|
||||||
tlv_uli_timestamp_t uli_timestamp;
|
tlv_uli_timestamp_t uli_timestamp;
|
||||||
@@ -882,7 +882,7 @@ typedef struct _gtp_delete_bearer_command_t {
|
|||||||
tlv_f_teid_t sender_f_teid_for_control_plane;
|
tlv_f_teid_t sender_f_teid_for_control_plane;
|
||||||
} gtp_delete_bearer_command_t;
|
} gtp_delete_bearer_command_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_bearer_failure_indication_t {
|
typedef struct gtp_delete_bearer_failure_indication_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_bearer_context_t bearer_context;
|
tlv_bearer_context_t bearer_context;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
@@ -891,13 +891,13 @@ typedef struct _gtp_delete_bearer_failure_indication_t {
|
|||||||
tlv_overload_control_information_t sgw_s_overload_control_information;
|
tlv_overload_control_information_t sgw_s_overload_control_information;
|
||||||
} gtp_delete_bearer_failure_indication_t;
|
} gtp_delete_bearer_failure_indication_t;
|
||||||
|
|
||||||
typedef struct _gtp_downlink_data_notification_failure_indication_t {
|
typedef struct gtp_downlink_data_notification_failure_indication_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_node_type_t originating_node;
|
tlv_node_type_t originating_node;
|
||||||
tlv_imsi_t imsi;
|
tlv_imsi_t imsi;
|
||||||
} gtp_downlink_data_notification_failure_indication_t;
|
} gtp_downlink_data_notification_failure_indication_t;
|
||||||
|
|
||||||
typedef struct _gtp_create_bearer_request_t {
|
typedef struct gtp_create_bearer_request_s {
|
||||||
tlv_pti_t procedure_transaction_id;
|
tlv_pti_t procedure_transaction_id;
|
||||||
tlv_ebi_t linked_eps_bearer_id;
|
tlv_ebi_t linked_eps_bearer_id;
|
||||||
tlv_pco_t protocol_configuration_options;
|
tlv_pco_t protocol_configuration_options;
|
||||||
@@ -917,7 +917,7 @@ typedef struct _gtp_create_bearer_request_t {
|
|||||||
tlv_f_container_t nbifom_container;
|
tlv_f_container_t nbifom_container;
|
||||||
} gtp_create_bearer_request_t;
|
} gtp_create_bearer_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_create_bearer_response_t {
|
typedef struct gtp_create_bearer_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_bearer_context_t bearer_contexts;
|
tlv_bearer_context_t bearer_contexts;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
@@ -940,7 +940,7 @@ typedef struct _gtp_create_bearer_response_t {
|
|||||||
tlv_port_number_t ue_tcp_port;
|
tlv_port_number_t ue_tcp_port;
|
||||||
} gtp_create_bearer_response_t;
|
} gtp_create_bearer_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_update_bearer_request_t {
|
typedef struct gtp_update_bearer_request_s {
|
||||||
tlv_bearer_context_t bearer_contexts;
|
tlv_bearer_context_t bearer_contexts;
|
||||||
tlv_pti_t procedure_transaction_id;
|
tlv_pti_t procedure_transaction_id;
|
||||||
tlv_pco_t protocol_configuration_options;
|
tlv_pco_t protocol_configuration_options;
|
||||||
@@ -960,7 +960,7 @@ typedef struct _gtp_update_bearer_request_t {
|
|||||||
tlv_f_container_t nbifom_container;
|
tlv_f_container_t nbifom_container;
|
||||||
} gtp_update_bearer_request_t;
|
} gtp_update_bearer_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_update_bearer_response_t {
|
typedef struct gtp_update_bearer_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_bearer_context_t bearer_contexts;
|
tlv_bearer_context_t bearer_contexts;
|
||||||
tlv_pco_t protocol_configuration_options;
|
tlv_pco_t protocol_configuration_options;
|
||||||
@@ -985,7 +985,7 @@ typedef struct _gtp_update_bearer_response_t {
|
|||||||
tlv_port_number_t ue_tcp_port;
|
tlv_port_number_t ue_tcp_port;
|
||||||
} gtp_update_bearer_response_t;
|
} gtp_update_bearer_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_bearer_request_t {
|
typedef struct gtp_delete_bearer_request_s {
|
||||||
tlv_ebi_t linked_eps_bearer_id;
|
tlv_ebi_t linked_eps_bearer_id;
|
||||||
tlv_ebi_t eps_bearer_ids;
|
tlv_ebi_t eps_bearer_ids;
|
||||||
tlv_bearer_context_t failed_bearer_contexts;
|
tlv_bearer_context_t failed_bearer_contexts;
|
||||||
@@ -1004,7 +1004,7 @@ typedef struct _gtp_delete_bearer_request_t {
|
|||||||
tlv_epco_t extended_protocol_configuration_options;
|
tlv_epco_t extended_protocol_configuration_options;
|
||||||
} gtp_delete_bearer_request_t;
|
} gtp_delete_bearer_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_bearer_response_t {
|
typedef struct gtp_delete_bearer_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_ebi_t linked_eps_bearer_id;
|
tlv_ebi_t linked_eps_bearer_id;
|
||||||
tlv_bearer_context_t bearer_contexts;
|
tlv_bearer_context_t bearer_contexts;
|
||||||
@@ -1030,7 +1030,7 @@ typedef struct _gtp_delete_bearer_response_t {
|
|||||||
tlv_port_number_t ue_tcp_port ;
|
tlv_port_number_t ue_tcp_port ;
|
||||||
} gtp_delete_bearer_response_t;
|
} gtp_delete_bearer_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_create_indirect_data_forwarding_tunnel_request_t {
|
typedef struct gtp_create_indirect_data_forwarding_tunnel_request_s {
|
||||||
tlv_imsi_t imsi;
|
tlv_imsi_t imsi;
|
||||||
tlv_mei_t me_identity;
|
tlv_mei_t me_identity;
|
||||||
tlv_indication_t indication_flags;
|
tlv_indication_t indication_flags;
|
||||||
@@ -1049,7 +1049,7 @@ typedef struct _gtp_create_indirect_data_forwarding_tunnel_request_t {
|
|||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
} gtp_create_indirect_data_forwarding_tunnel_request_t;
|
} gtp_create_indirect_data_forwarding_tunnel_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_create_indirect_data_forwarding_tunnel_response_t {
|
typedef struct gtp_create_indirect_data_forwarding_tunnel_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_f_teid_t sender_f_teid_for_control_plane;
|
tlv_f_teid_t sender_f_teid_for_control_plane;
|
||||||
tlv_bearer_context_t bearer_context_0;
|
tlv_bearer_context_t bearer_context_0;
|
||||||
@@ -1066,21 +1066,21 @@ typedef struct _gtp_create_indirect_data_forwarding_tunnel_response_t {
|
|||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
} gtp_create_indirect_data_forwarding_tunnel_response_t;
|
} gtp_create_indirect_data_forwarding_tunnel_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_indirect_data_forwarding_tunnel_request_t {
|
typedef struct gtp_delete_indirect_data_forwarding_tunnel_request_s {
|
||||||
} gtp_delete_indirect_data_forwarding_tunnel_request_t;
|
} gtp_delete_indirect_data_forwarding_tunnel_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_delete_indirect_data_forwarding_tunnel_response_t {
|
typedef struct gtp_delete_indirect_data_forwarding_tunnel_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
} gtp_delete_indirect_data_forwarding_tunnel_response_t;
|
} gtp_delete_indirect_data_forwarding_tunnel_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_release_access_bearers_request_t {
|
typedef struct gtp_release_access_bearers_request_s {
|
||||||
tlv_ebi_t list_of_rabs;
|
tlv_ebi_t list_of_rabs;
|
||||||
tlv_node_type_t originating_node;
|
tlv_node_type_t originating_node;
|
||||||
tlv_indication_t indication_flags;
|
tlv_indication_t indication_flags;
|
||||||
} gtp_release_access_bearers_request_t;
|
} gtp_release_access_bearers_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_release_access_bearers_response_t {
|
typedef struct gtp_release_access_bearers_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
tlv_indication_t indication_flags;
|
tlv_indication_t indication_flags;
|
||||||
@@ -1088,7 +1088,7 @@ typedef struct _gtp_release_access_bearers_response_t {
|
|||||||
tlv_overload_control_information_t sgw_s_overload_control_information;
|
tlv_overload_control_information_t sgw_s_overload_control_information;
|
||||||
} gtp_release_access_bearers_response_t;
|
} gtp_release_access_bearers_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_downlink_data_notification_t {
|
typedef struct gtp_downlink_data_notification_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_ebi_t eps_bearer_id;
|
tlv_ebi_t eps_bearer_id;
|
||||||
tlv_arp_t allocation_retention_priority;
|
tlv_arp_t allocation_retention_priority;
|
||||||
@@ -1100,7 +1100,7 @@ typedef struct _gtp_downlink_data_notification_t {
|
|||||||
tlv_paging_and_service_information_t paging_and_service_information;
|
tlv_paging_and_service_information_t paging_and_service_information;
|
||||||
} gtp_downlink_data_notification_t;
|
} gtp_downlink_data_notification_t;
|
||||||
|
|
||||||
typedef struct _gtp_downlink_data_notification_acknowledge_t {
|
typedef struct gtp_downlink_data_notification_acknowledge_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_delay_value_t data_notification_delay;
|
tlv_delay_value_t data_notification_delay;
|
||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
@@ -1110,7 +1110,7 @@ typedef struct _gtp_downlink_data_notification_acknowledge_t {
|
|||||||
tlv_integer_number_t dl_buffering_suggested_packet_count;
|
tlv_integer_number_t dl_buffering_suggested_packet_count;
|
||||||
} gtp_downlink_data_notification_acknowledge_t;
|
} gtp_downlink_data_notification_acknowledge_t;
|
||||||
|
|
||||||
typedef struct _gtp_modify_access_bearers_request_t {
|
typedef struct gtp_modify_access_bearers_request_s {
|
||||||
tlv_indication_t indication_flags;
|
tlv_indication_t indication_flags;
|
||||||
tlv_f_teid_t sender_f_teid_for_control_plane;
|
tlv_f_teid_t sender_f_teid_for_control_plane;
|
||||||
tlv_delay_value_t delay_downlink_packet_notification_request;
|
tlv_delay_value_t delay_downlink_packet_notification_request;
|
||||||
@@ -1119,7 +1119,7 @@ typedef struct _gtp_modify_access_bearers_request_t {
|
|||||||
tlv_recovery_t recovery;
|
tlv_recovery_t recovery;
|
||||||
} gtp_modify_access_bearers_request_t;
|
} gtp_modify_access_bearers_request_t;
|
||||||
|
|
||||||
typedef struct _gtp_modify_access_bearers_response_t {
|
typedef struct gtp_modify_access_bearers_response_s {
|
||||||
tlv_cause_t cause;
|
tlv_cause_t cause;
|
||||||
tlv_bearer_context_t bearer_contexts_modified;
|
tlv_bearer_context_t bearer_contexts_modified;
|
||||||
tlv_bearer_context_t bearer_contexts_marked_for_removal;
|
tlv_bearer_context_t bearer_contexts_marked_for_removal;
|
||||||
@@ -1129,7 +1129,7 @@ typedef struct _gtp_modify_access_bearers_response_t {
|
|||||||
tlv_overload_control_information_t sgw_s_overload_control_information;
|
tlv_overload_control_information_t sgw_s_overload_control_information;
|
||||||
} gtp_modify_access_bearers_response_t;
|
} gtp_modify_access_bearers_response_t;
|
||||||
|
|
||||||
typedef struct _gtp_message_t {
|
typedef struct gtp_message_s {
|
||||||
gtp_header_t h;
|
gtp_header_t h;
|
||||||
union {
|
union {
|
||||||
gtp_echo_request_t echo_request;
|
gtp_echo_request_t echo_request;
|
||||||
|
|||||||
@@ -1,181 +0,0 @@
|
|||||||
/*
|
|
||||||
* 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 "gtp_conv.h"
|
|
||||||
#include "gtp_node.h"
|
|
||||||
#include "gtp_xact.h"
|
|
||||||
|
|
||||||
static OGS_POOL(pool, gtp_node_t);
|
|
||||||
|
|
||||||
int gtp_node_init(void)
|
|
||||||
{
|
|
||||||
ogs_pool_init(&pool, base_self()->gtp.node.pool);
|
|
||||||
|
|
||||||
return OGS_OK;
|
|
||||||
}
|
|
||||||
int gtp_node_final(void)
|
|
||||||
{
|
|
||||||
ogs_pool_final(&pool);
|
|
||||||
|
|
||||||
return OGS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_create_node(gtp_node_t **node,
|
|
||||||
ogs_sockaddr_t *all_list, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
gtp_node_t *new_node = NULL;
|
|
||||||
ogs_sockaddr_t *preferred_list = NULL;
|
|
||||||
|
|
||||||
ogs_assert(all_list);
|
|
||||||
|
|
||||||
rv = ogs_copyaddrinfo(&preferred_list, all_list);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
if (no_ipv4 == 1)
|
|
||||||
{
|
|
||||||
rv = ogs_filteraddrinfo(&preferred_list, AF_INET6);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
}
|
|
||||||
if (no_ipv6 == 1)
|
|
||||||
{
|
|
||||||
rv = ogs_filteraddrinfo(&preferred_list, AF_INET);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
}
|
|
||||||
if (prefer_ipv4 == 1)
|
|
||||||
{
|
|
||||||
rv = ogs_sortaddrinfo(&preferred_list, AF_INET);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
rv = ogs_sortaddrinfo(&preferred_list, AF_INET6);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
}
|
|
||||||
|
|
||||||
if (preferred_list)
|
|
||||||
{
|
|
||||||
ogs_pool_alloc(&pool, &new_node);
|
|
||||||
ogs_assert(new_node);
|
|
||||||
memset(new_node, 0, sizeof(gtp_node_t));
|
|
||||||
|
|
||||||
new_node->sa_list = preferred_list;
|
|
||||||
|
|
||||||
ogs_list_init(&new_node->local_list);
|
|
||||||
ogs_list_init(&new_node->remote_list);
|
|
||||||
}
|
|
||||||
|
|
||||||
*node = new_node;
|
|
||||||
|
|
||||||
return OGS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_delete_node(gtp_node_t *node)
|
|
||||||
{
|
|
||||||
ogs_assert(node);
|
|
||||||
|
|
||||||
if (node->sock)
|
|
||||||
ogs_sock_destroy(node->sock);
|
|
||||||
|
|
||||||
gtp_xact_delete_all(node);
|
|
||||||
|
|
||||||
ogs_freeaddrinfo(node->sa_list);
|
|
||||||
ogs_pool_free(&pool, node);
|
|
||||||
|
|
||||||
return OGS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtp_node_t *gtp_add_node(ogs_list_t *list, gtp_f_teid_t *f_teid,
|
|
||||||
uint16_t port, int no_ipv4, int no_ipv6, int prefer_ipv4)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
gtp_node_t *node = NULL;
|
|
||||||
ogs_sockaddr_t *sa_list = NULL;
|
|
||||||
|
|
||||||
ogs_assert(list);
|
|
||||||
ogs_assert(f_teid);
|
|
||||||
ogs_assert(port);
|
|
||||||
|
|
||||||
rv = gtp_f_teid_to_sockaddr(f_teid, port, &sa_list);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
|
|
||||||
rv = gtp_create_node(&node, sa_list, no_ipv4, no_ipv6, prefer_ipv4);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
if (node == NULL)
|
|
||||||
{
|
|
||||||
ogs_error("Invalid Parameter : "
|
|
||||||
"port[%d], no_ipv4[%d], no_ipv6[%d], prefer_ipv4[%d]",
|
|
||||||
port, no_ipv4, no_ipv6, prefer_ipv4);
|
|
||||||
return NULL;
|
|
||||||
}
|
|
||||||
ogs_list_add(list, node);
|
|
||||||
|
|
||||||
rv = gtp_f_teid_to_ip(f_teid, &node->ip);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
|
|
||||||
rv = ogs_sock_fill_scope_id_in_local(node->sa_list);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
|
|
||||||
ogs_freeaddrinfo(sa_list);
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_remove_node(ogs_list_t *list, gtp_node_t *node)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
ogs_assert(node);
|
|
||||||
|
|
||||||
ogs_list_remove(list, node);
|
|
||||||
|
|
||||||
rv = gtp_delete_node(node);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
|
|
||||||
return rv;
|
|
||||||
}
|
|
||||||
|
|
||||||
int gtp_remove_all_nodes(ogs_list_t *list)
|
|
||||||
{
|
|
||||||
gtp_node_t *node = NULL, *next_node = NULL;
|
|
||||||
|
|
||||||
ogs_list_for_each_safe(list, next_node, node)
|
|
||||||
gtp_remove_node(list, node);
|
|
||||||
|
|
||||||
return OGS_OK;
|
|
||||||
}
|
|
||||||
|
|
||||||
gtp_node_t *gtp_find_node(ogs_list_t *list, gtp_f_teid_t *f_teid)
|
|
||||||
{
|
|
||||||
int rv;
|
|
||||||
gtp_node_t *node = NULL;
|
|
||||||
ip_t ip;
|
|
||||||
|
|
||||||
ogs_assert(list);
|
|
||||||
ogs_assert(f_teid);
|
|
||||||
|
|
||||||
rv = gtp_f_teid_to_ip(f_teid, &ip);
|
|
||||||
ogs_assert(rv == OGS_OK);
|
|
||||||
|
|
||||||
ogs_list_for_each(list, node)
|
|
||||||
{
|
|
||||||
if (memcmp(&node->ip, &ip, ip.len) == 0)
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
|
|
||||||
return node;
|
|
||||||
}
|
|
||||||
@@ -13,4 +13,4 @@ user@host ~/Documents/git/nextepc/lib/gtp/support$ \
|
|||||||
|
|
||||||
* Generate TLV support files
|
* Generate TLV support files
|
||||||
user@host ~/Documents/git/nextepc/lib/s1ap/support$ \
|
user@host ~/Documents/git/nextepc/lib/s1ap/support$ \
|
||||||
python gtp_tlv.py -f 29274-d80.docx -o ..
|
python gtp-tlv.py -f 29274-d80.docx -o ..
|
||||||
@@ -74,14 +74,14 @@ def output_header_to_file(f):
|
|||||||
|
|
||||||
""")
|
""")
|
||||||
f.write("/*******************************************************************************\n")
|
f.write("/*******************************************************************************\n")
|
||||||
f.write(" * This file had been created by gtp_tlv.py script v%s\n" % (version))
|
f.write(" * This file had been created by gtp-tlv.py script v%s\n" % (version))
|
||||||
f.write(" * Please do not modify this file but regenerate it via script.\n")
|
f.write(" * Please do not modify this file but regenerate it via script.\n")
|
||||||
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filename))
|
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filename))
|
||||||
f.write(" ******************************************************************************/\n\n")
|
f.write(" ******************************************************************************/\n\n")
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "Python generating TLV build/parser for GTPv2-C v%s" % (version)
|
print "Python generating TLV build/parser for GTPv2-C v%s" % (version)
|
||||||
print "Usage: python gtp_tlv.py [options]"
|
print "Usage: python gtp-tlv.py [options]"
|
||||||
print "Available options:"
|
print "Available options:"
|
||||||
print "-d Enable script debug"
|
print "-d Enable script debug"
|
||||||
print "-f [file] Input file to parse"
|
print "-f [file] Input file to parse"
|
||||||
@@ -370,22 +370,22 @@ type_list["APN Restriction"]["size"] = 1 # Type : 127
|
|||||||
type_list["Selection Mode"]["size"] = 1 # Type : 128
|
type_list["Selection Mode"]["size"] = 1 # Type : 128
|
||||||
type_list["Node Type"]["size"] = 1 # Type : 128
|
type_list["Node Type"]["size"] = 1 # Type : 128
|
||||||
|
|
||||||
f = open(outdir + 'gtp_message.h', 'w')
|
f = open(outdir + 'gtp-message.h', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#ifndef __GTP_MESSAGE_H__
|
f.write("""#ifndef GTP_MESSAGE_H
|
||||||
#define __GTP_MESSAGE_H__
|
#define GTP_MESSAGE_H
|
||||||
|
|
||||||
#include "gtp_tlv.h"
|
#include "gtp-tlv.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
/* 5.1 General format */
|
/* 5.1 General format */
|
||||||
#define GTPV1U_HEADER_LEN 8
|
#define GTPV1U_HEADER_LEN 8
|
||||||
#define GTPV2C_HEADER_LEN 12
|
#define GTPV2C_HEADER_LEN 12
|
||||||
#define GTP_TEID_LEN 4
|
#define GTP_TEID_LEN 4
|
||||||
typedef struct _gtp_header_t {
|
typedef struct gtp_header_s {
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
ED4(uint8_t version:3;,
|
ED4(uint8_t version:3;,
|
||||||
@@ -481,7 +481,7 @@ f.write("\n")
|
|||||||
|
|
||||||
f.write("/* Structure for Group Infomration Element */\n")
|
f.write("/* Structure for Group Infomration Element */\n")
|
||||||
for (k, v) in sorted_group_list:
|
for (k, v) in sorted_group_list:
|
||||||
f.write("typedef struct _tlv_" + v_lower(k) + "_t {\n")
|
f.write("typedef struct tlv_" + v_lower(k) + "_s {\n")
|
||||||
f.write(" tlv_presence_t presence;\n")
|
f.write(" tlv_presence_t presence;\n")
|
||||||
for ies in group_list[k]["ies"]:
|
for ies in group_list[k]["ies"]:
|
||||||
f.write(" tlv_" + v_lower(ies["ie_type"]) + "_t " + \
|
f.write(" tlv_" + v_lower(ies["ie_type"]) + "_t " + \
|
||||||
@@ -502,14 +502,14 @@ for (k, v) in sorted_group_list:
|
|||||||
f.write("/* Structure for Message */\n")
|
f.write("/* Structure for Message */\n")
|
||||||
for (k, v) in sorted_msg_list:
|
for (k, v) in sorted_msg_list:
|
||||||
if "ies" in msg_list[k]:
|
if "ies" in msg_list[k]:
|
||||||
f.write("typedef struct _gtp_" + v_lower(k) + "_t {\n")
|
f.write("typedef struct gtp_" + v_lower(k) + "_s {\n")
|
||||||
for ies in msg_list[k]["ies"]:
|
for ies in msg_list[k]["ies"]:
|
||||||
f.write(" tlv_" + v_lower(ies["ie_type"]) + "_t " + \
|
f.write(" tlv_" + v_lower(ies["ie_type"]) + "_t " + \
|
||||||
v_lower(ies["ie_value"]) + ";\n")
|
v_lower(ies["ie_value"]) + ";\n")
|
||||||
f.write("} gtp_" + v_lower(k) + "_t;\n")
|
f.write("} gtp_" + v_lower(k) + "_t;\n")
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
|
||||||
f.write("typedef struct _gtp_message_t {\n")
|
f.write("typedef struct gtp_message_s {\n")
|
||||||
f.write(" gtp_header_t h;\n")
|
f.write(" gtp_header_t h;\n")
|
||||||
f.write(" union {\n")
|
f.write(" union {\n")
|
||||||
for (k, v) in sorted_msg_list:
|
for (k, v) in sorted_msg_list:
|
||||||
@@ -523,15 +523,15 @@ int gtp_build_msg(ogs_pkbuf_t **pkbuf, gtp_message_t *gtp_message);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __GTP_MESSAGE_H__ */
|
#endif /* GTP_MESSAGE_H */
|
||||||
""")
|
""")
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = open(outdir + 'gtp_message.c', 'w')
|
f = open(outdir + 'gtp-message.c', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#include "gtp_message.h"
|
f.write("""#include "gtp-message.h"
|
||||||
|
|
||||||
""")
|
""")
|
||||||
|
|
||||||
@@ -18,8 +18,8 @@
|
|||||||
pkglib_LTLIBRARIES = libnas.la
|
pkglib_LTLIBRARIES = libnas.la
|
||||||
|
|
||||||
libnas_la_SOURCES = \
|
libnas_la_SOURCES = \
|
||||||
nas_message.h nas_ies.h nas_types.h \
|
nas-message.h nas-ies.h nas-types.h \
|
||||||
nas_decoder.c nas_encoder.c nas_ies.c nas_types.c \
|
nas-decoder.c nas-encoder.c nas-ies.c nas-types.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libnas_la_DEPENDENCIES = \
|
libnas_la_DEPENDENCIES = \
|
||||||
|
|||||||
@@ -18,13 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas_message.py script v0.1.0
|
* This file had been created by nas-message.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-17 02:01:09.581393 by acetcom
|
* Created on: 2019-06-21 14:10:51.931135 by acetcom
|
||||||
* from 24301-d80.docx
|
* from 24301-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "nas_message.h"
|
#include "nas-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -2974,21 +2974,3 @@ int nas_esm_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf)
|
|||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* deprecated */
|
|
||||||
int nas_plain_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf)
|
|
||||||
{
|
|
||||||
nas_security_header_t *h = NULL;
|
|
||||||
|
|
||||||
ogs_assert(pkbuf);
|
|
||||||
h = pkbuf->data;
|
|
||||||
ogs_assert(h);
|
|
||||||
|
|
||||||
if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM)
|
|
||||||
return nas_emm_decode(message, pkbuf);
|
|
||||||
else if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_ESM)
|
|
||||||
return nas_esm_decode(message, pkbuf);
|
|
||||||
|
|
||||||
ogs_assert_if_reached();
|
|
||||||
"Invalid Protocol : %d", h->protocol_discriminator);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas_message.py script v0.1.0
|
* This file had been created by nas-message.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-17 02:01:09.610640 by acetcom
|
* Created on: 2019-06-21 14:10:51.957409 by acetcom
|
||||||
* from 24301-d80.docx
|
* from 24301-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "nas_message.h"
|
#include "nas-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -18,13 +18,13 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas_message.py script v0.1.0
|
* This file had been created by nas-message.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-17 02:01:09.532072 by acetcom
|
* Created on: 2019-06-21 14:10:51.889878 by acetcom
|
||||||
* from 24301-d80.docx
|
* from 24301-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#include "nas_ies.h"
|
#include "nas-ies.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -2123,7 +2123,7 @@ int nas_decode_access_point_name(nas_access_point_name_t *access_point_name, ogs
|
|||||||
|
|
||||||
{
|
{
|
||||||
char apn[MAX_APN_LEN];
|
char apn[MAX_APN_LEN];
|
||||||
access_point_name->length = apn_parse(apn, access_point_name->apn, access_point_name->length);
|
access_point_name->length = fqdn_parse(apn, access_point_name->apn, access_point_name->length);
|
||||||
ogs_cpystrn(access_point_name->apn, apn, ogs_min(access_point_name->length, MAX_APN_LEN) + 1);
|
ogs_cpystrn(access_point_name->apn, apn, ogs_min(access_point_name->length, MAX_APN_LEN) + 1);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -2139,7 +2139,7 @@ int nas_encode_access_point_name(ogs_pkbuf_t *pkbuf, nas_access_point_name_t *ac
|
|||||||
nas_access_point_name_t target;
|
nas_access_point_name_t target;
|
||||||
|
|
||||||
memcpy(&target, access_point_name, sizeof(nas_access_point_name_t));
|
memcpy(&target, access_point_name, sizeof(nas_access_point_name_t));
|
||||||
target.length = apn_build(target.apn, access_point_name->apn, access_point_name->length);
|
target.length = fqdn_build(target.apn, access_point_name->apn, access_point_name->length);
|
||||||
size = target.length + sizeof(target.length);
|
size = target.length + sizeof(target.length);
|
||||||
|
|
||||||
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
|
||||||
@@ -18,20 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas_message.py script v0.1.0
|
* This file had been created by nas-message.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-17 02:01:09.521707 by acetcom
|
* Created on: 2019-06-21 14:10:51.884139 by acetcom
|
||||||
* from 24301-d80.docx
|
* from 24301-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef __NAS_IES_H__
|
#ifndef NAS_IES_H
|
||||||
#define __NAS_IES_H__
|
#define NAS_IES_H
|
||||||
|
|
||||||
#include "nas_types.h"
|
#include "nas-types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
|
int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
|
||||||
|
|
||||||
@@ -219,7 +219,7 @@ int nas_encode_pdn_address(ogs_pkbuf_t *pkbuf, nas_pdn_address_t *pdn_address);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __NAS_IES_H__ */
|
#endif /* NAS_IES_H */
|
||||||
|
|
||||||
@@ -18,20 +18,20 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
/*******************************************************************************
|
/*******************************************************************************
|
||||||
* This file had been created by nas_message.py script v0.1.0
|
* This file had been created by nas-message.py script v0.1.0
|
||||||
* Please do not modify this file but regenerate it via script.
|
* Please do not modify this file but regenerate it via script.
|
||||||
* Created on: 2019-03-17 02:01:09.555771 by acetcom
|
* Created on: 2019-06-21 14:10:51.908774 by acetcom
|
||||||
* from 24301-d80.docx
|
* from 24301-d80.docx
|
||||||
******************************************************************************/
|
******************************************************************************/
|
||||||
|
|
||||||
#ifndef __NAS_MESSAGE_H__
|
#ifndef NAS_MESSAGE_H
|
||||||
#define __NAS_MESSAGE_H__
|
#define NAS_MESSAGE_H
|
||||||
|
|
||||||
#include "nas_ies.h"
|
#include "nas-ies.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||||
@@ -51,20 +51,20 @@ extern "C" {
|
|||||||
#define NAS_EPS_BEARER_IDENTITY_UNASSIGNED 0
|
#define NAS_EPS_BEARER_IDENTITY_UNASSIGNED 0
|
||||||
#define NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0
|
#define NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0
|
||||||
|
|
||||||
typedef struct _nas_emm_header_t {
|
typedef struct nas_emm_header_s {
|
||||||
ED2(uint8_t security_header_type:4;,
|
ED2(uint8_t security_header_type:4;,
|
||||||
uint8_t protocol_discriminator:4;)
|
uint8_t protocol_discriminator:4;)
|
||||||
uint8_t message_type;
|
uint8_t message_type;
|
||||||
} __attribute__ ((packed)) nas_emm_header_t;
|
} __attribute__ ((packed)) nas_emm_header_t;
|
||||||
|
|
||||||
typedef struct _nas_esm_header_t {
|
typedef struct nas_esm_header_s {
|
||||||
ED2(uint8_t eps_bearer_identity:4;,
|
ED2(uint8_t eps_bearer_identity:4;,
|
||||||
uint8_t protocol_discriminator:4;)
|
uint8_t protocol_discriminator:4;)
|
||||||
uint8_t procedure_transaction_identity;
|
uint8_t procedure_transaction_identity;
|
||||||
uint8_t message_type;
|
uint8_t message_type;
|
||||||
} __attribute__ ((packed)) nas_esm_header_t;
|
} __attribute__ ((packed)) nas_esm_header_t;
|
||||||
|
|
||||||
typedef struct _nas_security_header_t {
|
typedef struct nas_security_header_s {
|
||||||
ED2(uint8_t security_header_type:4;,
|
ED2(uint8_t security_header_type:4;,
|
||||||
uint8_t protocol_discriminator:4;)
|
uint8_t protocol_discriminator:4;)
|
||||||
uint32_t message_authentication_code;
|
uint32_t message_authentication_code;
|
||||||
@@ -167,7 +167,7 @@ ED2(uint8_t security_header_type:4;,
|
|||||||
#define NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_TYPE 0x5E
|
#define NAS_ATTACH_REQUEST_T3412_EXTENDED_VALUE_TYPE 0x5E
|
||||||
#define NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
#define NAS_ATTACH_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
||||||
|
|
||||||
typedef struct _nas_attach_request_t {
|
typedef struct nas_attach_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_eps_attach_type_t eps_attach_type;
|
nas_eps_attach_type_t eps_attach_type;
|
||||||
nas_eps_mobile_identity_t eps_mobile_identity;
|
nas_eps_mobile_identity_t eps_mobile_identity;
|
||||||
@@ -228,7 +228,7 @@ typedef struct _nas_attach_request_t {
|
|||||||
#define NAS_ATTACH_ACCEPT_T3324_VALUE_TYPE 0x6A
|
#define NAS_ATTACH_ACCEPT_T3324_VALUE_TYPE 0x6A
|
||||||
#define NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
#define NAS_ATTACH_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
||||||
|
|
||||||
typedef struct _nas_attach_accept_t {
|
typedef struct nas_attach_accept_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_eps_attach_result_t eps_attach_result;
|
nas_eps_attach_result_t eps_attach_result;
|
||||||
nas_gprs_timer_t t3412_value;
|
nas_gprs_timer_t t3412_value;
|
||||||
@@ -257,7 +257,7 @@ typedef struct _nas_attach_accept_t {
|
|||||||
* ATTACH COMPLETE
|
* ATTACH COMPLETE
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_attach_complete_t {
|
typedef struct nas_attach_complete_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_message_container_t esm_message_container;
|
nas_esm_message_container_t esm_message_container;
|
||||||
} nas_attach_complete_t;
|
} nas_attach_complete_t;
|
||||||
@@ -275,7 +275,7 @@ typedef struct _nas_attach_complete_t {
|
|||||||
#define NAS_ATTACH_REJECT_T3402_VALUE_TYPE 0x16
|
#define NAS_ATTACH_REJECT_T3402_VALUE_TYPE 0x16
|
||||||
#define NAS_ATTACH_REJECT_EXTENDED_EMM_CAUSE_TYPE 0xA0
|
#define NAS_ATTACH_REJECT_EXTENDED_EMM_CAUSE_TYPE 0xA0
|
||||||
|
|
||||||
typedef struct _nas_attach_reject_t {
|
typedef struct nas_attach_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_emm_cause_t emm_cause;
|
nas_emm_cause_t emm_cause;
|
||||||
|
|
||||||
@@ -292,7 +292,7 @@ typedef struct _nas_attach_reject_t {
|
|||||||
* DETACH REQUEST FROM UE
|
* DETACH REQUEST FROM UE
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_detach_request_from_ue_t {
|
typedef struct nas_detach_request_from_ue_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_detach_type_t detach_type;
|
nas_detach_type_t detach_type;
|
||||||
nas_eps_mobile_identity_t eps_mobile_identity;
|
nas_eps_mobile_identity_t eps_mobile_identity;
|
||||||
@@ -305,7 +305,7 @@ typedef struct _nas_detach_request_from_ue_t {
|
|||||||
#define NAS_DETACH_REQUEST_EMM_CAUSE_PRESENT (1<<0)
|
#define NAS_DETACH_REQUEST_EMM_CAUSE_PRESENT (1<<0)
|
||||||
#define NAS_DETACH_REQUEST_EMM_CAUSE_TYPE 0x53
|
#define NAS_DETACH_REQUEST_EMM_CAUSE_TYPE 0x53
|
||||||
|
|
||||||
typedef struct _nas_detach_request_to_ue_t {
|
typedef struct nas_detach_request_to_ue_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_detach_type_t detach_type;
|
nas_detach_type_t detach_type;
|
||||||
|
|
||||||
@@ -369,7 +369,7 @@ typedef struct _nas_detach_request_to_ue_t {
|
|||||||
#define NAS_TRACKING_AREA_UPDATE_REQUEST_T3412_EXTENDED_VALUE_TYPE 0x5E
|
#define NAS_TRACKING_AREA_UPDATE_REQUEST_T3412_EXTENDED_VALUE_TYPE 0x5E
|
||||||
#define NAS_TRACKING_AREA_UPDATE_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
#define NAS_TRACKING_AREA_UPDATE_REQUEST_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
||||||
|
|
||||||
typedef struct _nas_tracking_area_update_request_t {
|
typedef struct nas_tracking_area_update_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_eps_update_type_t eps_update_type;
|
nas_eps_update_type_t eps_update_type;
|
||||||
nas_eps_mobile_identity_t old_guti;
|
nas_eps_mobile_identity_t old_guti;
|
||||||
@@ -442,7 +442,7 @@ typedef struct _nas_tracking_area_update_request_t {
|
|||||||
#define NAS_TRACKING_AREA_UPDATE_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
#define NAS_TRACKING_AREA_UPDATE_ACCEPT_EXTENDED_DRX_PARAMETERS_TYPE 0x6E
|
||||||
#define NAS_TRACKING_AREA_UPDATE_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_STATUS_TYPE 0x68
|
#define NAS_TRACKING_AREA_UPDATE_ACCEPT_HEADER_COMPRESSION_CONFIGURATION_STATUS_TYPE 0x68
|
||||||
|
|
||||||
typedef struct _nas_tracking_area_update_accept_t {
|
typedef struct nas_tracking_area_update_accept_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_eps_update_result_t eps_update_result;
|
nas_eps_update_result_t eps_update_result;
|
||||||
|
|
||||||
@@ -476,7 +476,7 @@ typedef struct _nas_tracking_area_update_accept_t {
|
|||||||
#define NAS_TRACKING_AREA_UPDATE_REJECT_T3346_VALUE_TYPE 0x5F
|
#define NAS_TRACKING_AREA_UPDATE_REJECT_T3346_VALUE_TYPE 0x5F
|
||||||
#define NAS_TRACKING_AREA_UPDATE_REJECT_EXTENDED_EMM_CAUSE_TYPE 0xA0
|
#define NAS_TRACKING_AREA_UPDATE_REJECT_EXTENDED_EMM_CAUSE_TYPE 0xA0
|
||||||
|
|
||||||
typedef struct _nas_tracking_area_update_reject_t {
|
typedef struct nas_tracking_area_update_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_emm_cause_t emm_cause;
|
nas_emm_cause_t emm_cause;
|
||||||
|
|
||||||
@@ -497,7 +497,7 @@ typedef struct _nas_tracking_area_update_reject_t {
|
|||||||
#define NAS_EXTENDED_SERVICE_REQUEST_EPS_BEARER_CONTEXT_STATUS_TYPE 0x57
|
#define NAS_EXTENDED_SERVICE_REQUEST_EPS_BEARER_CONTEXT_STATUS_TYPE 0x57
|
||||||
#define NAS_EXTENDED_SERVICE_REQUEST_DEVICE_PROPERTIES_TYPE 0xD0
|
#define NAS_EXTENDED_SERVICE_REQUEST_DEVICE_PROPERTIES_TYPE 0xD0
|
||||||
|
|
||||||
typedef struct _nas_extended_service_request_t {
|
typedef struct nas_extended_service_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_service_type_t service_type;
|
nas_service_type_t service_type;
|
||||||
nas_mobile_identity_t m_tmsi;
|
nas_mobile_identity_t m_tmsi;
|
||||||
@@ -514,7 +514,7 @@ typedef struct _nas_extended_service_request_t {
|
|||||||
* SERVICE REQUEST
|
* SERVICE REQUEST
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_service_request_t {
|
typedef struct nas_service_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_ksi_and_sequence_number_t ksi_and_sequence_number;
|
nas_ksi_and_sequence_number_t ksi_and_sequence_number;
|
||||||
nas_short_mac_t message_authentication_code;
|
nas_short_mac_t message_authentication_code;
|
||||||
@@ -527,7 +527,7 @@ typedef struct _nas_service_request_t {
|
|||||||
#define NAS_SERVICE_REJECT_T3346_VALUE_PRESENT (1<<0)
|
#define NAS_SERVICE_REJECT_T3346_VALUE_PRESENT (1<<0)
|
||||||
#define NAS_SERVICE_REJECT_T3346_VALUE_TYPE 0x5F
|
#define NAS_SERVICE_REJECT_T3346_VALUE_TYPE 0x5F
|
||||||
|
|
||||||
typedef struct _nas_service_reject_t {
|
typedef struct nas_service_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_emm_cause_t emm_cause;
|
nas_emm_cause_t emm_cause;
|
||||||
nas_gprs_timer_t t3442_value;
|
nas_gprs_timer_t t3442_value;
|
||||||
@@ -544,7 +544,7 @@ typedef struct _nas_service_reject_t {
|
|||||||
#define NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT (1<<0)
|
#define NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_PRESENT (1<<0)
|
||||||
#define NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_TYPE 0x54
|
#define NAS_GUTI_REALLOCATION_COMMAND_TAI_LIST_TYPE 0x54
|
||||||
|
|
||||||
typedef struct _nas_guti_reallocation_command_t {
|
typedef struct nas_guti_reallocation_command_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_eps_mobile_identity_t guti;
|
nas_eps_mobile_identity_t guti;
|
||||||
|
|
||||||
@@ -558,7 +558,7 @@ typedef struct _nas_guti_reallocation_command_t {
|
|||||||
* AUTHENTICATION REQUEST
|
* AUTHENTICATION REQUEST
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_authentication_request_t {
|
typedef struct nas_authentication_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_key_set_identifier_t nas_key_set_identifierasme;
|
nas_key_set_identifier_t nas_key_set_identifierasme;
|
||||||
nas_authentication_parameter_rand_t authentication_parameter_rand;
|
nas_authentication_parameter_rand_t authentication_parameter_rand;
|
||||||
@@ -570,7 +570,7 @@ typedef struct _nas_authentication_request_t {
|
|||||||
* AUTHENTICATION RESPONSE
|
* AUTHENTICATION RESPONSE
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_authentication_response_t {
|
typedef struct nas_authentication_response_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_authentication_response_parameter_t authentication_response_parameter;
|
nas_authentication_response_parameter_t authentication_response_parameter;
|
||||||
} nas_authentication_response_t;
|
} nas_authentication_response_t;
|
||||||
@@ -580,7 +580,7 @@ typedef struct _nas_authentication_response_t {
|
|||||||
* IDENTITY REQUEST
|
* IDENTITY REQUEST
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_identity_request_t {
|
typedef struct nas_identity_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_identity_type_2_t identity_type;
|
nas_identity_type_2_t identity_type;
|
||||||
} nas_identity_request_t;
|
} nas_identity_request_t;
|
||||||
@@ -590,7 +590,7 @@ typedef struct _nas_identity_request_t {
|
|||||||
* IDENTITY RESPONSE
|
* IDENTITY RESPONSE
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_identity_response_t {
|
typedef struct nas_identity_response_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_mobile_identity_t mobile_identity;
|
nas_mobile_identity_t mobile_identity;
|
||||||
} nas_identity_response_t;
|
} nas_identity_response_t;
|
||||||
@@ -602,7 +602,7 @@ typedef struct _nas_identity_response_t {
|
|||||||
#define NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1<<0)
|
#define NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_PRESENT (1<<0)
|
||||||
#define NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_TYPE 0x30
|
#define NAS_AUTHENTICATION_FAILURE_AUTHENTICATION_FAILURE_PARAMETER_TYPE 0x30
|
||||||
|
|
||||||
typedef struct _nas_authentication_failure_t {
|
typedef struct nas_authentication_failure_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_emm_cause_t emm_cause;
|
nas_emm_cause_t emm_cause;
|
||||||
|
|
||||||
@@ -622,7 +622,7 @@ typedef struct _nas_authentication_failure_t {
|
|||||||
#define NAS_SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_TYPE 0x55
|
#define NAS_SECURITY_MODE_COMMAND_REPLAYED_NONCEUE_TYPE 0x55
|
||||||
#define NAS_SECURITY_MODE_COMMAND_NONCEMME_TYPE 0x56
|
#define NAS_SECURITY_MODE_COMMAND_NONCEMME_TYPE 0x56
|
||||||
|
|
||||||
typedef struct _nas_security_mode_command_t {
|
typedef struct nas_security_mode_command_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_security_algorithms_t selected_nas_security_algorithms;
|
nas_security_algorithms_t selected_nas_security_algorithms;
|
||||||
nas_key_set_identifier_t nas_key_set_identifier;
|
nas_key_set_identifier_t nas_key_set_identifier;
|
||||||
@@ -642,7 +642,7 @@ typedef struct _nas_security_mode_command_t {
|
|||||||
#define NAS_SECURITY_MODE_COMPLETE_IMEISV_PRESENT (1<<0)
|
#define NAS_SECURITY_MODE_COMPLETE_IMEISV_PRESENT (1<<0)
|
||||||
#define NAS_SECURITY_MODE_COMPLETE_IMEISV_TYPE 0x23
|
#define NAS_SECURITY_MODE_COMPLETE_IMEISV_TYPE 0x23
|
||||||
|
|
||||||
typedef struct _nas_security_mode_complete_t {
|
typedef struct nas_security_mode_complete_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -654,7 +654,7 @@ typedef struct _nas_security_mode_complete_t {
|
|||||||
* SECURITY MODE REJECT
|
* SECURITY MODE REJECT
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_security_mode_reject_t {
|
typedef struct nas_security_mode_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_emm_cause_t emm_cause;
|
nas_emm_cause_t emm_cause;
|
||||||
} nas_security_mode_reject_t;
|
} nas_security_mode_reject_t;
|
||||||
@@ -664,7 +664,7 @@ typedef struct _nas_security_mode_reject_t {
|
|||||||
* EMM STATUS
|
* EMM STATUS
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_emm_status_t {
|
typedef struct nas_emm_status_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_emm_cause_t emm_cause;
|
nas_emm_cause_t emm_cause;
|
||||||
} nas_emm_status_t;
|
} nas_emm_status_t;
|
||||||
@@ -684,7 +684,7 @@ typedef struct _nas_emm_status_t {
|
|||||||
#define NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_TYPE 0x47
|
#define NAS_EMM_INFORMATION_UNIVERSAL_TIME_AND_LOCAL_TIME_ZONE_TYPE 0x47
|
||||||
#define NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_TYPE 0x49
|
#define NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_TYPE 0x49
|
||||||
|
|
||||||
typedef struct _nas_emm_information_t {
|
typedef struct nas_emm_information_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -700,7 +700,7 @@ typedef struct _nas_emm_information_t {
|
|||||||
* DOWNLINK NAS TRANSPORT
|
* DOWNLINK NAS TRANSPORT
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_downlink_nas_transport_t {
|
typedef struct nas_downlink_nas_transport_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_message_container_t nas_message_container;
|
nas_message_container_t nas_message_container;
|
||||||
} nas_downlink_nas_transport_t;
|
} nas_downlink_nas_transport_t;
|
||||||
@@ -710,7 +710,7 @@ typedef struct _nas_downlink_nas_transport_t {
|
|||||||
* UPLINK NAS TRANSPORT
|
* UPLINK NAS TRANSPORT
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_uplink_nas_transport_t {
|
typedef struct nas_uplink_nas_transport_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_message_container_t nas_message_container;
|
nas_message_container_t nas_message_container;
|
||||||
} nas_uplink_nas_transport_t;
|
} nas_uplink_nas_transport_t;
|
||||||
@@ -728,7 +728,7 @@ typedef struct _nas_uplink_nas_transport_t {
|
|||||||
#define NAS_CS_SERVICE_NOTIFICATION_LCS_INDICATOR_TYPE 0x62
|
#define NAS_CS_SERVICE_NOTIFICATION_LCS_INDICATOR_TYPE 0x62
|
||||||
#define NAS_CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_TYPE 0x63
|
#define NAS_CS_SERVICE_NOTIFICATION_LCS_CLIENT_IDENTITY_TYPE 0x63
|
||||||
|
|
||||||
typedef struct _nas_cs_service_notification_t {
|
typedef struct nas_cs_service_notification_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_paging_identity_t paging_identity;
|
nas_paging_identity_t paging_identity;
|
||||||
|
|
||||||
@@ -747,7 +747,7 @@ typedef struct _nas_cs_service_notification_t {
|
|||||||
#define NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT (1<<0)
|
#define NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT (1<<0)
|
||||||
#define NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE 0x65
|
#define NAS_UPLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE 0x65
|
||||||
|
|
||||||
typedef struct _nas_uplink_generic_nas_transport_t {
|
typedef struct nas_uplink_generic_nas_transport_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_generic_message_container_type_t generic_message_container_type;
|
nas_generic_message_container_type_t generic_message_container_type;
|
||||||
nas_generic_message_container_t generic_message_container;
|
nas_generic_message_container_t generic_message_container;
|
||||||
@@ -764,7 +764,7 @@ typedef struct _nas_uplink_generic_nas_transport_t {
|
|||||||
#define NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT (1<<0)
|
#define NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_PRESENT (1<<0)
|
||||||
#define NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE 0x65
|
#define NAS_DOWNLINK_GENERIC_NAS_TRANSPORT_ADDITIONAL_INFORMATION_TYPE 0x65
|
||||||
|
|
||||||
typedef struct _nas_downlink_generic_nas_transport_t {
|
typedef struct nas_downlink_generic_nas_transport_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_generic_message_container_type_t generic_message_container_type;
|
nas_generic_message_container_type_t generic_message_container_type;
|
||||||
nas_generic_message_container_t generic_message_container;
|
nas_generic_message_container_t generic_message_container;
|
||||||
@@ -809,7 +809,7 @@ typedef struct _nas_downlink_generic_nas_transport_t {
|
|||||||
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_SERVING_PLMN_RATE_CONTROL_TYPE 0x6E
|
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REQUEST_SERVING_PLMN_RATE_CONTROL_TYPE 0x6E
|
||||||
|
|
||||||
typedef struct _nas_activate_default_eps_bearer_context_request_t {
|
typedef struct nas_activate_default_eps_bearer_context_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_eps_quality_of_service_t eps_qos;
|
nas_eps_quality_of_service_t eps_qos;
|
||||||
nas_access_point_name_t access_point_name;
|
nas_access_point_name_t access_point_name;
|
||||||
@@ -843,7 +843,7 @@ typedef struct _nas_activate_default_eps_bearer_context_request_t {
|
|||||||
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
||||||
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_activate_default_eps_bearer_context_accept_t {
|
typedef struct nas_activate_default_eps_bearer_context_accept_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -860,7 +860,7 @@ typedef struct _nas_activate_default_eps_bearer_context_accept_t {
|
|||||||
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
||||||
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ACTIVATE_DEFAULT_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_activate_default_eps_bearer_context_reject_t {
|
typedef struct nas_activate_default_eps_bearer_context_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -893,7 +893,7 @@ typedef struct _nas_activate_default_eps_bearer_context_reject_t {
|
|||||||
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_activate_dedicated_eps_bearer_context_request_t {
|
typedef struct nas_activate_dedicated_eps_bearer_context_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_linked_eps_bearer_identity_t linked_eps_bearer_identity;
|
nas_linked_eps_bearer_identity_t linked_eps_bearer_identity;
|
||||||
nas_eps_quality_of_service_t eps_qos;
|
nas_eps_quality_of_service_t eps_qos;
|
||||||
@@ -923,7 +923,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_request_t {
|
|||||||
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_activate_dedicated_eps_bearer_context_accept_t {
|
typedef struct nas_activate_dedicated_eps_bearer_context_accept_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -943,7 +943,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_accept_t {
|
|||||||
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ACTIVATE_DEDICATED_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_activate_dedicated_eps_bearer_context_reject_t {
|
typedef struct nas_activate_dedicated_eps_bearer_context_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -983,7 +983,7 @@ typedef struct _nas_activate_dedicated_eps_bearer_context_reject_t {
|
|||||||
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66
|
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66
|
||||||
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_modify_eps_bearer_context_request_t {
|
typedef struct nas_modify_eps_bearer_context_request_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -1012,7 +1012,7 @@ typedef struct _nas_modify_eps_bearer_context_request_t {
|
|||||||
#define NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_MODIFY_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_modify_eps_bearer_context_accept_t {
|
typedef struct nas_modify_eps_bearer_context_accept_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -1032,7 +1032,7 @@ typedef struct _nas_modify_eps_bearer_context_accept_t {
|
|||||||
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_MODIFY_EPS_BEARER_CONTEXT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_modify_eps_bearer_context_reject_t {
|
typedef struct nas_modify_eps_bearer_context_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -1058,7 +1058,7 @@ typedef struct _nas_modify_eps_bearer_context_reject_t {
|
|||||||
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_deactivate_eps_bearer_context_request_t {
|
typedef struct nas_deactivate_eps_bearer_context_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -1080,7 +1080,7 @@ typedef struct _nas_deactivate_eps_bearer_context_request_t {
|
|||||||
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
||||||
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_DEACTIVATE_EPS_BEARER_CONTEXT_ACCEPT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_deactivate_eps_bearer_context_accept_t {
|
typedef struct nas_deactivate_eps_bearer_context_accept_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -1107,7 +1107,7 @@ typedef struct _nas_deactivate_eps_bearer_context_accept_t {
|
|||||||
#define NAS_PDN_CONNECTIVITY_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66
|
#define NAS_PDN_CONNECTIVITY_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66
|
||||||
#define NAS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_PDN_CONNECTIVITY_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_pdn_connectivity_request_t {
|
typedef struct nas_pdn_connectivity_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_request_type_t request_type;
|
nas_request_type_t request_type;
|
||||||
|
|
||||||
@@ -1137,7 +1137,7 @@ typedef struct _nas_pdn_connectivity_request_t {
|
|||||||
#define NAS_PDN_CONNECTIVITY_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_PDN_CONNECTIVITY_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_PDN_CONNECTIVITY_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_PDN_CONNECTIVITY_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_pdn_connectivity_reject_t {
|
typedef struct nas_pdn_connectivity_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -1159,7 +1159,7 @@ typedef struct _nas_pdn_connectivity_reject_t {
|
|||||||
#define NAS_PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
#define NAS_PDN_DISCONNECT_REQUEST_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
||||||
#define NAS_PDN_DISCONNECT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_PDN_DISCONNECT_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_pdn_disconnect_request_t {
|
typedef struct nas_pdn_disconnect_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_linked_eps_bearer_identity_t linked_eps_bearer_identity;
|
nas_linked_eps_bearer_identity_t linked_eps_bearer_identity;
|
||||||
|
|
||||||
@@ -1178,7 +1178,7 @@ typedef struct _nas_pdn_disconnect_request_t {
|
|||||||
#define NAS_PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
#define NAS_PDN_DISCONNECT_REJECT_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
||||||
#define NAS_PDN_DISCONNECT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_PDN_DISCONNECT_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_pdn_disconnect_reject_t {
|
typedef struct nas_pdn_disconnect_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -1201,7 +1201,7 @@ typedef struct _nas_pdn_disconnect_reject_t {
|
|||||||
#define NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_BEARER_RESOURCE_ALLOCATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_bearer_resource_allocation_request_t {
|
typedef struct nas_bearer_resource_allocation_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_linked_eps_bearer_identity_t linked_eps_bearer_identity;
|
nas_linked_eps_bearer_identity_t linked_eps_bearer_identity;
|
||||||
nas_traffic_flow_aggregate_description_t traffic_flow_aggregate;
|
nas_traffic_flow_aggregate_description_t traffic_flow_aggregate;
|
||||||
@@ -1230,7 +1230,7 @@ typedef struct _nas_bearer_resource_allocation_request_t {
|
|||||||
#define NAS_BEARER_RESOURCE_ALLOCATION_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_BEARER_RESOURCE_ALLOCATION_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_BEARER_RESOURCE_ALLOCATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_BEARER_RESOURCE_ALLOCATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_bearer_resource_allocation_reject_t {
|
typedef struct nas_bearer_resource_allocation_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -1262,7 +1262,7 @@ typedef struct _nas_bearer_resource_allocation_reject_t {
|
|||||||
#define NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66
|
#define NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_HEADER_COMPRESSION_CONFIGURATION_TYPE 0x66
|
||||||
#define NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_BEARER_RESOURCE_MODIFICATION_REQUEST_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_bearer_resource_modification_request_t {
|
typedef struct nas_bearer_resource_modification_request_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_linked_eps_bearer_identity_t eps_bearer_identity_for_packet_filter;
|
nas_linked_eps_bearer_identity_t eps_bearer_identity_for_packet_filter;
|
||||||
nas_traffic_flow_aggregate_description_t traffic_flow_aggregate;
|
nas_traffic_flow_aggregate_description_t traffic_flow_aggregate;
|
||||||
@@ -1293,7 +1293,7 @@ typedef struct _nas_bearer_resource_modification_request_t {
|
|||||||
#define NAS_BEARER_RESOURCE_MODIFICATION_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
#define NAS_BEARER_RESOURCE_MODIFICATION_REJECT_NBIFOM_CONTAINER_TYPE 0x33
|
||||||
#define NAS_BEARER_RESOURCE_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_BEARER_RESOURCE_MODIFICATION_REJECT_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_bearer_resource_modification_reject_t {
|
typedef struct nas_bearer_resource_modification_reject_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
|
|
||||||
@@ -1317,7 +1317,7 @@ typedef struct _nas_bearer_resource_modification_reject_t {
|
|||||||
#define NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
#define NAS_ESM_INFORMATION_RESPONSE_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x27
|
||||||
#define NAS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
#define NAS_ESM_INFORMATION_RESPONSE_EXTENDED_PROTOCOL_CONFIGURATION_OPTIONS_TYPE 0x7B
|
||||||
|
|
||||||
typedef struct _nas_esm_information_response_t {
|
typedef struct nas_esm_information_response_s {
|
||||||
|
|
||||||
/* Optional fields */
|
/* Optional fields */
|
||||||
uint32_t presencemask;
|
uint32_t presencemask;
|
||||||
@@ -1331,13 +1331,13 @@ typedef struct _nas_esm_information_response_t {
|
|||||||
* ESM STATUS
|
* ESM STATUS
|
||||||
******************************************************/
|
******************************************************/
|
||||||
|
|
||||||
typedef struct _nas_esm_status_t {
|
typedef struct nas_esm_status_s {
|
||||||
/* Mandatory fields */
|
/* Mandatory fields */
|
||||||
nas_esm_cause_t esm_cause;
|
nas_esm_cause_t esm_cause;
|
||||||
} nas_esm_status_t;
|
} nas_esm_status_t;
|
||||||
|
|
||||||
|
|
||||||
typedef struct _nas_emm_message_t {
|
typedef struct nas_emm_message_s {
|
||||||
nas_emm_header_t h;
|
nas_emm_header_t h;
|
||||||
union {
|
union {
|
||||||
nas_attach_request_t attach_request;
|
nas_attach_request_t attach_request;
|
||||||
@@ -1371,7 +1371,7 @@ typedef struct _nas_emm_message_t {
|
|||||||
};
|
};
|
||||||
} nas_emm_message_t;
|
} nas_emm_message_t;
|
||||||
|
|
||||||
typedef struct _nas_esm_message_t {
|
typedef struct nas_esm_message_s {
|
||||||
nas_esm_header_t h;
|
nas_esm_header_t h;
|
||||||
union {
|
union {
|
||||||
nas_activate_default_eps_bearer_context_request_t activate_default_eps_bearer_context_request;
|
nas_activate_default_eps_bearer_context_request_t activate_default_eps_bearer_context_request;
|
||||||
@@ -1398,7 +1398,7 @@ typedef struct _nas_esm_message_t {
|
|||||||
};
|
};
|
||||||
} nas_esm_message_t;
|
} nas_esm_message_t;
|
||||||
|
|
||||||
typedef struct _nas_message_t {
|
typedef struct nas_message_s {
|
||||||
nas_security_header_t h;
|
nas_security_header_t h;
|
||||||
union {
|
union {
|
||||||
nas_emm_message_t emm;
|
nas_emm_message_t emm;
|
||||||
@@ -1413,6 +1413,6 @@ int nas_plain_encode(
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __NAS_MESSAGE_H__ */
|
#endif /* NAS_MESSAGE_H */
|
||||||
@@ -17,7 +17,7 @@
|
|||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#include "nas_types.h"
|
#include "nas-types.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -52,7 +52,7 @@ extern "C" {
|
|||||||
|
|
||||||
/**********************************
|
/**********************************
|
||||||
* NAS PLMN_ID Structure */
|
* NAS PLMN_ID Structure */
|
||||||
typedef struct _nas_plmn_id_t {
|
typedef struct nas_plmn_id_s {
|
||||||
ED2(uint8_t mcc2:4;,
|
ED2(uint8_t mcc2:4;,
|
||||||
uint8_t mcc1:4;)
|
uint8_t mcc1:4;)
|
||||||
ED2(uint8_t mnc3:4;,
|
ED2(uint8_t mnc3:4;,
|
||||||
@@ -64,17 +64,17 @@ ED2(uint8_t mnc2:4;,
|
|||||||
void *nas_from_plmn_id(nas_plmn_id_t *nas_plmn_id, plmn_id_t *plmn_id);
|
void *nas_from_plmn_id(nas_plmn_id_t *nas_plmn_id, plmn_id_t *plmn_id);
|
||||||
void *nas_to_plmn_id(plmn_id_t *plmn_id, nas_plmn_id_t *nas_plmn_id);
|
void *nas_to_plmn_id(plmn_id_t *plmn_id, nas_plmn_id_t *nas_plmn_id);
|
||||||
|
|
||||||
typedef struct _guti_t {
|
typedef struct nas_guti_s {
|
||||||
nas_plmn_id_t plmn_id;
|
nas_plmn_id_t nas_plmn_id;
|
||||||
uint16_t mme_gid;
|
uint16_t mme_gid;
|
||||||
uint8_t mme_code;
|
uint8_t mme_code;
|
||||||
uint32_t m_tmsi;
|
uint32_t m_tmsi;
|
||||||
} __attribute__ ((packed)) guti_t;
|
} __attribute__ ((packed)) nas_guti_t;
|
||||||
|
|
||||||
/* 9.9.2.0 Additional information
|
/* 9.9.2.0 Additional information
|
||||||
* O TLV 3-n */
|
* O TLV 3-n */
|
||||||
#define NAX_MAX_ADDITIONAL_INFORMATION_LEN 255
|
#define NAX_MAX_ADDITIONAL_INFORMATION_LEN 255
|
||||||
typedef struct _nas_additional_information_t {
|
typedef struct nas_additional_information_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAX_MAX_ADDITIONAL_INFORMATION_LEN];
|
uint8_t buffer[NAX_MAX_ADDITIONAL_INFORMATION_LEN];
|
||||||
} __attribute__ ((packed)) nas_additional_information_t;
|
} __attribute__ ((packed)) nas_additional_information_t;
|
||||||
@@ -82,7 +82,7 @@ typedef struct _nas_additional_information_t {
|
|||||||
/* 9.9.2.0A Device properties
|
/* 9.9.2.0A Device properties
|
||||||
* See subclause 10.5.7.8 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.7.8 in 3GPP TS 24.008 [13].
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_device_properties_t {
|
typedef struct nas_device_properties_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t low_priority:1;)
|
uint8_t low_priority:1;)
|
||||||
@@ -90,7 +90,7 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.2.1 EPS bearer context status
|
/* 9.9.2.1 EPS bearer context status
|
||||||
* O TLV 4 */
|
* O TLV 4 */
|
||||||
typedef struct _nas_eps_bearer_context_status_t {
|
typedef struct nas_eps_bearer_context_status_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED8(uint8_t ebi7:1;,
|
ED8(uint8_t ebi7:1;,
|
||||||
uint8_t ebi6:1;,
|
uint8_t ebi6:1;,
|
||||||
@@ -113,11 +113,13 @@ ED8(uint8_t ebi15:1;,
|
|||||||
/* 9.9.2.2 Location area identification
|
/* 9.9.2.2 Location area identification
|
||||||
* See subclause 10.5.1.3 in 3GPP TS 24.008 [13]
|
* See subclause 10.5.1.3 in 3GPP TS 24.008 [13]
|
||||||
* O TV 6 */
|
* O TV 6 */
|
||||||
typedef struct _nas_location_area_identification_t {
|
typedef struct nas_location_area_identification_s {
|
||||||
nas_plmn_id_t plmn_id;
|
nas_plmn_id_t nas_plmn_id;
|
||||||
uint16_t lac;
|
uint16_t lac;
|
||||||
} __attribute__ ((packed)) nas_location_area_identification_t;
|
} __attribute__ ((packed)) nas_location_area_identification_t;
|
||||||
|
|
||||||
|
typedef nas_location_area_identification_t nas_lai_t;
|
||||||
|
|
||||||
/* 9.9.2.3 Mobile identity
|
/* 9.9.2.3 Mobile identity
|
||||||
* See subclause 10.5.1.4 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.1.4 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 7-10 */
|
* O TLV 7-10 */
|
||||||
@@ -128,7 +130,7 @@ typedef struct _nas_location_area_identification_t {
|
|||||||
#define NAS_MOBILE_IDENTITY_TMSI 4
|
#define NAS_MOBILE_IDENTITY_TMSI 4
|
||||||
#define NAS_MOBILE_IDENTITY_TMGI 5
|
#define NAS_MOBILE_IDENTITY_TMGI 5
|
||||||
#define NAS_MOBILE_IDENTITY_GUTI 6
|
#define NAS_MOBILE_IDENTITY_GUTI 6
|
||||||
typedef struct _nas_mobile_identity_imsi {
|
typedef struct nas_mobile_identity_imsi_s {
|
||||||
ED3(uint8_t digit1:4;,
|
ED3(uint8_t digit1:4;,
|
||||||
uint8_t odd_even:1;,
|
uint8_t odd_even:1;,
|
||||||
uint8_t type:3;)
|
uint8_t type:3;)
|
||||||
@@ -148,25 +150,25 @@ ED2(uint8_t digit15:4;,
|
|||||||
uint8_t digit14:4;)
|
uint8_t digit14:4;)
|
||||||
} __attribute__ ((packed)) nas_mobile_identity_imsi_t;
|
} __attribute__ ((packed)) nas_mobile_identity_imsi_t;
|
||||||
|
|
||||||
typedef struct _nas_mobile_identity_tmsi {
|
typedef struct nas_mobile_identity_tmsi_s {
|
||||||
ED3(uint8_t spare:4;,
|
ED3(uint8_t spare:4;,
|
||||||
uint8_t odd_even:1;,
|
uint8_t odd_even:1;,
|
||||||
uint8_t type:3;)
|
uint8_t type:3;)
|
||||||
uint32_t tmsi;
|
uint32_t tmsi;
|
||||||
} __attribute__ ((packed)) nas_mobile_identity_tmsi_t;
|
} __attribute__ ((packed)) nas_mobile_identity_tmsi_t;
|
||||||
|
|
||||||
typedef struct _nas_mobile_identity_tmgi {
|
typedef struct nas_mobile_identity_tmgi_s {
|
||||||
ED5(uint8_t spare:2;,
|
ED5(uint8_t spare:2;,
|
||||||
uint8_t mbms_session_id:1;,
|
uint8_t mbms_session_id:1;,
|
||||||
uint8_t mcc_mnc:1;,
|
uint8_t mcc_mnc:1;,
|
||||||
uint8_t odd_even:1;,
|
uint8_t odd_even:1;,
|
||||||
uint8_t type:3;)
|
uint8_t type:3;)
|
||||||
uint8_t mbms_servicec_id[3];
|
uint8_t mbms_servicec_id[3];
|
||||||
nas_plmn_id_t plmn_id;
|
nas_plmn_id_t nas_plmn_id;
|
||||||
uint8_t mbms_session_identity;
|
uint8_t mbms_session_identity;
|
||||||
} __attribute__ ((packed)) nas_mobile_identity_tmgi_t;
|
} __attribute__ ((packed)) nas_mobile_identity_tmgi_t;
|
||||||
|
|
||||||
typedef struct _nas_mobile_identity_t {
|
typedef struct nas_mobile_identity_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
union {
|
union {
|
||||||
nas_mobile_identity_imsi_t imsi;
|
nas_mobile_identity_imsi_t imsi;
|
||||||
@@ -217,7 +219,7 @@ ED8(uint8_t cm3:1;,
|
|||||||
* See subclause 10.5.1.7 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.1.7 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 2-34 */
|
* O TLV 2-34 */
|
||||||
#define NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN 32
|
#define NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN 32
|
||||||
typedef struct _nas_mobile_station_classmark_3_t {
|
typedef struct nas_mobile_station_classmark_3_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN];
|
uint8_t buffer[NAS_MAX_MOBILE_STATION_CLASSMARK_3_LEN];
|
||||||
} __attribute__ ((packed)) nas_mobile_station_classmark_3_t;
|
} __attribute__ ((packed)) nas_mobile_station_classmark_3_t;
|
||||||
@@ -226,29 +228,29 @@ typedef struct _nas_mobile_station_classmark_3_t {
|
|||||||
* See subclause 10.5.1.13 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.1.13 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 5-47 */
|
* O TLV 5-47 */
|
||||||
#define NAS_MAX_PLMN 15
|
#define NAS_MAX_PLMN 15
|
||||||
typedef struct _nas_plmn_list_t {
|
typedef struct nas_plmn_list_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
nas_plmn_id_t plmn_id[NAS_MAX_PLMN];
|
nas_plmn_id_t nas_plmn_id[NAS_MAX_PLMN];
|
||||||
} __attribute__ ((packed)) nas_plmn_list_t;
|
} __attribute__ ((packed)) nas_plmn_list_t;
|
||||||
|
|
||||||
/* 9.9.2.10 Supported codec list
|
/* 9.9.2.10 Supported codec list
|
||||||
* See subclause 10.5.4.32 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.4.32 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 5-n */
|
* O TLV 5-n */
|
||||||
typedef struct _nas_supported_codec_item_t {
|
typedef struct nas_supported_codec_item_s {
|
||||||
uint8_t system_identification;
|
uint8_t system_identification;
|
||||||
uint8_t length_of_bitmap;
|
uint8_t length_of_bitmap;
|
||||||
uint16_t codec_bitmap;
|
uint16_t codec_bitmap;
|
||||||
} __attribute__ ((packed)) nas_supported_codec_item_t;
|
} __attribute__ ((packed)) nas_supported_codec_item_t;
|
||||||
|
|
||||||
#define NAS_MAX_SUPPORTED_CODECS 8
|
#define NAS_MAX_SUPPORTED_CODECS 8
|
||||||
typedef struct _nas_supported_codec_list_t {
|
typedef struct nas_supported_codec_list_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
nas_supported_codec_item_t item[NAS_MAX_SUPPORTED_CODECS];
|
nas_supported_codec_item_t item[NAS_MAX_SUPPORTED_CODECS];
|
||||||
} __attribute__ ((packed)) nas_supported_codec_list_t;
|
} __attribute__ ((packed)) nas_supported_codec_list_t;
|
||||||
|
|
||||||
/* 9.9.3.0A Additional update result
|
/* 9.9.3.0A Additional update result
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_additional_update_result_t {
|
typedef struct nas_additional_update_result_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:2;,
|
uint8_t spare:2;,
|
||||||
uint8_t additional_update_result_value:2;)
|
uint8_t additional_update_result_value:2;)
|
||||||
@@ -260,7 +262,7 @@ ED3(uint8_t type:4;,
|
|||||||
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_CONTROL_PLANE 1
|
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_CONTROL_PLANE 1
|
||||||
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_DATA_PLANE 2
|
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_DATA_PLANE 2
|
||||||
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_RESERVED 3
|
#define NAS_ADDITIONAL_UPDATE_TYPE_CIOT_RESERVED 3
|
||||||
typedef struct _nas_additional_update_type_t {
|
typedef struct nas_additional_update_type_s {
|
||||||
ED4(uint8_t type:4;,
|
ED4(uint8_t type:4;,
|
||||||
uint8_t pnb_ciot:2;,
|
uint8_t pnb_ciot:2;,
|
||||||
uint8_t saf:1;,
|
uint8_t saf:1;,
|
||||||
@@ -270,7 +272,7 @@ ED4(uint8_t type:4;,
|
|||||||
/* 9.9.3.1 Authentication failure parameter
|
/* 9.9.3.1 Authentication failure parameter
|
||||||
* See subclause 10.5.3.2.2 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.3.2.2 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 16 */
|
* O TLV 16 */
|
||||||
typedef struct _nas_authentication_failure_parameter_t {
|
typedef struct nas_authentication_failure_parameter_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t auts[AUTS_LEN];
|
uint8_t auts[AUTS_LEN];
|
||||||
} __attribute__ ((packed)) nas_authentication_failure_parameter_t;
|
} __attribute__ ((packed)) nas_authentication_failure_parameter_t;
|
||||||
@@ -278,7 +280,7 @@ typedef struct _nas_authentication_failure_parameter_t {
|
|||||||
/* 9.9.3.2 Authentication parameter AUTN
|
/* 9.9.3.2 Authentication parameter AUTN
|
||||||
* See subclause 10.5.3.1.1 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.3.1.1 in 3GPP TS 24.008 [13].
|
||||||
* M LV 17 */
|
* M LV 17 */
|
||||||
typedef struct _nas_authentication_parameter_autn_t {
|
typedef struct nas_authentication_parameter_autn_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t autn[AUTN_LEN];
|
uint8_t autn[AUTN_LEN];
|
||||||
} nas_authentication_parameter_autn_t;
|
} nas_authentication_parameter_autn_t;
|
||||||
@@ -286,13 +288,13 @@ typedef struct _nas_authentication_parameter_autn_t {
|
|||||||
/* 9.9.3.3 Authentication parameter RAND
|
/* 9.9.3.3 Authentication parameter RAND
|
||||||
* See subclause 10.5.3.1 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.3.1 in 3GPP TS 24.008 [13].
|
||||||
* M V 16 */
|
* M V 16 */
|
||||||
typedef struct _nas_authentication_parameter_rand_t {
|
typedef struct nas_authentication_parameter_rand_s {
|
||||||
uint8_t rand[RAND_LEN];
|
uint8_t rand[RAND_LEN];
|
||||||
} nas_authentication_parameter_rand_t;
|
} nas_authentication_parameter_rand_t;
|
||||||
|
|
||||||
/* 9.9.3.4 Authentication response parameter
|
/* 9.9.3.4 Authentication response parameter
|
||||||
* M LV 5-17 */
|
* M LV 5-17 */
|
||||||
typedef struct _nas_authentication_response_parameter_t {
|
typedef struct nas_authentication_response_parameter_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t res[MAX_RES_LEN];
|
uint8_t res[MAX_RES_LEN];
|
||||||
} nas_authentication_response_parameter_t;
|
} nas_authentication_response_parameter_t;
|
||||||
@@ -301,7 +303,7 @@ typedef struct _nas_authentication_response_parameter_t {
|
|||||||
* See subclause 10.5.1.2 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.1.2 in 3GPP TS 24.008 [13].
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
#define NAS_CIPHERING_KEY_SEQUENCE_NUMBER_NO_KEY_FROM_MS 7
|
#define NAS_CIPHERING_KEY_SEQUENCE_NUMBER_NO_KEY_FROM_MS 7
|
||||||
typedef struct _nas_ciphering_key_sequence_number_t {
|
typedef struct nas_ciphering_key_sequence_number_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:1;,
|
uint8_t spare:1;,
|
||||||
uint8_t key_sequence:3;)
|
uint8_t key_sequence:3;)
|
||||||
@@ -311,7 +313,7 @@ ED3(uint8_t type:4;,
|
|||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
#define NAS_CS_FALLBACK_RESPONSE_REJECTED_BY_THE_UE 0
|
#define NAS_CS_FALLBACK_RESPONSE_REJECTED_BY_THE_UE 0
|
||||||
#define NAS_CS_FALLBACK_RESPONSE_ACCEPTED_BY_THE_UE 1
|
#define NAS_CS_FALLBACK_RESPONSE_ACCEPTED_BY_THE_UE 1
|
||||||
typedef struct _nas_csfb_response_t {
|
typedef struct nas_csfb_response_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:1;,
|
uint8_t spare:1;,
|
||||||
uint8_t response:3;)
|
uint8_t response:3;)
|
||||||
@@ -323,7 +325,7 @@ ED3(uint8_t type:4;,
|
|||||||
#define NAS_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 0
|
#define NAS_NO_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 0
|
||||||
#define NAS_PLUS_1_HOUR_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 1
|
#define NAS_PLUS_1_HOUR_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 1
|
||||||
#define NAS_PLUS_2_HOURS_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 2
|
#define NAS_PLUS_2_HOURS_ADJUSTMENT_FOR_DAYLIGHT_SAVING_TIME 2
|
||||||
typedef struct _nas_daylight_saving_time_t {
|
typedef struct nas_daylight_saving_time_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED2(uint8_t spare:6;,
|
ED2(uint8_t spare:6;,
|
||||||
uint8_t value:2;)
|
uint8_t value:2;)
|
||||||
@@ -339,7 +341,7 @@ ED2(uint8_t spare:6;,
|
|||||||
#define NAS_DETACH_TYPE_TO_UE_RE_ATTACH_REQUIRED 1
|
#define NAS_DETACH_TYPE_TO_UE_RE_ATTACH_REQUIRED 1
|
||||||
#define NAS_DETACH_TYPE_TO_UE_RE_ATTACH_NOT_REQUIRED 2
|
#define NAS_DETACH_TYPE_TO_UE_RE_ATTACH_NOT_REQUIRED 2
|
||||||
#define NAS_DETACH_TYPE_TO_UE_IMSI_DETACH 3
|
#define NAS_DETACH_TYPE_TO_UE_IMSI_DETACH 3
|
||||||
typedef struct _nas_detach_type_t {
|
typedef struct nas_detach_type_s {
|
||||||
ED4(uint8_t tsc:1;,
|
ED4(uint8_t tsc:1;,
|
||||||
uint8_t nas_key_set_identifier:3;,
|
uint8_t nas_key_set_identifier:3;,
|
||||||
uint8_t switch_off:1;,
|
uint8_t switch_off:1;,
|
||||||
@@ -362,7 +364,7 @@ ED4(uint8_t tsc:1;,
|
|||||||
#define NAS_DRX_PARAMETER_COEFFICIENT_7_T_64 7
|
#define NAS_DRX_PARAMETER_COEFFICIENT_7_T_64 7
|
||||||
#define NAS_DRX_PARAMETER_COEFFICIENT_8_T_128 8
|
#define NAS_DRX_PARAMETER_COEFFICIENT_8_T_128 8
|
||||||
#define NAS_DRX_PARAMETER_COEFFICIENT_9_T_256 9
|
#define NAS_DRX_PARAMETER_COEFFICIENT_9_T_256 9
|
||||||
typedef struct _nas_drx_parameter_t {
|
typedef struct nas_drx_parameter_s {
|
||||||
uint8_t split_pg_cycle_code;
|
uint8_t split_pg_cycle_code;
|
||||||
ED3(uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode:4;,
|
ED3(uint8_t cn_specific_drx_cycle_length_coefficient_and_drx_value_for_s1_mode:4;,
|
||||||
uint8_t split_on_ccch:1;,
|
uint8_t split_on_ccch:1;,
|
||||||
@@ -420,7 +422,7 @@ typedef uint8_t nas_emm_cause_t;
|
|||||||
* M V 1/2 */
|
* M V 1/2 */
|
||||||
#define NAS_ATTACH_RESULT_EPS_ONLY 1
|
#define NAS_ATTACH_RESULT_EPS_ONLY 1
|
||||||
#define NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH 2
|
#define NAS_ATTACH_RESULT_COMBINED_EPS_IMSI_ATTACH 2
|
||||||
typedef struct _nas_eps_attach_result_t {
|
typedef struct nas_eps_attach_result_s {
|
||||||
ED2(uint8_t spare:5;,
|
ED2(uint8_t spare:5;,
|
||||||
uint8_t result:3;)
|
uint8_t result:3;)
|
||||||
} __attribute__ ((packed)) nas_eps_attach_result_t;
|
} __attribute__ ((packed)) nas_eps_attach_result_t;
|
||||||
@@ -437,7 +439,7 @@ ED2(uint8_t spare:5;,
|
|||||||
#define NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTAACH 2
|
#define NAS_ATTACH_TYPE_COMBINED_EPS_IMSI_ATTAACH 2
|
||||||
#define NAS_ATTACH_TYPE_EPS_ERMERGENCY_ATTCH 3
|
#define NAS_ATTACH_TYPE_EPS_ERMERGENCY_ATTCH 3
|
||||||
#define NAS_ATTACH_TYPE_RESERVED 4
|
#define NAS_ATTACH_TYPE_RESERVED 4
|
||||||
typedef struct _nas_eps_attach_type_t {
|
typedef struct nas_eps_attach_type_s {
|
||||||
ED4(uint8_t tsc:1;,
|
ED4(uint8_t tsc:1;,
|
||||||
uint8_t nas_key_set_identifier:3;,
|
uint8_t nas_key_set_identifier:3;,
|
||||||
uint8_t spare:1;,
|
uint8_t spare:1;,
|
||||||
@@ -452,11 +454,11 @@ ED4(uint8_t tsc:1;,
|
|||||||
|
|
||||||
#define NAS_EPS_MOBILE_IDENTITY_EVEN 0
|
#define NAS_EPS_MOBILE_IDENTITY_EVEN 0
|
||||||
#define NAS_EPS_MOBILE_IDENTITY_ODD 1
|
#define NAS_EPS_MOBILE_IDENTITY_ODD 1
|
||||||
typedef struct _nas_eps_mobile_identity_guti_t {
|
typedef struct nas_eps_mobile_identity_guti_s {
|
||||||
ED3(uint8_t spare:4;,
|
ED3(uint8_t spare:4;,
|
||||||
uint8_t odd_even:1;,
|
uint8_t odd_even:1;,
|
||||||
uint8_t type:3;)
|
uint8_t type:3;)
|
||||||
nas_plmn_id_t plmn_id;
|
nas_plmn_id_t nas_plmn_id;
|
||||||
uint16_t mme_gid;
|
uint16_t mme_gid;
|
||||||
uint8_t mme_code;
|
uint8_t mme_code;
|
||||||
uint32_t m_tmsi;
|
uint32_t m_tmsi;
|
||||||
@@ -465,7 +467,7 @@ ED3(uint8_t spare:4;,
|
|||||||
typedef nas_mobile_identity_imsi_t nas_eps_mobile_identity_imsi_t;
|
typedef nas_mobile_identity_imsi_t nas_eps_mobile_identity_imsi_t;
|
||||||
typedef nas_eps_mobile_identity_imsi_t nas_eps_mobile_identity_imei_t;
|
typedef nas_eps_mobile_identity_imsi_t nas_eps_mobile_identity_imei_t;
|
||||||
|
|
||||||
typedef struct _nas_eps_mobile_identity_t {
|
typedef struct nas_eps_mobile_identity_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
union {
|
union {
|
||||||
nas_eps_mobile_identity_imsi_t imsi;
|
nas_eps_mobile_identity_imsi_t imsi;
|
||||||
@@ -476,7 +478,7 @@ typedef struct _nas_eps_mobile_identity_t {
|
|||||||
|
|
||||||
/* 9.9.3.12A EPS network feature support
|
/* 9.9.3.12A EPS network feature support
|
||||||
* O TLV 3 */
|
* O TLV 3 */
|
||||||
typedef struct _nas_eps_network_feature_support_t {
|
typedef struct nas_eps_network_feature_support_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED7(uint8_t cp_ciot:1;,
|
ED7(uint8_t cp_ciot:1;,
|
||||||
uint8_t erw_opdn:1;,
|
uint8_t erw_opdn:1;,
|
||||||
@@ -498,7 +500,7 @@ ED5(uint8_t spare:4;,
|
|||||||
#define NAS_EPS_UPDATE_RESULT_COMBINED_TA_LA_UPDATED 1
|
#define NAS_EPS_UPDATE_RESULT_COMBINED_TA_LA_UPDATED 1
|
||||||
#define NAS_EPS_UPDATE_RESULT_TA_UPDATED_AND_ISR_ACTIVATED 4
|
#define NAS_EPS_UPDATE_RESULT_TA_UPDATED_AND_ISR_ACTIVATED 4
|
||||||
#define NAS_EPS_UPDATE_RESULT_COMBINED_TA_LA_UPDATED_AND_ISR_ACTIVATED 5
|
#define NAS_EPS_UPDATE_RESULT_COMBINED_TA_LA_UPDATED_AND_ISR_ACTIVATED 5
|
||||||
typedef struct _nas_eps_update_result_t {
|
typedef struct nas_eps_update_result_s {
|
||||||
ED2(uint8_t spare:5;,
|
ED2(uint8_t spare:5;,
|
||||||
uint8_t result:3;)
|
uint8_t result:3;)
|
||||||
} __attribute__ ((packed)) nas_eps_update_result_t;
|
} __attribute__ ((packed)) nas_eps_update_result_t;
|
||||||
@@ -511,7 +513,7 @@ ED2(uint8_t spare:5;,
|
|||||||
#define NAS_EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING 1
|
#define NAS_EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING 1
|
||||||
#define NAS_EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING_WITH_IMSI_ATTACH 2
|
#define NAS_EPS_UPDATE_TYPE_COMBINED_TA_LA_UPDATING_WITH_IMSI_ATTACH 2
|
||||||
#define NAS_EPS_UPDATE_TYPE_PERIODIC_UPDATING 3
|
#define NAS_EPS_UPDATE_TYPE_PERIODIC_UPDATING 3
|
||||||
typedef struct _nas_eps_update_type_t {
|
typedef struct nas_eps_update_type_s {
|
||||||
ED4(uint8_t tsc:1;,
|
ED4(uint8_t tsc:1;,
|
||||||
uint8_t nas_key_set_identifier:3;,
|
uint8_t nas_key_set_identifier:3;,
|
||||||
uint8_t active_flag:1;,
|
uint8_t active_flag:1;,
|
||||||
@@ -520,7 +522,7 @@ ED4(uint8_t tsc:1;,
|
|||||||
|
|
||||||
/* 9.9.3.15 ESM message container
|
/* 9.9.3.15 ESM message container
|
||||||
* M LV-E 5-n */
|
* M LV-E 5-n */
|
||||||
typedef struct _nas_esm_message_container_t {
|
typedef struct nas_esm_message_container_s {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
} nas_esm_message_container_t;
|
} nas_esm_message_container_t;
|
||||||
@@ -532,7 +534,7 @@ typedef struct _nas_esm_message_container_t {
|
|||||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM 1
|
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_1_MM 1
|
||||||
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH 2
|
#define NAS_GRPS_TIMER_UNIT_MULTIPLES_OF_DECI_HH 2
|
||||||
#define NAS_GRPS_TIMER_UNIT_DEACTIVATED 7
|
#define NAS_GRPS_TIMER_UNIT_DEACTIVATED 7
|
||||||
typedef struct _nas_gprs_timer_t {
|
typedef struct nas_gprs_timer_s {
|
||||||
ED2(uint8_t unit:3;,
|
ED2(uint8_t unit:3;,
|
||||||
uint8_t value:5;)
|
uint8_t value:5;)
|
||||||
} __attribute__ ((packed)) nas_gprs_timer_t;
|
} __attribute__ ((packed)) nas_gprs_timer_t;
|
||||||
@@ -540,7 +542,7 @@ ED2(uint8_t unit:3;,
|
|||||||
/* 9.9.3.16A GPRS timer 2
|
/* 9.9.3.16A GPRS timer 2
|
||||||
* See subclause 10.5.7.4 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.7.4 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 3 */
|
* O TLV 3 */
|
||||||
typedef struct _nas_gprs_timer_2_t {
|
typedef struct nas_gprs_timer_2_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t gprs_timer_2_value;
|
uint8_t gprs_timer_2_value;
|
||||||
} __attribute__ ((packed)) nas_gprs_timer_2_t;
|
} __attribute__ ((packed)) nas_gprs_timer_2_t;
|
||||||
@@ -557,7 +559,7 @@ typedef struct _nas_gprs_timer_2_t {
|
|||||||
#define NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_320_HH 6
|
#define NAS_GRPS_TIMER_3_UNIT_MULTIPLES_OF_320_HH 6
|
||||||
#define NAS_GRPS_TIMER_3_UNIT_DEACTIVATED 7
|
#define NAS_GRPS_TIMER_3_UNIT_DEACTIVATED 7
|
||||||
|
|
||||||
typedef struct _nas_gprs_timer_3_t {
|
typedef struct nas_gprs_timer_3_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED2(uint8_t unit:3;,
|
ED2(uint8_t unit:3;,
|
||||||
uint8_t timer_value:5;)
|
uint8_t timer_value:5;)
|
||||||
@@ -570,7 +572,7 @@ ED2(uint8_t unit:3;,
|
|||||||
#define NAS_IDENTITY_TYPE_2_IMEI 2
|
#define NAS_IDENTITY_TYPE_2_IMEI 2
|
||||||
#define NAS_IDENTITY_TYPE_2_IMEISV 3
|
#define NAS_IDENTITY_TYPE_2_IMEISV 3
|
||||||
#define NAS_IDENTITY_TYPE_2_TMSI 4
|
#define NAS_IDENTITY_TYPE_2_TMSI 4
|
||||||
typedef struct _nas_identity_type_2_t {
|
typedef struct nas_identity_type_2_s {
|
||||||
ED2(uint8_t spare:5;,
|
ED2(uint8_t spare:5;,
|
||||||
uint8_t type:3;)
|
uint8_t type:3;)
|
||||||
} __attribute__ ((packed)) nas_identity_type_2_t;
|
} __attribute__ ((packed)) nas_identity_type_2_t;
|
||||||
@@ -578,7 +580,7 @@ ED2(uint8_t spare:5;,
|
|||||||
/* 9.9.3.18 IMEISV request
|
/* 9.9.3.18 IMEISV request
|
||||||
* See subclause 10.5.5.10 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.5.10 in 3GPP TS 24.008 [13].
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_imeisv_request_t {
|
typedef struct nas_imeisv_request_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:1;,
|
uint8_t spare:1;,
|
||||||
uint8_t imeisv_request_value:3;)
|
uint8_t imeisv_request_value:3;)
|
||||||
@@ -586,7 +588,7 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.3.19 KSI and sequence number
|
/* 9.9.3.19 KSI and sequence number
|
||||||
* M V 1 */
|
* M V 1 */
|
||||||
typedef struct _nas_ksi_and_sequence_number_t {
|
typedef struct nas_ksi_and_sequence_number_s {
|
||||||
ED2(uint8_t ksi:3;,
|
ED2(uint8_t ksi:3;,
|
||||||
uint8_t sequence_number:5;)
|
uint8_t sequence_number:5;)
|
||||||
} __attribute__ ((packed)) nas_ksi_and_sequence_number_t;
|
} __attribute__ ((packed)) nas_ksi_and_sequence_number_t;
|
||||||
@@ -600,7 +602,7 @@ ED2(uint8_t ksi:3;,
|
|||||||
#define NAS_MS_NETWORK_CAPABILITY_GEA5 0b00001000
|
#define NAS_MS_NETWORK_CAPABILITY_GEA5 0b00001000
|
||||||
#define NAS_MS_NETWORK_CAPABILITY_GEA6 0b00000100
|
#define NAS_MS_NETWORK_CAPABILITY_GEA6 0b00000100
|
||||||
#define NAS_MS_NETWORK_CAPABILITY_GEA7 0b00000010
|
#define NAS_MS_NETWORK_CAPABILITY_GEA7 0b00000010
|
||||||
typedef struct _nas_ms_network_capability_t {
|
typedef struct nas_ms_network_capability_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED7(uint8_t gea1:1;,
|
ED7(uint8_t gea1:1;,
|
||||||
uint8_t sm_capabilities_via_dedicated_channels:1;,
|
uint8_t sm_capabilities_via_dedicated_channels:1;,
|
||||||
@@ -631,7 +633,7 @@ ED6(uint8_t user_plane_integrity_protection_support:1;,
|
|||||||
/* 9.9.3.20A MS network feature support
|
/* 9.9.3.20A MS network feature support
|
||||||
* See subclause 10.5.1.15 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.1.15 in 3GPP TS 24.008 [13].
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_ms_network_feature_support_t {
|
typedef struct nas_ms_network_feature_support_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t extended_periodic_timers:1;)
|
uint8_t extended_periodic_timers:1;)
|
||||||
@@ -641,7 +643,7 @@ ED3(uint8_t type:4;,
|
|||||||
* M V 1/2
|
* M V 1/2
|
||||||
* 9.9.2.9 Spare half octet
|
* 9.9.2.9 Spare half octet
|
||||||
* M V 1/2 */
|
* M V 1/2 */
|
||||||
typedef struct _nas_key_set_identifier_t {
|
typedef struct nas_key_set_identifier_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t tsc:1;,
|
uint8_t tsc:1;,
|
||||||
uint8_t nas_key_set_identifier:3;)
|
uint8_t nas_key_set_identifier:3;)
|
||||||
@@ -650,7 +652,7 @@ ED3(uint8_t type:4;,
|
|||||||
/* 9.9.3.22 message container
|
/* 9.9.3.22 message container
|
||||||
* M LV 3-252 */
|
* M LV 3-252 */
|
||||||
#define NAS_MAX_MESSAGE_CONTAINER_LEN 250
|
#define NAS_MAX_MESSAGE_CONTAINER_LEN 250
|
||||||
typedef struct _nas_message_container_t {
|
typedef struct nas_message_container_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_MAX_MESSAGE_CONTAINER_LEN];
|
uint8_t buffer[NAS_MAX_MESSAGE_CONTAINER_LEN];
|
||||||
} __attribute__ ((packed)) nas_message_container_t;
|
} __attribute__ ((packed)) nas_message_container_t;
|
||||||
@@ -665,7 +667,7 @@ typedef struct _nas_message_container_t {
|
|||||||
#define NAS_SECURITY_ALGORITHMS_128_EEA1 1
|
#define NAS_SECURITY_ALGORITHMS_128_EEA1 1
|
||||||
#define NAS_SECURITY_ALGORITHMS_128_EEA2 2
|
#define NAS_SECURITY_ALGORITHMS_128_EEA2 2
|
||||||
#define NAS_SECURITY_ALGORITHMS_128_EEA3 3
|
#define NAS_SECURITY_ALGORITHMS_128_EEA3 3
|
||||||
typedef struct _nas_security_algorithms_t {
|
typedef struct nas_security_algorithms_s {
|
||||||
ED4(uint8_t spare1:1;,
|
ED4(uint8_t spare1:1;,
|
||||||
uint8_t type_of_ciphering_algorithm:3;,
|
uint8_t type_of_ciphering_algorithm:3;,
|
||||||
uint8_t spare2:1;,
|
uint8_t spare2:1;,
|
||||||
@@ -676,7 +678,7 @@ ED4(uint8_t spare1:1;,
|
|||||||
* See subclause 10.5.3.5a in 3GPP TS 24.008 [13].
|
* See subclause 10.5.3.5a in 3GPP TS 24.008 [13].
|
||||||
* O TLV 3-n */
|
* O TLV 3-n */
|
||||||
#define NAS_MAX_NETWORK_NAME_LEN 255
|
#define NAS_MAX_NETWORK_NAME_LEN 255
|
||||||
typedef struct _nas_network_name_t {
|
typedef struct nas_network_name_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED4(uint8_t ext:1;,
|
ED4(uint8_t ext:1;,
|
||||||
uint8_t coding_scheme:3;,
|
uint8_t coding_scheme:3;,
|
||||||
@@ -688,7 +690,7 @@ ED4(uint8_t ext:1;,
|
|||||||
/* 9.9.3.24A Network resource identifier container
|
/* 9.9.3.24A Network resource identifier container
|
||||||
* See subclause 10.5.5.31 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.5.31 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 4 */
|
* O TLV 4 */
|
||||||
typedef struct _nas_network_resource_identifier_container_t {
|
typedef struct nas_network_resource_identifier_container_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t nri_container_value1;
|
uint8_t nri_container_value1;
|
||||||
ED2(uint8_t nri_container_value2:2;,
|
ED2(uint8_t nri_container_value2:2;,
|
||||||
@@ -703,7 +705,7 @@ typedef uint32_t nas_nonce_t;
|
|||||||
* M V 1 */
|
* M V 1 */
|
||||||
#define NAS_PAGING_IDENTITY_IMSI 0
|
#define NAS_PAGING_IDENTITY_IMSI 0
|
||||||
#define NAS_PAGING_IDENTITY_TMSI 1
|
#define NAS_PAGING_IDENTITY_TMSI 1
|
||||||
typedef struct _nas_paging_identity_t {
|
typedef struct nas_paging_identity_s {
|
||||||
ED2(uint8_t spare:7;,
|
ED2(uint8_t spare:7;,
|
||||||
uint8_t identity:1;)
|
uint8_t identity:1;)
|
||||||
} nas_paging_identity_t;
|
} nas_paging_identity_t;
|
||||||
@@ -715,7 +717,7 @@ typedef uint32_t nas_p_tmsi_signature_t; /* TV : 4bytes */
|
|||||||
|
|
||||||
/* 9.9.3.26A Extended EMM cause
|
/* 9.9.3.26A Extended EMM cause
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_extended_emm_cause_t {
|
typedef struct nas_extended_emm_cause_s {
|
||||||
ED4(uint8_t type:4;,
|
ED4(uint8_t type:4;,
|
||||||
uint8_t spare:2;,
|
uint8_t spare:2;,
|
||||||
uint8_t eps_optimization_info:1;,
|
uint8_t eps_optimization_info:1;,
|
||||||
@@ -729,7 +731,7 @@ ED4(uint8_t type:4;,
|
|||||||
#define NAS_SERVICE_TYPE_CS_FALLBACK_OR_1XCS_FALLBACK_FROM_UE 0
|
#define NAS_SERVICE_TYPE_CS_FALLBACK_OR_1XCS_FALLBACK_FROM_UE 0
|
||||||
#define NAS_SERVICE_TYPE_CS_FALLBACK_OR_1XCS_FALLBACK_TO_UE 1
|
#define NAS_SERVICE_TYPE_CS_FALLBACK_OR_1XCS_FALLBACK_TO_UE 1
|
||||||
#define NAS_SERVICE_TYPE_CS_FALLBACK_EMERGENCY_CALL_OR_1XCS_FALLBACK_EMERGENCY_CALL_FROM_UE 2
|
#define NAS_SERVICE_TYPE_CS_FALLBACK_EMERGENCY_CALL_OR_1XCS_FALLBACK_EMERGENCY_CALL_FROM_UE 2
|
||||||
typedef struct _nas_service_type_t {
|
typedef struct nas_service_type_s {
|
||||||
ED3(uint8_t tsc:1;,
|
ED3(uint8_t tsc:1;,
|
||||||
uint8_t nas_key_set_identifier:3;,
|
uint8_t nas_key_set_identifier:3;,
|
||||||
uint8_t service_type:4;)
|
uint8_t service_type:4;)
|
||||||
@@ -749,7 +751,7 @@ typedef uint8_t nas_time_zone_t;
|
|||||||
* 9.2.3.11 TPServiceCentreTimeStamp (TPSCTS) in 3GPP TS 23.040 [90]
|
* 9.2.3.11 TPServiceCentreTimeStamp (TPSCTS) in 3GPP TS 23.040 [90]
|
||||||
* O TV 8 */
|
* O TV 8 */
|
||||||
#define NAS_TIME_TO_BCD(x) TIME_TO_BCD(x)
|
#define NAS_TIME_TO_BCD(x) TIME_TO_BCD(x)
|
||||||
typedef struct _nas_time_zone_and_time_t {
|
typedef struct nas_time_zone_and_time_s {
|
||||||
uint8_t year;
|
uint8_t year;
|
||||||
uint8_t mon;
|
uint8_t mon;
|
||||||
uint8_t mday;
|
uint8_t mday;
|
||||||
@@ -767,7 +769,7 @@ typedef struct _nas_time_zone_and_time_t {
|
|||||||
/* 9.9.3.31 TMSI status
|
/* 9.9.3.31 TMSI status
|
||||||
* See subclause 10.5.5.4 in 3GPP TS 24.008 [13]
|
* See subclause 10.5.5.4 in 3GPP TS 24.008 [13]
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_tmsi_status_t {
|
typedef struct nas_tmsi_status_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t tmsi_flag:1;)
|
uint8_t tmsi_flag:1;)
|
||||||
@@ -775,18 +777,20 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.3.32 Tracking area identity
|
/* 9.9.3.32 Tracking area identity
|
||||||
* O TV 6 */
|
* O TV 6 */
|
||||||
typedef struct _nas_tracking_area_identity_t {
|
typedef struct nas_tracking_area_identity_s {
|
||||||
nas_plmn_id_t plmn_id;
|
nas_plmn_id_t nas_plmn_id;
|
||||||
uint16_t tac;
|
uint16_t tac;
|
||||||
} __attribute__ ((packed)) nas_tracking_area_identity_t;
|
} __attribute__ ((packed)) nas_tracking_area_identity_t;
|
||||||
|
|
||||||
|
typedef nas_tracking_area_identity_t nas_tai_t;
|
||||||
|
|
||||||
/* 9.9.3.33 Tracking area identity list
|
/* 9.9.3.33 Tracking area identity list
|
||||||
* M LV 7-97 */
|
* M LV 7-97 */
|
||||||
#define NAS_MAX_TAI_LIST_LEN 96
|
#define NAS_MAX_TAI_LIST_LEN 96
|
||||||
#define TAI0_TYPE 0
|
#define TAI0_TYPE 0
|
||||||
#define TAI1_TYPE 1
|
#define TAI1_TYPE 1
|
||||||
#define TAI2_TYPE 2
|
#define TAI2_TYPE 2
|
||||||
typedef struct _tai0_list_t {
|
typedef struct tai0_list_s {
|
||||||
struct {
|
struct {
|
||||||
ED3(uint8_t spare:1;,
|
ED3(uint8_t spare:1;,
|
||||||
uint8_t type:2;,
|
uint8_t type:2;,
|
||||||
@@ -802,7 +806,7 @@ typedef struct _tai0_list_t {
|
|||||||
} __attribute__ ((packed)) tai[MAX_NUM_OF_TAI];
|
} __attribute__ ((packed)) tai[MAX_NUM_OF_TAI];
|
||||||
} __attribute__ ((packed)) tai0_list_t;
|
} __attribute__ ((packed)) tai0_list_t;
|
||||||
|
|
||||||
typedef struct _tai2_list_t {
|
typedef struct tai2_list_s {
|
||||||
ED3(uint8_t spare:1;,
|
ED3(uint8_t spare:1;,
|
||||||
uint8_t type:2;,
|
uint8_t type:2;,
|
||||||
uint8_t num:5;)
|
uint8_t num:5;)
|
||||||
@@ -815,7 +819,7 @@ ED3(uint8_t spare:1;,
|
|||||||
tai_t tai[MAX_NUM_OF_TAI];
|
tai_t tai[MAX_NUM_OF_TAI];
|
||||||
} __attribute__ ((packed)) tai2_list_t;
|
} __attribute__ ((packed)) tai2_list_t;
|
||||||
|
|
||||||
typedef struct _nas_tracking_area_identity_list_t {
|
typedef struct nas_tracking_area_identity_list_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_MAX_TAI_LIST_LEN];
|
uint8_t buffer[NAS_MAX_TAI_LIST_LEN];
|
||||||
} __attribute__ ((packed)) nas_tracking_area_identity_list_t;
|
} __attribute__ ((packed)) nas_tracking_area_identity_list_t;
|
||||||
@@ -826,7 +830,7 @@ void nas_tai_list_build(
|
|||||||
|
|
||||||
/* 9.9.3.34 UE network capability
|
/* 9.9.3.34 UE network capability
|
||||||
* M LV 3-14 */
|
* M LV 3-14 */
|
||||||
typedef struct _nas_ue_network_capability_t {
|
typedef struct nas_ue_network_capability_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
@@ -902,7 +906,7 @@ ED2(uint8_t spare:7;,
|
|||||||
|
|
||||||
/* 9.9.3.35 UE radio capability information update needed
|
/* 9.9.3.35 UE radio capability information update needed
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_ue_radio_capability_information_update_needed_t {
|
typedef struct nas_ue_radio_capability_information_update_needed_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t update_needed:1;)
|
uint8_t update_needed:1;)
|
||||||
@@ -910,7 +914,7 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.3.36 UE security capability
|
/* 9.9.3.36 UE security capability
|
||||||
* M LV 3-6 */
|
* M LV 3-6 */
|
||||||
typedef struct _nas_ue_security_capability_t {
|
typedef struct nas_ue_security_capability_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
union {
|
union {
|
||||||
struct {
|
struct {
|
||||||
@@ -983,7 +987,7 @@ typedef struct _nas_ue_security_capability_t {
|
|||||||
* See subclause 10.5.3.13 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.3.13 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 5-50 */
|
* O TLV 5-50 */
|
||||||
#define NAS_MAX_EMERGENCY_NUMBER_LIST_LEN 48
|
#define NAS_MAX_EMERGENCY_NUMBER_LIST_LEN 48
|
||||||
typedef struct _nas_emergency_number_list_t {
|
typedef struct nas_emergency_number_list_s {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t buffer[NAS_MAX_EMERGENCY_NUMBER_LIST_LEN];
|
uint8_t buffer[NAS_MAX_EMERGENCY_NUMBER_LIST_LEN];
|
||||||
} __attribute__ ((packed)) nas_emergency_number_list_t;
|
} __attribute__ ((packed)) nas_emergency_number_list_t;
|
||||||
@@ -994,7 +998,7 @@ typedef struct _nas_emergency_number_list_t {
|
|||||||
* octets 3 to 14 of the Calling party BCD number information element
|
* octets 3 to 14 of the Calling party BCD number information element
|
||||||
* defined in subclause 10.5.4.9 of 3GPP TS 24.008 [13]. */
|
* defined in subclause 10.5.4.9 of 3GPP TS 24.008 [13]. */
|
||||||
#define NAX_MAX_CLI_LEN 12
|
#define NAX_MAX_CLI_LEN 12
|
||||||
typedef struct _nas_cli_t {
|
typedef struct nas_cli_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAX_MAX_CLI_LEN];
|
uint8_t buffer[NAX_MAX_CLI_LEN];
|
||||||
} __attribute__ ((packed)) nas_cli_t;
|
} __attribute__ ((packed)) nas_cli_t;
|
||||||
@@ -1013,7 +1017,7 @@ typedef uint8_t nas_lcs_indicator_t;
|
|||||||
/* 9.9.3.41 LCS client identity
|
/* 9.9.3.41 LCS client identity
|
||||||
* O TLV 3-257 */
|
* O TLV 3-257 */
|
||||||
#define NAS_MAX_LCS_CLIENT_IDENTITY_LEN 255
|
#define NAS_MAX_LCS_CLIENT_IDENTITY_LEN 255
|
||||||
typedef struct _nas_lcs_client_identity_t {
|
typedef struct nas_lcs_client_identity_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_MAX_LCS_CLIENT_IDENTITY_LEN];
|
uint8_t buffer[NAS_MAX_LCS_CLIENT_IDENTITY_LEN];
|
||||||
} __attribute__ ((packed)) nas_lcs_client_identity_t;
|
} __attribute__ ((packed)) nas_lcs_client_identity_t;
|
||||||
@@ -1026,7 +1030,7 @@ typedef uint8_t nas_generic_message_container_type_t;
|
|||||||
|
|
||||||
/* 9.9.3.43 Generic message container
|
/* 9.9.3.43 Generic message container
|
||||||
* M LV-E 3-n */
|
* M LV-E 3-n */
|
||||||
typedef struct _nas_generic_message_container_t {
|
typedef struct nas_generic_message_container_s {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
} nas_generic_message_container_t;
|
} nas_generic_message_container_t;
|
||||||
@@ -1034,7 +1038,7 @@ typedef struct _nas_generic_message_container_t {
|
|||||||
/* 9.9.3.44 Voice domain preference and UE's usage setting
|
/* 9.9.3.44 Voice domain preference and UE's usage setting
|
||||||
* See subclause 10.5.5.28 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.5.28 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 3 */
|
* O TLV 3 */
|
||||||
typedef struct _nas_voice_domain_preference_and_ue_usage_setting_t {
|
typedef struct nas_voice_domain_preference_and_ue_usage_setting_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED3(uint8_t spare:5;,
|
ED3(uint8_t spare:5;,
|
||||||
uint8_t ue_usage_setting:1;,
|
uint8_t ue_usage_setting:1;,
|
||||||
@@ -1043,7 +1047,7 @@ ED3(uint8_t spare:5;,
|
|||||||
|
|
||||||
/* 9.9.3.45 GUTI type
|
/* 9.9.3.45 GUTI type
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_guti_type_t {
|
typedef struct nas_guti_type_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t guti_type:1;)
|
uint8_t guti_type:1;)
|
||||||
@@ -1052,7 +1056,7 @@ ED3(uint8_t type:4;,
|
|||||||
/* 9.9.3.46 Extended DRX parameters
|
/* 9.9.3.46 Extended DRX parameters
|
||||||
* See subclause 10.5.5.32 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.5.32 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 3 */
|
* O TLV 3 */
|
||||||
typedef struct _nas_extended_drx_parameters_t {
|
typedef struct nas_extended_drx_parameters_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED2(uint8_t paging_time_window:4;,
|
ED2(uint8_t paging_time_window:4;,
|
||||||
uint8_t e_drx_value:4;)
|
uint8_t e_drx_value:4;)
|
||||||
@@ -1061,14 +1065,14 @@ ED2(uint8_t paging_time_window:4;,
|
|||||||
/* 9.9.4.1 Access point name
|
/* 9.9.4.1 Access point name
|
||||||
* See subclause 10.5.6.1 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.6.1 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 3-102 */
|
* O TLV 3-102 */
|
||||||
typedef struct _nas_access_point_name_t {
|
typedef struct nas_access_point_name_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
char apn[MAX_APN_LEN];
|
char apn[MAX_APN_LEN];
|
||||||
} __attribute__ ((packed)) nas_access_point_name_t;
|
} __attribute__ ((packed)) nas_access_point_name_t;
|
||||||
|
|
||||||
/* 9.9.4.2 APN aggregate maximum bit rate
|
/* 9.9.4.2 APN aggregate maximum bit rate
|
||||||
* O TLV 4-8 */
|
* O TLV 4-8 */
|
||||||
typedef struct _nas_apn_aggregate_maximum_bit_rate_t {
|
typedef struct nas_apn_aggregate_maximum_bit_rate_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t dl_apn_ambr;
|
uint8_t dl_apn_ambr;
|
||||||
uint8_t ul_apn_ambr;
|
uint8_t ul_apn_ambr;
|
||||||
@@ -1085,7 +1089,7 @@ void apn_ambr_build(
|
|||||||
/* 9.9.4.2A Connectivity type
|
/* 9.9.4.2A Connectivity type
|
||||||
* See subclause 10.5.6.19 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.6.19 in 3GPP TS 24.008 [13].
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_connectivity_type_t {
|
typedef struct nas_connectivity_type_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t considered_lipa_pdn_connection:1;)
|
uint8_t considered_lipa_pdn_connection:1;)
|
||||||
@@ -1093,7 +1097,7 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.4.3 EPS quality of service
|
/* 9.9.4.3 EPS quality of service
|
||||||
* M LV 2-14 */
|
* M LV 2-14 */
|
||||||
typedef struct _nas_eps_quality_of_service_t {
|
typedef struct nas_eps_quality_of_service_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t qci;
|
uint8_t qci;
|
||||||
uint8_t ul_mbr;
|
uint8_t ul_mbr;
|
||||||
@@ -1169,7 +1173,7 @@ typedef uint8_t nas_esm_cause_t;
|
|||||||
|
|
||||||
/* 9.9.4.5 ESM information transfer flag
|
/* 9.9.4.5 ESM information transfer flag
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_esm_information_transfer_flag_t {
|
typedef struct nas_esm_information_transfer_flag_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t security_protected_required:1;)
|
uint8_t security_protected_required:1;)
|
||||||
@@ -1177,7 +1181,7 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.4.6 Linked EPS bearer identity
|
/* 9.9.4.6 Linked EPS bearer identity
|
||||||
* M V 1/2 */
|
* M V 1/2 */
|
||||||
typedef struct _nas_linked_eps_bearer_identity_t {
|
typedef struct nas_linked_eps_bearer_identity_s {
|
||||||
ED2(uint8_t spare:4;,
|
ED2(uint8_t spare:4;,
|
||||||
uint8_t eps_bearer_identity:4;)
|
uint8_t eps_bearer_identity:4;)
|
||||||
} __attribute__ ((packed)) nas_linked_eps_bearer_identity_t;
|
} __attribute__ ((packed)) nas_linked_eps_bearer_identity_t;
|
||||||
@@ -1196,7 +1200,7 @@ typedef uint8_t nas_llc_service_access_point_identifier_t;
|
|||||||
#define NAS_PACKET_FLOW_IDENTIFIER_TOM8 3
|
#define NAS_PACKET_FLOW_IDENTIFIER_TOM8 3
|
||||||
#define NAS_PACKET_FLOW_IDENTIFIER_DYNAMIC_ASSIGN_MIN 8
|
#define NAS_PACKET_FLOW_IDENTIFIER_DYNAMIC_ASSIGN_MIN 8
|
||||||
#define NAS_PACKET_FLOW_IDENTIFIER_DYNAMIC_ASSIGN_MAX 0xef
|
#define NAS_PACKET_FLOW_IDENTIFIER_DYNAMIC_ASSIGN_MAX 0xef
|
||||||
typedef struct _nas_packet_flow_identifier_t {
|
typedef struct nas_packet_flow_identifier_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED2(uint8_t spare:1;,
|
ED2(uint8_t spare:1;,
|
||||||
uint8_t value:7;)
|
uint8_t value:7;)
|
||||||
@@ -1205,7 +1209,7 @@ ED2(uint8_t spare:1;,
|
|||||||
/* 9.9.4.13 Radio priority
|
/* 9.9.4.13 Radio priority
|
||||||
* See subclause 10.5.7.2 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.7.2 in 3GPP TS 24.008 [13].
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_radio_priority_t {
|
typedef struct nas_radio_priority_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:1;,
|
uint8_t spare:1;,
|
||||||
uint8_t value:3;)
|
uint8_t value:3;)
|
||||||
@@ -1216,7 +1220,7 @@ ED3(uint8_t type:4;,
|
|||||||
#define NAS_PDN_ADDRESS_IPV4_LEN 5
|
#define NAS_PDN_ADDRESS_IPV4_LEN 5
|
||||||
#define NAS_PDN_ADDRESS_IPV6_LEN 9
|
#define NAS_PDN_ADDRESS_IPV6_LEN 9
|
||||||
#define NAS_PDN_ADDRESS_IPV4V6_LEN 13
|
#define NAS_PDN_ADDRESS_IPV4V6_LEN 13
|
||||||
typedef struct _nas_pdn_address_t {
|
typedef struct nas_pdn_address_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED2(uint8_t reserved:5;,
|
ED2(uint8_t reserved:5;,
|
||||||
uint8_t pdn_type:3;)
|
uint8_t pdn_type:3;)
|
||||||
@@ -1235,7 +1239,7 @@ ED2(uint8_t reserved:5;,
|
|||||||
/* 9.9.4.11 Protocol configuration options
|
/* 9.9.4.11 Protocol configuration options
|
||||||
* See subclause 10.5.6.3 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.6.3 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 3-253 */
|
* O TLV 3-253 */
|
||||||
typedef struct _nas_protocol_configuration_options_t {
|
typedef struct nas_protocol_configuration_options_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[MAX_PCO_LEN];
|
uint8_t buffer[MAX_PCO_LEN];
|
||||||
} __attribute__ ((packed)) nas_protocol_configuration_options_t;
|
} __attribute__ ((packed)) nas_protocol_configuration_options_t;
|
||||||
@@ -1244,14 +1248,14 @@ typedef struct _nas_protocol_configuration_options_t {
|
|||||||
* See subclause 10.5.6.5 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.6.5 in 3GPP TS 24.008 [13].
|
||||||
* O TLV 14-22 */
|
* O TLV 14-22 */
|
||||||
#define NAS_QOS_LEN 20
|
#define NAS_QOS_LEN 20
|
||||||
typedef struct _nas_quality_of_service_t {
|
typedef struct nas_quality_of_service_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_QOS_LEN];
|
uint8_t buffer[NAS_QOS_LEN];
|
||||||
} __attribute__ ((packed)) nas_quality_of_service_t;
|
} __attribute__ ((packed)) nas_quality_of_service_t;
|
||||||
|
|
||||||
/* 9.9.4.13A Re-attempt indicator
|
/* 9.9.4.13A Re-attempt indicator
|
||||||
* O TLV 3 */
|
* O TLV 3 */
|
||||||
typedef struct _nas_re_attempt_indicator_t {
|
typedef struct nas_re_attempt_indicator_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED3(uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */
|
ED3(uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */
|
||||||
uint8_t eplmnc:1;, /* allowed in an equivalent PLMN */
|
uint8_t eplmnc:1;, /* allowed in an equivalent PLMN */
|
||||||
@@ -1270,7 +1274,7 @@ ED3(uint8_t spare:3;, /* allowed in A/Gb mode or Iu mode */
|
|||||||
#define NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV6 2
|
#define NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV6 2
|
||||||
#define NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV4V6 3
|
#define NAS_PDN_CONNECTIVITY_PDN_TYPE_IPV4V6 3
|
||||||
#define NAS_PDN_CONNECTIVITY_PDN_TYPE_NON_IP 5
|
#define NAS_PDN_CONNECTIVITY_PDN_TYPE_NON_IP 5
|
||||||
typedef struct _nas_request_type_t {
|
typedef struct nas_request_type_s {
|
||||||
ED4(uint8_t spare1:1;,
|
ED4(uint8_t spare1:1;,
|
||||||
uint8_t pdn_type:3;,
|
uint8_t pdn_type:3;,
|
||||||
uint8_t spare2:1;,
|
uint8_t spare2:1;,
|
||||||
@@ -1281,7 +1285,7 @@ ED4(uint8_t spare1:1;,
|
|||||||
* see subclause 10.5.6.12 in 3GPP TS 24.008 [13]
|
* see subclause 10.5.6.12 in 3GPP TS 24.008 [13]
|
||||||
* M LV 2-256 */
|
* M LV 2-256 */
|
||||||
#define NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION 255
|
#define NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION 255
|
||||||
typedef struct _nas_traffic_flow_aggregate_description_t {
|
typedef struct nas_traffic_flow_aggregate_description_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION];
|
uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_AGGREGATE_DESCRIPTION];
|
||||||
} __attribute__ ((packed)) nas_traffic_flow_aggregate_description_t;
|
} __attribute__ ((packed)) nas_traffic_flow_aggregate_description_t;
|
||||||
@@ -1290,7 +1294,7 @@ typedef struct _nas_traffic_flow_aggregate_description_t {
|
|||||||
* See subclause 10.5.6.12 in 3GPP TS 24.008 [13].
|
* See subclause 10.5.6.12 in 3GPP TS 24.008 [13].
|
||||||
* M LV 2-256 */
|
* M LV 2-256 */
|
||||||
#define NAS_MAX_TRAFFIC_FLOW_TEMPLATE 255
|
#define NAS_MAX_TRAFFIC_FLOW_TEMPLATE 255
|
||||||
typedef struct _nas_traffic_flow_template_t {
|
typedef struct nas_traffic_flow_template_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_TEMPLATE];
|
uint8_t buffer[NAS_MAX_TRAFFIC_FLOW_TEMPLATE];
|
||||||
} __attribute__ ((packed)) nas_traffic_flow_template_t;
|
} __attribute__ ((packed)) nas_traffic_flow_template_t;
|
||||||
@@ -1298,7 +1302,7 @@ typedef struct _nas_traffic_flow_template_t {
|
|||||||
/* 9.9.4.17 Transaction identifier
|
/* 9.9.4.17 Transaction identifier
|
||||||
* 3GPP TS 24.008 [13], subclause 10.5.6.7.
|
* 3GPP TS 24.008 [13], subclause 10.5.6.7.
|
||||||
* O TLV 3-4 */
|
* O TLV 3-4 */
|
||||||
typedef struct _nas_transaction_identifier_t {
|
typedef struct nas_transaction_identifier_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint16_t linked_ti;
|
uint16_t linked_ti;
|
||||||
} __attribute__ ((packed)) nas_transaction_identifier_t;
|
} __attribute__ ((packed)) nas_transaction_identifier_t;
|
||||||
@@ -1306,7 +1310,7 @@ typedef struct _nas_transaction_identifier_t {
|
|||||||
/* 9.9.4.18 WLAN offload acceptability
|
/* 9.9.4.18 WLAN offload acceptability
|
||||||
* 3GPP TS 24.008 [13], subclause 10.5.6.20
|
* 3GPP TS 24.008 [13], subclause 10.5.6.20
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_wlan_offload_acceptability_t {
|
typedef struct nas_wlan_offload_acceptability_s {
|
||||||
ED4(uint8_t type:4;,
|
ED4(uint8_t type:4;,
|
||||||
uint8_t spare:2;,
|
uint8_t spare:2;,
|
||||||
uint8_t utran_via_wlan_acceptable:1;,
|
uint8_t utran_via_wlan_acceptable:1;,
|
||||||
@@ -1317,7 +1321,7 @@ ED4(uint8_t type:4;,
|
|||||||
* See subclause 10.5.6.21 in 3GPP TS 24.008 [4].
|
* See subclause 10.5.6.21 in 3GPP TS 24.008 [4].
|
||||||
* O TLV 3-257 */
|
* O TLV 3-257 */
|
||||||
#define MAX_NAS_NBIFOM_CONTAINER_LEN 255
|
#define MAX_NAS_NBIFOM_CONTAINER_LEN 255
|
||||||
typedef struct _nas_nbifom_container_t {
|
typedef struct nas_nbifom_container_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint8_t buffer[MAX_NAS_NBIFOM_CONTAINER_LEN];
|
uint8_t buffer[MAX_NAS_NBIFOM_CONTAINER_LEN];
|
||||||
} __attribute__ ((packed)) nas_nbifom_container_t;
|
} __attribute__ ((packed)) nas_nbifom_container_t;
|
||||||
@@ -1325,7 +1329,7 @@ typedef struct _nas_nbifom_container_t {
|
|||||||
/* 9.9.4.22 Header compression configuration
|
/* 9.9.4.22 Header compression configuration
|
||||||
* O TLV 5-257 */
|
* O TLV 5-257 */
|
||||||
#define MAX_NAS_HEADER_COMPRESSION_CONTAINER_LEN 251
|
#define MAX_NAS_HEADER_COMPRESSION_CONTAINER_LEN 251
|
||||||
typedef struct _nas_header_compression_configuration_t {
|
typedef struct nas_header_compression_configuration_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED8(uint8_t spare:1;,
|
ED8(uint8_t spare:1;,
|
||||||
uint8_t profile0x0104:1;,
|
uint8_t profile0x0104:1;,
|
||||||
@@ -1350,7 +1354,7 @@ ED8(uint8_t spare:1;,
|
|||||||
|
|
||||||
/* 9.9.4.23 Control plane only indication
|
/* 9.9.4.23 Control plane only indication
|
||||||
* O TV 1 */
|
* O TV 1 */
|
||||||
typedef struct _nas_control_plane_only_indication_t {
|
typedef struct nas_control_plane_only_indication_s {
|
||||||
ED3(uint8_t type:4;,
|
ED3(uint8_t type:4;,
|
||||||
uint8_t spare:3;,
|
uint8_t spare:3;,
|
||||||
uint8_t ciot_eps_optimization:1;)
|
uint8_t ciot_eps_optimization:1;)
|
||||||
@@ -1358,21 +1362,21 @@ ED3(uint8_t type:4;,
|
|||||||
|
|
||||||
/* 9.9.4.26 Extended protocol configuration options
|
/* 9.9.4.26 Extended protocol configuration options
|
||||||
* O TLV-E 4-65538 */
|
* O TLV-E 4-65538 */
|
||||||
typedef struct _nas_extended_protocol_configuration_options_t {
|
typedef struct nas_extended_protocol_configuration_options_s {
|
||||||
uint16_t length;
|
uint16_t length;
|
||||||
uint8_t *buffer;
|
uint8_t *buffer;
|
||||||
} __attribute__ ((packed)) nas_extended_protocol_configuration_options_t;
|
} __attribute__ ((packed)) nas_extended_protocol_configuration_options_t;
|
||||||
|
|
||||||
/* 9.9.4.27 Header compression configuration status
|
/* 9.9.4.27 Header compression configuration status
|
||||||
* O TLV 4 */
|
* O TLV 4 */
|
||||||
typedef struct _nas_header_compression_configuration_status_t {
|
typedef struct nas_header_compression_configuration_status_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
uint16_t value;
|
uint16_t value;
|
||||||
} __attribute__ ((packed)) nas_header_compression_configuration_status_t;
|
} __attribute__ ((packed)) nas_header_compression_configuration_status_t;
|
||||||
|
|
||||||
/* 9.9.4.28 Serving PLMN rate control
|
/* 9.9.4.28 Serving PLMN rate control
|
||||||
* O TLV 4 */
|
* O TLV 4 */
|
||||||
typedef struct _nas_serving_plmn_rate_control_t {
|
typedef struct nas_serving_plmn_rate_control_s {
|
||||||
uint8_t length;
|
uint8_t length;
|
||||||
ED8(uint8_t ebi7:1;,
|
ED8(uint8_t ebi7:1;,
|
||||||
uint8_t ebi6:1;,
|
uint8_t ebi6:1;,
|
||||||
@@ -13,4 +13,4 @@ user@host ~/Documents/git/nextepc/lib/gtp/support$ \
|
|||||||
|
|
||||||
* Generate Message support files
|
* Generate Message support files
|
||||||
user@host ~/Documents/git/nextepc/lib/s1ap/support$ \
|
user@host ~/Documents/git/nextepc/lib/s1ap/support$ \
|
||||||
python nas_message.py -f 24301-d80.docx -o ..
|
python nas-message.py -f 24301-d80.docx -o ..
|
||||||
@@ -74,14 +74,14 @@ def output_header_to_file(f):
|
|||||||
|
|
||||||
""")
|
""")
|
||||||
f.write("/*******************************************************************************\n")
|
f.write("/*******************************************************************************\n")
|
||||||
f.write(" * This file had been created by nas_message.py script v%s\n" % (version))
|
f.write(" * This file had been created by nas-message.py script v%s\n" % (version))
|
||||||
f.write(" * Please do not modify this file but regenerate it via script.\n")
|
f.write(" * Please do not modify this file but regenerate it via script.\n")
|
||||||
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filename))
|
f.write(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filename))
|
||||||
f.write(" ******************************************************************************/\n\n")
|
f.write(" ******************************************************************************/\n\n")
|
||||||
|
|
||||||
def usage():
|
def usage():
|
||||||
print "Python generating NAS Message encoder/decoder v%s" % (version)
|
print "Python generating NAS Message encoder/decoder v%s" % (version)
|
||||||
print "Usage: python nas_message.py [options]"
|
print "Usage: python nas-message.py [options]"
|
||||||
print "Available options:"
|
print "Available options:"
|
||||||
print "-d Enable script debug"
|
print "-d Enable script debug"
|
||||||
print "-f [file] Input file to parse"
|
print "-f [file] Input file to parse"
|
||||||
@@ -320,7 +320,7 @@ for (k, v) in sorted_msg_list:
|
|||||||
type_list[key] = { "reference" : ie["reference"], "presence" : ie["presence"], "format" : ie["format"], "length" : ie["length"], "message" : k, "value" : ie["value"] }
|
type_list[key] = { "reference" : ie["reference"], "presence" : ie["presence"], "format" : ie["format"], "length" : ie["length"], "message" : k, "value" : ie["value"] }
|
||||||
|
|
||||||
d_info("[Type List]")
|
d_info("[Type List]")
|
||||||
typefile = currentdir + "type_list.py"
|
typefile = currentdir + "type-list.py"
|
||||||
if os.path.isfile(typefile) and os.access(typefile, os.R_OK):
|
if os.path.isfile(typefile) and os.access(typefile, os.R_OK):
|
||||||
execfile(typefile)
|
execfile(typefile)
|
||||||
print "Read from " + typefile
|
print "Read from " + typefile
|
||||||
@@ -328,16 +328,16 @@ if os.path.isfile(typefile) and os.access(typefile, os.R_OK):
|
|||||||
tmp = [(k, v["reference"]) for k, v in type_list.items()]
|
tmp = [(k, v["reference"]) for k, v in type_list.items()]
|
||||||
sorted_type_list = sorted(tmp, key=lambda tup: tup[1])
|
sorted_type_list = sorted(tmp, key=lambda tup: tup[1])
|
||||||
|
|
||||||
f = open(outdir + 'nas_ies.h', 'w')
|
f = open(outdir + 'nas-ies.h', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#ifndef __NAS_IES_H__
|
f.write("""#ifndef NAS_IES_H
|
||||||
#define __NAS_IES_H__
|
#define NAS_IES_H
|
||||||
|
|
||||||
#include "nas_types.h"
|
#include "nas-types.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
|
int nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
|
||||||
|
|
||||||
@@ -354,16 +354,16 @@ f.write("\n")
|
|||||||
|
|
||||||
f.write("""#ifdef __cplusplus
|
f.write("""#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __NAS_IES_H__ */
|
#endif /* NAS_IES_H */
|
||||||
|
|
||||||
""")
|
""")
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = open(outdir + 'nas_ies.c', 'w')
|
f = open(outdir + 'nas-ies.c', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#include "nas_ies.h"
|
f.write("""#include "nas-ies.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -491,16 +491,16 @@ for (k, v) in sorted_type_list:
|
|||||||
f.write("}\n\n");
|
f.write("}\n\n");
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = open(outdir + 'nas_message.h', 'w')
|
f = open(outdir + 'nas-message.h', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#ifndef __NAS_MESSAGE_H__
|
f.write("""#ifndef NAS_MESSAGE_H
|
||||||
#define __NAS_MESSAGE_H__
|
#define NAS_MESSAGE_H
|
||||||
|
|
||||||
#include "nas_ies.h"
|
#include "nas-ies.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
/* The Packet Buffer(ogs_pkbuf_t) for NAS message MUST make a HEADROOM.
|
||||||
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
* When calculating AES_CMAC, we need to use the headroom of the packet. */
|
||||||
@@ -520,20 +520,20 @@ extern "C" {
|
|||||||
#define NAS_EPS_BEARER_IDENTITY_UNASSIGNED 0
|
#define NAS_EPS_BEARER_IDENTITY_UNASSIGNED 0
|
||||||
#define NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0
|
#define NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0
|
||||||
|
|
||||||
typedef struct _nas_emm_header_t {
|
typedef struct nas_emm_header_s {
|
||||||
ED2(uint8_t security_header_type:4;,
|
ED2(uint8_t security_header_type:4;,
|
||||||
uint8_t protocol_discriminator:4;)
|
uint8_t protocol_discriminator:4;)
|
||||||
uint8_t message_type;
|
uint8_t message_type;
|
||||||
} __attribute__ ((packed)) nas_emm_header_t;
|
} __attribute__ ((packed)) nas_emm_header_t;
|
||||||
|
|
||||||
typedef struct _nas_esm_header_t {
|
typedef struct nas_esm_header_s {
|
||||||
ED2(uint8_t eps_bearer_identity:4;,
|
ED2(uint8_t eps_bearer_identity:4;,
|
||||||
uint8_t protocol_discriminator:4;)
|
uint8_t protocol_discriminator:4;)
|
||||||
uint8_t procedure_transaction_identity;
|
uint8_t procedure_transaction_identity;
|
||||||
uint8_t message_type;
|
uint8_t message_type;
|
||||||
} __attribute__ ((packed)) nas_esm_header_t;
|
} __attribute__ ((packed)) nas_esm_header_t;
|
||||||
|
|
||||||
typedef struct _nas_security_header_t {
|
typedef struct nas_security_header_s {
|
||||||
ED2(uint8_t security_header_type:4;,
|
ED2(uint8_t security_header_type:4;,
|
||||||
uint8_t protocol_discriminator:4;)
|
uint8_t protocol_discriminator:4;)
|
||||||
uint32_t message_authentication_code;
|
uint32_t message_authentication_code;
|
||||||
@@ -563,7 +563,7 @@ for (k, v) in sorted_msg_list:
|
|||||||
for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]):
|
for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]):
|
||||||
f.write("\n#define NAS_%s_%s_TYPE 0x%s" % (v_upper(k), v_upper(ie["value"]), re.sub('-', '0', ie["iei"])))
|
f.write("\n#define NAS_%s_%s_TYPE 0x%s" % (v_upper(k), v_upper(ie["value"]), re.sub('-', '0', ie["iei"])))
|
||||||
|
|
||||||
f.write("\n\ntypedef struct _nas_%s_t {\n" % v_lower(k))
|
f.write("\n\ntypedef struct nas_%s_s {\n" % v_lower(k))
|
||||||
|
|
||||||
mandatory_fields = False;
|
mandatory_fields = False;
|
||||||
optional_fields = False;
|
optional_fields = False;
|
||||||
@@ -584,7 +584,7 @@ for (k, v) in sorted_msg_list:
|
|||||||
|
|
||||||
f.write("\n")
|
f.write("\n")
|
||||||
|
|
||||||
f.write("""typedef struct _nas_emm_message_t {
|
f.write("""typedef struct nas_emm_message_s {
|
||||||
nas_emm_header_t h;
|
nas_emm_header_t h;
|
||||||
union {
|
union {
|
||||||
""")
|
""")
|
||||||
@@ -598,7 +598,7 @@ for (k, v) in sorted_msg_list:
|
|||||||
f.write(""" };
|
f.write(""" };
|
||||||
} nas_emm_message_t;
|
} nas_emm_message_t;
|
||||||
|
|
||||||
typedef struct _nas_esm_message_t {
|
typedef struct nas_esm_message_s {
|
||||||
nas_esm_header_t h;
|
nas_esm_header_t h;
|
||||||
union {
|
union {
|
||||||
""")
|
""")
|
||||||
@@ -613,7 +613,7 @@ for (k, v) in sorted_msg_list:
|
|||||||
f.write(""" };
|
f.write(""" };
|
||||||
} nas_esm_message_t;
|
} nas_esm_message_t;
|
||||||
|
|
||||||
typedef struct _nas_message_t {
|
typedef struct nas_message_s {
|
||||||
nas_security_header_t h;
|
nas_security_header_t h;
|
||||||
union {
|
union {
|
||||||
nas_emm_message_t emm;
|
nas_emm_message_t emm;
|
||||||
@@ -628,18 +628,18 @@ int nas_plain_encode(
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __NAS_MESSAGE_H__ */
|
#endif /* NAS_MESSAGE_H */
|
||||||
""")
|
""")
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
f = open(outdir + 'nas_decoder.c', 'w')
|
f = open(outdir + 'nas-decoder.c', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#include "nas_message.h"
|
f.write("""#include "nas-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -799,31 +799,13 @@ f.write(""" default:
|
|||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
#if 0 /* deprecated */
|
|
||||||
int nas_plain_decode(nas_message_t *message, ogs_pkbuf_t *pkbuf)
|
|
||||||
{
|
|
||||||
nas_security_header_t *h = NULL;
|
|
||||||
|
|
||||||
ogs_assert(pkbuf);
|
|
||||||
h = pkbuf->data;
|
|
||||||
ogs_assert(h);
|
|
||||||
|
|
||||||
if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_EMM)
|
|
||||||
return nas_emm_decode(message, pkbuf);
|
|
||||||
else if (h->protocol_discriminator == NAS_PROTOCOL_DISCRIMINATOR_ESM)
|
|
||||||
return nas_esm_decode(message, pkbuf);
|
|
||||||
|
|
||||||
ogs_assert_if_reached();
|
|
||||||
"Invalid Protocol : %d", h->protocol_discriminator);
|
|
||||||
}
|
|
||||||
#endif
|
|
||||||
""")
|
""")
|
||||||
|
|
||||||
f.close()
|
f.close()
|
||||||
|
|
||||||
f = open(outdir + 'nas_encoder.c', 'w')
|
f = open(outdir + 'nas-encoder.c', 'w')
|
||||||
output_header_to_file(f)
|
output_header_to_file(f)
|
||||||
f.write("""#include "nas_message.h"
|
f.write("""#include "nas-message.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __base_nas_domain
|
#define OGS_LOG_DOMAIN __base_nas_domain
|
||||||
@@ -79,10 +79,10 @@ type_list["Short MAC"]["encode"] = \
|
|||||||
type_list["Access point name"]["decode"] = \
|
type_list["Access point name"]["decode"] = \
|
||||||
" {\n" \
|
" {\n" \
|
||||||
" char apn[MAX_APN_LEN];\n" \
|
" char apn[MAX_APN_LEN];\n" \
|
||||||
" access_point_name->length = apn_parse(apn, access_point_name->apn, access_point_name->length);\n" \
|
" access_point_name->length = fqdn_parse(apn, access_point_name->apn, access_point_name->length);\n" \
|
||||||
" ogs_cpystrn(access_point_name->apn, apn, ogs_min(access_point_name->length, MAX_APN_LEN) + 1);\n" \
|
" ogs_cpystrn(access_point_name->apn, apn, ogs_min(access_point_name->length, MAX_APN_LEN) + 1);\n" \
|
||||||
" }\n\n"
|
" }\n\n"
|
||||||
|
|
||||||
type_list["Access point name"]["encode"] = \
|
type_list["Access point name"]["encode"] = \
|
||||||
" target.length = apn_build(target.apn, access_point_name->apn, access_point_name->length);\n" \
|
" target.length = fqdn_build(target.apn, access_point_name->apn, access_point_name->length);\n" \
|
||||||
" size = target.length + sizeof(target.length);\n\n"
|
" size = target.length + sizeof(target.length);\n\n"
|
||||||
Submodule lib/ogslib updated: dd37f7714d...4d14299149
2
main.c
2
main.c
@@ -7,7 +7,7 @@
|
|||||||
|
|
||||||
/* Server */
|
/* Server */
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
#include "app_init.h"
|
#include "app-init.h"
|
||||||
|
|
||||||
static char *version = "NextEPC daemon v" PACKAGE_VERSION;
|
static char *version = "NextEPC daemon v" PACKAGE_VERSION;
|
||||||
|
|
||||||
|
|||||||
@@ -69,6 +69,7 @@ libepc_la_LIBADD = \
|
|||||||
AM_CPPFLAGS = \
|
AM_CPPFLAGS = \
|
||||||
@OGSCORE_CFLAGS@ \
|
@OGSCORE_CFLAGS@ \
|
||||||
-I$(top_srcdir)/src \
|
-I$(top_srcdir)/src \
|
||||||
|
-I$(top_srcdir)/lib \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
AM_CFLAGS = \
|
AM_CFLAGS = \
|
||||||
|
|||||||
@@ -1,3 +1,22 @@
|
|||||||
|
/*
|
||||||
|
* 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 "base/types.h"
|
#include "base/types.h"
|
||||||
|
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
@@ -15,8 +34,7 @@ int app_will_initialize(app_param_t *param)
|
|||||||
|
|
||||||
context_init();
|
context_init();
|
||||||
|
|
||||||
if (param->name)
|
if (param->name) {
|
||||||
{
|
|
||||||
rv = log_pid(param->name, param->pid_path);
|
rv = log_pid(param->name, param->pid_path);
|
||||||
if (rv != OGS_OK) return rv;
|
if (rv != OGS_OK) return rv;
|
||||||
}
|
}
|
||||||
@@ -34,13 +52,11 @@ int app_will_initialize(app_param_t *param)
|
|||||||
context_self()->log.path = param->log_path;
|
context_self()->log.path = param->log_path;
|
||||||
|
|
||||||
if (param->logfile_disabled == false &&
|
if (param->logfile_disabled == false &&
|
||||||
context_self()->config.logger.file)
|
context_self()->config.logger.file) {
|
||||||
{
|
|
||||||
if (context_self()->log.path)
|
if (context_self()->log.path)
|
||||||
context_self()->config.logger.file = context_self()->log.path;
|
context_self()->config.logger.file = context_self()->log.path;
|
||||||
|
|
||||||
if (ogs_log_add_file(context_self()->config.logger.file) == NULL)
|
if (ogs_log_add_file(context_self()->config.logger.file) == NULL) {
|
||||||
{
|
|
||||||
ogs_fatal("cannot open log file : %s",
|
ogs_fatal("cannot open log file : %s",
|
||||||
context_self()->config.logger.file);
|
context_self()->config.logger.file);
|
||||||
ogs_assert_if_reached();
|
ogs_assert_if_reached();
|
||||||
@@ -49,8 +65,8 @@ int app_will_initialize(app_param_t *param)
|
|||||||
ogs_log_print(OGS_LOG_INFO,
|
ogs_log_print(OGS_LOG_INFO,
|
||||||
"File Logging: '%s'\n", context_self()->config.logger.file);
|
"File Logging: '%s'\n", context_self()->config.logger.file);
|
||||||
}
|
}
|
||||||
if (context_self()->config.logger.level)
|
|
||||||
{
|
if (context_self()->config.logger.level) {
|
||||||
if (!strcasecmp(context_self()->config.logger.level, "none"))
|
if (!strcasecmp(context_self()->config.logger.level, "none"))
|
||||||
context_self()->log.level = OGS_LOG_NONE;
|
context_self()->log.level = OGS_LOG_NONE;
|
||||||
else if (!strcasecmp(context_self()->config.logger.level, "fatal"))
|
else if (!strcasecmp(context_self()->config.logger.level, "fatal"))
|
||||||
@@ -73,15 +89,14 @@ int app_will_initialize(app_param_t *param)
|
|||||||
ogs_log_print(OGS_LOG_INFO,
|
ogs_log_print(OGS_LOG_INFO,
|
||||||
"LOG-LEVEL: '%s'\n", context_self()->config.logger.level);
|
"LOG-LEVEL: '%s'\n", context_self()->config.logger.level);
|
||||||
}
|
}
|
||||||
if (context_self()->config.logger.domain)
|
|
||||||
{
|
if (context_self()->config.logger.domain) {
|
||||||
context_self()->log.domain = context_self()->config.logger.domain;
|
context_self()->log.domain = context_self()->config.logger.domain;
|
||||||
ogs_log_print(OGS_LOG_INFO,
|
ogs_log_print(OGS_LOG_INFO,
|
||||||
"LOG-DOMAIN: '%s'\n", context_self()->config.logger.domain);
|
"LOG-DOMAIN: '%s'\n", context_self()->config.logger.domain);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (param->log_level)
|
if (param->log_level) {
|
||||||
{
|
|
||||||
context_self()->log.level = param->log_level;
|
context_self()->log.level = param->log_level;
|
||||||
context_self()->log.domain = param->log_domain;
|
context_self()->log.domain = param->log_domain;
|
||||||
}
|
}
|
||||||
@@ -90,8 +105,7 @@ int app_will_initialize(app_param_t *param)
|
|||||||
if (rv != OGS_OK) return rv;
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
if (param->db_disabled == false &&
|
if (param->db_disabled == false &&
|
||||||
context_self()->config.db_uri)
|
context_self()->config.db_uri) {
|
||||||
{
|
|
||||||
/* Override configuration if DB_URI environment variable is existed */
|
/* Override configuration if DB_URI environment variable is existed */
|
||||||
if (ogs_env_get("DB_URI"))
|
if (ogs_env_get("DB_URI"))
|
||||||
context_self()->config.db_uri = ogs_env_get("DB_URI");
|
context_self()->config.db_uri = ogs_env_get("DB_URI");
|
||||||
@@ -128,8 +142,7 @@ static int log_pid(const char *app_name, const char *pid_path)
|
|||||||
pid_t mypid;
|
pid_t mypid;
|
||||||
char default_pid_path[MAX_FILEPATH_LEN];
|
char default_pid_path[MAX_FILEPATH_LEN];
|
||||||
|
|
||||||
if (pid_path == NULL)
|
if (pid_path == NULL) {
|
||||||
{
|
|
||||||
ogs_snprintf(default_pid_path, sizeof(default_pid_path),
|
ogs_snprintf(default_pid_path, sizeof(default_pid_path),
|
||||||
"%snextepc-%sd/pid", DEFAULT_RUNTIME_DIR_PATH, app_name);
|
"%snextepc-%sd/pid", DEFAULT_RUNTIME_DIR_PATH, app_name);
|
||||||
pid_path = default_pid_path;
|
pid_path = default_pid_path;
|
||||||
@@ -137,8 +150,7 @@ static int log_pid(const char *app_name, const char *pid_path)
|
|||||||
|
|
||||||
mypid = getpid();
|
mypid = getpid();
|
||||||
pid_file = fopen(pid_path, "w");
|
pid_file = fopen(pid_path, "w");
|
||||||
if (!pid_file)
|
if (!pid_file) {
|
||||||
{
|
|
||||||
ogs_error("CHECK PERMISSION of Installation Directory...");
|
ogs_error("CHECK PERMISSION of Installation Directory...");
|
||||||
ogs_error("Cannot create PID file:`%s`", pid_path);
|
ogs_error("Cannot create PID file:`%s`", pid_path);
|
||||||
ogs_assert_if_reached();
|
ogs_assert_if_reached();
|
||||||
|
|||||||
@@ -1,5 +1,24 @@
|
|||||||
#ifndef __APPLICATION_H__
|
/*
|
||||||
#define __APPLICATION_H__
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef APP_APPLICATION_H
|
||||||
|
#define APP_APPLICATION_H
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -31,6 +50,6 @@ int app_logger_restart(void);
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __APPLICATION_H__ */
|
#endif /* APP_APPLICATION_H */
|
||||||
|
|||||||
@@ -1,6 +1,27 @@
|
|||||||
|
/*
|
||||||
|
* 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 <mongoc.h>
|
#include <mongoc.h>
|
||||||
#include <yaml.h>
|
#include <yaml.h>
|
||||||
|
|
||||||
|
#include "base/types.h"
|
||||||
|
|
||||||
#include "context.h"
|
#include "context.h"
|
||||||
|
|
||||||
#define DEFAULT_SCTP_STREAMS 30
|
#define DEFAULT_SCTP_STREAMS 30
|
||||||
@@ -24,8 +45,7 @@ int context_final()
|
|||||||
{
|
{
|
||||||
ogs_assert(context_initialized == 1);
|
ogs_assert(context_initialized == 1);
|
||||||
|
|
||||||
if (self.config.document)
|
if (self.config.document) {
|
||||||
{
|
|
||||||
yaml_document_delete(self.config.document);
|
yaml_document_delete(self.config.document);
|
||||||
ogs_free(self.config.document);
|
ogs_free(self.config.document);
|
||||||
}
|
}
|
||||||
@@ -50,8 +70,7 @@ int context_read_file()
|
|||||||
ogs_assert(config->path);
|
ogs_assert(config->path);
|
||||||
|
|
||||||
file = fopen(config->path, "rb");
|
file = fopen(config->path, "rb");
|
||||||
if (!file)
|
if (!file) {
|
||||||
{
|
|
||||||
ogs_fatal("cannot open file `%s`", config->path);
|
ogs_fatal("cannot open file `%s`", config->path);
|
||||||
ogs_assert_if_reached();
|
ogs_assert_if_reached();
|
||||||
}
|
}
|
||||||
@@ -60,52 +79,50 @@ int context_read_file()
|
|||||||
yaml_parser_set_input_file(&parser, file);
|
yaml_parser_set_input_file(&parser, file);
|
||||||
|
|
||||||
document = ogs_calloc(1, sizeof(yaml_document_t));
|
document = ogs_calloc(1, sizeof(yaml_document_t));
|
||||||
if (!yaml_parser_load(&parser, document))
|
if (!yaml_parser_load(&parser, document)) {
|
||||||
{
|
|
||||||
ogs_fatal("Failed to parse configuration file '%s'", config->path);
|
ogs_fatal("Failed to parse configuration file '%s'", config->path);
|
||||||
switch (parser.error)
|
switch (parser.error) {
|
||||||
{
|
case YAML_MEMORY_ERROR:
|
||||||
case YAML_MEMORY_ERROR:
|
ogs_error("Memory error: Not enough memory for parsing");
|
||||||
ogs_error("Memory error: Not enough memory for parsing");
|
break;
|
||||||
break;
|
case YAML_READER_ERROR:
|
||||||
case YAML_READER_ERROR:
|
if (parser.problem_value != -1)
|
||||||
if (parser.problem_value != -1)
|
ogs_error("Reader error - %s: #%X at %zd", parser.problem,
|
||||||
ogs_error("Reader error - %s: #%X at %zd", parser.problem,
|
parser.problem_value, parser.problem_offset);
|
||||||
parser.problem_value, parser.problem_offset);
|
else
|
||||||
else
|
ogs_error("Reader error - %s at %zd", parser.problem,
|
||||||
ogs_error("Reader error - %s at %zd", parser.problem,
|
parser.problem_offset);
|
||||||
parser.problem_offset);
|
break;
|
||||||
break;
|
case YAML_SCANNER_ERROR:
|
||||||
case YAML_SCANNER_ERROR:
|
if (parser.context)
|
||||||
if (parser.context)
|
ogs_error("Scanner error - %s at line %zu, column %zu"
|
||||||
ogs_error("Scanner error - %s at line %zu, column %zu"
|
"%s at line %zu, column %zu", parser.context,
|
||||||
"%s at line %zu, column %zu", parser.context,
|
parser.context_mark.line+1,
|
||||||
parser.context_mark.line+1,
|
parser.context_mark.column+1,
|
||||||
parser.context_mark.column+1,
|
parser.problem, parser.problem_mark.line+1,
|
||||||
parser.problem, parser.problem_mark.line+1,
|
parser.problem_mark.column+1);
|
||||||
parser.problem_mark.column+1);
|
else
|
||||||
else
|
ogs_error("Scanner error - %s at line %zu, column %zu",
|
||||||
ogs_error("Scanner error - %s at line %zu, column %zu",
|
parser.problem, parser.problem_mark.line+1,
|
||||||
parser.problem, parser.problem_mark.line+1,
|
parser.problem_mark.column+1);
|
||||||
parser.problem_mark.column+1);
|
break;
|
||||||
break;
|
case YAML_PARSER_ERROR:
|
||||||
case YAML_PARSER_ERROR:
|
if (parser.context)
|
||||||
if (parser.context)
|
ogs_error("Parser error - %s at line %zu, column %zu"
|
||||||
ogs_error("Parser error - %s at line %zu, column %zu"
|
"%s at line %zu, column %zu", parser.context,
|
||||||
"%s at line %zu, column %zu", parser.context,
|
parser.context_mark.line+1,
|
||||||
parser.context_mark.line+1,
|
parser.context_mark.column+1,
|
||||||
parser.context_mark.column+1,
|
parser.problem, parser.problem_mark.line+1,
|
||||||
parser.problem, parser.problem_mark.line+1,
|
parser.problem_mark.column+1);
|
||||||
parser.problem_mark.column+1);
|
else
|
||||||
else
|
ogs_error("Parser error - %s at line %zu, column %zu",
|
||||||
ogs_error("Parser error - %s at line %zu, column %zu",
|
parser.problem, parser.problem_mark.line+1,
|
||||||
parser.problem, parser.problem_mark.line+1,
|
parser.problem_mark.column+1);
|
||||||
parser.problem_mark.column+1);
|
break;
|
||||||
break;
|
default:
|
||||||
default:
|
/* Couldn't happen. */
|
||||||
/* Couldn't happen. */
|
ogs_assert_if_reached();
|
||||||
ogs_assert_if_reached();
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
ogs_free(document);
|
ogs_free(document);
|
||||||
@@ -131,9 +148,35 @@ int context_setup_log_module()
|
|||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static void context_setup_pool()
|
||||||
|
{
|
||||||
|
self.pool.ue = self.config.max.ue * self.config.max.enb;
|
||||||
|
self.pool.sess = self.pool.ue * MAX_NUM_OF_SESS;
|
||||||
|
self.pool.bearer = self.pool.sess * MAX_NUM_OF_BEARER;
|
||||||
|
self.pool.tunnel = self.pool.bearer * MAX_NUM_OF_TUNNEL;
|
||||||
|
self.pool.pf = self.pool.bearer * MAX_NUM_OF_PF;
|
||||||
|
}
|
||||||
|
|
||||||
static int context_prepare()
|
static int context_prepare()
|
||||||
{
|
{
|
||||||
self.config.parameter.sctp_streams = DEFAULT_SCTP_STREAMS;
|
#define USRSCTP_LOCAL_UDP_PORT 9899
|
||||||
|
self.config.usrsctp.udp_port = USRSCTP_LOCAL_UDP_PORT;
|
||||||
|
|
||||||
|
#define MAX_NUM_OF_SGW 32 /* Num of SGW per MME */
|
||||||
|
#define MAX_NUM_OF_PGW 32 /* Num of PGW per MME */
|
||||||
|
#define MAX_NUM_OF_VLR 32 /* Num of VLR per MME */
|
||||||
|
#define MAX_NUM_OF_ENB 32 /* Num of eNodeB per MME */
|
||||||
|
#define MAX_NUM_OF_UE 128 /* Num of UE per eNodeB */
|
||||||
|
self.config.max.sgw = MAX_NUM_OF_SGW;
|
||||||
|
self.config.max.pgw = MAX_NUM_OF_PGW;
|
||||||
|
self.config.max.vlr = MAX_NUM_OF_VLR;
|
||||||
|
self.config.max.enb = MAX_NUM_OF_ENB;
|
||||||
|
self.config.max.ue = MAX_NUM_OF_UE;
|
||||||
|
|
||||||
|
#define MAX_NUM_OF_PACKET_POOL 65536
|
||||||
|
self.config.max.packet.pool = MAX_NUM_OF_PACKET_POOL;
|
||||||
|
|
||||||
|
context_setup_pool();
|
||||||
|
|
||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
}
|
}
|
||||||
@@ -141,8 +184,7 @@ static int context_prepare()
|
|||||||
static int context_validation()
|
static int context_validation()
|
||||||
{
|
{
|
||||||
if (self.config.parameter.no_ipv4 == 1 &&
|
if (self.config.parameter.no_ipv4 == 1 &&
|
||||||
self.config.parameter.no_ipv6 == 1)
|
self.config.parameter.no_ipv6 == 1) {
|
||||||
{
|
|
||||||
ogs_error("Both `no_ipv4` and `no_ipv6` set to `true` in `%s`",
|
ogs_error("Both `no_ipv4` and `no_ipv6` set to `true` in `%s`",
|
||||||
context_self()->config.path);
|
context_self()->config.path);
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
@@ -165,100 +207,137 @@ int context_parse_config()
|
|||||||
if (rv != OGS_OK) return rv;
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
ogs_yaml_iter_init(&root_iter, document);
|
ogs_yaml_iter_init(&root_iter, document);
|
||||||
while(ogs_yaml_iter_next(&root_iter))
|
while (ogs_yaml_iter_next(&root_iter)) {
|
||||||
{
|
|
||||||
const char *root_key = ogs_yaml_iter_key(&root_iter);
|
const char *root_key = ogs_yaml_iter_key(&root_iter);
|
||||||
ogs_assert(root_key);
|
ogs_assert(root_key);
|
||||||
if (!strcmp(root_key, "db_uri"))
|
if (!strcmp(root_key, "db_uri")) {
|
||||||
{
|
|
||||||
self.config.db_uri = ogs_yaml_iter_value(&root_iter);
|
self.config.db_uri = ogs_yaml_iter_value(&root_iter);
|
||||||
}
|
} else if (!strcmp(root_key, "logger")) {
|
||||||
else if (!strcmp(root_key, "logger"))
|
|
||||||
{
|
|
||||||
ogs_yaml_iter_t logger_iter;
|
ogs_yaml_iter_t logger_iter;
|
||||||
ogs_yaml_iter_recurse(&root_iter, &logger_iter);
|
ogs_yaml_iter_recurse(&root_iter, &logger_iter);
|
||||||
while(ogs_yaml_iter_next(&logger_iter))
|
while (ogs_yaml_iter_next(&logger_iter)) {
|
||||||
{
|
|
||||||
const char *logger_key = ogs_yaml_iter_key(&logger_iter);
|
const char *logger_key = ogs_yaml_iter_key(&logger_iter);
|
||||||
ogs_assert(logger_key);
|
ogs_assert(logger_key);
|
||||||
if (!strcmp(logger_key, "file"))
|
if (!strcmp(logger_key, "file")) {
|
||||||
{
|
|
||||||
self.config.logger.file = ogs_yaml_iter_value(&logger_iter);
|
self.config.logger.file = ogs_yaml_iter_value(&logger_iter);
|
||||||
}
|
} else if (!strcmp(logger_key, "level")) {
|
||||||
else if (!strcmp(logger_key, "level"))
|
|
||||||
{
|
|
||||||
self.config.logger.level =
|
self.config.logger.level =
|
||||||
ogs_yaml_iter_value(&logger_iter);
|
ogs_yaml_iter_value(&logger_iter);
|
||||||
}
|
} else if (!strcmp(logger_key, "domain")) {
|
||||||
else if (!strcmp(logger_key, "domain"))
|
|
||||||
{
|
|
||||||
self.config.logger.domain =
|
self.config.logger.domain =
|
||||||
ogs_yaml_iter_value(&logger_iter);
|
ogs_yaml_iter_value(&logger_iter);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
} else if (!strcmp(root_key, "parameter")) {
|
||||||
else if (!strcmp(root_key, "parameter"))
|
|
||||||
{
|
|
||||||
ogs_yaml_iter_t parameter_iter;
|
ogs_yaml_iter_t parameter_iter;
|
||||||
ogs_yaml_iter_recurse(&root_iter, ¶meter_iter);
|
ogs_yaml_iter_recurse(&root_iter, ¶meter_iter);
|
||||||
while(ogs_yaml_iter_next(¶meter_iter))
|
while (ogs_yaml_iter_next(¶meter_iter)) {
|
||||||
{
|
|
||||||
const char *parameter_key = ogs_yaml_iter_key(¶meter_iter);
|
const char *parameter_key = ogs_yaml_iter_key(¶meter_iter);
|
||||||
ogs_assert(parameter_key);
|
ogs_assert(parameter_key);
|
||||||
if (!strcmp(parameter_key, "no_hss"))
|
if (!strcmp(parameter_key, "no_hss")) {
|
||||||
{
|
|
||||||
self.config.parameter.no_hss =
|
self.config.parameter.no_hss =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "no_sgw")) {
|
||||||
else if (!strcmp(parameter_key, "no_sgw"))
|
|
||||||
{
|
|
||||||
self.config.parameter.no_sgw =
|
self.config.parameter.no_sgw =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "no_pgw")) {
|
||||||
else if (!strcmp(parameter_key, "no_pgw"))
|
|
||||||
{
|
|
||||||
self.config.parameter.no_pgw =
|
self.config.parameter.no_pgw =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "no_pcrf")) {
|
||||||
else if (!strcmp(parameter_key, "no_pcrf"))
|
|
||||||
{
|
|
||||||
self.config.parameter.no_pcrf =
|
self.config.parameter.no_pcrf =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "no_ipv4")) {
|
||||||
else if (!strcmp(parameter_key, "sctp_streams"))
|
|
||||||
{
|
|
||||||
const char *v = ogs_yaml_iter_value(¶meter_iter);
|
|
||||||
if (v) self.config.parameter.sctp_streams = atoi(v);
|
|
||||||
}
|
|
||||||
else if (!strcmp(parameter_key, "no_ipv4"))
|
|
||||||
{
|
|
||||||
self.config.parameter.no_ipv4 =
|
self.config.parameter.no_ipv4 =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "no_ipv6")) {
|
||||||
else if (!strcmp(parameter_key, "no_ipv6"))
|
|
||||||
{
|
|
||||||
self.config.parameter.no_ipv6 =
|
self.config.parameter.no_ipv6 =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "prefer_ipv4")) {
|
||||||
else if (!strcmp(parameter_key, "prefer_ipv4"))
|
|
||||||
{
|
|
||||||
self.config.parameter.prefer_ipv4 =
|
self.config.parameter.prefer_ipv4 =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "multicast")) {
|
||||||
else if (!strcmp(parameter_key, "multicast"))
|
|
||||||
{
|
|
||||||
self.config.parameter.multicast =
|
self.config.parameter.multicast =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else if (!strcmp(parameter_key, "no_slaac")) {
|
||||||
else if (!strcmp(parameter_key, "no_slaac"))
|
|
||||||
{
|
|
||||||
self.config.parameter.no_slaac =
|
self.config.parameter.no_slaac =
|
||||||
ogs_yaml_iter_bool(¶meter_iter);
|
ogs_yaml_iter_bool(¶meter_iter);
|
||||||
}
|
} else
|
||||||
else
|
|
||||||
ogs_warn("unknown key `%s`", parameter_key);
|
ogs_warn("unknown key `%s`", parameter_key);
|
||||||
}
|
}
|
||||||
|
} else if (!strcmp(root_key, "sctp")) {
|
||||||
|
ogs_yaml_iter_t sctp_iter;
|
||||||
|
ogs_yaml_iter_recurse(&root_iter, &sctp_iter);
|
||||||
|
while (ogs_yaml_iter_next(&sctp_iter)) {
|
||||||
|
const char *sctp_key = ogs_yaml_iter_key(&sctp_iter);
|
||||||
|
ogs_assert(sctp_key);
|
||||||
|
if (!strcmp(sctp_key, "heartbit_interval")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v) self.config.sockopt.sctp.heartbit_interval = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "rto_initial")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v) self.config.sockopt.sctp.rto_initial = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "rto_min")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v) self.config.sockopt.sctp.rto_min = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "rto_max")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v) self.config.sockopt.sctp.rto_max = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "max_num_of_ostreams")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v)
|
||||||
|
self.config.sockopt.sctp.max_num_of_ostreams = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "max_num_of_istreams")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v)
|
||||||
|
self.config.sockopt.sctp.max_num_of_istreams = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "max_attempts")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v) self.config.sockopt.sctp.max_attempts = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "max_initial_timeout")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v)
|
||||||
|
self.config.sockopt.sctp.max_initial_timeout = atoi(v);
|
||||||
|
} else if (!strcmp(sctp_key, "usrsctp_udp_port")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&sctp_iter);
|
||||||
|
if (v) self.config.usrsctp.udp_port = atoi(v);
|
||||||
|
} else
|
||||||
|
ogs_warn("unknown key `%s`", sctp_key);
|
||||||
|
}
|
||||||
|
} else if (!strcmp(root_key, "max")) {
|
||||||
|
ogs_yaml_iter_t max_iter;
|
||||||
|
ogs_yaml_iter_recurse(&root_iter, &max_iter);
|
||||||
|
while (ogs_yaml_iter_next(&max_iter)) {
|
||||||
|
const char *max_key = ogs_yaml_iter_key(&max_iter);
|
||||||
|
ogs_assert(max_key);
|
||||||
|
if (!strcmp(max_key, "ue")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&max_iter);
|
||||||
|
if (v) self.config.max.ue = atoi(v);
|
||||||
|
} else if (!strcmp(max_key, "enb")) {
|
||||||
|
const char *v = ogs_yaml_iter_value(&max_iter);
|
||||||
|
if (v) self.config.max.enb = atoi(v);
|
||||||
|
} else if (!strcmp(max_key, "packet")) {
|
||||||
|
const char *pool = NULL;
|
||||||
|
ogs_yaml_iter_t packet_iter;
|
||||||
|
ogs_yaml_iter_recurse(&max_iter, &packet_iter);
|
||||||
|
while (ogs_yaml_iter_next(&packet_iter)) {
|
||||||
|
const char *packet_key = ogs_yaml_iter_key(&packet_iter);
|
||||||
|
ogs_assert(packet_key);
|
||||||
|
if (!strcmp(packet_key, "pool")) {
|
||||||
|
pool = ogs_yaml_iter_value(&packet_iter);
|
||||||
|
} else
|
||||||
|
ogs_warn("unknown key `%s`", packet_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (pool) {
|
||||||
|
self.config.max.packet.pool = atoi(pool);
|
||||||
|
}
|
||||||
|
} else
|
||||||
|
ogs_warn("unknown key `%s`", max_key);
|
||||||
|
}
|
||||||
|
|
||||||
|
context_setup_pool();
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = context_validation();
|
rv = context_validation();
|
||||||
@@ -304,8 +383,7 @@ int context_db_init(const char *db_uri)
|
|||||||
self.db.initialized = true;
|
self.db.initialized = true;
|
||||||
|
|
||||||
self.db.client = mongoc_client_new(db_uri);
|
self.db.client = mongoc_client_new(db_uri);
|
||||||
if (!self.db.client)
|
if (!self.db.client) {
|
||||||
{
|
|
||||||
ogs_error("Failed to parse DB URI [%s]", db_uri);
|
ogs_error("Failed to parse DB URI [%s]", db_uri);
|
||||||
return OGS_ERROR;
|
return OGS_ERROR;
|
||||||
}
|
}
|
||||||
@@ -324,8 +402,7 @@ int context_db_init(const char *db_uri)
|
|||||||
ogs_assert(self.db.database);
|
ogs_assert(self.db.database);
|
||||||
|
|
||||||
if (!context_mongoc_client_get_server_status(
|
if (!context_mongoc_client_get_server_status(
|
||||||
self.db.client, NULL, &reply, &error))
|
self.db.client, NULL, &reply, &error)) {
|
||||||
{
|
|
||||||
ogs_error("Failed to connect to server [%s]", db_uri);
|
ogs_error("Failed to connect to server [%s]", db_uri);
|
||||||
return OGS_RETRY;
|
return OGS_RETRY;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,5 +1,24 @@
|
|||||||
#ifndef __CONTEXT_H__
|
/*
|
||||||
#define __CONTEXT_H__
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef APP_CONTEXT_H
|
||||||
|
#define APP_CONTEXT_H
|
||||||
|
|
||||||
#include "ogs-core.h"
|
#include "ogs-core.h"
|
||||||
#include "ogs-yaml.h"
|
#include "ogs-yaml.h"
|
||||||
@@ -8,9 +27,6 @@
|
|||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#define MAX_CONFIG_FILE_SIZE 2048
|
|
||||||
#define MAX_NUM_OF_CONFIG_TOKEN 256
|
|
||||||
|
|
||||||
typedef struct _config_t {
|
typedef struct _config_t {
|
||||||
const char *path;
|
const char *path;
|
||||||
void *document;
|
void *document;
|
||||||
@@ -30,7 +46,6 @@ typedef struct _config_t {
|
|||||||
int no_pcrf;
|
int no_pcrf;
|
||||||
|
|
||||||
/* Network */
|
/* Network */
|
||||||
int sctp_streams;
|
|
||||||
int no_ipv4;
|
int no_ipv4;
|
||||||
int no_ipv6;
|
int no_ipv6;
|
||||||
int prefer_ipv4;
|
int prefer_ipv4;
|
||||||
@@ -38,9 +53,23 @@ typedef struct _config_t {
|
|||||||
int no_slaac;
|
int no_slaac;
|
||||||
} parameter;
|
} parameter;
|
||||||
|
|
||||||
} config_t;
|
ogs_sockopt_t sockopt;
|
||||||
|
struct {
|
||||||
|
int udp_port;
|
||||||
|
} usrsctp;
|
||||||
|
|
||||||
#define MAX_DB_URI_LEN 256
|
struct {
|
||||||
|
int sgw;
|
||||||
|
int pgw;
|
||||||
|
int vlr;
|
||||||
|
int enb;
|
||||||
|
int ue;
|
||||||
|
struct {
|
||||||
|
int pool;
|
||||||
|
} packet;
|
||||||
|
} max;
|
||||||
|
|
||||||
|
} config_t;
|
||||||
|
|
||||||
typedef struct _context_t {
|
typedef struct _context_t {
|
||||||
config_t config;
|
config_t config;
|
||||||
@@ -59,6 +88,14 @@ typedef struct _context_t {
|
|||||||
const char *domain;
|
const char *domain;
|
||||||
} log;
|
} log;
|
||||||
|
|
||||||
|
struct {
|
||||||
|
int ue;
|
||||||
|
int sess;
|
||||||
|
int bearer;
|
||||||
|
int tunnel;
|
||||||
|
int pf;
|
||||||
|
} pool;
|
||||||
|
|
||||||
} context_t;
|
} context_t;
|
||||||
|
|
||||||
int context_init(void);
|
int context_init(void);
|
||||||
@@ -76,4 +113,4 @@ int context_db_final(void);
|
|||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif /* __cplusplus */
|
||||||
|
|
||||||
#endif /* __CONTEXT_H__ */
|
#endif /* APP_CONTEXT_H */
|
||||||
|
|||||||
12
src/epc.c
12
src/epc.c
@@ -1,7 +1,9 @@
|
|||||||
|
#include "mme/ogs-sctp.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
#include "app_init.h"
|
#include "app-init.h"
|
||||||
|
|
||||||
static ogs_proc_mutex_t *pcrf_sem1 = NULL;
|
static ogs_proc_mutex_t *pcrf_sem1 = NULL;
|
||||||
static ogs_proc_mutex_t *pcrf_sem2 = NULL;
|
static ogs_proc_mutex_t *pcrf_sem2 = NULL;
|
||||||
@@ -213,14 +215,15 @@ int epc_initialize(app_param_t *param)
|
|||||||
if (hss_sem1) ogs_proc_mutex_wait(hss_sem1);
|
if (hss_sem1) ogs_proc_mutex_wait(hss_sem1);
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = app_did_initialize();
|
|
||||||
if (rv != OGS_OK) return rv;
|
|
||||||
|
|
||||||
ogs_info("MME try to initialize");
|
ogs_info("MME try to initialize");
|
||||||
|
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
||||||
rv = mme_initialize();
|
rv = mme_initialize();
|
||||||
ogs_assert(rv == OGS_OK);
|
ogs_assert(rv == OGS_OK);
|
||||||
ogs_info("MME initialize...done");
|
ogs_info("MME initialize...done");
|
||||||
|
|
||||||
|
rv = app_did_initialize();
|
||||||
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
return OGS_OK;;
|
return OGS_OK;;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -230,6 +233,7 @@ void epc_terminate(void)
|
|||||||
|
|
||||||
ogs_info("MME try to terminate");
|
ogs_info("MME try to terminate");
|
||||||
mme_terminate();
|
mme_terminate();
|
||||||
|
ogs_sctp_final();
|
||||||
ogs_info("MME terminate...done");
|
ogs_info("MME terminate...done");
|
||||||
|
|
||||||
if (context_self()->config.parameter.no_hss == 0)
|
if (context_self()->config.parameter.no_hss == 0)
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
#include "app_init.h"
|
#include "app-init.h"
|
||||||
|
|
||||||
extern int __hss_log_domain;
|
extern int __hss_log_domain;
|
||||||
|
|
||||||
|
|||||||
@@ -3,8 +3,8 @@
|
|||||||
noinst_LTLIBRARIES = libhss.la
|
noinst_LTLIBRARIES = libhss.la
|
||||||
|
|
||||||
libhss_la_SOURCES = \
|
libhss_la_SOURCES = \
|
||||||
milenage.h hss_auc.h hss_context.h hss_fd_path.h \
|
milenage.h hss-auc.h hss-context.h hss-fd-path.h \
|
||||||
milenage.c hss_auc.c hss_init.c hss_context.c hss_fd_path.c \
|
milenage.c hss-auc.c hss-init.c hss-context.c hss-fd-path.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
libhss_la_DEPENDENCIES = \
|
libhss_la_DEPENDENCIES = \
|
||||||
|
|||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "ogs-crypt.h"
|
#include "ogs-crypt.h"
|
||||||
#include "base/types.h"
|
#include "base/types.h"
|
||||||
|
|
||||||
#include "hss_auc.h"
|
#include "hss-auc.h"
|
||||||
#include "milenage.h"
|
#include "milenage.h"
|
||||||
|
|
||||||
#define FC_VALUE 0x10
|
#define FC_VALUE 0x10
|
||||||
@@ -1,10 +1,10 @@
|
|||||||
#include <mongoc.h>
|
#include <mongoc.h>
|
||||||
#include <yaml.h>
|
#include <yaml.h>
|
||||||
|
|
||||||
#include "fd/fd_lib.h"
|
#include "fd/fd-lib.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "hss_context.h"
|
#include "hss-context.h"
|
||||||
|
|
||||||
static hss_context_t self;
|
static hss_context_t self;
|
||||||
static fd_config_t g_fd_conf;
|
static fd_config_t g_fd_conf;
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef __HSS_CONTEXT_H__
|
#ifndef __HSS_CONTEXT_H__
|
||||||
#define __HSS_CONTEXT_H__
|
#define __HSS_CONTEXT_H__
|
||||||
|
|
||||||
#include "fd/s6a/s6a_message.h"
|
#include "fd/s6a/s6a-message.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -27,7 +27,7 @@ typedef struct _hss_db_auth_info_t {
|
|||||||
uint64_t sqn;
|
uint64_t sqn;
|
||||||
} hss_db_auth_info_t;
|
} hss_db_auth_info_t;
|
||||||
|
|
||||||
typedef struct _fd_config_t fd_config_t;
|
typedef struct fd_config_s fd_config_t;
|
||||||
typedef struct _hss_context_t {
|
typedef struct _hss_context_t {
|
||||||
const char *fd_conf_path; /* HSS freeDiameter conf path */
|
const char *fd_conf_path; /* HSS freeDiameter conf path */
|
||||||
fd_config_t *fd_config; /* HSS freeDiameter config */
|
fd_config_t *fd_config; /* HSS freeDiameter config */
|
||||||
@@ -1,11 +1,29 @@
|
|||||||
|
/*
|
||||||
|
* 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-crypt.h"
|
#include "ogs-crypt.h"
|
||||||
|
#include "fd/fd-lib.h"
|
||||||
|
#include "fd/s6a/s6a-dict.h"
|
||||||
|
#include "fd/s6a/s6a-message.h"
|
||||||
|
|
||||||
#include "fd/fd_lib.h"
|
#include "hss-context.h"
|
||||||
#include "fd/s6a/s6a_dict.h"
|
#include "hss-auc.h"
|
||||||
#include "fd/s6a/s6a_message.h"
|
|
||||||
|
|
||||||
#include "hss_context.h"
|
|
||||||
#include "hss_auc.h"
|
|
||||||
#include "milenage.h"
|
#include "milenage.h"
|
||||||
|
|
||||||
/* handler for fallback cb */
|
/* handler for fallback cb */
|
||||||
@@ -74,15 +92,13 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp,
|
|||||||
ogs_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
|
ogs_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
|
||||||
|
|
||||||
rv = hss_db_auth_info(imsi_bcd, &auth_info);
|
rv = hss_db_auth_info(imsi_bcd, &auth_info);
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK) {
|
||||||
{
|
|
||||||
result_code = S6A_DIAMETER_ERROR_USER_UNKNOWN;
|
result_code = S6A_DIAMETER_ERROR_USER_UNKNOWN;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
memset(zero, 0, sizeof(zero));
|
memset(zero, 0, sizeof(zero));
|
||||||
if (memcmp(auth_info.rand, zero, RAND_LEN) == 0)
|
if (memcmp(auth_info.rand, zero, RAND_LEN) == 0) {
|
||||||
{
|
|
||||||
ogs_random(auth_info.rand, RAND_LEN);
|
ogs_random(auth_info.rand, RAND_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -93,25 +109,20 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp,
|
|||||||
|
|
||||||
ret = fd_msg_search_avp(qry, s6a_req_eutran_auth_info, &avp);
|
ret = fd_msg_search_avp(qry, s6a_req_eutran_auth_info, &avp);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
if (avp)
|
if (avp) {
|
||||||
{
|
|
||||||
ret = fd_avp_search_avp(avp, s6a_re_synchronization_info, &avpch);
|
ret = fd_avp_search_avp(avp, s6a_re_synchronization_info, &avpch);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
if (avpch)
|
if (avpch) {
|
||||||
{
|
|
||||||
ret = fd_msg_avp_hdr(avpch, &hdr);
|
ret = fd_msg_avp_hdr(avpch, &hdr);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
hss_auc_sqn(opc, auth_info.k, hdr->avp_value->os.data, sqn, mac_s);
|
hss_auc_sqn(opc, auth_info.k, hdr->avp_value->os.data, sqn, mac_s);
|
||||||
if (memcmp(mac_s, hdr->avp_value->os.data +
|
if (memcmp(mac_s, hdr->avp_value->os.data +
|
||||||
RAND_LEN + HSS_SQN_LEN, MAC_S_LEN) == 0)
|
RAND_LEN + HSS_SQN_LEN, MAC_S_LEN) == 0) {
|
||||||
{
|
|
||||||
ogs_random(auth_info.rand, RAND_LEN);
|
ogs_random(auth_info.rand, RAND_LEN);
|
||||||
auth_info.sqn = ogs_buffer_to_uint64(sqn, HSS_SQN_LEN);
|
auth_info.sqn = ogs_buffer_to_uint64(sqn, HSS_SQN_LEN);
|
||||||
/* 33.102 C.3.4 Guide : IND + 1 */
|
/* 33.102 C.3.4 Guide : IND + 1 */
|
||||||
auth_info.sqn = (auth_info.sqn + 32 + 1) & HSS_MAX_SQN;
|
auth_info.sqn = (auth_info.sqn + 32 + 1) & HSS_MAX_SQN;
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_error("Re-synch MAC failed for IMSI:`%s`", imsi_bcd);
|
ogs_error("Re-synch MAC failed for IMSI:`%s`", imsi_bcd);
|
||||||
ogs_log_print(OGS_LOG_ERROR, "MAC_S: ");
|
ogs_log_print(OGS_LOG_ERROR, "MAC_S: ");
|
||||||
ogs_log_hexdump(OGS_LOG_ERROR, mac_s, MAC_S_LEN);
|
ogs_log_hexdump(OGS_LOG_ERROR, mac_s, MAC_S_LEN);
|
||||||
@@ -127,16 +138,14 @@ static int hss_s6a_air_cb( struct msg **msg, struct avp *avp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
rv = hss_db_update_rand_and_sqn(imsi_bcd, auth_info.rand, auth_info.sqn);
|
rv = hss_db_update_rand_and_sqn(imsi_bcd, auth_info.rand, auth_info.sqn);
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK) {
|
||||||
{
|
|
||||||
ogs_error("Cannot update rand and sqn for IMSI:'%s'", imsi_bcd);
|
ogs_error("Cannot update rand and sqn for IMSI:'%s'", imsi_bcd);
|
||||||
result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE;
|
result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE;
|
||||||
goto out;
|
goto out;
|
||||||
}
|
}
|
||||||
|
|
||||||
rv = hss_db_increment_sqn(imsi_bcd);
|
rv = hss_db_increment_sqn(imsi_bcd);
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK) {
|
||||||
{
|
|
||||||
ogs_error("Cannot increment sqn for IMSI:'%s'", imsi_bcd);
|
ogs_error("Cannot increment sqn for IMSI:'%s'", imsi_bcd);
|
||||||
result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE;
|
result_code = S6A_DIAMETER_AUTHENTICATION_DATA_UNAVAILABLE;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -291,8 +300,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
ogs_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
|
ogs_min(hdr->avp_value->os.len, MAX_IMSI_BCD_LEN)+1);
|
||||||
|
|
||||||
rv = hss_db_subscription_data(imsi_bcd, &subscription_data);
|
rv = hss_db_subscription_data(imsi_bcd, &subscription_data);
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK) {
|
||||||
{
|
|
||||||
ogs_error("Cannot get Subscription-Data for IMSI:'%s'", imsi_bcd);
|
ogs_error("Cannot get Subscription-Data for IMSI:'%s'", imsi_bcd);
|
||||||
result_code = S6A_DIAMETER_ERROR_USER_UNKNOWN;
|
result_code = S6A_DIAMETER_ERROR_USER_UNKNOWN;
|
||||||
goto out;
|
goto out;
|
||||||
@@ -332,8 +340,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
ret = fd_msg_avp_hdr(avp, &hdr);
|
ret = fd_msg_avp_hdr(avp, &hdr);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
if (!(hdr->avp_value->u32 & S6A_ULR_SKIP_SUBSCRIBER_DATA))
|
if (!(hdr->avp_value->u32 & S6A_ULR_SKIP_SUBSCRIBER_DATA)) {
|
||||||
{
|
|
||||||
struct avp *avp_access_restriction_data;
|
struct avp *avp_access_restriction_data;
|
||||||
struct avp *avp_subscriber_status, *avp_network_access_mode;
|
struct avp *avp_subscriber_status, *avp_network_access_mode;
|
||||||
struct avp *avp_ambr, *avp_max_bandwidth_ul, *avp_max_bandwidth_dl;
|
struct avp *avp_ambr, *avp_max_bandwidth_ul, *avp_max_bandwidth_dl;
|
||||||
@@ -343,8 +350,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
ret = fd_msg_avp_new(s6a_subscription_data, 0, &avp);
|
ret = fd_msg_avp_new(s6a_subscription_data, 0, &avp);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
|
|
||||||
if (subscription_data.access_restriction_data)
|
if (subscription_data.access_restriction_data) {
|
||||||
{
|
|
||||||
ret = fd_msg_avp_new(s6a_access_restriction_data, 0,
|
ret = fd_msg_avp_new(s6a_access_restriction_data, 0,
|
||||||
&avp_access_restriction_data);
|
&avp_access_restriction_data);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
@@ -393,8 +399,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_ambr);
|
ret = fd_msg_avp_add(avp, MSG_BRW_LAST_CHILD, avp_ambr);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
|
|
||||||
if (subscription_data.num_of_pdn)
|
if (subscription_data.num_of_pdn) {
|
||||||
{
|
|
||||||
/* Set the APN Configuration Profile */
|
/* Set the APN Configuration Profile */
|
||||||
struct avp *apn_configuration_profile;
|
struct avp *apn_configuration_profile;
|
||||||
struct avp *context_identifier;
|
struct avp *context_identifier;
|
||||||
@@ -427,8 +432,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
all_apn_configuration_included_indicator);
|
all_apn_configuration_included_indicator);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
|
|
||||||
for (i = 0; i < subscription_data.num_of_pdn; i++)
|
for (i = 0; i < subscription_data.num_of_pdn; i++) {
|
||||||
{
|
|
||||||
/* Set the APN Configuration */
|
/* Set the APN Configuration */
|
||||||
struct avp *apn_configuration, *context_identifier;
|
struct avp *apn_configuration, *context_identifier;
|
||||||
struct avp *pdn_type, *service_selection;
|
struct avp *pdn_type, *service_selection;
|
||||||
@@ -536,14 +540,12 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
|
|
||||||
/* Set MIP6-Agent-Info */
|
/* Set MIP6-Agent-Info */
|
||||||
if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6)
|
if (pdn->pgw_ip.ipv4 || pdn->pgw_ip.ipv6) {
|
||||||
{
|
|
||||||
ret = fd_msg_avp_new(fd_mip6_agent_info, 0,
|
ret = fd_msg_avp_new(fd_mip6_agent_info, 0,
|
||||||
&mip6_agent_info);
|
&mip6_agent_info);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
|
|
||||||
if (pdn->pgw_ip.ipv4)
|
if (pdn->pgw_ip.ipv4) {
|
||||||
{
|
|
||||||
ret = fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
ret = fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
||||||
&mip_home_agent_address);
|
&mip_home_agent_address);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
@@ -557,8 +559,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (pdn->pgw_ip.ipv6)
|
if (pdn->pgw_ip.ipv6) {
|
||||||
{
|
|
||||||
ret = fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
ret = fd_msg_avp_new(fd_mip_home_agent_address, 0,
|
||||||
&mip_home_agent_address);
|
&mip_home_agent_address);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
@@ -579,8 +580,7 @@ static int hss_s6a_ulr_cb( struct msg **msg, struct avp *avp,
|
|||||||
}
|
}
|
||||||
|
|
||||||
/* Set AMBR */
|
/* Set AMBR */
|
||||||
if (pdn->ambr.downlink || pdn->ambr.uplink)
|
if (pdn->ambr.downlink || pdn->ambr.uplink) {
|
||||||
{
|
|
||||||
ret = fd_msg_avp_new(s6a_ambr, 0, &avp_ambr);
|
ret = fd_msg_avp_new(s6a_ambr, 0, &avp_ambr);
|
||||||
ogs_assert(ret == 0);
|
ogs_assert(ret == 0);
|
||||||
ret = fd_msg_avp_new(s6a_max_bandwidth_ul, 0,
|
ret = fd_msg_avp_new(s6a_max_bandwidth_ul, 0,
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
|
|
||||||
#include "hss_context.h"
|
#include "hss-context.h"
|
||||||
#include "hss_fd_path.h"
|
#include "hss-fd-path.h"
|
||||||
|
|
||||||
static int initialized = 0;
|
static int initialized = 0;
|
||||||
|
|
||||||
@@ -1,7 +1,9 @@
|
|||||||
|
#include "mme/ogs-sctp.h"
|
||||||
|
|
||||||
#include "app/context.h"
|
#include "app/context.h"
|
||||||
#include "app/application.h"
|
#include "app/application.h"
|
||||||
|
|
||||||
#include "app_init.h"
|
#include "app-init.h"
|
||||||
|
|
||||||
extern int __mme_log_domain;
|
extern int __mme_log_domain;
|
||||||
|
|
||||||
@@ -16,6 +18,7 @@ int app_initialize(app_param_t *param)
|
|||||||
rv = app_will_initialize(param);
|
rv = app_will_initialize(param);
|
||||||
if (rv != OGS_OK) return rv;
|
if (rv != OGS_OK) return rv;
|
||||||
|
|
||||||
|
ogs_sctp_init(context_self()->config.usrsctp.udp_port);
|
||||||
rv = mme_initialize();
|
rv = mme_initialize();
|
||||||
if (rv != OGS_OK)
|
if (rv != OGS_OK)
|
||||||
{
|
{
|
||||||
@@ -36,6 +39,7 @@ void app_terminate(void)
|
|||||||
|
|
||||||
ogs_info("MME try to terminate");
|
ogs_info("MME try to terminate");
|
||||||
mme_terminate();
|
mme_terminate();
|
||||||
|
ogs_sctp_final();
|
||||||
ogs_info("MME terminate...done");
|
ogs_info("MME terminate...done");
|
||||||
|
|
||||||
app_did_terminate();
|
app_did_terminate();
|
||||||
|
|||||||
@@ -3,31 +3,35 @@
|
|||||||
noinst_LTLIBRARIES = libmme.la
|
noinst_LTLIBRARIES = libmme.la
|
||||||
|
|
||||||
libmme_la_SOURCES = \
|
libmme_la_SOURCES = \
|
||||||
mme_kdf.h kasumi.h snow_3g.h zuc.h \
|
mme-kdf.h kasumi.h snow-3g.h zuc.h \
|
||||||
mme_event.h mme_context.h \
|
mme-event.h mme-context.h \
|
||||||
s1ap_build.h s1ap_handler.h s1ap_conv.h s1ap_path.h \
|
ogs-sctp.h \
|
||||||
mme_fd_path.h mme_s6a_handler.h \
|
s1ap-build.h s1ap-handler.h s1ap-conv.h s1ap-path.h \
|
||||||
nas_conv.h nas_security.h nas_path.h \
|
sgsap-build.h sgsap-handler.h sgsap-conv.h sgsap-path.h \
|
||||||
emm_handler.h emm_build.h \
|
mme-fd-path.h mme-s6a-handler.h \
|
||||||
esm_handler.h esm_build.h \
|
nas-conv.h nas-security.h nas-path.h \
|
||||||
mme_gtp_path.h mme_s11_build.h mme_s11_handler.h \
|
emm-handler.h emm-build.h \
|
||||||
mme_sm.h mme_path.h \
|
esm-handler.h esm-build.h \
|
||||||
mme_kdf.c kasumi.c snow_3g.c zuc.c \
|
mme-gtp-path.h mme-s11-build.h mme-s11-handler.h \
|
||||||
mme_init.c mme_event.c mme_context.c \
|
mme-sm.h mme-path.h \
|
||||||
s1ap_sm.c s1ap_build.c s1ap_handler.c s1ap_conv.c s1ap_path.c \
|
mme-kdf.c kasumi.c snow-3g.c zuc.c \
|
||||||
mme_fd_path.c mme_s6a_handler.c \
|
mme-init.c mme-event.c mme-context.c \
|
||||||
nas_conv.c nas_security.c nas_path.c \
|
ogs-sctp.c \
|
||||||
emm_sm.c emm_handler.c emm_build.c \
|
s1ap-sm.c s1ap-build.c s1ap-handler.c s1ap-conv.c s1ap-path.c \
|
||||||
esm_sm.c esm_handler.c esm_build.c \
|
sgsap-sm.c sgsap-build.c sgsap-handler.c sgsap-conv.c sgsap-path.c \
|
||||||
mme_gtp_path.c mme_s11_build.c mme_s11_handler.c \
|
mme-fd-path.c mme-s6a-handler.c \
|
||||||
mme_sm.c mme_path.c \
|
nas-conv.c nas-security.c nas-path.c \
|
||||||
sbc_message.h sbc_handler.h sbc_handler.c \
|
emm-sm.c emm-handler.c emm-build.c \
|
||||||
|
esm-sm.c esm-handler.c esm-build.c \
|
||||||
|
mme-gtp-path.c mme-s11-build.c mme-s11-handler.c \
|
||||||
|
mme-sm.c mme-path.c \
|
||||||
|
sbc-message.h sbc-handler.h sbc-handler.c \
|
||||||
$(NULL)
|
$(NULL)
|
||||||
|
|
||||||
if WITH_USRSCTP
|
if WITH_USRSCTP
|
||||||
libmme_la_SOURCES += s1ap_usrsctp.c
|
libmme_la_SOURCES += ogs-usrsctp.c s1ap-usrpath.c sgsap-usrpath.c
|
||||||
else
|
else
|
||||||
libmme_la_SOURCES += ogs-sctp.h ogs-sctp.c s1ap_lksctp.c
|
libmme_la_SOURCES += ogs-lksctp.c s1ap-lkpath.c sgsap-lkpath.c
|
||||||
endif
|
endif
|
||||||
|
|
||||||
libmme_la_DEPENDENCIES = \
|
libmme_la_DEPENDENCIES = \
|
||||||
|
|||||||
@@ -1,8 +1,27 @@
|
|||||||
#include "nas/nas_message.h"
|
/*
|
||||||
|
* 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 "nas_security.h"
|
#include "nas/nas-message.h"
|
||||||
#include "mme_kdf.h"
|
|
||||||
#include "emm_build.h"
|
#include "nas-security.h"
|
||||||
|
#include "mme-kdf.h"
|
||||||
|
#include "emm-build.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __emm_log_domain
|
#define OGS_LOG_DOMAIN __emm_log_domain
|
||||||
@@ -17,9 +36,13 @@ int emm_build_attach_accept(
|
|||||||
&attach_accept->eps_attach_result;
|
&attach_accept->eps_attach_result;
|
||||||
nas_gprs_timer_t *t3412_value = &attach_accept->t3412_value;
|
nas_gprs_timer_t *t3412_value = &attach_accept->t3412_value;
|
||||||
int served_tai_index = 0;
|
int served_tai_index = 0;
|
||||||
nas_eps_mobile_identity_t *guti = &attach_accept->guti;
|
nas_eps_mobile_identity_t *nas_guti = &attach_accept->guti;
|
||||||
nas_eps_network_feature_support_t *eps_network_feature_support =
|
nas_eps_network_feature_support_t *eps_network_feature_support =
|
||||||
&attach_accept->eps_network_feature_support;
|
&attach_accept->eps_network_feature_support;
|
||||||
|
nas_location_area_identification_t *lai =
|
||||||
|
&attach_accept->location_area_identification;
|
||||||
|
nas_mobile_identity_t *ms_identity = &attach_accept->ms_identity;
|
||||||
|
nas_mobile_identity_tmsi_t *tmsi = &ms_identity->tmsi;;
|
||||||
|
|
||||||
ogs_assert(mme_ue);
|
ogs_assert(mme_ue);
|
||||||
ogs_assert(esmbuf);
|
ogs_assert(esmbuf);
|
||||||
@@ -60,17 +83,15 @@ int emm_build_attach_accept(
|
|||||||
mme_ue->guti_present ? "[V]" : "[N]",
|
mme_ue->guti_present ? "[V]" : "[N]",
|
||||||
mme_ue->guti.mme_gid, mme_ue->guti.mme_code,
|
mme_ue->guti.mme_gid, mme_ue->guti.mme_code,
|
||||||
mme_ue->guti.m_tmsi, mme_ue->imsi_bcd);
|
mme_ue->guti.m_tmsi, mme_ue->imsi_bcd);
|
||||||
if (mme_ue->guti_present)
|
if (mme_ue->guti_present) {
|
||||||
{
|
|
||||||
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT;
|
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_GUTI_PRESENT;
|
||||||
guti->length = sizeof(nas_eps_mobile_identity_guti_t);
|
nas_guti->length = sizeof(nas_eps_mobile_identity_guti_t);
|
||||||
guti->guti.odd_even = NAS_EPS_MOBILE_IDENTITY_EVEN;
|
nas_guti->guti.odd_even = NAS_EPS_MOBILE_IDENTITY_EVEN;
|
||||||
guti->guti.type = NAS_EPS_MOBILE_IDENTITY_GUTI;
|
nas_guti->guti.type = NAS_EPS_MOBILE_IDENTITY_GUTI;
|
||||||
nas_from_plmn_id(&guti->guti.plmn_id,
|
nas_guti->guti.nas_plmn_id = mme_ue->guti.nas_plmn_id;
|
||||||
(plmn_id_t*)&mme_ue->guti.plmn_id);
|
nas_guti->guti.mme_gid = mme_ue->guti.mme_gid;
|
||||||
guti->guti.mme_gid = mme_ue->guti.mme_gid;
|
nas_guti->guti.mme_code = mme_ue->guti.mme_code;
|
||||||
guti->guti.mme_code = mme_ue->guti.mme_code;
|
nas_guti->guti.m_tmsi = mme_ue->guti.m_tmsi;
|
||||||
guti->guti.m_tmsi = mme_ue->guti.m_tmsi;
|
|
||||||
}
|
}
|
||||||
mme_ue->guti_present = 0;
|
mme_ue->guti_present = 0;
|
||||||
|
|
||||||
@@ -90,6 +111,25 @@ int emm_build_attach_accept(
|
|||||||
eps_network_feature_support->length = 1;
|
eps_network_feature_support->length = 1;
|
||||||
eps_network_feature_support->ims_vops = 1;
|
eps_network_feature_support->ims_vops = 1;
|
||||||
|
|
||||||
|
if (mme_ue->vlr) {
|
||||||
|
attach_accept->presencemask |=
|
||||||
|
NAS_ATTACH_ACCEPT_LOCATION_AREA_IDENTIFICATION_PRESENT;
|
||||||
|
lai->nas_plmn_id = mme_ue->vlr->lai.nas_plmn_id;
|
||||||
|
lai->lac = mme_ue->vlr->lai.lac;
|
||||||
|
ogs_debug(" LAI[PLMN_ID:%06x,LAC:%d]",
|
||||||
|
plmn_id_hexdump(&lai->nas_plmn_id), lai->lac);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (mme_ue->p_tmsi) {
|
||||||
|
attach_accept->presencemask |= NAS_ATTACH_ACCEPT_MS_IDENTITY_PRESENT;
|
||||||
|
ms_identity->length = 5;
|
||||||
|
tmsi->spare = 0xf;
|
||||||
|
tmsi->odd_even = 0;
|
||||||
|
tmsi->type = NAS_MOBILE_IDENTITY_TMSI;
|
||||||
|
tmsi->tmsi = mme_ue->p_tmsi;
|
||||||
|
ogs_debug(" P-TMSI: 0x%08x", tmsi->tmsi);
|
||||||
|
}
|
||||||
|
|
||||||
rv = nas_security_encode(emmbuf, mme_ue, &message);
|
rv = nas_security_encode(emmbuf, mme_ue, &message);
|
||||||
ogs_assert(rv == OGS_OK && *emmbuf);
|
ogs_assert(rv == OGS_OK && *emmbuf);
|
||||||
ogs_pkbuf_free(esmbuf);
|
ogs_pkbuf_free(esmbuf);
|
||||||
@@ -110,8 +150,7 @@ int emm_build_attach_reject(
|
|||||||
|
|
||||||
attach_reject->emm_cause = emm_cause;
|
attach_reject->emm_cause = emm_cause;
|
||||||
|
|
||||||
if (esmbuf)
|
if (esmbuf) {
|
||||||
{
|
|
||||||
attach_reject->presencemask |=
|
attach_reject->presencemask |=
|
||||||
NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT;
|
NAS_ATTACH_REJECT_ESM_MESSAGE_CONTAINER_PRESENT;
|
||||||
attach_reject->esm_message_container.buffer = esmbuf->data;
|
attach_reject->esm_message_container.buffer = esmbuf->data;
|
||||||
@@ -121,8 +160,7 @@ int emm_build_attach_reject(
|
|||||||
rv = nas_plain_encode(emmbuf, &message);
|
rv = nas_plain_encode(emmbuf, &message);
|
||||||
ogs_assert(rv == OGS_OK && *emmbuf);
|
ogs_assert(rv == OGS_OK && *emmbuf);
|
||||||
|
|
||||||
if (esmbuf)
|
if (esmbuf) {
|
||||||
{
|
|
||||||
ogs_pkbuf_free(esmbuf);
|
ogs_pkbuf_free(esmbuf);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -226,20 +264,16 @@ int emm_build_security_mode_command(
|
|||||||
message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM;
|
message.emm.h.protocol_discriminator = NAS_PROTOCOL_DISCRIMINATOR_EMM;
|
||||||
message.emm.h.message_type = NAS_SECURITY_MODE_COMMAND;
|
message.emm.h.message_type = NAS_SECURITY_MODE_COMMAND;
|
||||||
|
|
||||||
for (i = 0; i < mme_self()->num_of_integrity_order; i++)
|
for (i = 0; i < mme_self()->num_of_integrity_order; i++) {
|
||||||
{
|
|
||||||
if (mme_ue->ue_network_capability.eia &
|
if (mme_ue->ue_network_capability.eia &
|
||||||
(0x80 >> mme_self()->integrity_order[i]))
|
(0x80 >> mme_self()->integrity_order[i])) {
|
||||||
{
|
|
||||||
mme_ue->selected_int_algorithm = mme_self()->integrity_order[i];
|
mme_ue->selected_int_algorithm = mme_self()->integrity_order[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
for (i = 0; i < mme_self()->num_of_ciphering_order; i++)
|
for (i = 0; i < mme_self()->num_of_ciphering_order; i++) {
|
||||||
{
|
|
||||||
if (mme_ue->ue_network_capability.eea &
|
if (mme_ue->ue_network_capability.eea &
|
||||||
(0x80 >> mme_self()->ciphering_order[i]))
|
(0x80 >> mme_self()->ciphering_order[i])) {
|
||||||
{
|
|
||||||
mme_ue->selected_enc_algorithm = mme_self()->ciphering_order[i];
|
mme_ue->selected_enc_algorithm = mme_self()->ciphering_order[i];
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -288,8 +322,7 @@ int emm_build_security_mode_command(
|
|||||||
replayed_ue_security_capabilities->gea);
|
replayed_ue_security_capabilities->gea);
|
||||||
ogs_debug(" Selected[Integrity:0x%x Encrypt:0x%x]",
|
ogs_debug(" Selected[Integrity:0x%x Encrypt:0x%x]",
|
||||||
mme_ue->selected_int_algorithm, mme_ue->selected_enc_algorithm);
|
mme_ue->selected_int_algorithm, mme_ue->selected_enc_algorithm);
|
||||||
if (mme_ue->selected_int_algorithm == NAS_SECURITY_ALGORITHMS_EIA0)
|
if (mme_ue->selected_int_algorithm == NAS_SECURITY_ALGORITHMS_EIA0) {
|
||||||
{
|
|
||||||
ogs_fatal("Encrypt[0x%x] can be skipped with EEA0, "
|
ogs_fatal("Encrypt[0x%x] can be skipped with EEA0, "
|
||||||
"but Integrity[0x%x] cannot be bypassed with EIA0",
|
"but Integrity[0x%x] cannot be bypassed with EIA0",
|
||||||
mme_ue->selected_enc_algorithm, mme_ue->selected_int_algorithm);
|
mme_ue->selected_enc_algorithm, mme_ue->selected_int_algorithm);
|
||||||
@@ -383,25 +416,22 @@ int emm_build_tau_accept(ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue)
|
|||||||
NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT;
|
NAS_TRACKING_AREA_UPDATE_ACCEPT_EPS_BEARER_CONTEXT_STATUS_PRESENT;
|
||||||
tau_accept->eps_bearer_context_status.length = 2;
|
tau_accept->eps_bearer_context_status.length = 2;
|
||||||
sess = mme_sess_first(mme_ue);
|
sess = mme_sess_first(mme_ue);
|
||||||
while(sess)
|
while (sess) {
|
||||||
{
|
|
||||||
mme_bearer_t *bearer = mme_bearer_first(sess);
|
mme_bearer_t *bearer = mme_bearer_first(sess);
|
||||||
while(bearer)
|
while (bearer) {
|
||||||
{
|
switch (bearer->ebi) {
|
||||||
switch(bearer->ebi)
|
case 5: tau_accept->eps_bearer_context_status.ebi5 = 1; break;
|
||||||
{
|
case 6: tau_accept->eps_bearer_context_status.ebi6 = 1; break;
|
||||||
case 5: tau_accept->eps_bearer_context_status.ebi5 = 1; break;
|
case 7: tau_accept->eps_bearer_context_status.ebi7 = 1; break;
|
||||||
case 6: tau_accept->eps_bearer_context_status.ebi6 = 1; break;
|
case 8: tau_accept->eps_bearer_context_status.ebi8 = 1; break;
|
||||||
case 7: tau_accept->eps_bearer_context_status.ebi7 = 1; break;
|
case 9: tau_accept->eps_bearer_context_status.ebi9 = 1; break;
|
||||||
case 8: tau_accept->eps_bearer_context_status.ebi8 = 1; break;
|
case 10: tau_accept->eps_bearer_context_status.ebi10 = 1; break;
|
||||||
case 9: tau_accept->eps_bearer_context_status.ebi9 = 1; break;
|
case 11: tau_accept->eps_bearer_context_status.ebi11 = 1; break;
|
||||||
case 10: tau_accept->eps_bearer_context_status.ebi10 = 1; break;
|
case 12: tau_accept->eps_bearer_context_status.ebi12 = 1; break;
|
||||||
case 11: tau_accept->eps_bearer_context_status.ebi11 = 1; break;
|
case 13: tau_accept->eps_bearer_context_status.ebi13 = 1; break;
|
||||||
case 12: tau_accept->eps_bearer_context_status.ebi12 = 1; break;
|
case 14: tau_accept->eps_bearer_context_status.ebi14 = 1; break;
|
||||||
case 13: tau_accept->eps_bearer_context_status.ebi13 = 1; break;
|
case 15: tau_accept->eps_bearer_context_status.ebi15 = 1; break;
|
||||||
case 14: tau_accept->eps_bearer_context_status.ebi14 = 1; break;
|
default: break;
|
||||||
case 15: tau_accept->eps_bearer_context_status.ebi15 = 1; break;
|
|
||||||
default: break;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
bearer = mme_bearer_next(bearer);
|
bearer = mme_bearer_next(bearer);
|
||||||
@@ -1,11 +1,30 @@
|
|||||||
#ifndef __EMM_BUILD_H__
|
/*
|
||||||
#define __EMM_BUILD_H__
|
* 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 "mme_context.h"
|
#ifndef EMM_BUILD_H
|
||||||
|
#define EMM_BUILD_H
|
||||||
|
|
||||||
|
#include "mme-context.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
int emm_build_attach_accept(
|
int emm_build_attach_accept(
|
||||||
ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue, ogs_pkbuf_t *esmbuf);
|
ogs_pkbuf_t **emmbuf, mme_ue_t *mme_ue, ogs_pkbuf_t *esmbuf);
|
||||||
@@ -33,6 +52,6 @@ int emm_build_service_reject(ogs_pkbuf_t **emmbuf,
|
|||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
}
|
}
|
||||||
#endif /* __cplusplus */
|
#endif
|
||||||
|
|
||||||
#endif /* __EMM_BUILD_H__ */
|
#endif /* EMM_BUILD_H */
|
||||||
@@ -1,17 +1,36 @@
|
|||||||
#include "nas/nas_message.h"
|
/*
|
||||||
|
* 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 "mme_event.h"
|
#include "nas/nas-message.h"
|
||||||
|
#include "mme-event.h"
|
||||||
|
|
||||||
#include "mme_kdf.h"
|
#include "mme-kdf.h"
|
||||||
#include "nas_security.h"
|
#include "nas-security.h"
|
||||||
#include "nas_conv.h"
|
#include "nas-conv.h"
|
||||||
|
|
||||||
#include "s1ap_path.h"
|
#include "s1ap-path.h"
|
||||||
#include "nas_path.h"
|
#include "nas-path.h"
|
||||||
#include "mme_fd_path.h"
|
#include "mme-fd-path.h"
|
||||||
#include "mme_gtp_path.h"
|
#include "mme-gtp-path.h"
|
||||||
|
#include "sgsap-path.h"
|
||||||
|
|
||||||
#include "emm_handler.h"
|
#include "emm-handler.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __emm_log_domain
|
#define OGS_LOG_DOMAIN __emm_log_domain
|
||||||
@@ -58,8 +77,7 @@ int emm_handle_attach_request(
|
|||||||
*/
|
*/
|
||||||
CLEAR_EPS_BEARER_ID(mme_ue);
|
CLEAR_EPS_BEARER_ID(mme_ue);
|
||||||
CLEAR_PAGING_INFO(mme_ue);
|
CLEAR_PAGING_INFO(mme_ue);
|
||||||
if (SECURITY_CONTEXT_IS_VALID(mme_ue))
|
if (SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||||
{
|
|
||||||
mme_kdf_enb(mme_ue->kasme, mme_ue->ul_count.i32, mme_ue->kenb);
|
mme_kdf_enb(mme_ue->kasme, mme_ue->ul_count.i32, mme_ue->kenb);
|
||||||
mme_kdf_nh(mme_ue->kasme, mme_ue->kenb, mme_ue->nh);
|
mme_kdf_nh(mme_ue->kasme, mme_ue->kenb, mme_ue->nh);
|
||||||
mme_ue->nhcc = 1;
|
mme_ue->nhcc = 1;
|
||||||
@@ -70,19 +88,18 @@ int emm_handle_attach_request(
|
|||||||
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
||||||
plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id);
|
plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id);
|
||||||
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
||||||
plmn_id_hexdump(&enb_ue->nas.tai.plmn_id), enb_ue->nas.tai.tac);
|
plmn_id_hexdump(&enb_ue->saved.tai.plmn_id), enb_ue->saved.tai.tac);
|
||||||
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
||||||
plmn_id_hexdump(&enb_ue->nas.e_cgi.plmn_id),
|
plmn_id_hexdump(&enb_ue->saved.e_cgi.plmn_id),
|
||||||
enb_ue->nas.e_cgi.cell_id);
|
enb_ue->saved.e_cgi.cell_id);
|
||||||
|
|
||||||
/* Copy TAI and ECGI from enb_ue */
|
/* Copy TAI and ECGI from enb_ue */
|
||||||
memcpy(&mme_ue->tai, &enb_ue->nas.tai, sizeof(tai_t));
|
memcpy(&mme_ue->tai, &enb_ue->saved.tai, sizeof(tai_t));
|
||||||
memcpy(&mme_ue->e_cgi, &enb_ue->nas.e_cgi, sizeof(e_cgi_t));
|
memcpy(&mme_ue->e_cgi, &enb_ue->saved.e_cgi, sizeof(e_cgi_t));
|
||||||
|
|
||||||
/* Check TAI */
|
/* Check TAI */
|
||||||
served_tai_index = mme_find_served_tai(&mme_ue->tai);
|
served_tai_index = mme_find_served_tai(&mme_ue->tai);
|
||||||
if (served_tai_index < 0)
|
if (served_tai_index < 0) {
|
||||||
{
|
|
||||||
/* Send Attach Reject */
|
/* Send Attach Reject */
|
||||||
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
||||||
plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||||
@@ -95,18 +112,15 @@ int emm_handle_attach_request(
|
|||||||
|
|
||||||
/* Store UE specific information */
|
/* Store UE specific information */
|
||||||
if (attach_request->presencemask &
|
if (attach_request->presencemask &
|
||||||
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT)
|
NAS_ATTACH_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) {
|
||||||
{
|
|
||||||
nas_tracking_area_identity_t *last_visited_registered_tai =
|
nas_tracking_area_identity_t *last_visited_registered_tai =
|
||||||
&attach_request->last_visited_registered_tai;
|
&attach_request->last_visited_registered_tai;
|
||||||
|
|
||||||
nas_to_plmn_id(
|
nas_to_plmn_id(&mme_ue->visited_plmn_id,
|
||||||
&mme_ue->visited_plmn_id, &last_visited_registered_tai->plmn_id);
|
&last_visited_registered_tai->nas_plmn_id);
|
||||||
ogs_debug(" Visited_PLMN_ID:%06x",
|
ogs_debug(" Visited_PLMN_ID:%06x",
|
||||||
plmn_id_hexdump(&mme_ue->visited_plmn_id));
|
plmn_id_hexdump(&mme_ue->visited_plmn_id));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
memcpy(&mme_ue->visited_plmn_id, &mme_ue->tai.plmn_id, PLMN_ID_LEN);
|
memcpy(&mme_ue->visited_plmn_id, &mme_ue->tai.plmn_id, PLMN_ID_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -115,52 +129,50 @@ int emm_handle_attach_request(
|
|||||||
sizeof(attach_request->ue_network_capability));
|
sizeof(attach_request->ue_network_capability));
|
||||||
|
|
||||||
if (attach_request->presencemask &
|
if (attach_request->presencemask &
|
||||||
NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT)
|
NAS_ATTACH_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) {
|
||||||
{
|
|
||||||
memcpy(&mme_ue->ms_network_capability,
|
memcpy(&mme_ue->ms_network_capability,
|
||||||
&attach_request->ms_network_capability,
|
&attach_request->ms_network_capability,
|
||||||
sizeof(attach_request->ms_network_capability));
|
sizeof(attach_request->ms_network_capability));
|
||||||
}
|
}
|
||||||
|
|
||||||
switch(eps_mobile_identity->imsi.type)
|
switch (eps_mobile_identity->imsi.type) {
|
||||||
|
case NAS_EPS_MOBILE_IDENTITY_IMSI:
|
||||||
{
|
{
|
||||||
case NAS_EPS_MOBILE_IDENTITY_IMSI:
|
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
||||||
{
|
|
||||||
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
|
||||||
|
|
||||||
nas_imsi_to_bcd(
|
memcpy(&mme_ue->nas_mobile_identity_imsi,
|
||||||
&eps_mobile_identity->imsi, eps_mobile_identity->length,
|
&eps_mobile_identity->imsi, sizeof(nas_mobile_identity_imsi_t));
|
||||||
imsi_bcd);
|
nas_imsi_to_bcd(
|
||||||
mme_ue_set_imsi(mme_ue, imsi_bcd);
|
&eps_mobile_identity->imsi, eps_mobile_identity->length,
|
||||||
|
imsi_bcd);
|
||||||
|
mme_ue_set_imsi(mme_ue, imsi_bcd);
|
||||||
|
|
||||||
ogs_debug(" IMSI[%s]", imsi_bcd);
|
ogs_debug(" IMSI[%s]", imsi_bcd);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||||
{
|
{
|
||||||
nas_eps_mobile_identity_guti_t *nas_guti = NULL;
|
nas_eps_mobile_identity_guti_t *nas_eps_mobile_identity_guti =
|
||||||
nas_guti = &eps_mobile_identity->guti;
|
&eps_mobile_identity->guti;
|
||||||
guti_t guti;
|
nas_guti_t nas_guti;
|
||||||
|
|
||||||
guti.plmn_id = nas_guti->plmn_id;
|
nas_guti.nas_plmn_id = nas_eps_mobile_identity_guti->nas_plmn_id;
|
||||||
guti.mme_gid = nas_guti->mme_gid;
|
nas_guti.mme_gid = nas_eps_mobile_identity_guti->mme_gid;
|
||||||
guti.mme_code = nas_guti->mme_code;
|
nas_guti.mme_code = nas_eps_mobile_identity_guti->mme_code;
|
||||||
guti.m_tmsi = nas_guti->m_tmsi;
|
nas_guti.m_tmsi = nas_eps_mobile_identity_guti->m_tmsi;
|
||||||
|
|
||||||
ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]",
|
ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI[%s]",
|
||||||
guti.mme_gid,
|
nas_guti.mme_gid,
|
||||||
guti.mme_code,
|
nas_guti.mme_code,
|
||||||
guti.m_tmsi,
|
nas_guti.m_tmsi,
|
||||||
MME_UE_HAVE_IMSI(mme_ue)
|
MME_UE_HAVE_IMSI(mme_ue)
|
||||||
? mme_ue->imsi_bcd : "Unknown");
|
? mme_ue->imsi_bcd : "Unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
ogs_warn("Not implemented[%d]", eps_mobile_identity->imsi.type);
|
||||||
ogs_warn("Not implemented[%d]", eps_mobile_identity->imsi.type);
|
break;
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
NAS_STORE_DATA(&mme_ue->pdn_connectivity_request, esm_message_container);
|
NAS_STORE_DATA(&mme_ue->pdn_connectivity_request, esm_message_container);
|
||||||
@@ -222,13 +234,10 @@ int emm_handle_attach_complete(
|
|||||||
NAS_TIME_TO_BCD(gmt.tm_hour);
|
NAS_TIME_TO_BCD(gmt.tm_hour);
|
||||||
universal_time_and_local_time_zone->min = NAS_TIME_TO_BCD(gmt.tm_min);
|
universal_time_and_local_time_zone->min = NAS_TIME_TO_BCD(gmt.tm_min);
|
||||||
universal_time_and_local_time_zone->sec = NAS_TIME_TO_BCD(gmt.tm_sec);
|
universal_time_and_local_time_zone->sec = NAS_TIME_TO_BCD(gmt.tm_sec);
|
||||||
if (local.tm_gmtoff >= 0)
|
if (local.tm_gmtoff >= 0) {
|
||||||
{
|
|
||||||
universal_time_and_local_time_zone->timezone =
|
universal_time_and_local_time_zone->timezone =
|
||||||
NAS_TIME_TO_BCD(local.tm_gmtoff / 900);
|
NAS_TIME_TO_BCD(local.tm_gmtoff / 900);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
universal_time_and_local_time_zone->timezone =
|
universal_time_and_local_time_zone->timezone =
|
||||||
NAS_TIME_TO_BCD((-local.tm_gmtoff) / 900);
|
NAS_TIME_TO_BCD((-local.tm_gmtoff) / 900);
|
||||||
universal_time_and_local_time_zone->timezone |= 0x08;
|
universal_time_and_local_time_zone->timezone |= 0x08;
|
||||||
@@ -240,16 +249,14 @@ int emm_handle_attach_complete(
|
|||||||
NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT;
|
NAS_EMM_INFORMATION_NETWORK_DAYLIGHT_SAVING_TIME_PRESENT;
|
||||||
network_daylight_saving_time->length = 1;
|
network_daylight_saving_time->length = 1;
|
||||||
|
|
||||||
if(mme_self()->full_name.length)
|
if (mme_self()->full_name.length) {
|
||||||
{
|
|
||||||
emm_information->presencemask |=
|
emm_information->presencemask |=
|
||||||
NAS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT;
|
NAS_EMM_INFORMATION_FULL_NAME_FOR_NETWORK_PRESENT;
|
||||||
memcpy(&emm_information->full_name_for_network,
|
memcpy(&emm_information->full_name_for_network,
|
||||||
&mme_self()->full_name, sizeof(nas_network_name_t));
|
&mme_self()->full_name, sizeof(nas_network_name_t));
|
||||||
}
|
}
|
||||||
|
|
||||||
if(mme_self()->short_name.length)
|
if (mme_self()->short_name.length) {
|
||||||
{
|
|
||||||
emm_information->presencemask |=
|
emm_information->presencemask |=
|
||||||
NAS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT;
|
NAS_EMM_INFORMATION_SHORT_NAME_FOR_NETWORK_PRESENT;
|
||||||
memcpy(&emm_information->short_name_for_network,
|
memcpy(&emm_information->short_name_for_network,
|
||||||
@@ -263,6 +270,9 @@ int emm_handle_attach_complete(
|
|||||||
ogs_debug("[EMM] EMM information");
|
ogs_debug("[EMM] EMM information");
|
||||||
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
ogs_debug(" IMSI[%s]", mme_ue->imsi_bcd);
|
||||||
|
|
||||||
|
if (mme_ue->vlr)
|
||||||
|
sgsap_send_tmsi_reallocation_complete(mme_ue);
|
||||||
|
|
||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -280,18 +290,17 @@ int emm_handle_identity_response(
|
|||||||
|
|
||||||
mobile_identity = &identity_response->mobile_identity;
|
mobile_identity = &identity_response->mobile_identity;
|
||||||
|
|
||||||
if (mobile_identity->imsi.type == NAS_IDENTITY_TYPE_2_IMSI)
|
if (mobile_identity->imsi.type == NAS_IDENTITY_TYPE_2_IMSI) {
|
||||||
{
|
|
||||||
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
char imsi_bcd[MAX_IMSI_BCD_LEN+1];
|
||||||
|
|
||||||
|
memcpy(&mme_ue->nas_mobile_identity_imsi,
|
||||||
|
&mobile_identity->imsi, sizeof(nas_mobile_identity_imsi_t));
|
||||||
nas_imsi_to_bcd(
|
nas_imsi_to_bcd(
|
||||||
&mobile_identity->imsi, mobile_identity->length, imsi_bcd);
|
&mobile_identity->imsi, mobile_identity->length, imsi_bcd);
|
||||||
mme_ue_set_imsi(mme_ue, imsi_bcd);
|
mme_ue_set_imsi(mme_ue, imsi_bcd);
|
||||||
|
|
||||||
ogs_assert(mme_ue->imsi_len);
|
ogs_assert(mme_ue->imsi_len);
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
ogs_warn("Not supported Identity type[%d]", mobile_identity->imsi.type);
|
ogs_warn("Not supported Identity type[%d]", mobile_identity->imsi.type);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -315,26 +324,25 @@ int emm_handle_detach_request(
|
|||||||
ogs_debug(" NAS_EPS TYPE[%d] KSI[%d] DETACH[0x%x]",
|
ogs_debug(" NAS_EPS TYPE[%d] KSI[%d] DETACH[0x%x]",
|
||||||
mme_ue->nas_eps.type, mme_ue->nas_eps.ksi, mme_ue->nas_eps.data);
|
mme_ue->nas_eps.type, mme_ue->nas_eps.ksi, mme_ue->nas_eps.data);
|
||||||
|
|
||||||
switch (detach_request->detach_type.detach_type)
|
switch (detach_request->detach_type.detach_type) {
|
||||||
{
|
/* 0 0 1 : EPS detach */
|
||||||
/* 0 0 1 : EPS detach */
|
case NAS_DETACH_TYPE_FROM_UE_EPS_DETACH:
|
||||||
case NAS_DETACH_TYPE_FROM_UE_EPS_DETACH:
|
ogs_debug(" EPS Detach");
|
||||||
ogs_debug(" EPS Detach");
|
break;
|
||||||
break;
|
/* 0 1 0 : IMSI detach */
|
||||||
/* 0 1 0 : IMSI detach */
|
case NAS_DETACH_TYPE_FROM_UE_IMSI_DETACH:
|
||||||
case NAS_DETACH_TYPE_FROM_UE_IMSI_DETACH:
|
ogs_debug(" IMSI Detach");
|
||||||
ogs_debug(" IMSI Detach");
|
break;
|
||||||
break;
|
case 6: /* 1 1 0 : reserved */
|
||||||
case 6: /* 1 1 0 : reserved */
|
case 7: /* 1 1 1 : reserved */
|
||||||
case 7: /* 1 1 1 : reserved */
|
ogs_warn("Unknown Detach type[%d]",
|
||||||
ogs_warn("Unknown Detach type[%d]",
|
detach_request->detach_type.detach_type);
|
||||||
detach_request->detach_type.detach_type);
|
break;
|
||||||
break;
|
/* 0 1 1 : combined EPS/IMSI detach */
|
||||||
/* 0 1 1 : combined EPS/IMSI detach */
|
case NAS_DETACH_TYPE_FROM_UE_COMBINED_EPS_IMSI_DETACH:
|
||||||
case NAS_DETACH_TYPE_FROM_UE_COMBINED_EPS_IMSI_DETACH:
|
ogs_debug(" Combined EPS/IMSI Detach");
|
||||||
ogs_debug(" Combined EPS/IMSI Detach");
|
default: /* all other values */
|
||||||
default: /* all other values */
|
break;
|
||||||
break;
|
|
||||||
}
|
}
|
||||||
if (detach_request->detach_type.switch_off)
|
if (detach_request->detach_type.switch_off)
|
||||||
ogs_debug(" Switch-Off");
|
ogs_debug(" Switch-Off");
|
||||||
@@ -370,8 +378,7 @@ int emm_handle_service_request(
|
|||||||
* Update KeNB
|
* Update KeNB
|
||||||
*/
|
*/
|
||||||
CLEAR_PAGING_INFO(mme_ue);
|
CLEAR_PAGING_INFO(mme_ue);
|
||||||
if (SECURITY_CONTEXT_IS_VALID(mme_ue))
|
if (SECURITY_CONTEXT_IS_VALID(mme_ue)) {
|
||||||
{
|
|
||||||
mme_kdf_enb(mme_ue->kasme, mme_ue->ul_count.i32, mme_ue->kenb);
|
mme_kdf_enb(mme_ue->kasme, mme_ue->ul_count.i32, mme_ue->kenb);
|
||||||
mme_kdf_nh(mme_ue->kasme, mme_ue->kenb, mme_ue->nh);
|
mme_kdf_nh(mme_ue->kasme, mme_ue->kenb, mme_ue->nh);
|
||||||
mme_ue->nhcc = 1;
|
mme_ue->nhcc = 1;
|
||||||
@@ -440,19 +447,18 @@ int emm_handle_tau_request(
|
|||||||
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
ogs_debug(" OLD E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
||||||
plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id);
|
plmn_id_hexdump(&mme_ue->e_cgi.plmn_id), mme_ue->e_cgi.cell_id);
|
||||||
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
ogs_debug(" TAI[PLMN_ID:%06x,TAC:%d]",
|
||||||
plmn_id_hexdump(&enb_ue->nas.tai.plmn_id), enb_ue->nas.tai.tac);
|
plmn_id_hexdump(&enb_ue->saved.tai.plmn_id), enb_ue->saved.tai.tac);
|
||||||
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
ogs_debug(" E_CGI[PLMN_ID:%06x,CELL_ID:%d]",
|
||||||
plmn_id_hexdump(&enb_ue->nas.e_cgi.plmn_id),
|
plmn_id_hexdump(&enb_ue->saved.e_cgi.plmn_id),
|
||||||
enb_ue->nas.e_cgi.cell_id);
|
enb_ue->saved.e_cgi.cell_id);
|
||||||
|
|
||||||
/* Copy TAI and ECGI from enb_ue */
|
/* Copy TAI and ECGI from enb_ue */
|
||||||
memcpy(&mme_ue->tai, &enb_ue->nas.tai, sizeof(tai_t));
|
memcpy(&mme_ue->tai, &enb_ue->saved.tai, sizeof(tai_t));
|
||||||
memcpy(&mme_ue->e_cgi, &enb_ue->nas.e_cgi, sizeof(e_cgi_t));
|
memcpy(&mme_ue->e_cgi, &enb_ue->saved.e_cgi, sizeof(e_cgi_t));
|
||||||
|
|
||||||
/* Check TAI */
|
/* Check TAI */
|
||||||
served_tai_index = mme_find_served_tai(&mme_ue->tai);
|
served_tai_index = mme_find_served_tai(&mme_ue->tai);
|
||||||
if (served_tai_index < 0)
|
if (served_tai_index < 0) {
|
||||||
{
|
|
||||||
/* Send TAU reject */
|
/* Send TAU reject */
|
||||||
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
ogs_warn("Cannot find Served TAI[PLMN_ID:%06x,TAC:%d]",
|
||||||
plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
plmn_id_hexdump(&mme_ue->tai.plmn_id), mme_ue->tai.tac);
|
||||||
@@ -463,32 +469,27 @@ int emm_handle_tau_request(
|
|||||||
|
|
||||||
/* Store UE specific information */
|
/* Store UE specific information */
|
||||||
if (tau_request->presencemask &
|
if (tau_request->presencemask &
|
||||||
NAS_TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT)
|
NAS_TRACKING_AREA_UPDATE_REQUEST_LAST_VISITED_REGISTERED_TAI_PRESENT) {
|
||||||
{
|
|
||||||
nas_tracking_area_identity_t *last_visited_registered_tai =
|
nas_tracking_area_identity_t *last_visited_registered_tai =
|
||||||
&tau_request->last_visited_registered_tai;
|
&tau_request->last_visited_registered_tai;
|
||||||
|
|
||||||
nas_to_plmn_id(
|
nas_to_plmn_id(&mme_ue->visited_plmn_id,
|
||||||
&mme_ue->visited_plmn_id, &last_visited_registered_tai->plmn_id);
|
&last_visited_registered_tai->nas_plmn_id);
|
||||||
ogs_debug(" Visited_PLMN_ID:%06x",
|
ogs_debug(" Visited_PLMN_ID:%06x",
|
||||||
plmn_id_hexdump(&mme_ue->visited_plmn_id));
|
plmn_id_hexdump(&mme_ue->visited_plmn_id));
|
||||||
}
|
} else {
|
||||||
else
|
|
||||||
{
|
|
||||||
memcpy(&mme_ue->visited_plmn_id, &mme_ue->tai.plmn_id, PLMN_ID_LEN);
|
memcpy(&mme_ue->visited_plmn_id, &mme_ue->tai.plmn_id, PLMN_ID_LEN);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tau_request->presencemask &
|
if (tau_request->presencemask &
|
||||||
NAS_TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT)
|
NAS_TRACKING_AREA_UPDATE_REQUEST_UE_NETWORK_CAPABILITY_PRESENT) {
|
||||||
{
|
|
||||||
memcpy(&mme_ue->ue_network_capability,
|
memcpy(&mme_ue->ue_network_capability,
|
||||||
&tau_request->ue_network_capability,
|
&tau_request->ue_network_capability,
|
||||||
sizeof(tau_request->ue_network_capability));
|
sizeof(tau_request->ue_network_capability));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (tau_request->presencemask &
|
if (tau_request->presencemask &
|
||||||
NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT)
|
NAS_TRACKING_AREA_UPDATE_REQUEST_MS_NETWORK_CAPABILITY_PRESENT) {
|
||||||
{
|
|
||||||
memcpy(&mme_ue->ms_network_capability,
|
memcpy(&mme_ue->ms_network_capability,
|
||||||
&tau_request->ms_network_capability,
|
&tau_request->ms_network_capability,
|
||||||
sizeof(tau_request->ms_network_capability));
|
sizeof(tau_request->ms_network_capability));
|
||||||
@@ -498,34 +499,31 @@ int emm_handle_tau_request(
|
|||||||
* 1) Consider if MME is changed or not.
|
* 1) Consider if MME is changed or not.
|
||||||
* 2) Consider if SGW is changed or not.
|
* 2) Consider if SGW is changed or not.
|
||||||
*/
|
*/
|
||||||
switch(eps_mobile_identity->imsi.type)
|
switch (eps_mobile_identity->imsi.type) {
|
||||||
|
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
||||||
{
|
{
|
||||||
case NAS_EPS_MOBILE_IDENTITY_GUTI:
|
nas_eps_mobile_identity_guti_t *nas_eps_mobile_identity_guti =
|
||||||
{
|
&eps_mobile_identity->guti;
|
||||||
nas_eps_mobile_identity_guti_t *nas_guti = NULL;
|
nas_guti_t nas_guti;
|
||||||
nas_guti = &eps_mobile_identity->guti;
|
|
||||||
guti_t guti;
|
|
||||||
|
|
||||||
guti.plmn_id = nas_guti->plmn_id;
|
nas_guti.nas_plmn_id = nas_eps_mobile_identity_guti->nas_plmn_id;
|
||||||
guti.mme_gid = nas_guti->mme_gid;
|
nas_guti.mme_gid = nas_eps_mobile_identity_guti->mme_gid;
|
||||||
guti.mme_code = nas_guti->mme_code;
|
nas_guti.mme_code = nas_eps_mobile_identity_guti->mme_code;
|
||||||
guti.m_tmsi = nas_guti->m_tmsi;
|
nas_guti.m_tmsi = nas_eps_mobile_identity_guti->m_tmsi;
|
||||||
|
|
||||||
ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]",
|
ogs_debug(" GUTI[G:%d,C:%d,M_TMSI:0x%x] IMSI:[%s]",
|
||||||
guti.mme_gid,
|
nas_guti.mme_gid,
|
||||||
guti.mme_code,
|
nas_guti.mme_code,
|
||||||
guti.m_tmsi,
|
nas_guti.m_tmsi,
|
||||||
MME_UE_HAVE_IMSI(mme_ue)
|
MME_UE_HAVE_IMSI(mme_ue)
|
||||||
? mme_ue->imsi_bcd : "Unknown");
|
? mme_ue->imsi_bcd : "Unknown");
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
{
|
ogs_warn("Not implemented[%d]",
|
||||||
ogs_warn("Not implemented[%d]",
|
eps_mobile_identity->imsi.type);
|
||||||
eps_mobile_identity->imsi.type);
|
|
||||||
|
return OGS_OK;
|
||||||
return OGS_OK;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return OGS_OK;
|
return OGS_OK;
|
||||||
52
src/mme/emm-handler.h
Normal file
52
src/mme/emm-handler.h
Normal file
@@ -0,0 +1,52 @@
|
|||||||
|
/*
|
||||||
|
* 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/>.
|
||||||
|
*/
|
||||||
|
|
||||||
|
#ifndef EMM_HANDLER_H
|
||||||
|
#define EMM_HANDLER_H
|
||||||
|
|
||||||
|
#include "nas/nas-message.h"
|
||||||
|
|
||||||
|
#include "mme-context.h"
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
int emm_handle_attach_request(
|
||||||
|
mme_ue_t *mme_ue, nas_attach_request_t *attach_request);
|
||||||
|
int emm_handle_attach_complete(
|
||||||
|
mme_ue_t *mme_ue, nas_attach_complete_t *attach_complete);
|
||||||
|
|
||||||
|
int emm_handle_identity_response(
|
||||||
|
mme_ue_t *mme_ue, nas_identity_response_t *identity_response);
|
||||||
|
|
||||||
|
int emm_handle_detach_request(
|
||||||
|
mme_ue_t *mme_ue, nas_detach_request_from_ue_t *detach_request);
|
||||||
|
|
||||||
|
int emm_handle_service_request(
|
||||||
|
mme_ue_t *mme_ue, nas_service_request_t *service_request);
|
||||||
|
|
||||||
|
int emm_handle_tau_request(
|
||||||
|
mme_ue_t *mme_ue, nas_tracking_area_update_request_t *tau_request);
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
|
|
||||||
|
#endif /* EMM_HANDLER_H */
|
||||||
@@ -1,19 +1,19 @@
|
|||||||
#include "nas/nas_message.h"
|
#include "nas/nas-message.h"
|
||||||
#include "fd/fd_lib.h"
|
#include "fd/fd-lib.h"
|
||||||
#include "fd/s6a/s6a_message.h"
|
#include "fd/s6a/s6a-message.h"
|
||||||
|
|
||||||
#include "mme_event.h"
|
#include "mme-event.h"
|
||||||
#include "mme_kdf.h"
|
#include "mme-kdf.h"
|
||||||
#include "s1ap_handler.h"
|
#include "s1ap-handler.h"
|
||||||
#include "mme_fd_path.h"
|
#include "mme-fd-path.h"
|
||||||
#include "emm_handler.h"
|
#include "emm-handler.h"
|
||||||
#include "emm_build.h"
|
#include "emm-build.h"
|
||||||
#include "esm_handler.h"
|
#include "esm-handler.h"
|
||||||
#include "nas_path.h"
|
#include "nas-path.h"
|
||||||
#include "s1ap_path.h"
|
#include "s1ap-path.h"
|
||||||
#include "mme_gtp_path.h"
|
#include "mme-gtp-path.h"
|
||||||
#include "mme_path.h"
|
#include "mme-path.h"
|
||||||
#include "mme_sm.h"
|
#include "mme-sm.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __emm_log_domain
|
#define OGS_LOG_DOMAIN __emm_log_domain
|
||||||
@@ -1,33 +0,0 @@
|
|||||||
#ifndef __EMM_HANDLER_H__
|
|
||||||
#define __EMM_HANDLER_H__
|
|
||||||
|
|
||||||
#include "nas/nas_message.h"
|
|
||||||
|
|
||||||
#include "mme_context.h"
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
extern "C" {
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
int emm_handle_attach_request(
|
|
||||||
mme_ue_t *mme_ue, nas_attach_request_t *attach_request);
|
|
||||||
int emm_handle_attach_complete(
|
|
||||||
mme_ue_t *mme_ue, nas_attach_complete_t *attach_complete);
|
|
||||||
|
|
||||||
int emm_handle_identity_response(
|
|
||||||
mme_ue_t *mme_ue, nas_identity_response_t *identity_response);
|
|
||||||
|
|
||||||
int emm_handle_detach_request(
|
|
||||||
mme_ue_t *mme_ue, nas_detach_request_from_ue_t *detach_request);
|
|
||||||
|
|
||||||
int emm_handle_service_request(
|
|
||||||
mme_ue_t *mme_ue, nas_service_request_t *service_request);
|
|
||||||
|
|
||||||
int emm_handle_tau_request(
|
|
||||||
mme_ue_t *mme_ue, nas_tracking_area_update_request_t *tau_request);
|
|
||||||
|
|
||||||
#ifdef __cplusplus
|
|
||||||
}
|
|
||||||
#endif /* __cplusplus */
|
|
||||||
|
|
||||||
#endif /* __EMM_HANDLER_H__ */
|
|
||||||
@@ -1,8 +1,8 @@
|
|||||||
#include "nas/nas_message.h"
|
#include "nas/nas-message.h"
|
||||||
|
|
||||||
#include "nas_security.h"
|
#include "nas-security.h"
|
||||||
#include "esm_build.h"
|
#include "esm-build.h"
|
||||||
#include "mme_sm.h"
|
#include "mme-sm.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __esm_log_domain
|
#define OGS_LOG_DOMAIN __esm_log_domain
|
||||||
@@ -1,7 +1,7 @@
|
|||||||
#ifndef __ESM_BUILD_H__
|
#ifndef __ESM_BUILD_H__
|
||||||
#define __ESM_BUILD_H__
|
#define __ESM_BUILD_H__
|
||||||
|
|
||||||
#include "mme_context.h"
|
#include "mme-context.h"
|
||||||
|
|
||||||
#ifdef __cplusplus
|
#ifdef __cplusplus
|
||||||
extern "C" {
|
extern "C" {
|
||||||
@@ -1,10 +1,11 @@
|
|||||||
#include "nas/nas_message.h"
|
#include "nas/nas-message.h"
|
||||||
|
|
||||||
#include "mme_context.h"
|
#include "mme-context.h"
|
||||||
#include "nas_path.h"
|
#include "nas-path.h"
|
||||||
#include "mme_gtp_path.h"
|
#include "sgsap-path.h"
|
||||||
|
#include "mme-gtp-path.h"
|
||||||
|
|
||||||
#include "esm_build.h"
|
#include "esm-build.h"
|
||||||
|
|
||||||
#undef OGS_LOG_DOMAIN
|
#undef OGS_LOG_DOMAIN
|
||||||
#define OGS_LOG_DOMAIN __esm_log_domain
|
#define OGS_LOG_DOMAIN __esm_log_domain
|
||||||
@@ -130,8 +131,13 @@ int esm_handle_information_response(mme_sess_t *sess,
|
|||||||
ogs_debug(" APN[%s]", sess->pdn->apn);
|
ogs_debug(" APN[%s]", sess->pdn->apn);
|
||||||
if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue))
|
if (SESSION_CONTEXT_IS_AVAILABLE(mme_ue))
|
||||||
{
|
{
|
||||||
rv = nas_send_attach_accept(mme_ue);
|
mme_vlr_t *vlr = mme_vlr_find_by_tai(&mme_ue->tai);
|
||||||
ogs_assert(rv == OGS_OK);
|
mme_ue->vlr = vlr;
|
||||||
|
|
||||||
|
if (vlr)
|
||||||
|
sgsap_send_location_update_request(mme_ue);
|
||||||
|
else
|
||||||
|
nas_send_attach_accept(mme_ue);
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user