protocol.platform
Protocol platform specific functions
arr-fill
(arr-fill dbuf arr off & [cnt])
Write/fill an sequence of octets/bytes from arr
into the buffer dbuf
starting at off
. If cnt
is specified then only the first cnt
octets are written
bits->bytes
(bits->bytes bits)
Convert a sequence of 0/1 ‘bits’ (in MSB first order) into a sequence of bytes (in MSB first order)
buf->vec
(buf->vec buf off)
(buf->vec buf off end)
Slice buffer buf
starting at off
and ending at end
and return a vector of the octets/bytes
buf-cmp
(buf-cmp buf1 buf2)
buf-fill
(buf-fill dbuf sbuf off)
Copy/fill all bytes from sbuf
into dbuf
starting at offset off
within dbuf
buf-read-uint16-be
(buf-read-uint16-be buf off)
buf-read-uint16-le
(buf-read-uint16-le buf off)
buf-read-uint32-be
(buf-read-uint32-be buf off)
buf-read-uint32-le
(buf-read-uint32-le buf off)
buf-read-uint64-be
(buf-read-uint64-be buf off)
buf-read-uint64-le
(buf-read-uint64-le buf off)
buf-read-uint8
(buf-read-uint8 buf off)
buf-read-utf8
(buf-read-utf8 buf off length)
buf-slice
(buf-slice buf off)
(buf-slice buf off end)
buf-slurp
(buf-slurp path)
buf-write-uint16-be
(buf-write-uint16-be buf v off)
buf-write-uint16-le
(buf-write-uint16-le buf v off)
buf-write-uint32-be
(buf-write-uint32-be buf v off)
buf-write-uint32-le
(buf-write-uint32-le buf v off)
buf-write-uint64-be
(buf-write-uint64-be buf v off)
buf-write-uint64-le
(buf-write-uint64-le buf v off)
buf-write-uint8
(buf-write-uint8 buf v off)
buf-write-utf8
(buf-write-utf8 buf s off length)
bytes->bits
(bytes->bits byts)
Convert a sequence of bytes/octets byts
(in MSB first order) into a sequence of 0/1 ‘bits’ (in MSB first order)
num->string
(num->string n base)
pr-num
(pr-num n base sz)
Print a number n
in base base
with 0 padding up to size sz
.
remove-nulls
(remove-nulls s)
string->num
(string->num s)
(string->num s base)