Solved:
(g/header
(g/repeated :ubyte :prefix :ubyte)
(fn [h]
(g/finite-block (apply + h)))
(fn [b]
...))
That did it.
On Fri, Oct 10, 2014 at 10:32:59AM -0700, john walker wrote:
> What information do you want after this is decoded?
Correction: this actually is what I'm trying to do:
(defn get-payload-from-recursive-header-frame
[[hlenlen & raw-bytes]]
(let [hlen (apply + (take hlenlen raw-bytes))]
(take hlen (drop hlenlen raw-bytes
Or with the headers preserved:
(defn get-payload-from-recursive-header-f
After this is decoded, I want the the payload, and it'd be nice to have the
length too but not necessary.
Described in clojure instead of prose:
(defn get-payload-from-recursive-header-frame
[[hlenlen & raw-bytes]]
(let [hlen (apply + (take hlenlen raw-bytes))]
(drop hlenlen raw-bytes)))
I took a stab at it for 10 minutes, but I'm way too rusty.
Last year I implemented the blockchain wire protocol with gloss that might
be helpful: https://gist.github.com/danneu/7397350
Here's the spec: https://en.bitcoin.it/wiki/Protocol_specification
The var-int-codec is a somewhat complex
ex
What information do you want after this is decoded? Do you want the sum of
byte0 ... byten, as well as the actual payload? Do you also want the
header-length?
On Thursday, October 9, 2014 11:34:59 PM UTC-7, Ken Restivo wrote:
>
> I'm playing around with Gloss, trying to decode a packet, part of
I'm playing around with Gloss, trying to decode a packet, part of which has the
following nested struture:
header-length (1 byte, value n)
byte0 ... byten (count defined by that header-length byte)
actual payload (length of which is the sum of the values of the
above bytes)
S