From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM12-MW2-obe.outbound.protection.outlook.com (NAM12-MW2-obe.outbound.protection.outlook.com [40.107.244.40]) by mx.groups.io with SMTP id smtpd.web12.7402.1660281890499217818 for ; Thu, 11 Aug 2022 22:24:51 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=Cz0g3VWm; spf=permerror, err=parse error for token &{10 18 %{i}._ip.%{h}._ehlo.%{d}._spf.vali.email}: invalid domain name (domain: amd.com, ip: 40.107.244.40, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XcRA7w4B9fs429dRI3/8Oyz78NPUMuPTY+XQMRLu3pVZnXv0+pDLyEuZjvuLqM8ptfovv4UQAlv9RB4wfvKMK2NLh1gfdEsIJuOOILSypLP5TCs7uHwlPhMG7wz2Uf4mpsukQoUqByxmFS2frNtw5RYrsFAfbUgF4UR9zyY2xmSoeKQQL/bYcrcq9q+1j87Cx1zJadeJ6FjlEWiX5mvj2yCgFZTzTWZU7+XtOMe5V0+D7LjwKhNgcOK0Q0hqqabRuAJB12uSPqEPltBz3wIB0yiXL1yygOB8EmfiLaVZbgt1Vp3yn6EWJlFBjv3EqXRnzcovqwQgeIBOIJcLsg6bXQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-AntiSpam-MessageData-ChunkCount:X-MS-Exchange-AntiSpam-MessageData-0:X-MS-Exchange-AntiSpam-MessageData-1; bh=tO5hMdqndwTCauqFZ3ozZAg+Xyq/IgOw2OKQ3JclRf4=; b=TIemxRwCqwwVwVGb8dHqVNbS9vQRPCz7nSauWDlkNlbjo9m1uw/WU7fyhY1skfk46NQ1gPpwoRxkTaJuKKmvJKC3gR5vAVdfhwPYXcyDPkY6ZyoXn9IBSMoterl8DfR4u1vMEpmDKx5SxaMgFfipWDUrOVvu/lG0SZrqGZoCBTS6Mp5Ertj5cDzD6kwRJyDdRS2p5WuJ+0d3CiGmrmMylKB66SkUKqvngsbZJSrzd2pnuOZO2jr3r/7woScwt3goAxNV/J027ghpw8M6wukM5AUrHcl4V/BsAxLWtQf303SYIYDZC+5s+/ArAhfULcw5DS03QejLCWP6oqU3xPOZvQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=amd.com; dmarc=pass action=none header.from=amd.com; dkim=pass header.d=amd.com; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=amd.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=tO5hMdqndwTCauqFZ3ozZAg+Xyq/IgOw2OKQ3JclRf4=; b=Cz0g3VWm88jnQOnwPRguylK3u95bG9/OIhGPYK0HFNh6jIJ+o2qP2bJiK2XWPE8x5geL0G38cWGyKaDqzr0vDexzgTTw1r+zp7/hqOqmfP9elQZQl0nXG3Wgaaf2P4rG7gDimYcA6dgjUF4j0xM+9M5BGLmzyyzfGJtOE0ivpZg= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by DM6PR12MB3209.namprd12.prod.outlook.com (2603:10b6:5:184::33) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.17; Fri, 12 Aug 2022 05:24:43 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::e850:8264:41be:cb1f]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::e850:8264:41be:cb1f%4]) with mapi id 15.20.5504.020; Fri, 12 Aug 2022 05:24:43 +0000 From: "Chang, Abner" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: "nickle.wang@hpe.com" Subject: Re: [PATCH V2] RedfishPkg: Redfish third party modules may need to use the functions tat are currently private Thread-Topic: [PATCH V2] RedfishPkg: Redfish third party modules may need to use the functions tat are currently private Thread-Index: AQHYrPo+WyFrTV4by0GB+wwg5wABga2qvZ4A Date: Fri, 12 Aug 2022 05:24:43 +0000 Message-ID: References: <1660164369-7620-1-git-send-email-igork@ami.com> In-Reply-To: <1660164369-7620-1-git-send-email-igork@ami.com> Accept-Language: zh-CN, en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: msip_labels: MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Enabled=true; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SetDate=2022-08-12T05:24:40Z; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Method=Standard; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_Name=General; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_SiteId=3dd8961f-e488-4e60-8e11-a82d994e183d; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ActionId=84f0a4b1-38a3-4900-b36d-14f7eff974f8; MSIP_Label_4342314e-0df4-4b58-84bf-38bed6170a0f_ContentBits=1 authentication-results: dkim=none (message not signed) header.d=none;dmarc=none action=none header.from=amd.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 2f3e0cee-739a-4b60-4a47-08da7c22f67c x-ms-traffictypediagnostic: DM6PR12MB3209:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: 0/19aNS77/wlt21sfaqzqDFFlbagGADvliMdZEeaJ6jEI+aeFTmsn4hpccPalAXBefJQxSudw4cDDH7dR/5ThXuEtXrxAxkxh4ElGohA/0zrKJl+QGerFtVUwZDw8fN7WxpKm5s0MkrOguP2SsZWBhL94VGmEt+iTxUWtkZM9iHio8IA/v1LDUb3UbzXJlnaHVbucm24Rr2XFCHABCfKfvPZDArVWTqIm07ZKKKezSVSTt/5g98P12baaXbHl6ZDx/t03+XjHk7F+4JGQmOMGuZCShoquSkGCyXftV8YZkCLoFuSJ6O9YPpTb3R3chdMcDen3beUW5UkTa8icvhSTQzgvsTlJ5hJjjZGkvUb5rBsIcFaCgZplKqTjr4QQ9R7D+whCGSyO60drvl9Kv/ZJtzSI4KqFEtfosfpuFp9U+a1OjlVaT8yIE1M493hMs7/ngc219gvolQxHnTfVo2NJPFpQU1MLYHhO5a+wgZD7aEAwblvxkzU+vRy0BHjCizUPiGvigkBQkhg+VB6luMT6MqsixsKQ/1GNqqwGJphyDmewLs3zWjCb9bA9K3+IkVGHSn9x4bIcKKA44955Q2X17bMw7L5ToDD4f84HFW/W8Vv7Kluk4Hwcw+5jdBCtvowYb+umH2xBcKk65K/6a7/tgUy/pPYExkJ7vzKAI4Sd/uxZBR2XsiG7LV/zrydaSZvXSRB82/oD5TBlYs4CilJAS9dHwpnrC+kq9eupK8zcCgiG44khSpuNjQyvubUls4szdrG5a9wXYjZf+0rhbZTQhTTCgqu6wXGnAQSCthiXTndyW+JaIDdPF3e24TLAw4VoK2A6UeFzkriuMZJGpbN1KVLu9bKdJI2xh2XTWJgmEFXmKJoZnvYvVsk74I4Mhy8e/E/aGWwchehHNQRPpCwAA== x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:MN2PR12MB3966.namprd12.prod.outlook.com;PTR:;CAT:NONE;SFS:(13230016)(4636009)(346002)(136003)(376002)(39860400002)(396003)(366004)(478600001)(71200400001)(41300700001)(6506007)(7696005)(26005)(33656002)(40140700001)(86362001)(53546011)(186003)(110136005)(83380400001)(9686003)(45080400002)(38070700005)(316002)(5660300002)(55016003)(8676002)(66946007)(66446008)(4326008)(66476007)(76116006)(64756008)(122000001)(38100700002)(52536014)(30864003)(2906002)(66556008)(8936002)(21314003)(579004)(559001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?hp5XXET1+0xx4cTOCgL/VxnvqSmk6m2e0n+YtALm80VuP3E0l6Y6AFn3a9Yg?= =?us-ascii?Q?3mrmJBrpbIfrEOa+lwsS+DEHvjdNGYKQStVQdWrSMCOrjfLMf3Sj59n78V4l?= =?us-ascii?Q?L89jGUIpL0Ua84go5uc8ka7cI7xO2/eaw0cKaCtdRi6yU90SLzR/26+TzAqM?= =?us-ascii?Q?V7cAcJ8rhx+xQMb2EXeKk61f/FsvF1FZoPia+AtlXx9OIAc940Bfrr9/E/Ht?= =?us-ascii?Q?ZKMhXttI0RljV1LbNb2aBu5q76xPHkMD3aM1FKs1NkpZJ4soDEri5dBxkxks?= =?us-ascii?Q?2T3jztQ6b4XlRW3rRGJ1WS4G0/ernDnU9QfD184dT1qEmVbIdjSkyVyg2UAA?= =?us-ascii?Q?q6bfyV0aJC1nm4Nt+ENViouLMIynh0J+7bjp6vHU/erDlmNDmAuajx/EbnLu?= =?us-ascii?Q?lWlO5A7oQytuE6Ns+oxVTlqSBL1RjA+fZP3g2xwbMM4qPcsdhmUOm42YVBci?= =?us-ascii?Q?ep0jg6XLtlXcosQrmu8jhDx/uXitVubYW1kq4dWcoJ8Sx0IFiyZqKhOqDvd7?= =?us-ascii?Q?9BX8saeNbghQxRdMIBvPFpfuA84L4B5pwGUTHuYEMzPoJpLjlf1JMiOulId9?= =?us-ascii?Q?bUxmqeF7mEb0PL+XhDt6s3MRjqvSl5DjoZBfSWpeXbdQCvcHRocLp6mFS2I2?= =?us-ascii?Q?jnFya8SA2xGtdkRagME61UB2BUUojqQyaXFDwwhItxuy2jCasfTuR3AaCbUO?= =?us-ascii?Q?rGXgrHTAjhozcodL6G5jU9k6n1O4FYBay7D67w62hmHaOWBj8w4wUDhQ3o1U?= =?us-ascii?Q?b0SAW0o9+tF7NeMR4P7sJGhKCSh4hWnQFlQYCu49GVzka/daxcAEZ1cO5q37?= =?us-ascii?Q?MvZ2QcEzgp5cmAef+StczvqmzXAgeMaw7zgSLIHjL5Uw/X+zaG7+liYcrzHH?= =?us-ascii?Q?Eo7BqcI5miT6f3cS0yBf1gdnDkQ+wozJvQSrxQN3aQ1og8+ReJxF6bIQLYN5?= =?us-ascii?Q?kWN+g/OQrF7cG5lAmBoMf5Jb3LXyzk6JlZHX1P1aaZ5d9YkRIROKvpsGZ4iC?= =?us-ascii?Q?oyN6a04l6I2pe2N+sNyLg0cUS0pu5SU0gnsiRoOPaWQpdQIAjU1Iet2nH1f1?= =?us-ascii?Q?zoa27OiH4UJDl1cE5ctlub7rhiyHiVPOZ9w1Y3eBqMXhqfQRF24S9mEiPltM?= =?us-ascii?Q?5gbc1wLGklWBPZerVjrIdIfFB/3JzsvvD7RXvMVxSAJLjcJ7Sjm/cboH+KHE?= =?us-ascii?Q?Xh97ujBz5nHQLPEh+SCr9fF8QpMbwqC8QV05bRB4VkHb1akP+HQOC9nKIW8Q?= =?us-ascii?Q?s2R+MwKsN94ZcK5prO0zk79VBEJ4vdNsNdebwMSbXZ9SpdRbFOWWRXHd4SPa?= =?us-ascii?Q?8PKty9Y/TTN87t6HMAv92acnHoBnKt2fbZBB/f/rjKjdEzkOnzg+UU0PG9qM?= =?us-ascii?Q?vdfFdQy50nZjhnzKNMFG58wjzX10l3TiqN7mqOZGOtkgeRVCBI+rNbKZZvl2?= =?us-ascii?Q?Gt9k0nnqWJ2B4OLJVH9xckA6/E1nP6n4Wpo2CDR9i6bsz9FT1WooKElvDQPi?= =?us-ascii?Q?OUz2w89pQJEFdNUGhbN8OPVgoJ48Bvi8Lg65JWewMXTugQKwNDPr2qeD6Kbv?= =?us-ascii?Q?/KZhR1QD77xxDWMa89s=3D?= MIME-Version: 1.0 X-OriginatorOrg: amd.com X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MN2PR12MB3966.namprd12.prod.outlook.com X-MS-Exchange-CrossTenant-Network-Message-Id: 2f3e0cee-739a-4b60-4a47-08da7c22f67c X-MS-Exchange-CrossTenant-originalarrivaltime: 12 Aug 2022 05:24:43.1794 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 3dd8961f-e488-4e60-8e11-a82d994e183d X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: q59Naf3UluXk/tMPW8PcBtpikGcqefoVaWq6+Jegt3u/sr/OD51eRXQSkikC2n5kvYNZpvC6qrKwFSsCGnw42w== X-MS-Exchange-Transport-CrossTenantHeadersStamped: DM6PR12MB3209 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable [AMD Official Use Only - General] Reviewed-by: Abner Chang > -----Original Message----- > From: Igor Kulchytskyy > Sent: Thursday, August 11, 2022 4:46 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; nickle.wang@hpe.com; Igor > Kulchytskyy ; Chang, Abner > Subject: [PATCH V2] RedfishPkg: Redfish third party modules may need to > use the functions tat are currently private >=20 > [CAUTION: External Email] >=20 > Definitions of the required functions to send requests to BMC are in the > PrivateInclude folder. > So, they cannot be used by the other packages. >=20 > Cc: Abner Chang > Cc: Nickle Wang > Signed-off-by: Igor Kulchytskyy > --- > RedfishPkg/Include/Library/RedfishLib.h | 616 +++++++++++++++++++= + > RedfishPkg/PrivateInclude/Library/RedfishLib.h | 616 -------------------= - > RedfishPkg/RedfishPkg.dec | 2 +- > 3 files changed, 617 insertions(+), 617 deletions(-) >=20 > diff --git a/RedfishPkg/Include/Library/RedfishLib.h > b/RedfishPkg/Include/Library/RedfishLib.h > new file mode 100644 > index 0000000..b2488ab > --- /dev/null > +++ b/RedfishPkg/Include/Library/RedfishLib.h > @@ -0,0 +1,616 @@ > +/** @file > + This library provides a set of utility APIs that allow to > create/read/update/delete > + (CRUD) Redfish resources and provide basic query abilities by using > [URI/RedPath] > + > (https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgith > ub.com%2FDMTF%2Flibredfish&data=3D05%7C01%7CAbner.Chang%40am > d.com%7C801a31d2d98345b0b56408da7b116295%7C3dd8961fe4884e608e11a > 82d994e183d%7C0%7C0%7C637957611860036068%7CUnknown%7CTWFpbGZ > sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M > n0%3D%7C3000%7C%7C%7C&sdata=3D19FpvKZ8NZ7BTkrZ8CQ34rAMUGj > m0ElwjFyv1eHuVDA%3D&reserved=3D0). > + > + The query language is based on XPath > (https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fww > w.w3.org%2FTR%2F1999%2FREC-xpath- > 19991116%2F&data=3D05%7C01%7CAbner.Chang%40amd.com%7C801a31 > d2d98345b0b56408da7b116295%7C3dd8961fe4884e608e11a82d994e183d%7C > 0%7C0%7C637957611860036068%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000 > %7C%7C%7C&sdata=3D0%2BnenRffAczD19E5fUu%2FT2FkUAQ8OnSGzsm > 0UsEuwKY%3D&reserved=3D0). > + This library and query language essentially treat the entire Redfish S= ervice > like it > + was a single JSON document. In other words whenever it encounters an > odata.id in JSON > + document, it will retrieve the new JSON document (if needed). We name > the path as > + RedPath: > + > + Expression Description > + > + nodename Selects the JSON entity with the name "nodename". > + If the value of nodename is an object with "@odata.id= ", > + it will continue get the value from "@odata.id". > + > + / Selects from the root node > + > + [index] Selects the index number JSON entity from an array o= r > + object. If the JSON entity is one collection (has > + Members & Members@odata.count), means to get the inde= x > + member in "Members". Index number >=3D1, 1 means to r= eturn > + the first instance. > + > + [XXX] Operation on JSON entity. > + If the JSON entity is one collection (has Members & > + Members@odata.count), means to get all elements in > + "Members". If the JSON entity is one array, means to > + get all elements in array. Others will match the node= name > + directly (e.g. JSON_OBJECT, JSON_STRING, JSON_TRUE, > + JSON_FALSE, JSON_INTEGER). > + > + [nodename] Selects all the elements from an JSON entity that > + contain a property named "nodename" > + > + [name=3Dvalue] Selects all the elements from an JSON entity where > + the property "name" is equal to "value" > + > + [name~value] Selects all the elements from an JSON entity where > + the string property "name" is equal to "value" using > + case insensitive comparison. > + > + [name + the property "name" is less than "value" > + > + [name<=3Dvalue] Selects all the elements from an JSON entity where > + the property "name" is less than or equal to "value" > + > + [name>value] Selects all the elements from an JSON entity where > + the property "name" is greater than "value" > + > + [name>=3Dvalue] Selects all the elements from an JSON entity where > + the property "name" is greater than or equal to "valu= e" > + > + Some examples: > + > + /v1/Chassis[1] - Will return the first Chassis instance. > + /v1/Chassis[SKU=3D1234] - Will return all Chassis instances with a S= KU field > equal to 1234. > + /v1/Systems[Storage] - Will return all the System instances that ha= ve > Storage field populated. > + > + Copyright (c) 2019, Intel Corporation. All rights reserved.
> + (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_LIB_H_ > +#define REDFISH_LIB_H_ > + > +#include > + > +#include > +#include > + > +#define ODATA_TYPE_NAME_MAX_SIZE 128 > +#define ODATA_TYPE_MAX_SIZE 128 > + > +/// > +/// Library class public defines > +/// > +typedef VOID *REDFISH_SERVICE; > +typedef VOID *REDFISH_PAYLOAD; > + > +/// > +/// Library class public structures/unions > +/// > +typedef struct { > + EFI_HTTP_STATUS_CODE *StatusCode; > + UINTN HeaderCount; > + EFI_HTTP_HEADER *Headers; > + REDFISH_PAYLOAD Payload; > +} REDFISH_RESPONSE; > + > +/// > +/// Odata type-name mapping structure. > +/// > +typedef struct { > + CONST CHAR8 OdataTypeName[ODATA_TYPE_NAME_MAX_SIZE]; > + CONST CHAR8 OdataType[ODATA_TYPE_MAX_SIZE]; > +} REDFISH_ODATA_TYPE_MAPPING; > + > +/** > + This function uses REST EX protocol provided in RedfishConfigServiceIn= fo. > + The service enumerator will also handle the authentication flow > automatically > + if HTTP basic auth or Redfish session login is configured to use. > + > + Callers are responsible for freeing the returned service by > RedfishCleanupService(). > + > + @param[in] RedfishConfigServiceInfo Redfish service information the E= FI > Redfish > + feature driver communicates with. > + > + @return New created Redfish Service, or NULL if error happens. > + > +**/ > +REDFISH_SERVICE > +EFIAPI > +RedfishCreateService ( > + IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo > + ); > + > +/** > + Free the Service and all its related resources. > + > + @param[in] RedfishService The Service to access the Redfish res= ources. > + > +**/ > +VOID > +EFIAPI > +RedfishCleanupService ( > + IN REDFISH_SERVICE RedfishService > + ); > + > +/** > + Create REDFISH_PAYLOAD instance in local with JSON represented > resource value and > + the Redfish Service. > + > + The returned REDFISH_PAYLOAD can be used to create or update Redfish > resource in > + server side. > + > + Callers are responsible for freeing the returned payload by > RedfishCleanupPayload(). > + > + @param[in] Value JSON Value of the redfish resource= . > + @param[in] RedfishService The Service to access the Redfish > resources. > + > + @return REDFISH_PAYLOAD instance of the resource, or NULL if error > happens. > + > +**/ > +REDFISH_PAYLOAD > +EFIAPI > +RedfishCreatePayload ( > + IN EDKII_JSON_VALUE Value, > + IN REDFISH_SERVICE RedfishService > + ); > + > +/** > + Free the RedfishPayload and all its related resources. > + > + @param[in] Payload Payload to be freed. > + > +**/ > +VOID > +EFIAPI > +RedfishCleanupPayload ( > + IN REDFISH_PAYLOAD Payload > + ); > + > +/** > + This function returns the decoded JSON value of a REDFISH_PAYLOAD. > + > + Caller doesn't need to free the returned JSON value because it will be > released > + in corresponding RedfishCleanupPayload() function. > + > + @param[in] Payload A REDFISH_PAYLOAD instance. > + > + @return Decoded JSON value of the payload. > + > +**/ > +EDKII_JSON_VALUE > +EFIAPI > +RedfishJsonInPayload ( > + IN REDFISH_PAYLOAD Payload > + ); > + > +/** > + Fill the input RedPath string with system UUID from SMBIOS table or us= e > the customized > + ID if FromSmbios =3D=3D FALSE. > + > + This is a helper function to build a RedPath string which can be used = to > address > + a Redfish resource for this computer system. The input PathString must > have a Systems > + note in format of "Systems[UUID=3D%g]" or "Systems[UUID~%g]" to fill t= he > UUID value. > + > + Example: > + Use "/v1/Systems[UUID=3D%g]/Bios" to build a RedPath to address the > "Bios" resource > + for this computer system. > + > + @param[in] RedPath RedPath format to be build. > + @param[in] FromSmbios Get system UUID from SMBIOS as computer > system instance ID. > + @param[in] IdString The computer system instance ID. > + > + @return Full RedPath with system UUID inside, or NULL if error hap= pens. > + > +**/ > +CHAR8 * > +EFIAPI > +RedfishBuildPathWithSystemUuid ( > + IN CONST CHAR8 *RedPath, > + IN BOOLEAN FromSmbios, > + IN CHAR8 *IdString OPTIONAL > + ); > + > +/** > + Get a redfish response addressed by a RedPath string, including HTTP > StatusCode, Headers > + and Payload which record any HTTP response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] RedfishService The Service to access the Redfish > resources. > + @param[in] RedPath RedPath string to address a resour= ce, must > start > + from the root node. > + @param[out] RedResponse Pointer to the Redfish response da= ta. > + > + @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > + NULL and the value is 2XX. The corresp= onding redfish > resource has > + been returned in Payload within RedRes= ponse. > + @retval EFI_INVALID_PARAMETER RedfishService, RedPath, or > RedResponse is NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned Payload is NULL, in= dicates any error > happen. > + 2. If the returned StatusCode is NULL,= indicates any error > happen. > + 3. If the returned StatusCode is not 2= XX, indicates any error > happen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishGetByService ( > + IN REDFISH_SERVICE RedfishService, > + IN CONST CHAR8 *RedPath, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Get a redfish response addressed by URI, including HTTP StatusCode, > Headers > + and Payload which record any HTTP response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] RedfishService The Service to access the URI resource= s. > + @param[in] URI String to address a resource. > + @param[out] RedResponse Pointer to the Redfish response data. > + > + @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > + NULL and the value is 2XX. The corresp= onding redfish > resource has > + been returned in Payload within RedRes= ponse. > + @retval EFI_INVALID_PARAMETER RedfishService, RedPath, or > RedResponse is NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned Payload is NULL, in= dicates any error > happen. > + 2. If the returned StatusCode is NULL,= indicates any error > happen. > + 3. If the returned StatusCode is not 2= XX, indicates any error > happen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishGetByUri ( > + IN REDFISH_SERVICE RedfishService, > + IN CONST CHAR8 *Uri, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Get a redfish response addressed by the input Payload and relative > RedPath string, > + including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] Payload A existing REDFISH_PAYLOAD instance. > + @param[in] RedPath Relative RedPath string to address a r= esource > inside Payload. > + @param[out] RedResponse Pointer to the Redfish response data. > + > + @retval EFI_SUCCESS The opeartion is successful: > + 1. The HTTP StatusCode is NULL and the= returned Payload > in > + RedResponse is not NULL, indicates the= Redfish resource > has > + been parsed from the input payload dir= ectly. > + 2. The HTTP StatusCode is not NULL and= the value is 2XX, > + indicates the corresponding redfish re= source has been > returned > + in Payload within RedResponse. > + @retval EFI_INVALID_PARAMETER Payload, RedPath, or RedResponse is > NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned Payload is NULL, in= dicates any error > happen. > + 2. If StatusCode is not NULL and the r= eturned value of > StatusCode > + is not 2XX, indicates any error hap= pen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishGetByPayload ( > + IN REDFISH_PAYLOAD Payload, > + IN CONST CHAR8 *RedPath, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Use HTTP PATCH to perform updates on pre-existing Redfish resource. > + > + This function uses the RedfishService to patch a Redfish resource > addressed by > + Uri (only the relative path is required). Changes to one or more prope= rties > within > + the target resource are represented in the input Content, properties n= ot > specified > + in Content won't be changed by this request. The corresponding redfish > response will > + returned, including HTTP StatusCode, Headers and Payload which record > any HTTP response > + messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] RedfishService The Service to access the Redfish > resources. > + @param[in] Uri Relative path to address the resou= rce. > + @param[in] Content JSON represented properties to be = update. > + @param[out] RedResponse Pointer to the Redfish response da= ta. > + > + @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > + NULL and the value is 2XX. The Redfish= resource will be > returned > + in Payload within RedResponse if serve= r send it back in the > HTTP > + response message body. > + @retval EFI_INVALID_PARAMETER RedfishService, Uri, Content, or > RedResponse is NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned StatusCode is NULL,= indicates any error > happen. > + 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > + indicates any error happen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPatchToUri ( > + IN REDFISH_SERVICE RedfishService, > + IN CONST CHAR8 *Uri, > + IN CONST CHAR8 *Content, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Use HTTP PATCH to perform updates on target payload. Patch to odata.id > in Payload directly. > + > + This function uses the Payload to patch the Target. Changes to one or > more properties > + within the target resource are represented in the input Payload, > properties not specified > + in Payload won't be changed by this request. The corresponding redfish > response will > + returned, including HTTP StatusCode, Headers and Payload which record > any HTTP response > + messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] Target The target payload to be updated. > + @param[in] Payload Palyoad with properties to be changed. > + @param[out] RedResponse Pointer to the Redfish response data. > + > + @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > + NULL and the value is 2XX. The Redfish= resource will be > returned > + in Payload within RedResponse if serve= r send it back in the > HTTP > + response message body. > + @retval EFI_INVALID_PARAMETER Target, Payload, or RedResponse is > NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned StatusCode is NULL,= indicates any error > happen. > + 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > + indicates any error happen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPatchToPayload ( > + IN REDFISH_PAYLOAD Target, > + IN REDFISH_PAYLOAD Payload, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Use HTTP POST to create a new resource in target payload. > + > + The POST request should be submitted to the Resource Collection in whi= ch > the new resource > + is to belong. The Resource Collection is addressed by Target payload. = The > Redfish may > + ignore any service controlled properties. The corresponding redfish > response will returned, > + including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] Target Target payload of the Resource Collectio= n. > + @param[in] Payload The new resource to be created. > + @param[out] RedResponse Pointer to the Redfish response data. > + > + @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > + NULL and the value is 2XX. The Redfish= resource will be > returned > + in Payload within RedResponse if serve= r send it back in the > HTTP > + response message body. > + @retval EFI_INVALID_PARAMETER Target, Payload, or RedResponse is > NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned StatusCode is NULL,= indicates any error > happen. > + 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > + indicates any error happen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishPostToPayload ( > + IN REDFISH_PAYLOAD Target, > + IN REDFISH_PAYLOAD Payload, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Use HTTP DELETE to remove a resource. > + > + This function uses the RedfishService to remove a Redfish resource whi= ch > is addressed > + by input Uri (only the relative path is required). The corresponding r= edfish > response will > + returned, including HTTP StatusCode, Headers and Payload which record > any HTTP response > + messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > + redfish response data. > + > + @param[in] RedfishService The Service to access the Redfish > resources. > + @param[in] Uri Relative path to address the resou= rce. > + @param[out] RedResponse Pointer to the Redfish response da= ta. > + > + @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > + NULL and the value is 2XX, the Redfish= resource has been > removed. > + If there is any message returned from = server, it will be > returned > + in Payload within RedResponse. > + @retval EFI_INVALID_PARAMETER RedfishService, Uri, or RedResponse is > NULL. > + @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > + more error info from returned HTTP Sta= tusCode, Headers > and Payload > + within RedResponse: > + 1. If the returned StatusCode is NULL,= indicates any error > happen. > + 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > + indicates any error happen. > +**/ > +EFI_STATUS > +EFIAPI > +RedfishDeleteByUri ( > + IN REDFISH_SERVICE RedfishService, > + IN CONST CHAR8 *Uri, > + OUT REDFISH_RESPONSE *RedResponse > + ); > + > +/** > + Dump text in fractions. > + > + @param[in] String ASCII string to dump. > + > +**/ > +VOID > +RedfishDumpJsonStringFractions ( > + IN CHAR8 *String > + ); > + > +/** > + Extract the JSON text content from REDFISH_PAYLOAD and dump to debug > console. > + > + @param[in] Payload The Redfish payload to dump. > + > +**/ > +VOID > +RedfishDumpPayload ( > + IN REDFISH_PAYLOAD Payload > + ); > + > +/** > + Dump text in JSON value. > + > + @param[in] JsonValue The Redfish JSON value to dump. > + > +**/ > +VOID > +RedfishDumpJson ( > + IN EDKII_JSON_VALUE JsonValue > + ); > + > +/** > + This function will cleanup the HTTP header and Redfish payload resourc= es. > + > + @param[in] StatusCode The status code in HTTP response message= . > + @param[in] HeaderCount Number of HTTP header structures in > Headers list. > + @param[in] Headers Array containing list of HTTP headers. > + @param[in] Payload The Redfish payload to dump. > + > +**/ > +VOID > +RedfishFreeResponse ( > + IN EFI_HTTP_STATUS_CODE *StatusCode, > + IN UINTN HeaderCount, > + IN EFI_HTTP_HEADER *Headers, > + IN REDFISH_PAYLOAD Payload > + ); > + > +/** > + Check if the "@odata.type" in Payload is valid or not. > + > + @param[in] Payload The Redfish payload to be checked= . > + @param[in] OdataTypeName OdataType will be retrived from > mapping list. > + @param[in] OdataTypeMappingList The list of OdataType. > + @param[in] OdataTypeMappingListSize The number of mapping list > + > + @return TRUE if the "@odata.type" in Payload is valid, otherwise FALSE= . > + > +**/ > +BOOLEAN > +RedfishIsValidOdataType ( > + IN REDFISH_PAYLOAD Payload, > + IN CONST CHAR8 *OdataTypeName, > + IN REDFISH_ODATA_TYPE_MAPPING *OdataTypeMappingList, > + IN UINTN OdataTypeMappingListSize > + ); > + > +/** > + Check if the payload is collection > + > + @param[in] Payload The Redfish payload to be checked. > + > + @return TRUE if the payload is collection. > + > +**/ > +BOOLEAN > +RedfishIsPayloadCollection ( > + IN REDFISH_PAYLOAD Payload > + ); > + > +/** > + Get collection size. > + > + @param[in] Payload The Redfish collection payload > + @param[in] CollectionSize Size of this collection > + > + @return EFI_SUCCESS Coolection size is returned in Collec= tionSize > + @return EFI_INVALID_PARAMETER The payload is not a collection. > +**/ > +EFI_STATUS > +RedfishGetCollectionSize ( > + IN REDFISH_PAYLOAD Payload, > + IN UINTN *CollectionSize > + ); > + > +/** > + Get Redfish payload of collection member > + > + @param[in] Payload The Redfish collection payload > + @param[in] Index Index of collection member > + > + @return NULL Fail to get collection member. > + @return Non NULL Payload is returned. > +**/ > +REDFISH_PAYLOAD > +RedfishGetPayloadByIndex ( > + IN REDFISH_PAYLOAD Payload, > + IN UINTN Index > + ); > + > +/** > + Check and return Redfish resource of the given Redpath. > + > + @param[in] RedfishService Pointer to REDFISH_SERVICE > + @param[in] Redpath Redpath of the resource. > + @param[in] Response Optional return the resource. > + > + @return EFI_STATUS > +**/ > +EFI_STATUS > +RedfishCheckIfRedpathExist ( > + IN REDFISH_SERVICE RedfishService, > + IN CHAR8 *Redpath, > + IN REDFISH_RESPONSE *Response OPTIONAL > + ); > + > +/** > + This function returns the string of Redfish service version. > + > + @param[in] RedfishService Redfish service instance. > + @param[out] ServiceVersionStr Redfish service string. > + > + @return EFI_STATUS > + > +**/ > +EFI_STATUS > +RedfishGetServiceVersion ( > + IN REDFISH_SERVICE RedfishService, > + OUT CHAR8 **ServiceVersionStr > + ); > + > +/** > + This function returns the string of Redfish service version. > + > + @param[in] ServiceVerisonStr The string of Redfish service version. > + @param[in] Url The URL to build Redpath with ID. > + Start with "/", for example "/Registrie= s" > + @param[in] Id ID string > + @param[out] Redpath Pointer to retrive Redpath, caller has = to free > + the memory allocated for this string. > + @return EFI_STATUS > + > +**/ > +EFI_STATUS > +RedfishBuildRedpathUseId ( > + IN CHAR8 *ServiceVerisonStr, > + IN CHAR8 *Url, > + IN CHAR8 *Id, > + OUT CHAR8 **Redpath > + ); > + > +#endif > diff --git a/RedfishPkg/PrivateInclude/Library/RedfishLib.h > b/RedfishPkg/PrivateInclude/Library/RedfishLib.h > deleted file mode 100644 > index b2488ab..0000000 > --- a/RedfishPkg/PrivateInclude/Library/RedfishLib.h > +++ /dev/null > @@ -1,616 +0,0 @@ > -/** @file > - This library provides a set of utility APIs that allow to > create/read/update/delete > - (CRUD) Redfish resources and provide basic query abilities by using > [URI/RedPath] > - > (https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fgith > ub.com%2FDMTF%2Flibredfish&data=3D05%7C01%7CAbner.Chang%40am > d.com%7C801a31d2d98345b0b56408da7b116295%7C3dd8961fe4884e608e11a > 82d994e183d%7C0%7C0%7C637957611860036068%7CUnknown%7CTWFpbGZ > sb3d8eyJWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6M > n0%3D%7C3000%7C%7C%7C&sdata=3D19FpvKZ8NZ7BTkrZ8CQ34rAMUGj > m0ElwjFyv1eHuVDA%3D&reserved=3D0). > - > - The query language is based on XPath > (https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fww > w.w3.org%2FTR%2F1999%2FREC-xpath- > 19991116%2F&data=3D05%7C01%7CAbner.Chang%40amd.com%7C801a31 > d2d98345b0b56408da7b116295%7C3dd8961fe4884e608e11a82d994e183d%7C > 0%7C0%7C637957611860192298%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiM > C4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000 > %7C%7C%7C&sdata=3DYaK50FcrQhX4Fur4DPrh0yoI%2FDwhOKPce3kkNLz > uqRQ%3D&reserved=3D0). > - This library and query language essentially treat the entire Redfish S= ervice > like it > - was a single JSON document. In other words whenever it encounters an > odata.id in JSON > - document, it will retrieve the new JSON document (if needed). We name > the path as > - RedPath: > - > - Expression Description > - > - nodename Selects the JSON entity with the name "nodename". > - If the value of nodename is an object with "@odata.id= ", > - it will continue get the value from "@odata.id". > - > - / Selects from the root node > - > - [index] Selects the index number JSON entity from an array o= r > - object. If the JSON entity is one collection (has > - Members & Members@odata.count), means to get the inde= x > - member in "Members". Index number >=3D1, 1 means to r= eturn > - the first instance. > - > - [XXX] Operation on JSON entity. > - If the JSON entity is one collection (has Members & > - Members@odata.count), means to get all elements in > - "Members". If the JSON entity is one array, means to > - get all elements in array. Others will match the node= name > - directly (e.g. JSON_OBJECT, JSON_STRING, JSON_TRUE, > - JSON_FALSE, JSON_INTEGER). > - > - [nodename] Selects all the elements from an JSON entity that > - contain a property named "nodename" > - > - [name=3Dvalue] Selects all the elements from an JSON entity where > - the property "name" is equal to "value" > - > - [name~value] Selects all the elements from an JSON entity where > - the string property "name" is equal to "value" using > - case insensitive comparison. > - > - [name - the property "name" is less than "value" > - > - [name<=3Dvalue] Selects all the elements from an JSON entity where > - the property "name" is less than or equal to "value" > - > - [name>value] Selects all the elements from an JSON entity where > - the property "name" is greater than "value" > - > - [name>=3Dvalue] Selects all the elements from an JSON entity where > - the property "name" is greater than or equal to "valu= e" > - > - Some examples: > - > - /v1/Chassis[1] - Will return the first Chassis instance. > - /v1/Chassis[SKU=3D1234] - Will return all Chassis instances with a S= KU field > equal to 1234. > - /v1/Systems[Storage] - Will return all the System instances that ha= ve > Storage field populated. > - > - Copyright (c) 2019, Intel Corporation. All rights reserved.
> - (C) Copyright 2021 Hewlett Packard Enterprise Development LP
> - > - SPDX-License-Identifier: BSD-2-Clause-Patent > - > -**/ > - > -#ifndef REDFISH_LIB_H_ > -#define REDFISH_LIB_H_ > - > -#include > - > -#include > -#include > - > -#define ODATA_TYPE_NAME_MAX_SIZE 128 > -#define ODATA_TYPE_MAX_SIZE 128 > - > -/// > -/// Library class public defines > -/// > -typedef VOID *REDFISH_SERVICE; > -typedef VOID *REDFISH_PAYLOAD; > - > -/// > -/// Library class public structures/unions > -/// > -typedef struct { > - EFI_HTTP_STATUS_CODE *StatusCode; > - UINTN HeaderCount; > - EFI_HTTP_HEADER *Headers; > - REDFISH_PAYLOAD Payload; > -} REDFISH_RESPONSE; > - > -/// > -/// Odata type-name mapping structure. > -/// > -typedef struct { > - CONST CHAR8 OdataTypeName[ODATA_TYPE_NAME_MAX_SIZE]; > - CONST CHAR8 OdataType[ODATA_TYPE_MAX_SIZE]; > -} REDFISH_ODATA_TYPE_MAPPING; > - > -/** > - This function uses REST EX protocol provided in RedfishConfigServiceIn= fo. > - The service enumerator will also handle the authentication flow > automatically > - if HTTP basic auth or Redfish session login is configured to use. > - > - Callers are responsible for freeing the returned service by > RedfishCleanupService(). > - > - @param[in] RedfishConfigServiceInfo Redfish service information the E= FI > Redfish > - feature driver communicates with. > - > - @return New created Redfish Service, or NULL if error happens. > - > -**/ > -REDFISH_SERVICE > -EFIAPI > -RedfishCreateService ( > - IN REDFISH_CONFIG_SERVICE_INFORMATION *RedfishConfigServiceInfo > - ); > - > -/** > - Free the Service and all its related resources. > - > - @param[in] RedfishService The Service to access the Redfish res= ources. > - > -**/ > -VOID > -EFIAPI > -RedfishCleanupService ( > - IN REDFISH_SERVICE RedfishService > - ); > - > -/** > - Create REDFISH_PAYLOAD instance in local with JSON represented > resource value and > - the Redfish Service. > - > - The returned REDFISH_PAYLOAD can be used to create or update Redfish > resource in > - server side. > - > - Callers are responsible for freeing the returned payload by > RedfishCleanupPayload(). > - > - @param[in] Value JSON Value of the redfish resource= . > - @param[in] RedfishService The Service to access the Redfish > resources. > - > - @return REDFISH_PAYLOAD instance of the resource, or NULL if error > happens. > - > -**/ > -REDFISH_PAYLOAD > -EFIAPI > -RedfishCreatePayload ( > - IN EDKII_JSON_VALUE Value, > - IN REDFISH_SERVICE RedfishService > - ); > - > -/** > - Free the RedfishPayload and all its related resources. > - > - @param[in] Payload Payload to be freed. > - > -**/ > -VOID > -EFIAPI > -RedfishCleanupPayload ( > - IN REDFISH_PAYLOAD Payload > - ); > - > -/** > - This function returns the decoded JSON value of a REDFISH_PAYLOAD. > - > - Caller doesn't need to free the returned JSON value because it will be > released > - in corresponding RedfishCleanupPayload() function. > - > - @param[in] Payload A REDFISH_PAYLOAD instance. > - > - @return Decoded JSON value of the payload. > - > -**/ > -EDKII_JSON_VALUE > -EFIAPI > -RedfishJsonInPayload ( > - IN REDFISH_PAYLOAD Payload > - ); > - > -/** > - Fill the input RedPath string with system UUID from SMBIOS table or us= e > the customized > - ID if FromSmbios =3D=3D FALSE. > - > - This is a helper function to build a RedPath string which can be used = to > address > - a Redfish resource for this computer system. The input PathString must > have a Systems > - note in format of "Systems[UUID=3D%g]" or "Systems[UUID~%g]" to fill t= he > UUID value. > - > - Example: > - Use "/v1/Systems[UUID=3D%g]/Bios" to build a RedPath to address the > "Bios" resource > - for this computer system. > - > - @param[in] RedPath RedPath format to be build. > - @param[in] FromSmbios Get system UUID from SMBIOS as computer > system instance ID. > - @param[in] IdString The computer system instance ID. > - > - @return Full RedPath with system UUID inside, or NULL if error hap= pens. > - > -**/ > -CHAR8 * > -EFIAPI > -RedfishBuildPathWithSystemUuid ( > - IN CONST CHAR8 *RedPath, > - IN BOOLEAN FromSmbios, > - IN CHAR8 *IdString OPTIONAL > - ); > - > -/** > - Get a redfish response addressed by a RedPath string, including HTTP > StatusCode, Headers > - and Payload which record any HTTP response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] RedfishService The Service to access the Redfish > resources. > - @param[in] RedPath RedPath string to address a resour= ce, must > start > - from the root node. > - @param[out] RedResponse Pointer to the Redfish response da= ta. > - > - @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > - NULL and the value is 2XX. The corresp= onding redfish > resource has > - been returned in Payload within RedRes= ponse. > - @retval EFI_INVALID_PARAMETER RedfishService, RedPath, or > RedResponse is NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned Payload is NULL, in= dicates any error > happen. > - 2. If the returned StatusCode is NULL,= indicates any error > happen. > - 3. If the returned StatusCode is not 2= XX, indicates any error > happen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishGetByService ( > - IN REDFISH_SERVICE RedfishService, > - IN CONST CHAR8 *RedPath, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Get a redfish response addressed by URI, including HTTP StatusCode, > Headers > - and Payload which record any HTTP response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] RedfishService The Service to access the URI resource= s. > - @param[in] URI String to address a resource. > - @param[out] RedResponse Pointer to the Redfish response data. > - > - @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > - NULL and the value is 2XX. The corresp= onding redfish > resource has > - been returned in Payload within RedRes= ponse. > - @retval EFI_INVALID_PARAMETER RedfishService, RedPath, or > RedResponse is NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned Payload is NULL, in= dicates any error > happen. > - 2. If the returned StatusCode is NULL,= indicates any error > happen. > - 3. If the returned StatusCode is not 2= XX, indicates any error > happen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishGetByUri ( > - IN REDFISH_SERVICE RedfishService, > - IN CONST CHAR8 *Uri, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Get a redfish response addressed by the input Payload and relative > RedPath string, > - including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] Payload A existing REDFISH_PAYLOAD instance. > - @param[in] RedPath Relative RedPath string to address a r= esource > inside Payload. > - @param[out] RedResponse Pointer to the Redfish response data. > - > - @retval EFI_SUCCESS The opeartion is successful: > - 1. The HTTP StatusCode is NULL and the= returned Payload > in > - RedResponse is not NULL, indicates the= Redfish resource > has > - been parsed from the input payload dir= ectly. > - 2. The HTTP StatusCode is not NULL and= the value is 2XX, > - indicates the corresponding redfish re= source has been > returned > - in Payload within RedResponse. > - @retval EFI_INVALID_PARAMETER Payload, RedPath, or RedResponse is > NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned Payload is NULL, in= dicates any error > happen. > - 2. If StatusCode is not NULL and the r= eturned value of > StatusCode > - is not 2XX, indicates any error hap= pen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishGetByPayload ( > - IN REDFISH_PAYLOAD Payload, > - IN CONST CHAR8 *RedPath, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Use HTTP PATCH to perform updates on pre-existing Redfish resource. > - > - This function uses the RedfishService to patch a Redfish resource > addressed by > - Uri (only the relative path is required). Changes to one or more prope= rties > within > - the target resource are represented in the input Content, properties n= ot > specified > - in Content won't be changed by this request. The corresponding redfish > response will > - returned, including HTTP StatusCode, Headers and Payload which record > any HTTP response > - messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] RedfishService The Service to access the Redfish > resources. > - @param[in] Uri Relative path to address the resou= rce. > - @param[in] Content JSON represented properties to be = update. > - @param[out] RedResponse Pointer to the Redfish response da= ta. > - > - @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > - NULL and the value is 2XX. The Redfish= resource will be > returned > - in Payload within RedResponse if serve= r send it back in the > HTTP > - response message body. > - @retval EFI_INVALID_PARAMETER RedfishService, Uri, Content, or > RedResponse is NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned StatusCode is NULL,= indicates any error > happen. > - 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > - indicates any error happen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPatchToUri ( > - IN REDFISH_SERVICE RedfishService, > - IN CONST CHAR8 *Uri, > - IN CONST CHAR8 *Content, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Use HTTP PATCH to perform updates on target payload. Patch to odata.id= in > Payload directly. > - > - This function uses the Payload to patch the Target. Changes to one or = more > properties > - within the target resource are represented in the input Payload, prope= rties > not specified > - in Payload won't be changed by this request. The corresponding redfish > response will > - returned, including HTTP StatusCode, Headers and Payload which record > any HTTP response > - messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] Target The target payload to be updated. > - @param[in] Payload Palyoad with properties to be changed. > - @param[out] RedResponse Pointer to the Redfish response data. > - > - @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > - NULL and the value is 2XX. The Redfish= resource will be > returned > - in Payload within RedResponse if serve= r send it back in the > HTTP > - response message body. > - @retval EFI_INVALID_PARAMETER Target, Payload, or RedResponse is > NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned StatusCode is NULL,= indicates any error > happen. > - 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > - indicates any error happen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPatchToPayload ( > - IN REDFISH_PAYLOAD Target, > - IN REDFISH_PAYLOAD Payload, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Use HTTP POST to create a new resource in target payload. > - > - The POST request should be submitted to the Resource Collection in whi= ch > the new resource > - is to belong. The Resource Collection is addressed by Target payload. = The > Redfish may > - ignore any service controlled properties. The corresponding redfish > response will returned, > - including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] Target Target payload of the Resource Collectio= n. > - @param[in] Payload The new resource to be created. > - @param[out] RedResponse Pointer to the Redfish response data. > - > - @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > - NULL and the value is 2XX. The Redfish= resource will be > returned > - in Payload within RedResponse if serve= r send it back in the > HTTP > - response message body. > - @retval EFI_INVALID_PARAMETER Target, Payload, or RedResponse is > NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned StatusCode is NULL,= indicates any error > happen. > - 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > - indicates any error happen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishPostToPayload ( > - IN REDFISH_PAYLOAD Target, > - IN REDFISH_PAYLOAD Payload, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Use HTTP DELETE to remove a resource. > - > - This function uses the RedfishService to remove a Redfish resource whi= ch > is addressed > - by input Uri (only the relative path is required). The corresponding r= edfish > response will > - returned, including HTTP StatusCode, Headers and Payload which record > any HTTP response > - messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and > Payload returned in > - redfish response data. > - > - @param[in] RedfishService The Service to access the Redfish > resources. > - @param[in] Uri Relative path to address the resou= rce. > - @param[out] RedResponse Pointer to the Redfish response da= ta. > - > - @retval EFI_SUCCESS The opeartion is successful, indicates= the HTTP > StatusCode is not > - NULL and the value is 2XX, the Redfish= resource has been > removed. > - If there is any message returned from = server, it will be > returned > - in Payload within RedResponse. > - @retval EFI_INVALID_PARAMETER RedfishService, Uri, or RedResponse is > NULL. > - @retval EFI_DEVICE_ERROR An unexpected system or network error > occurred. Callers can get > - more error info from returned HTTP Sta= tusCode, Headers > and Payload > - within RedResponse: > - 1. If the returned StatusCode is NULL,= indicates any error > happen. > - 2. If the returned StatusCode is not N= ULL and the value is > not 2XX, > - indicates any error happen. > -**/ > -EFI_STATUS > -EFIAPI > -RedfishDeleteByUri ( > - IN REDFISH_SERVICE RedfishService, > - IN CONST CHAR8 *Uri, > - OUT REDFISH_RESPONSE *RedResponse > - ); > - > -/** > - Dump text in fractions. > - > - @param[in] String ASCII string to dump. > - > -**/ > -VOID > -RedfishDumpJsonStringFractions ( > - IN CHAR8 *String > - ); > - > -/** > - Extract the JSON text content from REDFISH_PAYLOAD and dump to debug > console. > - > - @param[in] Payload The Redfish payload to dump. > - > -**/ > -VOID > -RedfishDumpPayload ( > - IN REDFISH_PAYLOAD Payload > - ); > - > -/** > - Dump text in JSON value. > - > - @param[in] JsonValue The Redfish JSON value to dump. > - > -**/ > -VOID > -RedfishDumpJson ( > - IN EDKII_JSON_VALUE JsonValue > - ); > - > -/** > - This function will cleanup the HTTP header and Redfish payload resourc= es. > - > - @param[in] StatusCode The status code in HTTP response message= . > - @param[in] HeaderCount Number of HTTP header structures in > Headers list. > - @param[in] Headers Array containing list of HTTP headers. > - @param[in] Payload The Redfish payload to dump. > - > -**/ > -VOID > -RedfishFreeResponse ( > - IN EFI_HTTP_STATUS_CODE *StatusCode, > - IN UINTN HeaderCount, > - IN EFI_HTTP_HEADER *Headers, > - IN REDFISH_PAYLOAD Payload > - ); > - > -/** > - Check if the "@odata.type" in Payload is valid or not. > - > - @param[in] Payload The Redfish payload to be checked= . > - @param[in] OdataTypeName OdataType will be retrived from > mapping list. > - @param[in] OdataTypeMappingList The list of OdataType. > - @param[in] OdataTypeMappingListSize The number of mapping list > - > - @return TRUE if the "@odata.type" in Payload is valid, otherwise FALSE= . > - > -**/ > -BOOLEAN > -RedfishIsValidOdataType ( > - IN REDFISH_PAYLOAD Payload, > - IN CONST CHAR8 *OdataTypeName, > - IN REDFISH_ODATA_TYPE_MAPPING *OdataTypeMappingList, > - IN UINTN OdataTypeMappingListSize > - ); > - > -/** > - Check if the payload is collection > - > - @param[in] Payload The Redfish payload to be checked. > - > - @return TRUE if the payload is collection. > - > -**/ > -BOOLEAN > -RedfishIsPayloadCollection ( > - IN REDFISH_PAYLOAD Payload > - ); > - > -/** > - Get collection size. > - > - @param[in] Payload The Redfish collection payload > - @param[in] CollectionSize Size of this collection > - > - @return EFI_SUCCESS Coolection size is returned in Collec= tionSize > - @return EFI_INVALID_PARAMETER The payload is not a collection. > -**/ > -EFI_STATUS > -RedfishGetCollectionSize ( > - IN REDFISH_PAYLOAD Payload, > - IN UINTN *CollectionSize > - ); > - > -/** > - Get Redfish payload of collection member > - > - @param[in] Payload The Redfish collection payload > - @param[in] Index Index of collection member > - > - @return NULL Fail to get collection member. > - @return Non NULL Payload is returned. > -**/ > -REDFISH_PAYLOAD > -RedfishGetPayloadByIndex ( > - IN REDFISH_PAYLOAD Payload, > - IN UINTN Index > - ); > - > -/** > - Check and return Redfish resource of the given Redpath. > - > - @param[in] RedfishService Pointer to REDFISH_SERVICE > - @param[in] Redpath Redpath of the resource. > - @param[in] Response Optional return the resource. > - > - @return EFI_STATUS > -**/ > -EFI_STATUS > -RedfishCheckIfRedpathExist ( > - IN REDFISH_SERVICE RedfishService, > - IN CHAR8 *Redpath, > - IN REDFISH_RESPONSE *Response OPTIONAL > - ); > - > -/** > - This function returns the string of Redfish service version. > - > - @param[in] RedfishService Redfish service instance. > - @param[out] ServiceVersionStr Redfish service string. > - > - @return EFI_STATUS > - > -**/ > -EFI_STATUS > -RedfishGetServiceVersion ( > - IN REDFISH_SERVICE RedfishService, > - OUT CHAR8 **ServiceVersionStr > - ); > - > -/** > - This function returns the string of Redfish service version. > - > - @param[in] ServiceVerisonStr The string of Redfish service version. > - @param[in] Url The URL to build Redpath with ID. > - Start with "/", for example "/Registrie= s" > - @param[in] Id ID string > - @param[out] Redpath Pointer to retrive Redpath, caller has = to free > - the memory allocated for this string. > - @return EFI_STATUS > - > -**/ > -EFI_STATUS > -RedfishBuildRedpathUseId ( > - IN CHAR8 *ServiceVerisonStr, > - IN CHAR8 *Url, > - IN CHAR8 *Id, > - OUT CHAR8 **Redpath > - ); > - > -#endif > diff --git a/RedfishPkg/RedfishPkg.dec b/RedfishPkg/RedfishPkg.dec > index 9886502..0aa2688 100644 > --- a/RedfishPkg/RedfishPkg.dec > +++ b/RedfishPkg/RedfishPkg.dec > @@ -64,7 +64,7 @@ >=20 > ## @libraryclass Redfish Helper Library > # Library provides Redfish helper functions. > - RedfishLib|PrivateInclude/Library/RedfishLib.h > + RedfishLib|Include/Library/RedfishLib.h >=20 > [Protocols] > ## Include/Protocol/EdkIIRedfishCredential.h > -- > 2.6.1.windows.1 > -The information contained in this message may be confidential and > proprietary to American Megatrends (AMI). This communication is intended > to be read only by the individual or entity to whom it is addressed or by= their > designee. If the reader of this message is not the intended recipient, yo= u are > on notice that any distribution of this message, in any form, is strictly > prohibited. Please promptly notify the sender by reply e-mail or by > telephone at 770-246-8600, and then delete or destroy all copies of the > transmission.