~ubuntu-branches/ubuntu/wily/edk2/wily

« back to all changes in this revision

Viewing changes to NetworkPkg/Udp6Dxe/Udp6Impl.h

  • Committer: Package Import Robot
  • Author(s): Steve Langasek
  • Date: 2013-02-10 13:11:25 UTC
  • Revision ID: package-import@ubuntu.com-20130210131125-0zwkb8f8m4ecia4m
Tags: upstream-0~20121205.edae8d2d
ImportĀ upstreamĀ versionĀ 0~20121205.edae8d2d

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
/** @file
 
2
  Udp6 driver's whole implementation and internal data structures.
 
3
 
 
4
  Copyright (c) 2009 - 2010, Intel Corporation. All rights reserved.<BR>
 
5
 
 
6
  This program and the accompanying materials
 
7
  are licensed and made available under the terms and conditions of the BSD License
 
8
  which accompanies this distribution.  The full text of the license may be found at
 
9
  http://opensource.org/licenses/bsd-license.php.
 
10
 
 
11
  THE PROGRAM IS DISTRIBUTED UNDER THE BSD LICENSE ON AN "AS IS" BASIS,
 
12
  WITHOUT WARRANTIES OR REPRESENTATIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED.
 
13
 
 
14
**/
 
15
 
 
16
#ifndef _UDP6_IMPL_H_
 
17
#define _UDP6_IMPL_H_
 
18
 
 
19
#include <Uefi.h>
 
20
 
 
21
#include <Protocol/Ip6.h>
 
22
#include <Protocol/Udp6.h>
 
23
 
 
24
#include <Library/IpIoLib.h>
 
25
#include <Library/DebugLib.h>
 
26
#include <Library/UefiRuntimeServicesTableLib.h>
 
27
#include <Library/UefiBootServicesTableLib.h>
 
28
#include <Library/BaseLib.h>
 
29
#include <Library/UefiLib.h>
 
30
#include <Library/BaseMemoryLib.h>
 
31
#include <Library/MemoryAllocationLib.h>
 
32
#include <Library/DpcLib.h>
 
33
 
 
34
#include "Udp6Driver.h"
 
35
 
 
36
extern EFI_COMPONENT_NAME2_PROTOCOL   gUdp6ComponentName2;
 
37
extern EFI_COMPONENT_NAME_PROTOCOL    gUdp6ComponentName;
 
38
extern EFI_SERVICE_BINDING_PROTOCOL   mUdp6ServiceBinding;
 
39
extern EFI_UDP6_PROTOCOL              mUdp6Protocol;
 
40
extern UINT16                         mUdp6RandomPort;
 
41
 
 
42
//
 
43
// Define time out 50 milliseconds
 
44
//
 
45
#define UDP6_TIMEOUT_INTERVAL (50 * TICKS_PER_MS)
 
46
#define UDP6_HEADER_SIZE      sizeof (EFI_UDP_HEADER)
 
47
#define UDP6_MAX_DATA_SIZE    65507
 
48
#define UDP6_PORT_KNOWN       1024
 
49
 
 
50
#define UDP6_SERVICE_DATA_SIGNATURE SIGNATURE_32 ('U', 'd', 'p', '6')
 
51
#define UDP6_INSTANCE_DATA_SIGNATURE  SIGNATURE_32 ('U', 'd', 'p', 'S')
 
52
 
 
53
#define UDP6_SERVICE_DATA_FROM_THIS(a) \
 
54
  CR ( \
 
55
  (a), \
 
56
  UDP6_SERVICE_DATA, \
 
57
  ServiceBinding, \
 
58
  UDP6_SERVICE_DATA_SIGNATURE \
 
59
  )
 
60
 
 
61
#define UDP6_INSTANCE_DATA_FROM_THIS(a) \
 
62
  CR ( \
 
63
  (a), \
 
64
  UDP6_INSTANCE_DATA, \
 
65
  Udp6Proto, \
 
66
  UDP6_INSTANCE_DATA_SIGNATURE \
 
67
  )
 
68
//
 
69
// Udp6 service contest data
 
70
//
 
