NetworkPkg[all]  0.98
 All Data Structures Files Functions Variables Typedefs Enumerations Enumerator Macros Pages
HttpIoLib.h File Reference

Data Structures

struct  HTTP_IO_RESPONSE_DATA
 
struct  HTTP4_IO_CONFIG_DATA
 
struct  HTTP6_IO_CONFIG_DATA
 
union  HTTP_IO_CONFIG_DATA
 
struct  HTTP_IO
 
struct  HTTP_IO_CHUNKS
 

Macros

#define HTTP_IO_MAX_SEND_PAYLOAD   1024
 
#define HTTP_IO_CHUNK_SIZE_STRING_LEN   50
 
#define HTTP_IO_CHUNKED_TRANSFER_CODING_DATA_LENGTH   256
 

Typedefs

typedef IN EFI_HTTP_MESSAGE * Message
 
typedef IN EFI_HTTP_MESSAGE IN
VOID
Context
 

Enumerations

enum  HTTP_IO_CALLBACK_EVENT { HttpIoRequest, HttpIoResponse }
 
enum  HTTP_IO_SEND_CHUNK_PROCESS {
  HttpIoSendChunkNone = 0, HttpIoSendChunkHeaderZeroContent, HttpIoSendChunkContent, HttpIoSendChunkEndChunk,
  HttpIoSendChunkFinish
}
 
enum  HTTP_IO_SEND_NON_CHUNK_PROCESS { HttpIoSendNonChunkNone = 0, HttpIoSendNonChunkHeaderZeroContent, HttpIoSendNonChunkContent, HttpIoSendNonChunkFinish }
 

Functions

typedef EFI_STATUS (EFIAPI *HTTP_IO_CALLBACK)(IN HTTP_IO_CALLBACK_EVENT EventType
 
VOID EFIAPI HttpIoNotifyDpc (IN VOID *Context)
 
VOID EFIAPI HttpIoNotify (IN EFI_EVENT Event, IN VOID *Context)
 
VOID HttpIoDestroyIo (IN HTTP_IO *HttpIo)
 
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 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 HttpIoRecvResponse (IN HTTP_IO *HttpIo, IN BOOLEAN RecvMsgHeader, OUT HTTP_IO_RESPONSE_DATA *ResponseData)
 
EFI_STATUS HttpIoGetContentLength (IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers, OUT UINTN *ContentLength)
 
EFI_STATUS HttpIoGetChunkedTransferContent (IN HTTP_IO *HttpIo, IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers, OUT LIST_ENTRY **ChunkListHead, OUT UINTN *ContentLength)
 
EFI_STATUS HttpIoSendChunkedTransfer (IN HTTP_IO *HttpIo, IN HTTP_IO_SEND_CHUNK_PROCESS *SendChunkProcess, IN EFI_HTTP_MESSAGE *RequestMessage)
 

Detailed Description

HttpIoLib.h.

(C) Copyright 2020 Hewlett-Packard Development Company, L.P.
SPDX-License-Identifier: BSD-2-Clause-Patent

Macro Definition Documentation

#define HTTP_IO_CHUNK_SIZE_STRING_LEN   50
#define HTTP_IO_CHUNKED_TRANSFER_CODING_DATA_LENGTH   256
#define HTTP_IO_MAX_SEND_PAYLOAD   1024

Typedef Documentation

typedef IN EFI_HTTP_MESSAGE IN VOID* Context
typedef IN EFI_HTTP_MESSAGE* Message

Enumeration Type Documentation

HTTP_IO_CALLBACK_EVENT

Enumerator
HttpIoRequest 
HttpIoResponse 

Process code of HTTP chunk transfer.

Enumerator
HttpIoSendChunkNone 
HttpIoSendChunkHeaderZeroContent 
HttpIoSendChunkContent 
HttpIoSendChunkEndChunk 
HttpIoSendChunkFinish 

Process code of HTTP non chunk transfer.

Enumerator
HttpIoSendNonChunkNone 
HttpIoSendNonChunkHeaderZeroContent 
HttpIoSendNonChunkContent 
HttpIoSendNonChunkFinish 

Function Documentation

typedef EFI_STATUS ( EFIAPI *  HTTP_IO_CALLBACK)

HttpIo Callback function which will be invoked when specified HTTP_IO_CALLBACK_EVENT happened.

Parameters
[in]EventTypeIndicate the Event type that occurs in the current callback.
[in]MessageHTTP message which will be send to, or just received from HTTP server.
[in]ContextThe Callback Context pointer.
Return values
EFI_SUCCESSTells the HttpIo to continue the HTTP process.
OthersTells the HttpIo to abort the current HTTP process.
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 
)

Create a HTTP_IO to access the HTTP service. It will create and configure a HTTP child handle.

