Collaboration diagram for UDP:
![]() |
UDP only provides checksumming of data and multiplexing by port number. Therefore, an application program must deal directly with end-to-end communication problems like retransmission, flow control etc., if required.
Applications should call the UDP Socket API when using this protocol.
Functions | |
void | NutUdpInput (NETBUF *nb, ureg_t bcast) |
Handle incoming UDP packets. | |
int | NutUdpOutput (UDPSOCKET *sock, u_long daddr, u_short port, NETBUF *nb) |
Send a UDP packet. |
void NutUdpInput | ( | NETBUF * | nb, | |
ureg_t | bcast | |||
) |
Handle incoming UDP packets.
nb | Network buffer structure containing the UDP packet. | |
bcast | Broadcast flag. |
Definition at line 147 of file udpin.c.
References ICMP_UNREACH, ICMP_UNREACH_PORT, _NETBUF::nb_ap, _NETBUF::nb_next, _NETBUF::nb_tp, NutEventPost(), NutIcmpResponse(), NutNetBufFree(), NutUdpFindSocket(), udp_socket::so_rx_bsz, udp_socket::so_rx_cnt, udp_socket::so_rx_nb, udp_socket::so_rx_rdy, _NBDATA::sz, udphdr::uh_dport, and _NBDATA::vp.
Referenced by NutIpInput().
Send a UDP packet.
sock | Socket descriptor. This pointer must have been retrieved by calling NutUdpCreateSocket(). | |
daddr | IP address of the remote host in network byte order. | |
port | Remote port number in host byte order. | |
nb | Network buffer structure containing the datagram. This buffer will be released if the function returns an error. |
Definition at line 141 of file udpout.c.
References _NUTDEVICE::dev_icb, htons, ifnet::if_local_ip, IPPROTO_UDP, _NETBUF::nb_ap, _NETBUF::nb_tp, NBAF_TRANSPORT, NutIpChkSum(), NutIpChkSumPartial(), NutIpOutput(), NutIpPseudoChkSumPartial(), NutIpRouteQuery(), NutNetBufAlloc(), udp_socket::so_local_port, _NBDATA::sz, udphdr::uh_dport, udphdr::uh_sport, udphdr::uh_sum, udphdr::uh_ulen, and _NBDATA::vp.
Referenced by NutUdpSendTo().