71
typedef struct _UDP6_SERVICE_DATA {
 
72
  UINT32                        Signature;
 
73
  EFI_SERVICE_BINDING_PROTOCOL  ServiceBinding;
 
74
  EFI_HANDLE                    ImageHandle;
 
75
  EFI_HANDLE                    ControllerHandle;
 
76
  LIST_ENTRY                    ChildrenList;
 
77
  UINTN                         ChildrenNumber;
 
78
  IP_IO                         *IpIo;
 
79
  EFI_EVENT                     TimeoutEvent;
 
80
  CHAR16                        *MacString;
 
81
} UDP6_SERVICE_DATA;
 
82
 
 
83
typedef struct _UDP6_INSTANCE_DATA {
 
84
  UINT32                Signature;
 
85
  LIST_ENTRY            Link;
 
86
  UDP6_SERVICE_DATA     *Udp6Service;
 
87
  EFI_UDP6_PROTOCOL     Udp6Proto;
 
88
  EFI_UDP6_CONFIG_DATA  ConfigData;
 
89
  EFI_HANDLE            ChildHandle;
 
90
  BOOLEAN               Configured;
 
91
  BOOLEAN               IsNoMapping;
 
92
  NET_MAP               TxTokens;
 
93
  NET_MAP               RxTokens;
 
94
  NET_MAP               McastIps;
 
95
  LIST_ENTRY            RcvdDgramQue;
 
96
  LIST_ENTRY            DeliveredDgramQue;
 
97
  UINT16                HeadSum;
 
98
  EFI_STATUS            IcmpError;
 
99
  IP_IO_IP_INFO         *IpInfo;
 
100
  BOOLEAN               Destroyed;
 
101
} UDP6_INSTANCE_DATA;
 
102
 
 
103
typedef struct _UDP6_RXDATA_WRAP {
 
104
  LIST_ENTRY             Link;
 
105
  NET_BUF                *Packet;
 
106
  UINT32                 TimeoutTick;
 
107
  EFI_UDP6_RECEIVE_DATA  RxData;
 
108
} UDP6_RXDATA_WRAP;
 
109
 
 
110
/**
 
111
  Clean the Udp service context data.
 
112
 
 
113
  @param[in, out]  Udp6Service      Pointer to the UDP6_SERVICE_DATA.
 
114
 
 
115
**/
 
116
VOID
 
117
Udp6CleanService (
 
118
  IN OUT UDP6_SERVICE_DATA  *Udp6Service
 
119
  );
 
120
 
 
121
/**
 
122
  Create the Udp service context data.
 
123
 
 
124
  @param[in]  Udp6Service            Pointer to the UDP6_SERVICE_DATA.
 
125
  @param[in]  ImageHandle            The image handle of this udp6 driver.
 
126
  @param[in]  ControllerHandle       The controller handle this udp6 driver binds on.
 
127
 
 
128
  @retval EFI_SUCCESS            The udp6 service context data was created and
 
129
                                 initialized.
 
130
  @retval EFI_OUT_OF_RESOURCES   Cannot allocate memory.
 
131
  @retval Others                 An error condition occurred.
 
132
 
 
133
**/
 
134
EFI_STATUS
 
135
Udp6CreateService (
 
136
  IN UDP6_SERVICE_DATA  *Udp6Service,
 
137
  IN EFI_HANDLE         ImageHandle,
 
138
  IN EFI_HANDLE         ControllerHandle
 
139
  );
 
140
 
 
141
/**
 
142
  Set the Udp6 variable data.
 
143
 
 
144
  @param[in]  Udp6Service            Udp6 service data.
 
145
 
 
146
  @retval     EFI_OUT_OF_RESOURCES   There are not enough resources to set the
 
147
                                     variable.
 
148
  @retval     other                  Set variable failed.
 
149
 
 
150
**/
 
151
EFI_STATUS
 
152
Udp6SetVariableData (
 
153
  IN UDP6_SERVICE_DATA  *Udp6Service
 
154
  );
 
155
 
 
156
/**
 
157
  This function cleans the udp instance.
 
158
 
 
159
  @param[in, out]  Instance       Pointer to the UDP6_INSTANCE_DATA to clean.
 
160
 
 
161
**/
 
162
VOID
 
