| 265 | |
| 266 | |
| 267 | class SNMP(ASN1_Packet): |
| 268 | ASN1_codec = ASN1_Codecs.BER |
| 269 | ASN1_root = ASN1F_SEQUENCE( |
| 270 | ASN1F_enum_INTEGER("version", 1, {0: "v1", 1: "v2c", 2: "v2", 3: "v3"}), # noqa: E501 |
| 271 | ASN1F_STRING("community", "public"), |
| 272 | ASN1F_CHOICE("PDU", SNMPget(), |
| 273 | SNMPget, SNMPnext, SNMPresponse, SNMPset, |
| 274 | SNMPtrapv1, SNMPbulk, SNMPinform, SNMPtrapv2) |
| 275 | ) |
| 276 | |
| 277 | def answers(self, other): |
| 278 | return (isinstance(self.PDU, SNMPresponse) and |
| 279 | isinstance(other.PDU, (SNMPget, SNMPnext, SNMPset)) and |
| 280 | self.PDU.id == other.PDU.id) |
| 281 | |
| 282 | |
| 283 | bind_bottom_up(UDP, SNMP, sport=161) |
no test coverage detected