pypcapkit 1.3.5.post6__pp310-none-any.whl
Sign up to get free protection for your applications and to get access to all the features.
- pcapkit/__init__.py +124 -0
- pcapkit/__main__.py +138 -0
- pcapkit/all.py +136 -0
- pcapkit/const/__init__.py +81 -0
- pcapkit/const/arp/__init__.py +25 -0
- pcapkit/const/arp/hardware.py +181 -0
- pcapkit/const/arp/operation.py +131 -0
- pcapkit/const/ftp/__init__.py +25 -0
- pcapkit/const/ftp/command.py +309 -0
- pcapkit/const/ftp/return_code.py +304 -0
- pcapkit/const/hip/__init__.py +94 -0
- pcapkit/const/hip/certificate.py +77 -0
- pcapkit/const/hip/cipher.py +65 -0
- pcapkit/const/hip/di.py +59 -0
- pcapkit/const/hip/ecdsa_curve.py +59 -0
- pcapkit/const/hip/ecdsa_low_curve.py +56 -0
- pcapkit/const/hip/eddsa_curve.py +65 -0
- pcapkit/const/hip/esp_transform_suite.py +98 -0
- pcapkit/const/hip/group.py +86 -0
- pcapkit/const/hip/hi_algorithm.py +86 -0
- pcapkit/const/hip/hit_suite.py +68 -0
- pcapkit/const/hip/nat_traversal.py +62 -0
- pcapkit/const/hip/notify_message.py +200 -0
- pcapkit/const/hip/packet.py +89 -0
- pcapkit/const/hip/parameter.py +377 -0
- pcapkit/const/hip/registration.py +68 -0
- pcapkit/const/hip/registration_failure.py +84 -0
- pcapkit/const/hip/suite.py +71 -0
- pcapkit/const/hip/transport.py +59 -0
- pcapkit/const/http/__init__.py +39 -0
- pcapkit/const/http/error_code.py +95 -0
- pcapkit/const/http/frame.py +95 -0
- pcapkit/const/http/method.py +184 -0
- pcapkit/const/http/setting.py +96 -0
- pcapkit/const/http/status_code.py +298 -0
- pcapkit/const/ipv4/__init__.py +57 -0
- pcapkit/const/ipv4/classification_level.py +64 -0
- pcapkit/const/ipv4/option_class.py +55 -0
- pcapkit/const/ipv4/option_number.py +137 -0
- pcapkit/const/ipv4/protection_authority.py +63 -0
- pcapkit/const/ipv4/qs_function.py +51 -0
- pcapkit/const/ipv4/router_alert.py +251 -0
- pcapkit/const/ipv4/tos_del.py +51 -0
- pcapkit/const/ipv4/tos_ecn.py +55 -0
- pcapkit/const/ipv4/tos_pre.py +63 -0
- pcapkit/const/ipv4/tos_rel.py +51 -0
- pcapkit/const/ipv4/tos_thr.py +51 -0
- pcapkit/const/ipv4/ts_flag.py +53 -0
- pcapkit/const/ipv6/__init__.py +53 -0
- pcapkit/const/ipv6/extension_header.py +69 -0
- pcapkit/const/ipv6/option.py +137 -0
- pcapkit/const/ipv6/option_action.py +55 -0
- pcapkit/const/ipv6/qs_function.py +51 -0
- pcapkit/const/ipv6/router_alert.py +266 -0
- pcapkit/const/ipv6/routing.py +80 -0
- pcapkit/const/ipv6/seed_id.py +55 -0
- pcapkit/const/ipv6/smf_dpd_mode.py +51 -0
- pcapkit/const/ipv6/tagger_id.py +62 -0
- pcapkit/const/ipx/__init__.py +27 -0
- pcapkit/const/ipx/packet.py +72 -0
- pcapkit/const/ipx/socket.py +104 -0
- pcapkit/const/l2tp/__init__.py +21 -0
- pcapkit/const/l2tp/type.py +51 -0
- pcapkit/const/mh/__init__.py +204 -0
- pcapkit/const/mh/access_type.py +92 -0
- pcapkit/const/mh/ack_status_code.py +71 -0
- pcapkit/const/mh/ani_suboption.py +74 -0
- pcapkit/const/mh/auth_subtype.py +53 -0
- pcapkit/const/mh/binding_ack_flag.py +66 -0
- pcapkit/const/mh/binding_error.py +51 -0
- pcapkit/const/mh/binding_revocation.py +59 -0
- pcapkit/const/mh/binding_update_flag.py +81 -0
- pcapkit/const/mh/cga_extension.py +66 -0
- pcapkit/const/mh/cga_sec.py +57 -0
- pcapkit/const/mh/cga_type.py +68 -0
- pcapkit/const/mh/dhcp_support_mode.py +53 -0
- pcapkit/const/mh/dns_status_code.py +65 -0
- pcapkit/const/mh/dsmip6_tls_packet.py +62 -0
- pcapkit/const/mh/dsmipv6_home_address.py +74 -0
- pcapkit/const/mh/enumerating_algorithm.py +56 -0
- pcapkit/const/mh/fb_ack_status.py +62 -0
- pcapkit/const/mh/fb_action.py +71 -0
- pcapkit/const/mh/fb_indication_trigger.py +65 -0
- pcapkit/const/mh/fb_type.py +59 -0
- pcapkit/const/mh/flow_id_status.py +77 -0
- pcapkit/const/mh/flow_id_suboption.py +71 -0
- pcapkit/const/mh/handoff_type.py +71 -0
- pcapkit/const/mh/handover_ack_flag.py +54 -0
- pcapkit/const/mh/handover_ack_status.py +92 -0
- pcapkit/const/mh/handover_initiate_flag.py +57 -0
- pcapkit/const/mh/handover_initiate_status.py +62 -0
- pcapkit/const/mh/home_address_reply.py +71 -0
- pcapkit/const/mh/lla_code.py +63 -0
- pcapkit/const/mh/lma_mag_suboption.py +59 -0
- pcapkit/const/mh/mn_group_id.py +59 -0
- pcapkit/const/mh/mn_id_subtype.py +77 -0
- pcapkit/const/mh/operator_id.py +63 -0
- pcapkit/const/mh/option.py +260 -0
- pcapkit/const/mh/packet.py +119 -0
- pcapkit/const/mh/qos_attribute.py +89 -0
- pcapkit/const/mh/revocation_status_code.py +83 -0
- pcapkit/const/mh/revocation_trigger.py +86 -0
- pcapkit/const/mh/status_code.py +232 -0
- pcapkit/const/mh/traffic_selector.py +62 -0
- pcapkit/const/mh/upa_status.py +71 -0
- pcapkit/const/mh/upn_reason.py +80 -0
- pcapkit/const/ospf/__init__.py +27 -0
- pcapkit/const/ospf/authentication.py +65 -0
- pcapkit/const/ospf/packet.py +71 -0
- pcapkit/const/pcapng/__init__.py +51 -0
- pcapkit/const/pcapng/block_type.py +152 -0
- pcapkit/const/pcapng/filter_type.py +48 -0
- pcapkit/const/pcapng/hash_algorithm.py +59 -0
- pcapkit/const/pcapng/option_type.py +233 -0
- pcapkit/const/pcapng/record_type.py +57 -0
- pcapkit/const/pcapng/secrets_type.py +56 -0
- pcapkit/const/pcapng/verdict_type.py +53 -0
- pcapkit/const/reg/__init__.py +34 -0
- pcapkit/const/reg/apptype.py +32728 -0
- pcapkit/const/reg/ethertype.py +714 -0
- pcapkit/const/reg/linktype.py +890 -0
- pcapkit/const/reg/transtype.py +526 -0
- pcapkit/const/tcp/__init__.py +35 -0
- pcapkit/const/tcp/checksum.py +55 -0
- pcapkit/const/tcp/flags.py +73 -0
- pcapkit/const/tcp/mp_tcp_option.py +80 -0
- pcapkit/const/tcp/option.py +198 -0
- pcapkit/const/vlan/__init__.py +23 -0
- pcapkit/const/vlan/priority_level.py +71 -0
- pcapkit/corekit/__init__.py +59 -0
- pcapkit/corekit/fields/__init__.py +45 -0
- pcapkit/corekit/fields/collections.py +282 -0
- pcapkit/corekit/fields/field.py +269 -0
- pcapkit/corekit/fields/ipaddress.py +274 -0
- pcapkit/corekit/fields/misc.py +722 -0
- pcapkit/corekit/fields/numbers.py +375 -0
- pcapkit/corekit/fields/strings.py +245 -0
- pcapkit/corekit/infoclass.py +394 -0
- pcapkit/corekit/io.py +506 -0
- pcapkit/corekit/module.py +39 -0
- pcapkit/corekit/multidict.py +626 -0
- pcapkit/corekit/protochain.py +263 -0
- pcapkit/corekit/version.py +33 -0
- pcapkit/dumpkit/__init__.py +15 -0
- pcapkit/dumpkit/common.py +199 -0
- pcapkit/dumpkit/null.py +77 -0
- pcapkit/dumpkit/pcap.py +144 -0
- pcapkit/foundation/__init__.py +45 -0
- pcapkit/foundation/engines/__init__.py +36 -0
- pcapkit/foundation/engines/dpkt.py +230 -0
- pcapkit/foundation/engines/engine.py +194 -0
- pcapkit/foundation/engines/pcap.py +188 -0
- pcapkit/foundation/engines/pcapng.py +310 -0
- pcapkit/foundation/engines/pyshark.py +166 -0
- pcapkit/foundation/engines/scapy.py +161 -0
- pcapkit/foundation/extraction.py +915 -0
- pcapkit/foundation/reassembly/__init__.py +49 -0
- pcapkit/foundation/reassembly/data/__init__.py +48 -0
- pcapkit/foundation/reassembly/data/ip.py +117 -0
- pcapkit/foundation/reassembly/data/tcp.py +145 -0
- pcapkit/foundation/reassembly/ip.py +192 -0
- pcapkit/foundation/reassembly/ipv4.py +50 -0
- pcapkit/foundation/reassembly/ipv6.py +50 -0
- pcapkit/foundation/reassembly/reassembly.py +389 -0
- pcapkit/foundation/reassembly/tcp.py +249 -0
- pcapkit/foundation/registry/__init__.py +41 -0
- pcapkit/foundation/registry/foundation.py +327 -0
- pcapkit/foundation/registry/protocols.py +885 -0
- pcapkit/foundation/traceflow/__init__.py +44 -0
- pcapkit/foundation/traceflow/data/__init__.py +30 -0
- pcapkit/foundation/traceflow/data/tcp.py +105 -0
- pcapkit/foundation/traceflow/tcp.py +159 -0
- pcapkit/foundation/traceflow/traceflow.py +390 -0
- pcapkit/interface/__init__.py +22 -0
- pcapkit/interface/core.py +185 -0
- pcapkit/interface/misc.py +120 -0
- pcapkit/protocols/__init__.py +85 -0
- pcapkit/protocols/application/NotImplemented/bgp.py +0 -0
- pcapkit/protocols/application/NotImplemented/dhcp.py +0 -0
- pcapkit/protocols/application/NotImplemented/dhcpv6.py +0 -0
- pcapkit/protocols/application/NotImplemented/dns.py +0 -0
- pcapkit/protocols/application/NotImplemented/imap.py +0 -0
- pcapkit/protocols/application/NotImplemented/ldap.py +0 -0
- pcapkit/protocols/application/NotImplemented/mqtt.py +0 -0
- pcapkit/protocols/application/NotImplemented/nntp.py +0 -0
- pcapkit/protocols/application/NotImplemented/ntp.py +0 -0
- pcapkit/protocols/application/NotImplemented/onc_rpc.py +0 -0
- pcapkit/protocols/application/NotImplemented/pop.py +0 -0
- pcapkit/protocols/application/NotImplemented/rip.py +0 -0
- pcapkit/protocols/application/NotImplemented/rtp.py +0 -0
- pcapkit/protocols/application/NotImplemented/sip.py +0 -0
- pcapkit/protocols/application/NotImplemented/smtp.py +0 -0
- pcapkit/protocols/application/NotImplemented/snmp.py +0 -0
- pcapkit/protocols/application/NotImplemented/ssh.py +0 -0
- pcapkit/protocols/application/NotImplemented/telnet.py +0 -0
- pcapkit/protocols/application/NotImplemented/tls.py +0 -0
- pcapkit/protocols/application/NotImplemented/xmpp.py +0 -0
- pcapkit/protocols/application/__init__.py +34 -0
- pcapkit/protocols/application/application.py +114 -0
- pcapkit/protocols/application/ftp.py +206 -0
- pcapkit/protocols/application/http.py +176 -0
- pcapkit/protocols/application/httpv1.py +320 -0
- pcapkit/protocols/application/httpv2.py +1255 -0
- pcapkit/protocols/data/__init__.py +192 -0
- pcapkit/protocols/data/application/__init__.py +57 -0
- pcapkit/protocols/data/application/ftp.py +59 -0
- pcapkit/protocols/data/application/httpv1.py +79 -0
- pcapkit/protocols/data/application/httpv2.py +293 -0
- pcapkit/protocols/data/data.py +25 -0
- pcapkit/protocols/data/internet/__init__.py +298 -0
- pcapkit/protocols/data/internet/ah.py +31 -0
- pcapkit/protocols/data/internet/hip.py +804 -0
- pcapkit/protocols/data/internet/hopopt.py +351 -0
- pcapkit/protocols/data/internet/ipv4.py +369 -0
- pcapkit/protocols/data/internet/ipv6.py +67 -0
- pcapkit/protocols/data/internet/ipv6_frag.py +29 -0
- pcapkit/protocols/data/internet/ipv6_opts.py +368 -0
- pcapkit/protocols/data/internet/ipv6_route.py +86 -0
- pcapkit/protocols/data/internet/ipx.py +56 -0
- pcapkit/protocols/data/internet/mh.py +509 -0
- pcapkit/protocols/data/link/__init__.py +33 -0
- pcapkit/protocols/data/link/arp.py +74 -0
- pcapkit/protocols/data/link/ethernet.py +28 -0
- pcapkit/protocols/data/link/l2tp.py +63 -0
- pcapkit/protocols/data/link/ospf.py +58 -0
- pcapkit/protocols/data/link/vlan.py +42 -0
- pcapkit/protocols/data/misc/__init__.py +109 -0
- pcapkit/protocols/data/misc/null.py +18 -0
- pcapkit/protocols/data/misc/pcap/__init__.py +18 -0
- pcapkit/protocols/data/misc/pcap/frame.py +56 -0
- pcapkit/protocols/data/misc/pcap/header.py +53 -0
- pcapkit/protocols/data/misc/pcapng.py +925 -0
- pcapkit/protocols/data/misc/raw.py +25 -0
- pcapkit/protocols/data/protocol.py +32 -0
- pcapkit/protocols/data/transport/__init__.py +71 -0
- pcapkit/protocols/data/transport/tcp.py +555 -0
- pcapkit/protocols/data/transport/udp.py +29 -0
- pcapkit/protocols/internet/NotImplemented/ecn.py +0 -0
- pcapkit/protocols/internet/NotImplemented/esp.py +97 -0
- pcapkit/protocols/internet/NotImplemented/icmp.py +0 -0
- pcapkit/protocols/internet/NotImplemented/icmpv6.py +0 -0
- pcapkit/protocols/internet/NotImplemented/igmp.py +0 -0
- pcapkit/protocols/internet/NotImplemented/shim6.py +0 -0
- pcapkit/protocols/internet/__init__.py +43 -0
- pcapkit/protocols/internet/ah.py +275 -0
- pcapkit/protocols/internet/hip.py +4727 -0
- pcapkit/protocols/internet/hopopt.py +1879 -0
- pcapkit/protocols/internet/internet.py +249 -0
- pcapkit/protocols/internet/ip.py +51 -0
- pcapkit/protocols/internet/ipsec.py +50 -0
- pcapkit/protocols/internet/ipv4.py +1782 -0
- pcapkit/protocols/internet/ipv6.py +412 -0
- pcapkit/protocols/internet/ipv6_frag.py +258 -0
- pcapkit/protocols/internet/ipv6_opts.py +1890 -0
- pcapkit/protocols/internet/ipv6_route.py +708 -0
- pcapkit/protocols/internet/ipx.py +230 -0
- pcapkit/protocols/internet/mh.py +2764 -0
- pcapkit/protocols/link/NotImplemented/dsl.py +0 -0
- pcapkit/protocols/link/NotImplemented/eapol.py +1 -0
- pcapkit/protocols/link/NotImplemented/fddi.py +0 -0
- pcapkit/protocols/link/NotImplemented/isdn.py +0 -0
- pcapkit/protocols/link/NotImplemented/ndp.py +0 -0
- pcapkit/protocols/link/NotImplemented/ppp.py +0 -0
- pcapkit/protocols/link/__init__.py +35 -0
- pcapkit/protocols/link/arp.py +421 -0
- pcapkit/protocols/link/ethernet.py +248 -0
- pcapkit/protocols/link/l2tp.py +267 -0
- pcapkit/protocols/link/link.py +140 -0
- pcapkit/protocols/link/ospf.py +342 -0
- pcapkit/protocols/link/rarp.py +82 -0
- pcapkit/protocols/link/vlan.py +225 -0
- pcapkit/protocols/misc/__init__.py +37 -0
- pcapkit/protocols/misc/null.py +129 -0
- pcapkit/protocols/misc/pcap/__init__.py +17 -0
- pcapkit/protocols/misc/pcap/frame.py +478 -0
- pcapkit/protocols/misc/pcap/header.py +358 -0
- pcapkit/protocols/misc/pcapng.py +5520 -0
- pcapkit/protocols/misc/raw.py +180 -0
- pcapkit/protocols/protocol.py +1216 -0
- pcapkit/protocols/schema/__init__.py +140 -0
- pcapkit/protocols/schema/application/__init__.py +40 -0
- pcapkit/protocols/schema/application/ftp.py +21 -0
- pcapkit/protocols/schema/application/httpv1.py +21 -0
- pcapkit/protocols/schema/application/httpv2.py +384 -0
- pcapkit/protocols/schema/internet/__init__.py +294 -0
- pcapkit/protocols/schema/internet/ah.py +40 -0
- pcapkit/protocols/schema/internet/hip.py +1184 -0
- pcapkit/protocols/schema/internet/hopopt.py +679 -0
- pcapkit/protocols/schema/internet/ipv4.py +576 -0
- pcapkit/protocols/schema/internet/ipv6.py +63 -0
- pcapkit/protocols/schema/internet/ipv6_frag.py +48 -0
- pcapkit/protocols/schema/internet/ipv6_opts.py +680 -0
- pcapkit/protocols/schema/internet/ipv6_route.py +197 -0
- pcapkit/protocols/schema/internet/ipx.py +40 -0
- pcapkit/protocols/schema/internet/mh.py +718 -0
- pcapkit/protocols/schema/link/__init__.py +19 -0
- pcapkit/protocols/schema/link/arp.py +39 -0
- pcapkit/protocols/schema/link/ethernet.py +51 -0
- pcapkit/protocols/schema/link/l2tp.py +88 -0
- pcapkit/protocols/schema/link/ospf.py +90 -0
- pcapkit/protocols/schema/link/vlan.py +69 -0
- pcapkit/protocols/schema/misc/__init__.py +108 -0
- pcapkit/protocols/schema/misc/null.py +18 -0
- pcapkit/protocols/schema/misc/pcap/__init__.py +10 -0
- pcapkit/protocols/schema/misc/pcap/frame.py +51 -0
- pcapkit/protocols/schema/misc/pcap/header.py +63 -0
- pcapkit/protocols/schema/misc/pcapng.py +1689 -0
- pcapkit/protocols/schema/misc/raw.py +24 -0
- pcapkit/protocols/schema/schema.py +809 -0
- pcapkit/protocols/schema/transport/__init__.py +69 -0
- pcapkit/protocols/schema/transport/tcp.py +928 -0
- pcapkit/protocols/schema/transport/udp.py +90 -0
- pcapkit/protocols/transport/NotImplemented/dccp.py +0 -0
- pcapkit/protocols/transport/NotImplemented/rsvp.py +0 -0
- pcapkit/protocols/transport/NotImplemented/sctp.py +0 -0
- pcapkit/protocols/transport/__init__.py +27 -0
- pcapkit/protocols/transport/tcp.py +3025 -0
- pcapkit/protocols/transport/transport.py +158 -0
- pcapkit/protocols/transport/udp.py +214 -0
- pcapkit/py.typed +0 -0
- pcapkit/toolkit/__init__.py +57 -0
- pcapkit/toolkit/dpkt.py +306 -0
- pcapkit/toolkit/pcap.py +212 -0
- pcapkit/toolkit/pcapng.py +251 -0
- pcapkit/toolkit/pyshark.py +99 -0
- pcapkit/toolkit/scapy.py +297 -0
- pcapkit/utilities/__init__.py +20 -0
- pcapkit/utilities/compat.py +196 -0
- pcapkit/utilities/decorators.py +197 -0
- pcapkit/utilities/exceptions.py +365 -0
- pcapkit/utilities/logging.py +55 -0
- pcapkit/utilities/warnings.py +185 -0
- pcapkit/vendor/__init__.py +105 -0
- pcapkit/vendor/__main__.py +92 -0
- pcapkit/vendor/arp/__init__.py +27 -0
- pcapkit/vendor/arp/hardware.py +29 -0
- pcapkit/vendor/arp/operation.py +29 -0
- pcapkit/vendor/default.py +474 -0
- pcapkit/vendor/ftp/__init__.py +27 -0
- pcapkit/vendor/ftp/command.py +244 -0
- pcapkit/vendor/ftp/return_code.py +256 -0
- pcapkit/vendor/hip/__init__.py +94 -0
- pcapkit/vendor/hip/certificate.py +29 -0
- pcapkit/vendor/hip/cipher.py +29 -0
- pcapkit/vendor/hip/di.py +29 -0
- pcapkit/vendor/hip/ecdsa_curve.py +29 -0
- pcapkit/vendor/hip/ecdsa_low_curve.py +29 -0
- pcapkit/vendor/hip/eddsa_curve.py +85 -0
- pcapkit/vendor/hip/esp_transform_suite.py +29 -0
- pcapkit/vendor/hip/group.py +87 -0
- pcapkit/vendor/hip/hi_algorithm.py +29 -0
- pcapkit/vendor/hip/hit_suite.py +29 -0
- pcapkit/vendor/hip/nat_traversal.py +29 -0
- pcapkit/vendor/hip/notify_message.py +29 -0
- pcapkit/vendor/hip/packet.py +88 -0
- pcapkit/vendor/hip/parameter.py +88 -0
- pcapkit/vendor/hip/registration.py +29 -0
- pcapkit/vendor/hip/registration_failure.py +29 -0
- pcapkit/vendor/hip/suite.py +29 -0
- pcapkit/vendor/hip/transport.py +29 -0
- pcapkit/vendor/http/__init__.py +39 -0
- pcapkit/vendor/http/error_code.py +95 -0
- pcapkit/vendor/http/frame.py +91 -0
- pcapkit/vendor/http/method.py +167 -0
- pcapkit/vendor/http/setting.py +93 -0
- pcapkit/vendor/http/status_code.py +185 -0
- pcapkit/vendor/ipv4/__init__.py +57 -0
- pcapkit/vendor/ipv4/classification_level.py +91 -0
- pcapkit/vendor/ipv4/option_class.py +80 -0
- pcapkit/vendor/ipv4/option_number.py +105 -0
- pcapkit/vendor/ipv4/protection_authority.py +84 -0
- pcapkit/vendor/ipv4/qs_function.py +78 -0
- pcapkit/vendor/ipv4/router_alert.py +93 -0
- pcapkit/vendor/ipv4/tos_del.py +78 -0
- pcapkit/vendor/ipv4/tos_ecn.py +95 -0
- pcapkit/vendor/ipv4/tos_pre.py +84 -0
- pcapkit/vendor/ipv4/tos_rel.py +78 -0
- pcapkit/vendor/ipv4/tos_thr.py +77 -0
- pcapkit/vendor/ipv4/ts_flag.py +79 -0
- pcapkit/vendor/ipv6/__init__.py +53 -0
- pcapkit/vendor/ipv6/extension_header.py +171 -0
- pcapkit/vendor/ipv6/option.py +104 -0
- pcapkit/vendor/ipv6/option_action.py +90 -0
- pcapkit/vendor/ipv6/qs_function.py +78 -0
- pcapkit/vendor/ipv6/router_alert.py +93 -0
- pcapkit/vendor/ipv6/routing.py +87 -0
- pcapkit/vendor/ipv6/seed_id.py +81 -0
- pcapkit/vendor/ipv6/smf_dpd_mode.py +78 -0
- pcapkit/vendor/ipv6/tagger_id.py +81 -0
- pcapkit/vendor/ipx/__init__.py +37 -0
- pcapkit/vendor/ipx/packet.py +123 -0
- pcapkit/vendor/ipx/socket.py +125 -0
- pcapkit/vendor/l2tp/__init__.py +21 -0
- pcapkit/vendor/l2tp/type.py +78 -0
- pcapkit/vendor/mh/__init__.py +204 -0
- pcapkit/vendor/mh/access_type.py +87 -0
- pcapkit/vendor/mh/ack_status_code.py +88 -0
- pcapkit/vendor/mh/ani_suboption.py +88 -0
- pcapkit/vendor/mh/auth_subtype.py +83 -0
- pcapkit/vendor/mh/binding_ack_flag.py +148 -0
- pcapkit/vendor/mh/binding_error.py +78 -0
- pcapkit/vendor/mh/binding_revocation.py +87 -0
- pcapkit/vendor/mh/binding_update_flag.py +147 -0
- pcapkit/vendor/mh/cga_extension.py +91 -0
- pcapkit/vendor/mh/cga_sec.py +91 -0
- pcapkit/vendor/mh/cga_type.py +74 -0
- pcapkit/vendor/mh/dhcp_support_mode.py +77 -0
- pcapkit/vendor/mh/dns_status_code.py +87 -0
- pcapkit/vendor/mh/dsmip6_tls_packet.py +87 -0
- pcapkit/vendor/mh/dsmipv6_home_address.py +87 -0
- pcapkit/vendor/mh/enumerating_algorithm.py +82 -0
- pcapkit/vendor/mh/fb_ack_status.py +87 -0
- pcapkit/vendor/mh/fb_action.py +88 -0
- pcapkit/vendor/mh/fb_indication_trigger.py +87 -0
- pcapkit/vendor/mh/fb_type.py +88 -0
- pcapkit/vendor/mh/flow_id_status.py +87 -0
- pcapkit/vendor/mh/flow_id_suboption.py +87 -0
- pcapkit/vendor/mh/handoff_type.py +87 -0
- pcapkit/vendor/mh/handover_ack_flag.py +143 -0
- pcapkit/vendor/mh/handover_ack_status.py +87 -0
- pcapkit/vendor/mh/handover_initiate_flag.py +143 -0
- pcapkit/vendor/mh/handover_initiate_status.py +87 -0
- pcapkit/vendor/mh/home_address_reply.py +87 -0
- pcapkit/vendor/mh/lla_code.py +97 -0
- pcapkit/vendor/mh/lma_mag_suboption.py +88 -0
- pcapkit/vendor/mh/mn_group_id.py +87 -0
- pcapkit/vendor/mh/mn_id_subtype.py +87 -0
- pcapkit/vendor/mh/operator_id.py +87 -0
- pcapkit/vendor/mh/option.py +83 -0
- pcapkit/vendor/mh/packet.py +82 -0
- pcapkit/vendor/mh/qos_attribute.py +87 -0
- pcapkit/vendor/mh/revocation_status_code.py +87 -0
- pcapkit/vendor/mh/revocation_trigger.py +87 -0
- pcapkit/vendor/mh/status_code.py +91 -0
- pcapkit/vendor/mh/traffic_selector.py +87 -0
- pcapkit/vendor/mh/upa_status.py +87 -0
- pcapkit/vendor/mh/upn_reason.py +87 -0
- pcapkit/vendor/ospf/__init__.py +27 -0
- pcapkit/vendor/ospf/authentication.py +29 -0
- pcapkit/vendor/ospf/packet.py +29 -0
- pcapkit/vendor/pcapng/__init__.py +51 -0
- pcapkit/vendor/pcapng/block_type.py +94 -0
- pcapkit/vendor/pcapng/filter_type.py +77 -0
- pcapkit/vendor/pcapng/hash_algorithm.py +82 -0
- pcapkit/vendor/pcapng/option_type.py +287 -0
- pcapkit/vendor/pcapng/record_type.py +81 -0
- pcapkit/vendor/pcapng/secrets_type.py +81 -0
- pcapkit/vendor/pcapng/verdict_type.py +79 -0
- pcapkit/vendor/reg/__init__.py +34 -0
- pcapkit/vendor/reg/apptype.py +338 -0
- pcapkit/vendor/reg/ethertype.py +121 -0
- pcapkit/vendor/reg/linktype.py +110 -0
- pcapkit/vendor/reg/transtype.py +111 -0
- pcapkit/vendor/tcp/__init__.py +35 -0
- pcapkit/vendor/tcp/checksum.py +80 -0
- pcapkit/vendor/tcp/flags.py +149 -0
- pcapkit/vendor/tcp/mp_tcp_option.py +90 -0
- pcapkit/vendor/tcp/option.py +103 -0
- pcapkit/vendor/vlan/__init__.py +23 -0
- pcapkit/vendor/vlan/priority_level.py +97 -0
- pypcapkit-1.3.5.post6.dist-info/LICENSE +29 -0
- pypcapkit-1.3.5.post6.dist-info/METADATA +238 -0
- pypcapkit-1.3.5.post6.dist-info/RECORD +466 -0
- pypcapkit-1.3.5.post6.dist-info/WHEEL +5 -0
- pypcapkit-1.3.5.post6.dist-info/entry_points.txt +3 -0
- pypcapkit-1.3.5.post6.dist-info/top_level.txt +1 -0
@@ -0,0 +1,1184 @@
|
|
1
|
+
# -*- coding: utf-8 -*-
|
2
|
+
# mypy: disable-error-code=assignment
|
3
|
+
"""header schema for Host Identity Protocol"""
|
4
|
+
|
5
|
+
from typing import TYPE_CHECKING, cast
|
6
|
+
|
7
|
+
from pcapkit.const.hip.certificate import Certificate as Enum_Certificate
|
8
|
+
from pcapkit.const.hip.cipher import Cipher as Enum_Cipher
|
9
|
+
from pcapkit.const.hip.di import DITypes as Enum_DITypes
|
10
|
+
from pcapkit.const.hip.ecdsa_curve import ECDSACurve as Enum_ECDSACurve
|
11
|
+
from pcapkit.const.hip.ecdsa_low_curve import ECDSALowCurve as Enum_ECDSALowCurve
|
12
|
+
from pcapkit.const.hip.eddsa_curve import EdDSACurve as Enum_EdDSACurve
|
13
|
+
from pcapkit.const.hip.esp_transform_suite import ESPTransformSuite as Enum_ESPTransformSuite
|
14
|
+
from pcapkit.const.hip.group import Group as Enum_Group
|
15
|
+
from pcapkit.const.hip.hi_algorithm import HIAlgorithm as Enum_HIAlgorithm
|
16
|
+
from pcapkit.const.hip.hit_suite import HITSuite as Enum_HITSuite
|
17
|
+
from pcapkit.const.hip.nat_traversal import NATTraversal as Enum_NATTraversal
|
18
|
+
from pcapkit.const.hip.notify_message import NotifyMessage as Enum_NotifyMessage
|
19
|
+
from pcapkit.const.hip.parameter import Parameter as Enum_Parameter
|
20
|
+
from pcapkit.const.hip.registration import Registration as Enum_Registration
|
21
|
+
from pcapkit.const.hip.registration_failure import RegistrationFailure as Enum_RegistrationFailure
|
22
|
+
from pcapkit.const.hip.suite import Suite as Enum_Suite
|
23
|
+
from pcapkit.const.hip.transport import Transport as Enum_Transport
|
24
|
+
from pcapkit.const.reg.transtype import TransType as Enum_TransType
|
25
|
+
from pcapkit.corekit.fields.collections import ListField, OptionField
|
26
|
+
from pcapkit.corekit.fields.ipaddress import IPv6AddressField
|
27
|
+
from pcapkit.corekit.fields.misc import ConditionalField, PayloadField, SchemaField, SwitchField
|
28
|
+
from pcapkit.corekit.fields.numbers import (EnumField, NumberField, UInt8Field, UInt16Field,
|
29
|
+
UInt32Field)
|
30
|
+
from pcapkit.corekit.fields.strings import BitField, BytesField, PaddingField
|
31
|
+
from pcapkit.protocols.schema.schema import EnumSchema, Schema, schema_final
|
32
|
+
from pcapkit.utilities.exceptions import FieldValueError
|
33
|
+
from pcapkit.utilities.logging import SPHINX_TYPE_CHECKING
|
34
|
+
from pcapkit.utilities.warnings import ProtocolWarning, warn
|
35
|
+
|
36
|
+
__all__ = [
|
37
|
+
'HIP',
|
38
|
+
|
39
|
+
'LocatorData', 'Locator', 'HostIdentity',
|
40
|
+
'ECDSACurveHostIdentity', 'ECDSALowCurveHostIdentity', 'EdDSACurveHostIdentity',
|
41
|
+
|
42
|
+
'UnassignedParameter', 'ESPInfoParameter', 'R1CounterParameter',
|
43
|
+
'LocatorSetParameter', 'PuzzleParameter', 'SolutionParameter',
|
44
|
+
'SEQParameter', 'ACKParameter', 'DHGroupListParameter',
|
45
|
+
'DiffieHellmanParameter', 'HIPTransformParameter', 'HIPCipherParameter',
|
46
|
+
'NATTraversalModeParameter', 'TransactionPacingParameter', 'EncryptedParameter',
|
47
|
+
'HostIDParameter', 'HITSuiteListParameter', 'CertParameter',
|
48
|
+
'NotificationParameter', 'EchoRequestSignedParameter', 'RegInfoParameter',
|
49
|
+
'RegRequestParameter', 'RegResponseParameter', 'RegFailedParameter',
|
50
|
+
'RegFromParameter', 'EchoResponseSignedParameter', 'TransportFormatListParameter',
|
51
|
+
'ESPTransformParameter', 'SeqDataParameter', 'AckDataParameter',
|
52
|
+
'PayloadMICParameter', 'TransactionIDParameter', 'OverlayIDParameter',
|
53
|
+
'RouteDstParameter', 'HIPTransportModeParameter', 'HIPMACParameter',
|
54
|
+
'HIPMAC2Parameter', 'HIPSignature2Parameter', 'HIPSignatureParameter',
|
55
|
+
'EchoRequestUnsignedParameter', 'EchoResponseUnsignedParameter', 'RelayFromParameter',
|
56
|
+
'RelayToParameter', 'RouteViaParameter', 'FromParameter',
|
57
|
+
'RVSHMACParameter', 'RelayHMACParameter',
|
58
|
+
]
|
59
|
+
|
60
|
+
if TYPE_CHECKING:
|
61
|
+
from ipaddress import IPv6Address
|
62
|
+
from typing import Any, Optional
|
63
|
+
|
64
|
+
from pcapkit.corekit.fields.field import FieldBase as Field
|
65
|
+
from pcapkit.protocols.data.internet.hip import EncryptedParameter as Data_EncryptedParameter
|
66
|
+
from pcapkit.protocols.data.internet.hip import HIPCipherParameter as Data_HIPCipherParameter
|
67
|
+
from pcapkit.protocols.protocol import ProtocolBase as Protocol
|
68
|
+
|
69
|
+
if SPHINX_TYPE_CHECKING:
|
70
|
+
from typing_extensions import Literal, TypedDict
|
71
|
+
|
72
|
+
class PacketType(TypedDict):
|
73
|
+
"""Packet type."""
|
74
|
+
|
75
|
+
#: Reversed bit.
|
76
|
+
bit_0: Literal[0]
|
77
|
+
#: Packet type.
|
78
|
+
type: int
|
79
|
+
|
80
|
+
class VersionType(TypedDict):
|
81
|
+
"""Version type."""
|
82
|
+
|
83
|
+
#: Version.
|
84
|
+
version: int
|
85
|
+
#: Reversed bit.
|
86
|
+
bit_1: Literal[1]
|
87
|
+
|
88
|
+
class ControlsType(TypedDict):
|
89
|
+
"""Controls type."""
|
90
|
+
|
91
|
+
#: Anonymous.
|
92
|
+
anonymous: bool
|
93
|
+
|
94
|
+
class LocatorFlags(TypedDict):
|
95
|
+
"""Locator flags."""
|
96
|
+
|
97
|
+
#: Preferred flag.
|
98
|
+
preferred: bool
|
99
|
+
|
100
|
+
class DIData(TypedDict):
|
101
|
+
"""DI type data."""
|
102
|
+
|
103
|
+
#: DI type.
|
104
|
+
type: Enum_DITypes
|
105
|
+
#: DI length.
|
106
|
+
len: int
|
107
|
+
|
108
|
+
class RouteFlags(TypedDict):
|
109
|
+
"""Route destination flags."""
|
110
|
+
|
111
|
+
#: Symmetric flag.
|
112
|
+
symmetric: int
|
113
|
+
#: Must-follow flag.
|
114
|
+
must_follow: int
|
115
|
+
|
116
|
+
|
117
|
+
def locator_value_selector(pkt: 'dict[str, Any]') -> 'Field':
|
118
|
+
"""Selector function for :attr:`Locator.value` field.
|
119
|
+
|
120
|
+
Args:
|
121
|
+
pkt: Packet data.
|
122
|
+
|
123
|
+
Returns:
|
124
|
+
* If ``kind`` is ``0`` and ``size`` is ``16``,
|
125
|
+
returns an :class:`~pcapkit.corekit.fields.ipaddress.IPv6AddressField` instance.
|
126
|
+
* If ``kind`` is ``1`` and ``size`` is ``20``,
|
127
|
+
returns a :class:`~pcapkit.corekit.fields.misc.SchemaField` wrapped
|
128
|
+
:class:`~pcapkit.protocols.schema.internet.hip.LocatorData` instance.
|
129
|
+
|
130
|
+
"""
|
131
|
+
if pkt['type'] == 0 and pkt['len'] == 4:
|
132
|
+
return IPv6AddressField()
|
133
|
+
if pkt['type'] == 1 and pkt['len'] == 5:
|
134
|
+
return SchemaField(
|
135
|
+
length=20,
|
136
|
+
schema=LocatorData,
|
137
|
+
)
|
138
|
+
raise FieldValueError('invalid locator type or length')
|
139
|
+
|
140
|
+
|
141
|
+
def host_id_hi_selector(pkt: 'dict[str, Any]') -> 'Field':
|
142
|
+
"""Selector function for :attr:`HostIDParameter.hi` field.
|
143
|
+
|
144
|
+
Args:
|
145
|
+
pkt: Packet data.
|
146
|
+
|
147
|
+
Returns:
|
148
|
+
* If ``algorithm`` is ``7`` (ECDSA), returns a
|
149
|
+
:class:`~pcapkit.corekit.fields.misc.SchemaField` wrapped
|
150
|
+
:class:`~pcapkit.protocols.schema.internet.hip.ECDSACurveHostIdentity` instance.
|
151
|
+
* If ``algorithm`` is ``9`` (ECDSA_LOW), returns a
|
152
|
+
:class:`~pcapkit.corekit.fields.misc.SchemaField` wrapped
|
153
|
+
:class:`~pcapkit.protocols.schema.internet.hip.ECDSALowCurveHostIdentity` instance.
|
154
|
+
* If ``algorithm`` is ``13`` (EdDSA), returns a
|
155
|
+
:class:`~pcapkit.corekit.fields.misc.SchemaField` wrapped
|
156
|
+
:class:`~pcapkit.protocols.schema.internet.hip.EdDSACurveHostIdentity` instance.
|
157
|
+
|
158
|
+
"""
|
159
|
+
algo = pkt['algorithm']
|
160
|
+
schema = HostIdentity.registry[algo]
|
161
|
+
if schema is None:
|
162
|
+
return BytesField(length=pkt['hi_len'])
|
163
|
+
return SchemaField(length=pkt['hi_len'], schema=schema)
|
164
|
+
|
165
|
+
|
166
|
+
class Parameter(EnumSchema[Enum_Parameter]):
|
167
|
+
"""Base schema for HIP parameters."""
|
168
|
+
|
169
|
+
__default__ = lambda: UnassignedParameter
|
170
|
+
|
171
|
+
#: Parameter type.
|
172
|
+
type: 'Enum_Parameter' = EnumField(length=2, namespace=Enum_Parameter)
|
173
|
+
#: Parameter length.
|
174
|
+
len: 'int' = UInt16Field()
|
175
|
+
|
176
|
+
|
177
|
+
@schema_final
|
178
|
+
class UnassignedParameter(Parameter):
|
179
|
+
"""Header schema for HIP unsigned parameters."""
|
180
|
+
|
181
|
+
#: Parameter value.
|
182
|
+
value: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
183
|
+
#: Padding.
|
184
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
185
|
+
|
186
|
+
if TYPE_CHECKING:
|
187
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', value: 'bytes') -> 'None': ...
|
188
|
+
|
189
|
+
|
190
|
+
@schema_final
|
191
|
+
class ESPInfoParameter(Parameter, code=Enum_Parameter.ESP_INFO):
|
192
|
+
"""Header schema for HIP ``ESP_INFO`` parameters."""
|
193
|
+
|
194
|
+
#: Reserved.
|
195
|
+
reserved: 'bytes' = PaddingField(length=2)
|
196
|
+
#: Key management index.
|
197
|
+
index: 'int' = UInt16Field()
|
198
|
+
#: Old SPI.
|
199
|
+
old_spi: 'int' = UInt32Field()
|
200
|
+
#: New SPI.
|
201
|
+
new_spi: 'int' = UInt32Field()
|
202
|
+
#: Padding.
|
203
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
204
|
+
|
205
|
+
if TYPE_CHECKING:
|
206
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', index: 'int',
|
207
|
+
old_spi: 'int', new_spi: 'int') -> 'None': ...
|
208
|
+
|
209
|
+
|
210
|
+
@schema_final
|
211
|
+
class R1CounterParameter(Parameter, code=Enum_Parameter.R1_COUNTER):
|
212
|
+
"""Header schema for HIP ``R1_COUNTER`` parameters."""
|
213
|
+
|
214
|
+
#: Reserved.
|
215
|
+
reserved: 'bytes' = PaddingField(length=4)
|
216
|
+
#: R1 counter.
|
217
|
+
counter: 'int' = UInt32Field()
|
218
|
+
#: Padding.
|
219
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
220
|
+
|
221
|
+
if TYPE_CHECKING:
|
222
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', counter: 'int') -> 'None': ...
|
223
|
+
|
224
|
+
|
225
|
+
@schema_final
|
226
|
+
class Locator(Schema):
|
227
|
+
"""Header schema for HIP locators."""
|
228
|
+
|
229
|
+
#: Traffic type.
|
230
|
+
traffic: 'int' = UInt8Field()
|
231
|
+
#: Locator type.
|
232
|
+
type: 'int' = UInt8Field()
|
233
|
+
#: Locator length.
|
234
|
+
len: 'int' = UInt8Field()
|
235
|
+
#: Reserved and flags.
|
236
|
+
flags: 'LocatorFlags' = BitField(
|
237
|
+
length=1,
|
238
|
+
namespace={
|
239
|
+
'preferred': (7, 1),
|
240
|
+
},
|
241
|
+
)
|
242
|
+
lifetime: 'int' = UInt32Field()
|
243
|
+
#: Locator value.
|
244
|
+
value: 'IPv6Address | LocatorData' = SwitchField(
|
245
|
+
selector=locator_value_selector,
|
246
|
+
)
|
247
|
+
|
248
|
+
if TYPE_CHECKING:
|
249
|
+
def __init__(self, traffic: 'int', type: 'int', len: 'int', flags: 'LocatorFlags',
|
250
|
+
lifetime: 'int', value: 'bytes | LocatorData') -> 'None': ...
|
251
|
+
|
252
|
+
|
253
|
+
@schema_final
|
254
|
+
class LocatorSetParameter(Parameter, code=Enum_Parameter.LOCATOR_SET):
|
255
|
+
"""Header schema for HIP ``LOCATOR_SET`` parameters."""
|
256
|
+
|
257
|
+
#: List of locators.
|
258
|
+
locators: 'list[Locator]' = ListField(
|
259
|
+
length=lambda pkt: pkt['len'],
|
260
|
+
item_type=SchemaField(schema=Locator),
|
261
|
+
)
|
262
|
+
#: Padding.
|
263
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
264
|
+
|
265
|
+
if TYPE_CHECKING:
|
266
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', locators: 'list[Locator]') -> 'None': ...
|
267
|
+
|
268
|
+
|
269
|
+
@schema_final
|
270
|
+
class LocatorData(Schema):
|
271
|
+
"""Header schema for HIP locator data."""
|
272
|
+
|
273
|
+
#: SPI.
|
274
|
+
spi: 'int' = UInt32Field()
|
275
|
+
#: Locator.
|
276
|
+
ip: 'IPv6Address' = IPv6AddressField()
|
277
|
+
|
278
|
+
if TYPE_CHECKING:
|
279
|
+
def __init__(self, spi: 'int', ip: 'IPv6Address | int | bytes | str') -> 'None': ...
|
280
|
+
|
281
|
+
|
282
|
+
@schema_final
|
283
|
+
class PuzzleParameter(Parameter, code=Enum_Parameter.PUZZLE):
|
284
|
+
"""Header schema for HIP ``PUZZLE`` parameters."""
|
285
|
+
|
286
|
+
#: Numeric index.
|
287
|
+
index: 'int' = UInt8Field()
|
288
|
+
#: Lifetime.
|
289
|
+
lifetime: 'int' = UInt8Field()
|
290
|
+
#: Opaque data.
|
291
|
+
opaque: 'bytes' = BytesField(length=2)
|
292
|
+
#: Random data.
|
293
|
+
random: 'int' = NumberField(length=lambda pkt: pkt['len'] - 4, signed=False)
|
294
|
+
#: Padding.
|
295
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
296
|
+
|
297
|
+
if TYPE_CHECKING:
|
298
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', index: 'int', lifetime: 'int',
|
299
|
+
opaque: 'bytes', random: 'int') -> 'None': ...
|
300
|
+
|
301
|
+
|
302
|
+
@schema_final
|
303
|
+
class SolutionParameter(Parameter, code=Enum_Parameter.SOLUTION):
|
304
|
+
"""Header schema for HIP ``SOLUTION`` parameters."""
|
305
|
+
|
306
|
+
#: Numeric index.
|
307
|
+
index: 'int' = UInt8Field()
|
308
|
+
#: Lifetime.
|
309
|
+
lifetime: 'int' = UInt8Field()
|
310
|
+
#: Opaque data.
|
311
|
+
opaque: 'bytes' = BytesField(length=2)
|
312
|
+
#: Random data.
|
313
|
+
random: 'int' = NumberField(length=lambda pkt: (pkt['len'] - 4) // 2, signed=False)
|
314
|
+
#: Solution.
|
315
|
+
solution: 'int' = NumberField(length=lambda pkt: (pkt['len'] - 4) // 2, signed=False)
|
316
|
+
#: Padding.
|
317
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
318
|
+
|
319
|
+
if TYPE_CHECKING:
|
320
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', index: 'int', lifetime: 'int',
|
321
|
+
opaque: 'bytes', random: 'int', solution: 'int') -> 'None': ...
|
322
|
+
|
323
|
+
|
324
|
+
@schema_final
|
325
|
+
class SEQParameter(Parameter, code=Enum_Parameter.SEQ):
|
326
|
+
"""Header schema for HIP ``SEQ`` parameters."""
|
327
|
+
|
328
|
+
#: Update ID.
|
329
|
+
update_id: 'int' = UInt32Field()
|
330
|
+
#: Padding.
|
331
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
332
|
+
|
333
|
+
if TYPE_CHECKING:
|
334
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', update_id: 'int') -> 'None': ...
|
335
|
+
|
336
|
+
|
337
|
+
@schema_final
|
338
|
+
class ACKParameter(Parameter, code=Enum_Parameter.ACK):
|
339
|
+
"""Header schema for HIP ``ACK`` parameters."""
|
340
|
+
|
341
|
+
#: Update ID.
|
342
|
+
update_id: 'list[int]' = ListField(
|
343
|
+
length=lambda pkt: pkt['len'],
|
344
|
+
item_type=UInt32Field(),
|
345
|
+
)
|
346
|
+
#: Padding.
|
347
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
348
|
+
|
349
|
+
if TYPE_CHECKING:
|
350
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', update_id: 'bytes | list[int]') -> 'None': ...
|
351
|
+
|
352
|
+
|
353
|
+
@schema_final
|
354
|
+
class DHGroupListParameter(Parameter, code=Enum_Parameter.DH_GROUP_LIST):
|
355
|
+
"""Header schema for HIP ``DH_GROUP_LIST`` parameters."""
|
356
|
+
|
357
|
+
#: List of DH groups.
|
358
|
+
groups: 'list[Enum_Group]' = ListField(
|
359
|
+
length=lambda pkt: pkt['len'],
|
360
|
+
item_type=EnumField(length=1, namespace=Enum_Group),
|
361
|
+
)
|
362
|
+
#: Padding.
|
363
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
364
|
+
|
365
|
+
if TYPE_CHECKING:
|
366
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', groups: 'list[Enum_Group]') -> 'None': ...
|
367
|
+
|
368
|
+
|
369
|
+
@schema_final
|
370
|
+
class DiffieHellmanParameter(Parameter, code=Enum_Parameter.DIFFIE_HELLMAN):
|
371
|
+
"""Header schema for HIP ``DIFFIE_HELLMAN`` parameters."""
|
372
|
+
|
373
|
+
#: Diffie-Hellman group.
|
374
|
+
group: 'Enum_Group' = EnumField(length=1, namespace=Enum_Group)
|
375
|
+
#: Public value length.
|
376
|
+
pub_len: 'int' = UInt16Field()
|
377
|
+
#: Diffie-Hellman value.
|
378
|
+
pub_val: 'int' = NumberField(length=lambda pkt: pkt['pub_len'], signed=False)
|
379
|
+
#: Padding.
|
380
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
381
|
+
|
382
|
+
if TYPE_CHECKING:
|
383
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', group: 'Enum_Group', pub_len: 'int',
|
384
|
+
pub_val: 'int') -> 'None': ...
|
385
|
+
|
386
|
+
|
387
|
+
@schema_final
|
388
|
+
class HIPTransformParameter(Parameter, code=Enum_Parameter.HIP_TRANSFORM):
|
389
|
+
"""Header schema for HIP ``TRANSFORM`` parameters."""
|
390
|
+
|
391
|
+
#: Suite IDs.
|
392
|
+
suites: 'list[Enum_Suite]' = ListField(
|
393
|
+
length=lambda pkt: pkt['len'],
|
394
|
+
item_type=EnumField(length=2, namespace=Enum_Suite),
|
395
|
+
)
|
396
|
+
#: Padding.
|
397
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
398
|
+
|
399
|
+
if TYPE_CHECKING:
|
400
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', suites: 'list[Enum_Suite]') -> 'None': ...
|
401
|
+
|
402
|
+
|
403
|
+
@schema_final
|
404
|
+
class HIPCipherParameter(Parameter, code=Enum_Parameter.HIP_CIPHER):
|
405
|
+
"""Header schema for HIP ``CIPHER`` parameters."""
|
406
|
+
|
407
|
+
#: Cipher IDs.
|
408
|
+
ciphers: 'list[Enum_Cipher]' = ListField(
|
409
|
+
length=lambda pkt: pkt['len'],
|
410
|
+
item_type=EnumField(length=2, namespace=Enum_Cipher),
|
411
|
+
)
|
412
|
+
#: Padding.
|
413
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
414
|
+
|
415
|
+
if TYPE_CHECKING:
|
416
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', ciphers: 'list[Enum_Cipher]') -> 'None': ...
|
417
|
+
|
418
|
+
|
419
|
+
@schema_final
|
420
|
+
class NATTraversalModeParameter(Parameter, code=Enum_Parameter.NAT_TRAVERSAL_MODE):
|
421
|
+
"""Header schema for HIP ``NAT_TRAVERSAL_MODE`` parameters."""
|
422
|
+
|
423
|
+
#: Reserved.
|
424
|
+
reserved: 'bytes' = PaddingField(length=2)
|
425
|
+
#: NAT traversal modes.
|
426
|
+
modes: 'list[Enum_NATTraversal]' = ListField(
|
427
|
+
length=lambda pkt: pkt['len'] - 2,
|
428
|
+
item_type=EnumField(length=1, namespace=Enum_NATTraversal),
|
429
|
+
)
|
430
|
+
#: Padding.
|
431
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
432
|
+
|
433
|
+
if TYPE_CHECKING:
|
434
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', modes: 'list[Enum_NATTraversal]') -> 'None': ...
|
435
|
+
|
436
|
+
|
437
|
+
@schema_final
|
438
|
+
class TransactionPacingParameter(Parameter, code=Enum_Parameter.TRANSACTION_PACING):
|
439
|
+
"""Header schema for HIP ``TRANSACTION_PACING`` parameters."""
|
440
|
+
|
441
|
+
#: Transaction pacing.
|
442
|
+
min_ta: 'int' = UInt32Field()
|
443
|
+
#: Padding.
|
444
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
445
|
+
|
446
|
+
if TYPE_CHECKING:
|
447
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', min_ta: 'int') -> 'None': ...
|
448
|
+
|
449
|
+
|
450
|
+
@schema_final
|
451
|
+
class EncryptedParameter(Parameter, code=Enum_Parameter.ENCRYPTED):
|
452
|
+
"""Header schema for HIP ``ENCRYPTED`` parameters."""
|
453
|
+
|
454
|
+
#: Reserved.
|
455
|
+
reserved: 'bytes' = PaddingField(length=4)
|
456
|
+
#: Initialization vector.
|
457
|
+
iv: 'bytes' = ConditionalField(
|
458
|
+
BytesField(length=16),
|
459
|
+
lambda pkt: pkt['__cipher__'] in (Enum_Cipher.AES_128_CBC, Enum_Cipher.AES_256_CBC),
|
460
|
+
)
|
461
|
+
#: Data.
|
462
|
+
data: 'bytes' = BytesField(
|
463
|
+
length=lambda pkt: pkt['len'] - (16 if pkt.get('iv') else 0),
|
464
|
+
)
|
465
|
+
#: Padding.
|
466
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
467
|
+
|
468
|
+
@classmethod
|
469
|
+
def pre_unpack(cls, packet: 'dict[str, Any]') -> 'None':
|
470
|
+
"""Prepare ``packet`` data for unpacking process.
|
471
|
+
|
472
|
+
Args:
|
473
|
+
packet: packet data
|
474
|
+
|
475
|
+
"""
|
476
|
+
if 'options' in packet:
|
477
|
+
cipher_list = cast('list[Data_HIPCipherParameter]',
|
478
|
+
packet['options'].getlist(Enum_Parameter.HIP_CIPHER))
|
479
|
+
if cipher_list:
|
480
|
+
warn(f'HIP: [ParamNo {Enum_Parameter.ENCRYPTED}] '
|
481
|
+
'missing HIP_CIPHER parameter', ProtocolWarning)
|
482
|
+
# raise ProtocolError(f'HIPv{version}: [ParamNo {schema.type}] invalid format')
|
483
|
+
|
484
|
+
cipher_id = Enum_Cipher(0xffff)
|
485
|
+
else:
|
486
|
+
cipher_ids = [] # type: list[Enum_Cipher]
|
487
|
+
for cipher in cipher_list:
|
488
|
+
cipher_ids.extend(cipher.cipher_id)
|
489
|
+
|
490
|
+
encrypted_list = cast('list[Data_EncryptedParameter]',
|
491
|
+
packet['options'].getlist(Enum_Parameter.ENCRYPTED))
|
492
|
+
encrypted_index = len(encrypted_list)
|
493
|
+
|
494
|
+
if encrypted_index >= len(cipher_ids):
|
495
|
+
warn(f'HIP: [ParamNo {Enum_Parameter.ENCRYPTED}] '
|
496
|
+
'too many ENCRYPTED parameters', ProtocolWarning)
|
497
|
+
# raise ProtocolError(f'HIPv{version}: [ParamNo {schema.type}] invalid format')
|
498
|
+
|
499
|
+
cipher_id = Enum_Cipher(0xfffe)
|
500
|
+
else:
|
501
|
+
cipher_id = cipher_ids[encrypted_index]
|
502
|
+
else:
|
503
|
+
warn(f'HIP: [ParamNo {Enum_Parameter.ENCRYPTED}] '
|
504
|
+
'missing HIP_CIPHER parameter', ProtocolWarning)
|
505
|
+
cipher_id = Enum_Cipher(0xffff)
|
506
|
+
|
507
|
+
packet['__cipher__'] = cipher_id
|
508
|
+
|
509
|
+
def post_process(self, packet: 'dict[str, Any]') -> 'Schema':
|
510
|
+
"""Revise ``schema`` data after unpacking process.
|
511
|
+
|
512
|
+
Args:
|
513
|
+
packet: Unpacked data.
|
514
|
+
|
515
|
+
Returns:
|
516
|
+
Revised schema.
|
517
|
+
|
518
|
+
"""
|
519
|
+
self.cipher = packet['__cipher__']
|
520
|
+
return self
|
521
|
+
|
522
|
+
if TYPE_CHECKING:
|
523
|
+
#: Cipher ID.
|
524
|
+
cipher: 'Enum_Cipher'
|
525
|
+
|
526
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', cipher: 'Enum_Cipher',
|
527
|
+
iv: 'Optional[bytes]', data: 'bytes') -> 'None': ...
|
528
|
+
|
529
|
+
|
530
|
+
@schema_final
|
531
|
+
class HostIDParameter(Parameter, code=Enum_Parameter.HOST_ID):
|
532
|
+
"""Header schema for HIP ``HOST_ID`` parameters."""
|
533
|
+
|
534
|
+
#: Host ID length.
|
535
|
+
hi_len: 'int' = UInt16Field()
|
536
|
+
#: Domain ID type and length.
|
537
|
+
di_data: 'DIData' = BitField(
|
538
|
+
length=4,
|
539
|
+
namespace={
|
540
|
+
'type': (0, 4),
|
541
|
+
'len': (4, 12),
|
542
|
+
},
|
543
|
+
)
|
544
|
+
#: Algorithm type.
|
545
|
+
algorithm: 'Enum_HIAlgorithm' = EnumField(length=2, namespace=Enum_HIAlgorithm)
|
546
|
+
#: Host ID.
|
547
|
+
hi: 'bytes | HostIdentity' = SwitchField(selector=host_id_hi_selector)
|
548
|
+
#: Domain ID.
|
549
|
+
di: 'bytes' = BytesField(length=lambda pkt: pkt['di_data']['len'])
|
550
|
+
#: Padding.
|
551
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
552
|
+
|
553
|
+
if TYPE_CHECKING:
|
554
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', hi_len: 'int', di_data: 'DIData',
|
555
|
+
algorithm: 'Enum_HIAlgorithm', hi: 'bytes | HostIdentity',
|
556
|
+
di: 'bytes') -> 'None': ...
|
557
|
+
|
558
|
+
|
559
|
+
class HostIdentity(EnumSchema[Enum_HIAlgorithm]):
|
560
|
+
"""Host identity schema."""
|
561
|
+
|
562
|
+
|
563
|
+
@schema_final
|
564
|
+
class ECDSACurveHostIdentity(HostIdentity, code=Enum_HIAlgorithm.ECDSA):
|
565
|
+
"""Host identity schema with ECDSA curve."""
|
566
|
+
|
567
|
+
#: Algorithm curve type.
|
568
|
+
curve: 'Enum_ECDSACurve' = EnumField(length=2, namespace=Enum_ECDSACurve)
|
569
|
+
#: Public key.
|
570
|
+
pub_key: 'bytes' = BytesField(length=lambda pkt: pkt['__length__'])
|
571
|
+
|
572
|
+
if TYPE_CHECKING:
|
573
|
+
def __init__(self, curve: 'Enum_ECDSACurve', pub_key: 'bytes') -> 'None': ...
|
574
|
+
|
575
|
+
|
576
|
+
@schema_final
|
577
|
+
class ECDSALowCurveHostIdentity(HostIdentity, code=Enum_HIAlgorithm.ECDSA_LOW):
|
578
|
+
"""Host identity schema with ECDSA_LOW curve."""
|
579
|
+
|
580
|
+
#: Algorithm curve type.
|
581
|
+
curve: 'Enum_ECDSALowCurve' = EnumField(length=2, namespace=Enum_ECDSALowCurve)
|
582
|
+
#: Public key.
|
583
|
+
pub_key: 'bytes' = BytesField(length=lambda pkt: pkt['__length__'])
|
584
|
+
|
585
|
+
if TYPE_CHECKING:
|
586
|
+
def __init__(self, curve: 'Enum_ECDSALowCurve', pub_key: 'bytes') -> 'None': ...
|
587
|
+
|
588
|
+
|
589
|
+
@schema_final
|
590
|
+
class EdDSACurveHostIdentity(HostIdentity, code=Enum_HIAlgorithm.EdDSA):
|
591
|
+
"""Host identity schema with EdDSA curve."""
|
592
|
+
|
593
|
+
#: Algorithm curve type.
|
594
|
+
curve: 'Enum_EdDSACurve' = EnumField(length=2, namespace=Enum_EdDSACurve)
|
595
|
+
#: Public key.
|
596
|
+
pub_key: 'bytes' = BytesField(length=lambda pkt: pkt['__length__'])
|
597
|
+
|
598
|
+
if TYPE_CHECKING:
|
599
|
+
def __init__(self, curve: 'Enum_EdDSACurve', pub_key: 'bytes') -> 'None': ...
|
600
|
+
|
601
|
+
|
602
|
+
@schema_final
|
603
|
+
class HITSuiteListParameter(Parameter, code=Enum_Parameter.HIT_SUITE_LIST):
|
604
|
+
"""Header schema for HIP ``HIT_SUITE_LIST`` parameters."""
|
605
|
+
|
606
|
+
#: HIT suite IDs.
|
607
|
+
suites: 'list[Enum_HITSuite]' = ListField(
|
608
|
+
length=lambda pkt: pkt['len'],
|
609
|
+
item_type=EnumField(length=1, namespace=Enum_HITSuite),
|
610
|
+
)
|
611
|
+
#: Padding.
|
612
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
613
|
+
|
614
|
+
if TYPE_CHECKING:
|
615
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', suites: 'list[Enum_HITSuite]') -> 'None': ...
|
616
|
+
|
617
|
+
|
618
|
+
@schema_final
|
619
|
+
class CertParameter(Parameter, code=Enum_Parameter.CERT):
|
620
|
+
"""Header schema for HIP ``CERT`` parameters."""
|
621
|
+
|
622
|
+
#: Certificate group.
|
623
|
+
cert_group: 'Enum_Group' = EnumField(length=1, namespace=Enum_Group)
|
624
|
+
#: Certificate count.
|
625
|
+
cert_count: 'int' = UInt8Field()
|
626
|
+
#: Certificate ID.
|
627
|
+
cert_id: 'int' = UInt8Field()
|
628
|
+
#: Certificate type.
|
629
|
+
cert_type: 'Enum_Certificate' = EnumField(length=1, namespace=Enum_Certificate)
|
630
|
+
#: Certificate data.
|
631
|
+
cert: 'bytes' = BytesField(length=lambda pkt: pkt['len'] - 4)
|
632
|
+
#: Padding.
|
633
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
634
|
+
|
635
|
+
if TYPE_CHECKING:
|
636
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', cert_group: 'Enum_Group', cert_count: 'int',
|
637
|
+
cert_id: 'int', cert_type: 'Enum_Certificate', cert: 'bytes') -> 'None': ...
|
638
|
+
|
639
|
+
|
640
|
+
@schema_final
|
641
|
+
class NotificationParameter(Parameter, code=Enum_Parameter.NOTIFICATION):
|
642
|
+
"""Header schema for HIP ``NOTIFICATION`` parameters."""
|
643
|
+
|
644
|
+
#: Reserved.
|
645
|
+
reserved: 'bytes' = PaddingField(length=2)
|
646
|
+
#: Notify message type.
|
647
|
+
msg_type: 'Enum_NotifyMessage' = EnumField(length=2, namespace=Enum_NotifyMessage)
|
648
|
+
#: Notification data.
|
649
|
+
msg: 'bytes' = BytesField(length=lambda pkt: pkt['len'] - 4)
|
650
|
+
#: Padding.
|
651
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
652
|
+
|
653
|
+
if TYPE_CHECKING:
|
654
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', msg_type: 'Enum_NotifyMessage', msg: 'bytes') -> 'None': ...
|
655
|
+
|
656
|
+
|
657
|
+
@schema_final
|
658
|
+
class EchoRequestSignedParameter(Parameter, code=Enum_Parameter.ECHO_REQUEST_SIGNED):
|
659
|
+
"""Header schema for HIP ``ECHO_REQUEST_SIGNED`` parameters."""
|
660
|
+
|
661
|
+
#: Opaque data.
|
662
|
+
opaque: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
663
|
+
#: Padding.
|
664
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
665
|
+
|
666
|
+
if TYPE_CHECKING:
|
667
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', opaque: 'bytes') -> 'None': ...
|
668
|
+
|
669
|
+
|
670
|
+
@schema_final
|
671
|
+
class RegInfoParameter(Parameter, code=Enum_Parameter.REG_INFO):
|
672
|
+
"""Header schema for HIP ``REG_INFO`` parameters."""
|
673
|
+
|
674
|
+
#: Minimum lifetime.
|
675
|
+
min_lifetime: 'int' = UInt8Field()
|
676
|
+
#: Maximum lifetime.
|
677
|
+
max_lifetime: 'int' = UInt8Field()
|
678
|
+
#: Registration types.
|
679
|
+
reg_info: 'list[Enum_Registration]' = ListField(
|
680
|
+
length=lambda pkt: pkt['len'] - 2,
|
681
|
+
item_type=EnumField(length=1, namespace=Enum_Registration),
|
682
|
+
)
|
683
|
+
#: Padding.
|
684
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
685
|
+
|
686
|
+
if TYPE_CHECKING:
|
687
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', min_lifetime: 'int', max_lifetime: 'int',
|
688
|
+
reg_info: 'list[Enum_Registration]') -> 'None': ...
|
689
|
+
|
690
|
+
|
691
|
+
@schema_final
|
692
|
+
class RegRequestParameter(Parameter, code=Enum_Parameter.REG_REQUEST):
|
693
|
+
"""Header schema for HIP ``REG_REQUEST`` parameters."""
|
694
|
+
|
695
|
+
#: Lifetime.
|
696
|
+
lifetime: 'int' = UInt8Field()
|
697
|
+
#: Registration types.
|
698
|
+
reg_request: 'list[Enum_Registration]' = ListField(
|
699
|
+
length=lambda pkt: pkt['len'] - 1,
|
700
|
+
item_type=EnumField(length=1, namespace=Enum_Registration),
|
701
|
+
)
|
702
|
+
#: Padding.
|
703
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
704
|
+
|
705
|
+
if TYPE_CHECKING:
|
706
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', lifetime: 'int', reg_request: 'list[Enum_Registration]') -> 'None': ...
|
707
|
+
|
708
|
+
|
709
|
+
@schema_final
|
710
|
+
class RegResponseParameter(Parameter, code=Enum_Parameter.REG_RESPONSE):
|
711
|
+
"""Header schema for HIP ``REG_RESPONSE`` parameters."""
|
712
|
+
|
713
|
+
#: Lifetime.
|
714
|
+
lifetime: 'int' = UInt8Field()
|
715
|
+
#: Registration types.
|
716
|
+
reg_response: 'list[Enum_Registration]' = ListField(
|
717
|
+
length=lambda pkt: pkt['len'] - 1,
|
718
|
+
item_type=EnumField(length=1, namespace=Enum_Registration),
|
719
|
+
)
|
720
|
+
#: Padding.
|
721
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
722
|
+
|
723
|
+
if TYPE_CHECKING:
|
724
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', lifetime: 'int', reg_response: 'list[Enum_Registration]') -> 'None': ...
|
725
|
+
|
726
|
+
|
727
|
+
@schema_final
|
728
|
+
class RegFailedParameter(Parameter, code=Enum_Parameter.REG_FAILED):
|
729
|
+
"""Header schema for HIP ``REG_FAILED`` parameters."""
|
730
|
+
|
731
|
+
#: Lifetime.
|
732
|
+
lifetime: 'int' = UInt8Field()
|
733
|
+
#: Registration types.
|
734
|
+
reg_failed: 'list[Enum_RegistrationFailure]' = ListField(
|
735
|
+
length=lambda pkt: pkt['len'] - 1,
|
736
|
+
item_type=EnumField(length=1, namespace=Enum_RegistrationFailure),
|
737
|
+
)
|
738
|
+
#: Padding.
|
739
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
740
|
+
|
741
|
+
if TYPE_CHECKING:
|
742
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', lifetime: 'int', reg_failed: 'list[Enum_RegistrationFailure]') -> 'None': ...
|
743
|
+
|
744
|
+
|
745
|
+
@schema_final
|
746
|
+
class RegFromParameter(Parameter, code=Enum_Parameter.REG_FROM):
|
747
|
+
"""Header schema for HIP ``REG_FROM`` parameters."""
|
748
|
+
|
749
|
+
#: Port.
|
750
|
+
port: 'int' = UInt16Field()
|
751
|
+
#: Protocol.
|
752
|
+
protocol: 'Enum_TransType' = EnumField(length=1, namespace=Enum_TransType)
|
753
|
+
#: Reserved.
|
754
|
+
reserved: 'bytes' = PaddingField(length=1)
|
755
|
+
#: Address.
|
756
|
+
address: 'IPv6Address' = IPv6AddressField()
|
757
|
+
|
758
|
+
if TYPE_CHECKING:
|
759
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', port: 'int', protocol: 'Enum_TransType', address: 'IPv6Address | bytes | int | str') -> 'None': ...
|
760
|
+
|
761
|
+
|
762
|
+
@schema_final
|
763
|
+
class EchoResponseSignedParameter(Parameter, code=Enum_Parameter.ECHO_RESPONSE_SIGNED):
|
764
|
+
"""Header schema for HIP ``ECHO_RESPONSE_SIGNED`` parameters."""
|
765
|
+
|
766
|
+
#: Opaque data.
|
767
|
+
opaque: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
768
|
+
#: Padding.
|
769
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
770
|
+
|
771
|
+
if TYPE_CHECKING:
|
772
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', opaque: 'bytes') -> 'None': ...
|
773
|
+
|
774
|
+
|
775
|
+
@schema_final
|
776
|
+
class TransportFormatListParameter(Parameter, code=Enum_Parameter.TRANSPORT_FORMAT_LIST):
|
777
|
+
"""Header schema for HIP ``TRANSPORT_FORMAT_LIST`` parameters."""
|
778
|
+
|
779
|
+
#: Transport formats.
|
780
|
+
formats: 'list[Enum_Parameter]' = ListField(
|
781
|
+
length=lambda pkt: pkt['len'] - 2,
|
782
|
+
item_type=EnumField(length=1, namespace=Enum_Parameter),
|
783
|
+
)
|
784
|
+
#: Padding.
|
785
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
786
|
+
|
787
|
+
if TYPE_CHECKING:
|
788
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', formats: 'list[Enum_Parameter]') -> 'None': ...
|
789
|
+
|
790
|
+
|
791
|
+
@schema_final
|
792
|
+
class ESPTransformParameter(Parameter, code=Enum_Parameter.ESP_TRANSFORM):
|
793
|
+
"""Header schema for HIP ``ESP_TRANSFORM`` parameters."""
|
794
|
+
|
795
|
+
#: Reserved.
|
796
|
+
reserved: 'bytes' = PaddingField(length=2)
|
797
|
+
#: Suite IDs.
|
798
|
+
suites: 'list[Enum_ESPTransformSuite]' = ListField(
|
799
|
+
length=lambda pkt: pkt['len'] - 2,
|
800
|
+
item_type=EnumField(length=1, namespace=Enum_ESPTransformSuite),
|
801
|
+
)
|
802
|
+
#: Padding.
|
803
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
804
|
+
|
805
|
+
if TYPE_CHECKING:
|
806
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', suites: 'list[Enum_ESPTransformSuite]') -> 'None': ...
|
807
|
+
|
808
|
+
|
809
|
+
@schema_final
|
810
|
+
class SeqDataParameter(Parameter, code=Enum_Parameter.SEQ_DATA):
|
811
|
+
"""Header schema for HIP ``SEQ_DATA`` parameters."""
|
812
|
+
|
813
|
+
#: Sequence number.
|
814
|
+
seq: 'int' = UInt32Field()
|
815
|
+
#: Padding.
|
816
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
817
|
+
|
818
|
+
if TYPE_CHECKING:
|
819
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', seq: 'int') -> 'None': ...
|
820
|
+
|
821
|
+
|
822
|
+
@schema_final
|
823
|
+
class AckDataParameter(Parameter, code=Enum_Parameter.ACK_DATA):
|
824
|
+
"""Header schema for HIP ``ACK_DATA`` parameters."""
|
825
|
+
|
826
|
+
#: Acked sequence number.
|
827
|
+
ack: 'list[int]' = ListField(
|
828
|
+
length=lambda pkt: pkt['len'],
|
829
|
+
item_type=UInt32Field(),
|
830
|
+
)
|
831
|
+
#: Padding.
|
832
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
833
|
+
|
834
|
+
if TYPE_CHECKING:
|
835
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', ack: 'list[int]') -> 'None': ...
|
836
|
+
|
837
|
+
|
838
|
+
@schema_final
|
839
|
+
class PayloadMICParameter(Parameter, code=Enum_Parameter.PAYLOAD_MIC):
|
840
|
+
"""Header schema for HIP ``PAYLOAD_MIC`` parameters."""
|
841
|
+
|
842
|
+
#: Next header.
|
843
|
+
next: 'Enum_TransType' = EnumField(length=1, namespace=Enum_TransType)
|
844
|
+
#: Reversed.
|
845
|
+
reserved: 'bytes' = PaddingField(length=3)
|
846
|
+
#: Payload data.
|
847
|
+
payload: 'bytes' = BytesField(length=4)
|
848
|
+
#: MIC value.
|
849
|
+
mic: 'bytes' = BytesField(length=lambda pkt: pkt['len'] - 8)
|
850
|
+
#: Padding.
|
851
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
852
|
+
|
853
|
+
if TYPE_CHECKING:
|
854
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', next: 'Enum_TransType', payload: 'bytes', mic: 'bytes') -> 'None': ...
|
855
|
+
|
856
|
+
|
857
|
+
@schema_final
|
858
|
+
class TransactionIDParameter(Parameter, code=Enum_Parameter.TRANSACTION_ID):
|
859
|
+
"""Header schema for HIP ``TRANSACTION_ID`` parameters."""
|
860
|
+
|
861
|
+
#: Transaction ID.
|
862
|
+
id: 'int' = NumberField(length=lambda pkt: pkt['len'], signed=False)
|
863
|
+
#: Padding.
|
864
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
865
|
+
|
866
|
+
if TYPE_CHECKING:
|
867
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', id: 'int') -> 'None': ...
|
868
|
+
|
869
|
+
|
870
|
+
@schema_final
|
871
|
+
class OverlayIDParameter(Parameter, code=Enum_Parameter.OVERLAY_ID):
|
872
|
+
"""Header schema for HIP ``OVERLAY_ID`` parameters."""
|
873
|
+
|
874
|
+
#: Overlay ID.
|
875
|
+
id: 'int' = NumberField(length=lambda pkt: pkt['len'], signed=False)
|
876
|
+
#: Padding.
|
877
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
878
|
+
|
879
|
+
if TYPE_CHECKING:
|
880
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', id: 'int') -> 'None': ...
|
881
|
+
|
882
|
+
|
883
|
+
@schema_final
|
884
|
+
class RouteDstParameter(Parameter, code=Enum_Parameter.ROUTE_DST):
|
885
|
+
"""Header schema for HIP ``ROUTE_DST`` parameters."""
|
886
|
+
|
887
|
+
#: Flags.
|
888
|
+
flags: 'RouteFlags' = BitField(length=2, namespace={
|
889
|
+
'symmetric': (0, 1),
|
890
|
+
'must_follow': (1, 1),
|
891
|
+
})
|
892
|
+
#: Reserved.
|
893
|
+
reserved: 'bytes' = PaddingField(length=2)
|
894
|
+
#: HIT addresses.
|
895
|
+
hit: 'list[IPv6Address]' = ListField(
|
896
|
+
length=lambda pkt: pkt['len'] - 4,
|
897
|
+
item_type=IPv6AddressField(),
|
898
|
+
)
|
899
|
+
#: Padding.
|
900
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
901
|
+
|
902
|
+
if TYPE_CHECKING:
|
903
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', flags: 'RouteFlags', hit: 'list[str | int | bytes | IPv6Address]') -> 'None': ...
|
904
|
+
|
905
|
+
|
906
|
+
@schema_final
|
907
|
+
class HIPTransportModeParameter(Parameter, code=Enum_Parameter.HIP_TRANSPORT_MODE):
|
908
|
+
"""Header schema for HIP ``HIP_TRANSPORT_MODE`` parameters."""
|
909
|
+
|
910
|
+
#: Port.
|
911
|
+
port: 'int' = UInt16Field()
|
912
|
+
#: Mode IDs.
|
913
|
+
mode: 'list[Enum_Transport]' = ListField(
|
914
|
+
length=lambda pkt: pkt['len'] - 2,
|
915
|
+
item_type=EnumField(length=2, namespace=Enum_Transport),
|
916
|
+
)
|
917
|
+
#: Padding.
|
918
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
919
|
+
|
920
|
+
if TYPE_CHECKING:
|
921
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', port: 'int', mode: 'list[Enum_Transport]') -> 'None': ...
|
922
|
+
|
923
|
+
|
924
|
+
@schema_final
|
925
|
+
class HIPMACParameter(Parameter, code=Enum_Parameter.HIP_MAC):
|
926
|
+
"""Header schema for HIP ``HIP_MAC`` parameters."""
|
927
|
+
|
928
|
+
#: HMAC value.
|
929
|
+
hmac: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
930
|
+
#: Padding.
|
931
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
932
|
+
|
933
|
+
if TYPE_CHECKING:
|
934
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', hmac: 'bytes') -> 'None': ...
|
935
|
+
|
936
|
+
|
937
|
+
@schema_final
|
938
|
+
class HIPMAC2Parameter(Parameter, code=Enum_Parameter.HIP_MAC_2):
|
939
|
+
"""Header schema for HIP ``HIP_MAC_2`` parameters."""
|
940
|
+
|
941
|
+
#: HMAC value.
|
942
|
+
hmac: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
943
|
+
#: Padding.
|
944
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
945
|
+
|
946
|
+
if TYPE_CHECKING:
|
947
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', hmac: 'bytes') -> 'None': ...
|
948
|
+
|
949
|
+
|
950
|
+
@schema_final
|
951
|
+
class HIPSignature2Parameter(Parameter, code=Enum_Parameter.HIP_SIGNATURE_2):
|
952
|
+
"""Header schema for HIP ``HIP_SIGNATURE_2`` parameters."""
|
953
|
+
|
954
|
+
#: Signature algorithm.
|
955
|
+
algorithm: 'Enum_HIAlgorithm' = EnumField(length=2, namespace=Enum_HIAlgorithm)
|
956
|
+
#: Signature value.
|
957
|
+
signature: 'bytes' = BytesField(length=lambda pkt: pkt['len'] - 2)
|
958
|
+
#: Padding.
|
959
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
960
|
+
|
961
|
+
if TYPE_CHECKING:
|
962
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', algorithm: 'Enum_HIAlgorithm', signature: 'bytes') -> 'None': ...
|
963
|
+
|
964
|
+
|
965
|
+
@schema_final
|
966
|
+
class HIPSignatureParameter(Parameter, code=Enum_Parameter.HIP_SIGNATURE):
|
967
|
+
"""Header schema for HIP ``HIP_SIGNATURE`` parameters."""
|
968
|
+
|
969
|
+
#: Signature algorithm.
|
970
|
+
algorithm: 'Enum_HIAlgorithm' = EnumField(length=2, namespace=Enum_HIAlgorithm)
|
971
|
+
#: Signature value.
|
972
|
+
signature: 'bytes' = BytesField(length=lambda pkt: pkt['len'] - 2)
|
973
|
+
#: Padding.
|
974
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
975
|
+
|
976
|
+
if TYPE_CHECKING:
|
977
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', algorithm: 'Enum_HIAlgorithm', signature: 'bytes') -> 'None': ...
|
978
|
+
|
979
|
+
|
980
|
+
@schema_final
|
981
|
+
class EchoRequestUnsignedParameter(Parameter, code=Enum_Parameter.ECHO_REQUEST_UNSIGNED):
|
982
|
+
"""Header schema for HIP ``ECHO_REQUEST_UNSIGNED`` parameters."""
|
983
|
+
|
984
|
+
#: Opaque data.
|
985
|
+
opaque: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
986
|
+
#: Padding.
|
987
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
988
|
+
|
989
|
+
if TYPE_CHECKING:
|
990
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', opaque: 'bytes') -> 'None': ...
|
991
|
+
|
992
|
+
|
993
|
+
@schema_final
|
994
|
+
class EchoResponseUnsignedParameter(Parameter, code=Enum_Parameter.ECHO_RESPONSE_UNSIGNED):
|
995
|
+
"""Header schema for HIP ``ECHO_RESPONSE_UNSIGNED`` parameters."""
|
996
|
+
|
997
|
+
#: Opaque data.
|
998
|
+
opaque: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
999
|
+
#: Padding.
|
1000
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1001
|
+
|
1002
|
+
if TYPE_CHECKING:
|
1003
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', opaque: 'bytes') -> 'None': ...
|
1004
|
+
|
1005
|
+
|
1006
|
+
@schema_final
|
1007
|
+
class RelayFromParameter(Parameter, code=Enum_Parameter.RELAY_FROM):
|
1008
|
+
"""Header schema for HIP ``RELAY_FROM`` parameters."""
|
1009
|
+
|
1010
|
+
#: Port.
|
1011
|
+
port: 'int' = UInt16Field()
|
1012
|
+
#: Protocol.
|
1013
|
+
protocol: 'Enum_TransType' = EnumField(length=1, namespace=Enum_TransType)
|
1014
|
+
#: Reserved.
|
1015
|
+
reserved: 'bytes' = PaddingField(length=1)
|
1016
|
+
#: Address.
|
1017
|
+
address: 'IPv6Address' = IPv6AddressField()
|
1018
|
+
|
1019
|
+
if TYPE_CHECKING:
|
1020
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', port: 'int', protocol: 'Enum_TransType', address: 'str | bytes | int | IPv6Address') -> 'None': ...
|
1021
|
+
|
1022
|
+
|
1023
|
+
@schema_final
|
1024
|
+
class RelayToParameter(Parameter, code=Enum_Parameter.RELAY_TO):
|
1025
|
+
"""Header schema for HIP ``RELAY_TO`` parameters."""
|
1026
|
+
|
1027
|
+
#: Port.
|
1028
|
+
port: 'int' = UInt16Field()
|
1029
|
+
#: Protocol.
|
1030
|
+
protocol: 'Enum_TransType' = EnumField(length=1, namespace=Enum_TransType)
|
1031
|
+
#: Reserved.
|
1032
|
+
reserved: 'bytes' = PaddingField(length=1)
|
1033
|
+
#: Address.
|
1034
|
+
address: 'IPv6Address' = IPv6AddressField()
|
1035
|
+
|
1036
|
+
if TYPE_CHECKING:
|
1037
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', port: 'int', protocol: 'Enum_TransType', address: 'str | bytes | int | IPv6Address') -> 'None': ...
|
1038
|
+
|
1039
|
+
|
1040
|
+
@schema_final
|
1041
|
+
class OverlayTTLParameter(Parameter, code=Enum_Parameter.OVERLAY_TTL):
|
1042
|
+
"""Header schema for HIP ``OVERLAY_TTL`` parameters."""
|
1043
|
+
|
1044
|
+
#: TTL value.
|
1045
|
+
ttl: 'int' = UInt16Field()
|
1046
|
+
#: Reserved.
|
1047
|
+
reserved: 'bytes' = PaddingField(length=2)
|
1048
|
+
#: Padding.
|
1049
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1050
|
+
|
1051
|
+
if TYPE_CHECKING:
|
1052
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', ttl: 'int') -> 'None': ...
|
1053
|
+
|
1054
|
+
|
1055
|
+
@schema_final
|
1056
|
+
class RouteViaParameter(Parameter, code=Enum_Parameter.ROUTE_VIA):
|
1057
|
+
"""Header schema for HIP ``ROUTE_VIA`` parameters."""
|
1058
|
+
|
1059
|
+
#: Flags.
|
1060
|
+
flags: 'RouteFlags' = BitField(length=2, namespace={
|
1061
|
+
'symmetric': (0, 1),
|
1062
|
+
'must_follow': (1, 1),
|
1063
|
+
})
|
1064
|
+
#: Reserved.
|
1065
|
+
reserved: 'bytes' = PaddingField(length=2)
|
1066
|
+
#: HIT addresses.
|
1067
|
+
hit: 'list[IPv6Address]' = ListField(
|
1068
|
+
length=lambda pkt: pkt['len'] - 4,
|
1069
|
+
item_type=IPv6AddressField(),
|
1070
|
+
)
|
1071
|
+
#: Padding.
|
1072
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1073
|
+
|
1074
|
+
if TYPE_CHECKING:
|
1075
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', flags: 'RouteFlags', hit: 'list[str | bytes | int | IPv6Address]') -> 'None': ...
|
1076
|
+
|
1077
|
+
|
1078
|
+
@schema_final
|
1079
|
+
class FromParameter(Parameter, code=Enum_Parameter.FROM):
|
1080
|
+
"""Header schema for HIP ``FROM`` parameters."""
|
1081
|
+
|
1082
|
+
#: Address.
|
1083
|
+
address: 'IPv6Address' = IPv6AddressField()
|
1084
|
+
#: Padding.
|
1085
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1086
|
+
|
1087
|
+
if TYPE_CHECKING:
|
1088
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', address: 'str | bytes | int | IPv6Address') -> 'None': ...
|
1089
|
+
|
1090
|
+
|
1091
|
+
@schema_final
|
1092
|
+
class RVSHMACParameter(Parameter, code=Enum_Parameter.RVS_HMAC):
|
1093
|
+
"""Header schema for HIP ``RVS_HMAC`` parameters."""
|
1094
|
+
|
1095
|
+
#: HMAC value.
|
1096
|
+
hmac: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
1097
|
+
#: Padding.
|
1098
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1099
|
+
|
1100
|
+
if TYPE_CHECKING:
|
1101
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', hmac: 'bytes') -> 'None': ...
|
1102
|
+
|
1103
|
+
|
1104
|
+
@schema_final
|
1105
|
+
class ViaRVSParameter(Parameter, code=Enum_Parameter.VIA_RVS):
|
1106
|
+
"""Header schema for HIP ``VIA_RVS`` parameters."""
|
1107
|
+
|
1108
|
+
#: Address.
|
1109
|
+
address: 'list[IPv6Address]' = ListField(
|
1110
|
+
length=lambda pkt: pkt['len'],
|
1111
|
+
item_type=IPv6AddressField(),
|
1112
|
+
)
|
1113
|
+
#: Padding.
|
1114
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1115
|
+
|
1116
|
+
if TYPE_CHECKING:
|
1117
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', address: 'list[str | bytes | int | IPv6Address]') -> 'None': ...
|
1118
|
+
|
1119
|
+
|
1120
|
+
@schema_final
|
1121
|
+
class RelayHMACParameter(Parameter, code=Enum_Parameter.RELAY_HMAC):
|
1122
|
+
"""Header schema for HIP ``RELAY_HMAC`` parameters."""
|
1123
|
+
|
1124
|
+
#: HMAC value.
|
1125
|
+
hmac: 'bytes' = BytesField(length=lambda pkt: pkt['len'])
|
1126
|
+
#: Padding.
|
1127
|
+
padding: 'bytes' = PaddingField(length=lambda pkt: (8 - (pkt['len'] % 8)) % 8)
|
1128
|
+
|
1129
|
+
if TYPE_CHECKING:
|
1130
|
+
def __init__(self, type: 'Enum_Parameter', len: 'int', hmac: 'bytes') -> 'None': ...
|
1131
|
+
|
1132
|
+
|
1133
|
+
@schema_final
|
1134
|
+
class HIP(Schema):
|
1135
|
+
"""Header schema for HIP packet."""
|
1136
|
+
|
1137
|
+
#: Next header.
|
1138
|
+
next: 'Enum_TransType' = EnumField(length=1, namespace=Enum_TransType)
|
1139
|
+
#: Header length.
|
1140
|
+
len: 'int' = UInt8Field()
|
1141
|
+
#: Packet type.
|
1142
|
+
pkt: 'PacketType' = BitField(
|
1143
|
+
length=1,
|
1144
|
+
namespace={
|
1145
|
+
'bit_0': (0, 1),
|
1146
|
+
'type': (1, 7),
|
1147
|
+
},
|
1148
|
+
)
|
1149
|
+
#: HIP version.
|
1150
|
+
ver: 'VersionType' = BitField(
|
1151
|
+
length=1,
|
1152
|
+
namespace={
|
1153
|
+
'version': (0, 4),
|
1154
|
+
'bit_1': (7, 1),
|
1155
|
+
},
|
1156
|
+
)
|
1157
|
+
#: Checksum.
|
1158
|
+
checksum: 'bytes' = BytesField(length=2)
|
1159
|
+
#: HIP controls.
|
1160
|
+
control: 'ControlsType' = BitField(
|
1161
|
+
length=2,
|
1162
|
+
namespace={
|
1163
|
+
'anonymous': (15, 1),
|
1164
|
+
},
|
1165
|
+
)
|
1166
|
+
#: Sender's host identity tag.
|
1167
|
+
shit: 'int' = NumberField(length=16, signed=False)
|
1168
|
+
#: Receiver's host identity tag.
|
1169
|
+
rhit: 'int' = NumberField(length=16, signed=False)
|
1170
|
+
#: HIP parameters.
|
1171
|
+
param: 'list[Parameter]' = OptionField(
|
1172
|
+
length=lambda pkt: (pkt['len'] - 4) * 8,
|
1173
|
+
base_schema=Parameter,
|
1174
|
+
type_name='type',
|
1175
|
+
registry=Parameter.registry,
|
1176
|
+
)
|
1177
|
+
#: Payload.
|
1178
|
+
payload: 'bytes' = PayloadField()
|
1179
|
+
|
1180
|
+
if TYPE_CHECKING:
|
1181
|
+
def __init__(self, next: 'Enum_TransType', len: 'int', pkt: 'PacketType',
|
1182
|
+
ver: 'VersionType', checksum: 'bytes', control: 'ControlsType',
|
1183
|
+
shit: 'int', rhit: 'int', param: 'bytes | list[bytes | Parameter]',
|
1184
|
+
payload: 'bytes | Protocol | Schema') -> 'None': ...
|