TianoCore EDK2
master
Loading...
Searching...
No Matches
redfishService.h
Go to the documentation of this file.
1
19
#ifndef LIBREDFISH_REDFISH_SERVICE_H_
20
#define LIBREDFISH_REDFISH_SERVICE_H_
21
22
#include <
IndustryStandard/Http11.h
>
23
24
#include <
Library/BaseLib.h
>
25
#include <
Library/BaseMemoryLib.h
>
26
#include <
Library/DebugLib.h
>
27
#include <
Library/HttpLib.h
>
28
#include <
Library/MemoryAllocationLib.h
>
29
#include <
Library/NetLib.h
>
30
#include <
Library/RedfishContentCodingLib.h
>
31
#include <
Library/UefiRuntimeServicesTableLib.h
>
32
#include <
Library/UefiBootServicesTableLib.h
>
33
34
#include <
Include/Library/RedfishCrtLib.h
>
35
36
#include <
Protocol/EdkIIRedfishConfigHandler.h
>
37
#include <
Protocol/RestEx.h
>
38
39
#include <jansson.h>
40
41
typedef
struct
{
42
char
*host;
43
json_t *versions;
44
unsigned
int
flags;
45
char
*sessionToken;
46
char
*basicAuthStr;
47
//
48
// point to the <HOST> part in above "host" field, which will be put into
49
// the "Host" header of HTTP request message.
50
//
51
char
*HostHeaderValue;
52
EFI_REST_EX_PROTOCOL
*RestEx;
53
}
redfishService
;
54
55
typedef
struct
{
56
json_t *json;
57
redfishService
*service;
58
}
redfishPayload
;
59
60
#define REDFISH_AUTH_BASIC 0
61
#define REDFISH_AUTH_BEARER_TOKEN 1
62
#define REDFISH_AUTH_SESSION 2
63
64
#define REDFISH_HTTP_RESPONSE_TIMEOUT 5000
65
69
#define HTTP_FLAG L"http://"
70
#define HTTPS_FLAG L"https://"
71
76
#define REDFISH_FIRST_URL L"/redfish/v1"
77
78
typedef
struct
{
79
unsigned
int
authType;
80
union
{
81
struct
{
82
char
*username;
83
char
*password;
84
} userPass;
85
struct
{
86
char
*token;
87
} authToken;
88
} authCodes;
89
}
enumeratorAuthentication
;
90
91
// Values for flags
92
#define REDFISH_FLAG_SERVICE_NO_VERSION_DOC 0x00000001
// The Redfish Service lacks the version document (in violation of the Redfish spec)
93
redfishService
*
94
createServiceEnumerator (
95
REDFISH_CONFIG_SERVICE_INFORMATION
*RedfishConfigServiceInfo,
96
const
char
*rootUri,
97
enumeratorAuthentication
*auth,
98
unsigned
int
flags
99
);
100
101
json_t *
102
getUriFromService (
103
redfishService
*service,
104
const
char
*uri,
105
EFI_HTTP_STATUS_CODE
**StatusCode
106
);
107
108
json_t *
109
getUriFromServiceEx (
110
redfishService
*service,
111
const
char
*uri,
112
EFI_HTTP_HEADER
**Headers,
113
UINTN
*HeaderCount,
114
EFI_HTTP_STATUS_CODE
**StatusCode
115
);
116
117
json_t *
118
patchUriFromService (
119
redfishService
*service,
120
const
char
*uri,
121
const
char
*content,
122
EFI_HTTP_STATUS_CODE
**StatusCode
123
);
124
125
json_t *
126
patchUriFromServiceEx (
127
redfishService
*service,
128
const
char
*uri,
129
const
char
*content,
130
EFI_HTTP_HEADER
**Headers,
131
UINTN
*HeaderCount,
132
EFI_HTTP_STATUS_CODE
**StatusCode
133
);
134
135
json_t *
136
postUriFromService (
137
redfishService
*service,
138
const
char
*uri,
139
const
char
*content,
140
size_t
contentLength,
141
const
char
*contentType,
142
EFI_HTTP_STATUS_CODE
**StatusCode
143
);
144
145
json_t *
146
postUriFromServiceEx (
147
redfishService
*service,
148
const
char
*uri,
149
const
char
*content,
150
size_t
contentLength,
151
const
char
*contentType,
152
EFI_HTTP_HEADER
**Headers,
153
UINTN
*HeaderCount,
154
EFI_HTTP_STATUS_CODE
**StatusCode
155
);
156
157
json_t *
158
putUriFromServiceEx (
159
redfishService
*service,
160
const
char
*uri,
161
const
char
*content,
162
size_t
contentLength,
163
const
char
*contentType,
164
EFI_HTTP_HEADER
**Headers,
165
UINTN
*HeaderCount,
166
EFI_HTTP_STATUS_CODE
**StatusCode
167
);
168
169
json_t *
170
deleteUriFromService (
171
redfishService
*service,
172
const
char
*uri,
173
EFI_HTTP_STATUS_CODE
**StatusCode
174
);
175
176
json_t *
177
deleteUriFromServiceEx (
178
redfishService
*service,
179
const
char
*uri,
180
const
char
*content,
181
EFI_HTTP_STATUS_CODE
**StatusCode
182
);
183
184
redfishPayload
*
185
getRedfishServiceRoot (
186
redfishService
*service,
187
const
char
*version,
188
EFI_HTTP_STATUS_CODE
**StatusCode
189
);
190
191
redfishPayload
*
192
getPayloadByPath (
193
redfishService
*service,
194
const
char
*path,
195
EFI_HTTP_STATUS_CODE
**StatusCode
196
);
197
198
void
199
cleanupServiceEnumerator (
200
redfishService
*service
201
);
202
203
#endif
UINTN
UINT64 UINTN
Definition:
ProcessorBind.h:112
BaseLib.h
BaseMemoryLib.h
EdkIIRedfishConfigHandler.h
Http11.h
HttpLib.h
DebugLib.h
EFI_HTTP_STATUS_CODE
EFI_HTTP_STATUS_CODE
Definition:
Http.h:59
MemoryAllocationLib.h
NetLib.h
RedfishContentCodingLib.h
RedfishCrtLib.h
RestEx.h
UefiBootServicesTableLib.h
UefiRuntimeServicesTableLib.h
_EFI_REST_EX_PROTOCOL
Definition:
RestEx.h:378
EFI_HTTP_HEADER
Definition:
Http.h:210
REDFISH_CONFIG_SERVICE_INFORMATION
Definition:
EdkIIRedfishConfigHandler.h:21
enumeratorAuthentication
Definition:
redfishService.h:78
redfishPayload
Definition:
redfishService.h:55
redfishService
Definition:
redfishService.h:41
RedfishPkg
PrivateLibrary
RedfishLib
edk2libredfish
include
redfishService.h
Generated on Fri Nov 15 2024 18:01:23 for TianoCore EDK2 by
1.9.6