src/sync.h
author Krista Grothoff <krista@pep-project.org>
Sat, 24 Sep 2016 18:09:18 +0200
branchENGINE-27
changeset 1185 4b01328f3cf2
parent 690 3ae86b68fdfe
child 991 b230b6418b52
permissions -rw-r--r--
ENGINE-27: update_identity no longer pays attention to the input identity's fpr, but pulls one from elect_pubkey.
     1 #pragma once
     2 
     3 #include "message.h"
     4 #include "sync_fsm.h"
     5 
     6 
     7 // this module is for being used WITHOUT the Transport API in transport.h
     8 // DO NOT USE IT WHEN USING Transport API!
     9 
    10 
    11 #ifdef __cplusplus
    12 extern "C" {
    13 #endif
    14 
    15 // messageToSend() - send a beacon message
    16 //
    17 //  parameters:
    18 //      obj (in)        object handle (implementation defined)
    19 //      msg (in)        message struct with message to send
    20 //
    21 //  return value:
    22 //      PEP_STATUS_OK or any other value on error
    23 
    24 typedef PEP_STATUS (*messageToSend_t)(void *obj, const message *msg);
    25 
    26 
    27 typedef enum _sync_handshake_result {
    28     SYNC_HANDSHAKE_CANCEL = -1,
    29     SYNC_HANDSHAKE_ACCEPTED = 0,
    30     SYNC_HANDSHAKE_REJECTED = 1
    31 } sync_handshake_result;
    32 
    33 // showHandshake() - do a handshake by showing the handshake dialog
    34 //
    35 //  parameters:
    36 //      obj (in)        object handle (implementation defined)
    37 //      self (in)       own identity
    38 //      partner (in)    identity of partner
    39 //
    40 //  return value:
    41 //      PEP_STATUS_OK or any other value on error
    42 
    43 typedef PEP_STATUS (*showHandshake_t)(
    44         void *obj,
    45         const pEp_identity *self,
    46         const pEp_identity *partner
    47     );
    48 
    49 
    50 // deliverHandshakeResult() - give the result of the handshake dialog
    51 //
    52 //  parameters:
    53 //      session (in)    session handle
    54 //      result (in)     handshake result
    55 
    56 DYNAMIC_API PEP_STATUS deliverHandshakeResult(
    57         PEP_SESSION session,
    58         sync_handshake_result result
    59     );
    60 
    61 
    62 // register_sync_callbacks() - register adapter's callbacks
    63 //
    64 //  parameters:
    65 //      session (in)                session where to store obj handle
    66 //      obj (in)                    object handle (implementation defined)
    67 //      messageToSend (in)          callback for sending message
    68 //      showHandshake (in)          callback for doing the handshake
    69 //
    70 //  return value:
    71 //      PEP_STATUS_OK or any other value on errror
    72 //
    73 //  caveat:
    74 //      call that BEFORE you're using any other part of the engine
    75 
    76 DYNAMIC_API PEP_STATUS register_sync_callbacks(
    77         PEP_SESSION session,
    78         void *obj,
    79         messageToSend_t messageToSend,
    80         showHandshake_t showHandshake
    81     );
    82 
    83 
    84 // unregister_sync_callbacks() - unregister adapter's callbacks
    85 //
    86 //  parameters:
    87 //      session (in)                session where to store obj handle
    88 
    89 DYNAMIC_API void unregister_sync_callbacks(PEP_SESSION session);
    90 
    91 
    92 #ifdef __cplusplus
    93 }
    94 #endif
    95