From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from NAM11-DM6-obe.outbound.protection.outlook.com (NAM11-DM6-obe.outbound.protection.outlook.com [40.107.223.68]) by mx.groups.io with SMTP id smtpd.web09.25137.1660707611571826628 for ; Tue, 16 Aug 2022 20:40:12 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@amd.com header.s=selector1 header.b=4PYfNXk5; 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.223.68, mailfrom: abner.chang@amd.com) ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=ZcWPmTlMJkUTLHhD/t5vIz7vqVdMhPN+oPGpTcj4ds69sRuoWsVYxdVCTPZ2TS9S6ipgsNBRMsoWP8ebvr7HO2LghbjnBmRFkK2q3J5zKdQQCL8o9kIaJsvOarTqlJvSssMzNeXyR1ZxRBBSkGkZwhvdLdVRRyb6/umpAojLWyFanIgIMrEHUy3edcW7cI0BwoMWDpHFbqQqPZLpQP0Mw4DOwN6avMHlybgdMNfH3F5TaB8KcJ0zLT5E0jfyFWgBeY/8843WBe7njPe/Ro2sZrg7J174BlJ9lGoJxj/KKfQ9aXGZhSYVjkE9frDeBdgB0JLssVLOPyF5gcQwtyjjiw== 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=XYQt03fvofnM2iq5HZ4QT7CNKiPabPDbwofujDwtRx4=; b=VbSrh5IXMdPMYzMGdZTMGZ9s5oWCSC2/sdTqQESyVcY51oWxLgk8POJyCQ77Gm2Acxo+OST0siGy2cyNoLnI5fd8tAnlKoqb79GUgQCgPhRWJIFG7jik+Eiek0lTUFxfH1WC2t3qR5/m4VXgT74YFKX8fG6LflhoC56vqZ39UFwhpmLQ3x847D3/GfGlSu56t+ob/j9nh1o3clM1V+WG+vKnh09s2RVH+yNkho2bgkIsKyhpSaeQJEXx9hgSjO0ZdZBH+qLNXa3VHZAZ+TCQpaqOGDLi7gvU0raz9vQ/+eM4+RYNl7MUJJlFvJr8/2zjOpe+0PYtysnZxqP5G5Gjzg== 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=XYQt03fvofnM2iq5HZ4QT7CNKiPabPDbwofujDwtRx4=; b=4PYfNXk5+0GwtNiKT4tJ95vXJYuUDU2qug/qBAtY0I+OK6MSA9awC7KXgLFH+WWWCtfgT9ImI3EnqdCe/+IsC5pUtTTdOTFojaTNwZXqRPc10uga8YfL+zxQC5++VdcOqRTcuL/re5FMOkwOoxTK8Po+83001EYdBN7puvFOdNQ= Received: from MN2PR12MB3966.namprd12.prod.outlook.com (2603:10b6:208:165::18) by PH8PR12MB6700.namprd12.prod.outlook.com (2603:10b6:510:1cf::13) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.5504.16; Wed, 17 Aug 2022 03:40:08 +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.028; Wed, 17 Aug 2022 03:40:08 +0000 From: "Chang, Abner" To: Igor Kulchytskyy , "devel@edk2.groups.io" CC: "nickle.wang@hpe.com" Subject: Re: [PATCH 2/3] RedfishPkg: Redfish modules may need to use the functions which are private Thread-Topic: [PATCH 2/3] RedfishPkg: Redfish modules may need to use the functions which are private Thread-Index: AQHYsQ7waEBKpvVzkE+IlF5o8h/frK2yc22w Date: Wed, 17 Aug 2022 03:40:07 +0000 Message-ID: References: <1660613065-1572-1-git-send-email-igork@ami.com> In-Reply-To: <1660613065-1572-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-17T03:38:28Z; 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=a522788f-f15a-40ec-a668-d7029e93a654; 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: 073a29e4-7a11-4f4a-aceb-08da80022e39 x-ms-traffictypediagnostic: PH8PR12MB6700:EE_ x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: f/cHTykHbCF2HWtzdXHtSYUg5k+8xLysR1sGybajOwVFz3NWB263YF3QcShd2OjihsXym2qpNQc+2xfy5nbvCbgOgf6PaKy/h/CpjjAhkmC8AOZTIwrePnEcHVv/qv6EUrQkeZGL6A1ZkQyCD5lipy5YC5pTSNdcG7ax4LIac/PjCbAQrZZWKoh4HWDNPz1b0uREMtDJ3qkOcRl747iw1y5IPXyYNWDJ0A8Lhc95A7zQooS3riPJRYU0/P1TnR2W3v3dfZvP8bGi6kd3qFb6hsTKheyQ8zjwVz2sCly237yKd/0XLhclc5c6/v405kwAAT8/KCAScqyNELdhdtkOeb6H16c+8kQJhGnQAz7m7+qbjNvb5uVnJlm16wloQ1DxQ4j6cdOoAumm9nx29mqUn0yFj232zLsNhgjh38YSYnS+kXmMDzdnDCiYYyJHxLdM6eQwEcUTbblImWax/GjSQ1S//oq9ptm7Vejc9SIc+7Rb3smzN+L6/7qutobu75Gz1N1DTnp7Wqm9QuhWN+ys4iEkRJWQs3iv1n+BBBvALnptwA0rY7/iaDYNz1E4SOrqP0rHF0MfuLXIeQtXezgwyzeqTSI1uCclfBMMllyfqBErYNj2+rPt1b5RU2J41I3GhDV9flsyZw1krBph7uo96Iy9BTTxl8LfQ32Legxj+tBo+7YxQmyQmuXh1Ky1HLH26yA4TrCom3hvm3pEOU4/62mVNlpLElKYA6s0mkfZwQZ59C5d2ya7pQURg3FL+4zXDfX7JTte0ApYWYiuWRv/jvn18wpMLjQBXZ7RAZAYnqs5X49GfwwL8PzROeGyN6W/pQYLZiaVYs3oCes+ND5Ssab+LUSZumof1jq/OJXJEYtmJSFtTwacV+gSSt1bMgf78vwy7ChXjedf7uSFfn/EVg== 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)(396003)(376002)(346002)(39860400002)(136003)(366004)(30864003)(2906002)(5660300002)(55016003)(38100700002)(38070700005)(86362001)(122000001)(41300700001)(40140700001)(53546011)(6506007)(52536014)(7696005)(186003)(71200400001)(478600001)(9686003)(26005)(33656002)(83380400001)(316002)(64756008)(110136005)(4326008)(76116006)(8676002)(66946007)(66446008)(45080400002)(8936002)(66556008)(66476007)(21314003)(559001)(579004);DIR:OUT;SFP:1101; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?78ZKPx4wvegaYeI1dZWNpJcbjmu+5BJQev8/bJhXNWlJB8Xe6tghKek80svm?= =?us-ascii?Q?TQtPKxaWuP9Pz2IxlB+q34O7Iq1GhUV8JPkYQj14MuFwhY+MMiUHr7XtUhCE?= =?us-ascii?Q?5q8ZzEUHI58gyQEFW4xWwm71FR5Kg11qmLgrPl/UneKCeYexY+XW7f0N4UB7?= =?us-ascii?Q?WdEMr6u8YSSY9FaBjtI4GulQUzOOvFHLQsgJkEOpJc1ZVbjWnoT5ZJBFlu+h?= =?us-ascii?Q?pjAqTymnW6myex44136eo6B0pUAI/M1cUKx2S1S5KPEBS45E0/lTpiQ52uuf?= =?us-ascii?Q?OAGbTnt8icAiTY2IDv/yzu6b8tDeH5gnRIcla0G6+m4AcHScqsIquTBAkxAd?= =?us-ascii?Q?uSM/spLY4U9om2oX3GjMPAfJMKvQRGRDsZbwSNr6b/g0O/sdBU3KedTdhD/n?= =?us-ascii?Q?KFduQRQSPXOP6OQ46Y0Ivd4rw15UXonn/zQmnffH+x4pwYda9Imy/+dj66Zc?= =?us-ascii?Q?dNP3k8Gi56eZLWG/8p3dyDnL/adlY81n51TNk+W7MlkZOzYoWa0gPBaMbRTS?= =?us-ascii?Q?FUmz4EB9sia6qCdoPECArqCGQsCZtYPC48MQmoyycddNDO3xlOo+x0B9omsn?= =?us-ascii?Q?3ys2yU5N2lI4Bv+2NBAUJQPEgF99tjP/aBAcE+1jxdfuHsm/uW1UgR7wFfec?= =?us-ascii?Q?Z6TBR7kvivJlOrvYwa3Doz+Q1jPgVg/sNEfuboh87Z0yPhJNAFy6qf1Enoaa?= =?us-ascii?Q?yFO1OAEehPJqwMPxM21pdZdcwJu1k6pyB7LnHA0fShz6qiOcktXczBdeGryO?= =?us-ascii?Q?eLyg9GbIp14X7qvuwJUWJrzBCzZpoYSDDoZp46zexhk7AuMtC+vuqR2Z6Q7Q?= =?us-ascii?Q?B7RV8Og73FJiBDwJRLo84N4BhH2VcAdz5lC93hRzrw+++ldt0kByyad1lMdx?= =?us-ascii?Q?jEP+GJPzUDj2LA4xBFbl1MvhkTtrTE8ifwCSoLbOmHpfX6tWL4h2qpcD797w?= =?us-ascii?Q?hN7CZTlPBJ8Pn4r1LoZXeJHMgck2tYCF/saKFwNWogAT9YwBSKPduYNEqZ3F?= =?us-ascii?Q?Q3ci8UgYdHNdZcPcOZct27lfU+ETCKVC1/uyYKRKSG9D9tDjr1no0Wt/cQ5d?= =?us-ascii?Q?fSQahfgJpgCdeX597WuJiAhYpe7884TYawDd9nwZV/rkJG+GYxw5uXTawcQp?= =?us-ascii?Q?AMebIF5D+2aaEALT1E4Rc5cOjNVkMSCoh0vaupHlKwJtdd2fzWsI2ZXC+xZy?= =?us-ascii?Q?g0WqD92lNM09OGdC9gkPUGENxgDUr5RTlVRQdyhdDItdMfaSRHEgL8Fn4/LH?= =?us-ascii?Q?2z4qFBVNFDWFQih7hM7axze7aFmIWkg/8ExPYcF72LXOX+7N7M9QpjpNR3EU?= =?us-ascii?Q?OKpzvYCaxDp7XbMGH52aNX5r1ezJqFfVpQ0DvEYuURXEGsbzRP3VPHlcGcud?= =?us-ascii?Q?BfkO64C2fgu5hm+gRqALBZtySqvr1jk4ZOMsNrehCCePfMF+XoRfnBTKO9DU?= =?us-ascii?Q?THlPUh1wkgbD5piRjkBPoc/1/XOZrVQ7ewQfvyYAsjxuCBrEtaIfyqrOaKgi?= =?us-ascii?Q?x3zNQfllKtqU0rIi7U2KhYJ38IJYMnKCleSRD9jlFriUdEFMaDnWJoyX7YMX?= =?us-ascii?Q?0yaGwdMQQf6p704tQoHt0AUA5QYD0l936Cve1yql?= 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: 073a29e4-7a11-4f4a-aceb-08da80022e39 X-MS-Exchange-CrossTenant-originalarrivaltime: 17 Aug 2022 03:40:07.9543 (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: RKNg3mNQ4kKnv4sL78ljBu5OKXOee+KdmC3TWUSsj+JW07o55qHk5/Nx7NFatMg0WIjWi9/0Op9hCA0TqChEeQ== X-MS-Exchange-Transport-CrossTenantHeadersStamped: PH8PR12MB6700 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: Tuesday, August 16, 2022 9:25 AM > To: devel@edk2.groups.io > Cc: Chang, Abner ; nickle.wang@hpe.com; Igor > Kulchytskyy ; Chang, Abner > Subject: [PATCH 2/3] RedfishPkg: Redfish modules may need to use the > functions which are private >=20 > [CAUTION: External Email] >=20 > Definitions of the required functiuons to send requests to BMC > are in the PrivateInclude folder. > So they cannot be used by the other Redfish 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(-) > create mode 100644 RedfishPkg/Include/Library/RedfishLib.h > delete mode 100644 RedfishPkg/PrivateInclude/Library/RedfishLib.h >=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%40amd.com > %7C27a61a2be1dd4f3cdc2f08da7f261486%7C3dd8961fe4884e608e11a82d994 > e183d%7C0%7C0%7C637962098786418514%7CUnknown%7CTWFpbGZsb3d8ey > JWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C > 3000%7C%7C%7C&sdata=3DvnqFll%2BrBTzNqj3YUkS3pz89m31zRAc7KrPJRAH > VWyU%3D&reserved=3D0). > + > + The query language is based on XPath > (https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fwww. > w3.org%2FTR%2F1999%2FREC-xpath- > 19991116%2F&data=3D05%7C01%7CAbner.Chang%40amd.com%7C27a61a2 > be1dd4f3cdc2f08da7f261486%7C3dd8961fe4884e608e11a82d994e183d%7C0% > 7C0%7C637962098786418514%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL > jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C > %7C&sdata=3DKWLZrCaev5TayOaU4zIcyKi6J0sX6Y1m%2F4uRjKBwvsA%3D&a > mp;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 automa= tically > + 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 resourc= e > 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 P= ayload > 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 RedRespons= e > 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, He= aders > + and Payload which record any HTTP response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and P= ayload > 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 RedRespons= e > 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 Red= Path > string, > + including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and P= ayload > 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 addr= essed 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 P= ayload > 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 P= ayload > 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 NUL= L. > + @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 re= sponse > will returned, > + including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > + > + Callers are responsible for freeing the HTTP StatusCode, Headers and P= ayload > 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 NUL= L. > + @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 P= ayload > 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 Head= ers > 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 m= apping > 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%40amd.com > %7C27a61a2be1dd4f3cdc2f08da7f261486%7C3dd8961fe4884e608e11a82d994 > e183d%7C0%7C0%7C637962098786418514%7CUnknown%7CTWFpbGZsb3d8ey > JWIjoiMC4wLjAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C > 3000%7C%7C%7C&sdata=3DvnqFll%2BrBTzNqj3YUkS3pz89m31zRAc7KrPJRAH > VWyU%3D&reserved=3D0). > - > - The query language is based on XPath > (https://nam11.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fwww. > w3.org%2FTR%2F1999%2FREC-xpath- > 19991116%2F&data=3D05%7C01%7CAbner.Chang%40amd.com%7C27a61a2 > be1dd4f3cdc2f08da7f261486%7C3dd8961fe4884e608e11a82d994e183d%7C0% > 7C0%7C637962098786418514%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wL > jAwMDAiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C3000%7C%7C > %7C&sdata=3DKWLZrCaev5TayOaU4zIcyKi6J0sX6Y1m%2F4uRjKBwvsA%3D&a > mp;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 automa= tically > - 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 resourc= e > 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 P= ayload > 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 RedRespons= e > 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, He= aders > - and Payload which record any HTTP response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and P= ayload > 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 RedRespons= e > 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 Red= Path > string, > - including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and P= ayload > 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 addr= essed 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 P= ayload > 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 P= ayload > 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 NUL= L. > - @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 re= sponse > will returned, > - including HTTP StatusCode, Headers and Payload which record any HTTP > response messages. > - > - Callers are responsible for freeing the HTTP StatusCode, Headers and P= ayload > 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 NUL= L. > - @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 P= ayload > 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 Head= ers > 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 m= apping > 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 propri= etary > to American Megatrends (AMI). This communication is intended to be read o= nly > 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, you are on notice t= hat 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 th= en > delete or destroy all copies of the transmission.