adding shutdown; adding DYNAMIC_API for sync_event functions sync
authorVolker Birk <vb@pep-project.org>
Fri, 15 Nov 2019 10:17:57 +0100
branchsync
changeset 4183df575bbbea75
parent 4178 01f8a8d5ee1b
child 4184 546cf967b080
adding shutdown; adding DYNAMIC_API for sync_event functions
src/pEpEngine.h
src/sync_api.c
sync/gen_statemachine.ysl2
     1.1 --- a/src/pEpEngine.h	Thu Nov 14 19:38:45 2019 +0100
     1.2 +++ b/src/pEpEngine.h	Fri Nov 15 10:17:57 2019 +0100
     1.3 @@ -168,6 +168,10 @@
     1.4  //
     1.5  //  return value:
     1.6  //      0 if event could be stored successfully or nonzero otherwise
     1.7 +//
     1.8 +//  caveat:
     1.9 +//      if ev is SHUTDOWN then the implementation has to be synchronous
    1.10 +//      and the shutdown must be immediate
    1.11  
    1.12  typedef int (*inject_sync_event_t)(SYNC_EVENT ev, void *management);
    1.13  
     2.1 --- a/src/sync_api.c	Thu Nov 14 19:38:45 2019 +0100
     2.2 +++ b/src/sync_api.c	Fri Nov 15 10:17:57 2019 +0100
     2.3 @@ -230,6 +230,9 @@
     2.4      if (!session)
     2.5          return PEP_ILLEGAL_VALUE;
     2.6  
     2.7 +    if (session->inject_sync_event)
     2.8 +        session->inject_sync_event((void *) SHUTDOWN, NULL);
     2.9 +
    2.10      identity_list *il = NULL;
    2.11      PEP_STATUS status = own_identities_retrieve(session, &il);
    2.12      if (status)
     3.1 --- a/sync/gen_statemachine.ysl2	Thu Nov 14 19:38:45 2019 +0100
     3.2 +++ b/sync/gen_statemachine.ysl2	Fri Nov 15 10:17:57 2019 +0100
     3.3 @@ -58,7 +58,7 @@
     3.4          //      event must be valid for fsm or None
     3.5          //      in case msg is given event will be calculated out of message
     3.6  
     3.7 -        «@name»_event_t *new_«@name»_event(«yml:ucase(@name)»_PR fsm, int event, «yml:ucase(@name)» *msg);
     3.8 +        DYNAMIC_API «@name»_event_t *new_«@name»_event(«yml:ucase(@name)»_PR fsm, int event, «yml:ucase(@name)» *msg);
     3.9  
    3.10          #define «yml:ucase(@name)»_TIMEOUT_EVENT new_«@name»_event(«@name»_PR_NOTHING, 0, NULL);
    3.11  
    3.12 @@ -68,7 +68,7 @@
    3.13          //  parameters:
    3.14          //      ev (in)         event to free
    3.15  
    3.16 -        void free_«@name»_event(«@name»_event_t *ev);
    3.17 +        DYNAMIC_API void free_«@name»_event(«@name»_event_t *ev);
    3.18  
    3.19  
    3.20          #ifdef __cplusplus
    3.21 @@ -89,7 +89,7 @@
    3.22          #include "«@name»_func.h"
    3.23          `` for "fsm" | #include "«@name»_fsm.h"
    3.24  
    3.25 -        «@name»_event_t *new_«@name»_event(«yml:ucase(@name)»_PR fsm, int event, «@name»_t *msg)
    3.26 +        DYNAMIC_API «@name»_event_t *new_«@name»_event(«yml:ucase(@name)»_PR fsm, int event, «@name»_t *msg)
    3.27          {
    3.28              «@name»_event_t *ev = («@name»_event_t *) calloc(1, sizeof(«@name»_event_t));
    3.29              assert(ev);
    3.30 @@ -113,7 +113,7 @@
    3.31              return ev;
    3.32          }
    3.33  
    3.34 -        void free_«@name»_event(«@name»_event_t *ev)
    3.35 +        DYNAMIC_API void free_«@name»_event(«@name»_event_t *ev)
    3.36          {
    3.37              if (ev) {
    3.38                  free_identity_list(ev->own_identities);