Skip to content

Commit e1d22c6

Browse files
committed
Put back AccessingFabricIndex
1 parent d24fe15 commit e1d22c6

File tree

9 files changed

+17
-17
lines changed

9 files changed

+17
-17
lines changed

src/app/AttributeValueDecoder.h

+4-5
Original file line numberDiff line numberDiff line change
@@ -46,19 +46,18 @@ class AttributeValueDecoder
4646
mTriedDecode = true;
4747
// The WriteRequest comes with no fabric index, this will happen when receiving a write request on a PASE session before
4848
// AddNOC.
49-
VerifyOrReturnError(GetSubjectDescriptor().fabricIndex != kUndefinedFabricIndex, CHIP_IM_GLOBAL_STATUS(UnsupportedAccess));
49+
VerifyOrReturnError(AccessingFabricIndex() != kUndefinedFabricIndex, CHIP_IM_GLOBAL_STATUS(UnsupportedAccess));
5050
ReturnErrorOnFailure(DataModel::Decode(mReader, aArg));
51-
aArg.SetFabricIndex(GetSubjectDescriptor().fabricIndex);
51+
aArg.SetFabricIndex(AccessingFabricIndex());
5252
return CHIP_NO_ERROR;
5353
}
5454

5555
bool TriedDecode() const { return mTriedDecode; }
5656

57-
/**
58-
* The accessing subject descriptor for this write interaction.
59-
*/
6057
const Access::SubjectDescriptor & GetSubjectDescriptor() const { return mSubjectDescriptor; }
6158

59+
FabricIndex AccessingFabricIndex() const { return GetSubjectDescriptor().fabricIndex; }
60+
6261
private:
6362
TLV::TLVReader & mReader;
6463
bool mTriedDecode = false;

src/app/AttributeValueEncoder.h

+4-3
Original file line numberDiff line numberDiff line change
@@ -53,10 +53,9 @@ class AttributeValueEncoder
5353
// If we are encoding for a fabric filtered attribute read and the fabric index does not match that present in the
5454
// request, skip encoding this list item.
5555
VerifyOrReturnError(!mAttributeValueEncoder.mIsFabricFiltered ||
56-
aArg.GetFabricIndex() == mAttributeValueEncoder.GetSubjectDescriptor().fabricIndex,
56+
aArg.GetFabricIndex() == mAttributeValueEncoder.AccessingFabricIndex(),
5757
CHIP_NO_ERROR);
58-
return mAttributeValueEncoder.EncodeListItem(mAttributeValueEncoder.GetSubjectDescriptor().fabricIndex,
59-
std::forward<T>(aArg));
58+
return mAttributeValueEncoder.EncodeListItem(mAttributeValueEncoder.AccessingFabricIndex(), std::forward<T>(aArg));
6059
}
6160

6261
template <typename T, std::enable_if_t<!DataModel::IsFabricScoped<T>::value, bool> = true>
@@ -150,6 +149,8 @@ class AttributeValueEncoder
150149

151150
const Access::SubjectDescriptor & GetSubjectDescriptor() const { return mSubjectDescriptor; }
152151

152+
FabricIndex AccessingFabricIndex() const { return GetSubjectDescriptor().fabricIndex; }
153+
153154
/**
154155
* AttributeValueEncoder is a short lived object, and the state is persisted by mEncodeState and restored by constructor.
155156
*/

