(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.
(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`.
(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.
(frame-length buffer)
Check reported frame length.
Check reported frame length.
(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.
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close