Udp6Impl.h 25 KB

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