...
authorVolker Birk <vb@pep-project.org>
Sun, 15 May 2016 16:23:31 +0200
changeset 62664a89bd12469
parent 625 99e0c66655ad
child 627 ef1fdfde8ced
...
src/sync_driver.c
src/sync_fsm.h
sync/gen_actions_skeleton.ysl2
sync/gen_statemachine.ysl2
     1.1 --- a/src/sync_driver.c	Sun May 15 16:01:18 2016 +0200
     1.2 +++ b/src/sync_driver.c	Sun May 15 16:23:31 2016 +0200
     1.3 @@ -8,14 +8,10 @@
     1.4  {
     1.5      PEP_STATUS status = PEP_STATUS_OK;
     1.6  
     1.7 -    assert(session);
     1.8 -    if (!session)
     1.9 -        return PEP_ILLEGAL_VALUE;
    1.10 +    static DeviceState_state state = InitState;
    1.11 +    static Identity partner = NULL;
    1.12  
    1.13 -    static DeviceState_state fsm_state = InitState;
    1.14 -
    1.15 -    // working code
    1.16 -
    1.17 -
    1.18 +    state = fsm_DeviceState(state, event, partner);
    1.19      return status;
    1.20  }
    1.21 +
     2.1 --- a/src/sync_fsm.h	Sun May 15 16:01:18 2016 +0200
     2.2 +++ b/src/sync_fsm.h	Sun May 15 16:23:31 2016 +0200
     2.3 @@ -51,6 +51,14 @@
     2.4  PEP_STATUS sendOwnKeys(const Identity partner);
     2.5  PEP_STATUS transmitGroupKeys(const Identity partner);
     2.6  
     2.7 +// state machine
     2.8 +
     2.9 +DeviceState_state fsm_DeviceState(
    2.10 +        DeviceState_state state,
    2.11 +        DeviceState_event event,
    2.12 +        const Identity partner
    2.13 +    );
    2.14 +
    2.15  // driver
    2.16  
    2.17  PEP_STATUS fsm_DeviceState_inject(PEP_SESSION session, DeviceState_event event);
     3.1 --- a/sync/gen_actions_skeleton.ysl2	Sun May 15 16:01:18 2016 +0200
     3.2 +++ b/sync/gen_actions_skeleton.ysl2	Sun May 15 16:23:31 2016 +0200
     3.3 @@ -22,17 +22,13 @@
     3.4      {
     3.5          PEP_STATUS status = PEP_STATUS_OK;
     3.6  
     3.7 -        assert(session);
     3.8 -        if (!session)
     3.9 -            return PEP_ILLEGAL_VALUE;
    3.10 +        static «@name»_state state = InitState;
    3.11 +        static Identity partner = NULL;
    3.12  
    3.13 -        static DeviceState_state fsm_state = InitState;
    3.14 -
    3.15 -        // working code
    3.16 -
    3.17 -
    3.18 +        state = fsm_«@name»(state, event, partner);
    3.19          return status;
    3.20      }
    3.21 +
    3.22      ||
    3.23      ||
    3.24      // Actions for «@name» state machine
     4.1 --- a/sync/gen_statemachine.ysl2	Sun May 15 16:01:18 2016 +0200
     4.2 +++ b/sync/gen_statemachine.ysl2	Sun May 15 16:23:31 2016 +0200
     4.3 @@ -46,6 +46,14 @@
     4.4  
     4.5          `` for "func:distinctName(//action)" | PEP_STATUS «@name»(const Identity partner);
     4.6  
     4.7 +        // state machine
     4.8 +
     4.9 +        «@name»_state fsm_«@name»(
    4.10 +                «@name»_state state,
    4.11 +                «@name»_event event,
    4.12 +                const Identity partner
    4.13 +            );
    4.14 +
    4.15          // driver
    4.16  
    4.17          PEP_STATUS fsm_«@name»_inject(PEP_SESSION session, «@name»_event event);