locked
What's the code meaning? RRS feed

  • Question

  • VOID NTAPI EvtAccept(IN const FWPS_INCOMING_VALUES0 *pFixedValues,
                                IN const FWPS_INCOMING_METADATA_VALUES0 *pMetaValues,
                                IN OUT VOID *pLayerData,
                                IN const FWPS_FILTER0 *pFilter,
                                IN UINT64 flowContext,
                                OUT FWPS_CLASSIFY_OUT0 *pClassifyOut)

    {

     ........

    addressType   = pFixedValues->incomingValue[FWPS_FIELD_ALE_AUTH_RECV_ACCEPT_V4_IP_LOCAL_ADDRESS_TYPE].value.uint8 ;

     ........

     if( (protocol != PROTOCOL_TCP && protocol != PROTOCOL_UDP) ||
      addressType == NlatAnycast   ||
      addressType == NlatInvalid   ||
      (FWPS_IS_METADATA_FIELD_PRESENT(pMetaValues , FWPS_METADATA_FIELD_FLOW_HANDLE)))
     {
      pClassifyOut->actionType = FWP_ACTION_PERMIT ;
      goto done ;
     }
     ........

    }

    just the code:

    FWPS_IS_METADATA_FIELD_PRESENT(pMetaValues , FWPS_METADATA_FIELD_FLOW_HANDLE)

    what does it mean?  thanks

     

    Thursday, July 1, 2010 6:01 AM

Answers

  • FWPS_IS_METADATA_FIELD_PRESENT is a macro that checks to see if the pMetaValues->currentMetadataValues has the flag set for FWPS_METADATA_FIELD_FLOW_HANDLE.  if it is, then one knows that pMetaValues->flowHandle is valid and can be used

    http://msdn.microsoft.com/en-us/library/ff552397(VS.85).aspx

    Hope this helps,


    Dusty Harper [MSFT]
    Microsoft Corporation
    ------------------------------------------------------------
    This posting is provided "AS IS", with NO warranties and confers NO rights
    ------------------------------------------------------------
    Thursday, July 1, 2010 11:25 PM
    Moderator

All replies

  • FWPS_IS_METADATA_FIELD_PRESENT is a macro that checks to see if the pMetaValues->currentMetadataValues has the flag set for FWPS_METADATA_FIELD_FLOW_HANDLE.  if it is, then one knows that pMetaValues->flowHandle is valid and can be used

    http://msdn.microsoft.com/en-us/library/ff552397(VS.85).aspx

    Hope this helps,


    Dusty Harper [MSFT]
    Microsoft Corporation
    ------------------------------------------------------------
    This posting is provided "AS IS", with NO warranties and confers NO rights
    ------------------------------------------------------------
    Thursday, July 1, 2010 11:25 PM
    Moderator
  • that's means if FWPS_IS_METADATA_FIELD_PRESENT return TRUE ,  the pMetaValues->flowHandle is valid ?

    Is it right?

     

    just the same means:

    if( FWPS_IS_METADATA_FIELD_PRESENT(FWPS_METADATA_FIELD_FLOW_HANDLE) )

    {

    }

    and

    if( pMetaValues->currentMetadataValues &FWPS_METADATA_FIELD_FLOW_HANDLE )

    {

    }

    Wednesday, July 7, 2010 7:04 AM
  • yes this is the same.  for clarity, one should  use the macro.
    Dusty Harper [MSFT]
    Microsoft Corporation
    ------------------------------------------------------------
    This posting is provided "AS IS", with NO warranties and confers NO rights
    ------------------------------------------------------------
    Friday, July 9, 2010 3:11 AM
    Moderator
  • thank you
    Friday, July 9, 2010 5:06 AM