2007-06-11 13:01:04 +01:00
|
|
|
/*
|
|
|
|
* Scyther : An automatic verifier for security protocols.
|
2012-04-24 12:56:51 +01:00
|
|
|
* Copyright (C) 2007-2012 Cas Cremers
|
2007-06-11 13:01:04 +01:00
|
|
|
*
|
|
|
|
* 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 the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
|
|
|
*/
|
|
|
|
|
2004-04-23 11:58:43 +01:00
|
|
|
#ifndef TAC_H
|
|
|
|
#define TAC_H
|
|
|
|
|
2004-07-24 20:07:29 +01:00
|
|
|
#include "symbol.h"
|
2004-04-23 11:58:43 +01:00
|
|
|
|
|
|
|
/*
|
|
|
|
* TAC instructions
|
|
|
|
*/
|
|
|
|
|
2004-08-09 11:05:58 +01:00
|
|
|
enum tactypes
|
|
|
|
{
|
2004-07-29 12:26:59 +01:00
|
|
|
TAC_UNDEF,
|
|
|
|
TAC_SYM,
|
|
|
|
TAC_TUPLE,
|
|
|
|
TAC_ENCRYPT,
|
2013-04-26 10:36:41 +01:00
|
|
|
TAC_FCALL,
|
2004-07-29 12:26:59 +01:00
|
|
|
TAC_VAR,
|
|
|
|
TAC_CONST,
|
2010-01-05 12:45:19 +00:00
|
|
|
TAC_FRESH,
|
2012-04-25 08:53:07 +01:00
|
|
|
TAC_RECV,
|
2004-07-29 12:26:59 +01:00
|
|
|
TAC_SEND,
|
|
|
|
TAC_CLAIM,
|
|
|
|
TAC_FUNC,
|
|
|
|
TAC_STRING,
|
|
|
|
TAC_ROLE,
|
2012-12-14 22:53:04 +00:00
|
|
|
|
2004-07-29 12:26:59 +01:00
|
|
|
TAC_PROTOCOL,
|
2006-07-27 11:44:12 +01:00
|
|
|
TAC_KNOWS,
|
2004-07-29 12:26:59 +01:00
|
|
|
TAC_RUN,
|
|
|
|
TAC_ROLEREF,
|
|
|
|
TAC_SECRET,
|
|
|
|
TAC_INVERSEKEYS,
|
2013-04-26 10:36:41 +01:00
|
|
|
TAC_INVERSEKEYFUNCTIONS,
|
2009-04-28 15:28:16 +01:00
|
|
|
TAC_HASHFUNCTION,
|
2004-07-29 12:26:59 +01:00
|
|
|
TAC_UNTRUSTED,
|
|
|
|
TAC_COMPROMISED,
|
2012-11-21 10:28:40 +00:00
|
|
|
TAC_USERTYPE,
|
2012-11-22 11:30:00 +00:00
|
|
|
TAC_MATCH,
|
|
|
|
TAC_MACRO
|
2004-07-29 12:26:59 +01:00
|
|
|
};
|
2004-04-23 11:58:43 +01:00
|
|
|
|
2006-01-02 21:06:08 +00:00
|
|
|
//! Structure to hold the compilation tree nodes
|
2004-04-23 11:58:43 +01:00
|
|
|
struct tacnode
|
|
|
|
{
|
2006-01-02 21:06:08 +00:00
|
|
|
struct tacnode *next; //!< pointer to previous node
|
|
|
|
struct tacnode *prev; //!< pointer to next node
|
2004-04-23 11:58:43 +01:00
|
|
|
struct tacnode *allnext;
|
2006-01-02 21:06:08 +00:00
|
|
|
int op; //!< operator for this node
|
|
|
|
int lineno; //!< line number of parser location in the input file
|
2004-04-23 11:58:43 +01:00
|
|
|
union
|
|
|
|
{
|
2004-05-26 09:26:40 +01:00
|
|
|
Symbol sym;
|
|
|
|
struct tacnode *tac;
|
|
|
|
char *str;
|
2006-01-02 16:05:53 +00:00
|
|
|
int value;
|
2004-05-26 09:26:40 +01:00
|
|
|
} t1;
|
2004-08-09 11:05:58 +01:00
|
|
|
union
|
2004-04-23 11:58:43 +01:00
|
|
|
{
|
2004-05-26 09:26:40 +01:00
|
|
|
Symbol sym;
|
|
|
|
struct tacnode *tac;
|
|
|
|
char *str;
|
2006-01-02 16:05:53 +00:00
|
|
|
int value;
|
2004-05-26 09:26:40 +01:00
|
|
|
} t2;
|
2004-04-23 11:58:43 +01:00
|
|
|
union
|
|
|
|
{
|
2004-05-26 09:26:40 +01:00
|
|
|
Symbol sym;
|
|
|
|
struct tacnode *tac;
|
|
|
|
char *str;
|
2006-01-02 16:05:53 +00:00
|
|
|
int value;
|
2004-05-26 09:26:40 +01:00
|
|
|
} t3;
|
2004-04-23 11:58:43 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
typedef struct tacnode *Tac;
|
|
|
|
|
|
|
|
void tacInit (void);
|
|
|
|
void tacDone (void);
|
2012-11-23 10:55:29 +00:00
|
|
|
Tac tacCopy(Tac c);
|
2004-04-23 11:58:43 +01:00
|
|
|
Tac tacCreate (int op);
|
|
|
|
Tac tacSymb (char *s);
|
|
|
|
Tac tacJoin (int op, Tac t1, Tac t2, Tac t3);
|
|
|
|
Tac tacTuple (Tac taclist);
|
|
|
|
Tac tacCat (Tac t1, Tac t2);
|
|
|
|
void tacPrint (Tac t);
|
|
|
|
|
|
|
|
#endif
|