- Fixed intruder generated value displays.
This commit is contained in:
parent
dbe2042c01
commit
8d66dc48fd
@ -1740,6 +1740,9 @@ createNewTermGeneric (Termlist tl, Term t)
|
|||||||
memcpy (newterm, t, sizeof (struct term));
|
memcpy (newterm, t, sizeof (struct term));
|
||||||
TermRunid (newterm) = freenumber;
|
TermRunid (newterm) = freenumber;
|
||||||
|
|
||||||
|
/* The type of the new term should be that of the parent! */
|
||||||
|
newterm->stype = termlistAppend (NULL, t);
|
||||||
|
|
||||||
/* return */
|
/* return */
|
||||||
return termlistPrepend (tl, newterm);
|
return termlistPrepend (tl, newterm);
|
||||||
}
|
}
|
||||||
|
63
src/dotout.c
63
src/dotout.c
@ -5,6 +5,7 @@
|
|||||||
#include "arachne.h"
|
#include "arachne.h"
|
||||||
#include "binding.h"
|
#include "binding.h"
|
||||||
#include "depend.h"
|
#include "depend.h"
|
||||||
|
#include "type.h"
|
||||||
#include "debug.h"
|
#include "debug.h"
|
||||||
|
|
||||||
extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c
|
extern Protocol INTRUDER; // Pointers, to be set by the Init of arachne.c
|
||||||
@ -63,8 +64,29 @@ static System sys = NULL;
|
|||||||
* code
|
* code
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
//! Is this term chosen by the intruder?
|
||||||
|
int
|
||||||
|
isIntruderChoice (const Term t)
|
||||||
|
{
|
||||||
|
if (realTermLeaf (t))
|
||||||
|
{
|
||||||
|
if (TermRunid (t) >= sys->maxruns)
|
||||||
|
{
|
||||||
|
// Chosen by intruder
|
||||||
|
// However, if it is a rolename, this is not really what we mean
|
||||||
|
if (!(t->roleVar || isAgentType (t->stype)))
|
||||||
|
{
|
||||||
|
// Not a role variable, and chosen by the intruder: that's it
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
|
//! Print the run identifier in some meaningful way
|
||||||
void
|
void
|
||||||
printVisualRun (int rid)
|
printVisualRunID (int rid)
|
||||||
{
|
{
|
||||||
int run;
|
int run;
|
||||||
int displayi;
|
int displayi;
|
||||||
@ -99,11 +121,20 @@ printVisualRun (int rid)
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
// >= sys->maxruns means intruder choice
|
eprintf ("%i", (rid - sys->maxruns + 1));
|
||||||
eprintf ("Intruder%i", (rid - sys->maxruns + 1));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void
|
||||||
|
printVisualRun (const Term t)
|
||||||
|
{
|
||||||
|
if (isIntruderChoice (t))
|
||||||
|
{
|
||||||
|
eprintf ("Intruder");
|
||||||
|
}
|
||||||
|
printVisualRunID (TermRunid (t));
|
||||||
|
}
|
||||||
|
|
||||||
//! Remap term stuff
|
//! Remap term stuff
|
||||||
void
|
void
|
||||||
termPrintRemap (const Term t)
|
termPrintRemap (const Term t)
|
||||||
@ -113,12 +144,16 @@ termPrintRemap (const Term t)
|
|||||||
|
|
||||||
//! Remap term list
|
//! Remap term list
|
||||||
void
|
void
|
||||||
termlistPrintRemap (Termlist tl)
|
termlistPrintRemap (Termlist tl, char *sep)
|
||||||
{
|
{
|
||||||
while (tl != NULL)
|
while (tl != NULL)
|
||||||
{
|
{
|
||||||
termPrintRemap(tl->term);
|
termPrintRemap (tl->term);
|
||||||
tl = tl->next;
|
tl = tl->next;
|
||||||
|
if (tl != NULL)
|
||||||
|
{
|
||||||
|
eprintf ("%s", sep);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -1263,7 +1298,7 @@ printRunExplanation (const System sys, const int run,
|
|||||||
int hadcontent;
|
int hadcontent;
|
||||||
|
|
||||||
eprintf ("Run ");
|
eprintf ("Run ");
|
||||||
printVisualRun (run);
|
printVisualRunID (run);
|
||||||
|
|
||||||
eprintf (runrolesep);
|
eprintf (runrolesep);
|
||||||
// Print first line
|
// Print first line
|
||||||
@ -1717,39 +1752,37 @@ dotSemiState (const System mysys)
|
|||||||
b = (Binding) bl->data;
|
b = (Binding) bl->data;
|
||||||
if (!b->blocked)
|
if (!b->blocked)
|
||||||
{
|
{
|
||||||
int addsubterms(Term t)
|
int addsubterms (Term t)
|
||||||
{
|
{
|
||||||
if (TermRunid(t) >= sys->maxruns)
|
if (isIntruderChoice (t))
|
||||||
{
|
{
|
||||||
// >= sys->maxruns means intruder choice
|
found = termlistAddNew (found, t);
|
||||||
found = termlistAddNew(found, t);
|
|
||||||
}
|
}
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
term_iterate_open_leaves(b->term, addsubterms);
|
term_iterate_open_leaves (b->term, addsubterms);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// now maybe we draw the node
|
// now maybe we draw the node
|
||||||
if ((from_intruder_count > 0) || (found != NULL))
|
if ((from_intruder_count > 0) || (found != NULL))
|
||||||
{
|
{
|
||||||
eprintf
|
eprintf ("\tintruder [\n");
|
||||||
("\tintruder [\n");
|
|
||||||
eprintf ("\t\tlabel=\"");
|
eprintf ("\t\tlabel=\"");
|
||||||
eprintf ("Initial intruder knowledge");
|
eprintf ("Initial intruder knowledge");
|
||||||
if (found != NULL)
|
if (found != NULL)
|
||||||
{
|
{
|
||||||
eprintf ("\\n");
|
eprintf ("\\n");
|
||||||
eprintf ("The intruder generates: ");
|
eprintf ("The intruder generates: ");
|
||||||
termlistPrintRemap (found);
|
termlistPrintRemap (found, ", ");
|
||||||
}
|
}
|
||||||
eprintf ("\",\n");
|
eprintf ("\",\n");
|
||||||
eprintf ("\t\tstyle=filled,fillcolor=\"");
|
eprintf ("\t\tstyle=filled,fillcolor=\"");
|
||||||
printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS);
|
printColor (INTRUDERCOLORH, INTRUDERCOLORL, INTRUDERCOLORS);
|
||||||
eprintf ("\"\n\t];\n");
|
eprintf ("\"\n\t];\n");
|
||||||
}
|
}
|
||||||
termlistDelete(found);
|
termlistDelete (found);
|
||||||
}
|
}
|
||||||
|
|
||||||
// eprintf ("\t};\n");
|
// eprintf ("\t};\n");
|
||||||
|
1116
src/parser.c
1116
src/parser.c
File diff suppressed because it is too large
Load Diff
48
src/parser.h
48
src/parser.h
@ -1,7 +1,9 @@
|
|||||||
/* A Bison parser, made by GNU Bison 2.1. */
|
/* A Bison parser, made by GNU Bison 2.3. */
|
||||||
|
|
||||||
/* Skeleton parser for Yacc-like parsing with Bison,
|
/* Skeleton interface for Bison's Yacc-like parsers in C
|
||||||
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
|
|
||||||
|
Copyright (C) 1984, 1989, 1990, 2000, 2001, 2002, 2003, 2004, 2005, 2006
|
||||||
|
Free Software Foundation, Inc.
|
||||||
|
|
||||||
This program is free software; you can redistribute it and/or modify
|
This program is free software; you can redistribute it and/or modify
|
||||||
it under the terms of the GNU General Public License as published by
|
it under the terms of the GNU General Public License as published by
|
||||||
@ -18,17 +20,26 @@
|
|||||||
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
||||||
Boston, MA 02110-1301, USA. */
|
Boston, MA 02110-1301, USA. */
|
||||||
|
|
||||||
/* As a special exception, when this file is copied by Bison into a
|
/* As a special exception, you may create a larger work that contains
|
||||||
Bison output file, you may use that output file without restriction.
|
part or all of the Bison parser skeleton and distribute that work
|
||||||
This special exception was added by the Free Software Foundation
|
under terms of your choice, so long as that work isn't itself a
|
||||||
in version 1.24 of Bison. */
|
parser generator using the skeleton or a modified version thereof
|
||||||
|
as a parser skeleton. Alternatively, if you modify or redistribute
|
||||||
|
the parser skeleton itself, you may (at your option) remove this
|
||||||
|
special exception, which will cause the skeleton and the resulting
|
||||||
|
Bison output files to be licensed under the GNU General Public
|
||||||
|
License without this special exception.
|
||||||
|
|
||||||
|
This special exception was added by the Free Software Foundation in
|
||||||
|
version 2.2 of Bison. */
|
||||||
|
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#ifndef YYTOKENTYPE
|
#ifndef YYTOKENTYPE
|
||||||
# define YYTOKENTYPE
|
# define YYTOKENTYPE
|
||||||
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
/* Put the tokens into the symbol table, so that GDB and other debuggers
|
||||||
know about them. */
|
know about them. */
|
||||||
enum yytokentype {
|
enum yytokentype
|
||||||
|
{
|
||||||
ID = 258,
|
ID = 258,
|
||||||
PROTOCOL = 259,
|
PROTOCOL = 259,
|
||||||
ROLE = 260,
|
ROLE = 260,
|
||||||
@ -48,7 +59,7 @@
|
|||||||
HASHFUNCTION = 274,
|
HASHFUNCTION = 274,
|
||||||
KNOWS = 275,
|
KNOWS = 275,
|
||||||
TRUSTED = 276
|
TRUSTED = 276
|
||||||
};
|
};
|
||||||
#endif
|
#endif
|
||||||
/* Tokens. */
|
/* Tokens. */
|
||||||
#define ID 258
|
#define ID 258
|
||||||
@ -74,22 +85,21 @@
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
#if ! defined (YYSTYPE) && ! defined (YYSTYPE_IS_DECLARED)
|
#if ! defined YYSTYPE && ! defined YYSTYPE_IS_DECLARED
|
||||||
|
typedef union YYSTYPE
|
||||||
#line 13 "parser.y"
|
#line 13 "parser.y"
|
||||||
typedef union YYSTYPE {
|
{
|
||||||
char* str;
|
char *str;
|
||||||
struct tacnode* tac;
|
struct tacnode *tac;
|
||||||
Symbol symb;
|
Symbol symb;
|
||||||
int value;
|
int value;
|
||||||
} YYSTYPE;
|
}
|
||||||
/* Line 1447 of yacc.c. */
|
/* Line 1529 of yacc.c. */
|
||||||
#line 87 "parser.h"
|
#line 98 "parser.h"
|
||||||
|
YYSTYPE;
|
||||||
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
# define yystype YYSTYPE /* obsolescent; will be withdrawn */
|
||||||
# define YYSTYPE_IS_DECLARED 1
|
# define YYSTYPE_IS_DECLARED 1
|
||||||
# define YYSTYPE_IS_TRIVIAL 1
|
# define YYSTYPE_IS_TRIVIAL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
extern YYSTYPE yylval;
|
extern YYSTYPE yylval;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
975
src/scanner.c
975
src/scanner.c
File diff suppressed because it is too large
Load Diff
@ -315,7 +315,7 @@ termInTerm (Term t, Term tsub)
|
|||||||
void
|
void
|
||||||
termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||||
char *righttup, char *leftenc, char *rightenc,
|
char *righttup, char *leftenc, char *rightenc,
|
||||||
void (*callback) (int rid))
|
void (*callback) (const Term t))
|
||||||
{
|
{
|
||||||
#ifdef DEBUG
|
#ifdef DEBUG
|
||||||
if (!DEBUGL (4))
|
if (!DEBUGL (4))
|
||||||
@ -345,7 +345,7 @@ termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
|||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
callback (TermRunid (term));
|
callback (term);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (term->subst != NULL)
|
if (term->subst != NULL)
|
||||||
@ -404,7 +404,7 @@ termPrint (Term term)
|
|||||||
void
|
void
|
||||||
termTuplePrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
termTuplePrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||||
char *righttup, char *leftenc, char *rightenc,
|
char *righttup, char *leftenc, char *rightenc,
|
||||||
void (*callback) (int rid))
|
void (*callback) (const Term t))
|
||||||
{
|
{
|
||||||
if (term == NULL)
|
if (term == NULL)
|
||||||
{
|
{
|
||||||
|
@ -174,11 +174,11 @@ int termSubTerm (Term t, Term tsub);
|
|||||||
int termInTerm (Term t, Term tsub);
|
int termInTerm (Term t, Term tsub);
|
||||||
void termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
void termPrintCustom (Term term, char *leftvar, char *rightvar, char *lefttup,
|
||||||
char *righttup, char *leftenc, char *rightenc,
|
char *righttup, char *leftenc, char *rightenc,
|
||||||
void (*callback) (int rid));
|
void (*callback) (const Term t));
|
||||||
void termPrint (Term term);
|
void termPrint (Term term);
|
||||||
void termTuplePrintCustom (Term term, char *leftvar, char *rightvar,
|
void termTuplePrintCustom (Term term, char *leftvar, char *rightvar,
|
||||||
char *lefttup, char *righttup, char *leftenc,
|
char *lefttup, char *righttup, char *leftenc,
|
||||||
char *rightenc, void (*callback) (int rid));
|
char *rightenc, void (*callback) (const Term t));
|
||||||
void termTuplePrint (Term term);
|
void termTuplePrint (Term term);
|
||||||
Term termDuplicate (const Term term);
|
Term termDuplicate (const Term term);
|
||||||
Term termNodeDuplicate (const Term term);
|
Term termNodeDuplicate (const Term term);
|
||||||
|
Loading…
Reference in New Issue
Block a user