Lines Matching refs:p
146 * @param p pbuf to be demultiplexed to a UDP PCB.
151 udp_input(struct pbuf *p, struct netif *inp)
165 iphdr = (struct ip_hdr *)p->payload;
169 if (p->tot_len < (IPH_HL(iphdr) * 4 + UDP_HLEN) || pbuf_header(p, -(s16_t)(IPH_HL(iphdr) * 4))) {
172 ("udp_input: short UDP datagram (%"U16_F" bytes) discarded\n", p->tot_len));
176 pbuf_free(p);
180 udphdr = (struct udp_hdr *)p->payload;
185 LWIP_DEBUGF(UDP_DEBUG, ("udp_input: received datagram of length %"U16_F"\n", p->tot_len));
302 chklen = p->tot_len;
309 pbuf_free(p);
313 if (inet_chksum_pseudo_partial(p, ¤t_iphdr_src, ¤t_iphdr_dest,
314 IP_PROTO_UDPLITE, p->tot_len, chklen) != 0) {
320 pbuf_free(p);
329 if (inet_chksum_pseudo(p, ip_current_src_addr(), ip_current_dest_addr(),
330 IP_PROTO_UDP, p->tot_len) != 0) {
336 pbuf_free(p);
342 if(pbuf_header(p, -UDP_HLEN)) {
347 pbuf_free(p);
378 pbuf_header(p, (s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN));
381 q = pbuf_alloc(PBUF_RAW, p->tot_len, PBUF_RAM);
383 err_t err = pbuf_copy(q, p);
396 pbuf_header(p, -(s16_t)((IPH_HL(iphdr) * 4) + UDP_HLEN));
402 /* now the recv function is responsible for freeing p */
403 pcb->recv(pcb->recv_arg, pcb, p, ip_current_src_addr(), src);
406 pbuf_free(p);
418 pbuf_header(p, (IPH_HL(iphdr) * 4) + UDP_HLEN);
419 LWIP_ASSERT("p->payload == iphdr", (p->payload == iphdr));
420 icmp_dest_unreach(p, ICMP_DUR_PORT);
426 pbuf_free(p);
429 pbuf_free(p);
439 * @param p chain of pbuf's to be sent.
454 udp_send(struct udp_pcb *pcb, struct pbuf *p)
457 return udp_sendto(pcb, p, &pcb->remote_ip, pcb->remote_port);
464 udp_send_chksum(struct udp_pcb *pcb, struct pbuf *p,
468 return udp_sendto_chksum(pcb, p, &pcb->remote_ip, pcb->remote_port,
477 * @param p chain of pbuf's to be sent.
491 udp_sendto(struct udp_pcb *pcb, struct pbuf *p,
495 return udp_sendto_chksum(pcb, p, dst_ip, dst_port, 0, 0);
500 udp_sendto_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
523 return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, have_chksum, chksum);
525 return udp_sendto_if(pcb, p, dst_ip, dst_port, netif);
537 * @param p chain of pbuf's to be sent.
549 udp_sendto_if(struct udp_pcb *pcb, struct pbuf *p,
553 return udp_sendto_if_chksum(pcb, p, dst_ip, dst_port, netif, 0, 0);
558 udp_sendto_if_chksum(struct udp_pcb *pcb, struct pbuf *p, ip_addr_t *dst_ip,
572 ("udp_sendto_if: SOF_BROADCAST not enabled on pcb %p\n", (void *)pcb));
587 /* not enough space to add an UDP header to first pbuf in given p chain? */
588 if (pbuf_header(p, UDP_HLEN)) {
596 if (p->tot_len != 0) {
597 /* chain header q in front of given pbuf p (only if p contains data) */
598 pbuf_chain(q, p);
602 ("udp_send: added header pbuf %p before given pbuf %p\n", (void *)q, (void *)p));
604 /* adding space for header within p succeeded */
606 q = p;
607 LWIP_DEBUGF(UDP_DEBUG, ("udp_send: added header in given pbuf %p\n", (void *)p));
635 if (q != p) {
639 /* p is still referenced by the caller, and will live on */
735 if (q != p) {
739 /* p is still referenced by the caller, and will live on */