Liking cljdoc? Tell your friends :D

phlegyas.frames


assembleclj

(assemble frame ftype)

Takes in a frame and frame type, calculates the final size of the frame by adding 5, 4 bytes for the size and 1 byte for the type, looking up type-bytes from the phlegyas.types namespace, allocating frame-bytes as a byte-array, wrapping it as buffer, and using ByteBuffer operations to populate frame-bytes, finally returning the assembled output.

Takes in a frame and frame type, calculates the final size of the frame
by adding 5, 4 bytes for the size and 1 byte for the type, looking up `type-bytes`
from the `phlegyas.types` namespace, allocating `frame-bytes` as a byte-array, wrapping
it as `buffer`, and using ByteBuffer operations to populate `frame-bytes`, finally
returning the assembled output.
sourceraw docstring

assemble-packetclj

(assemble-packet frame)

frame is a map consisting of all the data required to assemble the final byte-array. The keys required are found in the phlegyas.types namespace. The layout is a list of ordered items representing each element of the frame.

We feed frame into transform, which takes a frame and layout, then flatten, pack, and finally assemble.

`frame` is a map consisting of all the data required to assemble the final byte-array.
The keys required are found in the `phlegyas.types` namespace. The layout is a list of
ordered items representing each element of the frame.

We feed `frame` into `transform`, which takes a frame and layout, then `flatten`, `pack`,
and finally `assemble`.
sourceraw docstring

disassemble-packetclj

(disassemble-packet packet)

Takes in a byte-array, and attempts to decode it. Produces a map, matching that of the message type found in the phlegyas.types namespace.

Takes in a byte-array, and attempts to decode it. Produces a map, matching that
of the message type found in the `phlegyas.types` namespace.
sourceraw docstring

frame-lengthcljmacro

(frame-length buffer)

Check reported frame length.

Check reported frame length.
sourceraw docstring

frame-typecljmacro

(frame-type buffer)

Look up frame type in the reverse lookup table reverse-frame-byte, defined in the phlegyas.types namespace, and keywordizes it for us.

Look up frame type in the reverse lookup table `reverse-frame-byte`,
defined in the `phlegyas.types` namespace, and `keywordizes` it for us.
sourceraw docstring

cljdoc is a website building & hosting documentation for Clojure/Script libraries

× close