48 Udp6 = UdpIo->Protocol.Udp6;
49 Config = &(UdpIo->Config.Udp6);
72 return Udp6->Configure (Udp6, Config);
91 ASSERT (Service->NumOfChild == 0);
93 if (Service->ClientId !=
NULL) {
97 if (Service->UdpIo !=
NULL) {
129 if (EFI_ERROR (Status)) {
130 DEBUG ((DEBUG_ERROR,
"%a failed to generate random number: %r\n", __func__, Status));
137 if (Dhcp6Srv ==
NULL) {
138 return EFI_OUT_OF_RESOURCES;
144 Dhcp6Srv->Snp =
NULL;
146 if (Dhcp6Srv->Snp ==
NULL) {
148 return EFI_DEVICE_ERROR;
154 Dhcp6Srv->Signature = DHCP6_SERVICE_SIGNATURE;
155 Dhcp6Srv->Controller = Controller;
156 Dhcp6Srv->Image = ImageHandle;
157 Dhcp6Srv->Xid = (0xffffff & Random);
160 &Dhcp6Srv->ServiceBinding,
161 &gDhcp6ServiceBindingTemplate,
168 Status =
gBS->HandleProtocol (
170 &gEfiIp6ConfigProtocolGuid,
171 (VOID **)&Dhcp6Srv->Ip6Cfg
173 if (EFI_ERROR (Status)) {
184 if (Dhcp6Srv->ClientId ==
NULL) {
186 return EFI_DEVICE_ERROR;
200 if (Dhcp6Srv->UdpIo ==
NULL) {
203 return EFI_DEVICE_ERROR;
228 gBS->CloseEvent (Instance->Timer);
233 if (Instance->Config !=
NULL) {
241 if (Instance->IaCb.Ia !=
NULL) {
242 if (Instance->IaCb.Ia->ReplyPacket !=
NULL) {
243 FreePool (Instance->IaCb.Ia->ReplyPacket);
249 if (Instance->Unicast !=
NULL) {
253 if (Instance->AdSelect !=
NULL) {
282 if (Dhcp6Ins ==
NULL) {
283 return EFI_OUT_OF_RESOURCES;
289 Dhcp6Ins->Signature = DHCP6_INSTANCE_SIGNATURE;
290 Dhcp6Ins->UdpSts = EFI_ALREADY_STARTED;
291 Dhcp6Ins->Service = Service;
292 Dhcp6Ins->InDestroy =
FALSE;
293 Dhcp6Ins->MediaPresent =
TRUE;
297 &gDhcp6ProtocolTemplate,
308 Status =
gBS->CreateEvent (
309 EVT_NOTIFY_SIGNAL | EVT_TIMER,
316 if (EFI_ERROR (Status)) {
321 *Instance = Dhcp6Ins;
346 if ((Entry ==
NULL) || (Context ==
NULL)) {
347 return EFI_INVALID_PARAMETER;
350 Instance = NET_LIST_USER_STRUCT_S (Entry,
DHCP6_INSTANCE, Link, DHCP6_INSTANCE_SIGNATURE);
353 return ServiceBinding->DestroyChild (ServiceBinding, Instance->Handle);
376 &gDhcp6DriverBinding,
378 &gDhcp6ComponentName,
379 &gDhcp6ComponentName2
408 return gBS->OpenProtocol (
410 &gEfiUdp6ServiceBindingProtocolGuid,
412 This->DriverBindingHandle,
414 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
450 Status =
gBS->OpenProtocol (
452 &gEfiDhcp6ServiceBindingProtocolGuid,
454 This->DriverBindingHandle,
456 EFI_OPEN_PROTOCOL_TEST_PROTOCOL
459 if (!EFI_ERROR (Status)) {
460 return EFI_ALREADY_STARTED;
468 This->DriverBindingHandle,
472 if (EFI_ERROR (Status)) {
476 ASSERT (Service !=
NULL);
478 Status =
gBS->InstallMultipleProtocolInterfaces (
480 &gEfiDhcp6ServiceBindingProtocolGuid,
481 &Service->ServiceBinding,
485 if (EFI_ERROR (Status)) {
533 if (NicHandle ==
NULL) {
537 Status =
gBS->OpenProtocol (
539 &gEfiDhcp6ServiceBindingProtocolGuid,
540 (VOID **)&ServiceBinding,
541 This->DriverBindingHandle,
543 EFI_OPEN_PROTOCOL_GET_PROTOCOL
546 if (EFI_ERROR (Status)) {
550 Service = DHCP6_SERVICE_FROM_THIS (ServiceBinding);
555 List = &Service->Child;
562 if (EFI_ERROR (Status) || (ListLength != 0)) {
563 Status = EFI_DEVICE_ERROR;
567 if ((NumberOfChildren == 0) && !
IsListEmpty (&Service->Child)) {
568 Status = EFI_DEVICE_ERROR;
571 if ((NumberOfChildren == 0) &&
IsListEmpty (&Service->Child)) {
575 Status =
gBS->UninstallProtocolInterface (
577 &gEfiDhcp6ServiceBindingProtocolGuid,
580 if (EFI_ERROR (Status)) {
622 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
623 return EFI_INVALID_PARAMETER;
626 Service = DHCP6_SERVICE_FROM_THIS (This);
630 if (EFI_ERROR (Status)) {
634 ASSERT (Instance !=
NULL);
639 Status =
gBS->SetTimer (
645 if (EFI_ERROR (Status)) {
652 Status =
gBS->InstallMultipleProtocolInterfaces (
654 &gEfiDhcp6ProtocolGuid,
659 if (EFI_ERROR (Status)) {
663 Instance->Handle = *ChildHandle;
668 Status =
gBS->OpenProtocol (
669 Service->UdpIo->UdpHandle,
670 &gEfiUdp6ProtocolGuid,
674 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
677 if (EFI_ERROR (Status)) {
678 gBS->UninstallMultipleProtocolInterfaces (
680 &gEfiDhcp6ProtocolGuid,
690 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
693 Service->NumOfChild++;
695 gBS->RestoreTPL (OldTpl);
735 if ((This ==
NULL) || (ChildHandle ==
NULL)) {
736 return EFI_INVALID_PARAMETER;
742 Status =
gBS->OpenProtocol (
744 &gEfiDhcp6ProtocolGuid,
748 EFI_OPEN_PROTOCOL_GET_PROTOCOL
751 if (EFI_ERROR (Status)) {
752 return EFI_UNSUPPORTED;
755 Instance = DHCP6_INSTANCE_FROM_THIS (Dhcp6);
756 Service = DHCP6_SERVICE_FROM_THIS (This);
758 if (Instance->Service != Service) {
759 return EFI_INVALID_PARAMETER;
762 if (Instance->InDestroy) {
766 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
768 Instance->InDestroy =
TRUE;
770 Status =
gBS->CloseProtocol (
771 Service->UdpIo->UdpHandle,
772 &gEfiUdp6ProtocolGuid,
777 if (EFI_ERROR (Status)) {
778 Instance->InDestroy =
FALSE;
779 gBS->RestoreTPL (OldTpl);
786 gBS->RestoreTPL (OldTpl);
787 Status =
gBS->UninstallProtocolInterface (
789 &gEfiDhcp6ProtocolGuid,
792 OldTpl =
gBS->RaiseTPL (TPL_CALLBACK);
793 if (EFI_ERROR (Status)) {
794 Instance->InDestroy =
FALSE;
795 gBS->RestoreTPL (OldTpl);
803 Service->NumOfChild--;
805 gBS->RestoreTPL (OldTpl);
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)
VOID Dhcp6DestroyService(IN OUT DHCP6_SERVICE *Service)
EFI_STATUS EFIAPI Dhcp6ServiceBindingCreateChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN OUT EFI_HANDLE *ChildHandle)
EFI_STATUS EFIAPI Dhcp6DestroyChildEntry(IN LIST_ENTRY *Entry, IN VOID *Context)
EFI_STATUS Dhcp6CreateService(IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle, OUT DHCP6_SERVICE **Service)
EFI_STATUS EFIAPI Dhcp6DriverBindingStop(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN UINTN NumberOfChildren, IN EFI_HANDLE *ChildHandleBuffer OPTIONAL)
EFI_STATUS EFIAPI Dhcp6DriverEntryPoint(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
VOID Dhcp6DestroyInstance(IN OUT DHCP6_INSTANCE *Instance)
EFI_STATUS EFIAPI Dhcp6ServiceBindingDestroyChild(IN EFI_SERVICE_BINDING_PROTOCOL *This, IN EFI_HANDLE ChildHandle)
EFI_STATUS EFIAPI Dhcp6DriverBindingSupported(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI Dhcp6DriverBindingStart(IN EFI_DRIVER_BINDING_PROTOCOL *This, IN EFI_HANDLE ControllerHandle, IN EFI_DEVICE_PATH_PROTOCOL *RemainingDevicePath OPTIONAL)
EFI_STATUS EFIAPI Dhcp6ConfigureUdpIo(IN UDP_IO *UdpIo, IN VOID *Context)
EFI_STATUS Dhcp6CreateInstance(IN DHCP6_SERVICE *Service, OUT DHCP6_INSTANCE **Instance)
VOID Dhcp6CleanupRetry(IN DHCP6_INSTANCE *Instance, IN UINT32 Scope)
VOID EFIAPI Dhcp6OnTimerTick(IN EFI_EVENT Event, IN VOID *Context)
EFI_DHCP6_DUID * Dhcp6GenerateClientId(IN EFI_SIMPLE_NETWORK_MODE *Mode)
VOID Dhcp6CleanupConfigData(IN OUT EFI_DHCP6_CONFIG_DATA *CfgData)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
#define DEBUG(Expression)
EFI_HANDLE EFIAPI NetLibGetSnpHandle(IN EFI_HANDLE ServiceHandle, OUT EFI_SIMPLE_NETWORK_PROTOCOL **Snp OPTIONAL)
EFI_STATUS EFIAPI PseudoRandomU32(OUT UINT32 *Output)
EFI_HANDLE EFIAPI NetLibGetNicHandle(IN EFI_HANDLE Controller, IN EFI_GUID *ProtocolGuid)
EFI_STATUS EFIAPI NetDestroyLinkList(IN LIST_ENTRY *List, IN NET_DESTROY_LINK_LIST_CALLBACK CallBack, IN VOID *Context OPTIONAL, OUT UINTN *ListLength OPTIONAL)
EFI_STATUS EFIAPI UdpIoFreeIo(IN UDP_IO *UdpIo)
UDP_IO *EFIAPI UdpIoCreateIo(IN EFI_HANDLE Controller, IN EFI_HANDLE ImageHandle, IN UDP_IO_CONFIG Configure, IN UINT8 UdpVersion, IN VOID *Context)
EFI_STATUS EFIAPI EfiLibInstallDriverBindingComponentName2(IN CONST EFI_HANDLE ImageHandle, IN CONST EFI_SYSTEM_TABLE *SystemTable, IN EFI_DRIVER_BINDING_PROTOCOL *DriverBinding, IN EFI_HANDLE DriverBindingHandle, IN CONST EFI_COMPONENT_NAME_PROTOCOL *ComponentName OPTIONAL, IN CONST EFI_COMPONENT_NAME2_PROTOCOL *ComponentName2 OPTIONAL)
EFI_HANDLE DriverBindingHandle
EFI_SIMPLE_NETWORK_MODE * Mode
BOOLEAN AcceptPromiscuous
BOOLEAN AllowDuplicatePort