netpkt#
network packets byte for byte: addresses, checksums, Ethernet to TCP codecs, DHCP, DNS, NTP, syslog, SNMP, SSH, TLS 1.3, EAP and IMAP without I/O, X.509, cookies, URI references, a dissector, pcapng -- crate root lib/netpkt/lib.rs
netpkt -- network packets byte for byte: addresses, checksums, header codecs, a dissector
and capture files. No I/O, no clock, no randomness: everything is deterministic and works
on every target (simulators, packet tools, tests).
addr Mac, Ipv4, Ipv6, IpAddr, Prefix4, Prefix6, wildcard_match
checksum Internet checksum (sum / finish / verify / pseudo_v4 / pseudo_v6 / update16),
crc32 (Ethernet FCS)
pkt Pkt: a buffer with headroom, headers are prepended in place
eth Ethernet II (EthView, EthHdr), 802.1Q tags (VlanTag, tag_of, tagged, untagged,
L2), 802.2 LLC
arp ArpView, Arp (request / reply / probe / announce) (RFC 826, 5227)
ipv4 Ipv4View, Ipv4Hdr, dec_ttl, fragment, Reassembly (RFC 791, 1624)
ipv6 Ipv6View, Ipv6Hdr, upper_layer / ext_headers (extension header walk),
FragHdr, fragment, Reassembly6 (RFC 8200, 5722)
icmp IcmpView, Icmp, error_quote, name (RFC 792, 1191)
udp UdpView, UdpHdr (push_v4 / push_v6 with checksum) (RFC 768)
tcp TcpView, TcpHdr, TcpOpts (MSS, WS, SACK, TS), seq_lt ... (RFC 9293, 7323, 2018)
dhcp DhcpView, Dhcp with typed options (Opt), MsgType (RFC 2131, 2132, 3046)
dns Message, Header, Question, Rr, RData, names with compression (RFC 1035, 3596)
dnssec canonical records, RRSIG / DS checks, NSEC and NSEC3 denial (RFC 4033-4035,
5155, 6840, 9276, 9824, 9905); the chain of trust is netio::dns's
ntp NtpView, Ntp, Ts (32.32 timestamps), offset_delay (RFC 5905)
syslog pri / bsd / ios formatting, parse (RFC 3164, IOS)
decode stack / proto_mask / layers / info: layers with fields and byte ranges for
packet inspectors, P_* bits for filters, one-line summaries
pcapng Writer (section, interfaces, enhanced packets), read
http HTTP/1.1 without I/O: Parser (fed as bytes arrive, says when it needs more),
Head, Headers, framing, encode_request / encode_response / chunks (RFC 9112)
stp BPDUs of STP and RSTP: Configuration, TCN and RST BPDUs with their flags,
BridgeId, PortId, path_cost, the 802.3 / LLC frame (802.1D-1998, 802.1D-2004)
rip RipView, Rip, Rte, Auth: RIP requests and responses, version 2 and 1, the
authentication entry recognised (RFC 2453, 1058)
nat address and port translation in place: Flow (what translation and filters look
at), rewrite / rewrite_quoted with incremental checksums (RFC 3022, 1624, 5508)
icmpv6 Icmp6View, Icmp6 (echo and the errors with their quote), Nd: router and neighbor
solicitations and advertisements, redirects, their options (link-layer
addresses, prefix information, MTU); error_quote, name (RFC 4443, 4861, 4862)
ospf OspfView, Packet (Hello, Database Description, Link State Request, Update,
Acknowledgment), LsaHeader, Lsa (router, network, summary, AS-external) with the
Fletcher checksum, compare (which instance is newer) (RFC 2328, RFC 905)
addrsel destination address selection: scope, the default policy table (precedence,
label), Dest and sort, the order getaddrinfo tries addresses in (RFC 6724)
eapol EapolView, Key: EAPOL-Key frames of the 4-way handshake (Key Information bits,
replay counter, nonces, MIC field, key data), the RSN element, KDEs (GTK,
IGTK); mic_input / set_mic for the caller's MIC (802.1X-2004, 802.11-2020 12.7)
bgp BGP-4 messages: frame (a message out of a TCP stream), BgpView, Message (OPEN with
capabilities, UPDATE with its path attributes, NOTIFICATION, KEEPALIVE,
ROUTE-REFRESH), BgpErr (the NOTIFICATION a receiver sends) (RFC 4271, 5492,
6793, 2918, 1997, 4486)
tftp TftpView, Packet (RRQ, WRQ, DATA, ACK, ERROR, OACK) with their options, error
codes, netascii, looks_like (a transfer away from port 69) (RFC 1350, 2347-2349)
ftp Command, Reply (multi-line), Lines, ReplyReader, host_port (PORT, 227), eprt,
epsv_port (229), the reply texts as the server's own words (RFC 959, 2428, 2389)
smtp Command, Path (MAIL FROM / RCPT TO with parameters), Reply (multi-line, enhanced
status codes), ReplyReader, Ehlo (keywords: SIZE, 8BITMIME, PIPELINING, AUTH),
Stream (the server's commands and DATA with dot-stuffing), stuff, AUTH PLAIN and
LOGIN, received (RFC 5321, 1870, 6152, 2920, 2034, 3463, 4954, 4616)
pop3 Command, Response (+OK / -ERR, multi-line with dot-stuffing), multi_line, Reader
(the responses of a server in pieces) (RFC 1939, 2449)
imf Internet messages: Message (header fields folded and unfolded, the body as text),
Mailbox (addresses with display names), Date, Message-ID, encoded words,
quoted-printable, base64, multipart parts, Draft (a plain-text message in UTF-8)
(RFC 5322, 2045-2047, 3464)
ber ASN.1 BER as SNMP uses it: Oid (dotted, lexicographic order), Value (the SMI's
types and the exceptions of SNMPv2), Reader / Writer, strict lengths (X.690, RFC 3417)
snmp SNMPv1 and v2c messages: community, the PDUs Get, GetNext, GetBulk, Set, Response,
the v1 Trap, SNMPv2-Trap, Inform and Report; error statuses and their v1 mapping,
the objects of notifications (RFC 1157, 1901, 3416, 3584)
mib the objects of SNMPv2-MIB, IF-MIB, IP-MIB and IP-FORWARD-MIB an agent of the
simulator serves: names, OIDs, syntax, access, lookup by name, values as net-snmp's
tools print them (RFC 3418, 2863, 4293, 2096)
telnet NVT commands, option negotiation without loops (Options: the Q method), IAC
escaping, NVT line ends, Reader for bytes in pieces, parse (RFC 854, 855, 857,
858, 1143)
radius RadiusView, Packet, Attr: authentication and accounting with every attribute of
RFC 2865 / 2866 by number and name (vendor-specific ones as bytes), the hiding of
User-Password, Request / Response Authenticators, the Message-Authenticator; the
caller lends MD5 and HMAC-MD5 (crypto) (RFC 2865, 2866, 3579)
uri Uri: references with scheme, authority, path, query and fragment, resolving a
relative one against a base, remove_dot_segments, percent encoding, the form
encoding of HTML (RFC 3986)
snmpv3 SNMPv3 messages (V3, Usm, ScopedPdu), the USM: Level, AuthProto (HMAC-MD5-96, HMAC-SHA-96,
the SHA-2 tags of RFC 7860), password_to_key, localize, sign, check, AES-128-CFB, engine
IDs, report PDUs; uses crate crypto (RFC 3411-3414, 3826, 7860)
ssh SSH-2 without I/O: Core for a client or a server (push bytes, take_out bytes,
take_events): identification, binary packets, KEXINIT, curve25519-sha256, ssh-ed25519
and rsa-sha2-256, chacha20-poly1305@openssh.com, aes128-ctr and aes256-ctr with
hmac-sha2-256, logins (none, password, publickey), session channels with windows;
KeyPair, OpenSSH key files, dissect; uses crate crypto (RFC 4250-4254, 8731, 8332, 8709)
eap Packet: EAP Request, Response, Success and Failure with Identity, Notification and
Nak, the data of EAP-MD5 (Md5Data, md5_value) and of EAP-PWD (Pwd, PwdId), info
for one line about a packet (RFC 3748, 1994, 5931)
imap Line and LineReader (tags, literals), Command, Response, Item, SeqSet, FetchItem,
SearchKey, envelope, internal_date, the parts of a message (RFC 9051, 3501)
cookie SetCookie::parse, parse_date, domain_match, path_match, default_path, site_of; Jar:
store, header, matching, script_text, purge, drop_session; SameSite as far as a small
browser needs it; the time comes from the caller (RFC 6265, 6265bis)
psl the Public Suffix List: public_suffix, registrable_domain, is_public_suffix (the
list as a table, psl_data.rs, MPL-2.0; tools/psl_gen.py makes it) (publicsuffix.org)
x509 certificates: the crate jflib-x509 (netio's as well), CertSpec as its builder's
earlier name, check_chain: what is wrong with a chain as fault bits for dialogs
signed_by, check_chain with F_* faults; no clock; uses crate crypto (RFC 5280, 8410)
tls TLS 1.3 without I/O: Core for a client or a server (push bytes, take_out bytes, read,
send, take_events), TLS_CHACHA20_POLY1305_SHA256, X25519, Ed25519; the key schedule,
the names of the protocol's numbers, dissect; uses crate crypto (RFC 8446)
Views (XxxView::parse) check lengths once and then read fields without copying; records
(XxxHdr, Arp, Icmp) write headers, usually with push_onto / push_v4 into a Pkt. Multi-byte
fields are big endian (network order); be16 / be32 / put16 / put32 below read and write them.
Sections
- netpkt crate root
- netpkt/addr.rs
- netpkt/arp.rs
- netpkt/checksum.rs
- netpkt/decode.rs
- netpkt/dhcp.rs
- netpkt/dns.rs
- netpkt/dnssec.rs
- netpkt/eth.rs
- netpkt/icmp.rs
- netpkt/ipv4.rs
- netpkt/ipv6.rs
- netpkt/ntp.rs
- netpkt/pcapng.rs
- netpkt/pkt.rs
- netpkt/syslog.rs
- netpkt/tcp.rs
- netpkt/udp.rs
- netpkt/http.rs
- netpkt/stp.rs
- netpkt/rip.rs
- netpkt/nat.rs
- netpkt/icmpv6.rs
- netpkt/ospf.rs
- netpkt/addrsel.rs
- netpkt/eapol.rs
- netpkt/bgp.rs
- netpkt/tftp.rs
- netpkt/ftp.rs
- netpkt/smtp.rs
- netpkt/pop3.rs
- netpkt/imf.rs
- netpkt/ber.rs
- netpkt/snmp.rs
- netpkt/mib.rs
- netpkt/telnet.rs
- netpkt/radius.rs
- netpkt/uri.rs
- netpkt/ssh.rs
- netpkt/snmpv3.rs
- netpkt/eap.rs
- netpkt/imap.rs
- netpkt/cookie.rs
- netpkt/psl.rs
- netpkt/x509.rs
- netpkt/tls.rs