MCPcopy Index your code
hub / github.com/secdev/scapy / getfield

Method getfield

scapy/fields.py:1605–1619  ·  view source on GitHub ↗
(self,
                 pkt,  # type: Packet
                 s,  # type: bytes
                 )

Source from the content-addressed store, hash-verified

1603 self.length_from = length_from or (lambda x: 0)
1604
1605 def getfield(self,
1606 pkt, # type: Packet
1607 s, # type: bytes
1608 ):
1609 # type: (...) -> Tuple[bytes, Optional[BasePacket]]
1610 len_pkt = self.length_from(pkt)
1611 i = None
1612 if len_pkt:
1613 try:
1614 i = self.m2i(pkt, s[:len_pkt])
1615 except Exception:
1616 if conf.debug_dissector:
1617 raise
1618 i = conf.raw_layer(load=s[:len_pkt])
1619 return s[len_pkt:], i
1620
1621
1622class PacketListField(_PacketField[List[BasePacket]]):

Callers

nothing calls this directly

Calls 2

length_fromMethod · 0.45
m2iMethod · 0.45

Tested by

no test coverage detected