Important changes to repositories hosted on mbed.com
Mbed hosted mercurial repositories are deprecated and are due to be permanently deleted in July 2026.
To keep a copy of this software download the repository Zip archive or clone locally using Mercurial.
It is also possible to export all your personal repositories from the account settings page.
Fork of mbed-os by
lwip_udp.c File Reference
User Datagram Protocol module
See also UDP.
More...
Go to the source code of this file.
Functions | |
void | udp_init (void) |
Initialize this module. | |
static u16_t | udp_new_port (void) |
Allocate a new local UDP port. | |
static u8_t | udp_input_local_match (struct udp_pcb *pcb, struct netif *inp, u8_t broadcast) |
Common code to see if the current input packet matches the pcb (current input packet is accessed via ip(4/6)_current_* macros) | |
void | udp_input (struct pbuf *p, struct netif *inp) |
Process an incoming UDP datagram. | |
err_t | udp_send (struct udp_pcb *pcb, struct pbuf *p) |
Send data using UDP. | |
err_t | udp_send_chksum (struct udp_pcb *pcb, struct pbuf *p, u8_t have_chksum, u16_t chksum) |
Same as udp_send() but with checksum. | |
err_t | udp_sendto (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port) |
Send data to a specified address using UDP. | |
err_t | udp_sendto_chksum (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, u8_t have_chksum, u16_t chksum) |
Same as udp_sendto(), but with checksum. | |
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) |
Send data to a specified address using UDP. | |
err_t | udp_sendto_if_chksum (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, u8_t have_chksum, u16_t chksum) |
Same as udp_sendto_if(), but with checksum. | |
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) |
Same as udp_sendto_if, but with source address. | |
err_t | udp_sendto_if_src_chksum (struct udp_pcb *pcb, struct pbuf *p, const ip_addr_t *dst_ip, u16_t dst_port, struct netif *netif, u8_t have_chksum, u16_t chksum, const ip_addr_t *src_ip) |
Same as udp_sendto_if_src(), but with checksum. | |
err_t | udp_bind (struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) |
Bind an UDP PCB. | |
err_t | udp_connect (struct udp_pcb *pcb, const ip_addr_t *ipaddr, u16_t port) |
Connect an UDP PCB. | |
void | udp_disconnect (struct udp_pcb *pcb) |
Disconnect a UDP PCB. | |
void | udp_recv (struct udp_pcb *pcb, udp_recv_fn recv, void *recv_arg) |
Set a receive callback for a UDP PCB. | |
void | udp_remove (struct udp_pcb *pcb) |
Remove an UDP PCB. | |
struct udp_pcb * | udp_new (void) |
Create a UDP PCB. | |
struct udp_pcb * | udp_new_ip_type (u8_t type) |
Create a UDP PCB for specific IP type. | |
void | udp_netif_ipv4_addr_changed (const ip4_addr_t *old_addr, const ip4_addr_t *new_addr) |
This function is called from netif.c when address is changed. | |
void | udp_debug_print (struct udp_hdr *udphdr) |
Print UDP header information for debug purposes. |
Detailed Description
User Datagram Protocol module
See also UDP.
Definition in file lwip_udp.c.
Function Documentation
void udp_debug_print | ( | struct udp_hdr * | udphdr ) |
Print UDP header information for debug purposes.
- Parameters:
-
udphdr pointer to the udp header in memory.
Definition at line 1210 of file lwip_udp.c.
void udp_init | ( | void | ) |
Initialize this module.
Definition at line 95 of file lwip_udp.c.
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:
-
p pbuf to be demultiplexed to a UDP PCB (p->payload pointing to the UDP header) inp network interface on which the datagram was received.
Definition at line 218 of file lwip_udp.c.
static u8_t udp_input_local_match | ( | struct udp_pcb * | pcb, |
struct netif * | inp, | ||
u8_t | broadcast | ||
) | [static] |
Common code to see if the current input packet matches the pcb (current input packet is accessed via ip(4/6)_current_* macros)
- Parameters:
-
pcb pcb to check inp network interface on which the datagram was received (only used for IPv4) broadcast 1 if his is an IPv4 broadcast (global or subnet-only), 0 otherwise (only used for IPv4)
- Returns:
- 1 on match, 0 otherwise
Definition at line 156 of file lwip_udp.c.
void udp_netif_ipv4_addr_changed | ( | const ip4_addr_t * | old_addr, |
const ip4_addr_t * | new_addr | ||
) |
This function is called from netif.c when address is changed.
- Parameters:
-
old_addr IPv4 address of the netif before change new_addr IPv4 address of the netif after change
Definition at line 1182 of file lwip_udp.c.
static u16_t udp_new_port | ( | void | ) | [static] |
Allocate a new local UDP port.
- Returns:
- a new (free) local UDP port number
Definition at line 108 of file lwip_udp.c.
err_t udp_sendto_if_chksum | ( | struct udp_pcb * | pcb, |
struct pbuf * | p, | ||
const ip_addr_t * | dst_ip, | ||
u16_t | dst_port, | ||
struct netif * | netif, | ||
u8_t | have_chksum, | ||
u16_t | chksum | ||
) |
Same as udp_sendto_if(), but with checksum.
Definition at line 629 of file lwip_udp.c.
err_t udp_sendto_if_src_chksum | ( | struct udp_pcb * | pcb, |
struct pbuf * | p, | ||
const ip_addr_t * | dst_ip, | ||
u16_t | dst_port, | ||
struct netif * | netif, | ||
u8_t | have_chksum, | ||
u16_t | chksum, | ||
const ip_addr_t * | src_ip | ||
) |
Same as udp_sendto_if_src(), but with checksum.
Definition at line 698 of file lwip_udp.c.
Generated on Tue Jul 12 2022 13:16:23 by
