Hi,
Below are the structures in my code.
struct uip_eth_hdr {
struct uip_eth_addr dest;
struct uip_eth_addr src;
Uint16 type;
};
struct ethip_hdr {
struct uip_eth_hdr ethhdr;
unsigned char vhl,
tos,
len[2],
ipid[2],
ipoffset[2],
ttl,
proto;
Uint16 ipchksum;
Uint16 srcipaddr[2],
destipaddr[2];
};
unsigned char uip_buf[1500];
#define IPBUF ((struct ethip_hdr *)&uip_buf[0])
Raw data packet of uip_buf :
FF FF FF FF FF FF B0 83 FE 6B BA E3 08 06 00 01
08 00 06 04 00 01 B0 83 FE 6B BA E3 C0 A8 00 28
00 00 00 00 00 00 C0 A8 00 14 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 AF D4 22 91
Mapped values of IPBUF :
ETH Dst add : FF FF FF FF FF FF
ETH Src add : B0 83 FE 6B BA E3
Eth type : 8 Problem
vh1 : 06
tos : 00
len : 01 08
ipid : 00 06
ipoffset : 04 00
ttl : 01
proto : B0
checksum : 131 Problem
srcip : 254 107 Problem
dstip : 186 227 Problem
From above code you can see value mapped is wrong from "Eth type".
PUBF->type should reserve 2 byte from raw array but it reserve only 1 byte, hence next all values parse wrongly.
Can anyone suggest me what is going on with code? Actually i had read a lot forum about size of data types(E.g. :- sizeof(Uint16) return value 1) But didn't find any perfect solution.
Thanks in advance.