sync/fsm.yml2
author Volker Birk <vb@pep.foundation>
Wed, 29 Aug 2018 21:49:28 +0200
branchsync
changeset 2903 33549a7c7191
parent 2877 70189b383730
child 2907 92f22b19b09e
permissions -rw-r--r--
safeguards
krista@2271
     1
// This file is under GNU General Public License 3.0
krista@2271
     2
// see LICENSE.txt
krista@2271
     3
vb@2829
     4
// FSM Y language 1.2
krista@2271
     5
vb@2829
     6
// Copyleft (c) 2016, 2017, p≡p foundation
krista@2271
     7
krista@2271
     8
// Written by Volker Birk
krista@2271
     9
vb@2829
    10
decl version(major, minor);
vb@2829
    11
vb@2829
    12
// a protocol family has a name and an ID
vb@2829
    13
vb@2829
    14
decl protocol @name (id);
vb@2829
    15
vb@2829
    16
// each protocol in a family has a finite state machine
vb@2829
    17
vb@2829
    18
decl fsm< protocol >;
vb@2829
    19
vb@2829
    20
// a state has a name and a timeout; after the timeout the state machine will
vb@2829
    21
// be reset
vb@2829
    22
krista@2271
    23
decl state @name (timeout=0);
vb@2829
    24
vb@2829
    25
// events have names
vb@2829
    26
krista@2271
    27
decl event @name, on is event;
vb@2829
    28
vb@2830
    29
// external events can have IDs
vb@2830
    30
vb@2830
    31
decl external @name (id);
vb@2830
    32
vb@2829
    33
// a transistion moves the statemachine to another state
vb@2829
    34
krista@2271
    35
decl transition @target, go is transition;
vb@2829
    36
vb@2829
    37
// an action is executed; if an action name starts with 'send' then it is
vb@2829
    38
// sending a message
vb@2829
    39
krista@2271
    40
decl action @name, do is action;
vb@2829
    41
vb@2865
    42
// send network messages
vb@2865
    43
vb@2877
    44
decl send @name;
vb@2865
    45
vb@2829
    46
// a condition is for different cases
vb@2829
    47
krista@2271
    48
decl condition @name, if is condition;
vb@2829
    49
vb@2829
    50
// some events have messages on the line signalling the event to the
vb@2829
    51
// communication partner
vb@2829
    52
vb@2877
    53
decl message @name (id, type="anycast", security="trusted");
vb@2829
    54
vb@2829
    55
// messages can have transmitted fields…
vb@2829
    56
vb@2829
    57
decl field @type @name;
vb@2829
    58
vb@2829
    59
// … or automatically calculated fields…
vb@2829
    60
vb@2829
    61
decl auto < field >;
vb@2829
    62