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

Class ThreeBytesField

scapy/fields.py:1068–1079  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1066
1067
1068class ThreeBytesField(Field[int, int]):
1069 def __init__(self, name, default):
1070 # type: (str, int) -> None
1071 Field.__init__(self, name, default, "!I")
1072
1073 def addfield(self, pkt, s, val):
1074 # type: (Packet, bytes, Optional[int]) -> bytes
1075 return s + struct.pack(self.fmt, self.i2m(pkt, val))[1:4]
1076
1077 def getfield(self, pkt, s):
1078 # type: (Packet, bytes) -> Tuple[bytes, int]
1079 return s[3:], self.m2i(pkt, struct.unpack(self.fmt, b"\x00" + s[:3])[0]) # noqa: E501
1080
1081
1082class X3BytesField(ThreeBytesField, XByteField):

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…