Lines Matching defs:buf
84 * ICMP_RX_CALLBACK(ref,buf,dst,src)
91 * buf - the ebuf containing the buffer
99 static int icmp_rx_callback(void *ref,ebuf_t *buf,uint8_t *dst,uint8_t *src)
109 imsg = ICMPMSG(buf->eb_ptr[0],buf->eb_ptr[1]);
119 ebuf_append_bytes(txbuf,buf->eb_ptr,buf->eb_length);
136 q_enqueue(&(icmp->icmp_echoreplies),(queue_t *) buf);
216 ebuf_t *buf;
228 buf = _ip_alloc(icmp->icmp_ipinfo);
229 if (buf == NULL) return -1;
236 icmphdr = buf->eb_ptr;
244 ebuf_append_u8(buf,8); /* echo message */
245 ebuf_append_u8(buf,0); /* code = 0 */
246 ebuf_append_u16_be(buf,0); /* empty checksum for now */
247 ebuf_append_u16_be(buf,id); /* packet ID */
248 ebuf_append_u16_be(buf,((uint16_t)seq)); /* sequence # */
251 ebuf_append_u8(buf,((idx+0x40)&0xFF)); /* data */
258 cksum = ~ip_chksum(0,icmphdr,ebuf_length(buf));
267 _ip_send(icmp->icmp_ipinfo,buf,dest,IPPROTO_ICMP);
268 buf = NULL;
279 buf = (ebuf_t *) q_deqnext(&(icmp->icmp_echoreplies));
283 if (buf) {
286 cksum = ip_chksum(0,buf->eb_ptr,ebuf_length(buf));
288 ebuf_skip(buf,2);
289 ebuf_skip(buf,2); /* skip checksum */
290 ebuf_get_u16_be(buf,rxid);
291 ebuf_get_u16_be(buf,rxseq);
298 _ip_free(icmp->icmp_ipinfo,buf);
308 if (buf) _ip_free(icmp->icmp_ipinfo,buf);