/** * Return true if should be pruned * * The termlist 'agentrole' contains subsequences of length 2, the first of which is a agent name, and the second is the role it is performing. * The idea is that once the agent name is assigned, it should not occur again for a different role. * E.g. [ alice, initiator, bob, responder, charlie, ... ] */ int multipleRolePrune (const System sys) { Termlist agentrole; int run; agentrole = NULL; for (run = 0; run < sys->maxruns; run++) { Protocol p; p = sys->runs[run].protocol; if ((p != INTRUDER) && (!isHelperProtocol (p))) { Term rolename; Term agent; Termlist tl; rolename = sys->runs[run].role->nameterm; agent = agentOfRun (sys, run); // Does this agent already occur yet in the list? for (tl = agentrole; tl != NULL; tl = (tl->next)->next) { if (isTermEqual (agent, tl->term)) { if (!isTermEqual (rolename, (tl->next)->term)) { // Same agent, but different role! This is not allowed. termlistDelete (agentrole); // cleanup return true; } } } // Does not occur yet, so add // Note we add the elements in front, so we need to reverse the order agentrole = termlistPrepend (agentrole, rolename); agentrole = termlistPrepend (agentrole, agent); } } termlistDelete (agentrole); return false; }
bool KProtocolInfo::isKnownProtocol( const QString &protocol ) { // We call the findProtocol (const QString&) to bypass any proxy settings. KProtocolInfo::Ptr prot = KProtocolInfoFactory::self()->findProtocol(protocol); return prot || isHelperProtocol(protocol); }
bool KProtocolInfo::isHelperProtocol( const KUrl &url ) { return isHelperProtocol (url.protocol()); }