<div dir="ltr">Hi Etienne,<div><br></div><div>Sorry if I didn't express myself correctly. I meant that I have to create code to communicate through that protocol. I am not designing a protocol. Anyway, I was more interested on feedback from similar libraries or about the design of the library.</div><div><br></div><div>Cheers!</div></div><br><div class="gmail_quote"><div dir="ltr">On Sun, Oct 4, 2015 at 10:38 PM Etienne Champetier <<a href="mailto:champetier.etienne@gmail.com">champetier.etienne@gmail.com</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr">Hi,<br><div class="gmail_extra"><br><div class="gmail_quote"></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote">2015-10-04 22:47 GMT+02:00 Javier Domingo Cansino <span dir="ltr"><<a href="mailto:javierdo1@gmail.com" target="_blank">javierdo1@gmail.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr">Hello,<div><br></div><div>I asked Friday on IRC how to write blobs, I was suggested using blob_raw_put from libubox/blob.h, but as I have to implement a binary protocol that uses different endianess, non aligned data etc., I think the best solution is creating a set of helper functions to write/read blobs.</div></div></blockquote><div><br></div></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><div>I don't know what you really want to do, but have you looked at protobuf?<br><a href="https://en.wikipedia.org/wiki/Protocol_Buffers" target="_blank">https://en.wikipedia.org/wiki/Protocol_Buffers</a><br><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div><br>As this is quite generic library, there might already exist some work done that I am missing (please link!). I would love to have feedback from this design before typing code.<br></div><div><br></div><div>I have started my work on github[1], which is basically a header file with the following comment and some prototype ideas. The syntax I have thought is described there, but it basically follows a printf syntax, allowing raw chars to be written.</div><div><br></div><div>Cheers!</div><div><br></div><div><div>/*</div><div> * Syntax for the function is as follows.</div><div> *   %[n][a][lb][01r]{i,y,w,d,q,s}</div><div> *   </div><div> *   All the characters that don't follow this will be treated as raw chars</div><div> *   to be written as they are.</div><div> *</div><div> * Data type</div><div> *   * i - bit</div><div> *   * y - byte</div><div> *   * w - 2 byte word</div><div> *   * d - 4 byte word</div><div> *   * q - 8 byte word</div><div> *   * s - string without termination (use strlen()+1 in quantity to null)</div><div> *</div><div> * Data value</div><div> *   * 0 - fill the specified space with zeros</div><div> *   * 1 - fill the specified space with ones</div><div> *   * r - fill the specified space with random data</div><div> *</div><div> *   String data type is not valid in this case</div><div> *</div><div> * Endianess. No conversion by default</div><div> *   * l - little endian</div><div> *   * b - big endian</div><div> *</div><div> * Alignment. No alignment by default</div><div> *   * a - align this to it's datatype</div><div> *         bits are aligned to byte</div><div> *</div><div> * Quantity. One by default</div><div> *   * n - number of same datatype (placed together)</div><div> *         this denotes length of string, padded with 0</div><div> *</div><div> * Some examples:</div><div> *   * %4lw - 4 little endian 2 byte word</div><div> *   * %2i  - 2 bits 'ab' from value b'000000ab'</div><div> *   * %2bi - 2 bits 'ab' from value b'000000ba'</div><div> *   * %2li - 2 bits 'ab' from value b'ab000000'</div><div> *</div><div> */</div></div><div><br></div><div><div><br></div></div><div>[1] Github branch: <a href="https://github.com/txomon/libubox" target="_blank">https://github.com/txomon/libubox</a></div></div>
<br></blockquote></div></div></div><div dir="ltr"><div class="gmail_extra"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">_______________________________________________<br>
openwrt-devel mailing list<br>
<a href="mailto:openwrt-devel@lists.openwrt.org" target="_blank">openwrt-devel@lists.openwrt.org</a><br>
<a href="https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel" rel="noreferrer" target="_blank">https://lists.openwrt.org/cgi-bin/mailman/listinfo/openwrt-devel</a><br>
<br></blockquote></div><br></div></div>
</blockquote></div>