src/app/clusters/access-control-server/access-control-server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ CHIP_ERROR AccessControlAttribute::WriteImpl(const ConcreteDataAttributePath & a
230230

231231
CHIP_ERROR AccessControlAttribute::WriteAcl(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
232232
{
233-
FabricIndex accessingFabricIndex = aDecoder.GetSubjectDescriptor().fabricIndex;
233+
FabricIndex accessingFabricIndex = aDecoder.AccessingFabricIndex();
234234

235235
size_t oldCount;
236236
ReturnErrorOnFailure(GetAccessControl().GetEntryCount(accessingFabricIndex, oldCount));
@@ -293,7 +293,7 @@ CHIP_ERROR AccessControlAttribute::WriteExtension(const ConcreteDataAttributePat
293293
{
294294
auto & storage = Server::GetInstance().GetPersistentStorage();
295295

296-
FabricIndex accessingFabricIndex = aDecoder.GetSubjectDescriptor().fabricIndex;
296+
FabricIndex accessingFabricIndex = aDecoder.AccessingFabricIndex();
297297

298298
uint8_t buffer[kExtensionDataMaxLength] = { 0 };
299299
uint16_t size = static_cast<uint16_t>(sizeof(buffer));

src/app/clusters/bindings/bindings.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -200,7 +200,7 @@ void BindingTableAccess::OnListWriteEnd(const app::ConcreteAttributePath & aPath
200200

201201
CHIP_ERROR BindingTableAccess::WriteBindingTable(const ConcreteDataAttributePath & path, AttributeValueDecoder & decoder)
202202
{
203-
mAccessingFabricIndex = decoder.GetSubjectDescriptor().fabricIndex;
203+
mAccessingFabricIndex = decoder.AccessingFabricIndex();
204204
if (!path.IsListOperation() || path.mListOp == ConcreteDataAttributePath::ListOperation::ReplaceAll)
205205
{
206206
DecodableBindingListType newBindingList;

src/app/clusters/group-key-mgmt-server/group-key-mgmt-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -192,7 +192,7 @@ class GroupKeyManagementAttributeAccess : public AttributeAccessInterface
192192

193193
CHIP_ERROR WriteGroupKeyMap(const ConcreteDataAttributePath & aPath, AttributeValueDecoder & aDecoder)
194194
{
195-
auto fabric_index = aDecoder.GetSubjectDescriptor().fabricIndex;
195+
auto fabric_index = aDecoder.AccessingFabricIndex();
196196
auto provider = GetGroupDataProvider();
197197

198198
if (!aPath.IsListItemOperation())

src/app/clusters/operational-credentials-server/operational-credentials-server.cpp

+2-2
Original file line numberDiff line numberDiff line change
@@ -117,7 +117,7 @@ class OperationalCredentialsAttrAccess : public AttributeAccessInterface
117117

118118
CHIP_ERROR OperationalCredentialsAttrAccess::ReadNOCs(EndpointId endpoint, AttributeValueEncoder & aEncoder)
119119
{
120-
auto accessingFabricIndex = aEncoder.GetSubjectDescriptor().fabricIndex;
120+
auto accessingFabricIndex = aEncoder.AccessingFabricIndex();
121121

122122
return aEncoder.EncodeList([accessingFabricIndex](const auto & encoder) -> CHIP_ERROR {
123123
const auto & fabricTable = Server::GetInstance().GetFabricTable();
@@ -252,7 +252,7 @@ CHIP_ERROR OperationalCredentialsAttrAccess::Read(const ConcreteReadAttributePat
252252
return ReadRootCertificates(aPath.mEndpointId, aEncoder);
253253
}
254254
case Attributes::CurrentFabricIndex::Id: {
255-
return aEncoder.Encode(aEncoder.GetSubjectDescriptor().fabricIndex);
255+
return aEncoder.Encode(aEncoder.AccessingFabricIndex());
256256
}
257257
default:
258258
break;

src/app/clusters/ota-requestor/ota-requestor-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ CHIP_ERROR OtaSoftwareUpdateRequestorAttrAccess::WriteDefaultOtaProviders(const
120120
DataModel::DecodableList<OtaSoftwareUpdateRequestor::Structs::ProviderLocation::DecodableType> list;
121121
ReturnErrorOnFailure(aDecoder.Decode(list));
122122

123-
ReturnErrorOnFailure(requestor->ClearDefaultOtaProviderList(aDecoder.GetSubjectDescriptor().fabricIndex));
123+
ReturnErrorOnFailure(requestor->ClearDefaultOtaProviderList(aDecoder.AccessingFabricIndex()));
124124

125125
auto iter = list.begin();
126126
while (iter.Next())

src/app/clusters/test-cluster-server/test-cluster-server.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -661,7 +661,7 @@ CHIP_ERROR TestAttrAccess::WriteListFabricScopedAttribute(const ConcreteDataAttr
661661
size_t srcIndex = 0, dstIndex = 0;
662662
while (srcIndex < gListFabricScopedAttributeLen)
663663
{
664-
if (gListFabricScopedAttributeValue[srcIndex].fabricIndex != aDecoder.GetSubjectDescriptor().fabricIndex)
664+
if (gListFabricScopedAttributeValue[srcIndex].fabricIndex != aDecoder.AccessingFabricIndex())
665665
{
666666
auto & dstEntry = gListFabricScopedAttributeValue[dstIndex];
667667
auto & srcEntry = gListFabricScopedAttributeValue[srcIndex];

src/app/util/ember-compatibility-functions.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -425,7 +425,7 @@ CHIP_ERROR GlobalAttributeReader::EncodeCommandList(const ConcreteClusterPath &
425425
// Helper function for trying to read an attribute value via an
426426
// AttributeAccessInterface. On failure, the read has failed. On success, the
427427
// aTriedEncode outparam is set to whether the AttributeAccessInterface tried to encode a value.
428-
CHIP_ERROR ReadViaAccessInterface(const SubjectDescriptor &subjectDescriptor, bool aIsFabricFiltered,
428+
CHIP_ERROR ReadViaAccessInterface(const SubjectDescriptor & subjectDescriptor, bool aIsFabricFiltered,
429429
const ConcreteReadAttributePath & aPath, AttributeReportIBs::Builder & aAttributeReports,
430430
AttributeEncodeState * aEncoderState, AttributeAccessInterface * aAccessInterface,
431431
bool * aTriedEncode)

0 commit comments

Comments
 (0)