TianoCore EDK2 master
Loading...
Searching...
No Matches
HttpProto.c File Reference
#include "HttpDriver.h"

Go to the source code of this file.

Functions

VOID EFIAPI HttpCommonNotify (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI HttpTcpTransmitNotifyDpc (IN VOID *Context)
 
VOID EFIAPI HttpTcpTransmitNotify (IN EFI_EVENT Event, IN VOID *Context)
 
VOID EFIAPI HttpTcpReceiveNotifyDpc (IN VOID *Context)
 
VOID EFIAPI HttpTcpReceiveNotify (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 HttpInitSession (IN HTTP_PROTOCOL *HttpInstance, IN HTTP_TOKEN_WRAP *Wrap, IN BOOLEAN Configure, IN BOOLEAN TlsConfigure)
 
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 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)
 
VOID HttpNotify (IN EDKII_HTTP_CALLBACK_EVENT Event, IN EFI_STATUS EventStatus)
 

Detailed Description

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

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.

◆ HttpTcpNotReady()

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

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.

◆ HttpTcpReceiveNotify()

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

Request HttpTcpReceiveNotifyDpc as a DPC at TPL_CALLBACK.

Parameters
EventThe receive event delivered to TCP for receive.
ContextContext for the callback.

Definition at line 271 of file HttpProto.c.

◆ HttpTcpReceiveNotifyDpc()

VOID EFIAPI HttpTcpReceiveNotifyDpc ( IN VOID *  Context)

The notify function associated with Rx4Token for Tcp4->Receive () or Rx6Token for Tcp6->Receive().

Parameters
[in]ContextThe context.

Definition at line 122 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 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.

◆ HttpTcpTransmitNotify()

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

Request HttpTcpTransmitNotifyDpc as a DPC at TPL_CALLBACK.

Parameters
EventThe receive event delivered to TCP for transmit.
ContextContext for the callback.

Definition at line 103 of file HttpProto.c.

◆ HttpTcpTransmitNotifyDpc()

VOID EFIAPI HttpTcpTransmitNotifyDpc ( IN VOID *  Context)

The notify function associated with Tx4Token for Tcp4->Transmit() or Tx6Token for Tcp6->Transmit().

Parameters
[in]ContextThe context.

Definition at line 42 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.