|Short description:||Class for packed binary data stored in ruby Strings.|
|Created:||2005-10-09 23:45:14 GMT|
|Last update:||2009-07-19 19:30:22 GMT|
|Owner:||Joel VanderWerf (Projects of this owner)|
Bit-struct is now a gem on rubyforge!
Use ‘gem install bit-struct’ to install.
Class for packed binary data stored in ruby Strings. BitStruct accessors, generated from user declared fields, use pack/unpack to treat substrings as fields with a specified portable format.
Field types include
ruby install.rb config ruby install.rb setup ruby install.rb install
BitStruct is useful for defining packets used in network protocols. This is especially useful for raw IP—see examples/ping-recv.rb. All multibyte numeric fields are stored in network order (though this could be different for user-defined field classes).
BitStruct is most efficient when your data is primarily treated as a binary string, and only secondarily treated as a data structure. (For instance, you are routing packets from one socket to another, possibly looking at one or two fields as it passes through or munging some headers.) If accessor operations are a bottleneck, a better approach is to define a class that wraps an array and uses pack/unpack when the object needs to behave like a binary string.
|Versions:||[0.13 (2009-07-19)] [0.12 (2009-07-19)] [0.10 (2007-01-15)] [0.9 (2006-09-20)] [0.8 (2006-05-27)] [0.7 (2006-05-21)] [0.6 (2006-05-01)] [0.5 (2006-04-01)] [0.3 (2006-01-17)] [0.2 (2005-10-09)]|