TianoCore EDK2 master
Loading...
Searching...
No Matches
RedfishHttpOperation.c
Go to the documentation of this file.
1
11#include "RedfishHttpData.h"
12
28 IN EFI_HTTP_HEADER *SrcHeaders,
29 IN UINTN SrcHeaderCount,
30 OUT EFI_HTTP_HEADER **DstHeaders,
31 OUT UINTN *DstHeaderCount
32 )
33{
34 UINTN Index;
35
36 if ((SrcHeaders == NULL) || (SrcHeaderCount == 0) || (DstHeaders == NULL) || (DstHeaderCount == NULL)) {
37 return EFI_INVALID_PARAMETER;
38 }
39
40 *DstHeaderCount = 0;
41 *DstHeaders = AllocateZeroPool (sizeof (EFI_HTTP_HEADER) * SrcHeaderCount);
42 if (*DstHeaders == NULL) {
43 return EFI_OUT_OF_RESOURCES;
44 }
45
46 *DstHeaderCount = SrcHeaderCount;
47 for (Index = 0; Index < SrcHeaderCount; Index++) {
48 (*DstHeaders)[Index].FieldName = ASCII_STR_DUPLICATE (SrcHeaders[Index].FieldName);
49 if ((*DstHeaders)[Index].FieldName == NULL) {
50 return EFI_OUT_OF_RESOURCES;
51 }
52
53 (*DstHeaders)[Index].FieldValue = ASCII_STR_DUPLICATE (SrcHeaders[Index].FieldValue);
54 if ((*DstHeaders)[Index].FieldValue == NULL) {
55 return EFI_OUT_OF_RESOURCES;
56 }
57 }
58
59 return EFI_SUCCESS;
60}
61
74 IN REDFISH_REQUEST *Request
75 )
76{
77 if (Request == NULL) {
78 return EFI_INVALID_PARAMETER;
79 }
80
81 if ((Request->Headers != NULL) && (Request->HeaderCount > 0)) {
82 HttpFreeHeaderFields (Request->Headers, Request->HeaderCount);
83 Request->Headers = NULL;
84 Request->HeaderCount = 0;
85 }
86
87 if (Request->Content != NULL) {
88 FreePool (Request->Content);
89 Request->Content = NULL;
90 }
91
92 if (Request->ContentType != NULL) {
93 FreePool (Request->ContentType);
94 Request->ContentType = NULL;
95 }
96
97 Request->ContentLength = 0;
98
99 return EFI_SUCCESS;
100}
101
113 IN REDFISH_RESPONSE *Response
114 )
115{
116 if (Response == NULL) {
117 return EFI_INVALID_PARAMETER;
118 }
119
120 if ((Response->Headers != NULL) && (Response->HeaderCount > 0)) {
121 HttpFreeHeaderFields (Response->Headers, Response->HeaderCount);
122 Response->Headers = NULL;
123 Response->HeaderCount = 0;
124 }
125
126 if (Response->Payload != NULL) {
127 ReleaseRedfishPayload (Response->Payload);
128 Response->Payload = NULL;
129 }
130
131 if (Response->StatusCode != NULL) {
132 FreePool (Response->StatusCode);
133 Response->StatusCode = NULL;
134 }
135
136 return EFI_SUCCESS;
137}
138
152 IN EFI_HTTP_MESSAGE *HttpMessage,
153 IN BOOLEAN IsRequest
154 )
155{
156 if (HttpMessage == NULL) {
157 return EFI_INVALID_PARAMETER;
158 }
159
160 if (IsRequest) {
161 if (HttpMessage->Data.Request != NULL) {
162 if (HttpMessage->Data.Request->Url != NULL) {
163 FreePool (HttpMessage->Data.Request->Url);
164 }
165
166 FreePool (HttpMessage->Data.Request);
167 HttpMessage->Data.Request = NULL;
168 }
169 } else {
170 if (HttpMessage->Data.Response != NULL) {
171 FreePool (HttpMessage->Data.Response);
172 HttpMessage->Data.Response = NULL;
173 }
174 }
175
176 if (HttpMessage->Body != NULL) {
177 FreePool (HttpMessage->Body);
178 HttpMessage->Body = NULL;
179 }
180
181 if (HttpMessage->Headers != NULL) {
182 HttpFreeHeaderFields (HttpMessage->Headers, HttpMessage->HeaderCount);
183 HttpMessage->Headers = NULL;
184 HttpMessage->HeaderCount = 0;
185 }
186
187 return EFI_SUCCESS;
188}
189
210 IN REDFISH_SERVICE_PRIVATE *ServicePrivate,
211 IN EFI_STRING Uri,
212 IN EFI_HTTP_METHOD Method,
213 IN REDFISH_REQUEST *Request OPTIONAL,
214 IN CHAR8 *ContentEncoding OPTIONAL
215 )
216{
217 EFI_STATUS Status;
218 EFI_STRING Url;
219 UINTN UrlSize;
220 UINTN Index;
221 EFI_HTTP_MESSAGE *RequestMsg;
222 EFI_HTTP_REQUEST_DATA *RequestData;
223 UINTN HeaderCount;
224 UINTN HeaderIndex;
225 EFI_HTTP_HEADER *Headers;
226 CHAR8 ContentLengthStr[REDFISH_CONTENT_LENGTH_SIZE];
227 VOID *Content;
228 UINTN ContentLength;
229 BOOLEAN HasContent;
230 BOOLEAN DoContentEncoding;
231
232 RequestMsg = NULL;
233 RequestData = NULL;
234 Url = NULL;
235 UrlSize = 0;
236 Content = NULL;
237 ContentLength = 0;
238 HeaderCount = REDFISH_COMMON_HEADER_SIZE;
239 HeaderIndex = 0;
240 Headers = NULL;
241 HasContent = FALSE;
242 DoContentEncoding = FALSE;
243
244 if ((ServicePrivate == NULL) || (IS_EMPTY_STRING (Uri))) {
245 return NULL;
246 }
247
248 if (Method >= HttpMethodMax) {
249 return NULL;
250 }
251
252 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: %s\n", __func__, Uri));
253
254 //
255 // Build full URL for HTTP query.
256 //
257 UrlSize = (AsciiStrLen (ServicePrivate->Host) + StrLen (Uri) + 1) * sizeof (CHAR16);
258 Url = AllocateZeroPool (UrlSize);
259 if (Url == NULL) {
260 return NULL;
261 }
262
263 UnicodeSPrint (Url, UrlSize, L"%a%s", ServicePrivate->Host, Uri);
264 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: Url: %s\n", __func__, Url));
265
266 //
267 // Step 1: build the HTTP headers.
268 //
269 if (!IS_EMPTY_STRING (ServicePrivate->SessionToken) || !IS_EMPTY_STRING (ServicePrivate->BasicAuth)) {
270 HeaderCount++;
271 }
272
273 if ((Request != NULL) && (Request->HeaderCount > 0)) {
274 HeaderCount += Request->HeaderCount;
275 }
276
277 //
278 // Check and see if we will do content encoding or not
279 //
280 if (!IS_EMPTY_STRING (ContentEncoding)) {
281 if (AsciiStrCmp (ContentEncoding, REDFISH_HTTP_CONTENT_ENCODING_NONE) != 0) {
282 DoContentEncoding = TRUE;
283 }
284 }
285
286 if ((Request != NULL) && !IS_EMPTY_STRING (Request->Content)) {
287 HeaderCount += 2;
288 HasContent = TRUE;
289 if (DoContentEncoding) {
290 HeaderCount += 1;
291 }
292 }
293
294 Headers = AllocateZeroPool (HeaderCount * sizeof (EFI_HTTP_HEADER));
295 if (Headers == NULL) {
296 goto ON_ERROR;
297 }
298
299 if (!IS_EMPTY_STRING (ServicePrivate->SessionToken)) {
300 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_X_AUTH_TOKEN, ServicePrivate->SessionToken);
301 if (EFI_ERROR (Status)) {
302 goto ON_ERROR;
303 }
304 } else if (!IS_EMPTY_STRING (ServicePrivate->BasicAuth)) {
305 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_AUTHORIZATION, ServicePrivate->BasicAuth);
306 if (EFI_ERROR (Status)) {
307 goto ON_ERROR;
308 }
309 }
310
311 if (Request != NULL) {
312 for (Index = 0; Index < Request->HeaderCount; Index++) {
313 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], Request->Headers[Index].FieldName, Request->Headers[Index].FieldValue);
314 if (EFI_ERROR (Status)) {
315 goto ON_ERROR;
316 }
317 }
318 }
319
320 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_HOST, ServicePrivate->HostName);
321 if (EFI_ERROR (Status)) {
322 goto ON_ERROR;
323 }
324
325 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], REDFISH_HTTP_HEADER_ODATA_VERSION_STR, REDFISH_HTTP_HEADER_ODATA_VERSION_VALUE);
326 if (EFI_ERROR (Status)) {
327 goto ON_ERROR;
328 }
329
330 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_ACCEPT, HTTP_CONTENT_TYPE_APP_JSON);
331 if (EFI_ERROR (Status)) {
332 goto ON_ERROR;
333 }
334
335 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_USER_AGENT, REDFISH_HTTP_HEADER_USER_AGENT_VALUE);
336 if (EFI_ERROR (Status)) {
337 goto ON_ERROR;
338 }
339
340 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], REDFISH_HTTP_HEADER_CONNECTION_STR, REDFISH_HTTP_HEADER_CONNECTION_VALUE);
341 if (EFI_ERROR (Status)) {
342 goto ON_ERROR;
343 }
344
345 //
346 // Handle content header
347 //
348 if (HasContent) {
349 if (Request->ContentType == NULL) {
350 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_CONTENT_TYPE, HTTP_CONTENT_TYPE_APP_JSON);
351 if (EFI_ERROR (Status)) {
352 goto ON_ERROR;
353 }
354 } else {
355 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_CONTENT_TYPE, Request->ContentType);
356 if (EFI_ERROR (Status)) {
357 goto ON_ERROR;
358 }
359 }
360
361 if (Request->ContentLength == 0) {
362 Request->ContentLength = AsciiStrLen (Request->Content);
363 }
364
366 ContentLengthStr,
367 sizeof (ContentLengthStr),
368 "%lu",
369 (UINT64)Request->ContentLength
370 );
371 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_CONTENT_LENGTH, ContentLengthStr);
372 if (EFI_ERROR (Status)) {
373 goto ON_ERROR;
374 }
375
376 //
377 // Encoding
378 //
379 if (DoContentEncoding) {
380 //
381 // We currently only support gzip Content-Encoding.
382 //
383 Status = RedfishContentEncode (
384 ContentEncoding,
385 Request->Content,
386 Request->ContentLength,
387 &Content,
388 &ContentLength
389 );
390 if (Status == EFI_INVALID_PARAMETER) {
391 DEBUG ((DEBUG_ERROR, "%a: Error to encode content.\n", __func__));
392 goto ON_ERROR;
393 } else if (Status == EFI_UNSUPPORTED) {
394 DoContentEncoding = FALSE;
395 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: No content coding for %a! Use raw data instead.\n", __func__, ContentEncoding));
397 if (EFI_ERROR (Status)) {
398 goto ON_ERROR;
399 }
400 } else {
401 Status = HttpSetFieldNameAndValue (&Headers[HeaderIndex++], HTTP_HEADER_CONTENT_ENCODING, HTTP_CONTENT_ENCODING_GZIP);
402 if (EFI_ERROR (Status)) {
403 goto ON_ERROR;
404 }
405 }
406 }
407
408 //
409 // When the content is from caller, we use our own copy so that we properly release it later.
410 //
411 if (!DoContentEncoding) {
412 Content = AllocateCopyPool (Request->ContentLength, Request->Content);
413 if (Content == NULL) {
414 goto ON_ERROR;
415 }
416
417 ContentLength = Request->ContentLength;
418 }
419 }
420
421 //
422 // Step 2: build the rest of HTTP request info.
423 //
424 RequestData = AllocateZeroPool (sizeof (EFI_HTTP_REQUEST_DATA));
425 if (RequestData == NULL) {
426 goto ON_ERROR;
427 }
428
429 RequestData->Method = Method;
430 RequestData->Url = Url;
431
432 //
433 // Step 3: fill in EFI_HTTP_MESSAGE
434 //
435 RequestMsg = AllocateZeroPool (sizeof (EFI_HTTP_MESSAGE));
436 if (RequestMsg == NULL) {
437 goto ON_ERROR;
438 }
439
440 ASSERT (HeaderIndex == HeaderCount);
441 RequestMsg->Data.Request = RequestData;
442 RequestMsg->HeaderCount = HeaderIndex;
443 RequestMsg->Headers = Headers;
444
445 if (HasContent) {
446 RequestMsg->BodyLength = ContentLength;
447 RequestMsg->Body = Content;
448 }
449
450 return RequestMsg;
451
452ON_ERROR:
453
454 if (Headers != NULL) {
455 HttpFreeHeaderFields (Headers, HeaderIndex);
456 }
457
458 if (RequestData != NULL) {
459 FreePool (RequestData);
460 }
461
462 if (RequestMsg != NULL) {
463 FreePool (RequestMsg);
464 }
465
466 if (Url != NULL) {
467 FreePool (Url);
468 }
469
470 return NULL;
471}
472
488 IN REDFISH_SERVICE_PRIVATE *ServicePrivate,
489 IN EFI_HTTP_MESSAGE *ResponseMsg,
490 OUT REDFISH_RESPONSE *RedfishResponse
491 )
492{
493 EFI_STATUS Status;
494 EDKII_JSON_VALUE JsonData;
495 EFI_HTTP_HEADER *ContentEncodedHeader;
496 EFI_HTTP_HEADER *ContentTypeHeader;
497 VOID *DecodedBody;
498 UINTN DecodedLength;
499
500 if ((ServicePrivate == NULL) || (ResponseMsg == NULL) || (RedfishResponse == NULL)) {
501 return EFI_INVALID_PARAMETER;
502 }
503
504 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a\n", __func__));
505
506 //
507 // Initialization
508 //
509 JsonData = NULL;
510 RedfishResponse->HeaderCount = 0;
511 RedfishResponse->Headers = NULL;
512 RedfishResponse->Payload = NULL;
513 RedfishResponse->StatusCode = NULL;
514 DecodedBody = NULL;
515 DecodedLength = 0;
516
517 //
518 // Return the HTTP StatusCode.
519 //
520 if (ResponseMsg->Data.Response != NULL) {
521 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: status: %d\n", __func__, ResponseMsg->Data.Response->StatusCode));
522 RedfishResponse->StatusCode = AllocateCopyPool (sizeof (EFI_HTTP_STATUS_CODE), &ResponseMsg->Data.Response->StatusCode);
523 if (RedfishResponse->StatusCode == NULL) {
524 DEBUG ((DEBUG_ERROR, "%a: Failed to create status code.\n", __func__));
525 }
526 }
527
528 //
529 // Return the HTTP headers.
530 //
531 if (ResponseMsg->Headers != NULL) {
532 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: header count: %d\n", __func__, ResponseMsg->HeaderCount));
533 Status = CopyHttpHeaders (
534 ResponseMsg->Headers,
535 ResponseMsg->HeaderCount,
536 &RedfishResponse->Headers,
537 &RedfishResponse->HeaderCount
538 );
539 if (EFI_ERROR (Status)) {
540 DEBUG ((DEBUG_ERROR, "%a: Failed to copy HTTP headers: %r\n", __func__, Status));
541 }
542 }
543
544 //
545 // Return the HTTP body.
546 //
547 if ((ResponseMsg->BodyLength != 0) && (ResponseMsg->Body != NULL)) {
548 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: body length: %d\n", __func__, ResponseMsg->BodyLength));
549
550 //
551 // We expect to see JSON body
552 //
553 ContentTypeHeader = HttpFindHeader (RedfishResponse->HeaderCount, RedfishResponse->Headers, HTTP_HEADER_CONTENT_TYPE);
554 if (ContentTypeHeader != NULL) {
555 if (AsciiStrCmp (ContentTypeHeader->FieldValue, HTTP_CONTENT_TYPE_APP_JSON) != 0) {
556 DEBUG ((DEBUG_WARN, "%a: body is not in %a format\n", __func__, HTTP_CONTENT_TYPE_APP_JSON));
557 }
558 }
559
560 //
561 // Check if data is encoded.
562 //
563 ContentEncodedHeader = HttpFindHeader (RedfishResponse->HeaderCount, RedfishResponse->Headers, HTTP_HEADER_CONTENT_ENCODING);
564 if (ContentEncodedHeader != NULL) {
565 //
566 // The content is encoded.
567 //
568 Status = RedfishContentDecode (
569 ContentEncodedHeader->FieldValue,
570 ResponseMsg->Body,
571 ResponseMsg->BodyLength,
572 &DecodedBody,
573 &DecodedLength
574 );
575 if (EFI_ERROR (Status)) {
576 DEBUG ((DEBUG_ERROR, "%a: Failed to decompress the response content: %r decoding method: %a\n.", __func__, Status, ContentEncodedHeader->FieldValue));
577 goto ON_ERROR;
578 }
579
580 JsonData = JsonLoadBuffer (DecodedBody, DecodedLength, 0, NULL);
581 FreePool (DecodedBody);
582 } else {
583 JsonData = JsonLoadBuffer (ResponseMsg->Body, ResponseMsg->BodyLength, 0, NULL);
584 }
585
586 if (!JsonValueIsNull (JsonData)) {
587 RedfishResponse->Payload = CreateRedfishPayload (ServicePrivate, JsonData);
588 if (RedfishResponse->Payload == NULL) {
589 DEBUG ((DEBUG_ERROR, "%a: Failed to create payload\n.", __func__));
590 }
591
592 JsonValueFree (JsonData);
593 } else {
594 DEBUG ((DEBUG_ERROR, "%a: No payload available\n", __func__));
595 }
596 }
597
598 return EFI_SUCCESS;
599
600ON_ERROR:
601
602 if (RedfishResponse != NULL) {
603 ReleaseRedfishResponse (RedfishResponse);
604 }
605
606 return Status;
607}
608
625 IN REDFISH_SERVICE Service,
626 IN EFI_STRING Uri,
627 IN EFI_HTTP_METHOD Method,
628 IN REDFISH_REQUEST *Request OPTIONAL,
629 OUT REDFISH_RESPONSE *Response
630 )
631{
632 EFI_STATUS Status;
633 EFI_STATUS RestExStatus;
634 EFI_HTTP_MESSAGE *RequestMsg;
635 EFI_HTTP_MESSAGE ResponseMsg;
636 REDFISH_SERVICE_PRIVATE *ServicePrivate;
637 EFI_HTTP_HEADER *XAuthTokenHeader;
638 CHAR8 *HttpContentEncoding;
639
640 if ((Service == NULL) || IS_EMPTY_STRING (Uri) || (Response == NULL)) {
641 return EFI_INVALID_PARAMETER;
642 }
643
644 DEBUG ((REDFISH_HTTP_CACHE_DEBUG_REQUEST, "%a: Method: 0x%x %s\n", __func__, Method, Uri));
645
646 ServicePrivate = (REDFISH_SERVICE_PRIVATE *)Service;
647 if (ServicePrivate->Signature != REDFISH_HTTP_SERVICE_SIGNATURE) {
648 DEBUG ((DEBUG_ERROR, "%a: signature check failure\n", __func__));
649 return EFI_INVALID_PARAMETER;
650 }
651
652 ZeroMem (&ResponseMsg, sizeof (ResponseMsg));
653 HttpContentEncoding = (CHAR8 *)PcdGetPtr (PcdRedfishServiceContentEncoding);
654
655 RequestMsg = BuildRequestMessage (Service, Uri, Method, Request, HttpContentEncoding);
656 if (RequestMsg == NULL) {
657 DEBUG ((DEBUG_ERROR, "%a: cannot build request message for %s\n", __func__, Uri));
658 return EFI_PROTOCOL_ERROR;
659 }
660
661 //
662 // call RESTEx to get response from REST service.
663 //
664 RestExStatus = ServicePrivate->RestEx->SendReceive (ServicePrivate->RestEx, RequestMsg, &ResponseMsg);
665 if (EFI_ERROR (RestExStatus)) {
666 DEBUG ((DEBUG_ERROR, "%a: %s SendReceive failure: %r\n", __func__, Uri, RestExStatus));
667 }
668
669 //
670 // Return status code, headers and payload to caller as much as possible even when RestEx returns failure.
671 //
672 Status = ParseResponseMessage (ServicePrivate, &ResponseMsg, Response);
673 if (EFI_ERROR (Status)) {
674 DEBUG ((DEBUG_ERROR, "%a: %s parse response failure: %r\n", __func__, Uri, Status));
675 } else {
676 //
677 // Capture session token in header
678 //
679 if ((Method == HttpMethodPost) &&
680 (Response->StatusCode != NULL) &&
681 ((*Response->StatusCode == HTTP_STATUS_200_OK) || (*Response->StatusCode == HTTP_STATUS_204_NO_CONTENT)))
682 {
683 XAuthTokenHeader = HttpFindHeader (ResponseMsg.HeaderCount, ResponseMsg.Headers, HTTP_HEADER_X_AUTH_TOKEN);
684 if (XAuthTokenHeader != NULL) {
685 Status = UpdateSessionToken (ServicePrivate, XAuthTokenHeader->FieldValue);
686 if (EFI_ERROR (Status)) {
687 DEBUG ((DEBUG_ERROR, "%a: update session token failure: %r\n", __func__, Status));
688 }
689 }
690 }
691 }
692
693 //
694 // Release resources
695 //
696 if (RequestMsg != NULL) {
697 ReleaseHttpMessage (RequestMsg, TRUE);
698 FreePool (RequestMsg);
699 }
700
701 ReleaseHttpMessage (&ResponseMsg, FALSE);
702
703 return RestExStatus;
704}
UINT64 UINTN
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
Definition: String.c:641
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
Definition: String.c:716
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
Definition: String.c:30
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID *EFIAPI AllocateCopyPool(IN UINTN AllocationSize, IN CONST VOID *Buffer)
#define HTTP_HEADER_USER_AGENT
Definition: Http11.h:163
#define HTTP_HEADER_AUTHORIZATION
Definition: Http11.h:221
#define HTTP_HEADER_CONTENT_LENGTH
Definition: Http11.h:135
#define HTTP_CONTENT_ENCODING_IDENTITY
Definition: Http11.h:100
#define HTTP_HEADER_ACCEPT
Definition: Http11.h:52
#define HTTP_HEADER_X_AUTH_TOKEN
Definition: Http11.h:235
#define HTTP_HEADER_CONTENT_TYPE
Definition: Http11.h:112
#define HTTP_HEADER_HOST
Definition: Http11.h:171
#define HTTP_HEADER_CONTENT_ENCODING
Definition: Http11.h:94
EFI_STATUS EFIAPI HttpSetFieldNameAndValue(IN OUT EFI_HTTP_HEADER *HttpHeader, IN CONST CHAR8 *FieldName, IN CONST CHAR8 *FieldValue)
Definition: DxeHttpLib.c:1529
EFI_HTTP_HEADER *EFIAPI HttpFindHeader(IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers, IN CHAR8 *FieldName)
Definition: DxeHttpLib.c:855
VOID EFIAPI HttpFreeHeaderFields(IN EFI_HTTP_HEADER *HeaderFields, IN UINTN FieldCount)
Definition: DxeHttpLib.c:1730
EDKII_JSON_VALUE EFIAPI JsonLoadBuffer(IN CONST CHAR8 *Buffer, IN UINTN BufferLen, IN UINTN Flags, IN OUT EDKII_JSON_ERROR *Error)
Definition: JsonLib.c:1021
BOOLEAN EFIAPI JsonValueIsNull(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:466
VOID EFIAPI JsonValueFree(IN EDKII_JSON_VALUE Json)
Definition: JsonLib.c:269
UINTN EFIAPI UnicodeSPrint(OUT CHAR16 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR16 *FormatString,...)
Definition: PrintLib.c:408
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
Definition: PrintLib.c:813
#define NULL
Definition: Base.h:319
#define TRUE
Definition: Base.h:301
#define FALSE
Definition: Base.h:307
#define IN
Definition: Base.h:279
#define OUT
Definition: Base.h:284
#define DEBUG(Expression)
Definition: DebugLib.h:434
EFI_HTTP_METHOD
Definition: Http.h:43
EFI_HTTP_STATUS_CODE
Definition: Http.h:59
#define PcdGetPtr(TokenName)
Definition: PcdLib.h:388
EFI_STATUS RedfishContentEncode(IN CHAR8 *ContentEncodedValue, IN CHAR8 *OriginalContent, IN UINTN OriginalContentLength, OUT VOID **EncodedContentPointer, OUT UINTN *EncodedLength)
EFI_STATUS RedfishContentDecode(IN CHAR8 *ContentEncodedValue, IN VOID *ContentPointer, IN UINTN ContentLength, OUT VOID **DecodedContentPointer, OUT UINTN *DecodedLength)
EFI_STATUS ReleaseRedfishPayload(IN REDFISH_PAYLOAD_PRIVATE *Payload)
EFI_STATUS UpdateSessionToken(IN REDFISH_SERVICE_PRIVATE *Service, IN CHAR8 *Token)
REDFISH_PAYLOAD_PRIVATE * CreateRedfishPayload(IN REDFISH_SERVICE_PRIVATE *Service, IN EDKII_JSON_VALUE JsonValue)
EFI_STATUS ReleaseHttpMessage(IN EFI_HTTP_MESSAGE *HttpMessage, IN BOOLEAN IsRequest)
EFI_STATUS CopyHttpHeaders(IN EFI_HTTP_HEADER *SrcHeaders, IN UINTN SrcHeaderCount, OUT EFI_HTTP_HEADER **DstHeaders, OUT UINTN *DstHeaderCount)
EFI_STATUS ParseResponseMessage(IN REDFISH_SERVICE_PRIVATE *ServicePrivate, IN EFI_HTTP_MESSAGE *ResponseMsg, OUT REDFISH_RESPONSE *RedfishResponse)
EFI_STATUS ReleaseRedfishRequest(IN REDFISH_REQUEST *Request)
EFI_HTTP_MESSAGE * BuildRequestMessage(IN REDFISH_SERVICE_PRIVATE *ServicePrivate, IN EFI_STRING Uri, IN EFI_HTTP_METHOD Method, IN REDFISH_REQUEST *Request OPTIONAL, IN CHAR8 *ContentEncoding OPTIONAL)
EFI_STATUS ReleaseRedfishResponse(IN REDFISH_RESPONSE *Response)
EFI_STATUS HttpSendReceive(IN REDFISH_SERVICE Service, IN EFI_STRING Uri, IN EFI_HTTP_METHOD Method, IN REDFISH_REQUEST *Request OPTIONAL, OUT REDFISH_RESPONSE *Response)
RETURN_STATUS EFI_STATUS
Definition: UefiBaseType.h:29
#define EFI_SUCCESS
Definition: UefiBaseType.h:112
CHAR8 * FieldValue
Definition: Http.h:220
CHAR8 * FieldName
Definition: Http.h:215
UINTN BodyLength
Definition: Http.h:257
EFI_HTTP_HEADER * Headers
Definition: Http.h:253
union EFI_HTTP_MESSAGE::@577 Data
UINTN HeaderCount
Definition: Http.h:246
VOID * Body
Definition: Http.h:262
EFI_HTTP_REQUEST_DATA * Request
Definition: Http.h:235
CHAR16 * Url
Definition: Http.h:194
EFI_HTTP_METHOD Method
Definition: Http.h:187