xref: /reactos/drivers/network/tcpip/include/udp.h (revision 1734f297)
1 /*
2  * COPYRIGHT:   See COPYING in the top level directory
3  * PROJECT:     ReactOS TCP/IP protocol driver
4  * FILE:        include/udp.h
5  * PURPOSE:     User Datagram Protocol definitions
6  */
7 
8 #pragma once
9 
10 #define UDP_STARTING_PORT 0x8000
11 #define UDP_DYNAMIC_PORTS 0x8000
12 
13 /* UDPv4 header structure */
14 #include <pshpack1.h>
15 typedef struct UDP_HEADER {
16   USHORT SourcePort; /* Source port */
17   USHORT DestPort;   /* Destination port */
18   USHORT Length;     /* Size of header and data */
19   USHORT Checksum;   /* Checksum of datagram */
20 } UDP_HEADER, *PUDP_HEADER;
21 
22 /* UDPv4 pseudo header */
23 typedef struct UDP_PSEUDO_HEADER {
24   ULONG SourceAddress; /* Source address */
25   ULONG DestAddress;   /* Destination address */
26   UCHAR Zero;          /* Reserved */
27   UCHAR Protocol;      /* Protocol */
28   USHORT UDPLength;    /* Size of UDP datagram */
29 } UDP_PSEUDO_HEADER, *PUDP_PSEUDO_HEADER;
30 #include <poppack.h>
31 
32 typedef struct UDP_STATISTICS {
33   ULONG InputDatagrams;
34   ULONG NumPorts;
35   ULONG InputErrors;
36   ULONG OutputDatagrams;
37   ULONG NumAddresses;
38 } UDP_STATISTICS, *PUDP_STATISTICS;
39 
40 extern UDP_STATISTICS UDPStats;
41 
42 VOID UDPSend(
43   PVOID Context,
44   PDATAGRAM_SEND_REQUEST SendRequest);
45 
46 NTSTATUS UDPSendDatagram(
47     PADDRESS_FILE AddrFile,
48     PTDI_CONNECTION_INFORMATION ConnInfo,
49     PCHAR BufferData,
50     ULONG DataSize,
51     PULONG DataUsed );
52 
53 VOID UDPReceive(
54     PIP_INTERFACE Interface,
55     PIP_PACKET IPPacket);
56 
57 NTSTATUS UDPStartup(
58   VOID);
59 
60 NTSTATUS UDPShutdown(
61   VOID);
62 UINT UDPAllocatePort( UINT HintPort );
63 VOID UDPFreePort( UINT Port );
64 
65 /* EOF */
66