ENGINE-139: now uses decrypt flags to mark detected sync messages ENGINE-139
authorEdouard Tisserant <edouard@pep-project.org>
Mon, 07 Nov 2016 14:14:10 +0100
branchENGINE-139
changeset 13555cc70d0bc348
parent 1354 4ab4bdbbd8d9
child 1356 ac3e66355937
child 2735 731b17a2e52f
ENGINE-139: now uses decrypt flags to mark detected sync messages
src/message_api.c
src/message_api.h
sync/gen_statemachine.ysl2
     1.1 --- a/src/message_api.c	Sun Nov 06 23:33:35 2016 +0100
     1.2 +++ b/src/message_api.c	Mon Nov 07 14:14:10 2016 +0100
     1.3 @@ -1414,7 +1414,9 @@
     1.4                      status == PEP_MESSAGE_DISCARDED) {
     1.5                      free_message(msg);
     1.6                      msg = NULL;
     1.7 -                    return status;
     1.8 +                    *flags |= (status == PEP_MESSAGE_DISCARDED) ?
     1.9 +                                PEP_decrypt_flag_discarded :
    1.10 +                                PEP_decrypt_flag_consumed;
    1.11                  }
    1.12                  else if (status != PEP_STATUS_OK) {
    1.13                      return status;
    1.14 @@ -1699,6 +1701,11 @@
    1.15                  status == PEP_MESSAGE_DISCARDED) {
    1.16                  free_message(msg);
    1.17                  msg = NULL;
    1.18 +                *flags |= (status == PEP_MESSAGE_DISCARDED) ?
    1.19 +                            PEP_decrypt_flag_discarded :
    1.20 +                            PEP_decrypt_flag_consumed;
    1.21 +
    1.22 +                status = decrypt_status;
    1.23              }
    1.24              else if (status != PEP_STATUS_OK){
    1.25                  goto pep_error;
     2.1 --- a/src/message_api.h	Sun Nov 06 23:33:35 2016 +0100
     2.2 +++ b/src/message_api.h	Mon Nov 07 14:14:10 2016 +0100
     2.3 @@ -157,7 +157,9 @@
     2.4  DYNAMIC_API PEP_color color_from_rating(PEP_rating rating);
     2.5  
     2.6  typedef enum _PEP_decrypt_flags {
     2.7 -    PEP_decrypt_flag_own_private_key = 0x1
     2.8 +    PEP_decrypt_flag_own_private_key = 0x1,
     2.9 +    PEP_decrypt_flag_consumed = 0x2,
    2.10 +    PEP_decrypt_flag_discarded = 0x4
    2.11  } PEP_decrypt_flags; 
    2.12  
    2.13  typedef unsigned int PEP_decrypt_flags_t;
     3.1 --- a/sync/gen_statemachine.ysl2	Sun Nov 06 23:33:35 2016 +0100
     3.2 +++ b/sync/gen_statemachine.ysl2	Mon Nov 07 14:14:10 2016 +0100
     3.3 @@ -207,8 +207,9 @@
     3.4      template "state"
     3.5      ||
     3.6      case «@name»:
     3.7 +        printf("State : «@name»\\\\n");
     3.8          switch (event) {
     3.9 -        `` if "not(event[@name='Init'])" |>> case Init: break;
    3.10 +        `` if "not(event[@name='Init'])" |>> case Init: printf("Event : Init\\\\n"); break;
    3.11          `` apply "event", 2
    3.12              default:
    3.13                  return («../@name»_state) invalid_event;
    3.14 @@ -220,6 +221,7 @@
    3.15      template "event"
    3.16      ||
    3.17      case «@name»:
    3.18 +    printf("Event : «@name»\\\\n");
    3.19      `` apply "action|transition|condition";
    3.20      `` if "name(*[position()=last()]) != 'transition'" |> break;
    3.21      ||