12CHAR16 mHttpBootConfigStorageName[] = L
"HTTP_BOOT_CONFIG_IFR_NVDATA";
30 IN CHAR16 *Description,
38 CHAR8 AsciiUri[URI_STR_MAX_SIZE];
47 if (
StrLen (Description) == 0) {
48 return EFI_INVALID_PARAMETER;
54 for (Index = 0; Index <
StrLen (Uri); Index++) {
55 if (Uri[Index] == L
':') {
59 if ((Uri[Index] >= L
'A') && (Uri[Index] <= L
'Z')) {
60 Uri[Index] -= (CHAR16)(L
'A' - L
'a');
67 if ((
StrLen (Uri) != 0) && (
StrnCmp (Uri, L
"http://", 7) != 0) && (
StrnCmp (Uri, L
"https://", 8) != 0)) {
68 return EFI_INVALID_PARAMETER;
78 Status = EFI_OUT_OF_RESOURCES;
88 Status = EFI_OUT_OF_RESOURCES;
99 if (TmpDevicePath ==
NULL) {
100 return EFI_OUT_OF_RESOURCES;
110 Status = EFI_OUT_OF_RESOURCES;
122 if (NewDevicePath ==
NULL) {
123 Status = EFI_OUT_OF_RESOURCES;
132 LoadOptionNumberUnassigned,
140 if (EFI_ERROR (Status)) {
149 if (NewDevicePath !=
NULL) {
232 OUT EFI_STRING *Progress,
233 OUT EFI_STRING *Results
239 EFI_STRING ConfigRequestHdr;
240 EFI_STRING ConfigRequest;
241 BOOLEAN AllocatedRequest;
244 if ((Progress ==
NULL) || (Results ==
NULL)) {
245 return EFI_INVALID_PARAMETER;
250 return EFI_NOT_FOUND;
253 ConfigRequestHdr =
NULL;
254 ConfigRequest =
NULL;
255 AllocatedRequest =
FALSE;
258 CallbackInfo = HTTP_BOOT_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS (This);
263 ZeroMem (&CallbackInfo->HttpBootNvData, BufferSize);
264 StrCpyS (CallbackInfo->HttpBootNvData.Description, DESCRIPTION_STR_MAX_SIZE / sizeof (CHAR16), HTTP_BOOT_DEFAULT_DESCRIPTION_STR);
266 ConfigRequest = Request;
273 ConfigRequestHdr =
HiiConstructConfigHdr (&gHttpBootConfigGuid, mHttpBootConfigStorageName, CallbackInfo->ChildHandle);
274 Size = (
StrLen (ConfigRequestHdr) + 32 + 1) *
sizeof (CHAR16);
276 if (ConfigRequest ==
NULL) {
277 return EFI_OUT_OF_RESOURCES;
280 AllocatedRequest =
TRUE;
281 UnicodeSPrint (ConfigRequest, Size, L
"%s&OFFSET=0&WIDTH=%016LX", ConfigRequestHdr, (UINT64)BufferSize);
288 (UINT8 *)&CallbackInfo->HttpBootNvData,
297 if (AllocatedRequest) {
299 ConfigRequest =
NULL;
305 if (Request ==
NULL) {
307 }
else if (
StrStr (Request, L
"OFFSET") ==
NULL) {
308 *Progress = Request +
StrLen (Request);
358 IN CONST EFI_STRING Configuration,
359 OUT EFI_STRING *Progress
367 if (Progress ==
NULL) {
368 return EFI_INVALID_PARAMETER;
371 *Progress = Configuration;
373 if (Configuration ==
NULL) {
374 return EFI_INVALID_PARAMETER;
381 if (!
HiiIsConfigHdrMatch (Configuration, &gHttpBootConfigGuid, mHttpBootConfigStorageName)) {
382 return EFI_NOT_FOUND;
385 CallbackInfo = HTTP_BOOT_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS (This);
386 Private = HTTP_BOOT_PRIVATE_DATA_FROM_CALLBACK_INFO (CallbackInfo);
389 ZeroMem (&CallbackInfo->HttpBootNvData, BufferSize);
394 (UINT8 *)&CallbackInfo->HttpBootNvData,
398 if (EFI_ERROR (Status)) {
407 (CallbackInfo->HttpBootNvData.IpVersion == HTTP_BOOT_IP_VERSION_6) ?
TRUE :
FALSE,
408 CallbackInfo->HttpBootNvData.Description,
409 CallbackInfo->HttpBootNvData.Uri
444 IN EFI_BROWSER_ACTION Action,
445 IN EFI_QUESTION_ID QuestionId,
448 OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest
463 if ((This ==
NULL) || (Value ==
NULL)) {
464 return EFI_INVALID_PARAMETER;
467 CallbackInfo = HTTP_BOOT_FORM_CALLBACK_INFO_FROM_CONFIG_ACCESS (This);
469 if (Action != EFI_BROWSER_ACTION_CHANGING) {
470 return EFI_UNSUPPORTED;
473 switch (QuestionId) {
474 case KEY_INITIATOR_URI:
480 return EFI_INVALID_PARAMETER;
488 UriLen =
StrLen (Uri) + 1;
490 if (AsciiUri ==
NULL) {
492 return EFI_OUT_OF_RESOURCES;
499 if (Status == EFI_INVALID_PARAMETER) {
500 DEBUG ((DEBUG_ERROR,
"HttpBootFormCallback: %r.\n", Status));
503 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
505 L
"ERROR: Unsupported URI!",
506 L
"Only supports HTTP and HTTPS",
509 }
else if (Status == EFI_ACCESS_DENIED) {
510 DEBUG ((DEBUG_ERROR,
"HttpBootFormCallback: %r.\n", Status));
513 EFI_LIGHTGRAY | EFI_BACKGROUND_BLUE,
515 L
"ERROR: Unsupported URI!",
526 if (AsciiUri !=
NULL) {
557 CHAR16 *OldMenuString;
558 CHAR16 MenuString[128];
560 CallbackInfo = &Private->CallbackInfo;
562 if (CallbackInfo->Initialized) {
566 CallbackInfo->Signature = HTTP_BOOT_FORM_CALLBACK_INFO_SIGNATURE;
579 Private->ParentDevicePath,
582 if (CallbackInfo->HiiVendorDevicePath ==
NULL) {
583 Status = EFI_OUT_OF_RESOURCES;
594 Status =
gBS->InstallMultipleProtocolInterfaces (
595 &CallbackInfo->ChildHandle,
596 &gEfiDevicePathProtocolGuid,
597 CallbackInfo->HiiVendorDevicePath,
598 &gEfiHiiConfigAccessProtocolGuid,
599 &CallbackInfo->ConfigAccess,
602 if (EFI_ERROR (Status)) {
610 &gHttpBootConfigGuid,
611 CallbackInfo->ChildHandle,
613 HttpBootConfigVfrBin,
616 if (CallbackInfo->RegisteredHandle ==
NULL) {
617 Status = EFI_OUT_OF_RESOURCES;
625 if (!EFI_ERROR (Status)) {
627 CallbackInfo->RegisteredHandle,
631 UnicodeSPrint (MenuString, 128, L
"%s (MAC:%s)", OldMenuString, MacString);
633 CallbackInfo->RegisteredHandle,
642 CallbackInfo->Initialized =
TRUE;
670 if ((Private->Ip4Nic !=
NULL) || (Private->Ip6Nic !=
NULL)) {
677 CallbackInfo = &Private->CallbackInfo;
678 if (CallbackInfo->ChildHandle !=
NULL) {
682 gBS->UninstallMultipleProtocolInterfaces (
683 CallbackInfo->ChildHandle,
684 &gEfiDevicePathProtocolGuid,
685 CallbackInfo->HiiVendorDevicePath,
686 &gEfiHiiConfigAccessProtocolGuid,
687 &CallbackInfo->ConfigAccess,
690 CallbackInfo->ChildHandle =
NULL;
693 if (CallbackInfo->HiiVendorDevicePath !=
NULL) {
694 FreePool (CallbackInfo->HiiVendorDevicePath);
695 CallbackInfo->HiiVendorDevicePath =
NULL;
698 if (CallbackInfo->RegisteredHandle !=
NULL) {
703 CallbackInfo->RegisteredHandle =
NULL;
RETURN_STATUS EFIAPI StrCpyS(OUT CHAR16 *Destination, IN UINTN DestMax, IN CONST CHAR16 *Source)
RETURN_STATUS EFIAPI UnicodeStrToAsciiStrS(IN CONST CHAR16 *Source, OUT CHAR8 *Destination, IN UINTN DestMax)
INTN EFIAPI StrnCmp(IN CONST CHAR16 *FirstString, IN CONST CHAR16 *SecondString, IN UINTN Length)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
CHAR16 *EFIAPI StrStr(IN CONST CHAR16 *String, IN CONST CHAR16 *SearchString)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
GUID *EFIAPI CopyGuid(OUT GUID *DestinationGuid, IN CONST GUID *SourceGuid)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
#define HARDWARE_DEVICE_PATH
#define MESSAGING_DEVICE_PATH
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)
EFI_HII_HANDLE EFIAPI HiiAddPackages(IN CONST EFI_GUID *PackageListGuid, IN EFI_HANDLE DeviceHandle OPTIONAL,...)
EFI_STRING EFIAPI HiiGetString(IN EFI_HII_HANDLE HiiHandle, IN EFI_STRING_ID StringId, IN CONST CHAR8 *Language OPTIONAL)
BOOLEAN EFIAPI HiiIsConfigHdrMatch(IN CONST EFI_STRING ConfigHdr, IN CONST EFI_GUID *Guid OPTIONAL, IN CONST CHAR16 *Name OPTIONAL)
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)
VOID EFIAPI HiiRemovePackages(IN EFI_HII_HANDLE HiiHandle)
EFI_STATUS EFIAPI HttpBootFormExtractConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Request, OUT EFI_STRING *Progress, OUT EFI_STRING *Results)
EFI_STATUS HttpBootConfigFormInit(IN HTTP_BOOT_PRIVATE_DATA *Private)
EFI_STATUS EFIAPI HttpBootFormCallback(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN EFI_BROWSER_ACTION Action, IN EFI_QUESTION_ID QuestionId, IN UINT8 Type, IN OUT EFI_IFR_TYPE_VALUE *Value, OUT EFI_BROWSER_ACTION_REQUEST *ActionRequest)
EFI_STATUS HttpBootAddBootOption(IN HTTP_BOOT_PRIVATE_DATA *Private, IN BOOLEAN UsingIpv6, IN CHAR16 *Description, IN CHAR16 *Uri)
EFI_STATUS EFIAPI HttpBootFormRouteConfig(IN CONST EFI_HII_CONFIG_ACCESS_PROTOCOL *This, IN CONST EFI_STRING Configuration, OUT EFI_STRING *Progress)
EFI_STATUS HttpBootConfigFormUnload(IN HTTP_BOOT_PRIVATE_DATA *Private)
EFI_STATUS HttpBootCheckUriScheme(IN CHAR8 *Uri)
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibGetMacString(IN EFI_HANDLE ServiceHandle, IN EFI_HANDLE ImageHandle OPTIONAL, OUT CHAR16 **MacString)
VOID *EFIAPI AllocatePool(IN UINTN AllocationSize)
EFI_STATUS EFIAPI EfiBootManagerFreeLoadOption(IN EFI_BOOT_MANAGER_LOAD_OPTION *LoadOption)
EFI_STATUS EFIAPI EfiBootManagerAddLoadOptionVariable(IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, IN UINTN Position)
EFI_STATUS EFIAPI EfiBootManagerInitializeLoadOption(IN OUT EFI_BOOT_MANAGER_LOAD_OPTION *Option, IN UINTN OptionNumber, IN EFI_BOOT_MANAGER_LOAD_OPTION_TYPE OptionType, IN UINT32 Attributes, IN CHAR16 *Description, IN EFI_DEVICE_PATH_PROTOCOL *FilePath, IN UINT8 *OptionalData, IN UINT32 OptionalDataSize)
EFI_HII_CONFIG_ROUTING_PROTOCOL * gHiiConfigRouting
VOID EFIAPI CreatePopUp(IN UINTN Attribute, OUT EFI_INPUT_KEY *Key OPTIONAL,...)