Skip to content

Commit

Permalink
Remove separate member for accessing fabric index
Browse files Browse the repository at this point in the history
  • Loading branch information
andy31415 committed Oct 9, 2024
1 parent fcdb555 commit 38e3bdb
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 4 deletions.
2 changes: 0 additions & 2 deletions src/app/CommandHandlerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -395,7 +395,6 @@ Status CommandHandlerImpl::ProcessCommandDataIB(CommandDataIB::Parser & aCommand

request.path = concretePath;
request.subjectDescriptor = GetSubjectDescriptor();
request.accessingFabricIndex = GetAccessingFabricIndex();
request.invokeFlags.Set(DataModel::InvokeFlags::kTimed, IsTimedInvoke());

Status preCheckStatus = mpCallback->ValidateCommandCanBeDispatched(request);
Expand Down Expand Up @@ -518,7 +517,6 @@ Status CommandHandlerImpl::ProcessGroupCommandDataIB(CommandDataIB::Parser & aCo

request.path = concretePath;
request.subjectDescriptor = GetSubjectDescriptor();
request.accessingFabricIndex = GetAccessingFabricIndex();
request.invokeFlags.Set(DataModel::InvokeFlags::kTimed, IsTimedInvoke());

Status preCheckStatus = mpCallback->ValidateCommandCanBeDispatched(request);
Expand Down
2 changes: 1 addition & 1 deletion src/app/InteractionModelEngine.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1763,7 +1763,7 @@ Protocols::InteractionModel::Status InteractionModelEngine::CheckCommandFlags(co

// Fabric-scoped commands are not allowed before a specific accessing fabric is available.
// This is mostly just during a PASE session before AddNOC.
if (aRequest.accessingFabricIndex == kUndefinedFabricIndex)
if (aRequest.GetAccessingFabricIndex() == kUndefinedFabricIndex)
{
return Status::UnsupportedAccess;
}
Expand Down
9 changes: 8 additions & 1 deletion src/app/data-model-provider/OperationTypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,14 @@ struct OperationRequest
///
/// NOTE: once kInternal flag is removed, this will become non-optional
std::optional<chip::Access::SubjectDescriptor> subjectDescriptor;

/// Accessing fabric index is the subjectDescriptor fabric index (if any).
/// This is a readability convenience function.
///
/// Returns kUndefinedFabricIndex if no subject descriptor is available
FabricIndex GetAccessingFabricIndex() const {
return subjectDescriptor.has_value() ? subjectDescriptor->fabricIndex : kUndefinedFabricIndex;
}
};

enum class ReadFlags : uint32_t
Expand Down Expand Up @@ -100,7 +108,6 @@ struct InvokeRequest : OperationRequest
{
ConcreteCommandPath path;
BitFlags<InvokeFlags> invokeFlags;
FabricIndex accessingFabricIndex = kUndefinedFabricIndex;
};

} // namespace DataModel
Expand Down

0 comments on commit 38e3bdb

Please sign in to comment.