src/sync.c
changeset 609 a22a400611ca
parent 604 ba04c2bd81a1
child 679 2210805af158
     1.1 --- a/src/sync.c	Thu May 12 10:45:54 2016 +0200
     1.2 +++ b/src/sync.c	Thu May 12 11:21:57 2016 +0200
     1.3 @@ -3,6 +3,8 @@
     1.4  #include <memory.h>
     1.5  #include <assert.h>
     1.6  
     1.7 +#include "sync_fsm.h"
     1.8 +
     1.9  
    1.10  DYNAMIC_API PEP_STATUS register_sync_callbacks(
    1.11          PEP_SESSION session,
    1.12 @@ -24,3 +26,29 @@
    1.13      session->showHandshake = NULL;
    1.14  }
    1.15  
    1.16 +PEP_STATUS deliverHandshakeResult(
    1.17 +        PEP_SESSION session,
    1.18 +        sync_handshake_result result
    1.19 +    )
    1.20 +{
    1.21 +    assert(session);
    1.22 +    if (!session)
    1.23 +        return PEP_ILLEGAL_VALUE;
    1.24 +
    1.25 +    switch (result) {
    1.26 +        case SYNC_HANDSHAKE_CANCEL:
    1.27 +            fsm_DeviceState_inject(session, Cancel);
    1.28 +            break;
    1.29 +        case SYNC_HANDSHAKE_ACCEPTED:
    1.30 +            fsm_DeviceState_inject(session, HandshakeAccepted);
    1.31 +            break;
    1.32 +        case SYNC_HANDSHAKE_REJECTED:
    1.33 +            fsm_DeviceState_inject(session, HandshakeRejected);
    1.34 +            break;
    1.35 +        default:
    1.36 +            return PEP_ILLEGAL_VALUE;
    1.37 +    }
    1.38 +
    1.39 +    return PEP_STATUS_OK;
    1.40 +}
    1.41 +