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

Method getfield

scapy/fields.py:1886–1891  ·  view source on GitHub ↗
(self, pkt, s)

Source from the content-addressed store, hash-verified

1884 return super(StrFixedLenField, self).i2repr(pkt, v)
1885
1886 def getfield(self, pkt, s):
1887 # type: (Packet, bytes) -> Tuple[bytes, bytes]
1888 len_pkt = self.length_from(pkt)
1889 if len_pkt == 0:
1890 return s, b""
1891 return s[len_pkt:], self.m2i(pkt, s[:len_pkt])
1892
1893 def addfield(self, pkt, s, val):
1894 # type: (Packet, bytes, Optional[bytes]) -> bytes

Callers

nothing calls this directly

Calls 2

length_fromMethod · 0.45
m2iMethod · 0.45

Tested by

no test coverage detected