summaryrefslogtreecommitdiff
path: root/Protocol/Udp/Udp.h
blob: 787fc43bdbdf2929376ad6ce7c1dd8293785eddf (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
//
// This file contains 'Framework Code' and is licensed as such 
// under the terms of your license agreement with Intel or your
// vendor.  This file may not be modified, except as allowed by
// additional terms of your license agreement.                 
//
#ifndef _EFI_UDP_H_
// GC_TODO: move protective #ifndef after comment header
#define _EFI_UDP_H_

/*++

Copyright (c)  2002 Intel Corporation.  All rights reserved.

This software and associated documentation (if any) is furnished
under a license and may only be used or copied in accordance
with the terms of the license. Except as permitted by such
license, no part of this software or documentation may be
reproduced, stored in a retrieval system, or transmitted in any
form or by any means without the express written consent of
Intel Corporation.


Module Name:
  Udp.h

Abstract:
  EFI User Datagram Protocol Definition

--*/
#include "Tiano.h"
#include "TianoTypes.h"

EFI_FORWARD_DECLARATION (EFI_UDP_PROTOCOL);

#include EFI_PROTOCOL_DEFINITION (Ip)

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
#define EFI_UDP_PROTOCOL_GUID \
  { \
    0xc56fb1b2, 0x017b, 0x4984, 0xa3, 0xf6, 0x3f, 0x73, 0x4f, 0xfa, 0x9e, 0x33 \
  }

extern EFI_GUID gEfiUdpProtocolGuid;

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

//
//
//
//
//
//
#pragma pack(1)

typedef struct {
  UINT16  SourcePort;
  UINT16  DestinationPort;
  UINT16  Length;
  UINT16  Checksum;
} EFI_UDP_HEADER;

#pragma pack()

/* - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */

//
//
//
typedef VOID  *EFI_UDP_HANDLE;

//
//
//
typedef
VOID
(EFIAPI *EFI_UDP_RECEIVE) (
  IN  VOID              *Context,
  IN  EFI_IP_ADDRESS    * DestinationIp,
  IN  UINT16            DestinationPort,
  IN  EFI_IP_ADDRESS    * SourceIp,
  IN  UINT16            SourcePort,
  IN  UINTN             BufferLen,
  IN  VOID              *Buffer
  );

/*++
 *  Description:
 *  The UDP receive function is called during UDP event processing when a
 *  valid UDP packet has been received.  All processing of the received data
 *  must be completed before returning control to the UDP protocol driver.
 *  The contents of the DestinationIp, SourceIp and Buffer parameters may
 *  be overwritten or unallocated after control is returned to the UDP
 *  protocol driver.
 *
 *  Parameters:
 *  Context -         Pointer to receive context data.
 *  DestinationIp -   IP address that the packet was sent to.
 *  DestinationPort - UDP port number that the packet was sent to.
 *  SourceIp -        IP address that the packet was sent from.
 *  SourcePort -      UDP port number that the packet was sent from.
 *  BufferLen -       Length of received UDP packet.  May be zero.
 *  Buffer -          Pointer to received UDP packet.  May be NULL.
 *
 *  Returns:
 *  n/a
--*/

//
//
//
typedef struct {
  VOID            *Context;
  EFI_IP_ADDRESS  StationIp;
  EFI_IP_ADDRESS  SubnetMask;
  EFI_IP_ADDRESS  GatewayIp;
  UINT8           TypeOfService;
  UINT8           TimeToLive;
  BOOLEAN         DoNotFragment;
  BOOLEAN         Promiscuous;
  BOOLEAN         Broadcast;
  BOOLEAN         AnyPort;
  UINT16          Port;
  EFI_UDP_RECEIVE Receive;
  UINTN           MulticastIpCount;
  EFI_IP_ADDRESS  *MulticastIpList;
} EFI_UDP_OPEN_DATA;

/*++
 *  StationIp -         IP address assigned to this UDP handle.
 *  SubnetMask -        Subnet mask.  Used to check if the destination IP
 *                      address is on the same subnet as the StationIp.
 *  GatewayIp -         Default gateway IP address.  Used if the destination
 *                      IP address is not on the same subnet as the StationIp
 *                      and is also not present in the route table.
 *  TypeOfService -     Packet service priority.
 *  TimeToLive -        Number of gateway 'hops' before packet 'dies'.
 *  DoNotFragment -     If TRUE, transmitted UDP packets will have the
 *                      'do not fragment' bit set in the IP header.
 *  Promiscuous -       If TRUE, accept all UDP packets if they get past
 *                      the port filters.
 *  Broadcast -         If TRUE, accept broadcast UDP packets if they get
 *                      past the port filters.
 *  AnyPort -           Accept UDP packets sent to any port number.
 *  Port -              If AnyPort is FALSE, only accept UDP packets sent
 *                      to this port number.
 *  Receive -           Pointer to the UDP receive function for this handle.
 *  MulticastIpCount -  Number of multicast IP addresses in the MulticastIpList
 *                      array.  May be zero.
 *  MulticastIpList -   Array of multicast IP addresses.  UDP packets sent to 
 *                      these addresses will be accepted by the UDP protocol
 *                      driver if they get past the port filters.
--*/

//
//
//
typedef
EFI_STATUS
(EFIAPI *EFI_UDP_OPEN) (
  IN EFI_UDP_PROTOCOL           * This,
  IN  EFI_UDP_OPEN_DATA         * UdpOpenData,
  OUT EFI_UDP_HANDLE            * NewUdpHandle
  );

//
//
//
typedef
EFI_STATUS
(EFIAPI *EFI_UDP_CLOSE) (
  IN  EFI_UDP_HANDLE  UdpHandle,
  IN  BOOLEAN         Flush
  );

//
//
//
typedef
EFI_STATUS
(EFIAPI *EFI_UDP_TRANSMIT) (
  IN  EFI_UDP_HANDLE  UdpHandle,
  IN  EFI_IP_ADDRESS  * DestinationIp,
  IN  UINT16          DestinationPort,
  IN  BOOLEAN         Flush,
  IN  UINTN           BufferLen,
  IN  VOID            *Buffer
  );

//
//  UDP protocol interface.
//
typedef struct _EFI_UDP_PROTOCOL {
  EFI_UDP_OPEN      Open;
  EFI_UDP_CLOSE     Close;
  EFI_UDP_TRANSMIT  Transmit;
  EFI_EVENT         Event;
} EFI_UDP_PROTOCOL;

#endif /* _EFI_UDP_H */

/* EOF - Udp.h */