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

Method i2m

scapy/fields.py:3452–3463  ·  view source on GitHub ↗
(self,
            pkt,  # type: Optional[Packet]
            x  # type: Optional[Tuple[str, int]]
            )

Source from the content-addressed store, hash-verified

3450 return "%s/%i" % (pfx, pfxlen)
3451
3452 def i2m(self,
3453 pkt, # type: Optional[Packet]
3454 x # type: Optional[Tuple[str, int]]
3455 ):
3456 # type: (...) -> Tuple[bytes, int]
3457 # ("fc00:1::1", 64) -> (b"\xfc\x00\x00\x01\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x00\x01", 64) # noqa: E501
3458 if x is None:
3459 pfx, pfxlen = "", 0
3460 else:
3461 (pfx, pfxlen) = x
3462 s = self.aton(pfx)
3463 return (s[:self._numbytes(pfxlen)], pfxlen)
3464
3465 def m2i(self, pkt, x):
3466 # type: (Optional[Packet], Tuple[bytes, int]) -> Tuple[str, int]

Callers 1

addfieldMethod · 0.95

Calls 1

_numbytesMethod · 0.95

Tested by

no test coverage detected