163
Udp6CleanInstance (
 
164
  IN OUT UDP6_INSTANCE_DATA  *Instance
 
165
  );
 
166
 
 
167
/**
 
168
  Clear the variable and free the resource.
 
169
 
 
170
  @param[in, out]  Udp6Service            Udp6 service data.
 
171
 
 
172
**/
 
173
VOID
 
174
Udp6ClearVariableData (
 
175
  IN OUT UDP6_SERVICE_DATA  *Udp6Service
 
176
  );
 
177
 
 
178
/**
 
179
  This function intializes the new created udp instance.
 
180
 
 
181
  @param[in]      Udp6Service      Pointer to the UDP6_SERVICE_DATA.
 
182
  @param[in, out]  Instance         Pointer to the un-initialized UDP6_INSTANCE_DATA.
 
183
 
 
184
**/
 
185
VOID
 
186
Udp6InitInstance (
 
187
  IN UDP6_SERVICE_DATA       *Udp6Service,
 
188
  IN OUT UDP6_INSTANCE_DATA  *Instance
 
189
  );
 
190
 
 
191
/**
 
192
  This function reports the received ICMP error.
 
193
 
 
194
  @param[in]  Instance          Pointer to the udp instance context data.
 
195
 
 
196
**/
 
197
VOID
 
198
Udp6ReportIcmpError (
 
199
  IN UDP6_INSTANCE_DATA  *Instance
 
200
  );
 
201
 
 
202
/**
 
203
  This function copies the current operational settings of this EFI UDPv6 Protocol
 
204
  instance into user-supplied buffers. This function is used optionally to retrieve
 
205
  the operational mode data of underlying networks or drivers.
 
206
 
 
207
  @param[in]  This               Pointer to the EFI_UDP6_PROTOCOL instance.
 
208
  @param[out] Udp6ConfigData     The buffer in which the current UDP configuration
 
209
                                 data is returned. This parameter is optional and
 
210
                                 may be NULL.
 
211
  @param[out] Ip6ModeData        The buffer in which the current EFI IPv6 Protocol
 
212
                                 mode data is returned. This parameter is optional
 
213
                                 and may be NULL.
 
214
  @param[out] MnpConfigData      The buffer in which the current managed network
 
215
                                 configuration data is returned. This parameter
 
216
                                 is optional and may be NULL.
 
217
  @param[out] SnpModeData        The buffer in which the simple network mode data
 
218
                                 is returned. This parameter is optional and may be NULL.
 
219
 
 
220
  @retval EFI_SUCCESS            The mode data was read.
 
221
  @retval EFI_NOT_STARTED        When Udp6ConfigData is queried, no configuration
 
222
                                 data is  available because this instance has not
 
223
                                 been started.
 
224
  @retval EFI_INVALID_PARAMETER  This is NULL.
 
225
 
 
226
**/
 
227
EFI_STATUS
 
228
EFIAPI
 
229
Udp6GetModeData (
 
230
  IN  EFI_UDP6_PROTOCOL                *This,
 
231
  OUT EFI_UDP6_CONFIG_DATA             *Udp6ConfigData OPTIONAL,
 
232
  OUT EFI_IP6_MODE_DATA                *Ip6ModeData    OPTIONAL,
 
233
  OUT EFI_MANAGED_NETWORK_CONFIG_DATA  *MnpConfigData  OPTIONAL,
 
234
  OUT EFI_SIMPLE_NETWORK_MODE          *SnpModeData    OPTIONAL
 
235
  );
 
