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

Go to the source code of this file.

Data Structures

struct  _HTTP_SERVICE
 
struct  HTTP_TCP_TOKEN_WRAP
 
struct  TLS_CONFIG_DATA
 
struct  HTTP_CALLBACK_DATA
 
struct  _HTTP_PROTOCOL
 
struct  HTTP_TOKEN_WRAP
 

Macros

#define DEF_BUF_LEN   2048
 
#define HTTP_SERVICE_SIGNATURE   SIGNATURE_32('H', 't', 't', 'S')
 
#define HTTP_SERVICE_FROM_PROTOCOL(a)
 
#define HTTP_STATE_UNCONFIGED   0
 
#define HTTP_STATE_HTTP_CONFIGED   1
 
#define HTTP_STATE_TCP_CONFIGED   2
 
#define HTTP_STATE_TCP_UNCONFIGED   3
 
#define HTTP_STATE_TCP_CONNECTED   4
 
#define HTTP_STATE_TCP_CLOSED   5
 
#define HTTP_TOS_DEAULT   8
 
#define HTTP_TTL_DEAULT   255
 
#define HTTP_BUFFER_SIZE_DEAULT   0x200000
 
#define HTTP_MAX_SYN_BACK_LOG   5
 
#define HTTP_CONNECTION_TIMEOUT   60
 
#define HTTP_DATA_RETRIES   12
 
#define HTTP_FIN_TIMEOUT   2
 
#define HTTP_KEEP_ALIVE_PROBES   6
 
#define HTTP_KEEP_ALIVE_TIME   7200
 
#define HTTP_KEEP_ALIVE_INTERVAL   30
 
#define HTTP_URL_BUFFER_LEN   4096
 
#define HTTP_PROTOCOL_SIGNATURE   SIGNATURE_32('H', 't', 't', 'P')
 
#define HTTP_INSTANCE_FROM_PROTOCOL(a)
 

Typedefs

typedef struct _HTTP_SERVICE HTTP_SERVICE
 
typedef struct _HTTP_PROTOCOL HTTP_PROTOCOL
 

Functions

VOID EFIAPI HttpCommonNotify (IN EFI_EVENT Event, IN VOID *Context)
 
EFI_STATUS HttpCreateTcpConnCloseEvent (IN HTTP_PROTOCOL *HttpInstance)
 
