#include <dolphin/ip.h>
#define UDP_HLEN 8
typedef struct UDPHeader
{
u16 src; // source port number
u16 dst; // destination port number
u16 len; // length
u16 sum; // check sum
} UDPHeader;
In a UDP datagram, the UDP header follows the IP header, supplying information specific to the UDP protocol..
A UDP datagram is encapsulated in an IP datagram as shown below:
|
UDP header |
UDP data |
Postel, J. B., 1981 "User Datagram Protocol", RFC 768 (Aug.).