236
 
 
237
/**
 
238
  This function is used to do the following:
 
239
  Initialize and start this instance of the EFI UDPv6 Protocol.
 
240
  Change the filtering rules and operational parameters.
 
241
  Reset this instance of the EFI UDPv6 Protocol.
 
242
 
 
243
  @param[in]  This               Pointer to the EFI_UDP6_PROTOCOL instance.
 
244
  @param[in]  UdpConfigData      Pointer to the buffer to set the configuration
 
245
                                 data. This parameter is optional and may be NULL.
 
246
 
 
247
  @retval EFI_SUCCESS            The configuration settings were set, changed, or
 
248
                                 reset successfully.
 
249
  @retval EFI_NO_MAPPING         When the UdpConifgData.UseAnyStationAddress is set
 
250
                                 to true  and there is no address available for IP6
 
251
                                 driver to binding  source address to this
 
252
                                 instance.
 
253
  @retval EFI_INVALID_PARAMETER  One or more following conditions are TRUE:
 
254
                                 This is NULL.
 
255
                                 UdpConfigData.StationAddress is not a valid
 
256
                                 unicast IPv6 address.
 
257
                                 UdpConfigData.RemoteAddress is not a valid unicast
 
258
                                 IPv6  address, if it is not zero.
 
259
  @retval EFI_ALREADY_STARTED    The EFI UDPv6 Protocol instance is already
 
260
                                 started/configured and must be stopped/reset
 
261
                                 before it can be reconfigured. Only TrafficClass,
 
262
                                 HopLimit, ReceiveTimeout, and TransmitTimeout can
 
263
                                 be reconfigured without stopping the current
 
264
                                 instance of the EFI UDPv6 Protocol.
 
265
  @retval EFI_ACCESS_DENIED      UdpConfigData.AllowDuplicatePort is FALSE, and
 
266
                                 UdpConfigData.StationPort is already used by another
 
267
                                 instance.
 
268
  @retval EFI_OUT_OF_RESOURCES   The EFI UDPv6 Protocol driver cannot allocate
 
269
                                 memory for this EFI UDPv6 Protocol instance.
 
270
  @retval EFI_DEVICE_ERROR       An unexpected network or system error occurred, and
 
271
                                 this instance was not opened.
 
272
 
 
273
**/
 
274
EFI_STATUS
 
275
EFIAPI
 
276
Udp6Configure (
 
277
  IN EFI_UDP6_PROTOCOL     *This,
 
278
  IN EFI_UDP6_CONFIG_DATA  *UdpConfigData OPTIONAL
 
279
  );
 
280
 
 
281
/**
 
282
  This function places a sending request to this instance of the EFI UDPv6 Protocol,
 
283
  alongside the transmit data that was filled by the user.
 
284
 
 
285
  @param[in]  This               Pointer to the EFI_UDP6_PROTOCOL instance.
 
286
  @param[in]  Token              Pointer to the completion token that will be
 
287
                                 placed into the transmit queue.
 
288
 
 
289
  @retval EFI_SUCCESS            The data has been queued for transmission.
 
290
  @retval EFI_NOT_STARTED        This EFI UDPv6 Protocol instance has not been
 
291
                                 started.
 
292
  @retval EFI_NO_MAPPING         The under-layer IPv6 driver was responsible for
 
293
                                 choosing a source address for this instance, but
 
294
                                 no  source address was available for use.
 
295
  @retval EFI_INVALID_PARAMETER  One or more of the following are TRUE:
 
296
                                 This is NULL. Token is NULL. Token.Event is NULL.
 
297
                                 Token.Packet.TxData is NULL.
 
298
                                 Token.Packet.TxData.FragmentCount is zero.
 
299
                                 Token.Packet.TxData.DataLength is not equal to the
 
300
                                 sum of fragment lengths.
 
301
                                 One or more of the
 
302
                                 Token.Packet.TxData.FragmentTable[]
 
303
                                 .FragmentLength fields is zero.
 
304
                                 One or more of the
 
305
                                 Token.Packet.TxData.FragmentTable[]
 
306
                                 .FragmentBuffer fields is NULL.
 
307
                                 One or more of the
 
308
                                 Token.Packet.TxData.UdpSessionData.
 
309
                                 DestinationAddres are not valid unicast IPv6
 
310
                                 addresses, if the  UdpSessionData is not NULL.
 
311
                                 Token.Packet.TxData.UdpSessionData.
 
312
                                 DestinationAddres is NULL
 
313
                                 Token.Packet.TxData.UdpSessionData.
 
314
                                 DestinatioPort is zero.
 
315
                                 Token.Packet.TxData.UdpSessionData is
 
316
                                 NULL and this  instance's
 
317
                                 UdpConfigData.RemoteAddress is unspecified.
 
318
  @retval EFI_ACCESS_DENIED      The transmit completion token with the same
 
319
                                 Token.Event is already in the transmit queue.
 
320
  @retval EFI_NOT_READY          The completion token could not be queued because
 
321
                                 the transmit queue is full.
 
322
  @retval EFI_OUT_OF_RESOURCES   Could not queue the transmit data.
 
323
  @retval EFI_NOT_FOUND          There is no route to the destination network or
 
324
                                 address.
 
325
  @retval EFI_BAD_BUFFER_SIZE    The data length is greater than the maximum UDP
 
326
                                 packet size. Or the length of the IP header + UDP
 
327
                                 header + data length is greater than MTU if
 
328
                                 DoNotFragment is TRUE.
 
329
 
 
330
**/
 
