Extract an internal value from a string Extract from the raw packet `s` the field value belonging to layer `pkt`. Returns a two-element list, first the raw packet string after having removed the extracted field, second the extracted field itself in internal
(self, pkt, s)
| 247 | ) |
| 248 | |
| 249 | def getfield(self, pkt, s): |
| 250 | # type: (Packet, bytes) -> Tuple[bytes, I] |
| 251 | """Extract an internal value from a string |
| 252 | |
| 253 | Extract from the raw packet `s` the field value belonging to layer |
| 254 | `pkt`. |
| 255 | |
| 256 | Returns a two-element list, |
| 257 | first the raw packet string after having removed the extracted field, |
| 258 | second the extracted field itself in internal representation. |
| 259 | """ |
| 260 | return s[self.sz:], self.m2i(pkt, self.struct.unpack(s[:self.sz])[0]) |
| 261 | |
| 262 | def do_copy(self, x): |
| 263 | # type: (I) -> I |