From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0b-002e3701.pphosted.com (mx0b-002e3701.pphosted.com [148.163.143.35]) by mx.groups.io with SMTP id smtpd.web10.11494.1603164231007006997 for ; Mon, 19 Oct 2020 20:23:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=M7J8mEqd; spf=pass (domain: hpe.com, ip: 148.163.143.35, mailfrom: prvs=056211f348=abner.chang@hpe.com) Received: from pps.filterd (m0148664.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.0.42/8.16.0.42) with SMTP id 09K3BV44002608; Tue, 20 Oct 2020 03:23:50 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : in-reply-to : references; s=pps0720; bh=e1bLpt8FYKF6/k7FN6/4BKDa5Ip8l2FAVU6fi9uPVMc=; b=M7J8mEqd1AJGnB2C0mMCKgQ0A1I3R4jROJ4SXZl2BsMU5k+WpjBy5C18IIuE6hlNqhsv Viy8j1T3VTxJ+StE5MKwrTFR/vzuoPU4DQlrLNDtQF2NEMbo3qQibSDAIEY30sb5GZRE CGs+7ApFGG258VLnAXQ4m6ZM20jMKr5V5RlfJeNqFkzOicLCUjmkEO4oqtzg04EFx7ws 2aYb+S79gRs7Ddk70pGjn5P4K3esTetSk7Ki58Hv73A37eCOfMt3QcXTf/kWHscLhALg aPr7E7yxRe2d4sIXFHyptj1lXnuOEXMbplnWzp2QQ+JXF60GD+4sgMh/1BKs9X/wCC1D ww== Received: from g9t5009.houston.hpe.com (g9t5009.houston.hpe.com [15.241.48.73]) by mx0b-002e3701.pphosted.com with ESMTP id 348mfy62et-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Tue, 20 Oct 2020 03:23:50 +0000 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g9t5009.houston.hpe.com (Postfix) with ESMTP id 91CD351; Tue, 20 Oct 2020 03:23:49 +0000 (UTC) Received: from abner-virtual-machine.asiapacific.hpqcorp.net (abner-virtual-machine.asiapacific.hpqcorp.net [15.119.210.153]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 5F7AB4C; Tue, 20 Oct 2020 03:23:48 +0000 (UTC) From: "Abner Chang" To: devel@edk2.groups.io Cc: Maciej Rabeda , Jiaxin Wu , Siyuan Fu , Nickle Wang Subject: [DxeHttpIoLib PATCH V2 3/3] NetworkPkg/HttpBootDxe: Utilize HttpIoLib Date: Tue, 20 Oct 2020 10:38:48 +0800 Message-Id: <20201020023848.3015-4-abner.chang@hpe.com> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20201020023848.3015-1-abner.chang@hpe.com> References: <20201020023848.3015-1-abner.chang@hpe.com> X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=fsecure engine=2.50.10434:6.0.235,18.0.687 definitions=2020-10-20_01:2020-10-16,2020-10-20 signatures=0 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 adultscore=0 mlxlogscore=999 bulkscore=0 impostorscore=0 priorityscore=1501 mlxscore=0 lowpriorityscore=0 suspectscore=1 spamscore=0 malwarescore=0 phishscore=0 clxscore=1015 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2009150000 definitions=main-2010200023 Remove HTTP IO realted funcitons from HttpBootDxe and use HttpIoLib instead. Signed-off-by: Abner Chang Cc: Maciej Rabeda Cc: Jiaxin Wu Cc: Siyuan Fu Cc: Nickle Wang --- NetworkPkg/HttpBootDxe/HttpBootDxe.h | 3 +- NetworkPkg/HttpBootDxe/HttpBootDxe.inf | 2 + NetworkPkg/HttpBootDxe/HttpBootSupport.c | 431 +---------------------- NetworkPkg/HttpBootDxe/HttpBootSupport.h | 189 +--------- 4 files changed, 6 insertions(+), 619 deletions(-) diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.h b/NetworkPkg/HttpBootDxe/HttpBootDxe.h index 0b45f9de0b..d692c3ad3c 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.h +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.h @@ -2,7 +2,7 @@ UEFI HTTP boot driver's private data structure and interfaces declaration. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
-(C) Copyright 2016 Hewlett Packard Enterprise Development LP
+(C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -28,6 +28,7 @@ SPDX-License-Identifier: BSD-2-Clause-Patent #include #include #include +#include #include #include #include diff --git a/NetworkPkg/HttpBootDxe/HttpBootDxe.inf b/NetworkPkg/HttpBootDxe/HttpBootDxe.inf index 5beab728dd..a27a561722 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootDxe.inf +++ b/NetworkPkg/HttpBootDxe/HttpBootDxe.inf @@ -2,6 +2,7 @@ # This modules produce the Load File Protocol for UEFI HTTP boot. # # Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+# (C) Copyright 2020 Hewlett-Packard Development Company, L.P.
# SPDX-License-Identifier: BSD-2-Clause-Patent # ## @@ -52,6 +53,7 @@ DebugLib NetLib HttpLib + HttpIoLib HiiLib PrintLib DpcLib diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.c b/NetworkPkg/HttpBootDxe/HttpBootSupport.c index 5b0e054a05..93d9dfc464 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.c +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.c @@ -2,7 +2,7 @@ Support functions implementation for UEFI HTTP boot driver. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
-(C) Copyright 2016 Hewlett Packard Enterprise Development LP
+(C) Copyright 2016 - 2020 Hewlett Packard Enterprise Development LP
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -622,435 +622,6 @@ HttpBootSetHeader ( return EFI_SUCCESS; } -/** - Notify the callback function when an event is triggered. - - @param[in] Context The opaque parameter to the function. - -**/ -VOID -EFIAPI -HttpIoNotifyDpc ( - IN VOID *Context - ) -{ - *((BOOLEAN *) Context) = TRUE; -} - -/** - Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK. - - @param[in] Event The event signaled. - @param[in] Context The opaque parameter to the function. - -**/ -VOID -EFIAPI -HttpIoNotify ( - IN EFI_EVENT Event, - IN VOID *Context - ) -{ - // - // Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK - // - QueueDpc (TPL_CALLBACK, HttpIoNotifyDpc, Context); -} - -/** - Create a HTTP_IO to access the HTTP service. It will create and configure - a HTTP child handle. - - @param[in] Image The handle of the driver image. - @param[in] Controller The handle of the controller. - @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. - @param[in] ConfigData The HTTP_IO configuration data. - @param[in] Callback Callback function which will be invoked when specified - HTTP_IO_CALLBACK_EVENT happened. - @param[in] Context The Context data which will be passed to the Callback function. - @param[out] HttpIo The HTTP_IO. - - @retval EFI_SUCCESS The HTTP_IO is created and configured. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_UNSUPPORTED One or more of the control options are not - supported in the implementation. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. - @retval Others Failed to create the HTTP_IO or configure it. - -**/ -EFI_STATUS -HttpIoCreateIo ( - IN EFI_HANDLE Image, - IN EFI_HANDLE Controller, - IN UINT8 IpVersion, - IN HTTP_IO_CONFIG_DATA *ConfigData, - IN HTTP_IO_CALLBACK Callback, - IN VOID *Context, - OUT HTTP_IO *HttpIo - ) -{ - EFI_STATUS Status; - EFI_HTTP_CONFIG_DATA HttpConfigData; - EFI_HTTPv4_ACCESS_POINT Http4AccessPoint; - EFI_HTTPv6_ACCESS_POINT Http6AccessPoint; - EFI_HTTP_PROTOCOL *Http; - EFI_EVENT Event; - - if ((Image == NULL) || (Controller == NULL) || (ConfigData == NULL) || (HttpIo == NULL)) { - return EFI_INVALID_PARAMETER; - } - - if (IpVersion != IP_VERSION_4 && IpVersion != IP_VERSION_6) { - return EFI_UNSUPPORTED; - } - - ZeroMem (HttpIo, sizeof (HTTP_IO)); - - // - // Create the HTTP child instance and get the HTTP protocol. - // - Status = NetLibCreateServiceChild ( - Controller, - Image, - &gEfiHttpServiceBindingProtocolGuid, - &HttpIo->Handle - ); - if (EFI_ERROR (Status)) { - return Status; - } - - Status = gBS->OpenProtocol ( - HttpIo->Handle, - &gEfiHttpProtocolGuid, - (VOID **) &Http, - Image, - Controller, - EFI_OPEN_PROTOCOL_BY_DRIVER - ); - if (EFI_ERROR (Status) || (Http == NULL)) { - goto ON_ERROR; - } - - // - // Init the configuration data and configure the HTTP child. - // - HttpIo->Image = Image; - HttpIo->Controller = Controller; - HttpIo->IpVersion = IpVersion; - HttpIo->Http = Http; - HttpIo->Callback = Callback; - HttpIo->Context = Context; - - ZeroMem (&HttpConfigData, sizeof (EFI_HTTP_CONFIG_DATA)); - HttpConfigData.HttpVersion = HttpVersion11; - HttpConfigData.TimeOutMillisec = ConfigData->Config4.RequestTimeOut; - if (HttpIo->IpVersion == IP_VERSION_4) { - HttpConfigData.LocalAddressIsIPv6 = FALSE; - - Http4AccessPoint.UseDefaultAddress = ConfigData->Config4.UseDefaultAddress; - Http4AccessPoint.LocalPort = ConfigData->Config4.LocalPort; - IP4_COPY_ADDRESS (&Http4AccessPoint.LocalAddress, &ConfigData->Config4.LocalIp); - IP4_COPY_ADDRESS (&Http4AccessPoint.LocalSubnet, &ConfigData->Config4.SubnetMask); - HttpConfigData.AccessPoint.IPv4Node = &Http4AccessPoint; - } else { - HttpConfigData.LocalAddressIsIPv6 = TRUE; - Http6AccessPoint.LocalPort = ConfigData->Config6.LocalPort; - IP6_COPY_ADDRESS (&Http6AccessPoint.LocalAddress, &ConfigData->Config6.LocalIp); - HttpConfigData.AccessPoint.IPv6Node = &Http6AccessPoint; - } - - Status = Http->Configure (Http, &HttpConfigData); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - - // - // Create events for various asynchronous operations. - // - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - HttpIoNotify, - &HttpIo->IsTxDone, - &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - HttpIo->ReqToken.Event = Event; - HttpIo->ReqToken.Message = &HttpIo->ReqMessage; - - Status = gBS->CreateEvent ( - EVT_NOTIFY_SIGNAL, - TPL_NOTIFY, - HttpIoNotify, - &HttpIo->IsRxDone, - &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - HttpIo->RspToken.Event = Event; - HttpIo->RspToken.Message = &HttpIo->RspMessage; - - // - // Create TimeoutEvent for response - // - Status = gBS->CreateEvent ( - EVT_TIMER, - TPL_CALLBACK, - NULL, - NULL, - &Event - ); - if (EFI_ERROR (Status)) { - goto ON_ERROR; - } - HttpIo->TimeoutEvent = Event; - - return EFI_SUCCESS; - -ON_ERROR: - HttpIoDestroyIo (HttpIo); - - return Status; -} - -/** - Destroy the HTTP_IO and release the resources. - - @param[in] HttpIo The HTTP_IO which wraps the HTTP service to be destroyed. - -**/ -VOID -HttpIoDestroyIo ( - IN HTTP_IO *HttpIo - ) -{ - EFI_HTTP_PROTOCOL *Http; - EFI_EVENT Event; - - if (HttpIo == NULL) { - return; - } - - Event = HttpIo->ReqToken.Event; - if (Event != NULL) { - gBS->CloseEvent (Event); - } - - Event = HttpIo->RspToken.Event; - if (Event != NULL) { - gBS->CloseEvent (Event); - } - - Event = HttpIo->TimeoutEvent; - if (Event != NULL) { - gBS->CloseEvent (Event); - } - - Http = HttpIo->Http; - if (Http != NULL) { - Http->Configure (Http, NULL); - gBS->CloseProtocol ( - HttpIo->Handle, - &gEfiHttpProtocolGuid, - HttpIo->Image, - HttpIo->Controller - ); - } - - NetLibDestroyServiceChild ( - HttpIo->Controller, - HttpIo->Image, - &gEfiHttpServiceBindingProtocolGuid, - HttpIo->Handle - ); -} - -/** - Synchronously send a HTTP REQUEST message to the server. - - @param[in] HttpIo The HttpIo wrapping the HTTP service. - @param[in] Request A pointer to storage such data as URL and HTTP method. - @param[in] HeaderCount Number of HTTP header structures in Headers list. - @param[in] Headers Array containing list of HTTP headers. - @param[in] BodyLength Length in bytes of the HTTP body. - @param[in] Body Body associated with the HTTP request. - - @retval EFI_SUCCESS The HTTP request is transmitted. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. - @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. - @retval Others Other errors as indicated. - -**/ -EFI_STATUS -HttpIoSendRequest ( - IN HTTP_IO *HttpIo, - IN EFI_HTTP_REQUEST_DATA *Request, - IN UINTN HeaderCount, - IN EFI_HTTP_HEADER *Headers, - IN UINTN BodyLength, - IN VOID *Body - ) -{ - EFI_STATUS Status; - EFI_HTTP_PROTOCOL *Http; - - if (HttpIo == NULL || HttpIo->Http == NULL) { - return EFI_INVALID_PARAMETER; - } - - HttpIo->ReqToken.Status = EFI_NOT_READY; - HttpIo->ReqToken.Message->Data.Request = Request; - HttpIo->ReqToken.Message->HeaderCount = HeaderCount; - HttpIo->ReqToken.Message->Headers = Headers; - HttpIo->ReqToken.Message->BodyLength = BodyLength; - HttpIo->ReqToken.Message->Body = Body; - - if (HttpIo->Callback != NULL) { - Status = HttpIo->Callback ( - HttpIoRequest, - HttpIo->ReqToken.Message, - HttpIo->Context - ); - if (EFI_ERROR (Status)) { - return Status; - } - } - - // - // Queue the request token to HTTP instances. - // - Http = HttpIo->Http; - HttpIo->IsTxDone = FALSE; - Status = Http->Request ( - Http, - &HttpIo->ReqToken - ); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Poll the network until transmit finish. - // - while (!HttpIo->IsTxDone) { - Http->Poll (Http); - } - - return HttpIo->ReqToken.Status; -} - -/** - Synchronously receive a HTTP RESPONSE message from the server. - - @param[in] HttpIo The HttpIo wrapping the HTTP service. - @param[in] RecvMsgHeader TRUE to receive a new HTTP response (from message header). - FALSE to continue receive the previous response message. - @param[out] ResponseData Point to a wrapper of the received response data. - - @retval EFI_SUCCESS The HTTP response is received. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. - @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. - @retval Others Other errors as indicated. - -**/ -EFI_STATUS -HttpIoRecvResponse ( - IN HTTP_IO *HttpIo, - IN BOOLEAN RecvMsgHeader, - OUT HTTP_IO_RESPONSE_DATA *ResponseData - ) -{ - EFI_STATUS Status; - EFI_HTTP_PROTOCOL *Http; - - if (HttpIo == NULL || HttpIo->Http == NULL || ResponseData == NULL) { - return EFI_INVALID_PARAMETER; - } - - // - // Start the timer, and wait Timeout seconds to receive the header packet. - // - Status = gBS->SetTimer (HttpIo->TimeoutEvent, TimerRelative, HTTP_BOOT_RESPONSE_TIMEOUT * TICKS_PER_MS); - if (EFI_ERROR (Status)) { - return Status; - } - - // - // Queue the response token to HTTP instances. - // - HttpIo->RspToken.Status = EFI_NOT_READY; - if (RecvMsgHeader) { - HttpIo->RspToken.Message->Data.Response = &ResponseData->Response; - } else { - HttpIo->RspToken.Message->Data.Response = NULL; - } - HttpIo->RspToken.Message->HeaderCount = 0; - HttpIo->RspToken.Message->Headers = NULL; - HttpIo->RspToken.Message->BodyLength = ResponseData->BodyLength; - HttpIo->RspToken.Message->Body = ResponseData->Body; - - Http = HttpIo->Http; - HttpIo->IsRxDone = FALSE; - Status = Http->Response ( - Http, - &HttpIo->RspToken - ); - - if (EFI_ERROR (Status)) { - gBS->SetTimer (HttpIo->TimeoutEvent, TimerCancel, 0); - return Status; - } - - // - // Poll the network until receive finish. - // - while (!HttpIo->IsRxDone && ((HttpIo->TimeoutEvent == NULL) || EFI_ERROR (gBS->CheckEvent (HttpIo->TimeoutEvent)))) { - Http->Poll (Http); - } - - gBS->SetTimer (HttpIo->TimeoutEvent, TimerCancel, 0); - - if (!HttpIo->IsRxDone) { - // - // Timeout occurs, cancel the response token. - // - Http->Cancel (Http, &HttpIo->RspToken); - - Status = EFI_TIMEOUT; - - return Status; - } else { - HttpIo->IsRxDone = FALSE; - } - - if ((HttpIo->Callback != NULL) && - (HttpIo->RspToken.Status == EFI_SUCCESS || HttpIo->RspToken.Status == EFI_HTTP_ERROR)) { - Status = HttpIo->Callback ( - HttpIoResponse, - HttpIo->RspToken.Message, - HttpIo->Context - ); - if (EFI_ERROR (Status)) { - return Status; - } - } - - // - // Store the received data into the wrapper. - // - ResponseData->Status = HttpIo->RspToken.Status; - ResponseData->HeaderCount = HttpIo->RspToken.Message->HeaderCount; - ResponseData->Headers = HttpIo->RspToken.Message->Headers; - ResponseData->BodyLength = HttpIo->RspToken.Message->BodyLength; - - return Status; -} - /** This function checks the HTTP(S) URI scheme. diff --git a/NetworkPkg/HttpBootDxe/HttpBootSupport.h b/NetworkPkg/HttpBootDxe/HttpBootSupport.h index 81d072ae37..1a2d32dd5a 100644 --- a/NetworkPkg/HttpBootDxe/HttpBootSupport.h +++ b/NetworkPkg/HttpBootDxe/HttpBootSupport.h @@ -2,6 +2,7 @@ Support functions declaration for UEFI HTTP boot driver. Copyright (c) 2015 - 2018, Intel Corporation. All rights reserved.
+(C) Copyright 2020 Hewlett-Packard Development Company, L.P.
SPDX-License-Identifier: BSD-2-Clause-Patent **/ @@ -139,102 +140,6 @@ HttpBootSetHeader ( IN CHAR8 *FieldValue ); -/// -/// HTTP_IO_CALLBACK_EVENT -/// -typedef enum { - HttpIoRequest, - HttpIoResponse -} HTTP_IO_CALLBACK_EVENT; - -/** - HttpIo Callback function which will be invoked when specified HTTP_IO_CALLBACK_EVENT happened. - - @param[in] EventType Indicate the Event type that occurs in the current callback. - @param[in] Message HTTP message which will be send to, or just received from HTTP server. - @param[in] Context The Callback Context pointer. - - @retval EFI_SUCCESS Tells the HttpIo to continue the HTTP process. - @retval Others Tells the HttpIo to abort the current HTTP process. -**/ -typedef -EFI_STATUS -(EFIAPI * HTTP_IO_CALLBACK) ( - IN HTTP_IO_CALLBACK_EVENT EventType, - IN EFI_HTTP_MESSAGE *Message, - IN VOID *Context - ); - -// -// HTTP_IO configuration data for IPv4 -// -typedef struct { - EFI_HTTP_VERSION HttpVersion; - UINT32 RequestTimeOut; // In milliseconds. - UINT32 ResponseTimeOut; // In milliseconds. - BOOLEAN UseDefaultAddress; - EFI_IPv4_ADDRESS LocalIp; - EFI_IPv4_ADDRESS SubnetMask; - UINT16 LocalPort; -} HTTP4_IO_CONFIG_DATA; - -// -// HTTP_IO configuration data for IPv6 -// -typedef struct { - EFI_HTTP_VERSION HttpVersion; - UINT32 RequestTimeOut; // In milliseconds. - BOOLEAN UseDefaultAddress; - EFI_IPv6_ADDRESS LocalIp; - UINT16 LocalPort; -} HTTP6_IO_CONFIG_DATA; - - -// -// HTTP_IO configuration -// -typedef union { - HTTP4_IO_CONFIG_DATA Config4; - HTTP6_IO_CONFIG_DATA Config6; -} HTTP_IO_CONFIG_DATA; - -// -// HTTP_IO wrapper of the EFI HTTP service. -// -typedef struct { - UINT8 IpVersion; - EFI_HANDLE Image; - EFI_HANDLE Controller; - EFI_HANDLE Handle; - - EFI_HTTP_PROTOCOL *Http; - - HTTP_IO_CALLBACK Callback; - VOID *Context; - - EFI_HTTP_TOKEN ReqToken; - EFI_HTTP_MESSAGE ReqMessage; - EFI_HTTP_TOKEN RspToken; - EFI_HTTP_MESSAGE RspMessage; - - BOOLEAN IsTxDone; - BOOLEAN IsRxDone; - - EFI_EVENT TimeoutEvent; -} HTTP_IO; - -// -// A wrapper structure to hold the received HTTP response data. -// -typedef struct { - EFI_HTTP_RESPONSE_DATA Response; - UINTN HeaderCount; - EFI_HTTP_HEADER *Headers; - UINTN BodyLength; - CHAR8 *Body; - EFI_STATUS Status; -} HTTP_IO_RESPONSE_DATA; - /** Retrieve the host address using the EFI_DNS6_PROTOCOL. @@ -267,98 +172,6 @@ HttpBootCommonNotify ( IN VOID *Context ); -/** - Create a HTTP_IO to access the HTTP service. It will create and configure - a HTTP child handle. - - @param[in] Image The handle of the driver image. - @param[in] Controller The handle of the controller. - @param[in] IpVersion IP_VERSION_4 or IP_VERSION_6. - @param[in] ConfigData The HTTP_IO configuration data. - @param[in] Callback Callback function which will be invoked when specified - HTTP_IO_CALLBACK_EVENT happened. - @param[in] Context The Context data which will be passed to the Callback function. - @param[out] HttpIo The HTTP_IO. - - @retval EFI_SUCCESS The HTTP_IO is created and configured. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_UNSUPPORTED One or more of the control options are not - supported in the implementation. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. - @retval Others Failed to create the HTTP_IO or configure it. - -**/ -EFI_STATUS -HttpIoCreateIo ( - IN EFI_HANDLE Image, - IN EFI_HANDLE Controller, - IN UINT8 IpVersion, - IN HTTP_IO_CONFIG_DATA *ConfigData, - IN HTTP_IO_CALLBACK Callback, - IN VOID *Context, - OUT HTTP_IO *HttpIo - ); - -/** - Destroy the HTTP_IO and release the resources. - - @param[in] HttpIo The HTTP_IO which wraps the HTTP service to be destroyed. - -**/ -VOID -HttpIoDestroyIo ( - IN HTTP_IO *HttpIo - ); - -/** - Synchronously send a HTTP REQUEST message to the server. - - @param[in] HttpIo The HttpIo wrapping the HTTP service. - @param[in] Request A pointer to storage such data as URL and HTTP method. - @param[in] HeaderCount Number of HTTP header structures in Headers list. - @param[in] Headers Array containing list of HTTP headers. - @param[in] BodyLength Length in bytes of the HTTP body. - @param[in] Body Body associated with the HTTP request. - - @retval EFI_SUCCESS The HTTP request is transmitted. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. - @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. - @retval Others Other errors as indicated. - -**/ -EFI_STATUS -HttpIoSendRequest ( - IN HTTP_IO *HttpIo, - IN EFI_HTTP_REQUEST_DATA *Request, OPTIONAL - IN UINTN HeaderCount, - IN EFI_HTTP_HEADER *Headers, OPTIONAL - IN UINTN BodyLength, - IN VOID *Body OPTIONAL - ); - -/** - Synchronously receive a HTTP RESPONSE message from the server. - - @param[in] HttpIo The HttpIo wrapping the HTTP service. - @param[in] RecvMsgHeader TRUE to receive a new HTTP response (from message header). - FALSE to continue receive the previous response message. - @param[out] ResponseData Point to a wrapper of the received response data. - - @retval EFI_SUCCESS The HTTP response is received. - @retval EFI_INVALID_PARAMETER One or more parameters are invalid. - @retval EFI_OUT_OF_RESOURCES Failed to allocate memory. - @retval EFI_DEVICE_ERROR An unexpected network or system error occurred. - @retval Others Other errors as indicated. - -**/ -EFI_STATUS -HttpIoRecvResponse ( - IN HTTP_IO *HttpIo, - IN BOOLEAN RecvMsgHeader, - OUT HTTP_IO_RESPONSE_DATA *ResponseData - ); - /** This function checks the HTTP(S) URI scheme. -- 2.17.1