xdr v0.1.2 XDR.Type.VariableOpaque View Source

RFC 4506, Section 4.10 - Variable-length Opaque Data

Link to this section Summary

Types

t()

A binary of max-length 2^32 - 1

Functions

Decodes a valid variable opaque xdr binary, removing the 4-byte length and any provided padding

Encodes a valid variable opaque binary, prepending the 4-byte length of the binary and appending any necessary padding

Determines if a value is a binary of a valid length

Link to this section Types

Link to this type decode_error() View Source
decode_error() :: {:error, :invalid | :max_length_too_large | :xdr_length_exceeds_defined_max | :invalid_xdr_length | :invalid_padding}

A binary of max-length 2^32 - 1

Link to this section Functions

Link to this function decode(xdr, max \\ 4294967295) View Source
decode(xdr :: xdr(), max :: max()) ::
  {:ok, {opaque :: t(), rest :: XDR.Type.Base.xdr()}} |
  decode_error()

Decodes a valid variable opaque xdr binary, removing the 4-byte length and any provided padding

Link to this function encode(opaque, max \\ 4294967295) View Source
encode(opaque :: t(), max :: max()) ::
  {:ok, xdr :: xdr()} |
  {:error, :invalid}

Encodes a valid variable opaque binary, prepending the 4-byte length of the binary and appending any necessary padding

Link to this function valid?(opaque, max \\ 4294967295) View Source
valid?(opaque :: t(), max :: max()) :: boolean()

Determines if a value is a binary of a valid length