xref: /freebsd/stand/efi/include/efiudp.h (revision 5b20c5e1f8d59f14901f0c0e4b6b577eaa3f9569)
1 /* $FreeBSD$ */
2 #ifndef _EFI_UDP_H
3 #define _EFI_UDP_H
4 
5 
6 /*++
7 Copyright (c) 2013  Intel Corporation
8 
9 --*/
10 
11 #define EFI_UDP4_SERVICE_BINDING_PROTOCOL \
12     { 0x83f01464, 0x99bd, 0x45e5, {0xb3, 0x83, 0xaf, 0x63, 0x05, 0xd8, 0xe9, 0xe6} }
13 
14 #define EFI_UDP4_PROTOCOL \
15     { 0x3ad9df29, 0x4501, 0x478d, {0xb1, 0xf8, 0x7f, 0x7f, 0xe7, 0x0e, 0x50, 0xf3} }
16 
17 #define EFI_UDP6_SERVICE_BINDING_PROTOCOL \
18     { 0x66ed4721, 0x3c98, 0x4d3e, {0x81, 0xe3, 0xd0, 0x3d, 0xd3, 0x9a, 0x72, 0x54} }
19 
20 #define EFI_UDP6_PROTOCOL \
21     { 0x4f948815, 0xb4b9, 0x43cb, {0x8a, 0x33, 0x90, 0xe0, 0x60, 0xb3,0x49, 0x55} }
22 
23 INTERFACE_DECL(_EFI_UDP4);
24 INTERFACE_DECL(_EFI_UDP6);
25 
26 typedef struct {
27     BOOLEAN          AcceptBroadcast;
28     BOOLEAN          AcceptPromiscuous;
29     BOOLEAN          AcceptAnyPort;
30     BOOLEAN          AllowDuplicatePort;
31     UINT8            TypeOfService;
32     UINT8            TimeToLive;
33     BOOLEAN          DoNotFragment;
34     UINT32           ReceiveTimeout;
35     UINT32           TransmitTimeout;
36     BOOLEAN          UseDefaultAddress;
37     EFI_IPv4_ADDRESS StationAddress;
38     EFI_IPv4_ADDRESS SubnetMask;
39     UINT16           StationPort;
40     EFI_IPv4_ADDRESS RemoteAddress;
41     UINT16           RemotePort;
42 } EFI_UDP4_CONFIG_DATA;
43 
44 typedef
45 EFI_STATUS
46 (EFIAPI *EFI_UDP4_GET_MODE_DATA) (
47     IN struct _EFI_UDP4                 *This,
48     OUT EFI_UDP4_CONFIG_DATA            *Udp4ConfigData OPTIONAL,
49     OUT EFI_IP4_MODE_DATA               *Ip4ModeData    OPTIONAL,
50     OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData  OPTIONAL,
51     OUT EFI_SIMPLE_NETWORK_MODE         *SnpModeData    OPTIONAL
52     );
53 
54 typedef
55 EFI_STATUS
56 (EFIAPI *EFI_UDP4_CONFIGURE) (
57     IN struct _EFI_UDP4     *This,
58     IN EFI_UDP4_CONFIG_DATA *UdpConfigData OPTIONAL
59     );
60 
61 typedef
62 EFI_STATUS
63 (EFIAPI *EFI_UDP4_GROUPS) (
64     IN struct _EFI_UDP4 *This,
65     IN BOOLEAN          JoinFlag,
66     IN EFI_IPv4_ADDRESS *MulticastAddress OPTIONAL
67     );
68 
69 typedef
70 EFI_STATUS
71 (EFIAPI *EFI_UDP4_ROUTES) (
72     IN struct _EFI_UDP4 *This,
73     IN BOOLEAN          DeleteRoute,
74     IN EFI_IPv4_ADDRESS *SubnetAddress,
75     IN EFI_IPv4_ADDRESS *SubnetMask,
76     IN EFI_IPv4_ADDRESS *GatewayAddress
77     );
78 
79 #define EFI_NETWORK_UNREACHABLE  EFIERR(100)
80 #define EFI_HOST_UNREACHABLE     EFIERR(101)
81 #define EFI_PROTOCOL_UNREACHABLE EFIERR(102)
82 #define EFI_PORT_UNREACHABLE     EFIERR(103)
83 
84 typedef struct {
85     EFI_IPv4_ADDRESS SourceAddress;
86     UINT16           SourcePort;
87     EFI_IPv4_ADDRESS DestinationAddress;
88     UINT16           DestinationPort;
89 } EFI_UDP4_SESSION_DATA;
90 
91 typedef struct {
92     UINT32 FragmentLength;
93     VOID   *FragmentBuffer;
94 } EFI_UDP4_FRAGMENT_DATA;
95 
96 typedef struct {
97     EFI_TIME               TimeStamp;
98     EFI_EVENT              RecycleSignal;
99     EFI_UDP4_SESSION_DATA  UdpSession;
100     UINT32                 DataLength;
101     UINT32                 FragmentCount;
102     EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
103 } EFI_UDP4_RECEIVE_DATA;
104 
105 typedef struct {
106     EFI_UDP4_SESSION_DATA  *UdpSessionData;
107     EFI_IPv4_ADDRESS       *GatewayAddress;
108     UINT32                 DataLength;
109     UINT32                 FragmentCount;
110     EFI_UDP4_FRAGMENT_DATA FragmentTable[1];
111 } EFI_UDP4_TRANSMIT_DATA;
112 
113 typedef struct {
114     EFI_EVENT                  Event;
115     EFI_STATUS                 Status;
116     union {
117         EFI_UDP4_RECEIVE_DATA  *RxData;
118 	EFI_UDP4_TRANSMIT_DATA *TxData;
119     }                          Packet;
120 } EFI_UDP4_COMPLETION_TOKEN;
121 
122 typedef
123 EFI_STATUS
124 (EFIAPI *EFI_UDP4_TRANSMIT) (
125     IN struct _EFI_UDP4          *This,
126     IN EFI_UDP4_COMPLETION_TOKEN *Token
127     );
128 
129 typedef
130 EFI_STATUS
131 (EFIAPI *EFI_UDP4_RECEIVE) (
132     IN struct _EFI_UDP4          *This,
133     IN EFI_UDP4_COMPLETION_TOKEN *Token
134     );
135 
136 typedef
137 EFI_STATUS
138 (EFIAPI *EFI_UDP4_CANCEL)(
139     IN struct _EFI_UDP4          *This,
140     IN EFI_UDP4_COMPLETION_TOKEN *Token OPTIONAL
141     );
142 
143 typedef
144 EFI_STATUS
145 (EFIAPI *EFI_UDP4_POLL) (
146     IN struct _EFI_UDP4 *This
147     );
148 
149 typedef struct _EFI_UDP4 {
150     EFI_UDP4_GET_MODE_DATA GetModeData;
151     EFI_UDP4_CONFIGURE     Configure;
152     EFI_UDP4_GROUPS        Groups;
153     EFI_UDP4_ROUTES        Routes;
154     EFI_UDP4_TRANSMIT      Transmit;
155     EFI_UDP4_RECEIVE       Receive;
156     EFI_UDP4_CANCEL        Cancel;
157     EFI_UDP4_POLL          Poll;
158 } EFI_UDP4;
159 
160 typedef struct {
161     BOOLEAN          AcceptPromiscuous;
162     BOOLEAN          AcceptAnyPort;
163     BOOLEAN          AllowDuplicatePort;
164     UINT8            TrafficClass;
165     UINT8            HopLimit;
166     UINT32           ReceiveTimeout;
167     UINT32           TransmitTimeout;
168     EFI_IPv6_ADDRESS StationAddress;
169     UINT16           StationPort;
170     EFI_IPv6_ADDRESS RemoteAddress;
171     UINT16           RemotePort;
172 } EFI_UDP6_CONFIG_DATA;
173 
174 typedef
175 EFI_STATUS
176 (EFIAPI *EFI_UDP6_GET_MODE_DATA) (
177     IN struct _EFI_UDP6                 *This,
178     OUT EFI_UDP6_CONFIG_DATA            *Udp6ConfigData OPTIONAL,
179     OUT EFI_IP6_MODE_DATA               *Ip6ModeData    OPTIONAL,
180     OUT EFI_MANAGED_NETWORK_CONFIG_DATA *MnpConfigData  OPTIONAL,
181     OUT EFI_SIMPLE_NETWORK_MODE         *SnpModeData    OPTIONAL
182     );
183 
184 typedef
185 EFI_STATUS
186 (EFIAPI *EFI_UDP6_CONFIGURE) (
187     IN struct _EFI_UDP6     *This,
188     IN EFI_UDP6_CONFIG_DATA *UdpConfigData OPTIONAL
189     );
190 
191 typedef
192 EFI_STATUS
193 (EFIAPI *EFI_UDP6_GROUPS) (
194     IN struct _EFI_UDP6 *This,
195     IN BOOLEAN          JoinFlag,
196     IN EFI_IPv6_ADDRESS *MulticastAddress OPTIONAL
197     );
198 
199 typedef struct {
200     EFI_IPv6_ADDRESS SourceAddress;
201     UINT16           SourcePort;
202     EFI_IPv6_ADDRESS DestinationAddress;
203     UINT16           DestinationPort;
204 } EFI_UDP6_SESSION_DATA;
205 
206 typedef struct {
207     UINT32 FragmentLength;
208     VOID   *FragmentBuffer;
209 } EFI_UDP6_FRAGMENT_DATA;
210 
211 typedef struct {
212     EFI_TIME               TimeStamp;
213     EFI_EVENT              RecycleSignal;
214     EFI_UDP6_SESSION_DATA  UdpSession;
215     UINT32                 DataLength;
216     UINT32                 FragmentCount;
217     EFI_UDP6_FRAGMENT_DATA FragmentTable[1];
218 } EFI_UDP6_RECEIVE_DATA;
219 
220 typedef struct {
221     EFI_UDP6_SESSION_DATA  *UdpSessionData;
222     UINT32                 DataLength;
223     UINT32                 FragmentCount;
224     EFI_UDP6_FRAGMENT_DATA FragmentTable[1];
225 } EFI_UDP6_TRANSMIT_DATA;
226 
227 typedef struct {
228     EFI_EVENT                  Event;
229     EFI_STATUS                 Status;
230     union {
231         EFI_UDP6_RECEIVE_DATA  *RxData;
232         EFI_UDP6_TRANSMIT_DATA *TxData;
233     }                          Packet;
234 } EFI_UDP6_COMPLETION_TOKEN;
235 
236 typedef
237 EFI_STATUS
238 (EFIAPI *EFI_UDP6_TRANSMIT) (
239     IN struct _EFI_UDP6          *This,
240     IN EFI_UDP6_COMPLETION_TOKEN *Token
241     );
242 
243 typedef
244 EFI_STATUS
245 (EFIAPI *EFI_UDP6_RECEIVE) (
246     IN struct _EFI_UDP6          *This,
247     IN EFI_UDP6_COMPLETION_TOKEN *Token
248     );
249 
250 typedef
251 EFI_STATUS
252 (EFIAPI *EFI_UDP6_CANCEL)(
253     IN struct _EFI_UDP6          *This,
254     IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL
255     );
256 
257 typedef
258 EFI_STATUS
259 (EFIAPI *EFI_UDP6_POLL) (
260     IN struct _EFI_UDP6 *This
261     );
262 
263 typedef struct _EFI_UDP6 {
264     EFI_UDP6_GET_MODE_DATA GetModeData;
265     EFI_UDP6_CONFIGURE     Configure;
266     EFI_UDP6_GROUPS        Groups;
267     EFI_UDP6_TRANSMIT      Transmit;
268     EFI_UDP6_RECEIVE       Receive;
269     EFI_UDP6_CANCEL        Cancel;
270     EFI_UDP6_POLL          Poll;
271 } EFI_UDP6;
272 
273 #endif /* _EFI_UDP_H */
274