moonbitstack/moontls/wire does not have a README file

    Refused

    pub(all) suberror Refused derive(Eq,
    Debug
    )

    A structure that does not fit its own lengths (RFC 8446 §3): a length running past the end, a vector outside its bounds or not a whole number of elements, or octets left over. A peer is owed a decode_error for each, which is what a connection turns this into.

    Refused::equal

    fn Refused::equal(Refused, Refused) -> Bool

    Refused::not_equal

    fn Refused::not_equal(x : Refused, y : Refused) -> Bool

    Refused::to_repr

    Reader

    pub struct Reader {
    // private fields
    }

    A cursor over one encoded structure. Every read checks the length it relies on, so a decoder is a run of reads ending in end, with no offset arithmetic of its own to get wrong.

    Reader::codes

    fn Reader::codes(self : Reader) -> Array[Int] raise Refused

    The 16-bit codes up to the end, the shape of every list of suites, groups, schemes and versions.

    Reader::end

    fn Reader::end(self : Reader) -> Unit raise Refused

    Raise when anything is left: a structure ends where its length says.

    Reader::is_empty

    fn Reader::is_empty(self : Reader) -> Bool

    Reader::new

    fn Reader::new(view : BytesView) -> Reader

    Reader::rest

    fn Reader::rest(self : Reader) -> BytesView

    Everything not yet read.

    Reader::take

    fn Reader::take(self : Reader, n : Int) -> BytesView raise Refused

    The next n octets.

    Reader::u16

    fn Reader::u16(self : Reader) -> Int raise Refused

    Reader::u24

    fn Reader::u24(self : Reader) -> Int raise Refused

    Reader::u8

    fn Reader::u8(self : Reader) -> Int raise Refused

    Reader::vec

    fn Reader::vec(self : Reader, width : Int, min? : Int, unit? : Int) -> Reader raise Refused

    A vector behind a width-octet length (RFC 8446 §3), as a cursor of its own. min is the least length the structure allows and unit the size of one element, which the length must be a whole multiple of.

    decode

    fn[T] decode(view : BytesView, read : (Reader) -> T raise Refused) -> T raise Refused

    Read all of view as one structure with read, refusing it when it does not fit its lengths or leaves octets over.

    The refusal is the answer, not a None: every caller of this either turns it into a decode_error for the peer or has nothing better to do with a structure that does not parse.

    legacy_version

    let legacy_version : Int

    The version octets TLS 1.3 freezes at TLS 1.2's value, 0x0303.

    It appears as TLSPlaintext.legacy_record_version (RFC 8446 §5.1) and as ClientHello.legacy_version (§4.1.2); the real version is negotiated by the supported_versions extension. A receiver ignores it, and it is written only so a middlebox watching for a TLS 1.2 handshake sees one.

    read_u16

    fn read_u16(view : BytesView, at : Int) -> Int

    Read a 16-bit big-endian integer at at. Past the end of view it aborts, as an index out of range does.

    read_u24

    fn read_u24(view : BytesView, at : Int) -> Int

    Read a 24-bit big-endian integer at at. Past the end of view it aborts, as an index out of range does.

    read_u64

    fn read_u64(view : BytesView, at : Int) -> UInt64

    Read a 64-bit big-endian integer at at. Past the end of view it aborts, as an index out of range does.

    try_decode

    fn[T] try_decode(view : BytesView, read : (Reader) -> T raise Refused) -> T?

    [decode] where a structure that does not parse is None rather than a refusal — for the payloads whose absence is itself an answer, such as an optional extension body a hello may simply not carry.

    u16

    fn u16(out :
    Buffer
    , value : Int) -> Unit

    Append a 16-bit big-endian integer.

    u24

    fn u24(out :
    Buffer
    , value : Int) -> Unit

    Append a 24-bit big-endian integer — the width RFC 8446 §4 gives a handshake message's length.

    u64

    fn u64(out :
    Buffer
    , value : UInt64) -> Unit

    Append a 64-bit big-endian integer — the width RFC 9147 §4 gives each half of a DTLS record number.

    Source Files