From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mx0a-002e3701.pphosted.com (mx0a-002e3701.pphosted.com [148.163.147.86]) by mx.groups.io with SMTP id smtpd.web10.11393.1635340315332313836 for ; Wed, 27 Oct 2021 06:12:07 -0700 Authentication-Results: mx.groups.io; dkim=pass header.i=@hpe.com header.s=pps0720 header.b=Ekc7vvkj; spf=temperror, err=temporary DNS error (domain: hpe.com, ip: 148.163.147.86, mailfrom: prvs=09340156cb=abner.chang@hpe.com) Received: from pps.filterd (m0134420.ppops.net [127.0.0.1]) by mx0b-002e3701.pphosted.com (8.16.1.2/8.16.1.2) with SMTP id 19R9dIh6003789; Wed, 27 Oct 2021 13:11:37 GMT DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hpe.com; h=from : to : cc : subject : date : message-id : references : in-reply-to : content-type : content-transfer-encoding : mime-version; s=pps0720; bh=tz0wYhquxKiFr72y6CjWKg07UdMM7f1B5IX3Y9kDuRg=; b=Ekc7vvkjsRkJY+B27bxbcdkl+2I7PRFA3/oJbacH6H2ekLLib5cz05Kl9siOXN1oxWSs UUqfe6Ps7KyfiPgQnkkn4V45vmFQqlgwfpuXP3ECI95nEb7bUGn+7OJ+Y5432CvWE5O6 j953QZfQ7m8mWsDQwyrAuDr/TlNA+P+/qXq/P2Xk7aYNh0HzZunJpouIJfBY04FDCoSM xtMcrUVhpupSm24QCNmc/3jgG0/ZoUCdo35kvtA1CAlhtPFB5kUsXyDyKhYXvBEsESc7 KwRh++iFmNQxlrAWB4nNkTgUic2RDFmFO+Z1zxQpxDrM6a5o2De2erbVeLbCg/4Y6MCX YA== Received: from g2t2354.austin.hpe.com (g2t2354.austin.hpe.com [15.233.44.27]) by mx0b-002e3701.pphosted.com with ESMTP id 3by4aysmyf-1 (version=TLSv1.2 cipher=ECDHE-RSA-AES256-GCM-SHA384 bits=256 verify=NOT); Wed, 27 Oct 2021 13:11:37 +0000 Received: from G9W9209.americas.hpqcorp.net (g9w9209.houston.hpecorp.net [16.220.66.156]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-SHA384 (256/256 bits)) (No client certificate requested) by g2t2354.austin.hpe.com (Postfix) with ESMTPS id 624CA134; Wed, 27 Oct 2021 13:11:36 +0000 (UTC) Received: from G1W8106.americas.hpqcorp.net (16.193.72.61) by G9W9209.americas.hpqcorp.net (16.220.66.156) with Microsoft SMTP Server (TLS) id 15.0.1497.23; Wed, 27 Oct 2021 13:11:35 +0000 Received: from NAM04-DM6-obe.outbound.protection.outlook.com (15.241.52.13) by G1W8106.americas.hpqcorp.net (16.193.72.61) with Microsoft SMTP Server (TLS) id 15.0.1497.23 via Frontend Transport; Wed, 27 Oct 2021 13:11:35 +0000 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=jh4qDcSO11/2MjCf8SfLa2mBB+leRE4EeKyG0sep3PmTpghgelSWph8IUE0NrKDKFWPyIiPq0CXN4Q8K913U5teJour39zegz77JsePUYtyq8F/QyBzxlyPryPmfhfV6zv/X42/hRseSShi4r0ObXgXpbOeTcutUwdNJUTvj2QqWiUsyWlinhWDE5TAOLlKDP/2fdKAKERpF70Qje3na5a4qkRbHO4bj0c32V8EzVs+qK0ai7Wd/gbMGwgYCi13qpZREgFSDjr2wKSg8YVCZy2zMmtp7skjinUj10/wdfwk8ildCL9URimD4gOX0r+GE9B0MY9qjXOP3r6F9yxGsoA== 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=dGBdRZuzURAkXyfGFhrW/zkcOxsuoWDPn0N1DsDpA/w=; b=eE0qnWlJliit1le/aI+N2wmqLUvmPNDHmnshHX4Y3XvRsSEgB/zPNpnXvmrqAyRxVl13YnscAupy9PkHa8xCdKm7IY9dr0JtRaz4K8Hny7CB5Mu+KqOUU9lIZ9A+XL5P08+AOXy24MFD4qb3VT84Ky91RxtUPIEs/CEf5RwBwc9kvu6kjcqpsZLxTCQTSSQa+mNCqBN+eBkj+0OsTZhHICeh2HlFf1Zoq5OKotg0zuaZPFW5LfOAvCP2kL5oS5EHyuG2mN8Hv96JtMXE6p/cZmxDIzexsZZmOuWssILLHNGQ8EDujxYL1urVVmP4H2bjRVZ6lt2gl26zCr56E/Gy4Q== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=pass smtp.mailfrom=hpe.com; dmarc=pass action=none header.from=hpe.com; dkim=pass header.d=hpe.com; arc=none Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:7508::16) by CS1PR8401MB1238.NAMPRD84.PROD.OUTLOOK.COM (2a01:111:e400:750a::18) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4649.14; Wed, 27 Oct 2021 13:11:34 +0000 Received: from CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::b88a:7fe7:6294:683f]) by CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM ([fe80::b88a:7fe7:6294:683f%9]) with mapi id 15.20.4628.020; Wed, 27 Oct 2021 13:11:34 +0000 From: "Abner Chang" To: "devel@edk2.groups.io" , "Chang, Abner (HPS SW/FW Technologist)" CC: "Wang, Nickle (HPS SW)" , Liming Gao Subject: Re: [edk2-devel] [PATCH] edk2-staging/RedfishClientPkg: Add RedfishLib.h Thread-Topic: [edk2-devel] [PATCH] edk2-staging/RedfishClientPkg: Add RedfishLib.h Thread-Index: AQHXyx8uO3sfPKEMl0m8to07r6exV6vm0gcA Date: Wed, 27 Oct 2021 13:11:34 +0000 Message-ID: References: <16B1DD1FCF06B07C.31256@groups.io> In-Reply-To: <16B1DD1FCF06B07C.31256@groups.io> Accept-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: authentication-results: edk2.groups.io; dkim=none (message not signed) header.d=none;edk2.groups.io; dmarc=none action=none header.from=hpe.com; x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: 1dae7b6e-34b2-4369-a569-08d9994b4d03 x-ms-traffictypediagnostic: CS1PR8401MB1238: x-microsoft-antispam-prvs: x-ms-oob-tlc-oobclassifiers: OLM:151; x-ms-exchange-senderadcheck: 1 x-ms-exchange-antispam-relay: 0 x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: OMgB2gybwJX5ZrXW9EfsxLv+giecc40gd1tw7hwVf6YIDs89RE3JOoU4YO2M1DEoXJI3JzD4kYrJ1v7Ll5QUiq3FvYipiXuWKt2HQi5pptr9cRTG8Qfg49ApUC2RXMq3ZTy7BtH3XQj0sIUW8k5vXKFT/yRYBdawu1O4mk/EF0DDxBxUjdyL6oFOx3dbSZoziOeGJMrb0MWiMCEVAioqt3DUPNxroOG0ZI9To3Hevzh7/kEvAekkB6VqUfgvoEo8qOwG9T/hseTRex5hL/nvKJw+P547OobU4SfRHvVIDGoHRDiwOraJm3V2NMsN2RmlUhV0UAdXnfDt79/OxQivB36JvpIpzYcEb3nloR++WgXYSN4V5y+upOj1OaUjChzgkrbrjC/aa4srsX+xi55ZmTjSFTeAruN7Nvi6FRDxRwlI73cXBL+6ajyCsNxKoqmx2q/0lsJqXCN+y+aPk9yZ/bpVcQVqT9HrmjcLHXWl5uKsDWSWwpRyHsnO8VBL7CiGsOMwxuv0O938t6LDKwot0Lk7Yqg/DzG3nYGVmKXhNbwXyBPVlMRE0MAEoOa0VaMaWhJO0dUFU95maR57oSYySY6bHqoYbN7Ij0pXGSZd7U5ph/+RsCb7pcGBI34NrCtuwIfiq8Y7lSYiV8E+maHpELGv8k5Dr+e8zvQDs0lN8wz7obh+y6H6lpEUc3D++xkHaIlSrrhSUVRzDYft0jTQCGZqks6+FMXbNSQNpHMvE8yMGR5h7MImBhBA25WGp342WgPbfEllHS02GdOF0bYN59uJCrSWPlLiISq5m/s58LLo+rrsQJDCI+TuGZXbPd+YN5gFyThuqOMF2XkYIHqR54SdAKmoAlgaSfOX7opqc8I= x-forefront-antispam-report: CIP:255.255.255.255;CTRY:;LANG:en;SCL:1;SRV:;IPV:NLI;SFV:NSPM;H:CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM;PTR:;CAT:NONE;SFS:(366004)(7696005)(316002)(186003)(110136005)(5660300002)(54906003)(52536014)(33656002)(26005)(2906002)(86362001)(82960400001)(53546011)(71200400001)(30864003)(4326008)(8936002)(76116006)(64756008)(66946007)(122000001)(83380400001)(6506007)(9686003)(8676002)(966005)(38100700002)(66476007)(38070700005)(66556008)(508600001)(55016002)(66446008)(21314003)(559001)(579004);DIR:OUT;SFP:1102; x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: =?us-ascii?Q?11WLSUMswDXgbEnHxTTIRvtPHZsqy9jiib0kpE0/oxCbymgq3kDHL+6xetqq?= =?us-ascii?Q?EMTGtWIL9M0n874lDIsVRu9rUlRfpMID0z0fvyfIYzOZSiQQdxeSS7p859a9?= =?us-ascii?Q?1dumOc1r9JbjaGs6sC60lo1IWzRCke3Bzinndlzpn8bA9pLr4vHbbdZuqDcg?= =?us-ascii?Q?3zqsAnQRveVud8sigewaBzSPrPGRePVUwU5aiLh/Ewd1ql5nihntSO/Hww1B?= =?us-ascii?Q?Ms58qeHqQYn8b0DuUDIPCNSyTyvv7W9S09bT5A+a1ajn2LLst+DWBw38bMfE?= =?us-ascii?Q?lycJtlUF2au1DPzvquFFo2Qk1uoGmgj1HqhV6+ETbeWkH29GBcKV5ZrftukF?= =?us-ascii?Q?53juLZ8jQ0zAB6zjYj7ldzm80VGe76iB8cEz6Byx5AhefwOKJCAf3pvurijs?= =?us-ascii?Q?IzWk9q1AGI0BFrAuTE3NRzVaWTU9c9YLs38/A93TB33AcFd7ss9cQdKKyD7G?= =?us-ascii?Q?el+632+rnf+IBy9JtjWuLhSyNa+gtXLDfXsIlpjn4DMtrKAig1WLKBkbLujp?= =?us-ascii?Q?2Eww3ty38yHQ7ZNc9ZEFKBVrLaWnzyh4clVnlhhZcfPaWf4B4DYy78xSSbpK?= =?us-ascii?Q?JJSMJnJ9UlStnk5vdQvNqcW51sylKjmhBTbOwrOh25yVMAdwr5TJ03uKi4i9?= =?us-ascii?Q?qlJvrRCKCUGF8zK+V3FxL0hv0FvFwHLE9M6Ugry5M6pER9LVIX+Rpz/KNQ3r?= =?us-ascii?Q?irGBo+wYtxxMAwC42LWSyulC/MQ9HV9MUbm0Alv+h2tjug4zrYiPijhlIsW1?= =?us-ascii?Q?DluXBoNA6UxLaHI13B9NWNEOFb+t2GSgaILG/Vy660RJRfVr9GtKpYRoPK7y?= =?us-ascii?Q?wFkBEhaDIJOJANzm2vyFrV4u9GplpzLNZec41CWc2wqGuArKkhiO9TVc+buQ?= =?us-ascii?Q?+xon5vMl4BKQrI3VFznM0Gzbj+S3IPS7s7iro9DpPwFM5D72/oVfTC/H/9t9?= =?us-ascii?Q?iO/MwBH8HPbzPU06CwnAMqULzlMhDitvrJMI0GS+E0MM0VGYeiHcSJ1p42RB?= =?us-ascii?Q?iw2R4Dv3Tf6d4523DW/bTAOeHcgqK6YHN6vq4NctLjlSalpaPt9HnmWHPHxr?= =?us-ascii?Q?YOjZ5FL6GEeQHSvWCVvs8+1/doZENnd5hzmM7uy/xERPHlezPRv0lJM1UJXb?= =?us-ascii?Q?z1E1HJq6N/XXEMZ+RLW2SObWexXFgxXdI6AremM47pq+Z9n1ivZEaEqPL75h?= =?us-ascii?Q?jjt3mXz1iM1vSWcrxUHQwg+WcL1v9z/BIs2sxmmbUxGY/niwTUhA8YPWUOS5?= =?us-ascii?Q?Wsfr/3/EmjDwEVjmeTcm94cpNq97q349QRDLWzUl82EEOkkesQMnowFcRt+V?= =?us-ascii?Q?6jGnNgSucQVft77y4TE1y//KvTnmjo67fgvPWuHvtBWzgqd26sbMdPyD/tm7?= =?us-ascii?Q?qnMbR3RlfAxcqz/8EqzrhbErFs6H6kwH9OF9CDoe6gn7PRWVUMX6zwqGG+UK?= =?us-ascii?Q?UBAW1yWODrviKUp6yiz4skg/09W8Kg1H/xysWo5Hp+KvE0yVp78JTje3NW8o?= =?us-ascii?Q?eoB42eL6ku4M3sU1wWyo7BlyJnjyXxuiQxQR5mT9pRvHUILsB6hFa+baaqr+?= =?us-ascii?Q?4vm1Ogzo2mfyn1jUDx8yQYf2FSRfQwyKnoXO4AThQbeHGHn+3Dk6MtQNp3vg?= =?us-ascii?Q?o5+VvOlhpg1NWVLRU5I1XY8=3D?= X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: CS1PR8401MB1144.NAMPRD84.PROD.OUTLOOK.COM X-MS-Exchange-CrossTenant-Network-Message-Id: 1dae7b6e-34b2-4369-a569-08d9994b4d03 X-MS-Exchange-CrossTenant-originalarrivaltime: 27 Oct 2021 13:11:34.1867 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 105b2061-b669-4b31-92ac-24d304d195dc X-MS-Exchange-CrossTenant-mailboxtype: HOSTED X-MS-Exchange-CrossTenant-userprincipalname: I3O+lhgEzb62Xr0Teb2PlzlV9NS3RX8jfk8/lIEe+cjZeN6FNS3KpfCIPh0RtA11+yY3sRZYgnae82cTleQ2bw== X-MS-Exchange-Transport-CrossTenantHeadersStamped: CS1PR8401MB1238 X-OriginatorOrg: hpe.com X-Proofpoint-GUID: nogs_q8gV8M5tKcWvxctntxot9lvg_wJ X-Proofpoint-ORIG-GUID: nogs_q8gV8M5tKcWvxctntxot9lvg_wJ X-Proofpoint-UnRewURL: 2 URL's were un-rewritten MIME-Version: 1.0 X-HPE-SCL: -1 X-Proofpoint-Virus-Version: vendor=baseguard engine=ICAP:2.0.182.1,Aquarius:18.0.790,Hydra:6.0.425,FMLib:17.0.607.475 definitions=2021-10-27_04,2021-10-26_01,2020-04-07_01 X-Proofpoint-Spam-Details: rule=outbound_notspam policy=outbound score=0 impostorscore=0 clxscore=1015 mlxlogscore=999 priorityscore=1501 phishscore=0 mlxscore=0 spamscore=0 bulkscore=0 lowpriorityscore=0 malwarescore=0 adultscore=0 suspectscore=0 classifier=spam adjust=0 reason=mlx scancount=1 engine=8.12.0-2110150000 definitions=main-2110270080 Content-Language: en-US Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: quoted-printable This patch set is sent in behalf of Nickle Wang. Reviewed-by: Abner Chang > -----Original Message----- > From: devel@edk2.groups.io [mailto:devel@edk2.groups.io] On Behalf Of > Abner Chang > Sent: Wednesday, October 27, 2021 6:36 PM > To: devel@edk2.groups.io > Cc: Wang, Nickle (HPS SW) ; Liming Gao > > Subject: [edk2-devel] [PATCH] edk2-staging/RedfishClientPkg: Add > RedfishLib.h >=20 > RedfishLib.h is the header file of RedfishLib > library under RedfishClientPkg. RedfishLib is > used by EDKII Redfish feature drivers. >=20 > Signed-off-by: Nickle Wang > Cc: Abner Chang > Cc: Liming Gao > --- > .../PrivateInclude/Library/RedfishLib.h | 611 ++++++++++++++++++ > 1 file changed, 611 insertions(+) > create mode 100644 RedfishClientPkg/PrivateInclude/Library/RedfishLib.h >=20 > diff --git a/RedfishClientPkg/PrivateInclude/Library/RedfishLib.h > b/RedfishClientPkg/PrivateInclude/Library/RedfishLib.h > new file mode 100644 > index 00000000000..c3069f0dd4c > --- /dev/null > +++ b/RedfishClientPkg/PrivateInclude/Library/RedfishLib.h > @@ -0,0 +1,611 @@ > +/** @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://github.com/DMTF/libredfish). > + > + The query language is based on XPath > (INVALID URI REMOVED > 19991116/__;!!NpxR!2mDPVN- > RDtCPdiXsE0BvDRU0GQ4qJuuc6ig9m5JxlhHlVCShQEYtiFDG1cHvcwI$ ). > + 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 > -- > 2.21.0.windows.1 >=20 >=20 >=20 >=20 >=20