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

Class LenField

scapy/fields.py:2274–2294  ·  view source on GitHub ↗

If None, will be filled with the size of the payload

Source from the content-addressed store, hash-verified

2272
2273
2274class LenField(Field[int, int]):
2275 """
2276 If None, will be filled with the size of the payload
2277 """
2278 __slots__ = ["adjust"]
2279
2280 def __init__(self, name, default, fmt="H", adjust=lambda x: x):
2281 # type: (str, Optional[Any], str, Callable[[int], int]) -> None
2282 Field.__init__(self, name, default, fmt)
2283 self.adjust = adjust
2284
2285 def i2m(self,
2286 pkt, # type: Optional[Packet]
2287 x, # type: Optional[int]
2288 ):
2289 # type: (...) -> int
2290 if x is None:
2291 x = 0
2292 if pkt is not None:
2293 x = self.adjust(len(pkt.payload))
2294 return x
2295
2296
2297class BCDFloatField(Field[float, int]):

Callers 15

rtmsghdrClass · 0.90
RTCPClass · 0.90
DCPIPBlockClass · 0.90
DCPFullIPBlockClass · 0.90
DCPDeviceIDBlockClass · 0.90
DCPDeviceRoleBlockClass · 0.90
DCPOEMIDBlockClass · 0.90
DCPControlBlockClass · 0.90
ProfinetDCPClass · 0.90

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…