from ustruct import *
class Struct:
def __init__(self, format):
self.format = format
self.size = calcsize(format)
def unpack(self, buf):
return unpack(self.format, buf)
def pack(self, *vals):
return pack(self.format, *vals)