// -----------------------------------------------------------------------------
// CHWRMVibraCommonService::ExecutingPriorityHigher
// Checks whether vibrating client's priority higher than new request making
// client's priority
// -----------------------------------------------------------------------------
//
TBool CHWRMVibraCommonService::ExecutingPriorityHigher(TSecureId aSid)
    {
    COMPONENT_TRACE1(_L( "HWRM Server - CHWRMVibraCommonService::ExecutingPriorityHigher" ) );

    TBool ret( EFalse );

    TInt count = iVibraClients.Count();

    if( count > 0 )
        {
        TBool trusted( EFalse );
        // Last client requested vibration always the first one in list
        TInt activePriority = iReservationHandler->GetPolicy()->GetPriority( iVibraClients[0].iSid, trusted );
        TInt reqPriority = iReservationHandler->GetPolicy()->GetPriority( aSid, trusted );
    
        if( activePriority < reqPriority )
            {
            ret = ETrue;
            }
        }
    
    COMPONENT_TRACE2(_L( "HWRM Server - CHWRMVibraCommonService::ExecutingPriorityHigher - ret %d" ), ret);
    
    return ret;
    }
Example #2
0
void any(int n)
{
  // untrusted(n);
  if(n > 10)
    // security policy possibly (when any is called) violated if n <= 10
    trusted(n - 1);
}
Example #3
0
int main()
{
  trusted(5);
  any(5);

  return 0;
}
Example #4
0
void trusted(int n)
{
  printf("%d ", n);
  untrusted(n);
  any(n);
  if (n)
    trusted(n - 1);
}
Example #5
0
void
ValidatorList::for_each_listed (
    std::function<void(PublicKey const&, bool)> func) const
{
    boost::shared_lock<boost::shared_mutex> read_lock{mutex_};

    for (auto const& v : keyListings_)
        func (v.first, trusted(v.first));
}