- XML output should be workable now.
This commit is contained in:
parent
018f54a904
commit
71558706a6
@ -43,7 +43,6 @@ extern int nodes;
|
|||||||
extern int graph_uordblks;
|
extern int graph_uordblks;
|
||||||
|
|
||||||
static System sys;
|
static System sys;
|
||||||
static Claimlist current_claim;
|
|
||||||
static int attack_length;
|
static int attack_length;
|
||||||
|
|
||||||
Protocol INTRUDER; // Pointers, to be set by the Init
|
Protocol INTRUDER; // Pointers, to be set by the Init
|
||||||
@ -1042,12 +1041,12 @@ latexSemiState ()
|
|||||||
// Open graph
|
// Open graph
|
||||||
attack_number++;
|
attack_number++;
|
||||||
eprintf ("\\begin{msc}{Attack on ");
|
eprintf ("\\begin{msc}{Attack on ");
|
||||||
p = (Protocol) current_claim->protocol;
|
p = (Protocol) sys->current_claim->protocol;
|
||||||
termPrint (p->nameterm);
|
termPrint (p->nameterm);
|
||||||
eprintf (", role ");
|
eprintf (", role ");
|
||||||
termPrint (current_claim->rolename);
|
termPrint (sys->current_claim->rolename);
|
||||||
eprintf (", claim type ");
|
eprintf (", claim type ");
|
||||||
termPrint (current_claim->type);
|
termPrint (sys->current_claim->type);
|
||||||
eprintf ("}\n%% Attack number %i\n", attack_number);
|
eprintf ("}\n%% Attack number %i\n", attack_number);
|
||||||
eprintf ("\n");
|
eprintf ("\n");
|
||||||
|
|
||||||
@ -1218,12 +1217,12 @@ dotSemiState ()
|
|||||||
attack_number++;
|
attack_number++;
|
||||||
eprintf ("digraph semiState%i {\n", attack_number);
|
eprintf ("digraph semiState%i {\n", attack_number);
|
||||||
eprintf ("\tlabel = \"Protocol ");
|
eprintf ("\tlabel = \"Protocol ");
|
||||||
p = (Protocol) current_claim->protocol;
|
p = (Protocol) sys->current_claim->protocol;
|
||||||
termPrint (p->nameterm);
|
termPrint (p->nameterm);
|
||||||
eprintf (", role ");
|
eprintf (", role ");
|
||||||
termPrint (current_claim->rolename);
|
termPrint (sys->current_claim->rolename);
|
||||||
eprintf (", claim type ");
|
eprintf (", claim type ");
|
||||||
termPrint (current_claim->type);
|
termPrint (sys->current_claim->type);
|
||||||
eprintf ("\";\n");
|
eprintf ("\";\n");
|
||||||
|
|
||||||
// Needed for the bindings later on: create graph
|
// Needed for the bindings later on: create graph
|
||||||
@ -1334,7 +1333,7 @@ dotSemiState ()
|
|||||||
eprintf ("\t\t");
|
eprintf ("\t\t");
|
||||||
node (run, index);
|
node (run, index);
|
||||||
eprintf (" [");
|
eprintf (" [");
|
||||||
if (run == 0 && index == current_claim->ev)
|
if (run == 0 && index == sys->current_claim->ev)
|
||||||
{
|
{
|
||||||
eprintf
|
eprintf
|
||||||
("style=filled,fillcolor=mistyrose,color=salmon,shape=doubleoctagon,");
|
("style=filled,fillcolor=mistyrose,color=salmon,shape=doubleoctagon,");
|
||||||
@ -2648,7 +2647,7 @@ prune_bounds ()
|
|||||||
get_time_limit ());
|
get_time_limit ());
|
||||||
}
|
}
|
||||||
// Pruned because of time bound!
|
// Pruned because of time bound!
|
||||||
current_claim->timebound = 1;
|
sys->current_claim->timebound = 1;
|
||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2751,11 +2750,11 @@ prune_bounds ()
|
|||||||
int
|
int
|
||||||
prune_claim_specifics ()
|
prune_claim_specifics ()
|
||||||
{
|
{
|
||||||
if (current_claim->type == CLAIM_Niagree)
|
if (sys->current_claim->type == CLAIM_Niagree)
|
||||||
{
|
{
|
||||||
if (arachne_claim_niagree (sys, 0, current_claim->ev))
|
if (arachne_claim_niagree (sys, 0, sys->current_claim->ev))
|
||||||
{
|
{
|
||||||
current_claim->count = statesIncrease (current_claim->count);
|
sys->current_claim->count = statesIncrease (sys->current_claim->count);
|
||||||
if (sys->output == PROOF)
|
if (sys->output == PROOF)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
@ -2765,11 +2764,11 @@ prune_claim_specifics ()
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (current_claim->type == CLAIM_Nisynch)
|
if (sys->current_claim->type == CLAIM_Nisynch)
|
||||||
{
|
{
|
||||||
if (arachne_claim_nisynch (sys, 0, current_claim->ev))
|
if (arachne_claim_nisynch (sys, 0, sys->current_claim->ev))
|
||||||
{
|
{
|
||||||
current_claim->count = statesIncrease (current_claim->count);
|
sys->current_claim->count = statesIncrease (sys->current_claim->count);
|
||||||
if (sys->output == PROOF)
|
if (sys->output == PROOF)
|
||||||
{
|
{
|
||||||
indentPrint ();
|
indentPrint ();
|
||||||
@ -2814,7 +2813,7 @@ add_claim_specifics (const Claimlist cl, const Roledef rd)
|
|||||||
void
|
void
|
||||||
count_false ()
|
count_false ()
|
||||||
{
|
{
|
||||||
current_claim->failed = statesIncrease (current_claim->failed);
|
sys->current_claim->failed = statesIncrease (sys->current_claim->failed);
|
||||||
}
|
}
|
||||||
|
|
||||||
//------------------------------------------------------------------------
|
//------------------------------------------------------------------------
|
||||||
@ -2940,8 +2939,8 @@ iterate ()
|
|||||||
eprintf ("All goals are now bound.\n");
|
eprintf ("All goals are now bound.\n");
|
||||||
}
|
}
|
||||||
sys->claims = statesIncrease (sys->claims);
|
sys->claims = statesIncrease (sys->claims);
|
||||||
current_claim->count =
|
sys->current_claim->count =
|
||||||
statesIncrease (current_claim->count);
|
statesIncrease (sys->current_claim->count);
|
||||||
flag = property_check ();
|
flag = property_check ();
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
@ -2956,7 +2955,7 @@ iterate ()
|
|||||||
else
|
else
|
||||||
{
|
{
|
||||||
// Pruned because of bound!
|
// Pruned because of bound!
|
||||||
current_claim->complete = 0;
|
sys->current_claim->complete = 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -3057,7 +3056,7 @@ arachne ()
|
|||||||
{
|
{
|
||||||
int run;
|
int run;
|
||||||
|
|
||||||
current_claim = cl;
|
sys->current_claim = cl;
|
||||||
attack_length = INT_MAX;
|
attack_length = INT_MAX;
|
||||||
cl->complete = 1;
|
cl->complete = 1;
|
||||||
p = (Protocol) cl->protocol;
|
p = (Protocol) cl->protocol;
|
||||||
|
@ -104,6 +104,10 @@ systemInit ()
|
|||||||
/* matching CLP */
|
/* matching CLP */
|
||||||
sys->constraints = NULL; // no initial constraints
|
sys->constraints = NULL; // no initial constraints
|
||||||
|
|
||||||
|
/* Arachne assist */
|
||||||
|
sys->bindings = NULL;
|
||||||
|
sys->current_claim = NULL;
|
||||||
|
|
||||||
/* reset global counters */
|
/* reset global counters */
|
||||||
systemReset (sys);
|
systemReset (sys);
|
||||||
|
|
||||||
|
@ -195,6 +195,7 @@ struct system
|
|||||||
|
|
||||||
/* Arachne assistance */
|
/* Arachne assistance */
|
||||||
List bindings; //!< List of bindings
|
List bindings; //!< List of bindings
|
||||||
|
Claimlist current_claim; //!< The claim under current investigation
|
||||||
|
|
||||||
//! Shortest attack storage.
|
//! Shortest attack storage.
|
||||||
struct tracebuf *attack;
|
struct tracebuf *attack;
|
||||||
|
68
src/xmlout.c
68
src/xmlout.c
@ -109,6 +109,25 @@ xmlAttrTerm (const char *tag, const Term term)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Print a term, known to be a role name
|
||||||
|
/**
|
||||||
|
* Arachne turns all role names into variables for convenience. Here we
|
||||||
|
* temporarily undo it for pretty-printing.
|
||||||
|
*/
|
||||||
|
void
|
||||||
|
roleTermPrint (const Term t)
|
||||||
|
{
|
||||||
|
if (t != NULL)
|
||||||
|
{
|
||||||
|
int typebuffer;
|
||||||
|
|
||||||
|
typebuffer = t->type;
|
||||||
|
t->type = GLOBAL;
|
||||||
|
termPrint (t);
|
||||||
|
t->type = typebuffer;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
//! Global system info
|
//! Global system info
|
||||||
/**
|
/**
|
||||||
* To be used by concrete trace as well as semitrace output
|
* To be used by concrete trace as well as semitrace output
|
||||||
@ -136,10 +155,34 @@ xmlOutSysInfo (const System sys)
|
|||||||
xmlPrint ("</system>");
|
xmlPrint ("</system>");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
//! Nicely format the role and agents we think we're talking to.
|
||||||
|
void
|
||||||
|
xmlAgentsOfRunPrint (const System sys, const int run)
|
||||||
|
{
|
||||||
|
Termlist roles;
|
||||||
|
|
||||||
|
xmlPrint ("<roleagents>");
|
||||||
|
xmlindent++;
|
||||||
|
|
||||||
|
roles = sys->runs[run].protocol->rolenames;
|
||||||
|
while (roles != NULL)
|
||||||
|
{
|
||||||
|
xmlIndentPrint ();
|
||||||
|
printf ("<");
|
||||||
|
roleTermPrint (roles->term);
|
||||||
|
printf (">");
|
||||||
|
termPrint (agentOfRunRole (sys, run, roles->term));
|
||||||
|
printf ("</");
|
||||||
|
roleTermPrint (roles->term);
|
||||||
|
printf (">\n");
|
||||||
|
roles = roles->next;
|
||||||
|
}
|
||||||
|
|
||||||
|
xmlindent--;
|
||||||
|
xmlPrint ("</roleagents>");
|
||||||
|
}
|
||||||
|
|
||||||
//! Static information about a run
|
//! Static information about a run
|
||||||
/**
|
|
||||||
* TODO: Does not output any sigma info yet (role->agent mappings), which is very important.
|
|
||||||
*/
|
|
||||||
void
|
void
|
||||||
xmlRunInfo (const System sys, const int run)
|
xmlRunInfo (const System sys, const int run)
|
||||||
{
|
{
|
||||||
@ -155,13 +198,17 @@ xmlRunInfo (const System sys, const int run)
|
|||||||
* more generic. */
|
* more generic. */
|
||||||
oldagent = r->nameterm->subst;
|
oldagent = r->nameterm->subst;
|
||||||
r->nameterm->subst = NULL;
|
r->nameterm->subst = NULL;
|
||||||
xmlOutTerm ("role", r->nameterm);
|
xmlIndentPrint ();
|
||||||
|
printf ("<role>");
|
||||||
|
roleTermPrint (r->nameterm);
|
||||||
|
printf ("</role>\n");
|
||||||
/* reinstate substitution */
|
/* reinstate substitution */
|
||||||
r->nameterm->subst = oldagent;
|
r->nameterm->subst = oldagent;
|
||||||
if (oldagent != NULL)
|
if (oldagent != NULL)
|
||||||
{
|
{
|
||||||
xmlOutTerm ("agent", r->nameterm);
|
xmlOutTerm ("agent", r->nameterm);
|
||||||
}
|
}
|
||||||
|
xmlAgentsOfRunPrint (sys, run);
|
||||||
}
|
}
|
||||||
|
|
||||||
//! Show a single event from a run
|
//! Show a single event from a run
|
||||||
@ -309,22 +356,27 @@ xmlOutTrace (const System sys)
|
|||||||
|
|
||||||
//! Output for a semitrace (from arachne method)
|
//! Output for a semitrace (from arachne method)
|
||||||
/**
|
/**
|
||||||
* Note: Uses get_trace_length(), which is defined for the arachne method only.
|
* Note: Uses get_trace_length(), which is defined for the arachne method
|
||||||
*
|
* only.
|
||||||
* TODO does not show violated claim yet, this must now be guessed by the
|
|
||||||
* reader.
|
|
||||||
*/
|
*/
|
||||||
void
|
void
|
||||||
xmlOutSemitrace (const System sys)
|
xmlOutSemitrace (const System sys)
|
||||||
{
|
{
|
||||||
xmlIndentPrint ();
|
xmlIndentPrint ();
|
||||||
printf ("<attack");
|
printf ("<attack");
|
||||||
|
/* mention the broken claim in the attributes */
|
||||||
|
if (sys->current_claim != NULL)
|
||||||
|
{
|
||||||
|
xmlAttrTerm ("claim", sys->current_claim->type);
|
||||||
|
xmlAttrTerm ("label", sys->current_claim->label);
|
||||||
|
}
|
||||||
/* add trace length attribute */
|
/* add trace length attribute */
|
||||||
printf (" tracelength=\"%i\"", get_semitrace_length ());
|
printf (" tracelength=\"%i\"", get_semitrace_length ());
|
||||||
printf (">\n");
|
printf (">\n");
|
||||||
xmlindent++;
|
xmlindent++;
|
||||||
/* any global information about the system */
|
/* any global information about the system */
|
||||||
xmlOutSysInfo (sys);
|
xmlOutSysInfo (sys);
|
||||||
|
/* semitrace */
|
||||||
xmlPrint ("<semitrace>");
|
xmlPrint ("<semitrace>");
|
||||||
xmlindent++;
|
xmlindent++;
|
||||||
xmlOutRuns (sys);
|
xmlOutRuns (sys);
|
||||||
|
Loading…
Reference in New Issue
Block a user