Binary streams parsing library for C -


could advise proven binary stream parsing library c? nice if declarative c allows.

i need binary protocol parsing , describing quite complicated protocol it's formal specification, that's why want declarative possible. haskell's data.binary.get great.

i've found binpac, seems heavyweight , oriented c++ , project pure c.

example describing mean:

parser_t parsers[] = {   { get_bit,      out_field1, &pkt.field1 }  ,{ get_bit7,     0,           0          } // skip 7 bits  ,{ get_word16be, out_field2, &pkt.field2 }  ,{ 0,            0,           0          } // end };  // skip // char *data, char *data_end,  map_parsers(data, data_end, parsers); // parse stream 

upd. it's fine have fast library sequential reading bits, words, aligned, unaligned, etc memory. may write declarative frontend or dsl on own.

there's pads nice people @ at&t. there's ragel can used same thing. i've not used either myself, found hints of existence on this page.

pads looks similar idea asn1 compiler objective systems , google protocol buffers; write schema file, compile source code language of choice. difference of course 2 work strictly defined binary encoding schemes whereas pads seemingly works arbitrary data streams.

good luck!


Comments

Popular posts from this blog

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -