| 1066 | |
| 1067 | |
| 1068 | class 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 | |
| 1082 | class X3BytesField(ThreeBytesField, XByteField): |
no outgoing calls
no test coverage detected
searching dependent graphs…