TianoCore EDK2 master
Loading...
Searching...
No Matches
RedfishHttpLib.c
Go to the documentation of this file.
1
11#include <Library/BaseLib.h>
12#include <Library/DebugLib.h>
15#include <Library/UefiLib.h>
16
17EDKII_REDFISH_HTTP_PROTOCOL *mRedfishHttpProtocol = NULL;
18
29REDFISH_SERVICE
31 IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo
32 )
33{
34 if (mRedfishHttpProtocol == NULL) {
35 return NULL;
36 }
37
38 return mRedfishHttpProtocol->CreateService (
39 mRedfishHttpProtocol,
40 RedfishConfigServiceInfo
41 );
42}
43
56 IN REDFISH_SERVICE RedfishService
57 )
58{
59 if (mRedfishHttpProtocol == NULL) {
60 return EFI_NOT_READY;
61 }
62
63 return mRedfishHttpProtocol->FreeService (
64 mRedfishHttpProtocol,
65 RedfishService
66 );
67}
68
80EDKII_JSON_VALUE
82 IN REDFISH_PAYLOAD RedfishPayload
83 )
84{
85 if (mRedfishHttpProtocol == NULL) {
86 return NULL;
87 }
88
89 return mRedfishHttpProtocol->JsonInPayload (
90 mRedfishHttpProtocol,
91 RedfishPayload
92 );
93}
94
107 IN REDFISH_REQUEST *Request
108 )
109{
110 if (mRedfishHttpProtocol == NULL) {
111 return EFI_NOT_READY;
112 }
113
114 return mRedfishHttpProtocol->FreeRequest (
115 mRedfishHttpProtocol,
116 Request
117 );
118}
119
132 IN REDFISH_RESPONSE *Response
133 )
134{
135 if (mRedfishHttpProtocol == NULL) {
136 return EFI_NOT_READY;
137 }
138
139 return mRedfishHttpProtocol->FreeResponse (
140 mRedfishHttpProtocol,
141 Response
142 );
143}
144
156 IN EFI_STRING Uri
157 )
158{
159 if (mRedfishHttpProtocol == NULL) {
160 return EFI_NOT_READY;
161 }
162
163 return mRedfishHttpProtocol->ExpireResponse (
164 mRedfishHttpProtocol,
165 Uri
166 );
167}
168
188 IN REDFISH_SERVICE Service,
189 IN EFI_STRING Uri,
190 IN REDFISH_REQUEST *Request OPTIONAL,
191 OUT REDFISH_RESPONSE *Response,
192 IN BOOLEAN UseCache
193 )
194{
195 if (mRedfishHttpProtocol == NULL) {
196 return EFI_NOT_READY;
197 }
198
199 return mRedfishHttpProtocol->GetResource (
200 mRedfishHttpProtocol,
201 Service,
202 Uri,
203 Request,
204 Response,
205 UseCache
206 );
207}
208
224 IN REDFISH_SERVICE Service,
225 IN EFI_STRING Uri,
226 IN CHAR8 *Content,
227 OUT REDFISH_RESPONSE *Response
228 )
229{
230 if (mRedfishHttpProtocol == NULL) {
231 return EFI_NOT_READY;
232 }
233
234 return mRedfishHttpProtocol->PatchResource (
235 mRedfishHttpProtocol,
236 Service,
237 Uri,
238 Content,
239 0,
240 NULL,
241 Response
242 );
243}
244
265 IN REDFISH_SERVICE Service,
266 IN EFI_STRING Uri,
267 IN CHAR8 *Content,
268 IN UINTN ContentSize OPTIONAL,
269 IN CHAR8 *ContentType OPTIONAL,
270 OUT REDFISH_RESPONSE *Response
271 )
272{
273 if (mRedfishHttpProtocol == NULL) {
274 return EFI_NOT_READY;
275 }
276
277 return mRedfishHttpProtocol->PatchResource (
278 mRedfishHttpProtocol,
279 Service,
280 Uri,
281 Content,
282 ContentSize,
283 ContentType,
284 Response
285 );
286}
287
303 IN REDFISH_SERVICE Service,
304 IN EFI_STRING Uri,
305 IN CHAR8 *Content,
306 OUT REDFISH_RESPONSE *Response
307 )
308{
309 if (mRedfishHttpProtocol == NULL) {
310 return EFI_NOT_READY;
311 }
312
313 return mRedfishHttpProtocol->PutResource (
314 mRedfishHttpProtocol,
315 Service,
316 Uri,
317 Content,
318 0,
319 NULL,
320 Response
321 );
322}
323
344 IN REDFISH_SERVICE Service,
345 IN EFI_STRING Uri,
346 IN CHAR8 *Content,
347 IN UINTN ContentSize OPTIONAL,
348 IN CHAR8 *ContentType OPTIONAL,
349 OUT REDFISH_RESPONSE *Response
350 )
351{
352 if (mRedfishHttpProtocol == NULL) {
353 return EFI_NOT_READY;
354 }
355
356 return mRedfishHttpProtocol->PutResource (
357 mRedfishHttpProtocol,
358 Service,
359 Uri,
360 Content,
361 ContentSize,
362 ContentType,
363 Response
364 );
365}
366
382 IN REDFISH_SERVICE Service,
383 IN EFI_STRING Uri,
384 IN CHAR8 *Content,
385 OUT REDFISH_RESPONSE *Response
386 )
387{
388 if (mRedfishHttpProtocol == NULL) {
389 return EFI_NOT_READY;
390 }
391
392 return mRedfishHttpProtocol->PostResource (
393 mRedfishHttpProtocol,
394 Service,
395 Uri,
396 Content,
397 0,
398 NULL,
399 Response
400 );
401}
402
423 IN REDFISH_SERVICE Service,
424 IN EFI_STRING Uri,
425 IN CHAR8 *Content,
426 IN UINTN ContentSize OPTIONAL,
427 IN CHAR8 *ContentType OPTIONAL,
428 OUT REDFISH_RESPONSE *Response
429 )
430{
431 if (mRedfishHttpProtocol == NULL) {
432 return EFI_NOT_READY;
433 }
434
435 return mRedfishHttpProtocol->PostResource (
436 mRedfishHttpProtocol,
437 Service,
438 Uri,
439 Content,
440 ContentSize,
441 ContentType,
442 Response
443 );
444}
445
460 IN REDFISH_SERVICE Service,
461 IN EFI_STRING Uri,
462 OUT REDFISH_RESPONSE *Response
463 )
464{
465 if (mRedfishHttpProtocol == NULL) {
466 return EFI_NOT_READY;
467 }
468
469 return mRedfishHttpProtocol->DeleteResource (
470 mRedfishHttpProtocol,
471 Service,
472 Uri,
473 NULL,
474 0,
475 NULL,
476 Response
477 );
478}
479
501 IN REDFISH_SERVICE Service,
502 IN EFI_STRING Uri,
503 IN CHAR8 *Content OPTIONAL,
504 IN UINTN ContentSize OPTIONAL,
505 IN CHAR8 *ContentType OPTIONAL,
506 OUT REDFISH_RESPONSE *Response
507 )
508{
509 if (mRedfishHttpProtocol == NULL) {
510 return EFI_NOT_READY;
511 }
512
513 return mRedfishHttpProtocol->DeleteResource (
514 mRedfishHttpProtocol,
515 Service,
516 Uri,
517 Content,
518 ContentSize,
519 ContentType,
520 Response
521 );
522}
523
530VOID
531EFIAPI
533 IN EFI_EVENT Event,
534 IN VOID *Context
535 )
536{
537 EFI_STATUS Status;
538
539 if (mRedfishHttpProtocol != NULL) {
540 gBS->CloseEvent (Event);
541 return;
542 }
543
544 Status = gBS->LocateProtocol (
545 &gEdkIIRedfishHttpProtocolGuid,
546 NULL,
547 (VOID **)&mRedfishHttpProtocol
548 );
549 if (EFI_ERROR (Status)) {
550 return;
551 }
552
553 gBS->CloseEvent (Event);
554}
555
568EFIAPI
570 IN EFI_HANDLE ImageHandle,
571 IN EFI_SYSTEM_TABLE *SystemTable
572 )
573{
574 VOID *Registration;
575
577 &gEdkIIRedfishHttpProtocolGuid,
578 TPL_CALLBACK,
580 NULL,
581 &Registration
582 );
583
584 return EFI_SUCCESS;
585}
UINT64 UINTN
#define NULL
Definition: Base.h:319
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
REDFISH_SERVICE RedfishCreateService(IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo)
EFI_STATUS RedfishHttpPatchResource(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content, OUT REDFISH_RESPONSE *Response)
EFI_STATUS RedfishCleanupService(IN REDFISH_SERVICE RedfishService)
EFI_STATUS RedfishHttpPostResourceEx(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *Response)
EFI_STATUS RedfishHttpExpireResponse(IN EFI_STRING Uri)
EFI_STATUS RedfishHttpGetResource(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN REDFISH_REQUEST *Request OPTIONAL, OUT REDFISH_RESPONSE *Response, IN BOOLEAN UseCache)
EFI_STATUS RedfishHttpDeleteResourceEx(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content OPTIONAL, IN UINTN ContentSize OPTIONAL, IN CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *Response)
EFI_STATUS RedfishHttpPutResource(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content, OUT REDFISH_RESPONSE *Response)
EFI_STATUS RedfishHttpPutResourceEx(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *Response)
EFI_STATUS RedfishHttpPatchResourceEx(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *Response)
EFI_STATUS EFIAPI RedfishHttpConstructor(IN EFI_HANDLE ImageHandle, IN EFI_SYSTEM_TABLE *SystemTable)
EFI_STATUS RedfishHttpFreeResponse(IN REDFISH_RESPONSE *Response)
EFI_STATUS RedfishHttpFreeRequest(IN REDFISH_REQUEST *Request)
EFI_STATUS RedfishHttpPostResource(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN CHAR8 *Content, OUT REDFISH_RESPONSE *Response)
EDKII_JSON_VALUE RedfishJsonInPayload(IN REDFISH_PAYLOAD RedfishPayload)
EFI_STATUS RedfishHttpDeleteResource(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, OUT REDFISH_RESPONSE *Response)
VOID EFIAPI RedfishHttpProtocolIsReady(IN EFI_EVENT Event, IN VOID *Context)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
VOID * EFI_EVENT
Definition: UefiBaseType.h:37
VOID * EFI_HANDLE
Definition: UefiBaseType.h:33
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
EFI_BOOT_SERVICES * gBS
EFI_EVENT EFIAPI EfiCreateProtocolNotifyEvent(IN EFI_GUID *ProtocolGuid, IN EFI_TPL NotifyTpl, IN EFI_EVENT_NOTIFY NotifyFunction, IN VOID *NotifyContext OPTIONAL, OUT VOID **Registration)
Definition: UefiLib.c:134