I am working on a dissector that is version dependent. I have created a union that contains the structs of both versions:
typedef struct _proto_struct { STRUCT_1 s1; STRUCT_2 s2; } s_t; s_t *s;
Memory for s is created based on version and sizeof(s1) or sizeof(s2).
Thus, to reference V1 it would be s->s1,
V2 would bes->s2. Both s1 and s2 have much in common. I would like to create a single pointer ptr, that would point to s1 or s2 as necessary that would be used to simplify the access to the structs without having to specifically cast ptr to the struct.
How could this be done?
Thanks as always. Alex Lindberg |