many commands give a command list sync
authorVolker Birk <vb@pep-project.org>
Wed, 11 Dec 2019 17:31:50 +0100
branchsync
changeset 4260a5d462cd4724
parent 4259 082c9c5b144c
child 4261 7836981785d3
many commands give a command list
src/key_reset.c
sync/distribution.fsm
sync/fsm.yml2
sync/gen_messages.ysl2
     1.1 --- a/src/key_reset.c	Wed Dec 11 16:24:52 2019 +0100
     1.2 +++ b/src/key_reset.c	Wed Dec 11 17:31:50 2019 +0100
     1.3 @@ -718,7 +718,7 @@
     1.4          return PEP_ILLEGAL_VALUE;
     1.5  
     1.6      for (const keyreset_command_list *cl = command_list; cl && cl->command; cl = cl->next) {
     1.7 -        Commands_t *c = calloc(1, sizeof(Commands_t));
     1.8 +        Command_t *c = (Command_t *) calloc(1, sizeof(Command_t));
     1.9          assert(c);
    1.10          if (!c)
    1.11              goto enomem;
     2.1 --- a/sync/distribution.fsm	Wed Dec 11 16:24:52 2019 +0100
     2.2 +++ b/sync/distribution.fsm	Wed Dec 11 17:31:50 2019 +0100
     2.3 @@ -13,8 +13,10 @@
     2.4      fsm KeyReset 1 {
     2.5          message Commands 1 {
     2.6              auto Version version;
     2.7 -            field Identity ident;
     2.8 -            field Hash newkey;
     2.9 +            list Command commandlist {
    2.10 +                field Identity ident;
    2.11 +                field Hash newkey;
    2.12 +            }
    2.13          }
    2.14      }
    2.15  }
     3.1 --- a/sync/fsm.yml2	Wed Dec 11 16:24:52 2019 +0100
     3.2 +++ b/sync/fsm.yml2	Wed Dec 11 17:31:50 2019 +0100
     3.3 @@ -61,3 +61,7 @@
     3.4  
     3.5  decl auto < field >;
     3.6  
     3.7 +// … or list of fields
     3.8 +
     3.9 +decl list < field >;
    3.10 +
     4.1 --- a/sync/gen_messages.ysl2	Wed Dec 11 16:24:52 2019 +0100
     4.2 +++ b/sync/gen_messages.ysl2	Wed Dec 11 17:31:50 2019 +0100
     4.3 @@ -71,7 +71,7 @@
     4.4          EXPORTS «@name»;
     4.5          `` call "pEp_imports"
     4.6  
     4.7 -        `` apply "message", 0, mode=impl;
     4.8 +        `` apply "message//list|message", 0, mode=impl;
     4.9          «@name» ::= CHOICE {
    4.10          `` for "message" |> «yml:mixedCase(@name)» [APPLICATION «@id»] «@name»`if "position()!=last()" > ,`
    4.11          }
    4.12 @@ -84,9 +84,23 @@
    4.13      template "message", mode=impl
    4.14      ||
    4.15      «@name» ::= SEQUENCE {
    4.16 -    `` for "field|auto" |> «func:asn1name()» «func:asn1type()»`if "position()!=last()" > ,`
    4.17 +    `` apply "field|auto|list", mode=direct
    4.18      }
    4.19  
    4.20      ||
    4.21 +
    4.22 +    template "list", mode=impl
    4.23 +    ||
    4.24 +    «@type» ::= SEQUENCE {
    4.25 +    `` apply "field|auto|list", mode=direct
    4.26 +    }
    4.27 +
    4.28 +    ||
    4.29 +
    4.30 +    template "field|auto", mode=direct
    4.31 +        | «func:asn1name()» «func:asn1type()»`if "position()!=last()" > ,`
    4.32 +
    4.33 +    template "list", mode=direct
    4.34 +        | «func:asn1name()» SEQUENCE OF «func:asn1type()»`if "position()!=last()" > ,`
    4.35  }
    4.36