Sorry for the obscure title.
I assume this is casting (i hope)
Assuming i am correct, this next bit of code threw me.Code:struct ip_header *ip ip = (struct ip_header *) (packet + ethernetHeader)
Funtion pcap_next retruns a u_char pointer to the packet it captures.
I thought the code would be:
However in the book i have its written:Code:u_char *packet packet = pcap_next(exp1, exp2)
Is this casting?? Was my original understanding of casting incorrect, it not a subject im very familiar about.Code:u_char packet* packet = (u_char *) pcap_next(exp1, exp2)
Just having trouble understanding why the code in the book (which is correct) has the (u_char) before pcap_next.
Many thanks for any help!