VOID HttpCloseTcpConnCloseEvent (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpCreateTcpTxEvent (IN HTTP_TOKEN_WRAP *Wrap)
 
EFI_STATUS HttpCreateTcpRxEventForHeader (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpCreateTcpRxEvent (IN HTTP_TOKEN_WRAP *Wrap)
 
VOID HttpCloseTcpRxEvent (IN HTTP_TOKEN_WRAP *Wrap)
 
EFI_STATUS HttpInitProtocol (IN OUT HTTP_PROTOCOL *HttpInstance, IN BOOLEAN IpVersion)
 
VOID HttpCleanProtocol (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpCreateConnection (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpCloseConnection (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpConfigureTcp4 (IN HTTP_PROTOCOL *HttpInstance, IN HTTP_TOKEN_WRAP *Wrap)
 
EFI_STATUS HttpConfigureTcp6 (IN HTTP_PROTOCOL *HttpInstance, IN HTTP_TOKEN_WRAP *Wrap)
 
EFI_STATUS HttpConnectTcp4 (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpConnectTcp6 (IN HTTP_PROTOCOL *HttpInstance)
 
EFI_STATUS HttpTransmitTcp (IN HTTP_PROTOCOL *HttpInstance, IN HTTP_TOKEN_WRAP *Wrap, IN UINT8 *TxString, IN UINTN TxStringLen)
 
EFI_STATUS EFIAPI HttpTokenExist (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
 
EFI_STATUS EFIAPI HttpTcpNotReady (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
 
EFI_STATUS HttpInitSession (IN HTTP_PROTOCOL *HttpInstance, IN HTTP_TOKEN_WRAP *Wrap, IN BOOLEAN Configure, IN BOOLEAN TlsConfigure)
 
EFI_STATUS EFIAPI HttpTcpTransmit (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
 
EFI_STATUS EFIAPI HttpTcpReceive (IN NET_MAP *Map, IN NET_MAP_ITEM *Item, IN VOID *Context)
 
EFI_STATUS HttpTcpReceiveHeader (IN HTTP_PROTOCOL *HttpInstance, IN OUT UINTN *SizeofHeaders, IN OUT UINTN *BufferSize, IN EFI_EVENT Timeout)
 
EFI_STATUS HttpTcpReceiveBody (IN HTTP_TOKEN_WRAP *Wrap, IN EFI_HTTP_MESSAGE *HttpMsg)
 
VOID HttpTcpTokenCleanup (IN HTTP_TOKEN_WRAP *Wrap)
 
EFI_STATUS HttpResponseWorker (IN HTTP_TOKEN_WRAP *Wrap)
 
VOID HttpNotify (IN EDKII_HTTP_CALLBACK_EVENT Event, IN EFI_STATUS EventStatus)
 

Detailed Description

The header files of miscellaneous routines for HttpDxe driver.

Copyright (c) 2015, Intel Corporation. All rights reserved.
(C) Copyright 2016 Hewlett Packard Enterprise Development LP
Copyright (C) 2024 Advanced Micro Devices, Inc. All rights reserved.
SPDX-License-Identifier: BSD-2-Clause-Patent

Definition in file HttpProto.h.

Macro Definition Documentation

◆ DEF_BUF_LEN

#define DEF_BUF_LEN   2048

Definition at line 14 of file HttpProto.h.

◆ HTTP_BUFFER_SIZE_DEAULT

#define HTTP_BUFFER_SIZE_DEAULT   0x200000

Definition at line 41 of file HttpProto.h.

◆ HTTP_CONNECTION_TIMEOUT

#define HTTP_CONNECTION_TIMEOUT   60

Definition at line 43 of file HttpProto.h.

◆ HTTP_DATA_RETRIES

#define HTTP_DATA_RETRIES   12

Definition at line 44 of file HttpProto.h.

◆ HTTP_FIN_TIMEOUT

#define HTTP_FIN_TIMEOUT   2

Definition at line 45 of file HttpProto.h.

◆ HTTP_INSTANCE_FROM_PROTOCOL

#define HTTP_INSTANCE_FROM_PROTOCOL (   a)
Value:
CR ( \
(a), \
Http, \
HTTP_PROTOCOL_SIGNATURE \
)
#define CR(Record, TYPE, Field, TestSignature)
Definition: DebugLib.h:659

Definition at line 211 of file HttpProto.h.

◆ HTTP_KEEP_ALIVE_INTERVAL

#define HTTP_KEEP_ALIVE_INTERVAL   30

Definition at line 48 of file HttpProto.h.

◆ HTTP_KEEP_ALIVE_PROBES

#define HTTP_KEEP_ALIVE_PROBES   6

Definition at line 46 of file HttpProto.h.

◆ HTTP_KEEP_ALIVE_TIME

#define HTTP_KEEP_ALIVE_TIME   7200

Definition at line 47 of file HttpProto.h.

◆ HTTP_MAX_SYN_BACK_LOG

#define HTTP_MAX_SYN_BACK_LOG   5

Definition at line 42 of file HttpProto.h.

◆ HTTP_PROTOCOL_SIGNATURE

#define HTTP_PROTOCOL_SIGNATURE   SIGNATURE_32('H', 't', 't', 'P')

Definition at line 209 of file HttpProto.h.

◆ HTTP_SERVICE_FROM_PROTOCOL

#define HTTP_SERVICE_FROM_PROTOCOL (   a)
Value:
CR ( \
(a), \
ServiceBinding, \
HTTP_SERVICE_SIGNATURE \
)

Definition at line 18 of file HttpProto.h.

◆ HTTP_SERVICE_SIGNATURE

#define HTTP_SERVICE_SIGNATURE   SIGNATURE_32('H', 't', 't', 'S')

Definition at line 16 of file HttpProto.h.

◆ HTTP_STATE_HTTP_CONFIGED

#define HTTP_STATE_HTTP_CONFIGED   1

Definition at line 30 of file HttpProto.h.

◆ HTTP_STATE_TCP_CLOSED

#define HTTP_STATE_TCP_CLOSED   5

Definition at line 34 of file HttpProto.h.

◆ HTTP_STATE_TCP_CONFIGED

#define HTTP_STATE_TCP_CONFIGED   2

Definition at line 31 of file HttpProto.h.

◆ HTTP_STATE_TCP_CONNECTED

#define HTTP_STATE_TCP_CONNECTED   4

Definition at line 33 of file HttpProto.h.

◆ HTTP_STATE_TCP_UNCONFIGED

#define HTTP_STATE_TCP_UNCONFIGED   3

Definition at line 32 of file HttpProto.h.

◆ HTTP_STATE_UNCONFIGED

#define HTTP_STATE_UNCONFIGED   0

Definition at line 29 of file HttpProto.h.

◆ HTTP_TOS_DEAULT

#define HTTP_TOS_DEAULT   8

Definition at line 39 of file HttpProto.h.

◆ HTTP_TTL_DEAULT

#define HTTP_TTL_DEAULT   255

Definition at line 40 of file HttpProto.h.

◆ HTTP_URL_BUFFER_LEN

#define HTTP_URL_BUFFER_LEN   4096

Definition at line 50 of file HttpProto.h.

Function Documentation

◆ HttpCleanProtocol()

VOID HttpCleanProtocol ( IN HTTP_PROTOCOL HttpInstance)

Clean up the HTTP child, release all the resources used by it.

Parameters
[in]HttpInstanceThe HTTP child to clean up.

Definition at line 820 of file HttpProto.c.

◆ HttpCloseConnection()

EFI_STATUS HttpCloseConnection ( IN HTTP_PROTOCOL HttpInstance)

Close existing TCP connection.

Parameters
[in]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSThe TCP connection is closed.
OthersOther error as indicated.

Definition at line 1001 of file HttpProto.c.

◆ HttpCloseTcpConnCloseEvent()

VOID HttpCloseTcpConnCloseEvent ( IN HTTP_PROTOCOL HttpInstance)

Close events in the TCP connection token and TCP close token.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.

Definition at line 374 of file HttpProto.c.

◆ HttpCloseTcpRxEvent()

VOID HttpCloseTcpRxEvent ( IN HTTP_TOKEN_WRAP Wrap)

Close Events for Tcp Receive Tokens for HTTP body and HTTP header.

Parameters
[in]WrapPointer to HTTP token's wrap data.

Definition at line 576 of file HttpProto.c.

◆ HttpCommonNotify()

VOID EFIAPI HttpCommonNotify ( IN EFI_EVENT  Event,
IN VOID *  Context 
)

The common notify function used in HTTP driver.

Parameters
[in]EventThe event signaled.
[in]ContextThe context.

Definition at line 22 of file HttpProto.c.

◆ HttpConfigureTcp4()

EFI_STATUS HttpConfigureTcp4 ( IN HTTP_PROTOCOL HttpInstance,
IN HTTP_TOKEN_WRAP Wrap 
)

Configure TCP4 protocol child.

Parameters
[in]HttpInstanceThe HTTP instance private data.
[in]WrapThe HTTP token's wrap data.
Return values
EFI_SUCCESSThe TCP4 protocol child is configured.
OthersOther error as indicated.

Definition at line 1048 of file HttpProto.c.

◆ HttpConfigureTcp6()

EFI_STATUS HttpConfigureTcp6 ( IN HTTP_PROTOCOL HttpInstance,
IN HTTP_TOKEN_WRAP Wrap 
)

Configure TCP6 protocol child.

Parameters
[in]HttpInstanceThe HTTP instance private data.
[in]WrapThe HTTP token's wrap data.
Return values
EFI_SUCCESSThe TCP6 protocol child is configured.
OthersOther error as indicated.

Definition at line 1137 of file HttpProto.c.

◆ HttpConnectTcp4()

EFI_STATUS HttpConnectTcp4 ( IN HTTP_PROTOCOL HttpInstance)

Check existing TCP connection, if in error state, recover TCP4 connection. Then, connect one TLS session if required.

Parameters
[in]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSThe TCP connection is established.
EFI_NOT_READYTCP4 protocol child is not created or configured.
OthersOther error as indicated.

Definition at line 1221 of file HttpProto.c.

◆ HttpConnectTcp6()

EFI_STATUS HttpConnectTcp6 ( IN HTTP_PROTOCOL HttpInstance)

Check existing TCP connection, if in error state, recover TCP6 connection. Then, connect one TLS session if required.

Parameters
[in]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSThe TCP connection is established.
EFI_NOT_READYTCP6 protocol child is not created or configured.
OthersOther error as indicated.

Definition at line 1313 of file HttpProto.c.

◆ HttpCreateConnection()

EFI_STATUS HttpCreateConnection ( IN HTTP_PROTOCOL HttpInstance)

Establish TCP connection with HTTP server.

Parameters
[in]HttpInstanceThe HTTP instance private data.
Return values
EFI_SUCCESSThe TCP connection is established.
OthersOther error as indicated.

Definition at line 943 of file HttpProto.c.

◆ HttpCreateTcpConnCloseEvent()

EFI_STATUS HttpCreateTcpConnCloseEvent ( IN HTTP_PROTOCOL HttpInstance)

Create events for the TCP connection token and TCP close token.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.
Return values
EFI_SUCCESSThe events are created successfully.
othersOther error as indicated.

Definition at line 292 of file HttpProto.c.

◆ HttpCreateTcpRxEvent()

EFI_STATUS HttpCreateTcpRxEvent ( IN HTTP_TOKEN_WRAP Wrap)

Create event for the TCP receive token which is used to receive HTTP body.

Parameters
[in]WrapPoint to HTTP token's wrap data.
Return values
EFI_SUCCESSThe events is created successfully.
othersOther error as indicated.

Definition at line 524 of file HttpProto.c.

◆ HttpCreateTcpRxEventForHeader()

EFI_STATUS HttpCreateTcpRxEventForHeader ( IN HTTP_PROTOCOL HttpInstance)

Create event for the TCP receive token which is used to receive HTTP header.

Parameters
[in]HttpInstancePointer to HTTP_PROTOCOL structure.
Return values
EFI_SUCCESSThe events is created successfully.
othersOther error as indicated.

Definition at line 473 of file HttpProto.c.

◆ HttpCreateTcpTxEvent()

EFI_STATUS HttpCreateTcpTxEvent ( IN HTTP_TOKEN_WRAP Wrap)

Create event for the TCP transmit token.

Parameters
[in]WrapPoint to HTTP token's wrap data.
Return values
EFI_SUCCESSThe events is created successfully.
othersOther error as indicated.

Definition at line 413 of file HttpProto.c.

◆ HttpInitProtocol()

EFI_STATUS HttpInitProtocol ( IN OUT HTTP_PROTOCOL HttpInstance,
IN BOOLEAN  IpVersion 
)

Initialize the HTTP_PROTOCOL structure to the unconfigured state.

Parameters
[in,out]HttpInstancePointer to HTTP_PROTOCOL structure.
[in]IpVersionIndicate us TCP4 protocol or TCP6 protocol.
Return values
EFI_SUCCESSHTTP_PROTOCOL structure is initialized successfully.
OthersOther error as indicated.

Definition at line 617 of file HttpProto.c.

◆ HttpInitSession()

EFI_STATUS HttpInitSession ( IN HTTP_PROTOCOL HttpInstance,
IN HTTP_TOKEN_WRAP Wrap,
IN BOOLEAN  Configure,
IN BOOLEAN  TlsConfigure 
)

Initialize Http session.

Parameters
[in]HttpInstanceThe HTTP instance private data.
[in]WrapThe HTTP token's wrap data.
[in]ConfigureThe Flag indicates whether need to initialize session.
[in]TlsConfigureThe Flag indicates whether it's the new Tls session.
Return values
EFI_SUCCESSThe initialization of session is done.
OthersOther error as indicated.

Definition at line 1407 of file HttpProto.c.

◆ HttpNotify()

VOID HttpNotify ( IN EDKII_HTTP_CALLBACK_EVENT  Event,
IN EFI_STATUS  EventStatus 
)

Send Events via EDKII_HTTP_CALLBACK_PROTOCOL.

Parameters
[in]EventThe event that occurs in the current state.
[in]EventStatusThe Status of Event, EFI_SUCCESS or other errors.

Definition at line 2213 of file HttpProto.c.

◆ HttpResponseWorker()

EFI_STATUS HttpResponseWorker ( IN HTTP_TOKEN_WRAP Wrap)

The work function of EfiHttpResponse().

Parameters
[in]WrapPointer to HTTP token's wrap data.
Return values
EFI_SUCCESSAllocation succeeded.
EFI_OUT_OF_RESOURCESFailed to complete the operation due to lack of resources.
EFI_NOT_READYCan't find a corresponding TxToken.

The work function of EfiHttpResponse().

Parameters
[in]WrapPointer to HTTP token's wrap data.
Return values
EFI_SUCCESSAllocation succeeded.
EFI_OUT_OF_RESOURCESFailed to complete the operation due to lack of resources.
EFI_NOT_READYCan't find a corresponding Tx4Token/Tx6Token or the EFI_HTTP_UTILITIES_PROTOCOL is not available.

Definition at line 966 of file HttpImpl.c.

◆ HttpTcpNotReady()

EFI_STATUS EFIAPI HttpTcpNotReady ( IN NET_MAP Map,
IN NET_MAP_ITEM Item,
IN VOID *  Context 
)

Check whether the HTTP message associated with TxToken or Tx6Token is already sent out.

Parameters
[in]MapThe container of TxToken.
[in]ItemCurrent item to check against.
[in]ContextThe Token to check against.
Return values
EFI_NOT_READYThe HTTP message is still queued in the list.
EFI_SUCCESSThe HTTP message has been sent out.

Check whether the HTTP message associated with Tx4Token or Tx6Token is already sent out.

Parameters
[in]MapThe container of Tx4Token or Tx6Token.
[in]ItemCurrent item to check against.
[in]ContextThe Token to check against.
Return values
EFI_NOT_READYThe HTTP message is still queued in the list.
EFI_SUCCESSThe HTTP message has been sent out.

Definition at line 1691 of file HttpProto.c.

◆ HttpTcpReceive()

EFI_STATUS EFIAPI HttpTcpReceive ( IN NET_MAP Map,
IN NET_MAP_ITEM Item,
IN VOID *  Context 
)

Receive the HTTP response by processing the associated HTTP token.

Parameters
[in]MapThe container of Rx4Token or Rx6Token.
[in]ItemCurrent item to check against.
[in]ContextThe Token to check against.
Return values
EFI_SUCCESSThe HTTP response is queued into TCP receive queue.
OthersOther error as indicated.

Definition at line 1797 of file HttpProto.c.

◆ HttpTcpReceiveBody()

EFI_STATUS HttpTcpReceiveBody ( IN HTTP_TOKEN_WRAP Wrap,
IN EFI_HTTP_MESSAGE HttpMsg 
)

Receive the HTTP body by processing the associated HTTP token.

Parameters
[in]WrapThe HTTP token's wrap data.
[in]HttpMsgThe HTTP message data.
Return values
EFI_SUCCESSThe HTTP body is received.
OthersOther error as indicated.

Definition at line 2087 of file HttpProto.c.

◆ HttpTcpReceiveHeader()

EFI_STATUS HttpTcpReceiveHeader ( IN HTTP_PROTOCOL HttpInstance,
IN OUT UINTN SizeofHeaders,
IN OUT UINTN BufferSize,
IN EFI_EVENT  Timeout 
)

Receive the HTTP header by processing the associated HTTP token.

Parameters
[in]HttpInstanceThe HTTP instance private data.
[in,out]SizeofHeadersThe HTTP header length.
[in,out]BufferSizeThe size of buffer to cache the header message.
[in]TimeoutThe time to wait for receiving the header packet.
Return values
EFI_SUCCESSThe HTTP header is received.
OthersOther errors as indicated.

Definition at line 1822 of file HttpProto.c.

◆ HttpTcpTokenCleanup()

VOID HttpTcpTokenCleanup ( IN HTTP_TOKEN_WRAP Wrap)

Clean up Tcp Tokens while the Tcp transmission error occurs.

Parameters
[in]WrapPointer to HTTP token's wrap data.

Definition at line 2147 of file HttpProto.c.

◆ HttpTcpTransmit()

EFI_STATUS EFIAPI HttpTcpTransmit ( IN NET_MAP Map,
IN NET_MAP_ITEM Item,
IN VOID *  Context 
)

Transmit the HTTP or HTTPS message by processing the associated HTTP token.

Parameters
[in]MapThe container of TxToken or Tx6Token.
[in]ItemCurrent item to check against.
[in]ContextThe Token to check against.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resources.
EFI_SUCCESSThe HTTP message is queued into TCP transmit queue.

Transmit the HTTP or HTTPS message by processing the associated HTTP token.

Parameters
[in]MapThe container of Tx4Token or Tx6Token.
[in]ItemCurrent item to check against.
[in]ContextThe Token to check against.
Return values
EFI_OUT_OF_RESOURCESFailed to allocate resources.
EFI_SUCCESSThe HTTP message is queued into TCP transmit queue.

Definition at line 1722 of file HttpProto.c.

◆ HttpTokenExist()

EFI_STATUS EFIAPI HttpTokenExist ( IN NET_MAP Map,
IN NET_MAP_ITEM Item,
IN VOID *  Context 
)

Check whether the user's token or event has already been enqueue on HTTP Tx or Rx Token list.

Parameters
[in]MapThe container of either user's transmit or receive token.
[in]ItemCurrent item to check against.
[in]ContextThe Token to check against.
Return values
EFI_ACCESS_DENIEDThe token or event has already been enqueued in IP
EFI_SUCCESSThe current item isn't the same token/event as the context.

Definition at line 1659 of file HttpProto.c.

◆ HttpTransmitTcp()

EFI_STATUS HttpTransmitTcp ( IN HTTP_PROTOCOL HttpInstance,
IN HTTP_TOKEN_WRAP Wrap,
IN UINT8 *  TxString,
IN UINTN  TxStringLen 
)

Send the HTTP or HTTPS message through TCP4 or TCP6.

Parameters
[in]HttpInstanceThe HTTP instance private data.
[in]WrapThe HTTP token's wrap data.
[in]TxStringBuffer containing the HTTP message string.
[in]TxStringLenLength of the HTTP message string in bytes.
Return values
EFI_SUCCESSThe HTTP message is queued into TCP transmit queue.
OthersOther error as indicated.

Definition at line 1483 of file HttpProto.c.