From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM10-DM6-obe.outbound.protection.outlook.com (NAM10-DM6-obe.outbound.protection.outlook.com [40.107.93.44]) by mx.groups.io with SMTP id smtpd.web10.6448.1683682185274579341 for ; Tue, 09 May 2023 18:29:45 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=Q5dGZVq7; 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.93.44, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=XueyQa8coUfBKrQSszWdXd/WxUc2bqGIe+GmPQkaQgJnSzjxoq5pUc0bG7njkvGwbNHcyKypIX3xwvqrPQISYqauUr1SjPnFgNncZnS38zWPaUHaGwth6+rs55H2j+HSTXbJkdXkwbz7x5SNPx9QgS0QHlq23rxkizKQfSfkGGY6ZZLsmWYpfdEZ25GhQrPFHLid7ZAowUKP65CQotyziMm2iTFd4FcN+bvCeMC3bsKogqVxDVhQEoM5dDHDn5ciW2jMPF1CsfpQv/H+9SZCRDi8QhVB3W8ICxJxKuDuE6Va5O3kXMccz1JZ7NsDZH0FNLiwekDrey4butrCqUvxCA== 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=1gpAu81rIRqKR8dJh79LvyLZVy7LtE1hLmBIw/+ELaE=; b=hP7Z9koeqxT2s85+YXy8vpXs6z0jKVmjr+C9hz0Mnxf7wVb516cMCtHN/H03D7aZ0havfGf4Pxc1hPhiszob7OtcRKyYedLFZNSf+ggi56a7x4mgc6wWe9OruXKf0oNDIz0Ctdf1O2mml6XnuZlfz+4g9XJexQvx85B/4RrIS2Kt7BsNdc+Ef3bfFdt6L5bp9EMuScpSHxFeGL5W3tSVfvr+k/5O3+QJn8FQeXewGPT/+4LO6ngMFX6uZDJZ08l2Wwm1fOukHY1L6h9t6WrXds0oHjnw7NlTDX+5xJGwRvvGjUwsHrq6sImlPFXKVreIWrNhGdG84tuOLK4PTN2e9Q== 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=1gpAu81rIRqKR8dJh79LvyLZVy7LtE1hLmBIw/+ELaE=; b=Q5dGZVq78LFPovXid5WAttR8ak1peMLM3PUR7EqxFV5R6x0Cto7LG2ItUw32P/l6jlCbIFqcrM6NWCJajAj5J0rE5ezlCep+DXXAVAfxmVk0CFqrAt2tbxd9u4I83n8/AOSD6cDMviL1kTZ2A5IiZEXWHIgP43OcYBOXNYAIJh8= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by CY5PR12MB6550.namprd12.prod.outlook.com (2603:10b6:930:42::6) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.6363.33; Wed, 10 May 2023 01:29:43 +0000 Received: from MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3]) by MN2PR12MB3966.namprd12.prod.outlook.com ([fe80::46f1:bdce:a4bc:29e3%3]) with mapi id 15.20.6363.032; Wed, 10 May 2023 01:29:43 +0000 From: "Chang, Abner" To: Nickle Wang , "devel@edk2.groups.io" CC: Igor Kulchytskyy Subject: Re: [edk2-redfish-client][PATCH 5/6] RedfishClientPkg: Introduce resource identify library Thread-Topic: [edk2-redfish-client][PATCH 5/6] RedfishClientPkg: Introduce resource identify library Thread-Index: AQHZgn53bQrdfF9Vdkapzv9OqU/5mK9SuMmQ Date: Wed, 10 May 2023 01:29:42 +0000 Message-ID: References: <20230509135909.7223-1-nicklew@nvidia.com> In-Reply-To: <20230509135909.7223-1-nicklew@nvidia.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=2023-05-10T01:29: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=692d30d5-64c6-4424-a006-dfe087bef36d; 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-traffictypediagnostic: MN2PR12MB3966:EE_|CY5PR12MB6550:EE_ x-ms-office365-filtering-correlation-id: 06892521-5b52-4b95-29b5-08db50f607ff x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OxxRPvxQtyRyDlL+DPT/U85nb8OI6H+CEFTH9oRiy+guiZfRrVZJBFGn5ILgEkS3z/hG4hT7TN5eZjD9dUEs7CQwuaH7gXf9CkrQP/odUynZ1ZcHSQVTvGiaynwJzAf0l5YvYX0YZXZYt+k91TubYF8DYH3YB7kpE2X9RaptZgJkG7Xaqd0bYLfJGuiDjgplcNphmmx4m2jam9louo9DAc+jWP2AIHet75J9Eo2UrhYBnyk3NuGAtrhb1+bL3TpSwbydMu2bbPIb7jFnFQKp5y5mtxTg4Xm11JvZJvB8InwLPML6RCAFDqyvjn8oZYeg4QMHOLdqYfouAaaMKl3IFJ3ZaeuEm4eNOSPh/29BZICz8wgXzLB3djPyIWDwlaBB9rrqjnG5D2ubU/lF7mN7/uc9spjFJJykzFhV2bRIm6nn+KgIY5bHjIvI2e/GyCCV8zFF2f4/KVNmY28Vi/cYmnAU0Ea/QH7t33xuenumIl2YyVkSR42urxwMjEUyTOTAyN9lXe24aHu5t2/sDg0zcCwLvFyaAFHlJIl3hgc/zhuTH55tM6VdG/Qe7s9IebCiOFmA6z4MRO4L45ZdrCd2vXdkArS53z6i/FNLfWHv6cWVRXW7NQUP4bivK4BePMsC 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:(13230028)(4636009)(39860400002)(366004)(396003)(136003)(346002)(376002)(451199021)(2906002)(86362001)(83380400001)(38070700005)(186003)(4326008)(41300700001)(66476007)(66946007)(76116006)(66446008)(64756008)(66556008)(9686003)(6506007)(26005)(53546011)(30864003)(5660300002)(33656002)(7696005)(38100700002)(52536014)(71200400001)(55016003)(122000001)(19627235002)(110136005)(316002)(8676002)(8936002)(478600001);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?51Ix90AvZcaP2LP2WYxEYBPyGeDmcSgwXIicXOsHuOpyiuO6MzVx8cz7VwxP?= =?us-ascii?Q?tR5ggtkyCFhW5XfZxCLNydIqLaJglCm/pnNBMmsefzqWoIK1Rh8npOpMOrOK?= =?us-ascii?Q?eX4AKzUnyZYWAuE7+9JwE56+TR7JfzrVBN7Gtx8CTlVJ0hhp9kbMPMdPOdgc?= =?us-ascii?Q?NuurDtcqiCKtxnCcji4QgmZqvHkkOlnn9/RfqZQIVeoQ0EuX6PAT5XVw0eQ2?= =?us-ascii?Q?YgNH9KmNB8q5C3VNreSnYe75OgYzyKhkowu7wH+UaaV/QZv4PG5WGWwvrkp6?= =?us-ascii?Q?8tFkfTDgFoP630JHZzH/byrc+KwJADmaUJJ6OnWfDVwPaXGivRNqyWoSufgr?= =?us-ascii?Q?A3RE3mXg48CrMcA7KPnfB7E2Gd/2vUqqqvmMBULzvDZaAFPrZGAQATOxQ3cI?= =?us-ascii?Q?iQuSGMTiDqHoxccZuzbdd93S6rDJQR42I7KEygFNfPqrlNPA0iA2mu8suH1J?= =?us-ascii?Q?CdcoI7zdgWhtt7pzMX+fmu3krIChBmEsrT1FdzBdQ3qzFf5phCKHutnXlvu1?= =?us-ascii?Q?OSs9zVX4Pqk8/h3f7gKeHrQzMDKybwvzV1w4bX8ZQB6coRXNUMnTBk8aSbH6?= =?us-ascii?Q?qgFboXUAw7ShbRGQgC5LuBeImqwL6lsFUZ33AeQIjC5JpxL1+uV5t5ownh6T?= =?us-ascii?Q?DaKP7zjJURjVb8z+gch6e8ziwK/6P3zwlYyLevPYovOsHo05hC1wVDYwYiaB?= =?us-ascii?Q?bTsRId8O70zURzsAjvNvQ8DV5N9546KpY3RPFKSIfbIyRPN7gJRYFc1pKihp?= =?us-ascii?Q?KX7y4U/0Vo5ISuumMvil2dVkKfRxynsGNSqx0VAcj5D2Xp5k87aouPSZvuwt?= =?us-ascii?Q?j2k+Zfdv1F9x8O+umcLtpOZv5S54GJgD0sCfTVuT3YnBd2zBCX008ZSGI0ce?= =?us-ascii?Q?0lAN3GQLO6RxMZXe7EJcV48weoqD/GWHLc4Fc/S1UIPmEybO1s72suA/DcSh?= =?us-ascii?Q?Lw0igi/OxFxCbyiY2h27IahOJwcr2OnmbJK3GgkpgxsWwhOMGLjvLZGXx251?= =?us-ascii?Q?ScMcwqWBmVy2KbLik0QiLROs2AWn2jWTz8IrTNcXtZ2ajZnGI9qWcnBTOfF5?= =?us-ascii?Q?21CoRY0m9zMuaIFk9PXeuVfA7v29oPP+5t8lpqN1L/bYvDCf7nigxcrl5IVK?= =?us-ascii?Q?02v8uf3kh7lnDvKz3v4Y6gUaeWy/tyU5ES1ByfY7j4kH1Qo8wFtu7Fr46EfH?= =?us-ascii?Q?3Ey2LOCmRKUWIaTEhuBowgNeBrHZrN0XQgAkloUBQX3GpSNa0rqSgOLINPVz?= =?us-ascii?Q?qnsm3RrzU8dYhVFbuMnyltvy5Ren8u3GHxP/E0pRdZ+CLkJGGrGek7wSBZE0?= =?us-ascii?Q?BntssRGKaOyjyxPwN331xV9jfxRHHV/JLWWGyfODUUA7vcjhU5Y0XV+mvdY4?= =?us-ascii?Q?m21e3u7F92P+dFFoRwx7NxmPBCpBCJMsBb4v4kbhnoVmZI4ygv/wGJH58kKL?= =?us-ascii?Q?HEPZAxlZMz7VtHErTZu77IJJukYtCknPgFn7WRJwjXVAki5PCXXIDQYQVFKp?= =?us-ascii?Q?P4B6zqO9t9NykcLn/YKqibJc+X5WURn/aQ3XD8HMJkvLRw76WgC/F00AjC8K?= =?us-ascii?Q?3sS9mI5gaN9c1yS+Hhx/8MSHbk8XeMoch3ZKZcko?= 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: 06892521-5b52-4b95-29b5-08db50f607ff X-MS-Exchange-CrossTenant-originalarrivaltime: 10 May 2023 01:29:42.9355 (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: NAGcKaxiFYpYYNKNWXVbRe3r+UiG0SxPUQJvj10hq5fMdLHX+HIu38auuzi6CE4Nt2QjOGq8Iun3LcuQSLNksw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CY5PR12MB6550 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: Nickle Wang > Sent: Tuesday, May 9, 2023 9:59 PM > To: devel@edk2.groups.io > Cc: Chang, Abner ; Igor Kulchytskyy > > Subject: [edk2-redfish-client][PATCH 5/6] RedfishClientPkg: Introduce > resource identify library >=20 > Caution: This message originated from an External Source. Use proper > caution when opening attachments, clicking links, or responding. >=20 >=20 > Introduce resource identify library which works with resource config prot= ocol > to identify Redfish resource. This library provides the flexibility for p= latform > to implement its own policy and identify resource. Two library > implementation are provided as demonstration code. NULL version of librar= y > accepts all Redfish resource and another implementation to computer > system resource uses UUID to identify Redfish resource. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Igor Kulchytskyy > --- > RedfishClientPkg/RedfishClientPkg.dec | 1 + > RedfishClientPkg/RedfishClientLibs.dsc.inc | 2 +- > ...edfishResourceIdentifyLibComuterSystem.inf | 39 +++++ > .../RedfishResourceIdentifyLibNull.inf | 32 ++++ > .../Library/RedfishResourceIdentifyLib.h | 29 ++++ > .../RedfishResourceIdentifyLibComuterSystem.c | 163 > ++++++++++++++++++ > .../RedfishResourceIdentifyLibNull.c | 37 ++++ > 7 files changed, 302 insertions(+), 1 deletion(-) create mode 100644 > RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_ > 0/RedfishResourceIdentifyLibComuterSystem.inf > create mode 100644 > RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResourceId > entifyLibNull.inf > create mode 100644 > RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h > create mode 100644 > RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_5_ > 0/RedfishResourceIdentifyLibComuterSystem.c > create mode 100644 > RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResourceId > entifyLibNull.c >=20 > diff --git a/RedfishClientPkg/RedfishClientPkg.dec > b/RedfishClientPkg/RedfishClientPkg.dec > index 9d18c42c..c61c5812 100644 > --- a/RedfishClientPkg/RedfishClientPkg.dec > +++ b/RedfishClientPkg/RedfishClientPkg.dec > @@ -21,6 +21,7 @@ >=20 > [LibraryClasses] > RedfishFeatureUtilityLib|Include/Library/RedfishFeatureUtilityLib.h > + > + RedfishResourceIdentifyLib|Include/Library/RedfishResourceIdentifyLib. > + h >=20 > EdkIIRedfishResourceConfigLib|Include/Library/EdkIIRedfishResourceConfig > Lib.h > RedfishEventLib|Include/Library/RedfishEventLib.h > RedfishVersionLib|Include/Library/RedfishVersionLib.h > diff --git a/RedfishClientPkg/RedfishClientLibs.dsc.inc > b/RedfishClientPkg/RedfishClientLibs.dsc.inc > index 8acb4791..413b83a7 100644 > --- a/RedfishClientPkg/RedfishClientLibs.dsc.inc > +++ b/RedfishClientPkg/RedfishClientLibs.dsc.inc > @@ -27,7 +27,7 @@ >=20 > RedfishPlatformConfigLib|RedfishPkg/Library/RedfishPlatformConfigLib/Red > fishPlatformConfigLib.inf >=20 > RedfishContentCodingLib|RedfishPkg/Library/RedfishContentCodingLibNull/ > RedfishContentCodingLibNull.inf >=20 > ConverterCommonLib|RedfishClientPkg/ConverterLib/edk2library/Converte > rCommonLib/ConverterCommonLib.inf > - > + > + RedfishResourceIdentifyLib|RedfishClientPkg/Library/RedfishResourceIde > + ntifyLibNull/RedfishResourceIdentifyLibNull.inf >=20 > EdkIIRedfishResourceConfigLib|RedfishClientPkg/Library/EdkIIRedfishResou > rceConfigLib/EdkIIRedfishResourceConfigLib.inf >=20 > RedfishEventLib|RedfishClientPkg/Library/RedfishEventLib/RedfishEventLib.= i > nf >=20 > RedfishVersionLib|RedfishClientPkg/Library/RedfishVersionLib/RedfishVersi > onLib.inf > diff --git > a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_ > 5_0/RedfishResourceIdentifyLibComuterSystem.inf > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_ > 5_0/RedfishResourceIdentifyLibComuterSystem.inf > new file mode 100644 > index 00000000..ae269b58 > --- /dev/null > +++ > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v > +++ 1_5_0/RedfishResourceIdentifyLibComuterSystem.inf > @@ -0,0 +1,39 @@ > +## @file > +# > +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
# # > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D RedfishResourceIdentifyLibComuterSy= stem > + FILE_GUID =3D 2AEE2C80-126A-44A6-877E-642F20510D1= 3 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D RedfishResourceIdentifyLib| DXE_DRI= VER > + CONSTRUCTOR =3D > RedfishResourceIdentifyComuterSystemConstructor > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC > +# > + > +[Sources] > + RedfishResourceIdentifyLibComuterSystem.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + NetworkPkg/NetworkPkg.dec > + RedfishPkg/RedfishPkg.dec > + RedfishClientPkg/RedfishClientPkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > + UefiBootServicesTableLib > + UefiLib > + > +[Protocols] > + gEfiRestJsonStructureProtocolGuid ## CONSUMES > diff --git > a/RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResource > IdentifyLibNull.inf > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResourc > eIdentifyLibNull.inf > new file mode 100644 > index 00000000..9164b229 > --- /dev/null > +++ b/RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishRes > +++ ourceIdentifyLibNull.inf > @@ -0,0 +1,32 @@ > +## @file > +# > +# (C) Copyright 2022 Hewlett Packard Enterprise Development LP
# # > +SPDX-License-Identifier: BSD-2-Clause-Patent # ## > + > +[Defines] > + INF_VERSION =3D 0x00010006 > + BASE_NAME =3D RedfishResourceIdentifyLibNull > + FILE_GUID =3D 6FFD4E25-48F8-4CB6-B194-CFAB407316E= 1 > + MODULE_TYPE =3D DXE_DRIVER > + VERSION_STRING =3D 1.0 > + LIBRARY_CLASS =3D RedfishResourceIdentifyLib| DXE_DRI= VER > + > +# > +# VALID_ARCHITECTURES =3D IA32 X64 EBC > +# > + > +[Sources] > + RedfishResourceIdentifyLibNull.c > + > +[Packages] > + MdePkg/MdePkg.dec > + MdeModulePkg/MdeModulePkg.dec > + RedfishPkg/RedfishPkg.dec > + RedfishClientPkg/RedfishClientPkg.dec > + > +[LibraryClasses] > + BaseLib > + DebugLib > diff --git a/RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.= h > b/RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h > new file mode 100644 > index 00000000..254f9be3 > --- /dev/null > +++ b/RedfishClientPkg/Include/Library/RedfishResourceIdentifyLib.h > @@ -0,0 +1,29 @@ > +/** @file > + This file defines the Redfish resource identify Library interface. > + > + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#ifndef REDFISH_RESOURCE_IDENTIFY_LIB_H_ #define > +REDFISH_RESOURCE_IDENTIFY_LIB_H_ > + > +/** > + Identify resource from given URI and context in JSON format > + > + @param[in] Uri URI of given Redfish resource > + @param[in] Json Context in JSON format of give Redfish resource > + > + @retval TRUE This is the Redfish resource that we have to handl= e. > + @retval FALSE We don't handle this Redfish resource. > + > +**/ > +BOOLEAN > +RedfishIdentifyResource ( > + IN EFI_STRING Uri, > + IN CHAR8 *Json > + ); > + > +#endif > diff --git > a/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_ > 5_0/RedfishResourceIdentifyLibComuterSystem.c > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v1_ > 5_0/RedfishResourceIdentifyLibComuterSystem.c > new file mode 100644 > index 00000000..a15809ef > --- /dev/null > +++ > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibComuterSystem/v > +++ 1_5_0/RedfishResourceIdentifyLibComuterSystem.c > @@ -0,0 +1,163 @@ > +/** @file > + Redfish resource identify library implementation for computer system > +version 1.5.0 > + > + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > + > +#include > +#include > +#include > +#include > +#include > +#include > + > +#include > + > +#include > + _0.h> > + > +EFI_REST_JSON_STRUCTURE_PROTOCOL *mJsonStructProtocol =3D NULL; > + > +/** > + Identify resource from given URI and context in JSON format > + > + @param[in] Uri URI of given Redfish resource > + @param[in] Json Context in JSON format of give Redfish resource > + > + @retval TRUE This is the Redfish resource that we have to handl= e. > + @retval FALSE We don't handle this Redfish resource. > + > +**/ > +BOOLEAN > +RedfishIdentifyResource ( > + IN EFI_STRING Uri, > + IN CHAR8 *Json > + ) > +{ > + EFI_STATUS Status; > + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0 *ComputerSystem; > + EFI_REDFISH_COMPUTERSYSTEM_V1_5_0_CS *ComputerSystemCs; > + EFI_GUID SystemUuid; > + EFI_GUID ResourceUuid; > + > + if (IS_EMPTY_STRING (Uri) || IS_EMPTY_STRING (Json)) { > + return FALSE; > + } > + > + if (mJsonStructProtocol =3D=3D NULL) { > + return FALSE; > + } > + > + ComputerSystem =3D NULL; > + ComputerSystemCs =3D NULL; > + > + Status =3D mJsonStructProtocol->ToStructure ( > + mJsonStructProtocol, > + NULL, > + Json, > + (EFI_REST_JSON_STRUCTURE_HEADER > **)&ComputerSystem > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, ToStructure() failed: %r\n", > __FUNCTION__, Status)); > + return FALSE; > + } > + > + ComputerSystemCs =3D ComputerSystem->ComputerSystem; > + > + if (IS_EMPTY_STRING (ComputerSystemCs->UUID)) { > + return FALSE; > + } > + > + Status =3D AsciiStrToGuid (ComputerSystemCs->UUID, &ResourceUuid); if > + (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, fail to get resource UUID: %r\n", > __FUNCTION__, Status)); > + return FALSE; > + } > + > + Status =3D NetLibGetSystemGuid (&SystemUuid); if (EFI_ERROR (Status)) > + { > + DEBUG ((DEBUG_ERROR, "%a, fail to get system UUID from SMBIOS: > %r\n", __FUNCTION__, Status)); > + return FALSE; > + } > + > + DEBUG ((REDFISH_DEBUG_TRACE, "%a, Identify: System: %g Resource: > + %g\n", __FUNCTION__, &SystemUuid, &ResourceUuid)); if (CompareGuid > (&ResourceUuid, &SystemUuid)) { > + Status =3D EFI_SUCCESS; > + } else { > + Status =3D EFI_UNSUPPORTED; > + } > + > + mJsonStructProtocol->DestoryStructure ( > + mJsonStructProtocol, > + (EFI_REST_JSON_STRUCTURE_HEADER *)ComputerSyste= m > + ); > + > + return (Status =3D=3D EFI_SUCCESS ? TRUE : FALSE); } > + > +/** > + Callback function when gEfiRestJsonStructureProtocolGuid is installed. > + > + @param[in] Event Event whose notification function is being invoked= . > + @param[in] Context Pointer to the notification function's context. > +**/ > +VOID > +EFIAPI > +RestJasonStructureProtocolIsReady ( > + IN EFI_EVENT Event, > + IN VOID *Context > + ) > +{ > + EFI_STATUS Status; > + > + if (mJsonStructProtocol !=3D NULL) { > + return; > + } > + > + Status =3D gBS->LocateProtocol ( > + &gEfiRestJsonStructureProtocolGuid, > + NULL, > + (VOID **)&mJsonStructProtocol > + ); > + if (EFI_ERROR (Status)) { > + DEBUG ((DEBUG_ERROR, "%a, failed to locate > + gEfiRestJsonStructureProtocolGuid: %r\n", __FUNCTION__, Status)); } > + > + gBS->CloseEvent (Event); > +} > + > +/** > + > + Install JSON protocol notification > + > + @param[in] ImageHandle The image handle. > + @param[in] SystemTable The system table. > + > + @retval EFI_SUCEESS Install Boot manager menu success. > + @retval Other Return error status. > + > +**/ > +EFI_STATUS > +EFIAPI > +RedfishResourceIdentifyComuterSystemConstructor ( > + IN EFI_HANDLE ImageHandle, > + IN EFI_SYSTEM_TABLE *SystemTable > + ) > +{ > + VOID *Registration; > + > + EfiCreateProtocolNotifyEvent ( > + &gEfiRestJsonStructureProtocolGuid, > + TPL_CALLBACK, > + RestJasonStructureProtocolIsReady, > + NULL, > + &Registration > + ); > + > + return EFI_SUCCESS; > +} > diff --git > a/RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResource > IdentifyLibNull.c > b/RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishResourc > eIdentifyLibNull.c > new file mode 100644 > index 00000000..42ee1a15 > --- /dev/null > +++ b/RedfishClientPkg/Library/RedfishResourceIdentifyLibNull/RedfishRes > +++ ourceIdentifyLibNull.c > @@ -0,0 +1,37 @@ > +/** @file > + Redfish resource identify NULL library implementation > + > + (C) Copyright 2022 Hewlett Packard Enterprise Development LP
> + > + SPDX-License-Identifier: BSD-2-Clause-Patent > + > +**/ > + > +#include > +#include > +#include > +#include > +#include > + > +/** > + Identify resource from given URI and context in JSON format > + > + @param[in] Uri URI of given Redfish resource > + @param[in] Json Context in JSON format of give Redfish resource > + > + @retval TRUE This is the Redfish resource that we have to handl= e. > + @retval FALSE We don't handle this Redfish resource. > + > +**/ > +BOOLEAN > +RedfishIdentifyResource ( > + IN EFI_STRING Uri, > + IN CHAR8 *Json > + ) > +{ > + if (!IS_EMPTY_STRING (Uri)) { > + DEBUG ((DEBUG_VERBOSE, "%a, accept resource: %s\n", __FUNCTION__, > +Uri)); > + } > + > + return TRUE; > +} > -- > 2.17.1