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;
|
2004-08-14 16:59:14 +01:00
|
|
|
//! The pointer to the protocol (not defined yet?)
|
|
|
|
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;
|
|
|
|
|
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
|
|
|
|
*/
|
2004-08-15 13:24:27 +01:00
|
|
|
int 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;
|
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);
|
|
|
|
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
|