| 310 | |
| 311 | |
| 312 | class Dot3(Packet): |
| 313 | name = "802.3" |
| 314 | fields_desc = [DestMACField("dst"), |
| 315 | SourceMACField("src"), |
| 316 | LenField("len", None, "H")] |
| 317 | |
| 318 | def extract_padding(self, s): |
| 319 | # type: (bytes) -> Tuple[bytes, bytes] |
| 320 | tmp_len = self.len |
| 321 | return s[:tmp_len], s[tmp_len:] |
| 322 | |
| 323 | def answers(self, other): |
| 324 | # type: (Packet) -> int |
| 325 | if isinstance(other, Dot3): |
| 326 | return self.payload.answers(other.payload) |
| 327 | return 0 |
| 328 | |
| 329 | def mysummary(self): |
| 330 | # type: () -> str |
| 331 | return "802.3 %s > %s" % (self.src, self.dst) |
| 332 | |
| 333 | @classmethod |
| 334 | def dispatch_hook(cls, _pkt=None, *args, **kargs): |
| 335 | # type: (Optional[Any], *Any, **Any) -> Type[Packet] |
| 336 | if _pkt and len(_pkt) >= 14: |
| 337 | if struct.unpack("!H", _pkt[12:14])[0] > 1500: |
| 338 | return Ether |
| 339 | return cls |
| 340 | |
| 341 | |
| 342 | class LLC(Packet): |
no test coverage detected
searching dependent graphs…