Computer Laboratory

libtesla.h File Reference
#include <stdint.h>
+ Include dependency graph for libtesla.h:
+ This graph shows which files directly or indirectly include this file:

Go to the source code of this file.

Classes

struct  tesla_transition
 A single allowable transition in a TESLA automaton. More...
 
struct  tesla_transitions
 A set of permissible state transitions for an automata instance. More...
 
struct  tesla_key
 A TESLA instance can be identified by a tesla_class and a tesla_key. More...
 
struct  tesla_instance
 A single instance of an automaton: a name (ti_key) and a state. More...
 
struct  tesla_event_handlers
 A vector of event handlers. More...
 
struct  tesla_event_metahandler
 A 'meta-handler' that wraps a number of event handling vectors. More...
 

Macros

#define TESLA_TRANS_INIT   0x02 /* May need to initialise the class. */
 
#define TESLA_TRANS_CLEANUP   0x04 /* Clean up the class now. */
 
#define TESLA_KEY_SIZE   4
 

Typedefs

typedef void(* tesla_ev_new_instance )(struct tesla_class *, struct tesla_instance *)
 A new tesla_instance has been created. More...
 
typedef void(* tesla_ev_transition )(struct tesla_class *, struct tesla_instance *, const struct tesla_transition *)
 A tesla_instance has taken a transition. More...
 
typedef void(* tesla_ev_clone )(struct tesla_class *, struct tesla_instance *orig, struct tesla_instance *copy, const struct tesla_transition *)
 An exisiting tesla_instance has been cloned because of an event. More...
 
typedef void(* tesla_ev_no_instance )(struct tesla_class *, const struct tesla_key *, const struct tesla_transitions *)
 No tesla_class instance was found to match a tesla_key. More...
 
typedef void(* tesla_ev_bad_transition )(struct tesla_class *, struct tesla_instance *, const struct tesla_transitions *)
 A tesla_instance is not in the right state to take a transition. More...
 
typedef void(* tesla_ev_error )(struct tesla_class *, int32_t, const char *)
 Generic error handler. More...
 
typedef void(* tesla_ev_accept )(struct tesla_class *, struct tesla_instance *)
 A tesla_instance has accepted a sequence of events. More...
 
typedef void(* tesla_ev_ignored )(const struct tesla_class *, const struct tesla_key *, const struct tesla_transitions *)
 An event is being ignored. More...
 

Enumerations

enum  tesla_err_t {
  TESLA_SUCCESS, TESLA_ERROR_ENOENT, TESLA_ERROR_ENOMEM, TESLA_ERROR_EINVAL,
  TESLA_ERROR_UNKNOWN
}
 Error values that can be returned by libtesla functions. More...
 
enum  tesla_context { TESLA_CONTEXT_GLOBAL, TESLA_CONTEXT_THREAD }
 A context where TESLA data is stored. More...
 

Functions

const char * tesla_strerror (int32_t error)
 Provide string versions of TESLA errors. More...
 
int32_t tesla_store_get (enum tesla_context context, uint32_t classes, uint32_t instances, struct tesla_store **store)
 Retrieve the tesla_store for a context (e.g., a thread). More...
 
int32_t tesla_class_get (struct tesla_store *store, uint32_t id, struct tesla_class **tclass, const char *name, const char *description)
 Retrieve (or create) a tesla_class from a tesla_store. More...
 
void tesla_class_put (struct tesla_class *)
 Release resources (e.g., locks) associated with a tesla_class. More...
 
void tesla_update_state (enum tesla_context context, uint32_t class_id, const struct tesla_key *key, const char *name, const char *description, const struct tesla_transitions *)
 Update all automata instances that match a given key to a new state. More...
 
int tesla_set_event_handler (struct tesla_event_handlers *)
 Register an event handler vector. More...
 
int tesla_set_event_handlers (struct tesla_event_metahandler *)
 Register a set of event handling vectors. More...