AquilaOS documentation
How it works, and its code
Loading...
Searching...
No Matches
udp.c File Reference

UDP input. More...

#include <core/system.h>
#include <core/string.h>
#include <net/byteorder.h>
#include <net/inet.h>

Go to the source code of this file.

Functions

void udp_input (struct netif *netif, struct netbuf *nb, const struct ipv4_hdr *ih)
 Takes in a UDP datagram that IPv4 received, and delivers it to its socket.

Detailed Description

UDP input.

A UDP datagram that arrives goes to the socket bound to its destination port. If no socket is bound there, the sender gets an ICMP "port unreachable" (unless the datagram was a broadcast), and the datagram is dropped. Sending is the sockets' (net/inet/socket.c).

Definition in file udp.c.

Function Documentation

◆ udp_input()

void udp_input ( struct netif * netif,
struct netbuf * nb,
const struct ipv4_hdr * ih )

Takes in a UDP datagram that IPv4 received, and delivers it to its socket.

A datagram with a bad length or checksum is dropped.

Parameters
netifthe interface it came in on
nbthe datagram, from its UDP header; it is freed or given to the socket
ihthe IPv4 header it came with

Definition at line 24 of file udp.c.

References udp_hdr::checksum, netbuf::data, ipv4_hdr::dst, udp_hdr::dst, ICMP_UNREACH_PORT, icmp_unreachable(), inet_checksum_pseudo(), inet_sock_deliver(), inet_sock_find(), IP_PROTO_UDP, ipv4_is_local(), netbuf::len, udp_hdr::len, netbuf_free(), netbuf_pull(), ntohs, ipv4_hdr::src, udp_hdr::src, netbuf::src_ip, netbuf::src_port, netif::stats, and udp_input().

Referenced by ipv4_input(), and udp_input().