47 #define FLAGS_COMPRESSED 0x8000
48 #define FLAGS_BROADCASTDATA 0x4000
106 struct udpip_hdr *uhdr;
108 hdr = (
struct hc_hdr *)buf;
109 uhdr = (
struct udpip_hdr *)buf;
114 if(uhdr->vhl == 0x45 &&
116 uhdr->len[0] == 0x00 &&
118 uhdr->ipoffset[0] == 0x00 &&
120 uhdr->ipoffset[1] == 0x00 &&
122 uhdr->proto == UIP_PROTO_UDP &&
126 uhdr->destport == uhdr->srcport &&
130 (uhdr->destport &
UIP_HTONS(0xc000)) == 0) {
136 FLAGS_BROADCASTDATA |
141 memcpy((
char *)hdr + HC_HLEN,
142 &buf[UIP_IPUDPH_LEN],
143 len - UIP_IPUDPH_LEN);
146 return len - (UIP_IPUDPH_LEN - HC_HLEN);
167 struct udpip_hdr *uhdr;
170 hdr = (
struct hc_hdr *)buf;
173 if((hdr->flagsport &
UIP_HTONS(FLAGS_COMPRESSED)) != 0 &&
174 (hdr->flagsport &
UIP_HTONS(FLAGS_BROADCASTDATA)) != 0) {
177 memmove(&buf[UIP_IPUDPH_LEN - HC_HLEN],
179 uhdr = (
struct udpip_hdr *)buf;
180 hdr = (
struct hc_hdr *)&buf[UIP_IPUDPH_LEN - HC_HLEN];
183 uhdr->srcport = hdr->flagsport &
UIP_HTONS(0x3fff);
184 uhdr->destport = hdr->flagsport &
UIP_HTONS(0x3fff);
188 len += UIP_IPUDPH_LEN - HC_HLEN;
195 uhdr->ipid[0] = uhdr->ipid[1] = 0xAD;
196 uhdr->ipoffset[0] = uhdr->ipoffset[1] = 0;
198 uhdr->proto = UIP_PROTO_UDP;