DEV: Guesses the next payload class from layer bonds. Can be overloaded to use a different mechanism. :param str payload: the layer's payload :return: the payload class
(self, payload)
| 1109 | self.add_payload(conf.padding_layer(pad)) |
| 1110 | |
| 1111 | def guess_payload_class(self, payload): |
| 1112 | # type: (bytes) -> Type[Packet] |
| 1113 | """ |
| 1114 | DEV: Guesses the next payload class from layer bonds. |
| 1115 | Can be overloaded to use a different mechanism. |
| 1116 | |
| 1117 | :param str payload: the layer's payload |
| 1118 | :return: the payload class |
| 1119 | """ |
| 1120 | for t in self.aliastypes: |
| 1121 | for fval, cls in t.payload_guess: |
| 1122 | try: |
| 1123 | if all(v == self.getfieldval(k) |
| 1124 | for k, v in fval.items()): |
| 1125 | return cls # type: ignore |
| 1126 | except AttributeError: |
| 1127 | pass |
| 1128 | return self.default_payload_class(payload) |
| 1129 | |
| 1130 | def default_payload_class(self, payload): |
| 1131 | # type: (bytes) -> Type[Packet] |
no test coverage detected