TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpIoLib.h File Reference

Go to the source code of this file.

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 EFI_STATUS(EFIAPI * HTTP_IO_CALLBACK) (IN HTTP_IO_CALLBACK_EVENT EventType, IN EFI_HTTP_MESSAGE *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

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 OPTIONAL, IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers OPTIONAL, IN UINTN BodyLength, IN VOID *Body OPTIONAL)
 
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

Definition in file HttpIoLib.h.

Macro Definition Documentation

◆ HTTP_IO_CHUNK_SIZE_STRING_LEN

#define HTTP_IO_CHUNK_SIZE_STRING_LEN   50

Definition at line 19 of file HttpIoLib.h.

◆ HTTP_IO_CHUNKED_TRANSFER_CODING_DATA_LENGTH

#define HTTP_IO_CHUNKED_TRANSFER_CODING_DATA_LENGTH   256

Definition at line 20 of file HttpIoLib.h.

◆ HTTP_IO_MAX_SEND_PAYLOAD

#define HTTP_IO_MAX_SEND_PAYLOAD   1024

Definition at line 18 of file HttpIoLib.h.

Typedef Documentation

◆ HTTP_IO_CALLBACK

typedef EFI_STATUS(EFIAPI * HTTP_IO_CALLBACK) (IN HTTP_IO_CALLBACK_EVENT EventType, IN EFI_HTTP_MESSAGE *Message, IN VOID *Context)

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.

Definition at line 41 of file HttpIoLib.h.

Enumeration Type Documentation

◆ HTTP_IO_CALLBACK_EVENT

HTTP_IO_CALLBACK_EVENT

Definition at line 25 of file HttpIoLib.h.

◆ HTTP_IO_SEND_CHUNK_PROCESS

Process code of HTTP chunk transfer.

Definition at line 121 of file HttpIoLib.h.

◆ HTTP_IO_SEND_NON_CHUNK_PROCESS

Process code of HTTP non chunk transfer.

Definition at line 132 of file HttpIoLib.h.

Function Documentation

◆ HttpIoCreateIo()

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.

◆ HttpIoDestroyIo()

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.

Definition at line 62 of file DxeHttpIoLib.c.

◆ HttpIoGetChunkedTransferContent()

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.

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 receive 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.

Definition at line 678 of file DxeHttpIoLib.c.

◆ HttpIoGetContentLength()

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.

Definition at line 479 of file DxeHttpIoLib.c.

◆ HttpIoNotify()

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.

Definition at line 44 of file DxeHttpIoLib.c.

◆ HttpIoNotifyDpc()

VOID EFIAPI HttpIoNotifyDpc ( IN VOID *  Context)

Notify the callback function when an event is triggered.

Parameters
[in]ContextThe opaque parameter to the function.

Definition at line 28 of file DxeHttpIoLib.c.

◆ HttpIoRecvResponse()

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.

Definition at line 366 of file DxeHttpIoLib.c.

◆ HttpIoSendChunkedTransfer()

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.

Send HTTP request in chunks.

Parameters
[in]HttpIoThe HttpIo wrapping the HTTP service.
[in]SendChunkProcessPointer to current chunk process status.
[in]RequestMessageRequest to send.
Return values
EFI_SUCCESSSuccessfully to send chunk data according to SendChunkProcess.
OtherOther errors.

Definition at line 507 of file DxeHttpIoLib.c.

◆ HttpIoSendRequest()

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 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.