MCPcopy Create free account
hub / github.com/secdev/scapy / APNStrLenField

Class APNStrLenField

scapy/contrib/gtp.py:607–627  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

605
606
607class APNStrLenField(StrLenField):
608 # Inspired by DNSStrField
609 def m2i(self, pkt, s):
610 ret_s = b""
611 tmp_s = s
612 while tmp_s:
613 tmp_len = orb(tmp_s[0]) + 1
614 if tmp_len > len(tmp_s):
615 warning("APN prematured end of character-string (size=%i, remaining bytes=%i)" % (tmp_len, len(tmp_s))) # noqa: E501
616 ret_s += tmp_s[1:tmp_len]
617 tmp_s = tmp_s[tmp_len:]
618 if len(tmp_s):
619 ret_s += b"."
620 s = ret_s
621 return s
622
623 def i2m(self, pkt, s):
624 if not isinstance(s, bytes):
625 s = bytes_encode(s)
626 s = b"".join(chb(len(x)) + x for x in s.split(b"."))
627 return s
628
629
630class IE_AccessPointName(IE_Base):

Callers 1

IE_AccessPointNameClass · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…