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