NAS-5GS is added

This commit is contained in:
Sukchan Lee
2020-05-21 21:24:21 -04:00
parent 3b19cd85cc
commit a9eaed18aa
135 changed files with 18180 additions and 4552 deletions

Binary file not shown.

View File

@@ -0,0 +1,16 @@
* Install python-pip
user@host ~/Documents/git/open5gs/lib/gtp/support$ \
sudo apt-get install python-pip
* Install python-docx
user@host ~/Documents/git/open5gs/lib/gtp/support$ \
sudo pip install python-docx
* Change the format of standard specification
from 24301-d80.doc to 24301-d80.docx
using Microsoft Office 2007+
* Generate Message support files
user@host ~/Documents/git/open5gs/lib/s1ap/support$ \
python nas-message.py -f 24501-g41.docx -o ..

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "Access type", "type" : "Access type", "reference" : "9.11.2.1A", "presence" : "M", "format" : "V", "length" : "1/2"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,12 @@
ies = []
ies.append({ "iei" : "", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "M", "format" : "LV-E", "length" : "3-65537"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "59", "value" : "Old PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "8", "value" : "Request type", "type" : "Request type", "reference" : "9.11.3.47", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"})
ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "A-", "value" : "MA PDU session information", "type" : "MA PDU session information", "reference" : "9.11.3.31A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,8 @@
ies = []
ies.append({ "iei" : "", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "M", "format" : "LV-E", "length" : "3-65537"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "58", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,12 @@
ies = []
ies.append({ "iei" : "", "value" : "Control plane service type", "type" : "Control plane service type", "reference" : "9.11.3.18D", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "6F", "value" : "CIoT small data container", "type" : "CIoT small data container", "reference" : "9.11.3.18B", "presence" : "O", "format" : "TLV", "length" : "4-257"})
ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "M", "format" : "LV", "length" : "2-5"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,14 @@
ies = []
ies.append({ "iei" : "", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "M", "format" : "V", "length" : "2"})
ies.append({ "iei" : "9-", "value" : "PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "A-", "value" : "SSC mode", "type" : "SSC mode", "reference" : "9.11.4.16", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "39", "value" : "SM PDU DN request container", "type" : "SM PDU DN request container", "reference" : "9.11.4.15", "presence" : "O", "format" : "TLV", "length" : "3-255"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
ies.append({ "iei" : "6E", "value" : "DS-TT Ethernet port MAC address", "type" : "DS-TT Ethernet port MAC address", "reference" : "9.11.4.25", "presence" : "O", "format" : "TLV", "length" : "8"})
ies.append({ "iei" : "6F", "value" : "UE-DS-TT residence time", "type" : "UE-DS-TT residence time", "reference" : "9.11.4.26", "presence" : "O", "format" : "TLV", "length" : "10"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,20 @@
ies = []
ies.append({ "iei" : "", "value" : "Selected PDU session type", "type" : "PDU session type", "reference" : "9.11.4.11", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "M", "format" : "LV-E", "length" : "6-65538"})
ies.append({ "iei" : "", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "M", "format" : "LV", "length" : "7"})
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "29", "value" : "PDU address", "type" : "PDU address", "reference" : "9.11.4.10", "presence" : "O", "format" : "TLV", "length" : "7, 11 or 15"})
ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "22", "value" : "S-NSSAI", "type" : "S-NSSAI", "reference" : "9.11.2.8", "presence" : "O", "format" : "TLV", "length" : "3-10"})
ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "25", "value" : "DNN", "type" : "DNN", "reference" : "9.11.2.1B", "presence" : "O", "format" : "TLV", "length" : "3-102"})
ies.append({ "iei" : "17", "value" : "5GSM network feature support", "type" : "5GSM network feature support", "reference" : "9.11.4.18", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "18", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "C-", "value" : "Control plane only indication", "type" : "Control plane only indication", "reference" : "9.11.4.23", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,9 @@
ies = []
ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "F-", "value" : "Allowed SSC mode", "type" : "Allowed SSC mode", "reference" : "9.11.4.5", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,13 @@
ies = []
ies.append({ "iei" : "28", "value" : "5GSM capability", "type" : "5GSM capability", "reference" : "9.11.4.1", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "55", "value" : "Maximum number of supported packet filters", "type" : "Maximum number of supported packet filters", "reference" : "9.11.4.9", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "B-", "value" : "Always-on PDU session requested", "type" : "Always-on PDU session requested", "reference" : "9.11.4.4", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "13", "value" : "Integrity protection maximum data rate", "type" : "Integrity protection maximum data rate", "reference" : "9.11.4.7", "presence" : "O", "format" : "TV", "length" : "3"})
ies.append({ "iei" : "7A", "value" : "Requested QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "79", "value" : "Requested QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"})
ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "37", "value" : "Back-off timer value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "1D", "value" : "Re-attempt indicator", "type" : "Re-attempt indicator", "reference" : "9.11.4.17", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "61", "value" : "5GSM congestion re-attempt indicator", "type" : "5GSM congestion re-attempt indicator", "reference" : "9.11.4.21", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,14 @@
ies = []
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "2A", "value" : "Session AMBR", "type" : "Session-AMBR", "reference" : "9.11.4.14", "presence" : "O", "format" : "TLV", "length" : "8"})
ies.append({ "iei" : "56", "value" : "RQ timer value", "type" : "GPRS timer", "reference" : "9.11.2.3", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "8-", "value" : "Always-on PDU session indication", "type" : "Always-on PDU session indication", "reference" : "9.11.4.3", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7A", "value" : "Authorized QoS rules", "type" : "QoS rules", "reference" : "9.11.4.13", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "75", "value" : "Mapped EPS bearer contexts", "type" : "Mapped EPS bearer contexts", "reference" : "9.11.4.8", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "79", "value" : "Authorized QoS flow descriptions", "type" : "QoS flow descriptions", "reference" : "9.11.4.12", "presence" : "O", "format" : "TLV-E", "length" : "6-65538"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "77", "value" : "ATSSS container", "type" : "ATSSS container", "reference" : "9.11.4.22", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "66", "value" : "Header compression configuration", "type" : "Header compression configuration", "reference" : "9.11.4.24", "presence" : "O", "format" : "TLV", "length" : "5-257"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
ies.append({ "iei" : "1E", "value" : "Serving PLMN rate control", "type" : "Serving PLMN rate control", "reference" : "9.11.4.20", "presence" : "O", "format" : "TLV", "length" : "4"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "7C", "value" : "Port management information container", "type" : "Port management information container", "reference" : "9.11.4.27", "presence" : "O", "format" : "TLV-E", "length" : "3-65538"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "59", "value" : "5GSM cause", "type" : "5GSM cause", "reference" : "9.11.4.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "7B", "value" : "Extended protocol configuration options", "type" : "Extended protocol configuration options", "reference" : "9.11.4.6", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
msg_list[key]["ies"] = ies

35
lib/nas/5gs/support/cache/nas-msg-65.py vendored Normal file
View File

@@ -0,0 +1,35 @@
ies = []
ies.append({ "iei" : "", "value" : "5GS registration type", "type" : "5GS registration type", "reference" : "9.11.3.7", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "5GS mobile identity", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "6-n"})
ies.append({ "iei" : "C-", "value" : "Non-current native NAS key set identifier", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "10", "value" : "5GMM capability", "type" : "5GMM capability", "reference" : "9.11.3.1", "presence" : "O", "format" : "TLV", "length" : "3-15"})
ies.append({ "iei" : "2E", "value" : "UE security capability", "type" : "UE security capability", "reference" : "9.11.3.54", "presence" : "O", "format" : "TLV", "length" : "4-10"})
ies.append({ "iei" : "2F", "value" : "Requested NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "52", "value" : "Last visited registered TAI", "type" : "5GS tracking area identity", "reference" : "9.11.3.8", "presence" : "O", "format" : "TV", "length" : "7"})
ies.append({ "iei" : "17", "value" : "S1 UE network capability", "type" : "S1 UE network capability", "reference" : "9.11.3.48", "presence" : "O", "format" : "TLV", "length" : "4-15"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "B-", "value" : "MICO indication", "type" : "MICO indication", "reference" : "9.11.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "2B", "value" : "UE status", "type" : "UE status", "reference" : "9.11.3.56", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "77", "value" : "Additional GUTI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "14"})
ies.append({ "iei" : "25", "value" : "Allowed PDU session status", "type" : "Allowed PDU session status", "reference" : "9.11.3.13", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "18", "value" : "UE usage setting", "type" : "UE usage setting", "reference" : "9.11.3.55", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "51", "value" : "Requested DRX parameters", "type" : "5GS DRX parameters", "reference" : "9.11.3.2A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "70", "value" : "EPS NAS message container", "type" : "EPS NAS message container", "reference" : "9.11.3.24", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "74", "value" : "LADN indication", "type" : "LADN indication", "reference" : "9.11.3.29", "presence" : "O", "format" : "TLV-E", "length" : "3-811"})
ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "9-", "value" : "Network slicing indication", "type" : "Network slicing indication", "reference" : "9.11.3.36", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "53", "value" : "5GS update type", "type" : "5GS update type", "reference" : "9.11.3.9A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "41", "value" : "Mobile station classmark 2", "type" : "Mobile station classmark 2", "reference" : "9.11.3.31C", "presence" : "O", "format" : "TLV", "length" : "5"})
ies.append({ "iei" : "42", "value" : "Supported codecs", "type" : "Supported codec list", "reference" : "9.11.3.51A", "presence" : "O", "format" : "TLV", "length" : "5-n"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "60", "value" : "EPS bearer context status", "type" : "EPS bearer context status", "reference" : "9.11.3.23A", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "6E", "value" : "Requested extended DRX parameters", "type" : "Extended DRX parameters", "reference" : "9.11.3.26A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "67", "value" : "UE radio capability ID", "type" : "UE radio capability ID", "reference" : "9.11.3.68", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "35", "value" : "Requested mapped NSSAI", "type" : "Mapped NSSAI", "reference" : "9.11.3.31B", "presence" : "O", "format" : "TLV", "length" : "3-42"})
ies.append({ "iei" : "48", "value" : "Additional information requested", "type" : "Additional information requested", "reference" : "9.11.3.12A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "1A", "value" : "Requested WUS assistance information", "type" : "WUS assistance information", "reference" : "9.11.3.71", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "A1", "value" : "N5GC indication", "type" : "N5GC indication", "reference" : "9.11.3.72", "presence" : "O", "format" : "T", "length" : "1"})
msg_list[key]["ies"] = ies

40
lib/nas/5gs/support/cache/nas-msg-66.py vendored Normal file
View File

@@ -0,0 +1,40 @@
ies = []
ies.append({ "iei" : "", "value" : "5GS registration result", "type" : "5GS registration result", "reference" : "9.11.3.6", "presence" : "M", "format" : "LV", "length" : "2"})
ies.append({ "iei" : "77", "value" : "5G-GUTI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "14"})
ies.append({ "iei" : "4A", "value" : "Equivalent PLMNs", "type" : "PLMN list", "reference" : "9.11.3.45", "presence" : "O", "format" : "TLV", "length" : "5-47"})
ies.append({ "iei" : "54", "value" : "TAI list", "type" : "5GS tracking area identity list", "reference" : "9.11.3.9", "presence" : "O", "format" : "TLV", "length" : "9-114"})
ies.append({ "iei" : "15", "value" : "Allowed NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "11", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
ies.append({ "iei" : "31", "value" : "Configured NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-146"})
ies.append({ "iei" : "21", "value" : "5GS network feature support", "type" : "5GS network feature support", "reference" : "9.11.3.5", "presence" : "O", "format" : "TLV", "length" : "3-5"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "26", "value" : "PDU session reactivation result", "type" : "PDU session reactivation result", "reference" : "9.11.3.42", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "72", "value" : "PDU session reactivation result error cause", "type" : "PDU session reactivation result error cause", "reference" : "9.11.3.43", "presence" : "O", "format" : "TLV-E", "length" : "5-515"})
ies.append({ "iei" : "79", "value" : "LADN information", "type" : "LADN information", "reference" : "9.11.3.30", "presence" : "O", "format" : "TLV-E", "length" : "12-1715"})
ies.append({ "iei" : "B-", "value" : "MICO indication", "type" : "MICO indication", "reference" : "9.11.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "9-", "value" : "Network slicing indication", "type" : "Network slicing indication", "reference" : "9.11.3.36", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "27", "value" : "Service area list", "type" : "Service area list", "reference" : "9.11.3.49", "presence" : "O", "format" : "TLV", "length" : "6-114"})
ies.append({ "iei" : "5E", "value" : "T3512 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "5D", "value" : "Non-3GPP de-registration timer value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "16", "value" : "T3502 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "34", "value" : "Emergency number list", "type" : "Emergency number list", "reference" : "9.11.3.23", "presence" : "O", "format" : "TLV", "length" : "5-50"})
ies.append({ "iei" : "7A", "value" : "Extended emergency number list", "type" : "Extended emergency number list", "reference" : "9.11.3.26", "presence" : "O", "format" : "TLV-E", "length" : "7-65538"})
ies.append({ "iei" : "73", "value" : "SOR transparent container", "type" : "SOR transparent container", "reference" : "9.11.3.51", "presence" : "O", "format" : "TLV-E", "length" : "20-n"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "A-", "value" : "NSSAI inclusion mode", "type" : "NSSAI inclusion mode", "reference" : "9.11.3.37A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "76", "value" : "Operator-defined access category definitions", "type" : "Operator-defined access category definitions", "reference" : "9.11.3.38", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "51", "value" : "Negotiated DRX parameters", "type" : "5GS DRX parameters", "reference" : "9.11.3.2A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "D-", "value" : "Non-3GPP NW policies", "type" : "Non-3GPP NW provided policies", "reference" : "9.11.3.36A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "60", "value" : "EPS bearer context status", "type" : "EPS bearer context status", "reference" : "9.11.3.23A", "presence" : "O", "format" : "TLV", "length" : "4"})
ies.append({ "iei" : "6E", "value" : "Negotiated extended DRX parameters", "type" : "Extended DRX parameters", "reference" : "9.11.3.26A", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6C", "value" : "T3447 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6B", "value" : "T3448 value", "type" : "GPRS timer 3", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6A", "value" : "T3324 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "67", "value" : "UE radio capability ID", "type" : "UE radio capability ID", "reference" : "9.11.3.68", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "68", "value" : "UE radio capability ID deletion indication", "type" : "UE radio capability ID deletion indication", "reference" : "9.11.3.69", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "39", "value" : "Pending NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "74", "value" : "Ciphering key data", "type" : "Ciphering key data", "reference" : "9.11.3.18C", "presence" : "O", "format" : "TLV-E", "length" : "x-n"})
ies.append({ "iei" : "75", "value" : "CAG information list", "type" : "CAG information list", "reference" : "9.11.3.18A", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "1B", "value" : "Truncated 5G-S-TMSI configuration", "type" : "Truncated 5G-S-TMSI configuration", "reference" : "9.11.3.70", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "1C", "value" : "Negotiated WUS assistance information", "type" : "WUS assistance information", "reference" : "9.11.3.71", "presence" : "O", "format" : "TLV", "length" : "3-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "73", "value" : "SOR transparent container", "type" : "SOR transparent container", "reference" : "9.11.3.51", "presence" : "O", "format" : "TLV-E", "length" : "20"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "5F", "value" : "T3346 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "16", "value" : "T3502 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "69", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "De-registration type", "type" : "De-registration type", "reference" : "9.11.3.20", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "5GS mobile identity", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "6-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,2 @@
ies = []
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,6 @@
ies = []
ies.append({ "iei" : "", "value" : "De-registration type", "type" : "De-registration type", "reference" : "9.11.3.20", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "58", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "5F", "value" : "T3346 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "6D", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,2 @@
ies = []
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,8 @@
ies = []
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "5G-S-TMSI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "9"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "25", "value" : "Allowed PDU session status", "type" : "Allowed PDU session status", "reference" : "9.11.3.13", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "5F", "value" : "T3346 value", "type" : "GPRS timer 2", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "6B", "value" : "T3448 value", "type" : "GPRS timer 3", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "26", "value" : "PDU session reactivation result", "type" : "PDU session reactivation result", "reference" : "9.11.3.42", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "72", "value" : "PDU session reactivation result error cause", "type" : "PDU session reactivation result error cause", "reference" : "9.11.3.43", "presence" : "O", "format" : "TLV-E", "length" : "5-515"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "6B", "value" : "T3448 value", "type" : "GPRS timer 3", "reference" : "9.11.2.4", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

25
lib/nas/5gs/support/cache/nas-msg-84.py vendored Normal file
View File

@@ -0,0 +1,25 @@
ies = []
ies.append({ "iei" : "D-", "value" : "Configuration update indication", "type" : "Configuration update indication", "reference" : "9.11.3.18", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "77", "value" : "5G-GUTI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "14"})
ies.append({ "iei" : "54", "value" : "TAI list", "type" : "5GS tracking area identity list", "reference" : "9.11.3.9", "presence" : "O", "format" : "TLV", "length" : "9-114"})
ies.append({ "iei" : "15", "value" : "Allowed NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-74"})
ies.append({ "iei" : "27", "value" : "Service area list", "type" : "Service area list", "reference" : "9.11.3.49", "presence" : "O", "format" : "TLV", "length" : "6-114"})
ies.append({ "iei" : "43", "value" : "Full name for network", "type" : "Network name", "reference" : "9.11.3.35", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "45", "value" : "Short name for network", "type" : "Network name", "reference" : "9.11.3.35", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "46", "value" : "Local time zone", "type" : "Time zone", "reference" : "9.11.3.52", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "47", "value" : "Universal time and local time zone", "type" : "Time zone and time", "reference" : "9.11.3.53", "presence" : "O", "format" : "TV", "length" : "8"})
ies.append({ "iei" : "49", "value" : "Network daylight saving time", "type" : "Daylight saving time", "reference" : "9.11.3.19", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "79", "value" : "LADN information", "type" : "LADN information", "reference" : "9.11.3.30", "presence" : "O", "format" : "TLV-E", "length" : "3-1715"})
ies.append({ "iei" : "B-", "value" : "MICO indication", "type" : "MICO indication", "reference" : "9.11.3.31", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "9-", "value" : "Network slicing indication", "type" : "Network slicing indication", "reference" : "9.11.3.36", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "31", "value" : "Configured NSSAI", "type" : "NSSAI", "reference" : "9.11.3.37", "presence" : "O", "format" : "TLV", "length" : "4-146"})
ies.append({ "iei" : "11", "value" : "Rejected NSSAI", "type" : "Rejected NSSAI", "reference" : "9.11.3.46", "presence" : "O", "format" : "TLV", "length" : "4-42"})
ies.append({ "iei" : "76", "value" : "Operator-defined access category definitions", "type" : "Operator-defined access category definitions", "reference" : "9.11.3.38", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "F-", "value" : "SMS indication", "type" : "SMS indication", "reference" : "9.11.3.50A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "6C", "value" : "T3447 value", "type" : "GPRS timer 3", "reference" : "9.11.2.5", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "75", "value" : "CAG information list", "type" : "CAG information list", "reference" : "9.11.3.18A", "presence" : "O", "format" : "TLV-E", "length" : "3-n"})
ies.append({ "iei" : "67", "value" : "UE radio capability ID", "type" : "UE radio capability ID", "reference" : "9.11.3.68", "presence" : "O", "format" : "TLV", "length" : "3-n"})
ies.append({ "iei" : "68", "value" : "UE radio capability ID deletion indication", "type" : "UE radio capability ID deletion indication", "reference" : "9.11.3.69", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "44", "value" : "5GS registration result", "type" : "5GS registration result", "reference" : "9.11.3.6", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "1B", "value" : "Truncated 5G-S-TMSI configuration", "type" : "Truncated 5G-S-TMSI configuration", "reference" : "9.11.3.70", "presence" : "O", "format" : "TLV", "length" : "3"})
msg_list[key]["ies"] = ies

12
lib/nas/5gs/support/cache/nas-msg-85.py vendored Normal file
View File

@@ -0,0 +1,12 @@
ies = []
ies.append({ "iei" : "", "value" : "Control plane service type", "type" : "Control plane service type", "reference" : "9.11.3.18D", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "6F", "value" : "CIoT small data container", "type" : "CIoT small data container", "reference" : "9.11.3.18B", "presence" : "O", "format" : "TLV", "length" : "4-257"})
ies.append({ "iei" : "8-", "value" : "Payload container type", "type" : "Payload container type", "reference" : "9.11.3.40", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "7B", "value" : "Payload container", "type" : "Payload container", "reference" : "9.11.3.39", "presence" : "O", "format" : "TLV-E", "length" : "4-65538"})
ies.append({ "iei" : "12", "value" : "PDU session ID", "type" : "PDU session identity 2", "reference" : "9.11.3.41", "presence" : "C", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "50", "value" : "PDU session status", "type" : "PDU session status", "reference" : "9.11.3.44", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "F-", "value" : "Release assistance indication", "type" : "Release assistance indication", "reference" : "9.11.3.46A", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "40", "value" : "Uplink data status", "type" : "Uplink data status", "reference" : "9.11.3.57", "presence" : "O", "format" : "TLV", "length" : "4-34"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "24", "value" : "Additional information", "type" : "Additional information", "reference" : "9.11.2.1", "presence" : "O", "format" : "TLV", "length" : "3-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,7 @@
ies = []
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "ABBA", "type" : "ABBA", "reference" : "9.11.3.10", "presence" : "M", "format" : "LV", "length" : "3-n"})
ies.append({ "iei" : "21", "value" : "Authentication parameter RAND", "type" : "Authentication parameter RAND", "reference" : "9.11.3.16", "presence" : "O", "format" : "TV", "length" : "17"})
ies.append({ "iei" : "20", "value" : "Authentication parameter AUTN", "type" : "Authentication parameter AUTN", "reference" : "9.11.3.15", "presence" : "O", "format" : "TLV", "length" : "18"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "2D", "value" : "Authentication response parameter", "type" : "Authentication response parameter", "reference" : "9.11.3.17", "presence" : "O", "format" : "TLV", "length" : "18"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,4 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "30", "value" : "Authentication failure parameter", "type" : "Authentication failure parameter", "reference" : "9.11.3.14", "presence" : "O", "format" : "TLV", "length" : "16"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,5 @@
ies = []
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "M", "format" : "LV-E", "length" : "6-1502"})
ies.append({ "iei" : "38", "value" : "ABBA", "type" : "ABBA", "reference" : "9.11.3.10", "presence" : "O", "format" : "TLV", "length" : "4-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "Identity type", "type" : "5GS identity type", "reference" : "9.11.3.3", "presence" : "M", "format" : "V", "length" : "1/2"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "Mobile identity", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "M", "format" : "LV-E", "length" : "3-n"})
msg_list[key]["ies"] = ies

11
lib/nas/5gs/support/cache/nas-msg-93.py vendored Normal file
View File

@@ -0,0 +1,11 @@
ies = []
ies.append({ "iei" : "", "value" : "Selected NAS security algorithms", "type" : "security algorithms", "reference" : "9.11.3.34", "presence" : "M", "format" : "V", "length" : "1"})
ies.append({ "iei" : "", "value" : "ngKSI", "type" : "key set identifier", "reference" : "9.11.3.32", "presence" : "M", "format" : "V", "length" : "1/2"})
ies.append({ "iei" : "", "value" : "Replayed UE security capabilities", "type" : "UE security capability", "reference" : "9.11.3.54", "presence" : "M", "format" : "LV", "length" : "3-9"})
ies.append({ "iei" : "E-", "value" : "IMEISV request", "type" : "IMEISV request", "reference" : "9.11.3.28", "presence" : "O", "format" : "TV", "length" : "1"})
ies.append({ "iei" : "57", "value" : "Selected EPS NAS security algorithms", "type" : "EPS NAS security algorithms", "reference" : "9.11.3.25", "presence" : "O", "format" : "TV", "length" : "2"})
ies.append({ "iei" : "36", "value" : "Additional 5G security information", "type" : "Additional 5G security information", "reference" : "9.11.3.12", "presence" : "O", "format" : "TLV", "length" : "3"})
ies.append({ "iei" : "78", "value" : "EAP message", "type" : "EAP message", "reference" : "9.11.2.2", "presence" : "O", "format" : "TLV-E", "length" : "7-1503"})
ies.append({ "iei" : "38", "value" : "ABBA", "type" : "ABBA", "reference" : "9.11.3.10", "presence" : "O", "format" : "TLV", "length" : "4-n"})
ies.append({ "iei" : "19", "value" : "Replayed S1 UE security capabilities", "type" : "S1 UE security capability", "reference" : "9.11.3.48A", "presence" : "O", "format" : "TLV", "length" : "4-7"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,5 @@
ies = []
ies.append({ "iei" : "77", "value" : "IMEISV", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "12"})
ies.append({ "iei" : "71", "value" : "NAS message container", "type" : "message container", "reference" : "9.11.3.33", "presence" : "O", "format" : "TLV-E", "length" : "4-n"})
ies.append({ "iei" : "78", "value" : "non-IMEISV PEI", "type" : "5GS mobile identity", "reference" : "9.11.3.4", "presence" : "O", "format" : "TLV-E", "length" : "7-n"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,3 @@
ies = []
ies.append({ "iei" : "", "value" : "5GMM cause", "type" : "5GMM cause", "reference" : "9.11.3.2", "presence" : "M", "format" : "V", "length" : "1"})
msg_list[key]["ies"] = ies

View File

@@ -0,0 +1,965 @@
# The MIT License
# Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
# This file is part of Open5GS.
# Permission is hereby granted, free of charge, to any person obtaining
# a copy of this software and associated documentation files (the
# "Software"), to deal in the Software without restriction, including
# without limitation the rights to use, copy, modify, merge, publish,
# distribute, sublicense, and/or sell copies of the Software, and to
# permit persons to whom the Software is furnished to do so, subject to
# the following conditions:
# The above copyright notice and this permission notice shall be
# included in all copies or substantial portions of the Software.
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
# EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
# MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
# NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
# LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
# OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
# WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
from docx import Document
import re, os, sys, string
import datetime
import getopt
import getpass
version = "0.2.0"
msg_list = {}
type_list = {}
verbosity = 0
filename = ""
outdir = './'
cachedir = './cache/'
currentdir = './'
FAIL = '\033[91m'
INFO = '\033[93m'
ENDC = '\033[0m'
def d_print(string):
if verbosity > 0:
sys.stdout.write(string)
def d_info(string):
sys.stdout.write(INFO + string + ENDC + "\n")
def d_error(string):
sys.stderr.write(FAIL + string + ENDC + "\n")
sys.exit(0)
def write_file(f, string):
f.write(string)
d_print(string)
def output_header_to_file(f):
now = datetime.datetime.now()
f.write("""/*
* The MIT License
*
* Copyright (C) 2019,2020 by Sukchan Lee <acetcom@gmail.com>
*
* This file is part of Open5GS.
*
* Permission is hereby granted, free of charge, to any person obtaining
* a copy of this software and associated documentation files (the
* "Software"), to deal in the Software without restriction, including
* without limitation the rights to use, copy, modify, merge, publish,
* distribute, sublicense, and/or sell copies of the Software, and to
* permit persons to whom the Software is furnished to do so, subject to
* the following conditions:
*
* The above copyright notice and this permission notice shall be
* included in all copies or substantial portions of the Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
* EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
* MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
* NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE
* LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION
* OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
* WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
*/
""")
f.write("/*******************************************************************************\n")
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(" * Created on: %s by %s\n * from %s\n" % (str(now), getpass.getuser(), filename))
f.write(" ******************************************************************************/\n\n")
def usage():
print "Python generating NAS Message encoder/decoder v%s" % (version)
print "Usage: python nas-message.py [options]"
print "Available options:"
print "-d Enable script debug"
print "-f [file] Input file to parse"
print "-o [dir] Output files to given directory"
print "-c [dir] Cache files to given directory"
print "-h Print this help and return"
def v_upper(v):
return re.sub('_TO_UE', '', re.sub('_FROM_UE', '', re.sub('\'', '_', re.sub('/', '_', re.sub('-', '_', re.sub(' ', '_', v)))).upper()))
def v_lower(v):
return re.sub('\'', '_', re.sub('/', '_', re.sub('-', '_', re.sub(' ', '_', v)))).lower()
def get_value(v):
return re.sub('5gs_', '', re.sub('5g_', '', re.sub('5gsm', 'gsm', re.sub('5gmm', 'gmm', re.sub('\'', '_', re.sub('/', '_', re.sub('-', '_', re.sub(' ', '_', v)))).lower()))))
def get_cells(cells):
iei = cells[0].text.encode('ascii', 'ignore')
value = re.sub("\s*$", "", re.sub("\s*\n*\s*\([^\)]*\)*", "", re.sub("'s", "", cells[1].text))).encode('ascii', 'ignore')
type = re.sub("^NAS ", "", re.sub("'s", "", re.sub('\s*\n\s*[a-zA-Z0-9.]*', '', cells[2].text))).encode('ascii', 'ignore')
reference = re.sub('[a-zA-Z0-9\'\-\s]*\n\s*', '', cells[2].text).encode('ascii', 'ignore')
presence = cells[3].text.encode('ascii', 'ignore')
format = cells[4].text.encode('ascii', 'ignore')
length = cells[5].text.encode('ascii', 'ignore')
return { "iei" : iei, "value" : value, "type" : type, "reference" : reference, "presence" : presence, "format" : format, "length" : length }
def write_cells_to_file(name, cells):
write_file(f, name + ".append({ \"iei\" : \"" + cells["iei"] + \
"\", \"value\" : \"" + cells["value"] + \
"\", \"type\" : \"" + cells["type"] + \
"\", \"reference\" : \"" + cells["reference"] + \
"\", \"presence\" : \"" + cells["presence"] + \
"\", \"format\" : \"" + cells["format"] + \
"\", \"length\" : \"" + cells["length"] + "\"})\n")
try:
opts, args = getopt.getopt(sys.argv[1:], "df:ho:c:", ["debug", "file", "help", "output", "cache"])
except getopt.GetoptError as err:
# print help information and exit:
usage()
sys.exit(2)
for o, a in opts:
if o in ("-d", "--debug"):
verbosity = 1
if o in ("-f", "--file"):
filename = a
if o in ("-o", "--output"):
outdir = a
if outdir.rfind('/') != len(outdir):
outdir += '/'
if o in ("-c", "--cache"):
cache = a
if cachedir.rfind('/') != len(cachedir):
cachedir += '/'
if o in ("-h", "--help"):
usage()
sys.exit(2)
# Message Type List
msg_list["REGISTRATION REQUEST"] = { "type" : "65" }
msg_list["REGISTRATION ACCEPT"] = { "type" : "66" }
msg_list["REGISTRATION COMPLETE"] = { "type" : "67" }
msg_list["REGISTRATION REJECT"] = { "type" : "68" }
msg_list["DEREGISTRATION REQUEST FROM UE"] = { "type" : "69" }
msg_list["DEREGISTRATION ACCEPT FROM UE"] = { "type" : "70" }
msg_list["DEREGISTRATION REQUEST TO UE"] = { "type" : "71" }
msg_list["DEREGISTRATION ACCEPT TO UE"] = { "type" : "72" }
msg_list["SERVICE REQUEST"] = { "type" : "76" }
msg_list["SERVICE REJECT"] = { "type" : "77" }
msg_list["SERVICE ACCEPT"] = { "type" : "78" }
msg_list["CONFIGURATION UPDATE COMMAND"] = { "type" : "84" }
msg_list["CONFIGURATION UPDATE COMPLETE"] = { "type" : "85" }
msg_list["AUTHENTICATION REQUEST"] = { "type" : "86" }
msg_list["AUTHENTICATION RESPONSE"] = { "type" : "87" }
msg_list["AUTHENTICATION REJECT"] = { "type" : "88" }
msg_list["AUTHENTICATION FAILURE"] = { "type" : "89" }
msg_list["AUTHENTICATION RESULT"] = { "type" : "90" }
msg_list["IDENTITY REQUEST"] = { "type" : "91" }
msg_list["IDENTITY RESPONSE"] = { "type" : "92" }
msg_list["SECURITY MODE COMMAND"] = { "type" : "93" }
msg_list["SECURITY MODE COMPLETE"] = { "type" : "94" }
msg_list["SECURITY MODE REJECT"] = { "type" : "95" }
msg_list["5GMM STATUS"] = { "type" : "100" }
msg_list["NOTIFICATION"] = { "type" : "101" }
msg_list["NOTIFICATION RESPONSE"] = { "type" : "102" }
msg_list["UL NAS TRANSPORT"] = { "type" : "103" }
msg_list["DL NAS TRANSPORT"] = { "type" : "104" }
msg_list["PDU SESSION ESTABLISHMENT REQUEST"] = { "type" : "193" }
msg_list["PDU SESSION ESTABLISHMENT ACCEPT"] = { "type" : "194" }
msg_list["PDU SESSION ESTABLISHMENT REJECT"] = { "type" : "195" }
msg_list["PDU SESSION AUTHENTICATION COMMAND"] = { "type" : "197" }
msg_list["PDU SESSION AUTHENTICATION COMPLETE"] = { "type" : "198" }
msg_list["PDU SESSION AUTHENTICATION RESULT"] = { "type" : "199" }
msg_list["PDU SESSION MODIFICATION REQUEST"] = { "type" : "201" }
msg_list["PDU SESSION MODIFICATION REJECT"] = { "type" : "202" }
msg_list["PDU SESSION MODIFICATION COMMAND"] = { "type" : "203" }
msg_list["PDU SESSION MODIFICATION COMPLETE"] = { "type" : "204" }
msg_list["PDU SESSION MODIFICATION COMMAND REJECT"] = { "type" : "205" }
msg_list["PDU SESSION RELEASE REQUEST"] = { "type" : "209" }
msg_list["PDU SESSION RELEASE REJECT"] = { "type" : "210" }
msg_list["PDU SESSION RELEASE COMMAND"] = { "type" : "211" }
msg_list["PDU SESSION RELEASE COMPLETE"] = { "type" : "212" }
msg_list["5GSM STATUS"] = { "type" : "214" }
# Table number for Message List
msg_list["AUTHENTICATION REQUEST"]["table"] = 0
msg_list["AUTHENTICATION RESPONSE"]["table"] = 1
msg_list["AUTHENTICATION RESULT"]["table"] = 2
msg_list["AUTHENTICATION FAILURE"]["table"] = 3
msg_list["AUTHENTICATION REJECT"]["table"] = 4
msg_list["REGISTRATION REQUEST"]["table"] = 5
msg_list["REGISTRATION ACCEPT"]["table"] = 6
msg_list["REGISTRATION COMPLETE"]["table"] = 7
msg_list["REGISTRATION REJECT"]["table"] = 8
msg_list["UL NAS TRANSPORT"]["table"] = 9
msg_list["DL NAS TRANSPORT"]["table"] = 10
msg_list["DEREGISTRATION REQUEST FROM UE"]["table"] = 11
msg_list["DEREGISTRATION ACCEPT FROM UE"]["table"] = 12
msg_list["DEREGISTRATION REQUEST TO UE"]["table"] = 13
msg_list["DEREGISTRATION ACCEPT TO UE"]["table"] = 14
msg_list["SERVICE REQUEST"]["table"] = 15
msg_list["SERVICE ACCEPT"]["table"] = 16
msg_list["SERVICE REJECT"]["table"] = 17
msg_list["CONFIGURATION UPDATE COMMAND"]["table"] = 18
msg_list["CONFIGURATION UPDATE COMPLETE"]["table"] = 29
msg_list["IDENTITY REQUEST"]["table"] = 20
msg_list["IDENTITY RESPONSE"]["table"] = 21
msg_list["NOTIFICATION"]["table"] = 22
msg_list["NOTIFICATION RESPONSE"]["table"] = 23
msg_list["SECURITY MODE COMMAND"]["table"] = 24
msg_list["SECURITY MODE COMPLETE"]["table"] = 25
msg_list["SECURITY MODE REJECT"]["table"] = 26
msg_list["5GMM STATUS"]["table"] = 28
msg_list["PDU SESSION ESTABLISHMENT REQUEST"]["table"] = 29
msg_list["PDU SESSION ESTABLISHMENT ACCEPT"]["table"] = 30
msg_list["PDU SESSION ESTABLISHMENT REJECT"]["table"] = 31
msg_list["PDU SESSION AUTHENTICATION COMMAND"]["table"] = 32
msg_list["PDU SESSION AUTHENTICATION COMPLETE"]["table"] = 33
msg_list["PDU SESSION AUTHENTICATION RESULT"]["table"] = 34
msg_list["PDU SESSION MODIFICATION REQUEST"]["table"] = 35
msg_list["PDU SESSION MODIFICATION REJECT"]["table"] = 36
msg_list["PDU SESSION MODIFICATION COMMAND"]["table"] = 37
msg_list["PDU SESSION MODIFICATION COMPLETE"]["table"] = 38
msg_list["PDU SESSION MODIFICATION COMMAND REJECT"]["table"] = 39
msg_list["PDU SESSION RELEASE REQUEST"]["table"] = 40
msg_list["PDU SESSION RELEASE REJECT"]["table"] = 41
msg_list["PDU SESSION RELEASE COMMAND"]["table"] = 42
msg_list["PDU SESSION RELEASE COMPLETE"]["table"] = 43
msg_list["5GSM STATUS"]["table"] = 44
for key in msg_list.keys():
if "table" not in msg_list[key].keys():
continue;
d_info("[" + key + "]")
cachefile = cachedir + "nas-msg-" + msg_list[key]["type"] + ".py"
if os.path.isfile(cachefile) and os.access(cachefile, os.R_OK):
execfile(cachefile)
print "Read from " + cachefile
else:
document = Document(filename)
f = open(cachefile, 'w')
ies = []
write_file(f, "ies = []\n")
table = document.tables[msg_list[key]["table"]]
start_row = 0
for start_row, row in enumerate(table.rows):
cells = get_cells(row.cells);
if cells["type"].find('Message type') != -1:
break
if cells["type"].find('KSI and sequence number') != -1:
start_row -= 1
break
assert start_row <= 4, "Can't find message type"
half_length = True;
for row in table.rows[start_row+1:]:
cells = get_cells(row.cells)
if cells is None:
continue
if cells["length"] == "1/2":
if half_length is True:
half_length = False;
else:
half_length = True;
continue;
ies.append(cells)
write_cells_to_file("ies", cells)
msg_list[key]["ies"] = ies
write_file(f, "msg_list[key][\"ies\"] = ies\n")
f.close()
tmp = [(k, v["type"]) for k, v in msg_list.items()]
sorted_msg_list = sorted(tmp, key=lambda tup: float(tup[1]))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
for ie in msg_list[k]["ies"]:
key = ie["type"]
if key in type_list.keys() and (type_list[key]["presence"] != ie["presence"] or type_list[key]["format"] != ie["format"] or type_list[key]["length"] != ie["length"]):
d_print("KEY type different : %s\n" % key)
d_print("%s.%s %s %s %s\n" % (v_lower(type_list[key]["message"]), type_list[key]["value"], type_list[key]["presence"], type_list[key]["format"], type_list[key]["length"]))
d_print("%s.%s %s %s %s\n\n" % (v_lower(k), ie["value"], ie["presence"], ie["format"], ie["length"]))
continue
type_list[key] = { "reference" : ie["reference"], "presence" : ie["presence"], "format" : ie["format"], "length" : ie["length"], "message" : k, "value" : ie["value"] }
d_info("[Type List]")
typefile = currentdir + "type-list.py"
if os.path.isfile(typefile) and os.access(typefile, os.R_OK):
execfile(typefile)
print "Read from " + typefile
tmp = [(k, v["reference"]) for k, v in type_list.items()]
sorted_type_list = sorted(tmp, key=lambda tup: tup[1])
f = open(outdir + 'ies.h', 'w')
output_header_to_file(f)
f.write("""#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_5GS_IES_H
#define OGS_NAS_5GS_IES_H
#ifdef __cplusplus
extern "C" {
#endif
int ogs_nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type);
""")
for (k, v) in sorted_type_list:
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf);\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("\n")
for (k, v) in sorted_type_list:
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s);\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("\n")
f.write("""#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_IES_H */
""")
f.close()
f = open(outdir + 'ies.c', 'w')
output_header_to_file(f)
f.write("""#include "ogs-nas-5gs.h"
int ogs_nas_encode_optional_type(ogs_pkbuf_t *pkbuf, uint8_t type)
{
uint16_t size = sizeof(uint8_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &type, size);
return size;
}
""")
for (k, v) in sorted_type_list:
# d_print("%s = %s\n" % (k, type_list[k]))
f.write("/* %s %s\n" % (type_list[k]["reference"], k))
f.write(" * %s %s %s */\n" % (type_list[k]["presence"], type_list[k]["format"], type_list[k]["length"]))
if (type_list[k]["format"] == "TV" or type_list[k]["format"] == "T") and type_list[k]["length"] == "1":
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" memcpy(%s, pkbuf->data - 1, 1);\n\n" % get_value(k))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - 1, 1);\n\n");
f.write(" return 0;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, %s, size);\n\n" % get_value(k))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
elif type_list[k]["format"] == "TV" or type_list[k]["format"] == "V":
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
if type_list[k]["length"] == "4":
f.write(" uint16_t size = 3;\n\n")
else:
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n\n" % v_lower(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
if type_list[k]["length"] == "4":
f.write(" uint16_t size = 3;\n")
else:
f.write(" uint16_t size = sizeof(ogs_nas_%s_t);\n" % v_lower(k))
f.write(" ogs_nas_%s_t target;\n\n" % v_lower(k))
f.write(" memcpy(&target, %s, size);\n" % get_value(k))
if "encode" in type_list[k]:
f.write("%s" % type_list[k]["encode"])
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, &target, size);\n\n")
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
elif (type_list[k]["format"] == "LV-E" or type_list[k]["format"] == "TLV-E") and type_list[k]["value"] != "5GS mobile identity":
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = 0;\n")
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = be16toh(source->length);\n" % get_value(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" %s->buffer = pkbuf->data - size + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, (void*)%s->buffer, %s->length);\n\n" % (get_value(k), get_value(k)));
f.write(" return size;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = 0;\n")
f.write(" uint16_t target;\n\n")
f.write(" ogs_assert(%s);\n" % get_value(k))
f.write(" ogs_assert(%s->buffer);\n\n" % get_value(k))
f.write(" size = sizeof(%s->length);\n" % get_value(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" target = htobe16(%s->length);\n" % get_value(k))
f.write(" memcpy(pkbuf->data - size, &target, size);\n\n")
f.write(" size = %s->length;\n" % get_value(k))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, %s->buffer, size);\n\n" % get_value(k))
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return %s->length + sizeof(%s->length);\n" % (get_value(k), get_value(k)))
f.write("}\n\n");
else:
f.write("int ogs_nas_decode_%s(ogs_nas_%s_t *%s, ogs_pkbuf_t *pkbuf)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = 0;\n")
f.write(" ogs_nas_%s_t *source = (ogs_nas_%s_t *)pkbuf->data;\n\n" % (v_lower(k), v_lower(k)))
f.write(" %s->length = source->length;\n" % get_value(k))
f.write(" size = %s->length + sizeof(%s->length);\n\n" % (get_value(k), get_value(k)))
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(%s, pkbuf->data - size, size);\n\n" % get_value(k))
if "decode" in type_list[k]:
f.write("%s" % type_list[k]["decode"])
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n")
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_%s_t *%s)\n" % (v_lower(k), v_lower(k), get_value(k)))
f.write("{\n")
f.write(" uint16_t size = %s->length + sizeof(%s->length);\n" % (get_value(k), get_value(k)))
f.write(" ogs_nas_%s_t target;\n\n" % v_lower(k))
f.write(" memcpy(&target, %s, sizeof(ogs_nas_%s_t));\n" % (get_value(k), v_lower(k)))
if "encode" in type_list[k]:
f.write("%s" % type_list[k]["encode"])
f.write(" ogs_assert(ogs_pkbuf_pull(pkbuf, size));\n")
f.write(" memcpy(pkbuf->data - size, &target, size);\n\n")
f.write(" ogs_trace(\" %s - \");\n" % v_upper(k))
f.write(" ogs_log_hexdump(OGS_LOG_TRACE, pkbuf->data - size, size);\n\n");
f.write(" return size;\n")
f.write("}\n\n");
f.close()
f = open(outdir + 'message.h', 'w')
output_header_to_file(f)
f.write("""#if !defined(OGS_NAS_INSIDE) && !defined(OGS_NAS_COMPILATION)
#error "This header cannot be included directly."
#endif
#ifndef OGS_NAS_5GS_MESSAGE_H
#define OGS_NAS_5GS_MESSAGE_H
#ifdef __cplusplus
extern "C" {
#endif
/* 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. */
#define OGS_NAS_HEADROOM 16
#define OGS_NAS_SECURITY_HEADER_PLAIN_NAS_MESSAGE 0
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED 1
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHERED 2
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_NEW_SECURITY_CONTEXT 3
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_CIPHTERD_WITH_NEW_INTEGRITY_CONTEXT 4
#define OGS_NAS_SECURITY_HEADER_INTEGRITY_PROTECTED_AND_PARTICALLY_CIPHTERD 5
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM 0x2e
#define OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM 0x7e
#define OGS_NAS_PDU_SESSION_IDENTITY_UNASSIGNED 0
#define OGS_NAS_PROCEDURE_TRANSACTION_IDENTITY_UNASSIGNED 0
typedef struct ogs_nas_5gmm_header_s {
uint8_t extended_protocol_discriminator;
uint8_t security_header_type;
uint8_t message_type;
} __attribute__ ((packed)) ogs_nas_5gmm_header_t;
typedef struct ogs_nas_5gsm_header_s {
uint8_t extended_protocol_discriminator;
uint8_t pdu_session_identity;
uint8_t procedure_transaction_identity;
uint8_t message_type;
} __attribute__ ((packed)) ogs_nas_5gsm_header_t;
typedef struct ogs_nas_security_header_s {
uint8_t extended_protocol_discriminator;
uint8_t security_header_type;
uint32_t message_authentication_code;
uint8_t sequence_number;
} __attribute__ ((packed)) ogs_nas_security_header_t;
""")
for (k, v) in sorted_msg_list:
if k.find("TO UE") == -1:
f.write("#define OGS_NAS_" + v_upper(k) + " " + v.split('.')[0] + "\n")
f.write("\n")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue;
f.write("\n/*******************************************************\n")
f.write(" * %s\n" % k)
f.write(" ******************************************************/")
for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]):
f.write("\n#define OGS_NAS_%s_%s_PRESENT ((uint64_t)1<<%d)" % (v_upper(k), v_upper(ie["value"]), i))
for i, ie in enumerate([ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]):
f.write("\n#define OGS_NAS_%s_%s_TYPE 0x%s" % (v_upper(k), v_upper(ie["value"]), re.sub('-', '0', ie["iei"])))
f.write("\n\ntypedef struct ogs_nas_%s_s {\n" % v_lower(k))
mandatory_fields = False;
optional_fields = False;
for ie in msg_list[k]["ies"]:
if ie["presence"] == "M" and mandatory_fields is False:
f.write(" /* Mandatory fields */\n")
mandatory_fields = True;
if ie["presence"] == "O" and optional_fields is False:
f.write("\n /* Optional fields */\n")
f.write(" uint64_t presencemask;\n");
optional_fields = True;
f.write(" ogs_nas_" + v_lower(ie["type"]) + "_t " + \
get_value(ie["value"]) + ";\n")
f.write("} ogs_nas_%s_t;\n\n" % v_lower(k))
f.write("\n")
f.write("""typedef struct ogs_nas_5gmm_message_s {
ogs_nas_5gmm_header_t h;
union {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue;
if float(msg_list[k]["type"]) < 192:
f.write(" ogs_nas_%s_t %s;\n" % (v_lower(k), get_value(k)))
f.write(""" };
} ogs_nas_5gmm_message_t;
typedef struct ogs_nas_5gsm_message_s {
ogs_nas_5gsm_header_t h;
union {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue;
if float(msg_list[k]["type"]) >= 192:
f.write(" ogs_nas_%s_t %s;\n" % (v_lower(k), get_value(k)))
f.write(""" };
} ogs_nas_5gsm_message_t;
typedef struct ogs_nas_message_s {
ogs_nas_security_header_t h;
union {
ogs_nas_5gmm_message_t gmm;
ogs_nas_5gsm_message_t gsm;
};
} ogs_nas_message_t;
ogs_pkbuf_t *ogs_nas_5gmm_encode(ogs_nas_message_t *message);
ogs_pkbuf_t *ogs_nas_5gsm_encode(ogs_nas_message_t *message);
int ogs_nas_5gmm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf);
int ogs_nas_5gsm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf);
ogs_pkbuf_t *ogs_nas_plain_encode(ogs_nas_message_t *message);
#ifdef __cplusplus
}
#endif
#endif /* OGS_NAS_5GS_MESSAGE_H */
""")
f.close()
f = open(outdir + 'decoder.c', 'w')
output_header_to_file(f)
f.write("""#include "ogs-nas-5gs.h"
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_decode_%s(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf);\n" % v_lower(k))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_decode_%s(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf)\n{\n" % v_lower(k))
if float(msg_list[k]["type"]) < 192:
f.write(" ogs_nas_%s_t *%s = &message->gmm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
else:
f.write(" ogs_nas_%s_t *%s = &message->gsm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
f.write(" int decoded = 0;\n")
f.write(" int size = 0;\n\n")
f.write(" ogs_trace(\"[NAS] Decode %s\\n\");\n\n" % v_upper(k))
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]:
f.write(" size = ogs_nas_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" decoded += size;\n\n")
optional_fields = False;
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]:
if optional_fields is False:
f.write(""" while (pkbuf->len > 0) {
uint8_t *buffer = pkbuf->data;
uint8_t type = (*buffer) >= 0x80 ? ((*buffer) & 0xf0) : (*buffer);
size = sizeof(uint8_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
decoded += size;
switch(type) {
""")
optional_fields = True;
f.write(" case OGS_NAS_%s_%s_TYPE:\n" % (v_upper(k), v_upper(ie["value"])))
f.write(" size = ogs_nas_decode_%s(&%s->%s, pkbuf);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" %s->presencemask |= OGS_NAS_%s_%s_PRESENT;\n" % (get_value(k), v_upper(k), v_upper(ie["value"])))
f.write(" decoded += size;\n")
f.write(" break;\n")
if [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]:
f.write(""" default:
ogs_warn("Unknown type(0x%x) or not implemented\\n", type);
break;
}
}
""")
f.write(""" return decoded;
}
""")
f.write("""int ogs_nas_5gmm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf)
{
int size = 0;
uint16_t decoded = 0;
ogs_assert(pkbuf);
ogs_assert(pkbuf->data);
ogs_assert(pkbuf->len);
memset(message, 0, sizeof(ogs_nas_message_t));
size = sizeof(ogs_nas_5gmm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(&message->gmm.h, pkbuf->data - size, size);
decoded += size;
switch(message->gmm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) < 192 and k.find("TO UE") == -1:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" decoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gmm.h.message_type);
break;
}
ogs_assert(ogs_pkbuf_push(pkbuf, decoded));
return OGS_OK;
}
""")
f.write("""int ogs_nas_5gsm_decode(ogs_nas_message_t *message, ogs_pkbuf_t *pkbuf)
{
int size = 0;
uint16_t decoded = 0;
ogs_assert(pkbuf);
ogs_assert(pkbuf->data);
ogs_assert(pkbuf->len);
memset(message, 0, sizeof(ogs_nas_message_t));
size = sizeof(ogs_nas_5gsm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(&message->gsm.h, pkbuf->data - size, size);
decoded += size;
switch(message->gsm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) >= 192:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_decode_%s(message, pkbuf);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" decoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gsm.h.message_type);
break;
}
ogs_assert(ogs_pkbuf_push(pkbuf, decoded));
return OGS_OK;
}
""")
f.close()
f = open(outdir + 'encoder.c', 'w')
output_header_to_file(f)
f.write("""#include "ogs-nas-5gs.h"
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_message_t *message);\n" % v_lower(k))
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if len(msg_list[k]["ies"]) == 0:
continue
f.write("int ogs_nas_encode_%s(ogs_pkbuf_t *pkbuf, ogs_nas_message_t *message)\n{\n" % v_lower(k))
if float(msg_list[k]["type"]) < 192:
f.write(" ogs_nas_%s_t *%s = &message->gmm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
else:
f.write(" ogs_nas_%s_t *%s = &message->gsm.%s;\n" % (v_lower(k), get_value(k), get_value(k)))
f.write(" int encoded = 0;\n")
f.write(" int size = 0;\n\n")
f.write(" ogs_trace(\"[NAS] Encode %s\");\n\n" % v_upper(k))
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "M"]:
f.write(" size = ogs_nas_encode_%s(pkbuf, &%s->%s);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n\n")
for ie in [ies for ies in msg_list[k]["ies"] if ies["presence"] == "O"]:
f.write(" if (%s->presencemask & OGS_NAS_%s_%s_PRESENT) {\n" % (get_value(k), v_upper(k), v_upper(ie["value"])))
if ie["length"] == "1" and ie["format"] == "TV":
f.write(" %s->%s.type = (OGS_NAS_%s_%s_TYPE >> 4);\n\n" % (get_value(k), get_value(ie["value"]), v_upper(k), v_upper(ie["value"])))
elif ie["length"] == "1" and ie["format"] == "T":
f.write(" %s->%s.type = OGS_NAS_%s_%s_TYPE;\n\n" % (get_value(k), get_value(ie["value"]), v_upper(k), v_upper(ie["value"])))
else:
f.write(" size = ogs_nas_encode_optional_type(pkbuf, OGS_NAS_%s_%s_TYPE);\n" % (v_upper(k), v_upper(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n\n")
f.write(" size = ogs_nas_encode_%s(pkbuf, &%s->%s);\n" % (v_lower(ie["type"]), get_value(k), get_value(ie["value"])))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n")
f.write(" }\n\n")
f.write(""" return encoded;
}
""")
f.write("""ogs_pkbuf_t *ogs_nas_5gmm_encode(ogs_nas_message_t *message)
{
ogs_pkbuf_t *pkbuf = NULL;
int size = 0;
int encoded = 0;
ogs_assert(message);
/* 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. */
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
ogs_assert(pkbuf);
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
size = sizeof(ogs_nas_5gmm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &message->gmm.h, size);
encoded += size;
switch(message->gmm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) < 192 and k.find("FROM UE") == -1:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_encode_%s(pkbuf, message);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gmm.h.message_type);
ogs_pkbuf_free(pkbuf);
return NULL;
}
ogs_assert(ogs_pkbuf_push(pkbuf, encoded));
pkbuf->len = encoded;
return pkbuf;
}
""")
f.write("""ogs_pkbuf_t *ogs_nas_5gsm_encode(ogs_nas_message_t *message)
{
ogs_pkbuf_t *pkbuf = NULL;
int size = 0;
int encoded = 0;
ogs_assert(message);
/* 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. */
pkbuf = ogs_pkbuf_alloc(NULL, OGS_MAX_SDU_LEN);
ogs_assert(pkbuf);
ogs_pkbuf_reserve(pkbuf, OGS_NAS_HEADROOM);
ogs_pkbuf_put(pkbuf, OGS_MAX_SDU_LEN-OGS_NAS_HEADROOM);
size = sizeof(ogs_nas_5gsm_header_t);
ogs_assert(ogs_pkbuf_pull(pkbuf, size));
memcpy(pkbuf->data - size, &message->gsm.h, size);
encoded += size;
switch(message->gsm.h.message_type) {
""")
for (k, v) in sorted_msg_list:
if "ies" not in msg_list[k]:
continue;
if float(msg_list[k]["type"]) >= 192:
f.write(" case OGS_NAS_%s:\n" % v_upper(k))
if len(msg_list[k]["ies"]) != 0:
f.write(" size = ogs_nas_encode_%s(pkbuf, message);\n" % v_lower(k))
f.write(" ogs_assert(size >= 0);\n")
f.write(" encoded += size;\n")
f.write(" break;\n")
f.write(""" default:
ogs_error("Unknown message type (0x%x) or not implemented",
message->gsm.h.message_type);
ogs_pkbuf_free(pkbuf);
return NULL;
}
ogs_assert(ogs_pkbuf_push(pkbuf, encoded));
pkbuf->len = encoded;
return pkbuf;
}
ogs_pkbuf_t *ogs_nas_plain_encode(ogs_nas_message_t *message)
{
ogs_assert(message);
ogs_assert(message->gmm.h.extended_protocol_discriminator ==
message->gsm.h.extended_protocol_discriminator);
if (message->gmm.h.extended_protocol_discriminator ==
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_EMM)
return ogs_nas_5gmm_encode(message);
else if (message->gmm.h.extended_protocol_discriminator ==
OGS_NAS_EXTENDED_PROTOCOL_DISCRIMINATOR_ESM)
return ogs_nas_5gsm_encode(message);
return NULL;
}
""")
f.close()

View File

@@ -0,0 +1,53 @@
# 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/>.
type_list["5GS tracking area identity"]["decode"] = \
" tracking_area_identity->tac = be16toh(tracking_area_identity->tac);\n\n"
type_list["5GS tracking area identity"]["encode"] = \
" target.tac = htobe16(tracking_area_identity->tac);\n\n"
type_list["5GS mobile identity"]["decode"] = \
" if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {\n" \
" mobile_identity->guti.m_tmsi = be32toh(mobile_identity->guti.m_tmsi);\n" \
" } else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {\n" \
" mobile_identity->s_tmsi.m_tmsi = be32toh(mobile_identity->s_tmsi.m_tmsi);\n" \
" }\n\n"
type_list["5GS mobile identity"]["encode"] = \
" if (mobile_identity->guti.type == OGS_NAS_5GS_MOBILE_IDENTITY_GUTI) {\n" \
" target.guti.m_tmsi = htobe32(mobile_identity->guti.m_tmsi);\n" \
" target.guti._0xf = 0xf;\n" \
" } else if (mobile_identity->s_tmsi.type == OGS_NAS_5GS_MOBILE_IDENTITY_S_TMSI) {\n" \
" target.s_tmsi.m_tmsi = htobe32(mobile_identity->s_tmsi.m_tmsi);\n" \
" target.s_tmsi._0xf = 0xf;\n" \
" }\n\n"
type_list["Header compression configuration"]["decode"] = \
" header_compression_configuration->max_cid = be16toh(header_compression_configuration->max_cid);\n\n"
type_list["Header compression configuration"]["encode"] = \
" target.max_cid = htobe16(header_compression_configuration->max_cid);\n\n"
type_list["DNN"]["decode"] = \
" {\n" \
" char data_network_name[OGS_MAX_DNN_LEN];\n" \
" dnn->length = ogs_fqdn_parse(data_network_name, dnn->value, dnn->length);\n" \
" ogs_cpystrn(dnn->value, data_network_name, ogs_min(dnn->length, OGS_MAX_DNN_LEN) + 1);\n" \
" }\n\n"
type_list["DNN"]["encode"] = \
" target.length = ogs_fqdn_build(target.value, dnn->value, dnn->length);\n" \
" size = target.length + sizeof(target.length);\n\n"