The STAMP Test TLV defined in Section 4 of [RFC 8972] provides a flexible extension mechanism for optional informational elements. The TLV Format in a STAMP Test packet is reported below:: 0 1 2 3 0 1 2 3 4 5 6 7
| 119 | |
| 120 | |
| 121 | class STAMPTestTLV(Packet): |
| 122 | """ |
| 123 | The STAMP Test TLV defined in Section 4 of [RFC 8972] provides a flexible |
| 124 | extension mechanism for optional informational elements. |
| 125 | |
| 126 | The TLV Format in a STAMP Test packet is reported below:: |
| 127 | |
| 128 | 0 1 2 3 |
| 129 | 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 2 3 4 5 6 7 8 9 0 1 |
| 130 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 131 | |STAMP TLV Flags| Type | Length | |
| 132 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 133 | ~ Value ~ |
| 134 | +-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+-+ |
| 135 | |
| 136 | |
| 137 | +-------+---------+-------------------------------------------------+ |
| 138 | | Field | Description | |
| 139 | +-----------------+-------------------------------------------------+ |
| 140 | | STAMP TLV Flags | 8-bit field; for the details about the STAMP | |
| 141 | | | TLV Flags Format, see RFC 8972 | |
| 142 | +-----------------+-------------------------------------------------+ |
| 143 | | Type | characterizes the interpretation of the Value | |
| 144 | | | field | |
| 145 | +-----------------+-------------------------------------------------+ |
| 146 | | Length | the length of the Value field in octets | |
| 147 | +-----------------+-------------------------------------------------+ |
| 148 | | Value | interpreted according to the value of the Type | |
| 149 | | | field | |
| 150 | +-----------------+-------------------------------------------------+ |
| 151 | |
| 152 | |
| 153 | References: |
| 154 | * `Simple Two-Way Active Measurement Protocol Optional Extensions |
| 155 | [RFC 8972] <https://www.rfc-editor.org/rfc/rfc8972.html>`_ |
| 156 | """ |
| 157 | |
| 158 | name = 'STAMP Test Packet - Generic TLV' |
| 159 | fields_desc = [ |
| 160 | FlagsField('flags', 0, 8, "UMIRRRRR"), |
| 161 | ByteEnumField('type', None, _stamp_tlvs), |
| 162 | ShortField('len', 0), |
| 163 | StrLenField('value', '', length_from=lambda pkt: pkt.len), |
| 164 | ] |
| 165 | |
| 166 | def extract_padding(self, p): |
| 167 | return b"", p |
| 168 | |
| 169 | registered_stamp_tlv = {} |
| 170 | |
| 171 | @classmethod |
| 172 | def register_variant(cls): |
| 173 | cls.registered_stamp_tlv[cls.type.default] = cls |
| 174 | |
| 175 | @classmethod |
| 176 | def dispatch_hook(cls, pkt=None, *args, **kargs): |
| 177 | if pkt: |
| 178 | tmp_type = ord(pkt[1:2]) |
nothing calls this directly
no test coverage detected
searching dependent graphs…