I have these structures:
typedef struct dnsQuery {
char header[12];
struct TdnsQuerySection *querySection;
} TdnsQuery;
typedef struct dnsQuerySection {
unsigned char *name;
struct TdnsQueryQuestion *question;
} TdnsQuerySection;
typedef struct dnsQueryQuestion {
unsigned short qtype;
unsigned short qclass;
} TdnsQueryQuestion;
and I have dns query in byte array from recvfrom
.
I am trying to get structure from byte array like this:
TdnsQuery* dnsQuery = (TdnsQuery*)buf;
printf("%u", dnsQuery->querySection->question.qtype);
Why I get error Dereferencing pointer to incomplete type? Am I doing this right? Or how can I get dns query structure from that array? I need that dns query question and type.