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