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

Method i2m

scapy/fields.py:2196–2212  ·  view source on GitHub ↗
(self, pkt, x)

Source from the content-addressed store, hash-verified

2194 self.adjust = adjust
2195
2196 def i2m(self, pkt, x):
2197 # type: (Optional[Packet], Optional[int]) -> int
2198 if x is None and pkt is not None:
2199 if self.length_of is not None:
2200 fld, fval = pkt.getfield_and_val(self.length_of)
2201 f = fld.i2len(pkt, fval)
2202 elif self.count_of is not None:
2203 fld, fval = pkt.getfield_and_val(self.count_of)
2204 f = fld.i2count(pkt, fval)
2205 else:
2206 raise ValueError(
2207 "Field should have either length_of or count_of"
2208 )
2209 x = self.adjust(pkt, f)
2210 elif x is None:
2211 x = 0
2212 return x
2213
2214
2215class StrNullField(StrField):

Callers

nothing calls this directly

Calls 3

getfield_and_valMethod · 0.45
i2lenMethod · 0.45
i2countMethod · 0.45

Tested by

no test coverage detected