VirtualBox

Ignore:
Timestamp:
Jul 1, 2021 8:17:41 AM (4 years ago)
Author:
vboxsync
Message:

Devices/EFI: Merge edk-stable202105 and openssl 1.1.1j and make it build, bugref:4643

Location:
trunk/src/VBox/Devices/EFI/FirmwareNew
Files:
6 added
22 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Devices/EFI/FirmwareNew

  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsDhcp.c

    r80721 r89983  
    132132      }
    133133
    134       for(Count=0; Count < ServerCount; Count++){
     134      for (Count=0; Count < ServerCount; Count++) {
    135135        CopyMem (ServerList + Count, &OptionList[Index]->Data[4 * Count], sizeof (EFI_IPv4_ADDRESS));
    136136      }
     
    226226      }
    227227
    228       for(Count=0; Count < ServerCount; Count++){
     228      for (Count=0; Count < ServerCount; Count++) {
    229229        CopyMem (ServerList + Count, &OptionList[Index]->Data[16 * Count], sizeof (EFI_IPv6_ADDRESS));
    230230      }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsDriver.c

    r85718 r89983  
    198198  UdpIoFreeIo (DnsSb->ConnectUdp);
    199199
    200   if (DnsSb->TimerToGetMap != NULL){
     200  if (DnsSb->TimerToGetMap != NULL) {
    201201    gBS->CloseEvent (DnsSb->TimerToGetMap);
    202202  }
    203203
    204   if (DnsSb->Timer != NULL){
     204  if (DnsSb->Timer != NULL) {
    205205    gBS->CloseEvent (DnsSb->Timer);
    206206  }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsImpl.c

    r85718 r89983  
    800800
    801801        return EFI_SUCCESS;
    802       }else {
     802      } else {
    803803        return EFI_ACCESS_DENIED;
    804804      }
     
    898898
    899899        return EFI_SUCCESS;
    900       }else {
     900      } else {
    901901        return EFI_ACCESS_DENIED;
    902902      }
     
    10811081    *Item = NET_LIST_USER_STRUCT (Entry, NET_MAP_ITEM, Link);
    10821082    Packet = (NET_BUF *) ((*Item)->Value);
    1083     if (Packet == NULL){
     1083    if (Packet == NULL) {
    10841084
    10851085      continue;
     
    21282128      }
    21292129    }
    2130   }else {
     2130  } else {
    21312131    //
    21322132    // Iterate through all the children of the DNS service instance. Time
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsImpl.h

    r85718 r89983  
    126126} DNS6_TOKEN_ENTRY;
    127127
    128 union _DNS_FLAGS{
     128union _DNS_FLAGS {
    129129  struct {
    130130    UINT16     RCode:4;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/DnsDxe/DnsProtocol.c

    r85718 r89983  
    218218    }
    219219
    220     if (Instance->UdpIo != NULL){
     220    if (Instance->UdpIo != NULL) {
    221221      UdpIoCleanIo (Instance->UdpIo);
    222222    }
     
    10621062    }
    10631063
    1064     if (Instance->UdpIo != NULL){
     1064    if (Instance->UdpIo != NULL) {
    10651065      UdpIoCleanIo (Instance->UdpIo);
    10661066    }
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootClient.c

    r80721 r89983  
    978978  //       User-Agent
    979979  //
    980   HttpIoHeader = HttpBootCreateHeader (3);
     980  HttpIoHeader = HttpIoCreateHeader (3);
    981981  if (HttpIoHeader == NULL) {
    982982    Status = EFI_OUT_OF_RESOURCES;
     
    996996    goto ERROR_3;
    997997  }
    998   Status = HttpBootSetHeader (
     998  Status = HttpIoSetHeader (
    999999             HttpIoHeader,
    10001000             HTTP_HEADER_HOST,
     
    10091009  // Add HTTP header field 2: Accept
    10101010  //
    1011   Status = HttpBootSetHeader (
     1011  Status = HttpIoSetHeader (
    10121012             HttpIoHeader,
    10131013             HTTP_HEADER_ACCEPT,
     
    10211021  // Add HTTP header field 3: User-Agent
    10221022  //
    1023   Status = HttpBootSetHeader (
     1023  Status = HttpIoSetHeader (
    10241024             HttpIoHeader,
    10251025             HTTP_HEADER_USER_AGENT,
     
    12921292  }
    12931293ERROR_3:
    1294   HttpBootFreeHeader (HttpIoHeader);
     1294  HttpIoFreeHeader (HttpIoHeader);
    12951295ERROR_2:
    12961296  if (Cache != NULL) {
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootDxe.h

    r85718 r89983  
    33
    44Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
    5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
     5(C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP<BR>
    66SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    2929#include <Library/NetLib.h>
    3030#include <Library/HttpLib.h>
     31#include <Library/HttpIoLib.h>
    3132#include <Library/HiiLib.h>
    3233#include <Library/PrintLib.h>
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootDxe.inf

    r80721 r89983  
    33#
    44#  Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
     5#  (C) Copyright 2020 Hewlett-Packard Development Company, L.P.<BR>
    56#  SPDX-License-Identifier: BSD-2-Clause-Patent
    67#
     
    5354  NetLib
    5455  HttpLib
     56  HttpIoLib
    5557  HiiLib
    5658  PrintLib
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootSupport.c

    r85718 r89983  
    33
    44Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
    5 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
     5(C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP<BR>
    66SPDX-License-Identifier: BSD-2-Clause-Patent
    77
     
    489489    FreePool (DnsServerList);
    490490  }
    491 
    492   return Status;
    493 }
    494 /**
    495   Create a HTTP_IO_HEADER to hold the HTTP header items.
    496 
    497   @param[in]  MaxHeaderCount         The maximum number of HTTP header in this holder.
    498 
    499   @return    A pointer of the HTTP header holder or NULL if failed.
    500 
    501 **/
    502 HTTP_IO_HEADER *
    503 HttpBootCreateHeader (
    504   UINTN                     MaxHeaderCount
    505   )
    506 {
    507   HTTP_IO_HEADER        *HttpIoHeader;
    508 
    509   if (MaxHeaderCount == 0) {
    510     return NULL;
    511   }
    512 
    513   HttpIoHeader = AllocateZeroPool (sizeof (HTTP_IO_HEADER) + MaxHeaderCount * sizeof (EFI_HTTP_HEADER));
    514   if (HttpIoHeader == NULL) {
    515     return NULL;
    516   }
    517 
    518   HttpIoHeader->MaxHeaderCount = MaxHeaderCount;
    519   HttpIoHeader->Headers = (EFI_HTTP_HEADER *) (HttpIoHeader + 1);
    520 
    521   return HttpIoHeader;
    522 }
    523 
    524 /**
    525   Destroy the HTTP_IO_HEADER and release the resources.
    526 
    527   @param[in]  HttpIoHeader       Point to the HTTP header holder to be destroyed.
    528 
    529 **/
    530 VOID
    531 HttpBootFreeHeader (
    532   IN  HTTP_IO_HEADER       *HttpIoHeader
    533   )
    534 {
    535   UINTN      Index;
    536 
    537   if (HttpIoHeader != NULL) {
    538     if (HttpIoHeader->HeaderCount != 0) {
    539       for (Index = 0; Index < HttpIoHeader->HeaderCount; Index++) {
    540         FreePool (HttpIoHeader->Headers[Index].FieldName);
    541         FreePool (HttpIoHeader->Headers[Index].FieldValue);
    542       }
    543     }
    544     FreePool (HttpIoHeader);
    545   }
    546 }
    547 
    548 /**
    549   Set or update a HTTP header with the field name and corresponding value.
    550 
    551   @param[in]  HttpIoHeader       Point to the HTTP header holder.
    552   @param[in]  FieldName          Null terminated string which describes a field name.
    553   @param[in]  FieldValue         Null terminated string which describes the corresponding field value.
    554 
    555   @retval  EFI_SUCCESS           The HTTP header has been set or updated.
    556   @retval  EFI_INVALID_PARAMETER Any input parameter is invalid.
    557   @retval  EFI_OUT_OF_RESOURCES  Insufficient resource to complete the operation.
    558   @retval  Other                 Unexpected error happened.
    559 
    560 **/
    561 EFI_STATUS
    562 HttpBootSetHeader (
    563   IN  HTTP_IO_HEADER       *HttpIoHeader,
    564   IN  CHAR8                *FieldName,
    565   IN  CHAR8                *FieldValue
    566   )
    567 {
    568   EFI_HTTP_HEADER       *Header;
    569   UINTN                 StrSize;
    570   CHAR8                 *NewFieldValue;
    571 
    572   if (HttpIoHeader == NULL || FieldName == NULL || FieldValue == NULL) {
    573     return EFI_INVALID_PARAMETER;
    574   }
    575 
    576   Header = HttpFindHeader (HttpIoHeader->HeaderCount, HttpIoHeader->Headers, FieldName);
    577   if (Header == NULL) {
    578     //
    579     // Add a new header.
    580     //
    581     if (HttpIoHeader->HeaderCount >= HttpIoHeader->MaxHeaderCount) {
    582       return EFI_OUT_OF_RESOURCES;
    583     }
    584     Header = &HttpIoHeader->Headers[HttpIoHeader->HeaderCount];
    585 
    586     StrSize = AsciiStrSize (FieldName);
    587     Header->FieldName = AllocatePool (StrSize);
    588     if (Header->FieldName == NULL) {
    589       return EFI_OUT_OF_RESOURCES;
    590     }
    591     CopyMem (Header->FieldName, FieldName, StrSize);
    592     Header->FieldName[StrSize -1] = '\0';
    593 
    594     StrSize = AsciiStrSize (FieldValue);
    595     Header->FieldValue = AllocatePool (StrSize);
    596     if (Header->FieldValue == NULL) {
    597       FreePool (Header->FieldName);
    598       return EFI_OUT_OF_RESOURCES;
    599     }
    600     CopyMem (Header->FieldValue, FieldValue, StrSize);
    601     Header->FieldValue[StrSize -1] = '\0';
    602 
    603     HttpIoHeader->HeaderCount++;
    604   } else {
    605     //
    606     // Update an existing one.
    607     //
    608     StrSize = AsciiStrSize (FieldValue);
    609     NewFieldValue = AllocatePool (StrSize);
    610     if (NewFieldValue == NULL) {
    611       return EFI_OUT_OF_RESOURCES;
    612     }
    613     CopyMem (NewFieldValue, FieldValue, StrSize);
    614     NewFieldValue[StrSize -1] = '\0';
    615 
    616     if (Header->FieldValue != NULL) {
    617       FreePool (Header->FieldValue);
    618     }
    619     Header->FieldValue = NewFieldValue;
    620   }
    621 
    622   return EFI_SUCCESS;
    623 }
    624 
    625 /**
    626   Notify the callback function when an event is triggered.
    627 
    628   @param[in]  Context         The opaque parameter to the function.
    629 
    630 **/
    631 VOID
    632 EFIAPI
    633 HttpIoNotifyDpc (
    634   IN VOID                *Context
    635   )
    636 {
    637   *((BOOLEAN *) Context) = TRUE;
    638 }
    639 
    640 /**
    641   Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK.
    642 
    643   @param[in]  Event                 The event signaled.
    644   @param[in]  Context               The opaque parameter to the function.
    645 
    646 **/
    647 VOID
    648 EFIAPI
    649 HttpIoNotify (
    650   IN EFI_EVENT              Event,
    651   IN VOID                   *Context
    652   )
    653 {
    654   //
    655   // Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK
    656   //
    657   QueueDpc (TPL_CALLBACK, HttpIoNotifyDpc, Context);
    658 }
    659 
    660 /**
    661   Create a HTTP_IO to access the HTTP service. It will create and configure
    662   a HTTP child handle.
    663 
    664   @param[in]  Image          The handle of the driver image.
    665   @param[in]  Controller     The handle of the controller.
    666   @param[in]  IpVersion      IP_VERSION_4 or IP_VERSION_6.
    667   @param[in]  ConfigData     The HTTP_IO configuration data.
    668   @param[in]  Callback       Callback function which will be invoked when specified
    669                              HTTP_IO_CALLBACK_EVENT happened.
    670   @param[in]  Context        The Context data which will be passed to the Callback function.
    671   @param[out] HttpIo         The HTTP_IO.
    672 
    673   @retval EFI_SUCCESS            The HTTP_IO is created and configured.
    674   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
    675   @retval EFI_UNSUPPORTED        One or more of the control options are not
    676                                  supported in the implementation.
    677   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
    678   @retval Others                 Failed to create the HTTP_IO or configure it.
    679 
    680 **/
    681 EFI_STATUS
    682 HttpIoCreateIo (
    683   IN EFI_HANDLE             Image,
    684   IN EFI_HANDLE             Controller,
    685   IN UINT8                  IpVersion,
    686   IN HTTP_IO_CONFIG_DATA    *ConfigData,
    687   IN HTTP_IO_CALLBACK       Callback,
    688   IN VOID                   *Context,
    689   OUT HTTP_IO               *HttpIo
    690   )
    691 {
    692   EFI_STATUS                Status;
    693   EFI_HTTP_CONFIG_DATA      HttpConfigData;
    694   EFI_HTTPv4_ACCESS_POINT   Http4AccessPoint;
    695   EFI_HTTPv6_ACCESS_POINT   Http6AccessPoint;
    696   EFI_HTTP_PROTOCOL         *Http;
    697   EFI_EVENT                 Event;
    698 
    699   if ((Image == NULL) || (Controller == NULL) || (ConfigData == NULL) || (HttpIo == NULL)) {
    700     return EFI_INVALID_PARAMETER;
    701   }
    702 
    703   if (IpVersion != IP_VERSION_4 && IpVersion != IP_VERSION_6) {
    704     return EFI_UNSUPPORTED;
    705   }
    706 
    707   ZeroMem (HttpIo, sizeof (HTTP_IO));
    708 
    709   //
    710   // Create the HTTP child instance and get the HTTP protocol.
    711   //
    712   Status = NetLibCreateServiceChild (
    713              Controller,
    714              Image,
    715              &gEfiHttpServiceBindingProtocolGuid,
    716              &HttpIo->Handle
    717              );
    718   if (EFI_ERROR (Status)) {
    719     return Status;
    720   }
    721 
    722   Status = gBS->OpenProtocol (
    723                   HttpIo->Handle,
    724                   &gEfiHttpProtocolGuid,
    725                   (VOID **) &Http,
    726                   Image,
    727                   Controller,
    728                   EFI_OPEN_PROTOCOL_BY_DRIVER
    729                   );
    730   if (EFI_ERROR (Status) || (Http == NULL)) {
    731     goto ON_ERROR;
    732   }
    733 
    734   //
    735   // Init the configuration data and configure the HTTP child.
    736   //
    737   HttpIo->Image       = Image;
    738   HttpIo->Controller  = Controller;
    739   HttpIo->IpVersion   = IpVersion;
    740   HttpIo->Http        = Http;
    741   HttpIo->Callback    = Callback;
    742   HttpIo->Context     = Context;
    743 
    744   ZeroMem (&HttpConfigData, sizeof (EFI_HTTP_CONFIG_DATA));
    745   HttpConfigData.HttpVersion        = HttpVersion11;
    746   HttpConfigData.TimeOutMillisec    = ConfigData->Config4.RequestTimeOut;
    747   if (HttpIo->IpVersion == IP_VERSION_4) {
    748     HttpConfigData.LocalAddressIsIPv6 = FALSE;
    749 
    750     Http4AccessPoint.UseDefaultAddress = ConfigData->Config4.UseDefaultAddress;
    751     Http4AccessPoint.LocalPort         = ConfigData->Config4.LocalPort;
    752     IP4_COPY_ADDRESS (&Http4AccessPoint.LocalAddress, &ConfigData->Config4.LocalIp);
    753     IP4_COPY_ADDRESS (&Http4AccessPoint.LocalSubnet, &ConfigData->Config4.SubnetMask);
    754     HttpConfigData.AccessPoint.IPv4Node = &Http4AccessPoint;
    755   } else {
    756     HttpConfigData.LocalAddressIsIPv6 = TRUE;
    757     Http6AccessPoint.LocalPort        = ConfigData->Config6.LocalPort;
    758     IP6_COPY_ADDRESS (&Http6AccessPoint.LocalAddress, &ConfigData->Config6.LocalIp);
    759     HttpConfigData.AccessPoint.IPv6Node = &Http6AccessPoint;
    760   }
    761 
    762   Status = Http->Configure (Http, &HttpConfigData);
    763   if (EFI_ERROR (Status)) {
    764     goto ON_ERROR;
    765   }
    766 
    767   //
    768   // Create events for various asynchronous operations.
    769   //
    770   Status = gBS->CreateEvent (
    771                   EVT_NOTIFY_SIGNAL,
    772                   TPL_NOTIFY,
    773                   HttpIoNotify,
    774                   &HttpIo->IsTxDone,
    775                   &Event
    776                   );
    777   if (EFI_ERROR (Status)) {
    778     goto ON_ERROR;
    779   }
    780   HttpIo->ReqToken.Event = Event;
    781   HttpIo->ReqToken.Message = &HttpIo->ReqMessage;
    782 
    783   Status = gBS->CreateEvent (
    784                   EVT_NOTIFY_SIGNAL,
    785                   TPL_NOTIFY,
    786                   HttpIoNotify,
    787                   &HttpIo->IsRxDone,
    788                   &Event
    789                   );
    790   if (EFI_ERROR (Status)) {
    791     goto ON_ERROR;
    792   }
    793   HttpIo->RspToken.Event = Event;
    794   HttpIo->RspToken.Message = &HttpIo->RspMessage;
    795 
    796   //
    797   // Create TimeoutEvent for response
    798   //
    799   Status = gBS->CreateEvent (
    800                   EVT_TIMER,
    801                   TPL_CALLBACK,
    802                   NULL,
    803                   NULL,
    804                   &Event
    805                   );
    806   if (EFI_ERROR (Status)) {
    807     goto ON_ERROR;
    808   }
    809   HttpIo->TimeoutEvent = Event;
    810 
    811   return EFI_SUCCESS;
    812 
    813 ON_ERROR:
    814   HttpIoDestroyIo (HttpIo);
    815 
    816   return Status;
    817 }
    818 
    819 /**
    820   Destroy the HTTP_IO and release the resources.
    821 
    822   @param[in]  HttpIo          The HTTP_IO which wraps the HTTP service to be destroyed.
    823 
    824 **/
    825 VOID
    826 HttpIoDestroyIo (
    827   IN HTTP_IO                *HttpIo
    828   )
    829 {
    830   EFI_HTTP_PROTOCOL         *Http;
    831   EFI_EVENT                 Event;
    832 
    833   if (HttpIo == NULL) {
    834     return;
    835   }
    836 
    837   Event = HttpIo->ReqToken.Event;
    838   if (Event != NULL) {
    839     gBS->CloseEvent (Event);
    840   }
    841 
    842   Event = HttpIo->RspToken.Event;
    843   if (Event != NULL) {
    844     gBS->CloseEvent (Event);
    845   }
    846 
    847   Event = HttpIo->TimeoutEvent;
    848   if (Event != NULL) {
    849     gBS->CloseEvent (Event);
    850   }
    851 
    852   Http = HttpIo->Http;
    853   if (Http != NULL) {
    854     Http->Configure (Http, NULL);
    855     gBS->CloseProtocol (
    856            HttpIo->Handle,
    857            &gEfiHttpProtocolGuid,
    858            HttpIo->Image,
    859            HttpIo->Controller
    860            );
    861   }
    862 
    863   NetLibDestroyServiceChild (
    864     HttpIo->Controller,
    865     HttpIo->Image,
    866     &gEfiHttpServiceBindingProtocolGuid,
    867     HttpIo->Handle
    868     );
    869 }
    870 
    871 /**
    872   Synchronously send a HTTP REQUEST message to the server.
    873 
    874   @param[in]   HttpIo           The HttpIo wrapping the HTTP service.
    875   @param[in]   Request          A pointer to storage such data as URL and HTTP method.
    876   @param[in]   HeaderCount      Number of HTTP header structures in Headers list.
    877   @param[in]   Headers          Array containing list of HTTP headers.
    878   @param[in]   BodyLength       Length in bytes of the HTTP body.
    879   @param[in]   Body             Body associated with the HTTP request.
    880 
    881   @retval EFI_SUCCESS            The HTTP request is transmitted.
    882   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
    883   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
    884   @retval EFI_DEVICE_ERROR       An unexpected network or system error occurred.
    885   @retval Others                 Other errors as indicated.
    886 
    887 **/
    888 EFI_STATUS
    889 HttpIoSendRequest (
    890   IN  HTTP_IO                *HttpIo,
    891   IN  EFI_HTTP_REQUEST_DATA  *Request,
    892   IN  UINTN                  HeaderCount,
    893   IN  EFI_HTTP_HEADER        *Headers,
    894   IN  UINTN                  BodyLength,
    895   IN  VOID                   *Body
    896   )
    897 {
    898   EFI_STATUS                 Status;
    899   EFI_HTTP_PROTOCOL          *Http;
    900 
    901   if (HttpIo == NULL || HttpIo->Http == NULL) {
    902     return EFI_INVALID_PARAMETER;
    903   }
    904 
    905   HttpIo->ReqToken.Status  = EFI_NOT_READY;
    906   HttpIo->ReqToken.Message->Data.Request = Request;
    907   HttpIo->ReqToken.Message->HeaderCount  = HeaderCount;
    908   HttpIo->ReqToken.Message->Headers      = Headers;
    909   HttpIo->ReqToken.Message->BodyLength   = BodyLength;
    910   HttpIo->ReqToken.Message->Body         = Body;
    911 
    912   if (HttpIo->Callback != NULL) {
    913     Status = HttpIo->Callback (
    914                HttpIoRequest,
    915                HttpIo->ReqToken.Message,
    916                HttpIo->Context
    917                );
    918     if (EFI_ERROR (Status)) {
    919       return Status;
    920     }
    921   }
    922 
    923   //
    924   // Queue the request token to HTTP instances.
    925   //
    926   Http = HttpIo->Http;
    927   HttpIo->IsTxDone = FALSE;
    928   Status = Http->Request (
    929                    Http,
    930                    &HttpIo->ReqToken
    931                    );
    932   if (EFI_ERROR (Status)) {
    933     return Status;
    934   }
    935 
    936   //
    937   // Poll the network until transmit finish.
    938   //
    939   while (!HttpIo->IsTxDone) {
    940     Http->Poll (Http);
    941   }
    942 
    943   return HttpIo->ReqToken.Status;
    944 }
    945 
    946 /**
    947   Synchronously receive a HTTP RESPONSE message from the server.
    948 
    949   @param[in]   HttpIo           The HttpIo wrapping the HTTP service.
    950   @param[in]   RecvMsgHeader    TRUE to receive a new HTTP response (from message header).
    951                                 FALSE to continue receive the previous response message.
    952   @param[out]  ResponseData     Point to a wrapper of the received response data.
    953 
    954   @retval EFI_SUCCESS            The HTTP response is received.
    955   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
    956   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
    957   @retval EFI_DEVICE_ERROR       An unexpected network or system error occurred.
    958   @retval Others                 Other errors as indicated.
    959 
    960 **/
    961 EFI_STATUS
    962 HttpIoRecvResponse (
    963   IN      HTTP_IO                  *HttpIo,
    964   IN      BOOLEAN                  RecvMsgHeader,
    965      OUT  HTTP_IO_RESPONSE_DATA    *ResponseData
    966   )
    967 {
    968   EFI_STATUS                 Status;
    969   EFI_HTTP_PROTOCOL          *Http;
    970 
    971   if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) {
    972     return EFI_INVALID_PARAMETER;
    973   }
    974 
    975   //
    976   // Start the timer, and wait Timeout seconds to receive the header packet.
    977   //
    978   Status = gBS->SetTimer (HttpIo->TimeoutEvent, TimerRelative, HTTP_BOOT_RESPONSE_TIMEOUT * TICKS_PER_MS);
    979   if (EFI_ERROR (Status)) {
    980     return Status;
    981   }
    982 
    983   //
    984   // Queue the response token to HTTP instances.
    985   //
    986   HttpIo->RspToken.Status  = EFI_NOT_READY;
    987   if (RecvMsgHeader) {
    988     HttpIo->RspToken.Message->Data.Response = &ResponseData->Response;
    989   } else {
    990     HttpIo->RspToken.Message->Data.Response = NULL;
    991   }
    992   HttpIo->RspToken.Message->HeaderCount   = 0;
    993   HttpIo->RspToken.Message->Headers       = NULL;
    994   HttpIo->RspToken.Message->BodyLength    = ResponseData->BodyLength;
    995   HttpIo->RspToken.Message->Body          = ResponseData->Body;
    996 
    997   Http = HttpIo->Http;
    998   HttpIo->IsRxDone = FALSE;
    999   Status = Http->Response (
    1000                    Http,
    1001                    &HttpIo->RspToken
    1002                    );
    1003 
    1004   if (EFI_ERROR (Status)) {
    1005     gBS->SetTimer (HttpIo->TimeoutEvent, TimerCancel, 0);
    1006     return Status;
    1007   }
    1008 
    1009   //
    1010   // Poll the network until receive finish.
    1011   //
    1012   while (!HttpIo->IsRxDone && ((HttpIo->TimeoutEvent == NULL) || EFI_ERROR (gBS->CheckEvent (HttpIo->TimeoutEvent)))) {
    1013     Http->Poll (Http);
    1014   }
    1015 
    1016   gBS->SetTimer (HttpIo->TimeoutEvent, TimerCancel, 0);
    1017 
    1018   if (!HttpIo->IsRxDone) {
    1019     //
    1020     // Timeout occurs, cancel the response token.
    1021     //
    1022     Http->Cancel (Http, &HttpIo->RspToken);
    1023 
    1024     Status = EFI_TIMEOUT;
    1025 
    1026     return Status;
    1027   } else {
    1028     HttpIo->IsRxDone = FALSE;
    1029   }
    1030 
    1031   if ((HttpIo->Callback != NULL) &&
    1032       (HttpIo->RspToken.Status == EFI_SUCCESS || HttpIo->RspToken.Status == EFI_HTTP_ERROR)) {
    1033     Status = HttpIo->Callback (
    1034                HttpIoResponse,
    1035                HttpIo->RspToken.Message,
    1036                HttpIo->Context
    1037                );
    1038     if (EFI_ERROR (Status)) {
    1039       return Status;
    1040     }
    1041   }
    1042 
    1043   //
    1044   // Store the received data into the wrapper.
    1045   //
    1046   ResponseData->Status = HttpIo->RspToken.Status;
    1047   ResponseData->HeaderCount = HttpIo->RspToken.Message->HeaderCount;
    1048   ResponseData->Headers     = HttpIo->RspToken.Message->Headers;
    1049   ResponseData->BodyLength  = HttpIo->RspToken.Message->BodyLength;
    1050491
    1051492  return Status;
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpBootDxe/HttpBootSupport.h

    r85718 r89983  
    33
    44Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.<BR>
     5(C) Copyright 2020 Hewlett-Packard Development Company, L.P.<BR>
    56SPDX-License-Identifier: BSD-2-Clause-Patent
    67
     
    8788  );
    8889
    89 //
    90 // A wrapper structure to hold the HTTP headers.
    91 //
    92 typedef struct {
    93   UINTN                       MaxHeaderCount;
    94   UINTN                       HeaderCount;
    95   EFI_HTTP_HEADER             *Headers;
    96 } HTTP_IO_HEADER;
    97 
    98 /**
    99   Create a HTTP_IO_HEADER to hold the HTTP header items.
    100 
    101   @param[in]  MaxHeaderCount         The maximum number of HTTP header in this holder.
    102 
    103   @return    A pointer of the HTTP header holder or NULL if failed.
    104 
    105 **/
    106 HTTP_IO_HEADER *
    107 HttpBootCreateHeader (
    108   IN  UINTN                MaxHeaderCount
    109   );
    110 
    111 /**
    112   Destroy the HTTP_IO_HEADER and release the resources.
    113 
    114   @param[in]  HttpIoHeader       Point to the HTTP header holder to be destroyed.
    115 
    116 **/
    117 VOID
    118 HttpBootFreeHeader (
    119   IN  HTTP_IO_HEADER       *HttpIoHeader
    120   );
    121 
    122 /**
    123   Set or update a HTTP header with the field name and corresponding value.
    124 
    125   @param[in]  HttpIoHeader       Point to the HTTP header holder.
    126   @param[in]  FieldName          Null terminated string which describes a field name.
    127   @param[in]  FieldValue         Null terminated string which describes the corresponding field value.
    128 
    129   @retval  EFI_SUCCESS           The HTTP header has been set or updated.
    130   @retval  EFI_INVALID_PARAMETER Any input parameter is invalid.
    131   @retval  EFI_OUT_OF_RESOURCES  Insufficient resource to complete the operation.
    132   @retval  Other                 Unexpected error happened.
    133 
    134 **/
    135 EFI_STATUS
    136 HttpBootSetHeader (
    137   IN  HTTP_IO_HEADER       *HttpIoHeader,
    138   IN  CHAR8                *FieldName,
    139   IN  CHAR8                *FieldValue
    140   );
    141 
    142 ///
    143 /// HTTP_IO_CALLBACK_EVENT
    144 ///
    145 typedef enum {
    146   HttpIoRequest,
    147   HttpIoResponse
    148 } HTTP_IO_CALLBACK_EVENT;
    149 
    150 /**
    151   HttpIo Callback function which will be invoked when specified HTTP_IO_CALLBACK_EVENT happened.
    152 
    153   @param[in]    EventType      Indicate the Event type that occurs in the current callback.
    154   @param[in]    Message        HTTP message which will be send to, or just received from HTTP server.
    155   @param[in]    Context        The Callback Context pointer.
    156 
    157   @retval EFI_SUCCESS          Tells the HttpIo to continue the HTTP process.
    158   @retval Others               Tells the HttpIo to abort the current HTTP process.
    159 **/
    160 typedef
    161 EFI_STATUS
    162 (EFIAPI * HTTP_IO_CALLBACK) (
    163   IN  HTTP_IO_CALLBACK_EVENT    EventType,
    164   IN  EFI_HTTP_MESSAGE          *Message,
    165   IN  VOID                      *Context
    166   );
    167 
    168 //
    169 // HTTP_IO configuration data for IPv4
    170 //
    171 typedef struct {
    172   EFI_HTTP_VERSION          HttpVersion;
    173   UINT32                    RequestTimeOut;  // In milliseconds.
    174   UINT32                    ResponseTimeOut; // In milliseconds.
    175   BOOLEAN                   UseDefaultAddress;
    176   EFI_IPv4_ADDRESS          LocalIp;
    177   EFI_IPv4_ADDRESS          SubnetMask;
    178   UINT16                    LocalPort;
    179 } HTTP4_IO_CONFIG_DATA;
    180 
    181 //
    182 // HTTP_IO configuration data for IPv6
    183 //
    184 typedef struct {
    185   EFI_HTTP_VERSION          HttpVersion;
    186   UINT32                    RequestTimeOut;  // In milliseconds.
    187   BOOLEAN                   UseDefaultAddress;
    188   EFI_IPv6_ADDRESS          LocalIp;
    189   UINT16                    LocalPort;
    190 } HTTP6_IO_CONFIG_DATA;
    191 
    192 
    193 //
    194 // HTTP_IO configuration
    195 //
    196 typedef union {
    197   HTTP4_IO_CONFIG_DATA       Config4;
    198   HTTP6_IO_CONFIG_DATA       Config6;
    199 } HTTP_IO_CONFIG_DATA;
    200 
    201 //
    202 // HTTP_IO wrapper of the EFI HTTP service.
    203 //
    204 typedef struct {
    205   UINT8                     IpVersion;
    206   EFI_HANDLE                Image;
    207   EFI_HANDLE                Controller;
    208   EFI_HANDLE                Handle;
    209 
    210   EFI_HTTP_PROTOCOL         *Http;
    211 
    212   HTTP_IO_CALLBACK          Callback;
    213   VOID                      *Context;
    214 
    215   EFI_HTTP_TOKEN            ReqToken;
    216   EFI_HTTP_MESSAGE          ReqMessage;
    217   EFI_HTTP_TOKEN            RspToken;
    218   EFI_HTTP_MESSAGE          RspMessage;
    219 
    220   BOOLEAN                   IsTxDone;
    221   BOOLEAN                   IsRxDone;
    222 
    223   EFI_EVENT                 TimeoutEvent;
    224 } HTTP_IO;
    225 
    226 //
    227 // A wrapper structure to hold the received HTTP response data.
    228 //
    229 typedef struct {
    230   EFI_HTTP_RESPONSE_DATA      Response;
    231   UINTN                       HeaderCount;
    232   EFI_HTTP_HEADER             *Headers;
    233   UINTN                       BodyLength;
    234   CHAR8                       *Body;
    235   EFI_STATUS                  Status;
    236 } HTTP_IO_RESPONSE_DATA;
    237 
    23890/**
    23991  Retrieve the host address using the EFI_DNS6_PROTOCOL.
     
    266118  IN EFI_EVENT           Event,
    267119  IN VOID                *Context
    268   );
    269 
    270 /**
    271   Create a HTTP_IO to access the HTTP service. It will create and configure
    272   a HTTP child handle.
    273 
    274   @param[in]  Image          The handle of the driver image.
    275   @param[in]  Controller     The handle of the controller.
    276   @param[in]  IpVersion      IP_VERSION_4 or IP_VERSION_6.
    277   @param[in]  ConfigData     The HTTP_IO configuration data.
    278   @param[in]  Callback       Callback function which will be invoked when specified
    279                              HTTP_IO_CALLBACK_EVENT happened.
    280   @param[in]  Context        The Context data which will be passed to the Callback function.
    281   @param[out] HttpIo         The HTTP_IO.
    282 
    283   @retval EFI_SUCCESS            The HTTP_IO is created and configured.
    284   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
    285   @retval EFI_UNSUPPORTED        One or more of the control options are not
    286                                  supported in the implementation.
    287   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
    288   @retval Others                 Failed to create the HTTP_IO or configure it.
    289 
    290 **/
    291 EFI_STATUS
    292 HttpIoCreateIo (
    293   IN EFI_HANDLE             Image,
    294   IN EFI_HANDLE             Controller,
    295   IN UINT8                  IpVersion,
    296   IN HTTP_IO_CONFIG_DATA    *ConfigData,
    297   IN HTTP_IO_CALLBACK       Callback,
    298   IN VOID                   *Context,
    299   OUT HTTP_IO               *HttpIo
    300   );
    301 
    302 /**
    303   Destroy the HTTP_IO and release the resources.
    304 
    305   @param[in]  HttpIo          The HTTP_IO which wraps the HTTP service to be destroyed.
    306 
    307 **/
    308 VOID
    309 HttpIoDestroyIo (
    310   IN HTTP_IO                *HttpIo
    311   );
    312 
    313 /**
    314   Synchronously send a HTTP REQUEST message to the server.
    315 
    316   @param[in]   HttpIo           The HttpIo wrapping the HTTP service.
    317   @param[in]   Request          A pointer to storage such data as URL and HTTP method.
    318   @param[in]   HeaderCount      Number of HTTP header structures in Headers list.
    319   @param[in]   Headers          Array containing list of HTTP headers.
    320   @param[in]   BodyLength       Length in bytes of the HTTP body.
    321   @param[in]   Body             Body associated with the HTTP request.
    322 
    323   @retval EFI_SUCCESS            The HTTP request is transmitted.
    324   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
    325   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
    326   @retval EFI_DEVICE_ERROR       An unexpected network or system error occurred.
    327   @retval Others                 Other errors as indicated.
    328 
    329 **/
    330 EFI_STATUS
    331 HttpIoSendRequest (
    332   IN  HTTP_IO                *HttpIo,
    333   IN  EFI_HTTP_REQUEST_DATA  *Request,      OPTIONAL
    334   IN  UINTN                  HeaderCount,
    335   IN  EFI_HTTP_HEADER        *Headers,      OPTIONAL
    336   IN  UINTN                  BodyLength,
    337   IN  VOID                   *Body          OPTIONAL
    338   );
    339 
    340 /**
    341   Synchronously receive a HTTP RESPONSE message from the server.
    342 
    343   @param[in]   HttpIo           The HttpIo wrapping the HTTP service.
    344   @param[in]   RecvMsgHeader    TRUE to receive a new HTTP response (from message header).
    345                                 FALSE to continue receive the previous response message.
    346   @param[out]  ResponseData     Point to a wrapper of the received response data.
    347 
    348   @retval EFI_SUCCESS            The HTTP response is received.
    349   @retval EFI_INVALID_PARAMETER  One or more parameters are invalid.
    350   @retval EFI_OUT_OF_RESOURCES   Failed to allocate memory.
    351   @retval EFI_DEVICE_ERROR       An unexpected network or system error occurred.
    352   @retval Others                 Other errors as indicated.
    353 
    354 **/
    355 EFI_STATUS
    356 HttpIoRecvResponse (
    357   IN      HTTP_IO                  *HttpIo,
    358   IN      BOOLEAN                  RecvMsgHeader,
    359      OUT  HTTP_IO_RESPONSE_DATA    *ResponseData
    360120  );
    361121
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/HttpDxe/HttpProto.c

    r85718 r89983  
    874874    //
    875875    HttpInstance->TlsSb->DestroyChild (HttpInstance->TlsSb, HttpInstance->TlsChildHandle);
     876    HttpInstance->TlsChildHandle = NULL;
    876877  }
    877878
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Include/Library/HttpLib.h

    r85718 r89983  
    477477  );
    478478
     479//
     480// A wrapper structure to hold the HTTP headers.
     481//
     482typedef struct {
     483  UINTN                       MaxHeaderCount;
     484  UINTN                       HeaderCount;
     485  EFI_HTTP_HEADER             *Headers;
     486} HTTP_IO_HEADER;
     487
     488
     489/**
     490  Create a HTTP_IO_HEADER to hold the HTTP header items.
     491
     492  @param[in]  MaxHeaderCount         The maximun number of HTTP header in this holder.
     493
     494  @return    A pointer of the HTTP header holder or NULL if failed.
     495
     496**/
     497HTTP_IO_HEADER *
     498HttpIoCreateHeader (
     499  UINTN                     MaxHeaderCount
     500  );
     501
     502/**
     503  Destroy the HTTP_IO_HEADER and release the resources.
     504
     505  @param[in]  HttpIoHeader       Point to the HTTP header holder to be destroyed.
     506
     507**/
     508VOID
     509HttpIoFreeHeader (
     510  IN  HTTP_IO_HEADER       *HttpIoHeader
     511  );
     512
     513/**
     514  Set or update a HTTP header with the field name and corresponding value.
     515
     516  @param[in]  HttpIoHeader       Point to the HTTP header holder.
     517  @param[in]  FieldName          Null terminated string which describes a field name.
     518  @param[in]  FieldValue         Null terminated string which describes the corresponding field value.
     519
     520  @retval  EFI_SUCCESS           The HTTP header has been set or updated.
     521  @retval  EFI_INVALID_PARAMETER Any input parameter is invalid.
     522  @retval  EFI_OUT_OF_RESOURCES  Insufficient resource to complete the operation.
     523  @retval  Other                 Unexpected error happened.
     524
     525**/
     526EFI_STATUS
     527HttpIoSetHeader (
     528  IN  HTTP_IO_HEADER       *HttpIoHeader,
     529  IN  CHAR8                *FieldName,
     530  IN  CHAR8                *FieldValue
     531  );
    479532
    480533#endif
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Library/DxeHttpLib/DxeHttpLib.c

    r85718 r89983  
    44
    55Copyright (c) 2015 - 2019, Intel Corporation. All rights reserved.<BR>
    6 (C) Copyright 2016 Hewlett Packard Enterprise Development LP<BR>
     6(C) Copyright 2016 - 2020  Hewlett Packard Enterprise Development LP<BR>
    77SPDX-License-Identifier: BSD-2-Clause-Patent
    88
     
    11231123  UINTN                 RemainderLengthInThis;
    11241124  UINTN                 LengthForCallback;
     1125  UINTN                 PortionLength;
    11251126  EFI_STATUS            Status;
    11261127  HTTP_BODY_PARSER      *Parser;
     
    11741175      // Identity transfer-coding, just notify user to save the body data.
    11751176      //
     1177      PortionLength = MIN (
     1178                        BodyLength,
     1179                        Parser->ContentLength - Parser->ParsedBodyLength
     1180                        );
     1181      if (PortionLength == 0) {
     1182        //
     1183        // Got BodyLength, but no ContentLength. Use BodyLength.
     1184        //
     1185        PortionLength = BodyLength;
     1186        Parser->ContentLength = PortionLength;
     1187      }
     1188
    11761189      if (Parser->Callback != NULL) {
    11771190        Status = Parser->Callback (
    11781191                           BodyParseEventOnData,
    11791192                           Char,
    1180                            MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength),
     1193                           PortionLength,
    11811194                           Parser->Context
    11821195                           );
     
    11851198        }
    11861199      }
    1187       Char += MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength);
    1188       Parser->ParsedBodyLength += MIN (BodyLength, Parser->ContentLength - Parser->ParsedBodyLength);
     1200      Char += PortionLength;
     1201      Parser->ParsedBodyLength += PortionLength;
    11891202      if (Parser->ParsedBodyLength == Parser->ContentLength) {
    11901203        Parser->State = BodyParserComplete;
     
    20832096}
    20842097
     2098
     2099/**
     2100  Create a HTTP_IO_HEADER to hold the HTTP header items.
     2101
     2102  @param[in]  MaxHeaderCount         The maximun number of HTTP header in this holder.
     2103
     2104  @return    A pointer of the HTTP header holder or NULL if failed.
     2105
     2106**/
     2107HTTP_IO_HEADER *
     2108HttpIoCreateHeader (
     2109  UINTN                     MaxHeaderCount
     2110  )
     2111{
     2112  HTTP_IO_HEADER        *HttpIoHeader;
     2113
     2114  if (MaxHeaderCount == 0) {
     2115    return NULL;
     2116  }
     2117
     2118  HttpIoHeader = AllocateZeroPool (sizeof (HTTP_IO_HEADER) + MaxHeaderCount * sizeof (EFI_HTTP_HEADER));
     2119  if (HttpIoHeader == NULL) {
     2120    return NULL;
     2121  }
     2122
     2123  HttpIoHeader->MaxHeaderCount = MaxHeaderCount;
     2124  HttpIoHeader->Headers = (EFI_HTTP_HEADER *) (HttpIoHeader + 1);
     2125
     2126  return HttpIoHeader;
     2127}
     2128
     2129/**
     2130  Destroy the HTTP_IO_HEADER and release the resources.
     2131
     2132  @param[in]  HttpIoHeader       Point to the HTTP header holder to be destroyed.
     2133
     2134**/
     2135VOID
     2136HttpIoFreeHeader (
     2137  IN  HTTP_IO_HEADER       *HttpIoHeader
     2138  )
     2139{
     2140  UINTN      Index;
     2141
     2142  if (HttpIoHeader != NULL) {
     2143    if (HttpIoHeader->HeaderCount != 0) {
     2144      for (Index = 0; Index < HttpIoHeader->HeaderCount; Index++) {
     2145        FreePool (HttpIoHeader->Headers[Index].FieldName);
     2146        ZeroMem (HttpIoHeader->Headers[Index].FieldValue, AsciiStrSize (HttpIoHeader->Headers[Index].FieldValue));
     2147        FreePool (HttpIoHeader->Headers[Index].FieldValue);
     2148      }
     2149    }
     2150    FreePool (HttpIoHeader);
     2151  }
     2152}
     2153
     2154/**
     2155  Set or update a HTTP header with the field name and corresponding value.
     2156
     2157  @param[in]  HttpIoHeader       Point to the HTTP header holder.
     2158  @param[in]  FieldName          Null terminated string which describes a field name.
     2159  @param[in]  FieldValue         Null terminated string which describes the corresponding field value.
     2160
     2161  @retval  EFI_SUCCESS           The HTTP header has been set or updated.
     2162  @retval  EFI_INVALID_PARAMETER Any input parameter is invalid.
     2163  @retval  EFI_OUT_OF_RESOURCES  Insufficient resource to complete the operation.
     2164  @retval  Other                 Unexpected error happened.
     2165
     2166**/
     2167EFI_STATUS
     2168HttpIoSetHeader (
     2169  IN  HTTP_IO_HEADER       *HttpIoHeader,
     2170  IN  CHAR8                *FieldName,
     2171  IN  CHAR8                *FieldValue
     2172  )
     2173{
     2174  EFI_HTTP_HEADER       *Header;
     2175  UINTN                 StrSize;
     2176  CHAR8                 *NewFieldValue;
     2177
     2178  if (HttpIoHeader == NULL || FieldName == NULL || FieldValue == NULL) {
     2179    return EFI_INVALID_PARAMETER;
     2180  }
     2181
     2182  Header = HttpFindHeader (HttpIoHeader->HeaderCount, HttpIoHeader->Headers, FieldName);
     2183  if (Header == NULL) {
     2184    //
     2185    // Add a new header.
     2186    //
     2187    if (HttpIoHeader->HeaderCount >= HttpIoHeader->MaxHeaderCount) {
     2188      return EFI_OUT_OF_RESOURCES;
     2189    }
     2190    Header = &HttpIoHeader->Headers[HttpIoHeader->HeaderCount];
     2191
     2192    StrSize = AsciiStrSize (FieldName);
     2193    Header->FieldName = AllocatePool (StrSize);
     2194    if (Header->FieldName == NULL) {
     2195      return EFI_OUT_OF_RESOURCES;
     2196    }
     2197    CopyMem (Header->FieldName, FieldName, StrSize);
     2198    Header->FieldName[StrSize -1] = '\0';
     2199
     2200    StrSize = AsciiStrSize (FieldValue);
     2201    Header->FieldValue = AllocatePool (StrSize);
     2202    if (Header->FieldValue == NULL) {
     2203      FreePool (Header->FieldName);
     2204      return EFI_OUT_OF_RESOURCES;
     2205    }
     2206    CopyMem (Header->FieldValue, FieldValue, StrSize);
     2207    Header->FieldValue[StrSize -1] = '\0';
     2208
     2209    HttpIoHeader->HeaderCount++;
     2210  } else {
     2211    //
     2212    // Update an existing one.
     2213    //
     2214    StrSize = AsciiStrSize (FieldValue);
     2215    NewFieldValue = AllocatePool (StrSize);
     2216    if (NewFieldValue == NULL) {
     2217      return EFI_OUT_OF_RESOURCES;
     2218    }
     2219    CopyMem (NewFieldValue, FieldValue, StrSize);
     2220    NewFieldValue[StrSize -1] = '\0';
     2221
     2222    if (Header->FieldValue != NULL) {
     2223      FreePool (Header->FieldValue);
     2224    }
     2225    Header->FieldValue = NewFieldValue;
     2226  }
     2227
     2228  return EFI_SUCCESS;
     2229}
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Network.dsc.inc

    r85718 r89983  
    88# IA32 PEI and X64 DXE platform. Its default value is FALSE.
    99#
    10 # Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
     10# Copyright (c) 2019 - 2020, Intel Corporation. All rights reserved.<BR>
    1111# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    1212#
     
    3131!include NetworkPkg/NetworkLibs.dsc.inc
    3232
     33[BuildOptions]
     34!include NetworkPkg/NetworkBuildOptions.dsc.inc
     35
    3336!if $(PLATFORMX64_ENABLE) == TRUE
    3437[Components.X64]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/Network.fdf.inc

    r80721 r89983  
    4747  !endif
    4848
    49   !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
     49  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) OR ($(NETWORK_HTTP_ENABLE) == TRUE)
    5050    INF  NetworkPkg/DnsDxe/DnsDxe.inf
    5151    INF  NetworkPkg/HttpDxe/HttpDxe.inf
    5252    INF  NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
     53  !endif
     54
     55  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
    5356    INF  NetworkPkg/HttpBootDxe/HttpBootDxe.inf
    5457  !endif
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/NetworkComponents.dsc.inc

    r80721 r89983  
    4949  !endif
    5050
    51   !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
     51  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) OR ($(NETWORK_HTTP_ENABLE) == TRUE)
    5252    NetworkPkg/DnsDxe/DnsDxe.inf
    5353    NetworkPkg/HttpDxe/HttpDxe.inf
    5454    NetworkPkg/HttpUtilitiesDxe/HttpUtilitiesDxe.inf
     55  !endif
     56
     57  !if $(NETWORK_HTTP_BOOT_ENABLE) == TRUE
    5558    NetworkPkg/HttpBootDxe/HttpBootDxe.inf
    5659  !endif
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/NetworkDefines.dsc.inc

    r80721 r89983  
    1616#   DEFINE NETWORK_IP6_ENABLE             = TRUE
    1717#   DEFINE NETWORK_TLS_ENABLE             = TRUE
     18#   DEFINE NETWORK_HTTP_ENABLE            = FALSE
    1819#   DEFINE NETWORK_HTTP_BOOT_ENABLE       = TRUE
    1920#   DEFINE NETWORK_ALLOW_HTTP_CONNECTIONS = FALSE
    20 #   DEFINE NETWORK_ISCSI_ENABLE           = TRUE
     21#   DEFINE NETWORK_ISCSI_ENABLE           = FALSE
    2122#   DEFINE NETWORK_VLAN_ENABLE            = TRUE
    2223#
    2324# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
     25# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
    2426#
    2527#    SPDX-License-Identifier: BSD-2-Clause-Patent
     
    7476!endif
    7577
     78!ifndef NETWORK_HTTP_ENABLE
     79  #
     80  # This flag is to enable or disable HTTP(S) feature.
     81  # The default is set to FALSE to not affecting the existing
     82  # platforms.
     83  # NETWORK_HTTP_ENABLE set to FALSE is not affecting NETWORK_HTTP_BOOT_ENABLE
     84  # when NETWORK_HTTP_BOOT_ENABLE is TRUE.
     85  DEFINE NETWORK_HTTP_ENABLE = FALSE
     86!endif
     87
    7688!ifndef NETWORK_HTTP_BOOT_ENABLE
    7789  #
    7890  # This flag is to enable or disable HTTP(S) boot feature.
     91  #
    7992  #
    8093  DEFINE NETWORK_HTTP_BOOT_ENABLE = TRUE
     
    102115  #       since libssl is not required for iSCSI.
    103116  #
    104   DEFINE NETWORK_ISCSI_ENABLE = TRUE
     117  DEFINE NETWORK_ISCSI_ENABLE = FALSE
    105118!endif
    106119
     
    113126  !endif
    114127
    115   !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) AND ($(NETWORK_TLS_ENABLE) == FALSE) AND ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
    116     !error "Must enable TLS to support HTTPS, or allow unsecured HTTP connection, if NETWORK_HTTP_BOOT_ENABLE is set to TRUE!"
     128  !if ($(NETWORK_HTTP_BOOT_ENABLE) == TRUE) OR ($(NETWORK_HTTP_ENABLE) == TRUE)
     129    !if ($(NETWORK_TLS_ENABLE) == FALSE) AND ($(NETWORK_ALLOW_HTTP_CONNECTIONS) == FALSE)
     130      !error "Must enable TLS to support HTTPS, or allow unsecured HTTP connection, if NETWORK_HTTP_BOOT_ENABLE or NETWORK_HTTP_ENABLE is set to TRUE!"
     131    !endif
    117132  !endif
    118133!endif
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/NetworkLibs.dsc.inc

    r80721 r89983  
    77#
    88# Copyright (c) 2019, Intel Corporation. All rights reserved.<BR>
     9# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
    910#
    1011#    SPDX-License-Identifier: BSD-2-Clause-Patent
     
    1718  UdpIoLib|NetworkPkg/Library/DxeUdpIoLib/DxeUdpIoLib.inf
    1819  TcpIoLib|NetworkPkg/Library/DxeTcpIoLib/DxeTcpIoLib.inf
    19   # HttpLib is used for Http Boot
     20  # HttpLib and HttpIoLib are used for Http Boot and other
     21  # HTTP applications.
    2022  HttpLib|NetworkPkg/Library/DxeHttpLib/DxeHttpLib.inf
     23  HttpIoLib|NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/NetworkPkg.ci.yaml

    r85718 r89983  
    33#
    44# Copyright (c) Microsoft Corporation
     5# Copyright (c) 2020, Intel Corporation. All rights reserved.<BR>
     6# (C) Copyright 2020 Hewlett Packard Enterprise Development LP<BR>
    57# SPDX-License-Identifier: BSD-2-Clause-Patent
    68##
    79{
     10    "LicenseCheck": {
     11        "IgnoreFiles": []
     12    },
     13    "EccCheck": {
     14        ## Exception sample looks like below:
     15        ## "ExceptionList": [
     16        ##     "<ErrorID>", "<KeyWord>"
     17        ## ]
     18        "ExceptionList": [
     19        ],
     20        ## Both file path and directory path are accepted.
     21        "IgnoreFiles": [
     22        ]
     23    },
    824    "CompilerPlugin": {
    925        "DscPath": "NetworkPkg.dsc"
     
    5773        "BLD_*_NETWORK_IP6_ENABLE": "TRUE",
    5874        "BLD_*_NETWORK_TLS_ENABLE": "TRUE",
     75        "BLD_*_NETWORK_HTTP_ENABLE": "FALSE",
    5976        "BLD_*_NETWORK_HTTP_BOOT_ENABLE": "TRUE",
    6077        "BLD_*_NETWORK_ISCSI_ENABLE": "TRUE",
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/NetworkPkg.dec

    r85718 r89983  
    44# This package provides network modules that conform to UEFI 2.4 specification.
    55#
    6 # Copyright (c) 2009 - 2019, Intel Corporation. All rights reserved.<BR>
    7 # (C) Copyright 2015-2017 Hewlett Packard Enterprise Development LP<BR>
     6# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
     7# (C) Copyright 2015-2020 Hewlett Packard Enterprise Development LP<BR>
    88#
    99# SPDX-License-Identifier: BSD-2-Clause-Patent
     
    4141  #   This library is only intended to be used by UEFI network stack modules.
    4242  HttpLib|Include/Library/HttpLib.h
     43
     44  ##  @libraryclass  Http IO helper routines for HTTP transfer.
     45  #   This library is only intended to be used by UEFI network stack modules.
     46  HttpIoLib|Include/Library/HttpIoLib.h
    4347
    4448  ##  @libraryclass  Library for Deferred Procedure Calls.
     
    8993  # @Prompt Max attempt number.
    9094  gEfiNetworkPkgTokenSpaceGuid.PcdMaxIScsiAttemptNumber|0x08|UINT8|0x0000000D
     95
     96  ## The maximum size of total HTTP chunk transfer.
     97  # @Prompt Max size of total HTTP chunk transfer. the default value is 12MB.
     98  gEfiNetworkPkgTokenSpaceGuid.PcdMaxHttpChunkTransfer|0x0C00000|UINT32|0x0000000E
     99
     100  ## The Timeout value of HTTP IO.
     101  # @Prompt The Timeout value of HTTP Io. Default value is 5000.
     102  gEfiNetworkPkgTokenSpaceGuid.PcdHttpIoTimeout|5000|UINT32|0x0000000F
    91103
    92104[PcdsFixedAtBuild, PcdsPatchableInModule]
  • trunk/src/VBox/Devices/EFI/FirmwareNew/NetworkPkg/NetworkPkg.dsc

    r85718 r89983  
    33#
    44# (C) Copyright 2014 Hewlett-Packard Development Company, L.P.<BR>
    5 # Copyright (c) 2009 - 2018, Intel Corporation. All rights reserved.<BR>
     5# Copyright (c) 2009 - 2021, Intel Corporation. All rights reserved.<BR>
    66# Copyright (c) 2020, Hewlett Packard Enterprise Development LP. All rights reserved.<BR>
    77#    SPDX-License-Identifier: BSD-2-Clause-Patent
     
    1818  BUILD_TARGETS                  = DEBUG|RELEASE|NOOPT
    1919  SKUID_IDENTIFIER               = DEFAULT
     20
     21  DEFINE NETWORK_ISCSI_ENABLE    = TRUE
     22
     23!include MdePkg/MdeLibs.dsc.inc
    2024
    2125[LibraryClasses]
     
    4145  DxeServicesTableLib|MdePkg/Library/DxeServicesTableLib/DxeServicesTableLib.inf
    4246  SafeIntLib|MdePkg/Library/BaseSafeIntLib/BaseSafeIntLib.inf
     47  RngLib|MdePkg/Library/BaseRngLib/BaseRngLib.inf
    4348
    4449!ifdef CONTINUOUS_INTEGRATION
     
    107112  NetworkPkg/Library/DxeDpcLib/DxeDpcLib.inf
    108113  NetworkPkg/Library/DxeHttpLib/DxeHttpLib.inf
     114  NetworkPkg/Library/DxeHttpIoLib/DxeHttpIoLib.inf
    109115  NetworkPkg/Library/DxeIpIoLib/DxeIpIoLib.inf
    110116  NetworkPkg/Library/DxeNetLib/DxeNetLib.inf
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette