- @return None\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-UdpIoOnDgramRcvdDpc (\r
- IN VOID *Context\r
- )\r
-{\r
- EFI_UDP4_COMPLETION_TOKEN *UdpToken;\r
- EFI_UDP4_RECEIVE_DATA *UdpRxData;\r
- EFI_UDP4_SESSION_DATA *UdpSession;\r
- UDP_RX_TOKEN *Token;\r
- UDP_POINTS Points;\r
- NET_BUF *Netbuf;\r
-\r
- Token = (UDP_RX_TOKEN *) Context;\r
-\r
- ASSERT ((Token->Signature == UDP_IO_RX_SIGNATURE) &&\r
- (Token == Token->UdpIo->RecvRequest));\r
-\r
- //\r
- // Clear the receive request first in case that the caller\r
- // wants to restart the receive in the callback.\r
- //\r
- Token->UdpIo->RecvRequest = NULL;\r
-\r
- UdpToken = &Token->UdpToken;\r
- UdpRxData = UdpToken->Packet.RxData;\r
-\r
- if (EFI_ERROR (UdpToken->Status) || (UdpRxData == NULL)) {\r
- if (UdpToken->Status != EFI_ABORTED) {\r
- //\r
- // Invoke the CallBack only if the reception is not actively aborted.\r
- //\r
- Token->CallBack (NULL, NULL, UdpToken->Status, Token->Context);\r
- }\r
-\r
- UdpIoFreeRxToken (Token);\r
- return;\r
- }\r
-\r
- //\r
- // Build a NET_BUF from the UDP receive data, then deliver it up.\r
- //\r
- Netbuf = NetbufFromExt (\r
- (NET_FRAGMENT *) UdpRxData->FragmentTable,\r
- UdpRxData->FragmentCount,\r
- 0,\r
- (UINT32) Token->HeadLen,\r
- UdpIoRecycleDgram,\r
- Token\r
- );\r
-\r
- if (Netbuf == NULL) {\r
- gBS->SignalEvent (UdpRxData->RecycleSignal);\r
- Token->CallBack (NULL, NULL, EFI_OUT_OF_RESOURCES, Token->Context);\r
-\r
- UdpIoFreeRxToken (Token);\r
- return;\r
- }\r
-\r
- UdpSession = &UdpRxData->UdpSession;\r
- Points.LocalPort = UdpSession->DestinationPort;\r
- Points.RemotePort = UdpSession->SourcePort;\r
-\r
- CopyMem (&Points.LocalAddr, &UdpSession->DestinationAddress, sizeof (IP4_ADDR));\r
- CopyMem (&Points.RemoteAddr, &UdpSession->SourceAddress, sizeof (IP4_ADDR));\r
- Points.LocalAddr = NTOHL (Points.LocalAddr);\r
- Points.RemoteAddr = NTOHL (Points.RemoteAddr);\r
-\r
- Token->CallBack (Netbuf, &Points, EFI_SUCCESS, Token->Context);\r
-}\r
-\r
-/**\r
- Request UdpIoOnDgramRcvdDpc as a DPC at TPL_CALLBACK.\r
-\r
- @param Event The UDP receive request event.\r
- @param Context The UDP RX token.\r
-\r
- @return None\r
-\r
-**/\r
-VOID\r
-EFIAPI\r
-UdpIoOnDgramRcvd (\r
- IN EFI_EVENT Event,\r
- IN VOID *Context\r
- )\r
-/*++\r
-\r
-Routine Description:\r
-\r
- Request UdpIoOnDgramRcvdDpc as a DPC at TPL_CALLBACK\r
-\r
-Arguments:\r
-\r
- Event - The UDP receive request event\r
- Context - The UDP RX token.\r
-\r
-Returns:\r
-\r
- None\r
-\r
---*/\r
-{\r
- //\r
- // Request UdpIoOnDgramRcvdDpc as a DPC at TPL_CALLBACK\r
- //\r
- NetLibQueueDpc (TPL_CALLBACK, UdpIoOnDgramRcvdDpc, Context);\r
-}\r
-\r
-\r
-/**\r
- Issue a receive request to the UDP IO port.\r
-\r
- @param UdpIo The UDP IO port to recieve the packet from.\r
- @param CallBack The call back function to execute when receive\r
- finished.\r
- @param Context The opque context to the call back\r
- @param HeadLen The lenght of the application's header\r