lib/stun/src/root.zig

daab053ee43316e1809a84551d573ddd1e5bf3d2

 1 //! Stun builds and reads STUN messages, parses the type-length-value records
 2 //! following the message header (*attributes*), and verifies message integrity.
 3 //! Encoding writes into caller-supplied output storage. `Message.decode` reads
 4 //! immutable input and returns a `Message` that retains the input slice, so the
 5 //! caller keeps it alive and unchanged while using that decoded view. Encoding
 6 //! and decoding need no dynamic allocation.
 7 //!
 8 //! Following RFC 8489 framing, integrity verification computes HMAC-SHA1 or
 9 //! HMAC-SHA256 with a locally substituted two-byte header length. That length
10 //! describes the message through the end of the integrity attribute, while the
11 //! bytes authenticated stop at the start of that integrity attribute. Later
12 //! attributes, including `FINGERPRINT`, are outside this HMAC input.
13 //! Verification compares the computed digest with the digest stored in the
14 //! integrity attribute.
15 //!
16 //! Formal message properties and their testing links are cataloged under
17 //! `verification/stun`, where the formal model treats HMAC and hash functions
18 //! as opaque.
19 
20 const attribute_mod = @import("attribute.zig");
21 const integrity_mod = @import("integrity.zig");
22 const message_mod = @import("message.zig");
23 
24 pub const Address = attribute_mod.Address;
25 pub const Attribute = attribute_mod.Attribute;
26 pub const AttributeType = attribute_mod.Type;
27 pub const ChangeRequest = attribute_mod.ChangeRequest;
28 pub const PasswordAlgorithm = attribute_mod.PasswordAlgorithm;
29 pub const Value = attribute_mod.Value;
30 
31 pub const Builder = message_mod.Builder;
32 pub const Capacity = message_mod.Capacity;
33 pub const Class = message_mod.Class;
34 pub const DecodeError = message_mod.DecodeError;
35 pub const EncodeError = message_mod.EncodeError;
36 pub const Header = message_mod.Header;
37 pub const Limits = message_mod.Limits;
38 pub const Message = message_mod.Message;
39 pub const Method = message_mod.Method;
40 pub const TransactionId = message_mod.TransactionId;
41 pub const VerifyError = message_mod.VerifyError;
42 pub const max_attribute_count = message_mod.max_attribute_count;
43 pub const max_message_bytes = message_mod.max_message_bytes;
44 pub const magic_cookie = message_mod.magic_cookie;
45 
46 pub const CredentialError = integrity_mod.CredentialError;
47 pub const longTermKeyMd5 = integrity_mod.longTermKeyMd5;
48 pub const longTermKeySha256 = integrity_mod.longTermKeySha256;
49 pub const shortTermKey = integrity_mod.shortTermKey;