src/sync.h
changeset 572 3077e2489dfe
child 573 28b0d3154f0f
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/src/sync.h	Tue May 03 15:50:40 2016 +0200
     1.3 @@ -0,0 +1,87 @@
     1.4 +#pragma once
     1.5 +
     1.6 +#include "message.h"
     1.7 +
     1.8 +
     1.9 +// this module is for being used WITHOUT the Transport API in transport.h
    1.10 +// DO NOT USE IT WHEN USING Transport API!
    1.11 +
    1.12 +
    1.13 +#ifdef __cplusplus
    1.14 +extern "C" {
    1.15 +#endif
    1.16 +
    1.17 +// sendBeacon() - send a beacon message
    1.18 +//
    1.19 +//  parameters:
    1.20 +//      beacon (in)     message struct with beacon message to send
    1.21 +//
    1.22 +//  return value:
    1.23 +//      must return PEP_STATUS_OK or any other value on error
    1.24 +
    1.25 +typedef PEP_STATUS (*sendBeacon_t)(message beacon);
    1.26 +
    1.27 +
    1.28 +// sendHandshakeRequest() - send a handshake request message
    1.29 +//
    1.30 +//  parameters:
    1.31 +//      request (in)    message struct with beacon message to send
    1.32 +//
    1.33 +//  return value:
    1.34 +//      must return PEP_STATUS_OK or any other value on error
    1.35 +
    1.36 +typedef PEP_STATUS (*sendHandshakeRequest_t)(message request);
    1.37 +
    1.38 +
    1.39 +typedef enum _sync_handshake_result {
    1.40 +    SYNC_HANDSHAKE_CANCEL = -1,
    1.41 +    SYNC_HANDSHAKE_ACCEPTED = 0,
    1.42 +    SYNC_HANDSHAKE_REJECTED = 1
    1.43 +} sync_handshake_result;
    1.44 +
    1.45 +// showHandshake() - do a handshake and deliver the result
    1.46 +//
    1.47 +//  parameters:
    1.48 +//      self (in)       own identity
    1.49 +//      partner (in)    identity of partner
    1.50 +//
    1.51 +//  return value:
    1.52 +//      result of handshake
    1.53 +
    1.54 +typedef sync_handshake_result (*showHandshake_t)(
    1.55 +        pEp_identity self,
    1.56 +        pEp_identity partner
    1.57 +    );
    1.58 +
    1.59 +
    1.60 +// register_sync_callbacks() - register adapter's callbacks
    1.61 +//
    1.62 +//  parameters:
    1.63 +//      session (in)                session handle
    1.64 +//      sendBeacon (in)             callback for sending beacon
    1.65 +//      sendHandshakeRequest (in)   callback for sending handshake request
    1.66 +//      showHandshake (in)          callback for doing the handshake
    1.67 +//
    1.68 +//  return value:
    1.69 +//      PEP_STATUS_OK or any other value on errror
    1.70 +
    1.71 +DYNAMIC_API PEP_STATUS register_sync_callbacks(
    1.72 +        PEP_SESSION session,
    1.73 +        sendBeacon_t sendBeacon,
    1.74 +        sendHandshakeRequest_t sendHandshakeRequest,
    1.75 +        showHandshake_t showHandshake
    1.76 +    );
    1.77 +
    1.78 +
    1.79 +// unregister_sync_callbacks() - unregister adapter's callbacks
    1.80 +//
    1.81 +//  parameters:
    1.82 +//      session (in)                session handle
    1.83 +
    1.84 +DYNAMIC_API void unregister_sync_callbacks(PEP_SESSION session);
    1.85 +
    1.86 +
    1.87 +#ifdef __cplusplus
    1.88 +}
    1.89 +#endif
    1.90 +