- Added a global attack id, starting at one. Currently only shown in

XML and Dot output. For Dot, it is included in the label. For XML, it
  is an added attribute of the 'attack' tag.
This commit is contained in:
ccremers 2005-06-07 13:40:56 +00:00
parent 22a0d2adfb
commit 1331f5e7a3
5 changed files with 10 additions and 1 deletions

View File

@ -1427,7 +1427,7 @@ dotSemiState ()
// Open graph
attack_number++;
eprintf ("digraph semiState%i {\n", attack_number);
eprintf ("\tlabel = \"Protocol ");
eprintf ("\tlabel = \"[Id %i] Protocol ", sys->attackid);
p = (Protocol) sys->current_claim->protocol;
termPrint (p->nameterm);
eprintf (", role ");
@ -3066,9 +3066,13 @@ add_claim_specifics (const Claimlist cl, const Roledef rd)
}
//! Count a false claim
/**
* Counts global attacks as well as claim instances.
*/
void
count_false ()
{
sys->attackid++;
sys->current_claim->failed = statesIncrease (sys->current_claim->failed);
}

View File

@ -1239,6 +1239,7 @@ violateClaim (const System sys, int length, int claimev, Termlist reqt)
flag = 1;
/* Count the violations */
sys->attackid++;
sys->failed = statesIncrease (sys->failed);
clinfo = sys->traceEvent[claimev]->claiminfo;
clinfo->failed = statesIncrease (clinfo->failed); // note: for modelchecking secrecy, this can lead to more fails (at further events in branches of the tree) than claim encounters

View File

@ -104,6 +104,7 @@ systemInit ()
sys->claimlist = NULL;
sys->labellist = NULL;
sys->match = 0; // default matching
sys->attackid = 0; // First attack will have id 1, because the counter is increased before any attacks are displayed.
/* matching CLP */
sys->constraints = NULL; // no initial constraints

View File

@ -163,6 +163,7 @@ struct system
states_t interval; //!< Used to update state printing at certain intervals
states_t claims; //!< Number of claims encountered.
states_t failed; //!< Number of claims failed.
int attackid; //!< Global counter of attacks (used for assigning identifiers) within this Scyther call.
int countScenario; //!< Number of scenarios skipped.
/* matching */

View File

@ -752,6 +752,8 @@ xmlOutSemitrace (const System sys)
printf ("<attack");
/* add trace length attribute */
printf (" tracelength=\"%i\"", get_semitrace_length ());
/* add attack id attribute (within this scyther call) */
printf (" id=\"%i\"", sys->attackid);
printf (">\n");
xmlindent++;