Parameters
[in]ImageThe handle of the driver image.
[in]ControllerThe handle of the controller.
[in]IpVersionIP_VERSION_4 or IP_VERSION_6.
[in]ConfigDataThe HTTP_IO configuration data.
[in]CallbackCallback function which will be invoked when specified HTTP_IO_CALLBACK_EVENT happened.
[in]ContextThe Context data which will be passed to the Callback function.
[out]HttpIoThe HTTP_IO.
Return values
EFI_SUCCESSThe HTTP_IO is created and configured.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_UNSUPPORTEDOne or more of the control options are not supported in the implementation.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
OthersFailed to create the HTTP_IO or configure it.
VOID HttpIoDestroyIo ( IN HTTP_IO HttpIo)

Destroy the HTTP_IO and release the resources.

Parameters
[in]HttpIoThe HTTP_IO which wraps the HTTP service to be destroyed.
EFI_STATUS HttpIoGetChunkedTransferContent ( IN HTTP_IO HttpIo,
IN UINTN  HeaderCount,
IN EFI_HTTP_HEADER *  Headers,
OUT LIST_ENTRY **  ChunkListHead,
OUT UINTN *  ContentLength 
)

Synchronously receive a HTTP RESPONSE message from the server.

Parameters
[in]HttpIoThe HttpIo wrapping the HTTP service.
[in]HeaderCountNumber of headers in Headers.
[in]HeadersArray containing list of HTTP headers.
[out]ChunkListHeadA pointer to receivce list head of chunked data. Caller has to release memory of ChunkListHead and all list entries.
[out]ContentLengthTotal content length
Return values
EFI_SUCCESSThe HTTP chunked transfer is received.
EFI_NOT_FOUNDNo chunked transfer coding header found.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_INVALID_PARAMETERImproper parameters.
OthersOther errors as indicated.
EFI_STATUS HttpIoGetContentLength ( IN UINTN  HeaderCount,
IN EFI_HTTP_HEADER *  Headers,
OUT UINTN *  ContentLength 
)

Get the value of the content length if there is a "Content-Length" header.

Parameters
[in]HeaderCountNumber of HTTP header structures in Headers.
[in]HeadersArray containing list of HTTP headers.
[out]ContentLengthPointer to save the value of the content length.
Return values
EFI_SUCCESSSuccessfully get the content length.
EFI_NOT_FOUNDNo "Content-Length" header in the Headers.
VOID EFIAPI HttpIoNotify ( IN EFI_EVENT  Event,
IN VOID Context 
)

Request HttpIoNotifyDpc as a DPC at TPL_CALLBACK.

Parameters
[in]EventThe event signaled.
[in]ContextThe opaque parameter to the function.
VOID EFIAPI HttpIoNotifyDpc ( IN VOID Context)

Notify the callback function when an event is triggered.

Parameters
[in]ContextThe opaque parameter to the function.
EFI_STATUS HttpIoRecvResponse ( IN HTTP_IO HttpIo,
IN BOOLEAN  RecvMsgHeader,
OUT HTTP_IO_RESPONSE_DATA ResponseData 
)

Synchronously receive a HTTP RESPONSE message from the server.

Parameters
[in]HttpIoThe HttpIo wrapping the HTTP service.
[in]RecvMsgHeaderTRUE to receive a new HTTP response (from message header). FALSE to continue receive the previous response message.
[out]ResponseDataPoint to a wrapper of the received response data.
Return values
EFI_SUCCESSThe HTTP response is received.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_DEVICE_ERRORAn unexpected network or system error occurred.
OthersOther errors as indicated.
EFI_STATUS HttpIoSendChunkedTransfer ( IN HTTP_IO HttpIo,
IN HTTP_IO_SEND_CHUNK_PROCESS SendChunkProcess,
IN EFI_HTTP_MESSAGE *  RequestMessage 
)

Send HTTP request in chunks.

Parameters
[in]HttpIoThe HttpIo wrapping the HTTP service.
[in]SendChunkProcessPointer to current chunk process status.
[out]RequestMessageRequest to send.
Return values
EFI_SUCCESSSuccessfully to send chunk data according to SendChunkProcess.
OtherOther errors.
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 
)

Synchronously send a HTTP REQUEST message to the server.

Parameters
[in]HttpIoThe HttpIo wrapping the HTTP service.
[in]RequestA pointer to storage such data as URL and HTTP method.
[in]HeaderCountNumber of HTTP header structures in Headers list.
[in]HeadersArray containing list of HTTP headers.
[in]BodyLengthLength in bytes of the HTTP body.
[in]BodyBody associated with the HTTP request.
Return values
EFI_SUCCESSThe HTTP request is transmitted.
EFI_INVALID_PARAMETEROne or more parameters are invalid.
EFI_OUT_OF_RESOURCESFailed to allocate memory.
EFI_DEVICE_ERRORAn unexpected network or system error occurred.
OthersOther errors as indicated.