| 305 | self.ldict[layer.__module__].append(layer) |
| 306 | |
| 307 | def layers(self): |
| 308 | # type: () -> List[Tuple[str, str]] |
| 309 | result = [] |
| 310 | # This import may feel useless, but it is required for the eval below |
| 311 | import scapy # noqa: F401 |
| 312 | try: |
| 313 | import builtins # noqa: F401 |
| 314 | except ImportError: |
| 315 | import __builtin__ # noqa: F401 |
| 316 | for lay in self.ldict: |
| 317 | doc = eval(lay).__doc__ |
| 318 | result.append((lay, doc.strip().split("\n")[0] if doc else lay)) |
| 319 | return result |
| 320 | |
| 321 | def filter(self, items): |
| 322 | # type: (List[Type[Packet]]) -> None |