Convert internal value to a length usable by a FieldLenField
(self,
pkt, # type: Packet
x, # type: Any
)
| 180 | self.owners.append(cls) |
| 181 | |
| 182 | def i2len(self, |
| 183 | pkt, # type: Packet |
| 184 | x, # type: Any |
| 185 | ): |
| 186 | # type: (...) -> int |
| 187 | """Convert internal value to a length usable by a FieldLenField""" |
| 188 | if isinstance(x, RawVal): |
| 189 | return len(x) |
| 190 | return self.sz |
| 191 | |
| 192 | def i2count(self, pkt, x): |
| 193 | # type: (Optional[Packet], I) -> int |