1 /** @file
2   This file defines the EFI HTTP Boot Callback Protocol interface.
3 
4   Copyright (c) 2017 - 2018, Intel Corporation. All rights reserved.<BR>
5   SPDX-License-Identifier: BSD-2-Clause-Patent
6 
7   @par Revision Reference:
8   This Protocol is introduced in UEFI Specification 2.7
9 
10 **/
11 
12 #ifndef __EFI_HTTP_BOOT_CALLBACK_H__
13 #define __EFI_HTTP_BOOT_CALLBACK_H__
14 
15 #define EFI_HTTP_BOOT_CALLBACK_PROTOCOL_GUID \
16   { \
17     0xba23b311, 0x343d, 0x11e6, {0x91, 0x85, 0x58, 0x20, 0xb1, 0xd6, 0x52, 0x99} \
18   }
19 
20 typedef struct _EFI_HTTP_BOOT_CALLBACK_PROTOCOL EFI_HTTP_BOOT_CALLBACK_PROTOCOL;
21 
22 ///
23 /// EFI_HTTP_BOOT_CALLBACK_DATA_TYPE
24 ///
25 typedef enum {
26   ///
27   /// Data points to a DHCP4 packet which is about to transmit or has received.
28   ///
29   HttpBootDhcp4,
30   ///
31   /// Data points to a DHCP6 packet which is about to be transmit or has received.
32   ///
33   HttpBootDhcp6,
34   ///
35   /// Data points to an EFI_HTTP_MESSAGE structure, whichcontians a HTTP request message
36   /// to be transmitted.
37   ///
38   HttpBootHttpRequest,
39   ///
40   /// Data points to an EFI_HTTP_MESSAGE structure, which contians a received HTTP
41   /// response message.
42   ///
43   HttpBootHttpResponse,
44   ///
45   /// Part of the entity body has been received from the HTTP server. Data points to the
46   /// buffer of the entity body data.
47   ///
48   HttpBootHttpEntityBody,
49   HttpBootTypeMax
50 } EFI_HTTP_BOOT_CALLBACK_DATA_TYPE;
51 
52 /**
53   Callback function that is invoked when the HTTP Boot driver is about to transmit or has received a
54   packet.
55 
56   This function is invoked when the HTTP Boot driver is about to transmit or has received packet.
57   Parameters DataType and Received specify the type of event and the format of the buffer pointed
58   to by Data. Due to the polling nature of UEFI device drivers, this callback function should not
59   execute for more than 5 ms.
60   The returned status code determines the behavior of the HTTP Boot driver.
61 
62   @param[in]  This                Pointer to the EFI_HTTP_BOOT_CALLBACK_PROTOCOL instance.
63   @param[in]  DataType            The event that occurs in the current state.
64   @param[in]  Received            TRUE if the callback is being invoked due to a receive event.
65                                   FALSE if the callback is being invoked due to a transmit event.
66   @param[in]  DataLength          The length in bytes of the buffer pointed to by Data.
67   @param[in]  Data                A pointer to the buffer of data, the data type is specified by
68                                   DataType.
69 
70   @retval EFI_SUCCESS             Tells the HTTP Boot driver to continue the HTTP Boot process.
71   @retval EFI_ABORTED             Tells the HTTP Boot driver to abort the current HTTP Boot process.
72 **/
73 typedef
74 EFI_STATUS
75 (EFIAPI *EFI_HTTP_BOOT_CALLBACK)(
76   IN EFI_HTTP_BOOT_CALLBACK_PROTOCOL    *This,
77   IN EFI_HTTP_BOOT_CALLBACK_DATA_TYPE   DataType,
78   IN BOOLEAN                            Received,
79   IN UINT32                             DataLength,
80   IN VOID                               *Data   OPTIONAL
81   );
82 
83 ///
84 /// EFI HTTP Boot Callback Protocol is invoked when the HTTP Boot driver is about to transmit or
85 /// has received a packet. The EFI HTTP Boot Callback Protocol must be installed on the same handle
86 /// as the Load File Protocol for the HTTP Boot.
87 ///
88 struct _EFI_HTTP_BOOT_CALLBACK_PROTOCOL {
89   EFI_HTTP_BOOT_CALLBACK    Callback;
90 };
91 
92 extern EFI_GUID  gEfiHttpBootCallbackProtocolGuid;
93 
94 #endif
95