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
102 u16_t chksum_len_rx, chksum_len_tx;
111 extern struct udp_pcb *udp_pcbs;
115 struct udp_pcb * udp_new (
void);
116 struct udp_pcb * udp_new_ip_type(
u8_t type);
117 void udp_remove (
struct udp_pcb *pcb);
122 void udp_disconnect (
struct udp_pcb *pcb);
123 void udp_recv (
struct udp_pcb *pcb, udp_recv_fn recv,
125 err_t udp_sendto_if (
struct udp_pcb *pcb,
struct pbuf *p,
128 err_t udp_sendto_if_src(
struct udp_pcb *pcb,
struct pbuf *p,
131 err_t udp_sendto (
struct udp_pcb *pcb,
struct pbuf *p,
133 err_t udp_send (
struct udp_pcb *pcb,
struct pbuf *p);
135 #if LWIP_CHECKSUM_ON_COPY && CHECKSUM_GEN_UDP
136 err_t udp_sendto_if_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
140 err_t udp_sendto_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
143 err_t udp_send_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
145 err_t udp_sendto_if_src_chksum(
struct udp_pcb *pcb,
struct pbuf *p,
150 #define udp_flags(pcb) ((pcb)->flags)
151 #define udp_setflags(pcb, f) ((pcb)->flags = (f))
154 void udp_input (
struct pbuf *p,
struct netif *inp);
156 void udp_init (
void);
159 #define udp_new_ip6() udp_new_ip_type(IPADDR_TYPE_V6)
161 #if LWIP_MULTICAST_TX_OPTIONS
162 #define udp_set_multicast_netif_addr(pcb, ip4addr) ip_addr_copy_from_ip4((pcb)->multicast_ip, *(ip4addr))
163 #define udp_get_multicast_netif_addr(pcb) ip_2_ip4(&(pcb)->multicast_ip)
164 #define udp_set_multicast_ttl(pcb, value) do { (pcb)->mcast_ttl = value; } while(0)
165 #define udp_get_multicast_ttl(pcb) ((pcb)->mcast_ttl)
169 void udp_debug_print(
struct udp_hdr *udphdr);
171 #define udp_debug_print(udphdr)