7 // this module is for being used WITHOUT the Transport API in transport.h
8 // DO NOT USE IT WHEN USING Transport API!
15 // messageToSend() - send a message
18 // obj (in) object handle (implementation defined)
19 // msg (in) message struct with message to send
22 // PEP_STATUS_OK or any other value on error
25 // the ownership of msg goes to the callee
27 typedef PEP_STATUS (*messageToSend_t)(void *obj, message *msg);
30 typedef enum _sync_handshake_result {
31 SYNC_HANDSHAKE_CANCEL = -1,
32 SYNC_HANDSHAKE_ACCEPTED = 0,
33 SYNC_HANDSHAKE_REJECTED = 1
34 } sync_handshake_result;
36 // showHandshake() - do a handshake by showing the handshake dialog
39 // obj (in) object handle (implementation defined)
40 // me (in) own identity
41 // partner (in) identity of partner
44 // PEP_STATUS_OK or any other value on error
47 // ownership of self and partner go to the callee
49 typedef PEP_STATUS (*showHandshake_t)(
56 // deliverHandshakeResult() - give the result of the handshake dialog
59 // session (in) session handle
60 // result (in) handshake result
62 DYNAMIC_API PEP_STATUS deliverHandshakeResult(
64 sync_handshake_result result
68 // inject_sync_msg - inject sync protocol message
71 // msg (in) message to inject
72 // management (in) application defined
75 // 0 if msg could be stored successfully or nonzero otherwise
77 typedef int (*inject_sync_msg_t)(void *msg, void *management);
80 // retrieve_next_sync_msg - receive next sync message
83 // management (in) application defined
86 // next message or NULL for termination
88 typedef void *(*retrieve_next_sync_msg_t)(void *management);
91 // register_sync_callbacks() - register adapter's callbacks
94 // session (in) session where to store obj handle
95 // obj (in) object handle (implementation defined)
96 // messageToSend (in) callback for sending message
97 // showHandshake (in) callback for doing the handshake
98 // retrieve_next_sync_msg (in) callback for receiving sync messages
101 // PEP_STATUS_OK or any other value on errror
104 // call that BEFORE you're using any other part of the engine
106 DYNAMIC_API PEP_STATUS register_sync_callbacks(
109 messageToSend_t messageToSend,
110 showHandshake_t showHandshake,
111 inject_sync_msg_t inject_sync_msg,
112 retrieve_next_sync_msg_t retrieve_next_sync_msg
116 // unregister_sync_callbacks() - unregister adapter's callbacks
119 // session (in) session where to store obj handle
121 DYNAMIC_API void unregister_sync_callbacks(PEP_SESSION session);
124 // do_sync_protocol - function to be run on an extra thread
127 // session pEp session to use
128 // retrieve_next_sync_msg pointer to retrieve_next_identity() callback
129 // which returns at least a valid address field in
130 // the identity struct
131 // management management data to give to keymanagement
132 // (implementation defined)
135 // PEP_STATUS_OK if thread has to terminate successfully or any other
139 // to ensure proper working of this library, a thread has to be started
140 // with this function immediately after initialization
141 // do_keymanagement() calls retrieve_next_identity(management)
143 DYNAMIC_API PEP_STATUS do_sync_protocol(