TianoCore EDK2 master
Loading...
Searching...
No Matches
Ip4Config2Nv.c
Go to the documentation of this file.
1
9#include "Ip4Impl.h"
10
11CHAR16 mIp4Config2StorageName[] = L"IP4_CONFIG2_IFR_NVDATA";
12
22UINT8
24 IN EFI_IPv4_ADDRESS *SubnetMask
25 )
26{
27 UINT8 Len;
28 UINT32 ReverseMask;
29
30 //
31 // The SubnetMask is in network byte order.
32 //
33 ReverseMask = SwapBytes32 (*(UINT32 *)&SubnetMask[0]);
34
35 //
36 // Reverse it.
37 //
38 ReverseMask = ~ReverseMask;
39
40 if ((ReverseMask & (ReverseMask + 1)) != 0) {
41 return 0;
42 }
43
44 Len = 0;
45
46 while (ReverseMask != 0) {
47 ReverseMask = ReverseMask >> 1;
48 Len++;
49 }
50
51 return (UINT8)(32 - Len);
52}
53
66 IN CHAR16 *Str,
68 )
69{
70 UINTN Index;
71 UINTN Number;
72
73 Index = 0;
74
75 while (*Str != L'\0') {
76 if (Index > 3) {
77 return EFI_INVALID_PARAMETER;
78 }
79
80 Number = 0;
81 while ((*Str >= L'0') && (*Str <= L'9')) {
82 Number = Number * 10 + (*Str - L'0');
83 Str++;
84 }
85
86 if (Number > 0xFF) {
87 return EFI_INVALID_PARAMETER;
88 }
89
90 Ip->Addr[Index] = (UINT8)Number;
91
92 if ((*Str != L'\0') && (*Str != L'.')) {
93 //
94 // The current character should be either the NULL terminator or
95 // the dot delimiter.
96 //
97 return EFI_INVALID_PARAMETER;
98 }
99
100 if (*Str == L'.') {
101 //
102 // Skip the delimiter.
103 //
104 Str++;
105 }
106
107 Index++;
108 }
109
110 if (Index != 4) {
111 return EFI_INVALID_PARAMETER;
112 }
113
114 return EFI_SUCCESS;
115}
116
131 IN CHAR16 *Str,
132 OUT EFI_IPv4_ADDRESS **PtrIpList,
133 OUT UINTN *IpCount
134 )
135{
136 UINTN BeginIndex;
137 UINTN EndIndex;
138 UINTN Index;
139 UINTN IpIndex;
140 CHAR16 *StrTemp;
141 BOOLEAN SpaceTag;
142
143 BeginIndex = 0;
144 EndIndex = BeginIndex;
145 Index = 0;
146 IpIndex = 0;
147 StrTemp = NULL;
148 SpaceTag = TRUE;
149
150 *PtrIpList = NULL;
151 *IpCount = 0;
152
153 if (Str == NULL) {
154 return EFI_SUCCESS;
155 }
156
157 //
158 // Get the number of Ip.
159 //
160 while (*(Str + Index) != L'\0') {
161 if (*(Str + Index) == L' ') {
162 SpaceTag = TRUE;
163 } else {
164 if (SpaceTag) {
165 (*IpCount)++;
166 SpaceTag = FALSE;
167 }
168 }
169
170 Index++;
171 }
172
173 if (*IpCount == 0) {
174 return EFI_SUCCESS;
175 }
176
177 //
178 // Allocate buffer for IpList.
179 //
180 *PtrIpList = AllocateZeroPool (*IpCount * sizeof (EFI_IPv4_ADDRESS));
181 if (*PtrIpList == NULL) {
182 return EFI_OUT_OF_RESOURCES;
183 }
184
185 //
186 // Get IpList from Str.
187 //
188 Index = 0;
189 while (*(Str + Index) != L'\0') {
190 if (*(Str + Index) == L' ') {
191 if (!SpaceTag) {
192 StrTemp = AllocateZeroPool ((EndIndex - BeginIndex + 1) * sizeof (CHAR16));
193 if (StrTemp == NULL) {
194 FreePool (*PtrIpList);
195 *PtrIpList = NULL;
196 *IpCount = 0;
197 return EFI_OUT_OF_RESOURCES;
198 }
199
200 CopyMem (StrTemp, Str + BeginIndex, (EndIndex - BeginIndex) * sizeof (CHAR16));
201 *(StrTemp + (EndIndex - BeginIndex)) = L'\0';
202
203 if (Ip4Config2StrToIp (StrTemp, &((*PtrIpList)[IpIndex])) != EFI_SUCCESS) {
204 FreePool (StrTemp);
205 FreePool (*PtrIpList);
206 *PtrIpList = NULL;
207 *IpCount = 0;
208 return EFI_INVALID_PARAMETER;
209 }
210
211 BeginIndex = EndIndex;
212 IpIndex++;
213
214 FreePool (StrTemp);
215 }
216
217 BeginIndex++;
218 EndIndex++;
219 SpaceTag = TRUE;
220 } else {
221 EndIndex++;
222 SpaceTag = FALSE;
223 }
224
225 Index++;
226
227 if (*(Str + Index) == L'\0') {
228 if (!SpaceTag) {
229 StrTemp = AllocateZeroPool ((EndIndex - BeginIndex + 1) * sizeof (CHAR16));
230 if (StrTemp == NULL) {
231 FreePool (*PtrIpList);
232 *PtrIpList = NULL;
233 *IpCount = 0;
234 return EFI_OUT_OF_RESOURCES;
235 }
236
237 CopyMem (StrTemp, Str + BeginIndex, (EndIndex - BeginIndex) * sizeof (CHAR16));
238 *(StrTemp + (EndIndex - BeginIndex)) = L'\0';
239
240 if (Ip4Config2StrToIp (StrTemp, &((*PtrIpList)[IpIndex])) != EFI_SUCCESS) {
241 FreePool (StrTemp);
242 FreePool (*PtrIpList);
243 *PtrIpList = NULL;
244 *IpCount = 0;
245 return EFI_INVALID_PARAMETER;
246 }
247
248 FreePool (StrTemp);
249 }
250 }
251 }
252
253 return EFI_SUCCESS;
254}
255
263VOID
266 OUT CHAR16 *Str
267 )
268{
270 Str,
271 2 * IP4_STR_MAX_SIZE,
272 L"%d.%d.%d.%d",
273 Ip->Addr[0],
274 Ip->Addr[1],
275 Ip->Addr[2],
276 Ip->Addr[3]
277 );
278}
279
296 IN UINTN IpCount,
297 OUT CHAR16 *Str
298 )
299{
300 UINTN Index;
301 UINTN TemIndex;
302 UINTN StrIndex;
303 CHAR16 *TempStr;
304 EFI_IPv4_ADDRESS *TempIp;
305
306 Index = 0;
307 TemIndex = 0;
308 StrIndex = 0;
309 TempStr = NULL;
310 TempIp = NULL;
311
312 for (Index = 0; Index < IpCount; Index++) {
313 TempIp = Ip + Index;
314 if (TempStr == NULL) {
315 TempStr = AllocateZeroPool (2 * IP4_STR_MAX_SIZE);
316 if (TempStr == NULL) {
317 return EFI_OUT_OF_RESOURCES;
318 }
319 }
320
322 TempStr,
323 2 * IP4_STR_MAX_SIZE,
324 L"%d.%d.%d.%d",
325 TempIp->Addr[0],
326 TempIp->Addr[1],
327 TempIp->Addr[2],
328 TempIp->Addr[3]
329 );
330
331 for (TemIndex = 0; TemIndex < IP4_STR_MAX_SIZE; TemIndex++) {
332 if (*(TempStr + TemIndex) == L'\0') {
333 if (Index == IpCount - 1) {
334 Str[StrIndex++] = L'\0';
335 } else {
336 Str[StrIndex++] = L' ';
337 }
338
339 break;
340 } else {
341 Str[StrIndex++] = *(TempStr + TemIndex);
342 }
343 }
344 }
345
346 if (TempStr != NULL) {
347 FreePool (TempStr);
348 }
349
350 return EFI_SUCCESS;
351}
352
360VOID
361EFIAPI
363 IN EFI_EVENT Event,
364 IN VOID *Context
365 )
366{
367 *((BOOLEAN *)Context) = TRUE;
368}
369
384 IN IP4_CONFIG2_INSTANCE *Instance,
385 IN OUT IP4_CONFIG2_IFR_NVDATA *IfrNvData
386 )
387{
388 IP4_SERVICE *IpSb;
389 EFI_IP4_CONFIG2_PROTOCOL *Ip4Config2;
392 UINTN DataSize;
393 UINTN GatewaySize;
394 EFI_IPv4_ADDRESS GatewayAddress;
395 EFI_STATUS Status;
396 UINTN DnsSize;
397 UINTN DnsCount;
398 EFI_IPv4_ADDRESS *DnsAddress;
399
400 Status = EFI_SUCCESS;
401 Ip4Config2 = &Instance->Ip4Config2;
402 Ip4Info = NULL;
403 DnsAddress = NULL;
404 GatewaySize = sizeof (EFI_IPv4_ADDRESS);
405
406 if ((IfrNvData == NULL) || (Instance == NULL)) {
407 return EFI_INVALID_PARAMETER;
408 }
409
410 NET_CHECK_SIGNATURE (Instance, IP4_CONFIG2_INSTANCE_SIGNATURE);
411
412 IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
413
414 if (IpSb->DefaultInterface->Configured) {
415 IfrNvData->Configure = 1;
416 } else {
417 IfrNvData->Configure = 0;
418 goto Exit;
419 }
420
421 //
422 // Get the Policy info.
423 //
424 DataSize = sizeof (EFI_IP4_CONFIG2_POLICY);
425 Status = Ip4Config2->GetData (
426 Ip4Config2,
428 &DataSize,
429 &Policy
430 );
431 if (EFI_ERROR (Status)) {
432 goto Exit;
433 }
434
435 if (Policy == Ip4Config2PolicyStatic) {
436 IfrNvData->DhcpEnable = FALSE;
437 } else if (Policy == Ip4Config2PolicyDhcp) {
438 IfrNvData->DhcpEnable = TRUE;
439 goto Exit;
440 }
441
442 //
443 // Get the interface info.
444 //
445 DataSize = 0;
446 Status = Ip4Config2->GetData (
447 Ip4Config2,
449 &DataSize,
450 NULL
451 );
452 if (Status != EFI_BUFFER_TOO_SMALL) {
453 return Status;
454 }
455
456 Ip4Info = AllocateZeroPool (DataSize);
457 if (Ip4Info == NULL) {
458 Status = EFI_OUT_OF_RESOURCES;
459 return Status;
460 }
461
462 Status = Ip4Config2->GetData (
463 Ip4Config2,
465 &DataSize,
466 Ip4Info
467 );
468 if (EFI_ERROR (Status)) {
469 goto Exit;
470 }
471
472 //
473 // Get the Gateway info.
474 //
475 Status = Ip4Config2->GetData (
476 Ip4Config2,
478 &GatewaySize,
479 &GatewayAddress
480 );
481 if (EFI_ERROR (Status)) {
482 goto Exit;
483 }
484
485 //
486 // Get the Dns info.
487 //
488 DnsSize = 0;
489 Status = Ip4Config2->GetData (
490 Ip4Config2,
492 &DnsSize,
493 NULL
494 );
495 if ((Status != EFI_BUFFER_TOO_SMALL) && (Status != EFI_NOT_FOUND)) {
496 goto Exit;
497 }
498
499 DnsCount = (UINT32)(DnsSize / sizeof (EFI_IPv4_ADDRESS));
500
501 if (DnsSize > 0) {
502 DnsAddress = AllocateZeroPool (DnsSize);
503 if (DnsAddress == NULL) {
504 Status = EFI_OUT_OF_RESOURCES;
505 goto Exit;
506 }
507
508 Status = Ip4Config2->GetData (
509 Ip4Config2,
511 &DnsSize,
512 DnsAddress
513 );
514 if (EFI_ERROR (Status)) {
515 goto Exit;
516 }
517 }
518
519 Ip4Config2IpToStr (&Ip4Info->StationAddress, IfrNvData->StationAddress);
520 Ip4Config2IpToStr (&Ip4Info->SubnetMask, IfrNvData->SubnetMask);
521 Ip4Config2IpToStr (&GatewayAddress, IfrNvData->GatewayAddress);
522 Status = Ip4Config2IpListToStr (DnsAddress, DnsCount, IfrNvData->DnsAddress);
523
524Exit:
525
526 if (DnsAddress != NULL) {
527 FreePool (DnsAddress);
528 }
529
530 if (Ip4Info != NULL) {
531 FreePool (Ip4Info);
532 }
533
534 return Status;
535}
536
552 IN IP4_CONFIG2_IFR_NVDATA *IfrFormNvData,
553 IN OUT IP4_CONFIG2_INSTANCE *Instance
554 )
555{
556 EFI_STATUS Status;
558 IP4_CONFIG2_NVDATA *Ip4NvData;
559
560 EFI_IP_ADDRESS StationAddress;
561 EFI_IP_ADDRESS SubnetMask;
562 EFI_IP_ADDRESS Gateway;
563 IP4_ADDR Ip;
564 EFI_IPv4_ADDRESS *DnsAddress;
565 UINTN DnsCount;
566 UINTN Index;
567
568 EFI_EVENT TimeoutEvent;
569 EFI_EVENT SetAddressEvent;
570 BOOLEAN IsAddressOk;
571 UINTN DataSize;
572 EFI_INPUT_KEY Key;
573
574 Status = EFI_SUCCESS;
575 Ip4Cfg2 = &Instance->Ip4Config2;
576 Ip4NvData = &Instance->Ip4NvData;
577
578 DnsCount = 0;
579 DnsAddress = NULL;
580
581 TimeoutEvent = NULL;
582 SetAddressEvent = NULL;
583
584 if ((Instance == NULL) || (IfrFormNvData == NULL)) {
585 return EFI_INVALID_PARAMETER;
586 }
587
588 if (IfrFormNvData->Configure != TRUE) {
589 if (Ip4NvData->DnsAddress != NULL) {
590 FreePool (Ip4NvData->DnsAddress);
591 Ip4NvData->DnsAddress = NULL;
592 Ip4NvData->DnsAddressCount = 0;
593 }
594
595 if (Ip4NvData->GatewayAddress != NULL) {
596 FreePool (Ip4NvData->GatewayAddress);
597 Ip4NvData->GatewayAddress = NULL;
598 Ip4NvData->GatewayAddressCount = 0;
599 }
600
601 if (Ip4NvData->ManualAddress != NULL) {
602 FreePool (Ip4NvData->ManualAddress);
603 Ip4NvData->ManualAddress = NULL;
604 Ip4NvData->ManualAddressCount = 0;
605 }
606
607 Ip4NvData->Policy = Ip4Config2PolicyDhcp;
608 Status = Ip4Cfg2->SetData (
609 Ip4Cfg2,
611 sizeof (EFI_IP4_CONFIG2_POLICY),
612 &Ip4NvData->Policy
613 );
614 return EFI_SUCCESS;
615 }
616
617 if (IfrFormNvData->DhcpEnable == TRUE) {
618 Ip4NvData->Policy = Ip4Config2PolicyDhcp;
619
620 Status = Ip4Cfg2->SetData (
621 Ip4Cfg2,
623 sizeof (EFI_IP4_CONFIG2_POLICY),
624 &Ip4NvData->Policy
625 );
626 if (EFI_ERROR (Status)) {
627 return Status;
628 }
629 } else {
630 //
631 // Get Ip4NvData from IfrFormNvData if it is valid.
632 //
633 Ip4NvData->Policy = Ip4Config2PolicyStatic;
634
635 Status = Ip4Config2StrToIp (IfrFormNvData->SubnetMask, &SubnetMask.v4);
636 if (EFI_ERROR (Status) || ((SubnetMask.Addr[0] != 0) && (GetSubnetMaskPrefixLength (&SubnetMask.v4) == 0))) {
637 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Subnet Mask!", NULL);
638 return EFI_INVALID_PARAMETER;
639 }
640
641 Status = Ip4Config2StrToIp (IfrFormNvData->StationAddress, &StationAddress.v4);
642 if (EFI_ERROR (Status) ||
643 ((SubnetMask.Addr[0] != 0) && !NetIp4IsUnicast (NTOHL (StationAddress.Addr[0]), NTOHL (SubnetMask.Addr[0]))) ||
644 !Ip4StationAddressValid (NTOHL (StationAddress.Addr[0]), NTOHL (SubnetMask.Addr[0])))
645 {
646 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
647 return EFI_INVALID_PARAMETER;
648 }
649
650 Status = Ip4Config2StrToIp (IfrFormNvData->GatewayAddress, &Gateway.v4);
651 if (EFI_ERROR (Status) ||
652 ((Gateway.Addr[0] != 0) && (SubnetMask.Addr[0] != 0) && !NetIp4IsUnicast (NTOHL (Gateway.Addr[0]), NTOHL (SubnetMask.Addr[0]))))
653 {
654 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
655 return EFI_INVALID_PARAMETER;
656 }
657
658 Status = Ip4Config2StrToIpList (IfrFormNvData->DnsAddress, &DnsAddress, &DnsCount);
659 if (!EFI_ERROR (Status) && (DnsCount > 0)) {
660 for (Index = 0; Index < DnsCount; Index++) {
661 CopyMem (&Ip, &DnsAddress[Index], sizeof (IP4_ADDR));
662 if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
663 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Dns Server!", NULL);
664 FreePool (DnsAddress);
665 return EFI_INVALID_PARAMETER;
666 }
667 }
668 } else {
669 if (EFI_ERROR (Status)) {
670 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Dns Server!", NULL);
671 }
672 }
673
674 if (Ip4NvData->ManualAddress != NULL) {
675 FreePool (Ip4NvData->ManualAddress);
676 }
677
678 Ip4NvData->ManualAddressCount = 1;
680 if (Ip4NvData->ManualAddress == NULL) {
681 if (DnsAddress != NULL) {
682 FreePool (DnsAddress);
683 }
684
685 return EFI_OUT_OF_RESOURCES;
686 }
687
688 CopyMem (&Ip4NvData->ManualAddress->Address, &StationAddress.v4, sizeof (EFI_IPv4_ADDRESS));
689 CopyMem (&Ip4NvData->ManualAddress->SubnetMask, &SubnetMask.v4, sizeof (EFI_IPv4_ADDRESS));
690
691 if (Ip4NvData->GatewayAddress != NULL) {
692 FreePool (Ip4NvData->GatewayAddress);
693 }
694
695 Ip4NvData->GatewayAddressCount = 1;
696 Ip4NvData->GatewayAddress = AllocateZeroPool (sizeof (EFI_IPv4_ADDRESS));
697 if (Ip4NvData->GatewayAddress == NULL) {
698 if (DnsAddress != NULL) {
699 FreePool (DnsAddress);
700 }
701
702 return EFI_OUT_OF_RESOURCES;
703 }
704
705 CopyMem (Ip4NvData->GatewayAddress, &Gateway.v4, sizeof (EFI_IPv4_ADDRESS));
706
707 if (Ip4NvData->DnsAddress != NULL) {
708 FreePool (Ip4NvData->DnsAddress);
709 }
710
711 Ip4NvData->DnsAddressCount = (UINT32)DnsCount;
712 Ip4NvData->DnsAddress = DnsAddress;
713
714 //
715 // Setting Ip4NvData.
716 //
717 Status = Ip4Cfg2->SetData (
718 Ip4Cfg2,
720 sizeof (EFI_IP4_CONFIG2_POLICY),
721 &Ip4NvData->Policy
722 );
723 if (EFI_ERROR (Status)) {
724 return Status;
725 }
726
727 //
728 // Create events & timers for asynchronous settings.
729 //
730 Status = gBS->CreateEvent (
731 EVT_TIMER,
732 TPL_CALLBACK,
733 NULL,
734 NULL,
735 &TimeoutEvent
736 );
737 if (EFI_ERROR (Status)) {
738 return EFI_OUT_OF_RESOURCES;
739 }
740
741 Status = gBS->CreateEvent (
742 EVT_NOTIFY_SIGNAL,
743 TPL_NOTIFY,
745 &IsAddressOk,
746 &SetAddressEvent
747 );
748 if (EFI_ERROR (Status)) {
749 goto Exit;
750 }
751
752 IsAddressOk = FALSE;
753
754 Status = Ip4Cfg2->RegisterDataNotify (
755 Ip4Cfg2,
757 SetAddressEvent
758 );
759 if (EFI_ERROR (Status)) {
760 goto Exit;
761 }
762
763 //
764 // Set ManualAddress.
765 //
766 DataSize = Ip4NvData->ManualAddressCount * sizeof (EFI_IP4_CONFIG2_MANUAL_ADDRESS);
767 Status = Ip4Cfg2->SetData (
768 Ip4Cfg2,
770 DataSize,
771 (VOID *)Ip4NvData->ManualAddress
772 );
773
774 if (Status == EFI_NOT_READY) {
775 gBS->SetTimer (TimeoutEvent, TimerRelative, 50000000);
776 while (EFI_ERROR (gBS->CheckEvent (TimeoutEvent))) {
777 if (IsAddressOk) {
778 Status = EFI_SUCCESS;
779 break;
780 }
781 }
782 }
783
784 Ip4Cfg2->UnregisterDataNotify (
785 Ip4Cfg2,
787 SetAddressEvent
788 );
789 if (EFI_ERROR (Status)) {
790 goto Exit;
791 }
792
793 //
794 // Set gateway.
795 //
796 DataSize = Ip4NvData->GatewayAddressCount * sizeof (EFI_IPv4_ADDRESS);
797 Status = Ip4Cfg2->SetData (
798 Ip4Cfg2,
800 DataSize,
801 Ip4NvData->GatewayAddress
802 );
803 if (EFI_ERROR (Status)) {
804 goto Exit;
805 }
806
807 //
808 // Set DNS addresses.
809 //
810 if ((Ip4NvData->DnsAddressCount > 0) && (Ip4NvData->DnsAddress != NULL)) {
811 DataSize = Ip4NvData->DnsAddressCount * sizeof (EFI_IPv4_ADDRESS);
812 Status = Ip4Cfg2->SetData (
813 Ip4Cfg2,
815 DataSize,
816 Ip4NvData->DnsAddress
817 );
818
819 if (EFI_ERROR (Status)) {
820 goto Exit;
821 }
822 }
823 }
824
825Exit:
826 if (SetAddressEvent != NULL) {
827 gBS->CloseEvent (SetAddressEvent);
828 }
829
830 if (TimeoutEvent != NULL) {
831 gBS->CloseEvent (TimeoutEvent);
832 }
833
834 return Status;
835}
836
894EFIAPI
897 IN CONST EFI_STRING Request,
898 OUT EFI_STRING *Progress,
899 OUT EFI_STRING *Results
900 )
901{
902 EFI_STATUS Status;
903 IP4_CONFIG2_INSTANCE *Ip4Config2Instance;
904 IP4_FORM_CALLBACK_INFO *Private;
905 IP4_CONFIG2_IFR_NVDATA *IfrFormNvData;
906 EFI_STRING ConfigRequestHdr;
907 EFI_STRING ConfigRequest;
908 BOOLEAN AllocatedRequest;
909 EFI_STRING FormResult;
910 UINTN Size;
911 UINTN BufferSize;
912
913 if ((Progress == NULL) || (Results == NULL)) {
914 return EFI_INVALID_PARAMETER;
915 }
916
917 Status = EFI_SUCCESS;
918 IfrFormNvData = NULL;
919 ConfigRequest = NULL;
920 FormResult = NULL;
921 Size = 0;
922 AllocatedRequest = FALSE;
923 ConfigRequest = Request;
924 Private = IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS (This);
925 Ip4Config2Instance = IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK (Private);
926 BufferSize = sizeof (IP4_CONFIG2_IFR_NVDATA);
927 *Progress = Request;
928
929 //
930 // Check Request data in <ConfigHdr>.
931 //
932 if ((Request == NULL) || HiiIsConfigHdrMatch (Request, &gIp4Config2NvDataGuid, mIp4Config2StorageName)) {
933 IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG2_IFR_NVDATA));
934 if (IfrFormNvData == NULL) {
935 return EFI_OUT_OF_RESOURCES;
936 }
937
938 Ip4Config2ConvertConfigNvDataToIfrNvData (Ip4Config2Instance, IfrFormNvData);
939
940 if ((Request == NULL) || (StrStr (Request, L"OFFSET") == NULL)) {
941 //
942 // Request has no request element, construct full request string.
943 // Allocate and fill a buffer large enough to hold the <ConfigHdr> template
944 // followed by "&OFFSET=0&WIDTH=WWWWWWWWWWWWWWWW" followed by a Null-terminator
945 //
946 ConfigRequestHdr = HiiConstructConfigHdr (&gIp4Config2NvDataGuid, mIp4Config2StorageName, Private->ChildHandle);
947 Size = (StrLen (ConfigRequestHdr) + 32 + 1) * sizeof (CHAR16);
948 ConfigRequest = AllocateZeroPool (Size);
949 if (ConfigRequest == NULL) {
950 Status = EFI_OUT_OF_RESOURCES;
951 goto Failure;
952 }
953
954 AllocatedRequest = TRUE;
955
956 UnicodeSPrint (ConfigRequest, Size, L"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
957 FreePool (ConfigRequestHdr);
958 }
959
960 //
961 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
962 //
963 Status = gHiiConfigRouting->BlockToConfig (
965 ConfigRequest,
966 (UINT8 *)IfrFormNvData,
967 BufferSize,
968 &FormResult,
969 Progress
970 );
971
972 FreePool (IfrFormNvData);
973
974 //
975 // Free the allocated config request string.
976 //
977 if (AllocatedRequest) {
978 FreePool (ConfigRequest);
979 ConfigRequest = NULL;
980 }
981
982 if (EFI_ERROR (Status)) {
983 goto Failure;
984 }
985 }
986
987 if ((Request == NULL) || HiiIsConfigHdrMatch (Request, &gIp4Config2NvDataGuid, mIp4Config2StorageName)) {
988 *Results = FormResult;
989 } else {
990 return EFI_NOT_FOUND;
991 }
992
993Failure:
994 //
995 // Set Progress string to the original request string.
996 //
997 if (Request == NULL) {
998 *Progress = NULL;
999 } else if (StrStr (Request, L"OFFSET") == NULL) {
1000 *Progress = Request + StrLen (Request);
1001 }
1002
1003 return Status;
1004}
1005
1040EFIAPI
1043 IN CONST EFI_STRING Configuration,
1044 OUT EFI_STRING *Progress
1045 )
1046{
1047 EFI_STATUS Status;
1048 UINTN BufferSize;
1049 IP4_CONFIG2_IFR_NVDATA *IfrFormNvData;
1050 IP4_CONFIG2_INSTANCE *Ip4Config2Instance;
1051 IP4_FORM_CALLBACK_INFO *Private;
1052
1053 Status = EFI_SUCCESS;
1054 IfrFormNvData = NULL;
1055
1056 if ((Configuration == NULL) || (Progress == NULL)) {
1057 return EFI_INVALID_PARAMETER;
1058 }
1059
1060 *Progress = Configuration;
1061
1062 Private = IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS (This);
1063 Ip4Config2Instance = IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK (Private);
1064
1065 //
1066 // Check Routing data in <ConfigHdr>.
1067 //
1068 if (HiiIsConfigHdrMatch (Configuration, &gIp4Config2NvDataGuid, mIp4Config2StorageName)) {
1069 //
1070 // Convert buffer data to <ConfigResp> by helper function BlockToConfig()
1071 //
1072 IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG2_IFR_NVDATA));
1073 if (IfrFormNvData == NULL) {
1074 return EFI_OUT_OF_RESOURCES;
1075 }
1076
1077 BufferSize = 0;
1078
1079 Status = gHiiConfigRouting->ConfigToBlock (
1081 Configuration,
1082 (UINT8 *)IfrFormNvData,
1083 &BufferSize,
1084 Progress
1085 );
1086 if (Status != EFI_BUFFER_TOO_SMALL) {
1087 return Status;
1088 }
1089
1090 Status = gHiiConfigRouting->ConfigToBlock (
1092 Configuration,
1093 (UINT8 *)IfrFormNvData,
1094 &BufferSize,
1095 Progress
1096 );
1097 if (!EFI_ERROR (Status)) {
1098 Status = Ip4Config2ConvertIfrNvDataToConfigNvData (IfrFormNvData, Ip4Config2Instance);
1099 }
1100
1101 FreePool (IfrFormNvData);
1102 } else {
1103 return EFI_NOT_FOUND;
1104 }
1105
1106 return Status;
1107}
1108
1137EFIAPI
1140 IN EFI_BROWSER_ACTION Action,
1141 IN EFI_QUESTION_ID QuestionId,
1142 IN UINT8 Type,
1143 IN EFI_IFR_TYPE_VALUE *Value,
1144 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
1145 )
1146{
1147 EFI_STATUS Status;
1148 IP4_CONFIG2_INSTANCE *Instance;
1149 IP4_CONFIG2_IFR_NVDATA *IfrFormNvData;
1150 IP4_FORM_CALLBACK_INFO *Private;
1151
1152 EFI_IP_ADDRESS StationAddress;
1153 EFI_IP_ADDRESS SubnetMask;
1154 EFI_IP_ADDRESS Gateway;
1155 IP4_ADDR Ip;
1156 EFI_IPv4_ADDRESS *DnsAddress;
1157 UINTN DnsCount;
1158 UINTN Index;
1159 EFI_INPUT_KEY Key;
1160
1161 IfrFormNvData = NULL;
1162 DnsCount = 0;
1163 DnsAddress = NULL;
1164
1165 if (Action == EFI_BROWSER_ACTION_CHANGED) {
1166 Private = IP4_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS (This);
1167 Instance = IP4_CONFIG2_INSTANCE_FROM_FORM_CALLBACK (Private);
1168
1169 IfrFormNvData = AllocateZeroPool (sizeof (IP4_CONFIG2_IFR_NVDATA));
1170 if (IfrFormNvData == NULL) {
1171 return EFI_OUT_OF_RESOURCES;
1172 }
1173
1174 //
1175 // Retrieve uncommitted data from Browser
1176 //
1177 if (!HiiGetBrowserData (&gIp4Config2NvDataGuid, mIp4Config2StorageName, sizeof (IP4_CONFIG2_IFR_NVDATA), (UINT8 *)IfrFormNvData)) {
1178 FreePool (IfrFormNvData);
1179 return EFI_NOT_FOUND;
1180 }
1181
1182 Status = EFI_SUCCESS;
1183
1184 switch (QuestionId) {
1185 case KEY_LOCAL_IP:
1186 Status = Ip4Config2StrToIp (IfrFormNvData->StationAddress, &StationAddress.v4);
1187 if (EFI_ERROR (Status) || IP4_IS_UNSPECIFIED (NTOHL (StationAddress.Addr[0])) || IP4_IS_LOCAL_BROADCAST (NTOHL (StationAddress.Addr[0]))) {
1188 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid IP address!", NULL);
1189 Status = EFI_INVALID_PARAMETER;
1190 }
1191
1192 break;
1193
1194 case KEY_SUBNET_MASK:
1195 Status = Ip4Config2StrToIp (IfrFormNvData->SubnetMask, &SubnetMask.v4);
1196 if (EFI_ERROR (Status) || ((SubnetMask.Addr[0] != 0) && (GetSubnetMaskPrefixLength (&SubnetMask.v4) == 0))) {
1197 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Subnet Mask!", NULL);
1198 Status = EFI_INVALID_PARAMETER;
1199 }
1200
1201 break;
1202
1203 case KEY_GATE_WAY:
1204 Status = Ip4Config2StrToIp (IfrFormNvData->GatewayAddress, &Gateway.v4);
1205 if (EFI_ERROR (Status) || IP4_IS_LOCAL_BROADCAST (NTOHL (Gateway.Addr[0]))) {
1206 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Gateway!", NULL);
1207 Status = EFI_INVALID_PARAMETER;
1208 }
1209
1210 break;
1211
1212 case KEY_DNS:
1213 Status = Ip4Config2StrToIpList (IfrFormNvData->DnsAddress, &DnsAddress, &DnsCount);
1214 if (!EFI_ERROR (Status) && (DnsCount > 0)) {
1215 for (Index = 0; Index < DnsCount; Index++) {
1216 CopyMem (&Ip, &DnsAddress[Index], sizeof (IP4_ADDR));
1217 if (IP4_IS_UNSPECIFIED (NTOHL (Ip)) || IP4_IS_LOCAL_BROADCAST (NTOHL (Ip))) {
1218 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Dns Server!", NULL);
1219 Status = EFI_INVALID_PARAMETER;
1220 break;
1221 }
1222 }
1223 } else {
1224 if (EFI_ERROR (Status)) {
1225 CreatePopUp (EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE, &Key, L"Invalid Dns Server!", NULL);
1226 }
1227 }
1228
1229 if (DnsAddress != NULL) {
1230 FreePool (DnsAddress);
1231 }
1232
1233 break;
1234
1235 case KEY_SAVE_CHANGES:
1236 Status = Ip4Config2ConvertIfrNvDataToConfigNvData (IfrFormNvData, Instance);
1237 *ActionRequest = EFI_BROWSER_ACTION_REQUEST_SUBMIT;
1238 break;
1239
1240 default:
1241 break;
1242 }
1243
1244 FreePool (IfrFormNvData);
1245
1246 return Status;
1247 }
1248
1249 //
1250 // All other action return unsupported.
1251 //
1252 return EFI_UNSUPPORTED;
1253}
1254
1267 IN OUT IP4_CONFIG2_INSTANCE *Instance
1268 )
1269{
1270 EFI_STATUS Status;
1271 IP4_SERVICE *IpSb;
1272 IP4_FORM_CALLBACK_INFO *CallbackInfo;
1273 EFI_HII_CONFIG_ACCESS_PROTOCOL *ConfigAccess;
1274 VENDOR_DEVICE_PATH VendorDeviceNode;
1276 CHAR16 *MacString;
1277 CHAR16 MenuString[128];
1278 CHAR16 PortString[128];
1279 CHAR16 *OldMenuString;
1280 EFI_DEVICE_PATH_PROTOCOL *ParentDevicePath;
1281
1282 IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
1283 ASSERT (IpSb != NULL);
1284
1285 CallbackInfo = &Instance->CallbackInfo;
1286
1287 CallbackInfo->Signature = IP4_FORM_CALLBACK_INFO_SIGNATURE;
1288
1289 Status = gBS->HandleProtocol (
1290 IpSb->Controller,
1291 &gEfiDevicePathProtocolGuid,
1292 (VOID **)&ParentDevicePath
1293 );
1294 if (EFI_ERROR (Status)) {
1295 return Status;
1296 }
1297
1298 //
1299 // Construct device path node for EFI HII Config Access protocol,
1300 // which consists of controller physical device path and one hardware
1301 // vendor guid node.
1302 //
1303 ZeroMem (&VendorDeviceNode, sizeof (VENDOR_DEVICE_PATH));
1304 VendorDeviceNode.Header.Type = HARDWARE_DEVICE_PATH;
1305 VendorDeviceNode.Header.SubType = HW_VENDOR_DP;
1306
1307 CopyGuid (&VendorDeviceNode.Guid, &gEfiCallerIdGuid);
1308
1309 SetDevicePathNodeLength (&VendorDeviceNode.Header, sizeof (VENDOR_DEVICE_PATH));
1310 CallbackInfo->HiiVendorDevicePath = AppendDevicePathNode (
1311 ParentDevicePath,
1312 (EFI_DEVICE_PATH_PROTOCOL *)&VendorDeviceNode
1313 );
1314 if (CallbackInfo->HiiVendorDevicePath == NULL) {
1315 Status = EFI_OUT_OF_RESOURCES;
1316 goto Error;
1317 }
1318
1319 ConfigAccess = &CallbackInfo->HiiConfigAccessProtocol;
1320 ConfigAccess->ExtractConfig = Ip4FormExtractConfig;
1321 ConfigAccess->RouteConfig = Ip4FormRouteConfig;
1322 ConfigAccess->Callback = Ip4FormCallback;
1323
1324 //
1325 // Install Device Path Protocol and Config Access protocol on new handle
1326 //
1327 Status = gBS->InstallMultipleProtocolInterfaces (
1328 &CallbackInfo->ChildHandle,
1329 &gEfiDevicePathProtocolGuid,
1330 CallbackInfo->HiiVendorDevicePath,
1331 &gEfiHiiConfigAccessProtocolGuid,
1332 ConfigAccess,
1333 NULL
1334 );
1335
1336 if (!EFI_ERROR (Status)) {
1337 //
1338 // Open the Parent Handle for the child
1339 //
1340 Status = gBS->OpenProtocol (
1341 IpSb->Controller,
1342 &gEfiManagedNetworkServiceBindingProtocolGuid,
1343 (VOID **)&MnpSb,
1344 IpSb->Image,
1345 CallbackInfo->ChildHandle,
1346 EFI_OPEN_PROTOCOL_BY_CHILD_CONTROLLER
1347 );
1348 }
1349
1350 if (EFI_ERROR (Status)) {
1351 goto Error;
1352 }
1353
1354 //
1355 // Publish our HII data
1356 //
1357 CallbackInfo->RegisteredHandle = HiiAddPackages (
1358 &gIp4Config2NvDataGuid,
1359 CallbackInfo->ChildHandle,
1360 Ip4DxeStrings,
1361 Ip4Config2Bin,
1362 NULL
1363 );
1364 if (CallbackInfo->RegisteredHandle == NULL) {
1365 Status = EFI_OUT_OF_RESOURCES;
1366 goto Error;
1367 }
1368
1369 //
1370 // Append MAC string in the menu help string and tile help string
1371 //
1372 Status = NetLibGetMacString (IpSb->Controller, IpSb->Image, &MacString);
1373 if (!EFI_ERROR (Status)) {
1374 OldMenuString = HiiGetString (
1375 CallbackInfo->RegisteredHandle,
1376 STRING_TOKEN (STR_IP4_CONFIG2_FORM_HELP),
1377 NULL
1378 );
1379 UnicodeSPrint (MenuString, 128, L"%s (MAC:%s)", OldMenuString, MacString);
1380 HiiSetString (
1381 CallbackInfo->RegisteredHandle,
1382 STRING_TOKEN (STR_IP4_CONFIG2_FORM_HELP),
1383 MenuString,
1384 NULL
1385 );
1386
1387 UnicodeSPrint (PortString, 128, L"MAC:%s", MacString);
1388 HiiSetString (
1389 CallbackInfo->RegisteredHandle,
1390 STRING_TOKEN (STR_IP4_DEVICE_FORM_HELP),
1391 PortString,
1392 NULL
1393 );
1394
1395 FreePool (MacString);
1396 FreePool (OldMenuString);
1397
1398 return EFI_SUCCESS;
1399 }
1400
1401Error:
1402 Ip4Config2FormUnload (Instance);
1403 return Status;
1404}
1405
1412VOID
1414 IN OUT IP4_CONFIG2_INSTANCE *Instance
1415 )
1416{
1417 IP4_SERVICE *IpSb;
1418 IP4_FORM_CALLBACK_INFO *CallbackInfo;
1419 IP4_CONFIG2_NVDATA *Ip4NvData;
1420
1421 IpSb = IP4_SERVICE_FROM_IP4_CONFIG2_INSTANCE (Instance);
1422 ASSERT (IpSb != NULL);
1423
1424 CallbackInfo = &Instance->CallbackInfo;
1425
1426 if (CallbackInfo->ChildHandle != NULL) {
1427 //
1428 // Close the child handle
1429 //
1430 gBS->CloseProtocol (
1431 IpSb->Controller,
1432 &gEfiManagedNetworkServiceBindingProtocolGuid,
1433 IpSb->Image,
1434 CallbackInfo->ChildHandle
1435 );
1436
1437 //
1438 // Uninstall EFI_HII_CONFIG_ACCESS_PROTOCOL
1439 //
1440 gBS->UninstallMultipleProtocolInterfaces (
1441 CallbackInfo->ChildHandle,
1442 &gEfiDevicePathProtocolGuid,
1443 CallbackInfo->HiiVendorDevicePath,
1444 &gEfiHiiConfigAccessProtocolGuid,
1445 &CallbackInfo->HiiConfigAccessProtocol,
1446 NULL
1447 );
1448 }
1449
1450 if (CallbackInfo->HiiVendorDevicePath != NULL) {
1451 FreePool (CallbackInfo->HiiVendorDevicePath);
1452 }
1453
1454 if (CallbackInfo->RegisteredHandle != NULL) {
1455 //
1456 // Remove HII package list
1457 //
1458 HiiRemovePackages (CallbackInfo->RegisteredHandle);
1459 }
1460
1461 Ip4NvData = &Instance->Ip4NvData;
1462
1463 if (Ip4NvData->ManualAddress != NULL) {
1464 FreePool (Ip4NvData->ManualAddress);
1465 }
1466
1467 if (Ip4NvData->GatewayAddress != NULL) {
1468 FreePool (Ip4NvData->GatewayAddress);
1469 }
1470
1471 if (Ip4NvData->DnsAddress != NULL) {
1472 FreePool (Ip4NvData->DnsAddress);
1473 }
1474
1475 Ip4NvData->ManualAddressCount = 0;
1476 Ip4NvData->GatewayAddressCount = 0;
1477 Ip4NvData->DnsAddressCount = 0;
1478}
UINT64 UINTN
UINT32 EFIAPI SwapBytes32(IN UINT32 Value)
Definition: SwapBytes32.c:25
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
Definition: String.c:224
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
Definition: MemLibGuid.c:39
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
Definition: DevicePath.h:68
#define HW_VENDOR_DP
Definition: DevicePath.h:133
UINT16 EFIAPI SetDevicePathNodeLength(IN OUT VOID *Node, IN UINTN Length)
EFI_DEVICE_PATH_PROTOCOL *EFIAPI AppendDevicePathNode(IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePath OPTIONAL, IN CONST EFI_DEVICE_PATH_PROTOCOL *DevicePathNode OPTIONAL)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
EFI_STRING EFIAPI HiiConstructConfigHdr(IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL, IN EFI_HANDLE DriverHandle)
Definition: HiiLib.c:723
BOOLEAN EFIAPI HiiGetBrowserData(IN CONST EFI_GUID *VariableGuid OPTIONAL, IN CONST CHAR16 *VariableName OPTIONAL, IN UINTN BufferSize, OUT UINT8 *Buffer)
Definition: HiiLib.c:2872
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
Definition: HiiLib.c:141
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
Definition: HiiString.c:211
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
Definition: HiiLib.c:2813
EFI_STRING_ID EFIAPI HiiSetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId OPTIONAL, IN CONST EFI_STRING String, IN CONST CHAR8 *SupportedLanguages OPTIONAL)
Definition: HiiString.c:52
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
Definition: HiiLib.c:253
BOOLEAN Ip4StationAddressValid(IN IP4_ADDR Ip, IN IP4_ADDR Netmask)
Definition: Ip4Common.c:267
EFI_IP4_CONFIG2_POLICY
Definition: Ip4Config2.h:127
@ Ip4Config2PolicyDhcp
Definition: Ip4Config2.h:142
@ Ip4Config2PolicyStatic
Definition: Ip4Config2.h:135
@ Ip4Config2DataTypeManualAddress
Definition: Ip4Config2.h:52
@ Ip4Config2DataTypeGateway
Definition: Ip4Config2.h:63
@ Ip4Config2DataTypePolicy
Definition: Ip4Config2.h:43
@ Ip4Config2DataTypeInterfaceInfo
Definition: Ip4Config2.h:35
@ Ip4Config2DataTypeDnsServer
Definition: Ip4Config2.h:74
EFI_STATUS EFIAPI Ip4FormRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS Ip4Config2ConvertConfigNvDataToIfrNvData(IN IP4_CONFIG2_INSTANCE *Instance, IN OUT IP4_CONFIG2_IFR_NVDATA *IfrNvData)
Definition: Ip4Config2Nv.c:383
EFI_STATUS Ip4Config2StrToIpList(IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS **PtrIpList, OUT UINTN *IpCount)
Definition: Ip4Config2Nv.c:130
EFI_STATUS Ip4Config2FormInit(IN OUT IP4_CONFIG2_INSTANCE *Instance)
EFI_STATUS EFIAPI Ip4FormExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
Definition: Ip4Config2Nv.c:895
VOID EFIAPI Ip4Config2ManualAddressNotify(IN EFI_EVENT Event, IN VOID *Context)
Definition: Ip4Config2Nv.c:362
EFI_STATUS EFIAPI Ip4FormCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
VOID Ip4Config2FormUnload(IN OUT IP4_CONFIG2_INSTANCE *Instance)
EFI_STATUS Ip4Config2ConvertIfrNvDataToConfigNvData(IN IP4_CONFIG2_IFR_NVDATA *IfrFormNvData, IN OUT IP4_CONFIG2_INSTANCE *Instance)
Definition: Ip4Config2Nv.c:551
VOID Ip4Config2IpToStr(IN EFI_IPv4_ADDRESS *Ip, OUT CHAR16 *Str)
Definition: Ip4Config2Nv.c:264
UINT8 GetSubnetMaskPrefixLength(IN EFI_IPv4_ADDRESS *SubnetMask)
Definition: Ip4Config2Nv.c:23
EFI_STATUS Ip4Config2StrToIp(IN CHAR16 *Str, OUT EFI_IPv4_ADDRESS *Ip)
Definition: Ip4Config2Nv.c:65
EFI_STATUS Ip4Config2IpListToStr(IN EFI_IPv4_ADDRESS *Ip, IN UINTN IpCount, OUT CHAR16 *Str)
Definition: Ip4Config2Nv.c:294
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
#define NULL
Definition: Base.h:319
#define CONST
Definition: Base.h:259
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
EFI_STATUS EFIAPI NetLibGetMacString(IN EFI_HANDLE ServiceHandle, IN EFI_HANDLE ImageHandle OPTIONAL, OUT CHAR16 **MacString)
Definition: DxeNetLib.c:2363
BOOLEAN EFIAPI NetIp4IsUnicast(IN IP4_ADDR Ip, IN IP4_ADDR NetMask)
Definition: DxeNetLib.c:683
VOID EFIAPI Exit(IN EFI_STATUS Status)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
IPv4_ADDRESS EFI_IPv4_ADDRESS
Definition: UefiBaseType.h:85
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
#define STRING_TOKEN(t)
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)
Definition: Console.c:393
@ TimerRelative
Definition: UefiSpec.h:539
EFI_IPv4_ADDRESS SubnetMask
Definition: Ip4Config2.h:111
EFI_IPv4_ADDRESS StationAddress
Definition: Ip4Config2.h:107
EFI_IPv4_ADDRESS SubnetMask
Definition: Ip4Config2.h:157
EFI_IP4_CONFIG2_MANUAL_ADDRESS * ManualAddress
IP addresses.
EFI_IPv4_ADDRESS * DnsAddress
DNS server address.
UINT32 ManualAddressCount
IP addresses count.
UINT32 DnsAddressCount
DNS server address count.
EFI_IP4_CONFIG2_POLICY Policy
manual or automatic
EFI_IPv4_ADDRESS * GatewayAddress
Gateway address.
UINT32 GatewayAddressCount
Gateway address count.