34 REDFISH_SERVICE RedfishService;
40 RedfishService =
NULL;
47 if (RedfishConfigServiceInfo ==
NULL) {
55 if (EFI_ERROR (Status)) {
63 RedfishConfigServiceInfo,
74 if (Password !=
NULL) {
78 return RedfishService;
90 IN REDFISH_SERVICE RedfishService
93 if (RedfishService ==
NULL) {
97 cleanupServiceEnumerator (RedfishService);
118 IN EDKII_JSON_VALUE Value,
119 IN REDFISH_SERVICE RedfishService
122 EDKII_JSON_VALUE CopyValue;
125 return createRedfishPayload (CopyValue, RedfishService);
137 IN REDFISH_PAYLOAD Payload
140 if (Payload ==
NULL) {
161 IN REDFISH_PAYLOAD Payload
164 if (Payload ==
NULL) {
185 IN REDFISH_PAYLOAD Payload
188 if (Payload ==
NULL) {
218 IN BOOLEAN FromSmbios,
219 IN CHAR8 *IdString OPTIONAL
227 if (RedPath ==
NULL) {
236 if (EFI_ERROR (Status)) {
247 if (RetRedPath ==
NULL) {
252 AsciiSPrint (RetRedPath, BufSize, RedPath, &SystemUuid);
254 AsciiSPrint (RetRedPath, BufSize, RedPath, IdString);
286 IN REDFISH_SERVICE RedfishService,
291 if ((RedfishService ==
NULL) || (RedPath ==
NULL) || (RedResponse ==
NULL)) {
292 return EFI_INVALID_PARAMETER;
297 RedResponse->Payload = (REDFISH_PAYLOAD)getPayloadByPath (RedfishService, RedPath, &(RedResponse->StatusCode));
303 if ((RedResponse->Payload ==
NULL) || (RedResponse->StatusCode ==
NULL)) {
304 return EFI_DEVICE_ERROR;
312 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
313 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
315 return EFI_DEVICE_ERROR;
346 IN REDFISH_SERVICE RedfishService,
351 EDKII_JSON_VALUE JsonValue;
353 if ((RedfishService ==
NULL) || (Uri ==
NULL) || (RedResponse ==
NULL)) {
354 return EFI_INVALID_PARAMETER;
359 JsonValue = getUriFromServiceEx (RedfishService, Uri, &RedResponse->Headers, &RedResponse->HeaderCount, &RedResponse->StatusCode);
360 RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
366 if ((RedResponse->Payload ==
NULL) || (RedResponse->StatusCode ==
NULL)) {
367 return EFI_DEVICE_ERROR;
375 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
376 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
378 return EFI_DEVICE_ERROR;
413 IN REDFISH_PAYLOAD Payload,
418 if ((Payload ==
NULL) || (RedPath ==
NULL) || (RedResponse ==
NULL)) {
419 return EFI_INVALID_PARAMETER;
424 RedResponse->Payload = (REDFISH_PAYLOAD)getPayloadForPathString (Payload, RedPath, &(RedResponse->StatusCode));
429 if (RedResponse->Payload ==
NULL) {
430 return EFI_DEVICE_ERROR;
439 if ((RedResponse->StatusCode !=
NULL) && \
440 ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
441 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT)
444 return EFI_DEVICE_ERROR;
483 IN REDFISH_SERVICE RedfishService,
490 EDKII_JSON_VALUE JsonValue;
495 if ((RedfishService ==
NULL) || (Uri ==
NULL) || (Content ==
NULL) || (RedResponse ==
NULL)) {
496 return EFI_INVALID_PARAMETER;
501 JsonValue = (EDKII_JSON_VALUE)patchUriFromServiceEx (
505 &(RedResponse->Headers),
506 &(RedResponse->HeaderCount),
507 &(RedResponse->StatusCode)
513 if (RedResponse->StatusCode ==
NULL) {
514 Status = EFI_DEVICE_ERROR;
523 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
524 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
526 Status = EFI_DEVICE_ERROR;
530 if (JsonValue !=
NULL) {
531 RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
532 if (RedResponse->Payload ==
NULL) {
575 IN REDFISH_PAYLOAD Target,
576 IN REDFISH_PAYLOAD Payload,
580 if ((Target ==
NULL) || (Payload ==
NULL) || (RedResponse ==
NULL)) {
581 return EFI_INVALID_PARAMETER;
586 RedResponse->Payload = (REDFISH_PAYLOAD)patchPayload (
589 &(RedResponse->StatusCode)
595 if (RedResponse->StatusCode ==
NULL) {
596 return EFI_DEVICE_ERROR;
604 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
605 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
607 return EFI_DEVICE_ERROR;
646 IN REDFISH_SERVICE RedfishService,
650 IN CONST CHAR8 *ContentType OPTIONAL,
655 EDKII_JSON_VALUE JsonValue;
660 if ((RedfishService ==
NULL) || (Uri ==
NULL) || (Content ==
NULL) || (RedResponse ==
NULL)) {
661 return EFI_INVALID_PARAMETER;
666 JsonValue = (EDKII_JSON_VALUE)postUriFromServiceEx (
672 &(RedResponse->Headers),
673 &(RedResponse->HeaderCount),
674 &(RedResponse->StatusCode)
680 if (RedResponse->StatusCode ==
NULL) {
681 Status = EFI_DEVICE_ERROR;
690 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
691 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
693 Status = EFI_DEVICE_ERROR;
697 if (JsonValue !=
NULL) {
698 RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
699 if (RedResponse->Payload ==
NULL) {
741 IN REDFISH_PAYLOAD Target,
742 IN REDFISH_PAYLOAD Payload,
746 if ((Target ==
NULL) || (Payload ==
NULL) || (RedResponse ==
NULL)) {
747 return EFI_INVALID_PARAMETER;
752 RedResponse->Payload = (REDFISH_PAYLOAD)postPayload (
755 &(RedResponse->StatusCode)
761 if (RedResponse->StatusCode ==
NULL) {
762 return EFI_DEVICE_ERROR;
770 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
771 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
773 return EFI_DEVICE_ERROR;
809 IN REDFISH_SERVICE RedfishService,
815 EDKII_JSON_VALUE JsonValue;
820 if ((RedfishService ==
NULL) || (Uri ==
NULL) || (RedResponse ==
NULL)) {
821 return EFI_INVALID_PARAMETER;
826 JsonValue = (EDKII_JSON_VALUE)deleteUriFromService (
829 &(RedResponse->StatusCode)
835 if (RedResponse->StatusCode ==
NULL) {
836 Status = EFI_DEVICE_ERROR;
845 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
846 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
848 Status = EFI_DEVICE_ERROR;
852 if (JsonValue !=
NULL) {
853 RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
854 if (RedResponse->Payload ==
NULL) {
897 IN REDFISH_SERVICE RedfishService,
904 EDKII_JSON_VALUE JsonValue;
909 if ((RedfishService ==
NULL) || (Content ==
NULL) || (Uri ==
NULL) || (RedResponse ==
NULL)) {
910 return EFI_INVALID_PARAMETER;
915 JsonValue = (EDKII_JSON_VALUE)deleteUriFromServiceEx (
919 &(RedResponse->StatusCode)
925 if (RedResponse->StatusCode ==
NULL) {
926 Status = EFI_DEVICE_ERROR;
935 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
936 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
938 Status = EFI_DEVICE_ERROR;
942 if (JsonValue !=
NULL) {
943 RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
944 if (RedResponse->Payload ==
NULL) {
968 UINTN StringFractionSize;
973 StringFractionSize = 200;
974 if (String ==
NULL) {
978 DEBUG ((DEBUG_MANAGEABILITY,
"JSON text:\n"));
979 NextFraction = String;
985 for (Count = 0; Count < (
StrLen / StringFractionSize); Count++) {
986 BackupChar = *(NextFraction + StringFractionSize);
987 *(NextFraction + StringFractionSize) = 0;
988 DEBUG ((DEBUG_MANAGEABILITY,
"%a", NextFraction));
989 *(NextFraction + StringFractionSize) = BackupChar;
990 NextFraction += StringFractionSize;
993 if ((
StrLen % StringFractionSize) != 0) {
994 DEBUG ((DEBUG_MANAGEABILITY,
"%a\n\n", NextFraction));
1006 IN EDKII_JSON_VALUE JsonValue
1012 if (String ==
NULL) {
1028 IN REDFISH_PAYLOAD Payload
1031 EDKII_JSON_VALUE JsonValue;
1037 if (Payload ==
NULL) {
1042 if (JsonValue ==
NULL) {
1047 if (String ==
NULL) {
1069 IN REDFISH_PAYLOAD Payload
1072 if (StatusCode !=
NULL) {
1077 if ((HeaderCount != 0) && (Headers !=
NULL)) {
1082 if (Payload !=
NULL) {
1101 IN REDFISH_PAYLOAD Payload,
1102 IN CONST CHAR8 *OdataTypeName,
1104 IN UINTN OdataTypeMappingListSize
1108 EDKII_JSON_VALUE OdataType;
1109 EDKII_JSON_VALUE JsonValue;
1111 if ((Payload ==
NULL) || (OdataTypeName ==
NULL)) {
1125 for (Index = 0; Index < OdataTypeMappingListSize; Index++) {
1126 if ((
AsciiStrCmp (OdataTypeMappingList[Index].OdataTypeName, OdataTypeName) == 0) &&
1133 DEBUG ((DEBUG_MANAGEABILITY,
"%a: This Odata type is not in the list.\n", __func__));
1147 IN REDFISH_PAYLOAD Payload
1150 return isPayloadCollection (Payload);
1164 IN REDFISH_PAYLOAD Payload,
1168 if ((Payload ==
NULL) || (CollectionSize ==
NULL)) {
1169 return EFI_INVALID_PARAMETER;
1173 return EFI_INVALID_PARAMETER;
1176 *CollectionSize = (
UINTN)getCollectionSize (Payload);
1191 IN REDFISH_PAYLOAD Payload,
1196 REDFISH_PAYLOAD PayloadReturn;
1198 PayloadReturn = (VOID *)getPayloadByIndex (Payload, Index, &RedfishResponse.StatusCode);
1199 if ((PayloadReturn ==
NULL) ||
1200 ((*(RedfishResponse.StatusCode) < HTTP_STATUS_200_OK) && (*(RedfishResponse.StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT)))
1205 return PayloadReturn;
1219 IN REDFISH_SERVICE RedfishService,
1227 if (Redpath ==
NULL) {
1228 return EFI_INVALID_PARAMETER;
1232 if (EFI_ERROR (Status)) {
1236 if (Response ==
NULL) {
1238 TempResponse.StatusCode,
1239 TempResponse.HeaderCount,
1240 TempResponse.Headers,
1241 TempResponse.Payload
1285 IN REDFISH_SERVICE RedfishService,
1288 IN UINTN ContentSize OPTIONAL,
1289 IN CONST CHAR8 *ContentType OPTIONAL,
1294 EDKII_JSON_VALUE JsonValue;
1299 if ((RedfishService ==
NULL) || (Uri ==
NULL) || (Content ==
NULL) || (RedResponse ==
NULL)) {
1300 return EFI_INVALID_PARAMETER;
1305 JsonValue = (EDKII_JSON_VALUE)putUriFromServiceEx (
1311 &(RedResponse->Headers),
1312 &(RedResponse->HeaderCount),
1313 &(RedResponse->StatusCode)
1319 if (RedResponse->StatusCode ==
NULL) {
1320 Status = EFI_DEVICE_ERROR;
1329 if ((*(RedResponse->StatusCode) < HTTP_STATUS_200_OK) || \
1330 (*(RedResponse->StatusCode) > HTTP_STATUS_206_PARTIAL_CONTENT))
1332 Status = EFI_DEVICE_ERROR;
1336 if (JsonValue !=
NULL) {
1337 RedResponse->Payload = createRedfishPayload (JsonValue, RedfishService);
1338 if (RedResponse->Payload ==
NULL) {
UINTN EFIAPI AsciiStrLen(IN CONST CHAR8 *String)
INTN EFIAPI AsciiStrCmp(IN CONST CHAR8 *FirstString, IN CONST CHAR8 *SecondString)
UINTN EFIAPI AsciiStrSize(IN CONST CHAR8 *String)
UINTN EFIAPI StrLen(IN CONST CHAR16 *String)
VOID *EFIAPI CopyMem(OUT VOID *DestinationBuffer, IN CONST VOID *SourceBuffer, IN UINTN Length)
VOID *EFIAPI ZeroMem(OUT VOID *Buffer, IN UINTN Length)
EDKII_REDFISH_AUTH_METHOD
VOID *EFIAPI AllocateZeroPool(IN UINTN AllocationSize)
VOID EFIAPI FreePool(IN VOID *Buffer)
VOID EFIAPI HttpFreeHeaderFields(IN EFI_HTTP_HEADER *HeaderFields, IN UINTN FieldCount)
BOOLEAN EFIAPI JsonValueIsString(IN EDKII_JSON_VALUE Json)
VOID EFIAPI JsonValueFree(IN EDKII_JSON_VALUE Json)
CHAR8 *EFIAPI JsonDumpString(IN EDKII_JSON_VALUE JsonValue, IN UINTN Flags)
EDKII_JSON_OBJECT EFIAPI JsonValueGetObject(IN EDKII_JSON_VALUE Json)
EDKII_JSON_VALUE EFIAPI JsonValueClone(IN EDKII_JSON_VALUE Json)
CONST CHAR8 *EFIAPI JsonValueGetAsciiString(IN EDKII_JSON_VALUE Json)
EDKII_JSON_VALUE EFIAPI JsonObjectGetValue(IN CONST EDKII_JSON_OBJECT JsonObj, IN CONST CHAR8 *Key)
BOOLEAN EFIAPI JsonValueIsObject(IN EDKII_JSON_VALUE Json)
UINTN EFIAPI AsciiSPrint(OUT CHAR8 *StartOfBuffer, IN UINTN BufferSize, IN CONST CHAR8 *FormatString,...)
#define DEBUG(Expression)
EFI_STATUS EFIAPI NetLibGetSystemGuid(OUT EFI_GUID *SystemGuid)
REDFISH_SERVICE EFIAPI RedfishServiceInPayload(IN REDFISH_PAYLOAD Payload)
EFI_STATUS EFIAPI RedfishGetByUri(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, OUT REDFISH_RESPONSE *RedResponse)
VOID EFIAPI RedfishCleanupPayload(IN REDFISH_PAYLOAD Payload)
EFI_STATUS EFIAPI RedfishDeleteByUri(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, OUT REDFISH_RESPONSE *RedResponse)
EFI_STATUS EFIAPI RedfishGetByPayload(IN REDFISH_PAYLOAD Payload, IN CONST CHAR8 *RedPath, OUT REDFISH_RESPONSE *RedResponse)
VOID EFIAPI RedfishCleanupService(IN REDFISH_SERVICE RedfishService)
EFI_STATUS EFIAPI RedfishPostToPayload(IN REDFISH_PAYLOAD Target, IN REDFISH_PAYLOAD Payload, OUT REDFISH_RESPONSE *RedResponse)
VOID RedfishFreeResponse(IN EFI_HTTP_STATUS_CODE *StatusCode, IN UINTN HeaderCount, IN EFI_HTTP_HEADER *Headers, IN REDFISH_PAYLOAD Payload)
EFI_STATUS EFIAPI RedfishPatchToUri(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, OUT REDFISH_RESPONSE *RedResponse)
BOOLEAN RedfishIsPayloadCollection(IN REDFISH_PAYLOAD Payload)
EFI_STATUS EFIAPI RedfishDeleteByUriEx(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, OUT REDFISH_RESPONSE *RedResponse)
VOID RedfishDumpPayload(IN REDFISH_PAYLOAD Payload)
CHAR8 *EFIAPI RedfishBuildPathWithSystemUuid(IN CONST CHAR8 *RedPath, IN BOOLEAN FromSmbios, IN CHAR8 *IdString OPTIONAL)
VOID RedfishDumpJson(IN EDKII_JSON_VALUE JsonValue)
EDKII_JSON_VALUE EFIAPI RedfishJsonInPayload(IN REDFISH_PAYLOAD Payload)
EFI_STATUS RedfishGetCollectionSize(IN REDFISH_PAYLOAD Payload, IN UINTN *CollectionSize)
REDFISH_SERVICE EFIAPI RedfishCreateService(IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo)
EFI_STATUS RedfishCheckIfRedpathExist(IN REDFISH_SERVICE RedfishService, IN CHAR8 *Redpath, IN REDFISH_RESPONSE *Response OPTIONAL)
REDFISH_PAYLOAD RedfishGetPayloadByIndex(IN REDFISH_PAYLOAD Payload, IN UINTN Index)
EFI_STATUS EFIAPI RedfishPutToUri(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CONST CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *RedResponse)
EFI_STATUS EFIAPI RedfishPostToUri(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *Uri, IN CONST CHAR8 *Content, IN UINTN ContentSize OPTIONAL, IN CONST CHAR8 *ContentType OPTIONAL, OUT REDFISH_RESPONSE *RedResponse)
EFI_STATUS EFIAPI RedfishGetByService(IN REDFISH_SERVICE RedfishService, IN CONST CHAR8 *RedPath, OUT REDFISH_RESPONSE *RedResponse)
VOID RedfishDumpJsonStringFractions(IN CHAR8 *String)
REDFISH_PAYLOAD EFIAPI RedfishCreatePayload(IN EDKII_JSON_VALUE Value, IN REDFISH_SERVICE RedfishService)
EFI_STATUS EFIAPI RedfishPatchToPayload(IN REDFISH_PAYLOAD Target, IN REDFISH_PAYLOAD Payload, OUT REDFISH_RESPONSE *RedResponse)
BOOLEAN RedfishIsValidOdataType(IN REDFISH_PAYLOAD Payload, IN CONST CHAR8 *OdataTypeName, IN REDFISH_ODATA_TYPE_MAPPING *OdataTypeMappingList, IN UINTN OdataTypeMappingListSize)
EFI_STATUS RedfishGetAuthInfo(OUT EDKII_REDFISH_AUTH_METHOD *AuthMethod, OUT CHAR8 **UserId, OUT CHAR8 **Password)
REDFISH_SERVICE RedfishCreateLibredfishService(IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo, IN EDKII_REDFISH_AUTH_METHOD AuthMethod, IN CHAR8 *UserId, IN CHAR8 *Password)