331
EFI_STATUS
 
332
EFIAPI
 
333
Udp6Transmit (
 
334
  IN EFI_UDP6_PROTOCOL          *This,
 
335
  IN EFI_UDP6_COMPLETION_TOKEN  *Token
 
336
  );
 
337
 
 
338
/**
 
339
  This function places a completion token into the receive packet queue. This function
 
340
  is always asynchronous.
 
341
 
 
342
  @param[in]  This               Pointer to the EFI_UDP6_PROTOCOL instance.
 
343
  @param[in]  Token              Pointer to a token that is associated with the
 
344
                                 receive data descriptor.
 
345
 
 
346
  @retval EFI_SUCCESS            The receive completion token is cached.
 
347
  @retval EFI_NOT_STARTED        This EFI UDPv6 Protocol instance has not been
 
348
                                 started.
 
349
  @retval EFI_NO_MAPPING         When using a default address, configuration (DHCP,
 
350
                                 BOOTP, RARP, etc.) is not finished yet.
 
351
  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
 
352
                                 This is NULL.
 
353
                                 Token is NULL.
 
354
                                 Token.Event is NULL.
 
355
  @retval EFI_OUT_OF_RESOURCES   The receive completion token could not be queued
 
356
                                 due to a lack of system resources (usually
 
357
                                 memory).
 
358
  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred.
 
359
                                 The EFI UDPv6 Protocol instance has been reset to
 
360
                                 startup defaults.
 
361
  @retval EFI_ACCESS_DENIED      A receive completion token with the same
 
362
                                 Token.Event is already in the receive queue.
 
363
  @retval EFI_NOT_READY          The receive request could not be queued because
 
364
                                 the receive  queue is full.
 
365
 
 
366
**/
 
367
EFI_STATUS
 
368
EFIAPI
 
369
Udp6Receive (
 
370
  IN EFI_UDP6_PROTOCOL          *This,
 
371
  IN EFI_UDP6_COMPLETION_TOKEN  *Token
 
372
  );
 
373
 
 
374
/**
 
375
  This function is used to abort a pending transmit or receive request.
 
376
 
 
377
  @param[in]  This               Pointer to the EFI_UDP6_PROTOCOL instance.
 
378
  @param[in]  Token              Pointer to a token that has been issued by
 
379
                                 EFI_UDP6_PROTOCOL.Transmit() or
 
380
                                 EFI_UDP6_PROTOCOL.Receive(). This parameter is
 
381
                                 optional and may be NULL.
 
382
 
 
383
  @retval EFI_SUCCESS            The asynchronous I/O request is aborted and
 
384
                                 Token.Event is  signaled. When Token is NULL, all
 
385
                                 pending requests are aborted and their events are
 
386
                                 signaled.
 
387
  @retval EFI_INVALID_PARAMETER  This is NULL.
 
388
  @retval EFI_NOT_STARTED        This instance has not been started.
 
389
  @retval EFI_NO_MAPPING         When using the default address, configuration
 
390
                                 (DHCP, BOOTP, RARP, etc.) is not finished yet.
 
391
  @retval EFI_NOT_FOUND          When Token is not NULL, the asynchronous I/O
 
392
                                 request is not found in the transmit or receive
 
393
                                 queue. It either completed or was not issued by
 
394
                                 Transmit() or Receive().
 
395
 
 
396
**/
 
397
EFI_STATUS
 
398
EFIAPI
 
