FwpsFlowAssociateContext0 function (fwpsk.h)
The FwpsFlowAssociateContext0 function associates a callout driver-defined context with a data flow.
NTSTATUS FwpsFlowAssociateContext0( [in] UINT64 flowId, [in] UINT16 layerId, [in] UINT32 calloutId, [in] UINT64 flowContext );
A run-time identifier that specifies the data flow with which to associate the context. The run-time identifier for a data flow is provided to a callout driver through the FWPS_METADATA_FIELD_FLOW_HANDLE metadata value that was passed to the callout driver's classifyFn callout function.
The run-time identifier for the filtering layer with which the context is being associated. The context will be associated only with the specified filtering layer. For more information, see Run-time Filtering Layer Identifiers.
The run-time identifier for the callout in the filter engine. This identifier was returned when the callout driver called the FwpsCalloutRegister0, FwpsCalloutRegister1, or FwpsCalloutRegister2 function to register the callout with the filter engine.
The callout driver-defined context to be associated with the data flow. This parameter must not be zero. This context is opaque to the filter engine.
The FwpsFlowAssociateContext0 function returns one of the following NTSTATUS codes.
||The context was successfully associated with the data flow.|
||Either the flowContext parameter is NULL or the callout specified by the calloutID parameter does not have a flowDeleteFn registered.|
||A context is already associated with the data flow. In this case, a callout driver should first call the FwpsFlowRemoveContext0 function to remove the existing context and then call the FwpsFlowAssociateContext0 function again to associate the new context with the data flow.|
||An error occurred.|
When filtering a data flow, a callout driver can call the FwpsFlowAssociateContext0 function to associate a context with the data flow. It can then use this context to preserve any driver-specific data or state information between calls by the filter engine to a callout's classifyFn callout function for that data flow.
There must be a callout in the filter engine at the layer identified by the layerId parameter that has registered a flowDeleteFn callout function. Otherwise, the call to the FwpsFlowAssociateContext0 function will return STATUS_INVALID_PARAMETER. The filter engine calls that flowDeleteFn callout function when the flow is terminated so that the callout driver can clean up the context associated with the flow.
You can call FwpsFlowAssociateContext0 multiple times for the same flow. In each call, you must specify a different callout and a different context—one context per added callout.
The FwpsFlowAssociateContext0 function associates a single context with a single added callout.
You can associate multiple contexts with a flow. However, each context must be associated with a different callout. The new callout can be at the same layer as the previous one or at a different layer.
|Minimum supported client||Available starting with Windows Vista.|
|Header||fwpsk.h (include Fwpsk.h)|