process only valid messages sync
authorVolker Birk <vb@pep.foundation>
Thu, 23 Aug 2018 07:16:54 +0200
branchsync
changeset 287770189b383730
parent 2876 6ad08f60ae1b
child 2878 6163c699dd69
process only valid messages
sync/fsm.yml2
sync/gen_statemachine.ysl2
     1.1 --- a/sync/fsm.yml2	Thu Aug 23 07:07:31 2018 +0200
     1.2 +++ b/sync/fsm.yml2	Thu Aug 23 07:16:54 2018 +0200
     1.3 @@ -41,7 +41,7 @@
     1.4  
     1.5  // send network messages
     1.6  
     1.7 -decl send @name (type="unicast");
     1.8 +decl send @name;
     1.9  
    1.10  // a condition is for different cases
    1.11  
    1.12 @@ -50,7 +50,7 @@
    1.13  // some events have messages on the line signalling the event to the
    1.14  // communication partner
    1.15  
    1.16 -decl message @name (id);
    1.17 +decl message @name (id, type="anycast", security="trusted");
    1.18  
    1.19  // messages can have transmitted fields…
    1.20  
     2.1 --- a/sync/gen_statemachine.ysl2	Thu Aug 23 07:07:31 2018 +0200
     2.2 +++ b/sync/gen_statemachine.ysl2	Thu Aug 23 07:16:54 2018 +0200
     2.3 @@ -348,7 +348,7 @@
     2.4  
     2.5                  switch (message_type) {
     2.6                      // these messages are being broadcasted
     2.7 -                    `` for "fsm/message[@type='broadcast']" |>> case «../@name»__payload_PR_«yml:lcase(@name)»:
     2.8 +                    `` for "fsm/message[@type='broadcast']" |>> case «../@name»__payload_PR_«yml:mixedCase(@name)»:
     2.9                          status = _own_identities_retrieve(session, &channels, PEP_idf_not_for_«yml:lcase(@name)»);
    2.10                          if (status)
    2.11                              goto the_end;
    2.12 @@ -359,8 +359,9 @@
    2.13                          }
    2.14                          break;
    2.15  
    2.16 -                    // all other go anycast; previously used address is sticky (unicast)
    2.17 -                    default: {
    2.18 +                    // these go anycast; previously used address is sticky (unicast)
    2.19 +                    `` for "fsm/message[@type='anycast']" |>> case «../@name»__payload_PR_«yml:mixedCase(@name)»:
    2.20 +                    {
    2.21                          if (!session->«yml:lcase(@name)»_state.common.from `> |`|
    2.22                              (session->«yml:lcase(@name)»_state.common.from->flags &
    2.23                              PEP_idf_not_for_«yml:lcase(@name)»)) {
    2.24 @@ -395,6 +396,10 @@
    2.25                              }
    2.26                          }
    2.27                      }
    2.28 +
    2.29 +                    default:
    2.30 +                        status = PEP_«yml:ucase(@name)»_ILLEGAL_MESSAGE;
    2.31 +                        goto the_end;
    2.32                  }
    2.33  
    2.34                  for (identity_list *li = channels; li && li->ident ; li = li->next) {