r"""Bind 2 layers for dissection. The upper layer will be chosen for dissection on top of the lower layer, if ALL the passed arguments are validated. If multiple calls are made with the same layers, the last one will be used as default. ex: >>> bind_bottom_up(Ether, SNAP, ty
(lower, # type: Type[Packet]
upper, # type: Type[Packet]
__fval=None, # type: Optional[Any]
**fval # type: Any
)
| 2049 | |
| 2050 | |
| 2051 | def bind_bottom_up(lower, # type: Type[Packet] |
| 2052 | upper, # type: Type[Packet] |
| 2053 | __fval=None, # type: Optional[Any] |
| 2054 | **fval # type: Any |
| 2055 | ): |
| 2056 | # type: (...) -> None |
| 2057 | r"""Bind 2 layers for dissection. |
| 2058 | The upper layer will be chosen for dissection on top of the lower layer, if |
| 2059 | ALL the passed arguments are validated. If multiple calls are made with |
| 2060 | the same layers, the last one will be used as default. |
| 2061 | |
| 2062 | ex: |
| 2063 | >>> bind_bottom_up(Ether, SNAP, type=0x1234) |
| 2064 | >>> Ether(b'\xff\xff\xff\xff\xff\xff\xd0P\x99V\xdd\xf9\x124\x00\x00\x00\x00\x00') # noqa: E501 |
| 2065 | <Ether dst=ff:ff:ff:ff:ff:ff src=d0:50:99:56:dd:f9 type=0x1234 |<SNAP OUI=0x0 code=0x0 |>> # noqa: E501 |
| 2066 | """ |
| 2067 | if __fval is not None: |
| 2068 | fval.update(__fval) |
| 2069 | lower.payload_guess = lower.payload_guess[:] |
| 2070 | lower.payload_guess.append((fval, upper)) |
| 2071 | |
| 2072 | |
| 2073 | def bind_top_down(lower, # type: Type[Packet] |