| 605 | |
| 606 | |
| 607 | class 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 | |
| 630 | class IE_AccessPointName(IE_Base): |
no outgoing calls
no test coverage detected
searching dependent graphs…