I have a unsigned short buffer , it contain a hexa values of IP header .
unsigned short buffer = {45,00,00,4E,4E,05,00,10,80,11,0X00,0X00,0A,00,00,1C,1A,00,00,2F};
I added 0X00 , 0X00
in the place of Checksum filed and calculated checksum with the RFC 1071 - Calculating IP header checksum . So it is returning a unsigned short checksum
value . Now i need to insert to the Ip buffer .
For example : if my unsigned short checksum value
= 55168
and it's Hex value = D780
. Now i need to add D7
, 80
to buffer[11]
and buffer[12]
. How can i convert unsigned short checksum value and split the Hex value for inserting to the buffer ? If it Hex = D78
, then also i need to add 0D
and 78
to the buffer field .