src/sync_fsm.h
author Volker Birk <vb@pep-project.org>
Thu, 12 May 2016 20:03:58 +0200
changeset 618 32fe7c8bee51
parent 613 d59da438b2cb
child 623 533a7fcc423b
permissions -rw-r--r--
adding newline at the end
     1 #pragma once
     2 
     3 // state machine for DeviceState
     4 
     5 #include "pEpEngine.h"
     6 
     7 // types
     8 
     9 typedef pEp_identity * Identity;
    10 typedef stringlist_t * Stringlist;
    11 typedef union _param { const Identity partner; const stringlist_t *keylist; } param_t;
    12 
    13 // error values
    14 
    15 typedef enum _fsm_error {
    16     invalid_state = -1,
    17     invalid_event = -2
    18 } fsm_error;
    19 
    20 // states
    21 
    22 typedef enum _DeviceState_state {
    23     Sole, 
    24     HandshakingSole, 
    25     WaitForGroupKeys, 
    26     Grouped
    27 } DeviceState_state;
    28 
    29 // events
    30 
    31 typedef enum _DeviceState_event {
    32     KeyGen, 
    33     CannotDecrypt, 
    34     Beacon, 
    35     HandshakeRequest, 
    36     Init, 
    37     HandshakeRejected, 
    38     HandshakeAccepted, 
    39     ReceiveGroupKeys, 
    40     Cancel, 
    41     Reject
    42 } DeviceState_event;
    43 
    44 // actions
    45 
    46 void sendBeacon(const Identity partner);
    47 void sendHandshakeRequest(const Identity partner);
    48 void showHandshake(const Identity partner);
    49 void reject(const Identity partner);
    50 void storeGroupKeys(const Identity partner);
    51 void sendOwnKeys(const Identity partner);
    52 void transmitGroupKeys(const Identity partner);
    53 
    54 // driver
    55 
    56 void fsm_DeviceState_inject(PEP_SESSION session, DeviceState_event event);
    57