12UINT16 mUdp6RandomPort;
119 IN VOID *Arg OPTIONAL
296 Udp6Service->Signature = UDP6_SERVICE_DATA_SIGNATURE;
297 Udp6Service->ServiceBinding = mUdp6ServiceBinding;
298 Udp6Service->ImageHandle = ImageHandle;
299 Udp6Service->ControllerHandle = ControllerHandle;
300 Udp6Service->ChildrenNumber = 0;
307 Udp6Service->IpIo =
IpIoCreate (ImageHandle, ControllerHandle, IP_VERSION_6);
308 if (Udp6Service->IpIo ==
NULL) {
309 return EFI_OUT_OF_RESOURCES;
317 &mIp6IoDefaultIpConfigData,
328 Status =
IpIoOpen (Udp6Service->IpIo, &OpenData);
329 if (EFI_ERROR (Status)) {
336 Status =
gBS->CreateEvent (
337 EVT_TIMER | EVT_NOTIFY_SIGNAL,
341 &Udp6Service->TimeoutEvent
343 if (EFI_ERROR (Status)) {
350 Status =
gBS->SetTimer (
351 Udp6Service->TimeoutEvent,
353 UDP6_TIMEOUT_INTERVAL
355 if (EFI_ERROR (Status)) {
363 if (Udp6Service->TimeoutEvent !=
NULL) {
364 gBS->CloseEvent (Udp6Service->TimeoutEvent);
368 Udp6Service->IpIo =
NULL;
387 gBS->CloseEvent (Udp6Service->TimeoutEvent);
393 Udp6Service->IpIo =
NULL;
423 NET_CHECK_SIGNATURE (Udp6Service, UDP6_SERVICE_DATA_SIGNATURE);
425 NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
430 NET_CHECK_SIGNATURE (Instance, UDP6_INSTANCE_DATA_SIGNATURE);
432 if (!Instance->Configured || (Instance->ConfigData.
ReceiveTimeout == 0)) {
439 NET_LIST_FOR_EACH_SAFE (WrapEntry, NextEntry, &Instance->RcvdDgramQue) {
445 if (Wrap->TimeoutTick < UDP6_TIMEOUT_INTERVAL / 10) {
451 Wrap->TimeoutTick -= UDP6_TIMEOUT_INTERVAL / 10;
473 Instance->Signature = UDP6_INSTANCE_DATA_SIGNATURE;
492 Instance->Udp6Service = Udp6Service;
495 Instance->Configured =
FALSE;
496 Instance->IsNoMapping =
FALSE;
497 Instance->InDestroy =
FALSE;
539 NET_LIST_FOR_EACH (Entry, InstanceList) {
544 ConfigData = &Instance->ConfigData;
595 if (ConfigData->AcceptAnyPort) {
599 StationAddress = &ConfigData->StationAddress;
601 if (ConfigData->StationPort != 0) {
602 if (!ConfigData->AllowDuplicatePort &&
609 return EFI_ACCESS_DENIED;
615 if (ConfigData->AllowDuplicatePort) {
619 ConfigData->StationPort = mUdp6RandomPort;
621 StartPort = mUdp6RandomPort;
625 if (mUdp6RandomPort == 0) {
626 mUdp6RandomPort = UDP6_PORT_KNOWN;
629 if (mUdp6RandomPort == StartPort) {
633 return EFI_OUT_OF_RESOURCES;
637 ConfigData->StationPort = mUdp6RandomPort;
641 if (mUdp6RandomPort == 0) {
642 mUdp6RandomPort = UDP6_PORT_KNOWN;
667 if ((NewConfigData->AcceptAnyPort != OldConfigData->AcceptAnyPort) ||
668 (NewConfigData->AcceptPromiscuous != OldConfigData->AcceptPromiscuous) ||
669 (NewConfigData->AllowDuplicatePort != OldConfigData->AllowDuplicatePort)
678 if ((!NewConfigData->AcceptAnyPort) &&
679 (NewConfigData->StationPort != OldConfigData->StationPort)
688 if (!EFI_IP6_EQUAL (&NewConfigData->StationAddress, &OldConfigData->StationAddress)) {
695 if (!EFI_IP6_EQUAL (&NewConfigData->RemoteAddress, &OldConfigData->RemoteAddress)) {
703 (NewConfigData->RemotePort != OldConfigData->RemotePort)
733 &mIp6IoDefaultIpConfigData,
736 Ip6ConfigData->DefaultProtocol = EFI_IP_PROTO_UDP;
737 Ip6ConfigData->AcceptPromiscuous = Udp6ConfigData->AcceptPromiscuous;
738 IP6_COPY_ADDRESS (&Ip6ConfigData->StationAddress, &Udp6ConfigData->StationAddress);
739 IP6_COPY_ADDRESS (&Ip6ConfigData->DestinationAddress, &Udp6ConfigData->RemoteAddress);
743 Ip6ConfigData->ReceiveTimeout = (UINT32)(-1);
787 if (TxToken->Event ==
NULL) {
788 return EFI_INVALID_PARAMETER;
791 TxData = TxToken->Packet.TxData;
794 return EFI_INVALID_PARAMETER;
806 return EFI_INVALID_PARAMETER;
817 return EFI_INVALID_PARAMETER;
820 ConfigData = &Instance->ConfigData;
823 if (UdpSessionData !=
NULL) {
828 return EFI_INVALID_PARAMETER;
838 return EFI_INVALID_PARAMETER;
849 return EFI_INVALID_PARAMETER;
856 return EFI_INVALID_PARAMETER;
859 if (TxData->
DataLength > UDP6_MAX_DATA_SIZE) {
860 return EFI_BAD_BUFFER_SIZE;
893 if ((Token == TokenInItem) || (Token->
Event == TokenInItem->
Event)) {
898 return EFI_ACCESS_DENIED;
926 Checksum =
NetAddChecksum (Checksum, HTONS ((UINT16)Packet->TotalSize));
927 Checksum = (UINT16)(~Checksum);
963 return EFI_NOT_FOUND;
992 ASSERT (Context !=
NULL && NotifyData !=
NULL);
1033 ASSERT (NetSession !=
NULL && Packet !=
NULL && Context !=
NULL);
1034 NET_CHECK_SIGNATURE (Packet, NET_BUF_SIGNATURE);
1077 IN VOID *Arg OPTIONAL
1084 if ((McastIp !=
NULL) &&
1102 if (McastIp !=
NULL) {
1133 IN VOID *Arg OPTIONAL
1140 if ((Arg !=
NULL) && (Item->Key != Arg)) {
1144 if (Item->Value !=
NULL) {
1151 Packet = (
NET_BUF *)(Item->Value);
1152 IpIo = (
IP_IO *)(*((
UINTN *)&Packet->ProtoData[0]));
1162 TokenToCancel->
Status = EFI_ABORTED;
1163 gBS->SignalEvent (TokenToCancel->
Event);
1224 if ((Token !=
NULL) && (Status == EFI_ABORTED)) {
1243 return EFI_NOT_FOUND;
1275 ConfigData = &Instance->ConfigData;
1295 !EFI_IP6_EQUAL (&ConfigData->
RemoteAddress, &Udp6Session->SourceAddress)
1305 EFI_IP6_EQUAL (&Udp6Session->DestinationAddress, &ConfigData->
StationAddress)
1315 IP6_COPY_ADDRESS (&Destination, &Udp6Session->DestinationAddress);
1317 if (IP6_IS_MULTICAST (&Destination) &&
1406 Status =
gBS->CreateEvent (
1413 if (EFI_ERROR (Status)) {
1418 Wrap->Packet = Packet;
1419 Wrap->TimeoutTick = Instance->ConfigData.ReceiveTimeout;
1450 NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
1456 if (!Instance->Configured) {
1469 NET_GET_REF (Packet);
1503 if (NET_BUF_SHARED (Wrap->Packet)) {
1524 RxData = &Wrap->RxData;
1534 Token->Packet.
RxData = &Wrap->RxData;
1536 OldTpl =
gBS->RaiseTPL (TPL_NOTIFY);
1538 gBS->RestoreTPL (OldTpl);
1558 NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
1564 if (!Instance->Configured) {
1598 if (Packet->TotalSize < UDP6_HEADER_SIZE) {
1607 ASSERT (Udp6Header !=
NULL);
1608 if (Udp6Header ==
NULL) {
1613 if (Udp6Header->Checksum != 0) {
1618 &NetSession->Source.v6,
1619 &NetSession->Dest.v6,
1634 Udp6Session->
SourcePort = NTOHS (Udp6Header->SrcPort);
1637 IP6_COPY_ADDRESS (&Udp6Session->
SourceAddress, &NetSession->Source);
1645 RxData.
DataLength = (UINT32)Packet->TotalSize;
1652 if (Enqueued == 0) {
1705 if (NetSession->IpVersion == IP_VERSION_6) {
1707 IP6_IS_MULTICAST (&NetSession->Dest.v6)
1714 IpSender =
IpIoFindSender (&IpIo, NetSession->IpVersion, &NetSession->Dest);
1720 ASSERT (Ip6ModeData !=
NULL);
1721 if (Ip6ModeData ==
NULL) {
1729 if (IpSender ==
NULL) {
1730 Ip6Protocol = IpIo->Ip.Ip6;
1732 Ip6Protocol = IpSender->Ip.Ip6;
1735 Status = Ip6Protocol->GetModeData (
1742 if (EFI_ERROR (Status)) {
1749 Len = NetSession->IpHdrLen +
1764 if (Packet ==
NULL) {
1772 ASSERT (IcmpErrHdr !=
NULL);
1773 if (IcmpErrHdr ==
NULL) {
1781 IcmpErrHdr->Head.Code = ICMP_V6_PORT_UNREACHABLE;
1782 IcmpErrHdr->Head.Checksum = 0;
1783 IcmpErrHdr->Fourth = 0;
1791 Ptr = (VOID *)&IcmpErrHdr->Head;
1793 CopyMem (Ptr, NetSession->IpHdr.Ip6Hdr, NetSession->IpHdrLen);
1795 Ptr + NetSession->IpHdrLen,
1803 IcmpErrHdr->Head.Checksum = 0;
1809 Override.Ip6OverrideData.
HopLimit = 255;
1810 Override.Ip6OverrideData.
Protocol = IP6_ICMP;
1815 IpIoSend (IpIo, Packet, IpSender,
NULL,
NULL, &NetSession->Source, &Override);
1820 if (Ip6ModeData !=
NULL) {
1849 if (Packet->TotalSize < UDP6_HEADER_SIZE) {
1855 ASSERT (Udp6Header !=
NULL);
1856 if (Udp6Header ==
NULL) {
1861 IP6_COPY_ADDRESS (&Udp6Session.
SourceAddress, &NetSession->Source);
1864 Udp6Session.
SourcePort = NTOHS (Udp6Header->DstPort);
1867 NET_LIST_FOR_EACH (Entry, &Udp6Service->ChildrenList) {
1873 if (!Instance->Configured) {
1883 if (IcmpError > ICMP_ERR_UNREACH_PORT) {
1884 Instance->IcmpError = EFI_ICMP_ERROR;
1919 if (EFI_ERROR (Instance->IcmpError)) {
1925 if (Token !=
NULL) {
1929 Token->
Status = Instance->IcmpError;
1974 ASSERT (Map !=
NULL);
1975 NET_LIST_FOR_EACH (Entry, &Map->Used) {
1976 Item = NET_LIST_USER_STRUCT (Entry,
NET_MAP_ITEM, Link);
1978 if (EFI_IP6_EQUAL (Addr, Key)) {
BOOLEAN EFIAPI IsListEmpty(IN CONST LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI RemoveEntryList(IN CONST LIST_ENTRY *Entry)
LIST_ENTRY *EFIAPI InitializeListHead(IN OUT LIST_ENTRY *ListHead)
LIST_ENTRY *EFIAPI InsertTailList(IN OUT LIST_ENTRY *ListHead, IN OUT LIST_ENTRY *Entry)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EFI_STATUS EFIAPI DispatchDpc(VOID)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define ICMP_V6_DEST_UNREACHABLE
EFI_STATUS EFIAPI IpIoDestroy(IN OUT IP_IO *IpIo)
IP_IO *EFIAPI IpIoCreate(IN EFI_HANDLE Image, IN EFI_HANDLE Controller, IN UINT8 IpVersion)
EFI_STATUS EFIAPI IpIoOpen(IN OUT IP_IO *IpIo, IN IP_IO_OPEN_DATA *OpenData)
EFI_STATUS EFIAPI IpIoSend(IN OUT IP_IO *IpIo, IN OUT NET_BUF *Pkt, IN IP_IO_IP_INFO *Sender OPTIONAL, IN VOID *Context OPTIONAL, IN VOID *NotifyData OPTIONAL, IN EFI_IP_ADDRESS *Dest OPTIONAL, IN IP_IO_OVERRIDE *OverrideData OPTIONAL)
VOID EFIAPI IpIoCancelTxToken(IN IP_IO *IpIo, IN VOID *Packet)
IP_IO_IP_INFO *EFIAPI IpIoFindSender(IN OUT IP_IO **IpIo, IN UINT8 IpVersion, IN EFI_IP_ADDRESS *Src)
EFI_STATUS EFIAPI IpIoGetIcmpErrStatus(IN UINT8 IcmpError, IN UINT8 IpVersion, OUT BOOLEAN *IsHard OPTIONAL, OUT BOOLEAN *Notify OPTIONAL)
VOID EFIAPI NetbufFree(IN NET_BUF *Nbuf)
LIST_ENTRY *EFIAPI NetListRemoveHead(IN OUT LIST_ENTRY *Head)
UINT16 EFIAPI NetIp6PseudoHeadChecksum(IN EFI_IPv6_ADDRESS *Src, IN EFI_IPv6_ADDRESS *Dst, IN UINT8 NextHeader, IN UINT32 Len)
UINT32 EFIAPI NetbufTrim(IN OUT NET_BUF *Nbuf, IN UINT32 Len, IN BOOLEAN FromHead)
UINT16 EFIAPI NetbufChecksum(IN NET_BUF *Nbuf)
EFI_STATUS EFIAPI NetbufBuildExt(IN NET_BUF *Nbuf, IN OUT NET_FRAGMENT *ExtFragment, IN OUT UINT32 *ExtNum)
VOID EFIAPI NetMapClean(IN OUT NET_MAP *Map)
NET_MAP_ITEM *EFIAPI NetMapFindKey(IN NET_MAP *Map, IN VOID *Key)
UINT16 EFIAPI NetAddChecksum(IN UINT16 Checksum1, IN UINT16 Checksum2)
NET_BUF *EFIAPI NetbufAlloc(IN UINT32 Len)
VOID EFIAPI NetMapInit(IN OUT NET_MAP *Map)
BOOLEAN EFIAPI NetIp6IsUnspecifiedAddr(IN EFI_IPv6_ADDRESS *Ip6)
UINT8 *EFIAPI NetbufAllocSpace(IN OUT NET_BUF *Nbuf, IN UINT32 Len, IN BOOLEAN FromHead)
NET_BUF *EFIAPI NetbufDuplicate(IN NET_BUF *Nbuf, IN OUT NET_BUF *Duplicate OPTIONAL, IN UINT32 HeadSpace)
BOOLEAN EFIAPI NetMapIsEmpty(IN NET_MAP *Map)
UINT8 *EFIAPI NetbufGetByte(IN NET_BUF *Nbuf, IN UINT32 Offset, OUT UINT32 *Index OPTIONAL)
VOID *EFIAPI NetMapRemoveItem(IN OUT NET_MAP *Map, IN OUT NET_MAP_ITEM *Item, OUT VOID **Value OPTIONAL)
VOID *EFIAPI NetMapRemoveHead(IN OUT NET_MAP *Map, OUT VOID **Value OPTIONAL)
EFI_STATUS EFIAPI NetMapIterate(IN NET_MAP *Map, IN NET_MAP_CALLBACK CallBack, IN VOID *Arg OPTIONAL)
UINTN EFIAPI NetMapGetCount(IN NET_MAP *Map)
EFI_STATUS EFIAPI Udp6LeaveGroup(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
EFI_STATUS Udp6CreateService(IN UDP6_SERVICE_DATA *Udp6Service, IN EFI_HANDLE ImageHandle, IN EFI_HANDLE ControllerHandle)
EFI_STATUS Udp6RemoveToken(IN NET_MAP *TokenMap, IN EFI_UDP6_COMPLETION_TOKEN *Token)
UINTN Udp6EnqueueDgram(IN UDP6_SERVICE_DATA *Udp6Service, IN NET_BUF *Packet, IN EFI_UDP6_RECEIVE_DATA *RxData)
VOID Udp6CleanInstance(IN OUT UDP6_INSTANCE_DATA *Instance)
VOID Udp6InstanceDeliverDgram(IN UDP6_INSTANCE_DATA *Instance)
VOID Udp6InitInstance(IN UDP6_SERVICE_DATA *Udp6Service, IN OUT UDP6_INSTANCE_DATA *Instance)
UINT16 Udp6Checksum(IN NET_BUF *Packet, IN UINT16 HeadSum)
EFI_STATUS EFIAPI Udp6CancelTokens(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Arg OPTIONAL)
VOID Udp6FlushRcvdDgram(IN UDP6_INSTANCE_DATA *Instance)
EFI_STATUS Udp6InstanceCancelToken(IN UDP6_INSTANCE_DATA *Instance, IN EFI_UDP6_COMPLETION_TOKEN *Token OPTIONAL)
EFI_STATUS Udp6ValidateTxToken(IN UDP6_INSTANCE_DATA *Instance, IN EFI_UDP6_COMPLETION_TOKEN *TxToken)
EFI_STATUS Udp6Bind(IN LIST_ENTRY *InstanceList, IN EFI_UDP6_CONFIG_DATA *ConfigData)
NET_MAP_ITEM * Udp6MapMultiCastAddr(IN NET_MAP *Map, IN VOID *Key)
VOID Udp6CleanService(IN OUT UDP6_SERVICE_DATA *Udp6Service)
VOID Udp6SendPortUnreach(IN IP_IO *IpIo, IN EFI_NET_SESSION_DATA *NetSession, IN VOID *Udp6Header)
VOID EFIAPI Udp6RecycleRxDataWrap(IN EFI_EVENT Event, IN VOID *Context)
VOID EFIAPI Udp6NetVectorExtFree(IN VOID *Context)
VOID Udp6ReportIcmpError(IN UDP6_INSTANCE_DATA *Instance)
VOID EFIAPI Udp6DgramRcvd(IN EFI_STATUS Status, IN UINT8 IcmpError, IN EFI_NET_SESSION_DATA *NetSession, IN NET_BUF *Packet, IN VOID *Context)
VOID Udp6DeliverDgram(IN UDP6_SERVICE_DATA *Udp6Service)
VOID EFIAPI Udp6CheckTimeout(IN EFI_EVENT Event, IN VOID *Context)
BOOLEAN Udp6MatchDgram(IN UDP6_INSTANCE_DATA *Instance, IN EFI_UDP6_SESSION_DATA *Udp6Session)
VOID EFIAPI Udp6DgramSent(IN EFI_STATUS Status, IN VOID *Context, IN IP_IO_IP_PROTOCOL Sender, IN VOID *NotifyData)
BOOLEAN Udp6IsReconfigurable(IN EFI_UDP6_CONFIG_DATA *OldConfigData, IN EFI_UDP6_CONFIG_DATA *NewConfigData)
VOID Udp6IcmpHandler(IN UDP6_SERVICE_DATA *Udp6Service, IN UINT8 IcmpError, IN EFI_NET_SESSION_DATA *NetSession, IN OUT NET_BUF *Packet)
UDP6_RXDATA_WRAP * Udp6WrapRxData(IN UDP6_INSTANCE_DATA *Instance, IN NET_BUF *Packet, IN EFI_UDP6_RECEIVE_DATA *RxData)
VOID Udp6BuildIp6ConfigData(IN EFI_UDP6_CONFIG_DATA *Udp6ConfigData, IN OUT EFI_IP6_CONFIG_DATA *Ip6ConfigData)
BOOLEAN Udp6FindInstanceByPort(IN LIST_ENTRY *InstanceList, IN EFI_IPv6_ADDRESS *Address, IN UINT16 Port)
EFI_STATUS EFIAPI Udp6TokenExist(IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
VOID Udp6Demultiplex(IN UDP6_SERVICE_DATA *Udp6Service, IN EFI_NET_SESSION_DATA *NetSession, IN NET_BUF *Packet)
UINT8 HopLimit
Hop-Limit override.
UINT32 FlowLabel
Flow-Label override.
UINT8 Protocol
Protocol type override.
PKT_RCVD_NOTIFY PktRcvdNotify
Receive callback.
VOID * SndContext
Context data used by send callback.
IP_IO_IP_CONFIG_DATA IpConfigData
Configuration of the IP instance.
VOID * RcvdContext
Context data used by receive callback.
PKT_SENT_NOTIFY PktSentNotify
Send callback.
EFI_UDP6_RECEIVE_DATA * RxData
BOOLEAN AcceptPromiscuous
EFI_IPv6_ADDRESS RemoteAddress
EFI_IPv6_ADDRESS StationAddress
UINT32 FragmentLength
Length of the fragment data buffer.
VOID * FragmentBuffer
Pointer to the fragment data buffer.
EFI_UDP6_FRAGMENT_DATA FragmentTable[1]
EFI_UDP6_SESSION_DATA UdpSession
EFI_IPv6_ADDRESS DestinationAddress
EFI_IPv6_ADDRESS SourceAddress
EFI_UDP6_FRAGMENT_DATA FragmentTable[1]
EFI_UDP6_SESSION_DATA * UdpSessionData