Wraps a class for use when dissecting streams.
(cls: Type[Packet])
| 163 | |
| 164 | |
| 165 | def streamcls(cls: Type[Packet]) -> Callable[ |
| 166 | [bytes, Dict[str, Any], Dict[str, Any]], |
| 167 | Optional[Packet], |
| 168 | ]: |
| 169 | """ |
| 170 | Wraps a class for use when dissecting streams. |
| 171 | """ |
| 172 | if hasattr(cls, "tcp_reassemble"): |
| 173 | return cls.tcp_reassemble # type: ignore |
| 174 | else: |
| 175 | # There is no tcp_reassemble. Just dissect the packet |
| 176 | return lambda data, *_: data and cls(data) |
| 177 | |
| 178 | |
| 179 | class TCPSession(IPSession): |