Bind 2 layers for building. When the upper layer is added as a payload of the lower layer, all the arguments will be applied to them. ex: >>> bind_top_down(Ether, SNAP, type=0x1234) >>> Ether()/SNAP() >
(lower, # type: Type[Packet]
upper, # type: Type[Packet]
__fval=None, # type: Optional[Any]
**fval # type: Any
)
| 2071 | |
| 2072 | |
| 2073 | def bind_top_down(lower, # type: Type[Packet] |
| 2074 | upper, # type: Type[Packet] |
| 2075 | __fval=None, # type: Optional[Any] |
| 2076 | **fval # type: Any |
| 2077 | ): |
| 2078 | # type: (...) -> None |
| 2079 | """Bind 2 layers for building. |
| 2080 | When the upper layer is added as a payload of the lower layer, all the |
| 2081 | arguments will be applied to them. |
| 2082 | |
| 2083 | ex: |
| 2084 | >>> bind_top_down(Ether, SNAP, type=0x1234) |
| 2085 | >>> Ether()/SNAP() |
| 2086 | <Ether type=0x1234 |<SNAP |>> |
| 2087 | """ |
| 2088 | if __fval is not None: |
| 2089 | fval.update(__fval) |
| 2090 | upper._overload_fields = upper._overload_fields.copy() # type: ignore |
| 2091 | upper._overload_fields[lower] = fval |
| 2092 | |
| 2093 | |
| 2094 | @conf.commands.register |