More teaks in sync proto codec gen
authorEdouard Tisserant
Thu, 12 May 2016 19:18:14 +0200
changeset 61552c1a857e73e
parent 614 6bf3b8a6fb1b
child 616 6d4ea9ea1016
More teaks in sync proto codec gen
src/sync_codec.c
sync/gen_codec.ysl2
     1.1 --- a/src/sync_codec.c	Thu May 12 18:26:34 2016 +0200
     1.2 +++ b/src/sync_codec.c	Thu May 12 19:18:14 2016 +0200
     1.3 @@ -4,12 +4,12 @@
     1.4  
     1.5  // decoders
     1.6  
     1.7 -void decodeBeacon(const char **bufp, size_t *sizep);
     1.8 -void decodeHandshakeRequest(const char **bufp, size_t *sizep, Identity partner);
     1.9 -void decodeOwnKeys(const char **bufp, size_t *sizep, Stringlist *ownKeys);
    1.10 +void readBeacon(const char *buf, size_t size);
    1.11 +void readHandshakeRequest(const char *buf, size_t size, Identity partner);
    1.12 +void readOwnKeys(const char *buf, size_t size, Stringlist *ownKeys);
    1.13  
    1.14  // encoders 
    1.15  
    1.16 -void encodeBeacon(const char **bufp, size_t *sizep);
    1.17 -void encodeHandshakeRequest(const char **bufp, size_t *sizep, Identity partner);
    1.18 -void encodeOwnKeys(const char **bufp, size_t *sizep, Stringlist *ownKeys);
    1.19 +void createBeacon(const char **bufp, size_t *sizep);
    1.20 +void createHandshakeRequest(const char **bufp, size_t *sizep, Identity partner);
    1.21 +void createOwnKeys(const char **bufp, size_t *sizep, Stringlist *ownKeys);
    1.22 \ No newline at end of file
     2.1 --- a/sync/gen_codec.ysl2	Thu May 12 18:26:34 2016 +0200
     2.2 +++ b/sync/gen_codec.ysl2	Thu May 12 19:18:14 2016 +0200
     2.3 @@ -10,21 +10,29 @@
     2.4      variable "UniqueActions", "/protocol/fsm/state/event//action[generate-id()=generate-id(key('ActionByNames',@name)[1])]";
     2.5      variable "UniqueSendActions", "$UniqueActions[starts-with(@name,'send')]";
     2.6  
     2.7 -    template "/protocol"
     2.8 -    ||
     2.9 -    // encoders and decoders state for «@name» protocol
    2.10 +    template "/protocol" {
    2.11 +        ||
    2.12 +        // encoders and decoders state for «@name» protocol
    2.13  
    2.14 -    #include "pEpEngine.h"
    2.15 +        #include "pEpEngine.h"
    2.16  
    2.17 -    // decoders
    2.18 +        // decoders
    2.19  
    2.20 -    `` apply "$UniqueSendActions",0 mode="proto" with "pfx", "'decode'"
    2.21 +        ||
    2.22 +        apply "$UniqueSendActions",0 mode="proto" {
    2.23 +            with "pfx", "'read'";
    2.24 +            with "baseParms" > const char *buf, size_t size
    2.25 +        }
    2.26 +        ||
    2.27  
    2.28 -    // encoders 
    2.29 +        // encoders 
    2.30  
    2.31 -    `` apply "$UniqueSendActions",0 mode="proto" with "pfx", "'encode'"
    2.32 -
    2.33 -    ||
    2.34 +        ||
    2.35 +        apply "$UniqueSendActions",0 mode="proto" {
    2.36 +            with "pfx", "'create'";
    2.37 +            with "baseParms" > const char **bufp, size_t *sizep
    2.38 +        }
    2.39 +    }
    2.40  
    2.41      def "xsl:typeOfActionParam" {
    2.42          param "n", "name(.)";
    2.43 @@ -52,16 +60,21 @@
    2.44  
    2.45      template "action", mode="func_header" {
    2.46          param "pfx";
    2.47 +        param "baseParms";
    2.48          variable "ifaceName", "substring-after(@name, 'send')";
    2.49  
    2.50 -        > void «$pfx»«$ifaceName»(const char **bufp, size_t *sizep
    2.51 +        > void «$pfx»«$ifaceName»(«$baseParms»
    2.52          call("interfaces_params") with "ifaceName", "$ifaceName";
    2.53          > )
    2.54      }
    2.55  
    2.56      template "action", mode="proto" {
    2.57          param "pfx";
    2.58 -        apply ".",0 mode="func_header" with "pfx", "$pfx" ;
    2.59 +        param "baseParms";
    2.60 +        apply ".",0 mode="func_header" {
    2.61 +            with "pfx", "$pfx" ;
    2.62 +            with "baseParms", "$baseParms" ;
    2.63 +        }
    2.64          | ;
    2.65      }
    2.66  }