interactive binary decoder to structs
I have looked a bit but I was unable to find开发者_StackOverflow中文版 what I figured might have been something that has already been created.
I am looking for an application that would read in a binary file, allow the inputing of the types of patterns/rules in someway that are expected (like a set of messages each of which are header + data) and then deserialize the data into a text format based on the patterns/rules (e.g., the binary file is a set of M messages with a header that contains the type of struct and the number of bytes the struct's serialization takes up directly serialized to the file).
Specifically, lets say I know ahead of time that I will have a file that contains a sequence of serialized C structs (or C++ classes) which are all prepended by a header indicating which struct in serialized in the next N bytes (where N is contained in the header).
I know how to write C/C++ code to go through and deserialize the data (provided I know all the types ahead of time) but I am wondering if there exists some type of application which would help facilitate this process if you were not entirely sure of the format/structs ahead of time (other than a hexeditor). Something graphical where you could see the dynamic effect of changing the structs/rules/patterns would be optimal if it exists.
boost::serialization already does something quite similar to this, without having to get your hands quite as dirty in the details. It supports various archive formats, including XML, text and binary ones, is very extensible and can cope with smart pointers, containers etc.
精彩评论