On Sat, Mar 10, 2018 at 9:30 PM, studi <[email protected]> wrote:

> Cap'n Proto is on top a bytestream layer.
>

Not really. There are utilities for reading from / writing to a byte
stream, but Cap'n Proto is not fundamentally tied to byte streams. In fact,
Cap'n Proto is commonly used on top of mmap(), which is definitely not a
byte stream.

I want to send Cap's proto data on top of encrypted UDT streams. (Which are
> not exactly streams since they reliably transmit arbitrary length records,
> rather than an arbitrary stream of sequential bytes, necessitating
> ciphertext stealing when a record is not a multiple of sixteen bytes)
>
> I suppose this is probably documented in some glaringly obvious place, or
> should be self evident, but how do I arrange that Cap'n proto uses my
> streams - how do I hook the output from Cap'n proto and supply it with
> input?


Are you talking about the base Cap'n Proto serialization, or the RPC
protocol?

For the base serialization (assuming C++):
MessageBuilder::getSegmentsForOutput() returns an array of arrays pointing
to the segments of the message (does not do a copy; returns pointers
directly into the existing underlying memory). Do whatever you want with
them. On the receiving end, use SegmentArrayMessageReader to take an
array-of-arrays and read messages from them (again, with no copies).

If you want to implement an alternative RPC transport, you need to write
your own implementation of capnp::VatNetwork (defined in capnp/rpc.h).

-Kenton

-- 
You received this message because you are subscribed to the Google Groups 
"Cap'n Proto" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
Visit this group at https://groups.google.com/group/capnproto.

Reply via email to