- a large array (1500 bytes) holding data (might be holding 40..1500 bytes of valid data)
- some variables holding information (timestamps, data length, source, destination, ..)
Question is: how do I do that?
My first idea was:
- pass a pointer to the clients local packet over the interface
- fill in information and do a memcpy of the data
I know that passing an array and then doing a memcpy works. Arrays are passed by reference in xC (at least to functions, not sure about interfaces) so I tried:
- pass a reference to the local packet over the interface
- fill in information and do a memcpy of the data
I could pass the data array only to copy the data and receive additional information as 'return' values, but that is not very clean, as changing the struct requires to change the interface function as well. Alternatively, i could return a packet.
What do you think would be a good approach? I'd like to just pass a pointer or reference to the whole struct but im not sure if that is possible.