399
Udp6Cancel (
 
400
  IN EFI_UDP6_PROTOCOL          *This,
 
401
  IN EFI_UDP6_COMPLETION_TOKEN  *Token OPTIONAL
 
402
  );
 
403
 
 
404
/**
 
405
  This function can be used by network drivers and applications to increase the rate that
 
406
  data packets are moved between the communications device and the transmit/receive queues.
 
407
 
 
408
  @param[in] This                Pointer to the EFI_UDP6_PROTOCOL instance.
 
409
 
 
410
  @retval EFI_SUCCESS            Incoming or outgoing data was processed.
 
411
  @retval EFI_INVALID_PARAMETER  This is NULL.
 
412
  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred.
 
413
  @retval EFI_TIMEOUT            Data was dropped out of the transmit and/or
 
414
                                 receive queue.
 
415
 
 
416
**/
 
417
EFI_STATUS
 
418
EFIAPI
 
419
Udp6Poll (
 
420
  IN EFI_UDP6_PROTOCOL  *This
 
421
  );
 
422
 
 
423
/**
 
424
  This function is used to enable and disable the multicast group filtering.
 
425
 
 
426
  @param[in]  This               Pointer to the EFI_UDP6_PROTOCOL instance.
 
427
  @param[in]  JoinFlag           Set to TRUE to join a multicast group. Set to
 
428
                                 FALSE to leave one or all multicast groups.
 
429
  @param[in]  MulticastAddress   Pointer to multicast group address to join or
 
430
                                 leave. This parameter is optional and may be NULL.
 
431
 
 
432
  @retval EFI_SUCCESS            The operation completed successfully.
 
433
  @retval EFI_NOT_STARTED        The EFI UDPv6 Protocol instance has not been
 
434
                                 started.
 
435
  @retval EFI_OUT_OF_RESOURCES   Could not allocate resources to join the group.
 
436
  @retval EFI_INVALID_PARAMETER  One or more of the following conditions is TRUE:
 
437
                                 This is NULL. JoinFlag is TRUE and
 
438
                                 MulticastAddress is NULL. JoinFlag is TRUE and
 
439
                                 *MulticastAddress is not a valid  multicast
 
440
                                 address.
 
441
  @retval EFI_ALREADY_STARTED    The group address is already in the group table
 
442
                                 (when JoinFlag is TRUE).
 
443
  @retval EFI_NOT_FOUND          The group address is not in the group table (when
 
444
                                 JoinFlag is FALSE).
 
445
  @retval EFI_DEVICE_ERROR       An unexpected system or network error occurred.
 
446
 
 
447
**/
 
448
EFI_STATUS
 
449
EFIAPI
 
450
Udp6Groups (
 
451
  IN EFI_UDP6_PROTOCOL  *This,
 
452
  IN BOOLEAN            JoinFlag,
 
453
  IN EFI_IPv6_ADDRESS   *MulticastAddress OPTIONAL
 
454
  );
 
455
 
 
456
/**
 
457
  This function tries to bind the udp instance according to the configured port
 
458
  allocation stragety.
 
459
 
 
460
  @param[in]  InstanceList       Pointer to the head of the list linking the udp
 
461
                                 instances.
 
462
  @param[in]  ConfigData         Pointer to the ConfigData of the instance to be
 
463
                                 bound.
 
464
 
 
465
  @retval EFI_SUCCESS            The bound operation completed successfully.
 
466
  @retval EFI_ACCESS_DENIED      The <Address, Port> specified by the ConfigData is
 
467
                                 already used by another instance.
 
468
  @retval EFI_OUT_OF_RESOURCES   No available port resources.
 
469
 
 
470
**/
 
471
EFI_STATUS
 
472
Udp6Bind (
 
473
  IN LIST_ENTRY            *InstanceList,
 
474
  IN EFI_UDP6_CONFIG_DATA  *ConfigData
 
475
  );
 
476
 
 
477
/**
 
478
  This function builds the Ip6 configdata from the Udp6ConfigData.
 
479
 
 
480
  @param[in]       Udp6ConfigData         Pointer to the EFI_UDP6_CONFIG_DATA.
 
481
  @param[in, out]  Ip6ConfigData          Pointer to the EFI_IP6_CONFIG_DATA.
 
482
 
 
483
**/
 
