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