Byte stuffing

I know there’s much more elegant ways of sending encoded data to and from an IMP/Agent, but I’m stuck with having to send and receive a binary proprietary protocol (just a struct byte stuffed in an array) between the host uP and the IMP. In straith C (on the uP), retrieving the struct elements out of the byte array is as easy as type casting the struct on to the array (given no problems with endianness etc :-), but what would be an elegant way of retrieving the various elements of the struct out of the received byte array in squirrel ? (if no better ideas, I can always go back to the old tedious and error prone byte mapping into various variables, but that’s as ugly as can be :slight_smile:

I’m afraid there’s no equivalent of struct mapping; the best you can do is to put the data in a blob and treat it as a stream, using blob.readn() to extract different types as if it were a file.