2004-07-24 16:05:20 +01:00
|
|
|
#ifndef ROLES
|
|
|
|
#define ROLES
|
|
|
|
|
2004-07-24 20:07:29 +01:00
|
|
|
#include "term.h"
|
|
|
|
#include "termmap.h"
|
|
|
|
#include "termlist.h"
|
2004-07-24 16:05:20 +01:00
|
|
|
#include "knowledge.h"
|
2004-07-24 20:07:29 +01:00
|
|
|
#include "constraint.h"
|
2004-07-24 16:05:20 +01:00
|
|
|
#include "states.h"
|
|
|
|
|
2004-08-09 11:05:58 +01:00
|
|
|
enum eventtype
|
|
|
|
{ READ, SEND, CLAIM };
|
2004-07-24 16:05:20 +01:00
|
|
|
|
|
|
|
//! The container for the claim info list
|
|
|
|
struct claimlist
|
|
|
|
{
|
2004-07-24 21:30:00 +01:00
|
|
|
//! The type of claim
|
|
|
|
Term type;
|
2004-07-24 16:05:20 +01:00
|
|
|
//! The term element for this node.
|
|
|
|
Term label;
|
2005-12-28 11:50:17 +00:00
|
|
|
//! Any parameters
|
|
|
|
Term parameter;
|
2004-10-14 14:19:36 +01:00
|
|
|
//! The pointer to the protocol (not defined typically, because
|
|
|
|
//! at compile time of the claim the protocol structure is not known yet.)
|
2004-08-14 16:59:14 +01:00
|
|
|
void *protocol;
|
2004-07-24 16:05:20 +01:00
|
|
|
//! The name of the role in which it occurs.
|
|
|
|
Term rolename;
|
2004-08-14 16:59:14 +01:00
|
|
|
//! The pointer to the role structure
|
|
|
|
void *role;
|
2004-08-14 20:19:23 +01:00
|
|
|
//! The pointer to the roledef
|
|
|
|
void *roledef;
|
2004-07-24 16:05:20 +01:00
|
|
|
//! Number of occurrences in system exploration.
|
|
|
|
states_t count;
|
|
|
|
//! Number of occurrences that failed.
|
|
|
|
states_t failed;
|
2004-08-19 14:09:35 +01:00
|
|
|
//! Whether the result is complete or not (failings always are!)
|
|
|
|
int complete;
|
2005-01-14 13:01:31 +00:00
|
|
|
//! If we ran into the time bound (incomplete, and bad for results)
|
|
|
|
int timebound;
|
2005-12-27 13:44:12 +00:00
|
|
|
//! Some claims are always true (shown by the initial scan)
|
|
|
|
int alwaystrue;
|
|
|
|
//! Warnings should tell you more
|
|
|
|
int warnings;
|
2004-08-19 14:09:35 +01:00
|
|
|
|
2004-08-09 11:05:58 +01:00
|
|
|
int r; //!< role number for mapping
|
|
|
|
int ev; //!< event index in role
|
2004-07-24 16:05:20 +01:00
|
|
|
//! Preceding label list
|
|
|
|
Termlist prec;
|
2004-08-27 13:36:23 +01:00
|
|
|
//! Roles that are involved (nameterms)
|
|
|
|
Termlist roles;
|
2004-07-24 16:05:20 +01:00
|
|
|
//! Next node pointer or NULL for the last element of the function.
|
|
|
|
struct claimlist *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Shorthand for claimlist pointers.
|
|
|
|
typedef struct claimlist *Claimlist;
|
|
|
|
|
|
|
|
//! Structure for a role event node or list.
|
|
|
|
/**
|
|
|
|
*\sa role
|
|
|
|
*/
|
|
|
|
struct roledef
|
|
|
|
{
|
|
|
|
//! flag for internal actions.
|
|
|
|
/**
|
|
|
|
* Typically, this is true to signify internal reads (e.g. variable choices)
|
|
|
|
* as opposed to a normal read.
|
|
|
|
*/
|
|
|
|
int internal;
|
|
|
|
//! Type of event.
|
|
|
|
/**
|
|
|
|
*\sa READ, SEND, CLAIM
|
|
|
|
*/
|
|
|
|
int type;
|
|
|
|
//! Event label.
|
|
|
|
Term label;
|
|
|
|
//! Event sender.
|
|
|
|
Term from;
|
|
|
|
//! Event target.
|
|
|
|
Term to;
|
|
|
|
//! Event message.
|
|
|
|
Term message;
|
|
|
|
//! Pointer to next roledef node.
|
|
|
|
struct roledef *next;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Substructure for reads
|
|
|
|
*/
|
|
|
|
//! Illegal injections for this event.
|
2004-07-24 21:30:00 +01:00
|
|
|
/**
|
|
|
|
* For send this means that the send is allowed if it is NULL, otherwise it is blocked.
|
|
|
|
*/
|
2004-07-24 16:05:20 +01:00
|
|
|
Knowledge forbidden;
|
|
|
|
//! knowledge transitions counter.
|
|
|
|
int knowPhase;
|
|
|
|
|
|
|
|
/*
|
|
|
|
* Substructure for claims
|
|
|
|
*/
|
|
|
|
//! Pointer to claim type info
|
|
|
|
Claimlist claiminfo;
|
|
|
|
|
2004-08-10 16:17:00 +01:00
|
|
|
/*
|
|
|
|
* Bindings for Arachne engine
|
|
|
|
*/
|
2006-01-02 21:06:08 +00:00
|
|
|
int bound; //!< determines whether it is already bound
|
2004-08-10 16:17:00 +01:00
|
|
|
|
2004-07-24 16:05:20 +01:00
|
|
|
/* evt runid for synchronisation, but that is implied in the
|
|
|
|
base array */
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Shorthand for roledef pointer.
|
|
|
|
typedef struct roledef *Roledef;
|
|
|
|
|
|
|
|
//! Role definition.
|
|
|
|
/**
|
|
|
|
*\sa roledef
|
|
|
|
*/
|
|
|
|
struct role
|
|
|
|
{
|
|
|
|
//! Name of the role encoded in a term.
|
|
|
|
Term nameterm;
|
|
|
|
//! List of role events.
|
|
|
|
Roledef roledef;
|
|
|
|
//! Local constants for this role.
|
|
|
|
Termlist locals;
|
2004-08-12 10:14:31 +01:00
|
|
|
//! Local variables for this role.
|
|
|
|
Termlist variables;
|
2005-12-28 11:50:17 +00:00
|
|
|
//! Declared constants for this role
|
|
|
|
Termlist declaredconsts;
|
2005-12-27 13:44:12 +00:00
|
|
|
//! Declared variables for this role
|
|
|
|
Termlist declaredvars;
|
2005-09-09 11:05:29 +01:00
|
|
|
//! Flag for initiator roles
|
|
|
|
int initiator;
|
2006-01-02 16:05:53 +00:00
|
|
|
//! Flag for singular roles
|
|
|
|
int singular;
|
2004-07-24 16:05:20 +01:00
|
|
|
//! Pointer to next role definition.
|
|
|
|
struct role *next;
|
|
|
|
};
|
|
|
|
|
|
|
|
//! Shorthand for role pointer.
|
|
|
|
typedef struct role *Role;
|
|
|
|
|
|
|
|
void roledefPrint (Roledef rd);
|
2004-10-28 13:56:13 +01:00
|
|
|
void roledefPrintShort (Roledef rd);
|
2004-07-24 16:05:20 +01:00
|
|
|
Roledef roledefDuplicate1 (const Roledef rd);
|
|
|
|
Roledef roledefDuplicate (Roledef rd);
|
|
|
|
void roledefDelete (Roledef rd);
|
|
|
|
void roledefDestroy (Roledef rd);
|
2004-08-09 11:05:58 +01:00
|
|
|
Roledef roledefInit (int type, Term label, Term from, Term to, Term msg,
|
|
|
|
Claimlist cl);
|
|
|
|
Roledef roledefAdd (Roledef rd, int type, Term label, Term from, Term to,
|
|
|
|
Term msg, Claimlist cl);
|
2004-07-24 16:05:20 +01:00
|
|
|
Role roleCreate (Term nameterm);
|
|
|
|
void rolePrint (Role r);
|
|
|
|
void rolesPrint (Role r);
|
2004-08-12 10:14:31 +01:00
|
|
|
int roledef_iterate_events (Roledef rd, int (*func) ());
|
2004-08-12 12:22:49 +01:00
|
|
|
int roledef_length (const Roledef rd);
|
|
|
|
Roledef roledef_shift (Roledef rd, int i);
|
2004-07-24 16:05:20 +01:00
|
|
|
|
|
|
|
#endif
|