lwIP  2.1.0
Lightweight IP stack
udp.c File Reference
#include "lwip/opt.h"
#include "lwip/udp.h"
#include "lwip/def.h"
#include "lwip/memp.h"
#include "lwip/inet_chksum.h"
#include "lwip/ip_addr.h"
#include "lwip/ip6.h"
#include "lwip/ip6_addr.h"
#include "lwip/netif.h"
#include "lwip/icmp.h"
#include "lwip/icmp6.h"
#include "lwip/stats.h"
#include "lwip/snmp.h"
#include "lwip/dhcp.h"
#include <string.h>

Functions

void udp_init (void)
 
void udp_input (struct pbuf *p, struct netif *inp)
 
err_t udp_send (struct udp_pcb *pcb, struct pbuf *p)
 
err_t udp_sendto (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port)
 
err_t udp_sendto_if (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif)
 
err_t udp_sendto_if_src (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, const ip_addr_t *src_ip)
 
err_t udp_bind (struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
 
void udp_bind_netif (struct udp_pcb *pcb, const struct netif *netif)
 
err_t udp_connect (struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port)
 
void udp_disconnect (struct udp_pcb *pcb)
 
void udp_recv (struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg)
 
void udp_remove (struct udp_pcb *pcb)
 
struct udp_pcbudp_new (void)
 
struct udp_pcbudp_new_ip_type (u8_t type)
 
void udp_netif_ip_addr_changed (const ip_addr_t *old_addr, const ip_addr_t *new_addr)
 

Detailed Description

User Datagram Protocol module
The code for the User Datagram Protocol UDP & UDPLite (RFC 3828).
See also UDP

Function Documentation

◆ udp_init()

void udp_init ( void  )

Initialize this module.

◆ udp_input()

void udp_input ( struct pbuf p,
struct netif inp 
)

Process an incoming UDP datagram.

Given an incoming UDP datagram (as a chain of pbufs) this function finds a corresponding UDP PCB and hands over the pbuf to the pcbs recv function. If no pcb is found or the datagram is incorrect, the pbuf is freed.

Parameters
ppbuf to be demultiplexed to a UDP PCB (p->payload pointing to the UDP header)
inpnetwork interface on which the datagram was received.

◆ udp_netif_ip_addr_changed()

void udp_netif_ip_addr_changed ( const ip_addr_t old_addr,
const ip_addr_t new_addr 
)

This function is called from netif.c when address is changed

Parameters
old_addrIP address of the netif before change
new_addrIP address of the netif after change