1 | /** @file
|
---|
2 | This file defines the EFI REST Protocol interface.
|
---|
3 |
|
---|
4 | Copyright (c) 2015, 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.5
|
---|
9 |
|
---|
10 | **/
|
---|
11 |
|
---|
12 | #ifndef __EFI_REST_PROTOCOL_H__
|
---|
13 | #define __EFI_REST_PROTOCOL_H__
|
---|
14 |
|
---|
15 | #include <Protocol/Http.h>
|
---|
16 |
|
---|
17 | #define EFI_REST_PROTOCOL_GUID \
|
---|
18 | { \
|
---|
19 | 0x0db48a36, 0x4e54, 0xea9c, {0x9b, 0x09, 0x1e, 0xa5, 0xbe, 0x3a, 0x66, 0x0b } \
|
---|
20 | }
|
---|
21 |
|
---|
22 | typedef struct _EFI_REST_PROTOCOL EFI_REST_PROTOCOL;
|
---|
23 |
|
---|
24 | /**
|
---|
25 | Provides a simple HTTP-like interface to send and receive resources from a REST
|
---|
26 | service.
|
---|
27 |
|
---|
28 | The SendReceive() function sends an HTTP request to this REST service, and returns a
|
---|
29 | response when the data is retrieved from the service. RequestMessage contains the HTTP
|
---|
30 | request to the REST resource identified by RequestMessage.Request.Url. The
|
---|
31 | ResponseMessage is the returned HTTP response for that request, including any HTTP
|
---|
32 | status.
|
---|
33 |
|
---|
34 | @param[in] This Pointer to EFI_REST_PROTOCOL instance for a particular
|
---|
35 | REST service.
|
---|
36 | @param[in] RequestMessage Pointer to the HTTP request data for this resource.
|
---|
37 | @param[out] ResponseMessage Pointer to the HTTP response data obtained for this
|
---|
38 | requested.
|
---|
39 |
|
---|
40 | @retval EFI_SUCCESS Operation succeeded.
|
---|
41 | @retval EFI_INVALID_PARAMETER This, RequestMessage, or ResponseMessage are NULL.
|
---|
42 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
43 | **/
|
---|
44 | typedef
|
---|
45 | EFI_STATUS
|
---|
46 | (EFIAPI *EFI_REST_SEND_RECEIVE)(
|
---|
47 | IN EFI_REST_PROTOCOL *This,
|
---|
48 | IN EFI_HTTP_MESSAGE *RequestMessage,
|
---|
49 | OUT EFI_HTTP_MESSAGE *ResponseMessage
|
---|
50 | );
|
---|
51 |
|
---|
52 | /**
|
---|
53 | The GetServiceTime() function is an optional interface to obtain the current time from
|
---|
54 | this REST service instance. If this REST service does not support retrieving the time,
|
---|
55 | this function returns EFI_UNSUPPORTED.
|
---|
56 |
|
---|
57 | @param[in] This Pointer to EFI_REST_PROTOCOL instance.
|
---|
58 | @param[out] Time A pointer to storage to receive a snapshot of the
|
---|
59 | current time of the REST service.
|
---|
60 |
|
---|
61 | @retval EFI_SUCCESS Operation succeeded
|
---|
62 | @retval EFI_INVALID_PARAMETER This or Time are NULL.
|
---|
63 | @retval EFI_UNSUPPORTED The RESTful service does not support returning the
|
---|
64 | time.
|
---|
65 | @retval EFI_DEVICE_ERROR An unexpected system or network error occurred.
|
---|
66 | **/
|
---|
67 | typedef
|
---|
68 | EFI_STATUS
|
---|
69 | (EFIAPI *EFI_REST_GET_TIME)(
|
---|
70 | IN EFI_REST_PROTOCOL *This,
|
---|
71 | OUT EFI_TIME *Time
|
---|
72 | );
|
---|
73 |
|
---|
74 | ///
|
---|
75 | /// The EFI REST protocol is designed to be used by EFI drivers and applications to send
|
---|
76 | /// and receive resources from a RESTful service. This protocol abstracts REST
|
---|
77 | /// (Representational State Transfer) client functionality. This EFI protocol could be
|
---|
78 | /// implemented to use an underlying EFI HTTP protocol, or it could rely on other
|
---|
79 | /// interfaces that abstract HTTP access to the resources.
|
---|
80 | ///
|
---|
81 | struct _EFI_REST_PROTOCOL {
|
---|
82 | EFI_REST_SEND_RECEIVE SendReceive;
|
---|
83 | EFI_REST_GET_TIME GetServiceTime;
|
---|
84 | };
|
---|
85 |
|
---|
86 | extern EFI_GUID gEfiRestProtocolGuid;
|
---|
87 |
|
---|
88 | #endif
|
---|