Fixed UDP protocol.
[reactos.git] / reactos / drivers / net / tcpip / include / udp.h
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 #ifndef __UDP_H
8 #define __UDP_H
9
10
11 /* UDPv4 header structure */
12 typedef struct UDP_HEADER {
13 USHORT SourcePort; /* Source port */
14 USHORT DestPort; /* Destination port */
15 USHORT Length; /* Size of header and data */
16 USHORT Checksum; /* Checksum of datagram */
17 } __attribute__((packed)) UDP_HEADER, *PUDP_HEADER;
18
19 /* UDPv4 pseudo header */
20 typedef struct UDP_PSEUDO_HEADER {
21 ULONG SourceAddress; /* Source address */
22 ULONG DestAddress; /* Destination address */
23 UCHAR Zero; /* Reserved */
24 UCHAR Protocol; /* Protocol */
25 USHORT UDPLength; /* Size of UDP datagram */
26 } __attribute__((packed)) UDP_PSEUDO_HEADER, *PUDP_PSEUDO_HEADER;
27
28
29 typedef struct UDP_STATISTICS {
30 ULONG InputDatagrams;
31 ULONG NumPorts;
32 ULONG InputErrors;
33 ULONG OutputDatagrams;
34 ULONG NumAddresses;
35 } UDP_STATISTICS, *PUDP_STATISTICS;
36
37 VOID UDPSend(
38 PVOID Context,
39 PDATAGRAM_SEND_REQUEST SendRequest);
40
41 NTSTATUS UDPSendDatagram(
42 PADDRESS_FILE AddrFile,
43 PTDI_CONNECTION_INFORMATION ConnInfo,
44 PCHAR BufferData,
45 ULONG DataSize,
46 PULONG DataUsed );
47
48 NTSTATUS UDPReceiveDatagram(
49 PADDRESS_FILE AddrFile,
50 PTDI_CONNECTION_INFORMATION ConnInfo,
51 PCHAR Buffer,
52 ULONG ReceiveLength,
53 ULONG ReceiveFlags,
54 PTDI_CONNECTION_INFORMATION ReturnInfo,
55 PULONG BytesReceived);
56
57 VOID UDPReceive(
58 PNET_TABLE_ENTRY NTE,
59 PIP_PACKET IPPacket);
60
61 NTSTATUS UDPStartup(
62 VOID);
63
64 NTSTATUS UDPShutdown(
65 VOID);
66
67 #endif /* __UDP_H */
68
69 /* EOF */