484
VOID
 
485
Udp6BuildIp6ConfigData (
 
486
  IN EFI_UDP6_CONFIG_DATA      *Udp6ConfigData,
 
487
  IN OUT EFI_IP6_CONFIG_DATA   *Ip6ConfigData
 
488
  );
 
489
 
 
490
/**
 
491
  This function checks whether the specified Token duplicates with the one in the Map.
 
492
 
 
493
  @param[in]  Map                Pointer to the NET_MAP.
 
494
  @param[in]  Item               Pointer to the NET_MAP_ITEM contain the pointer to
 
495
                                 the Token.
 
496
  @param[in]  Context            Pointer to the Token to be checked.
 
497
 
 
498
  @retval EFI_SUCCESS            The Token specified by Context differs from the
 
499
                                 one in the Item.
 
500
  @retval EFI_ACCESS_DENIED      The Token duplicates with the one in the Item.
 
501
 
 
502
**/
 
503
EFI_STATUS
 
504
EFIAPI
 
505
Udp6TokenExist (
 
506
  IN NET_MAP       *Map,
 
507
  IN NET_MAP_ITEM  *Item,
 
508
  IN VOID          *Context
 
509
  );
 
510
 
 
511
/**
 
512
  This function removes the specified Token from the TokenMap.
 
513
 
 
514
  @param[in]  TokenMap           Pointer to the NET_MAP containing the tokens.
 
515
  @param[in]  Token              Pointer to the Token to be removed.
 
516
 
 
517
  @retval EFI_SUCCESS            The specified Token is removed from the TokenMap.
 
518
  @retval EFI_NOT_FOUND          The specified Token is not found in the TokenMap.
 
519
 
 
520
**/
 
521
EFI_STATUS
 
522
Udp6RemoveToken (
 
523
  IN NET_MAP                    *TokenMap,
 
524
  IN EFI_UDP6_COMPLETION_TOKEN  *Token
 
525
  );
 
526
 
 
527
/**
 
528
  This function is used to check whether the NewConfigData has any un-reconfigurable
 
529
  parameters changed compared to the OldConfigData.
 
530
 
 
531
  @param[in]  OldConfigData    Pointer to the current ConfigData the udp instance
 
532
                               uses.
 
533
  @param[in]  NewConfigData    Pointer to the new ConfigData.
 
534
 
 
535
  @retval TRUE     The instance is reconfigurable according to NewConfigData.
 
536
  @retval FALSE   The instance is not reconfigurable according to NewConfigData.
 
537
 
 
538
**/
 
539
BOOLEAN
 
540
Udp6IsReconfigurable (
 
541
  IN EFI_UDP6_CONFIG_DATA  *OldConfigData,
 
542
  IN EFI_UDP6_CONFIG_DATA  *NewConfigData
 
543
  );
 
544
 
 
545
/**
 
546
  This function removes the multicast group specified by Arg from the Map.
 
547
 
 
548
  @param[in]  Map                Pointer to the NET_MAP.
 
549
  @param[in]  Item               Pointer to the NET_MAP_ITEM.
 
550
  @param[in]  Arg                Pointer to the Arg. It is the pointer to a
 
551
                                 multicast IPv6 Address. This parameter is
 
552
                                 optional and may be NULL.
 
553
 
 
554
  @retval EFI_SUCCESS            The multicast address is removed.
 
555
  @retval EFI_ABORTED            The specified multicast address is removed, and the
 
556
                                 Arg is not NULL.
 
557
 
 
558
**/
 
559
EFI_STATUS
 
560
EFIAPI
 
561
Udp6LeaveGroup (
 
562
  IN NET_MAP       *Map,
 
563
  IN NET_MAP_ITEM  *Item,
 
564
  IN VOID          *Arg OPTIONAL
 
565
  );
 
