Added helper protocol support.

This is not a full copy from the compromise branch. In particular,
some counts (in arachne.c) are missing, as well as the modified dot output (dotout.c).
This commit is contained in:
Cas Cremers 2011-04-01 15:23:20 +02:00
parent 2e7328e0df
commit 4ec5ea4232
3 changed files with 47 additions and 11 deletions

View File

@ -939,12 +939,17 @@ claimAddAll (const System sys, const Protocol protocol, const Role role)
}
}
addSecrecyList (role->declaredconsts);
addSecrecyList (role->declaredvars);
if (!isHelperProtocol (protocol))
{
addSecrecyList (role->declaredconsts);
addSecrecyList (role->declaredvars);
/* full non-injective agreement and ni-synch */
claimCreate (sys, protocol, role, CLAIM_Niagree, NULL, NULL, -1);
claimCreate (sys, protocol, role, CLAIM_Nisynch, NULL, NULL, -1);
/* full non-injective agreement and ni-synch */
claimCreate (sys, protocol, role, CLAIM_Alive, NULL, NULL, -1);
claimCreate (sys, protocol, role, CLAIM_Weakagree, NULL, NULL, -1);
claimCreate (sys, protocol, role, CLAIM_Niagree, NULL, NULL, -1);
claimCreate (sys, protocol, role, CLAIM_Nisynch, NULL, NULL, -1);
}
}
//! Compile a role
@ -1028,8 +1033,11 @@ roleCompile (Term nameterm, Tac tc)
if (switches.addreachableclaim)
{
claimCreate (sys, thisProtocol, thisRole, CLAIM_Reachable, NULL, NULL,
-1);
if (!isHelperProtocol (thisProtocol))
{
claimCreate (sys, thisProtocol, thisRole, CLAIM_Reachable, NULL,
NULL, -1);
}
}
if (switches.addallclaims)
{

View File

@ -1291,9 +1291,12 @@ selfSession (const System sys, const int run)
int
selfResponder (const System sys, const int run)
{
if (sys->runs[run].role->initiator)
if (!isHelperProtocol (sys->runs[run].protocol))
{
return false;
if (sys->runs[run].role->initiator)
{
return false;
}
}
else
{
@ -1328,9 +1331,12 @@ selfResponders (const System sys)
int
selfInitiator (const System sys, const int run)
{
if (sys->runs[run].role->initiator)
if (!isHelperProtocol (sys->runs[run].protocol))
{
return selfSession (sys, run);
if (sys->runs[run].role->initiator)
{
return selfSession (sys, run);
}
}
else
{
@ -1357,3 +1363,24 @@ selfInitiators (const System sys)
}
return count;
}
//! Check a protocol for being a helper protocol.
/**
* Special helper protocols start with an '@' conform the usage in Gijs
* Hollestelle's work.
*/
int
isHelperProtocol (Protocol p)
{
if (p != NULL)
{
if (p->nameterm != NULL)
{
if (TermSymb (p->nameterm)->text[0] == '@')
{
return true;
}
}
}
return false;
}

View File

@ -208,6 +208,7 @@ int selfResponders (const System sys);
int selfInitiator (const System sys, const int run);
int selfInitiators (const System sys);
int enoughAttacks (const System sys);
int isHelperProtocol (Protocol p);
//! Equality for run structure naming