38 #ifndef LWIP_HDR_UDP_H
39 #define LWIP_HDR_UDP_H
56 #define UDP_FLAGS_NOCHKSUM 0x01U
57 #define UDP_FLAGS_UDPLITE 0x02U
58 #define UDP_FLAGS_CONNECTED 0x04U
59 #define UDP_FLAGS_MULTICAST_LOOP 0x08U
77 typedef void (*udp_recv_fn)(
void *arg,
struct udp_pcb *pcb,
struct pbuf *p,
91 u16_t local_port, remote_port;
93 #if LWIP_MULTICAST_TX_OPTIONS
106 u16_t chksum_len_rx, chksum_len_tx;
115 extern struct udp_pcb *udp_pcbs;
119 struct udp_pcb * udp_new (
void);
120 struct udp_pcb * udp_new_ip_type(
u8_t type);
121 void udp_remove (
struct udp_pcb *pcb);
124 void udp_bind_netif (
struct udp_pcb *pcb,
const struct netif*
netif);
127 void udp_disconnect (
struct udp_pcb *pcb);
128 void udp_recv (
struct udp_pcb *pcb, udp_recv_fn recv,
130 err_t udp_sendto_if (
struct udp_pcb *pcb,
struct pbuf *p,
133 err_t udp_sendto_if_src(
struct udp_pcb *pcb,
struct pbuf *p,
136 err_t udp_sendto (
struct udp_pcb *pcb,
struct pbuf *p,
138 err_t udp_send (
struct udp_pcb *pcb,
struct pbuf *p);
140 #if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
141 err_t udp_sendto_if_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
145 err_t udp_sendto_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
148 err_t udp_send_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
150 err_t udp_sendto_if_src_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
155 #define udp_flags(pcb) ((pcb)->flags)
156 #define udp_setflags(pcb, f) ((pcb)->flags = (f))
158 #define udp_set_flags(pcb, set_flags) do { (pcb)->flags = (u8_t)((pcb)->flags | (set_flags)); } while(0)
159 #define udp_clear_flags(pcb, clr_flags) do { (pcb)->flags = (u8_t)((pcb)->flags & (u8_t)(~(clr_flags) & 0xff)); } while(0)
160 #define udp_is_flag_set(pcb, flag) (((pcb)->flags & (flag)) != 0)
163 void udp_input (
struct pbuf *p,
struct netif *inp);
165 void udp_init (
void);
168 #define udp_new_ip6() udp_new_ip_type(IPADDR_TYPE_V6)
170 #if LWIP_MULTICAST_TX_OPTIONS
172 #define udp_set_multicast_netif_addr(pcb, ip4addr) ip4_addr_copy((pcb)->mcast_ip4, *(ip4addr))
173 #define udp_get_multicast_netif_addr(pcb) (&(pcb)->mcast_ip4)
175 #define udp_set_multicast_netif_index(pcb, idx) ((pcb)->mcast_ifindex = (idx))
176 #define udp_get_multicast_netif_index(pcb) ((pcb)->mcast_ifindex)
177 #define udp_set_multicast_ttl(pcb, value) ((pcb)->mcast_ttl = (value))
178 #define udp_get_multicast_ttl(pcb) ((pcb)->mcast_ttl)
182 void udp_debug_print(
struct udp_hdr *udphdr);
184 #define udp_debug_print(udphdr)
uint8_t u8_t
Definition: arch.h:125
uint16_t u16_t
Definition: arch.h:127
s8_t err_t
Definition: err.h:96
#define IP_PCB
Definition: ip.h:76
ip6_addr_t ip_addr_t
Definition: ip_addr.h:318