I am writing a script in python and have worked only on C and C++ all my life. What i want is to take in some parameters from caller and then create a 32 byte packet. Packet contains some bytes, some DWORDS, some bit fields etc. So i want to create this packet and then copy it over byte-by-byte (this is important) into a buffer which is allocated by a low level driver.
In C/C++ this is straight forward. Define a struct, program the fields and then read it byte by byte and copy it over to the buffer.
How can i do this in python? Looks like i can't define a class/struct which contains my 32 byte packet and then iterate over its members to copy them down byte by byte.
Any suggestions?