src/sync.h
author Volker Birk <vb@pep-project.org>
Tue, 03 May 2016 16:04:21 +0200
changeset 574 3c21749a79a6
parent 573 28b0d3154f0f
child 597 560c0caf14ef
permissions -rw-r--r--
reuse sendBeacon() for sendHandshakeRequest()
     1 #pragma once
     2 
     3 #include "message.h"
     4 
     5 
     6 // this module is for being used WITHOUT the Transport API in transport.h
     7 // DO NOT USE IT WHEN USING Transport API!
     8 
     9 
    10 #ifdef __cplusplus
    11 extern "C" {
    12 #endif
    13 
    14 // sendBeacon() - send a beacon message
    15 //
    16 //  parameters:
    17 //      beacon (in)     message struct with beacon message to send
    18 //
    19 //  return value:
    20 //      must return PEP_STATUS_OK or any other value on error
    21 
    22 typedef PEP_STATUS (*sendBeacon_t)(message beacon);
    23 
    24 
    25 typedef enum _sync_handshake_result {
    26     SYNC_HANDSHAKE_CANCEL = -1,
    27     SYNC_HANDSHAKE_ACCEPTED = 0,
    28     SYNC_HANDSHAKE_REJECTED = 1
    29 } sync_handshake_result;
    30 
    31 // showHandshake() - do a handshake and deliver the result
    32 //
    33 //  parameters:
    34 //      self (in)       own identity
    35 //      partner (in)    identity of partner
    36 //
    37 //  return value:
    38 //      result of handshake
    39 
    40 typedef sync_handshake_result (*showHandshake_t)(
    41         pEp_identity self,
    42         pEp_identity partner
    43     );
    44 
    45 
    46 // register_sync_callbacks() - register adapter's callbacks
    47 //
    48 //  parameters:
    49 //      sendBeacon (in)             callback for sending beacon
    50 //      showHandshake (in)          callback for doing the handshake
    51 //
    52 //  return value:
    53 //      PEP_STATUS_OK or any other value on errror
    54 //
    55 //  caveat:
    56 //      call that BEFORE you're using any other part of the engine
    57 
    58 DYNAMIC_API PEP_STATUS register_sync_callbacks(
    59         sendBeacon_t sendBeacon,
    60         showHandshake_t showHandshake
    61     );
    62 
    63 
    64 // unregister_sync_callbacks() - unregister adapter's callbacks
    65 
    66 DYNAMIC_API void unregister_sync_callbacks();
    67 
    68 
    69 #ifdef __cplusplus
    70 }
    71 #endif
    72