566
 
 
567
/**
 
568
  This function validates the TxToken, it returns the error code according to the spec.
 
569
 
 
570
  @param[in]  Instance           Pointer to the udp instance context data.
 
571
  @param[in]  TxToken            Pointer to the token to be checked.
 
572
 
 
573
  @retval EFI_SUCCESS            The TxToken is valid.
 
574
  @retval EFI_INVALID_PARAMETER  One or more of the following are TRUE:
 
575
                                 Token.Event is NULL.
 
576
                                 Token.Packet.TxData is NULL.
 
577
                                 Token.Packet.TxData.FragmentCount is zero.
 
578
                                 Token.Packet.TxData.DataLength is not equal to the
 
579
                                 sum of fragment lengths.
 
580
                                 One or more of the
 
581
                                 Token.Packet.TxData.FragmentTable[].FragmentLength
 
582
                                 fields is zero.
 
583
                                 One or more of the
 
584
                                 Token.Packet.TxData.FragmentTable[].FragmentBuffer
 
585
                                 fields is NULL.
 
586
                                 UdpSessionData.DestinationAddress are not valid
 
587
                                 unicast IPv6 addresses if the UdpSessionData is
 
588
                                 not NULL.
 
589
                                 UdpSessionData.DestinationPort and
 
590
                                 ConfigData.RemotePort are all zero if the
 
591
                                 UdpSessionData is not NULL.
 
592
  @retval EFI_BAD_BUFFER_SIZE    The data length is greater than the maximum UDP
 
593
                                 packet size.
 
594
 
 
595
**/
 
596
EFI_STATUS
 
597
Udp6ValidateTxToken (
 
598
  IN UDP6_INSTANCE_DATA         *Instance,
 
599
  IN EFI_UDP6_COMPLETION_TOKEN  *TxToken
 
600
  );
 
601
 
 
602
/**
 
603
  This function is a dummy ext-free function for the NET_BUF created for the output
 
604
  udp datagram.
 
605
 
 
606
  @param[in]  Context               Pointer to the context data.
 
607
 
 
608
**/
 
609
VOID
 
610
EFIAPI
 
611
Udp6NetVectorExtFree (
 
612
  IN VOID  *Context
 
613
  );
 
614
 
 
615
/**
 
616
  This function calculates the checksum for the Packet, utilizing the pre-calculated
 
617
  pseudo header to reduce overhead.
 
618
 
 
619
  @param[in]  Packet           Pointer to the NET_BUF contains the udp datagram.
 
620
  @param[in]  HeadSum          Checksum of the pseudo header execpt the length
 
621
                               field.
 
622
 
 
623
  @return The 16-bit checksum of this udp datagram.
 
624
 
 
625
**/
 
626
UINT16
 
627
Udp6Checksum (
 
628
  IN NET_BUF *Packet,
 
629
  IN UINT16  HeadSum
 
630
  );
 
631
 
 
632
/**
 
633
  This function delivers the received datagrams to the specified instance.
 
634
 
 
635
  @param[in]  Instance               Pointer to the instance context data.
 
636
 
 
637
**/
 
638
VOID
 
639
Udp6InstanceDeliverDgram (
 
640
  IN UDP6_INSTANCE_DATA  *Instance
 
641
  );
 
642
 
 
643
/**
 
644
  Cancel Udp6 tokens from the Udp6 instance.
 
645
 
 
646
  @param[in]  Instance           Pointer to the udp instance context data.
 
647
  @param[in]  Token              Pointer to the token to be canceled. If NULL, all
 
648
                                 tokens in this instance will be cancelled.
 
649
                                 This parameter is optional and may be NULL.
 
650
 
 
651
  @retval EFI_SUCCESS            The Token is cancelled.
 
652
  @retval EFI_NOT_FOUND          The Token is not found.
 
653
 
 
654
**/
 
655
EFI_STATUS
 
656
Udp6InstanceCancelToken (
 
657
  IN UDP6_INSTANCE_DATA         *Instance,
 
658
  IN EFI_UDP6_COMPLETION_TOKEN  *Token OPTIONAL
 
659
  );
 
660
 
 
661
/**
 
662
  This function removes all the Wrap datas in the RcvdDgramQue.
 
663
 
 
664
  @param[in]  Instance    Pointer to the Udp6 Instance.
 
665
 
 
666
**/
 
667
VOID
 
668
Udp6FlushRcvdDgram (
 
669
  IN UDP6_INSTANCE_DATA  *Instance
 
670
  );
 
671
 
 
672
#endif
 
673