From 371ab497ef632c756d8024824acb534859129a15 Mon Sep 17 00:00:00 2001
From: Guillaume Valadon <guillaume@valadon.net>
Date: Thu, 25 Dec 2014 09:46:04 +0100
Subject: [PATCH] User Location Information IE

--HG--
branch : GTP support
---
 scapy/contrib/gtp.py | 18 +++++++++++++++---
 1 file changed, 15 insertions(+), 3 deletions(-)

diff --git a/scapy/contrib/gtp.py b/scapy/contrib/gtp.py
index 804506a8..9582fa3e 100644
--- a/scapy/contrib/gtp.py
+++ b/scapy/contrib/gtp.py
@@ -167,7 +167,6 @@ class IE_Cause(Packet):
     def extract_padding(self, pkt):
         return "",pkt
 
-
 class IE_IMSI(Packet):
     name = "IMSI - Subscriber identity of the MS"
     fields_desc = [ ByteEnumField("ietype", 2, IEType),
@@ -175,7 +174,6 @@ class IE_IMSI(Packet):
     def extract_padding(self, pkt):
         return "",pkt
 
-
 class IE_Routing(Packet):
     name = "Routing Area Identity"
     fields_desc = [ ByteEnumField("ietype", 3, IEType),
@@ -313,6 +311,20 @@ class IE_MSInternationalNumber(Packet):
     def extract_padding(self, pkt):
         return "",pkt
 
+class IE_UserLocationInformation(Packet):
+    name = "User Location Information"
+    fields_desc = [ ByteEnumField("ietype", 152, IEType),
+                    ShortField("length", None),
+                    ByteField("type", 1),
+                    # Only type 1 is currently supported
+                    TBCDByteField("MCC", "", 2),
+                    # MNC: if the third digit of MCC is 0xf, then the length of MNC is 1 byte
+                    TBCDByteField("MNC", "", 1),
+                    ShortField("LAC", None),
+                    ShortField("SAC", None) ]
+    def extract_padding(self, pkt):
+        return "",pkt
+
 class IE_IMEI(Packet):
     name = "IMEI"
     fields_desc = [ ByteEnumField("ietype", 154, IEType),
@@ -333,7 +345,7 @@ ietypecls = {   1: IE_Cause, 2: IE_IMSI, 3: IE_Routing, 15: IE_SelectionMode, 16
                17: IE_TEICP, 19: IE_Teardown, 20: IE_NSAPI, 26: IE_ChargingCharacteristics,
                27: IE_TraceReference, 28: IE_TraceType,
               128: IE_EndUserAddress, 131: IE_AccessPointName, 133: IE_GSNAddress,
-              134: IE_MSInternationalNumber, 154: IE_IMEI } 
+              134: IE_MSInternationalNumber, 152: IE_UserLocationInformation, 154: IE_IMEI } 
 
 def IE_Dispatcher(s):
   """Choose the correct Information Element class."""
-- 
GitLab