Lines Matching refs:buf

104 static int _udp_rx_callback(void *ref,ebuf_t *buf,uint8_t *destaddr,uint8_t *srcaddr);
199 ebuf_t *buf;
201 while ((buf = (ebuf_t *) q_deqnext(&(udp->up_rxqueue)))) {
202 _ip_free(info->ui_ipinfo,buf);
212 * _udp_send(info,s,buf,dest)
220 * buf - an ebuf to send
228 int _udp_send(udp_info_t *info,int s,ebuf_t *buf,uint8_t *dest)
240 udplen = ebuf_length(buf) + UDP_HDR_LENGTH;
257 ebuf_seek(buf,-UDP_HDR_LENGTH);
258 udphdr = ebuf_ptr(buf);
260 ebuf_put_u16_be(buf,udp->up_srcport);
261 ebuf_put_u16_be(buf,udp->up_destport);
262 ebuf_put_u16_be(buf,udplen);
263 ebuf_put_u16_be(buf,0);
265 ebuf_prepend(buf,UDP_HDR_LENGTH);
282 _ip_send(info->ui_ipinfo,buf,dest,IPPROTO_UDP);
342 * _udp_rx_callback(ref,buf,destaddr,srcaddr)
350 * buf - the ebuf, currently pointing at the UDP header
359 static int _udp_rx_callback(void *ref,ebuf_t *buf,uint8_t *destaddr,uint8_t *srcaddr)
378 udplen = ebuf_length(buf);
379 udphdr = ebuf_ptr(buf);
414 ebuf_get_u16_be(buf,srcport);
415 ebuf_get_u16_be(buf,dstport);
416 ebuf_get_u16_be(buf,udplen2);
417 ebuf_skip(buf,2);
438 buf->eb_usrdata = (int) srcport;
439 buf->eb_usrptr = srcaddr;
453 ebuf_setlength(buf,udplen2-UDP_HDR_LENGTH);
454 q_enqueue(&(udp->up_rxqueue),(queue_t *) buf);
475 ebuf_t *buf;
478 buf = (ebuf_t *) q_deqnext(&(udp->up_rxqueue));
480 return buf;
554 ebuf_t *buf;
569 while ((buf = (ebuf_t *) q_deqnext(&(udp->up_rxqueue)))) {
570 _ip_free(info->ui_ipinfo,buf);
599 ebuf_t *buf;
605 buf = _ip_alloc(info->ui_ipinfo);
607 if (!buf) return NULL;
613 ebuf_seek(buf,UDP_HDR_LENGTH);
614 ebuf_setlength(buf,0);
616 return buf;
620 * _udp_free(info,buf)
626 * buf - an ebuf
632 void _udp_free(udp_info_t *info,ebuf_t *buf)
634 _ip_free(info->ui_ipinfo,buf);