src/sync.h
branchkeysync
changeset 1043 f786ee22e281
parent 1003 e5eef6e5b153
child 1116 c9a03f2423c1
     1.1 --- a/src/sync.h	Tue Aug 16 19:20:20 2016 +0200
     1.2 +++ b/src/sync.h	Sat Aug 20 14:45:19 2016 +0200
     1.3 @@ -12,7 +12,7 @@
     1.4  extern "C" {
     1.5  #endif
     1.6  
     1.7 -// messageToSend() - send a beacon message
     1.8 +// messageToSend() - send a message
     1.9  //
    1.10  //  parameters:
    1.11  //      obj (in)        object handle (implementation defined)
    1.12 @@ -56,8 +56,8 @@
    1.13  // deliverHandshakeResult() - give the result of the handshake dialog
    1.14  //
    1.15  //  parameters:
    1.16 -//      session (in)    session handle
    1.17 -//      result (in)     handshake result
    1.18 +//      session (in)        session handle
    1.19 +//      result (in)         handshake result
    1.20  
    1.21  DYNAMIC_API PEP_STATUS deliverHandshakeResult(
    1.22          PEP_SESSION session,
    1.23 @@ -65,6 +65,29 @@
    1.24      );
    1.25  
    1.26  
    1.27 +// inject_sync_msg - inject sync protocol message
    1.28 +//
    1.29 +//  parameters:
    1.30 +//      msg (in)            message to inject
    1.31 +//      management (in)     application defined
    1.32 +//
    1.33 +//  return value:
    1.34 +//      0 if msg could be stored successfully or nonzero otherwise
    1.35 +
    1.36 +typedef int (*inject_sync_msg_t)(void *msg, void *management);
    1.37 +
    1.38 +
    1.39 +// retrieve_next_sync_msg - receive next sync message
    1.40 +//
    1.41 +//  parameters:
    1.42 +//      management (in)     application defined
    1.43 +//
    1.44 +//  return value:
    1.45 +//      next message or NULL for termination
    1.46 +
    1.47 +typedef void *(*retrieve_next_sync_msg_t)(void *management);
    1.48 +
    1.49 +
    1.50  // register_sync_callbacks() - register adapter's callbacks
    1.51  //
    1.52  //  parameters:
    1.53 @@ -72,6 +95,7 @@
    1.54  //      obj (in)                    object handle (implementation defined)
    1.55  //      messageToSend (in)          callback for sending message
    1.56  //      showHandshake (in)          callback for doing the handshake
    1.57 +//      retrieve_next_sync_msg (in) callback for receiving sync messages
    1.58  //
    1.59  //  return value:
    1.60  //      PEP_STATUS_OK or any other value on errror
    1.61 @@ -83,7 +107,9 @@
    1.62          PEP_SESSION session,
    1.63          void *obj,
    1.64          messageToSend_t messageToSend,
    1.65 -        showHandshake_t showHandshake
    1.66 +        showHandshake_t showHandshake,
    1.67 +        inject_sync_msg_t inject_sync_msg,
    1.68 +        retrieve_next_sync_msg_t retrieve_next_sync_msg
    1.69      );
    1.70  
    1.71  
    1.72 @@ -95,6 +121,31 @@
    1.73  DYNAMIC_API void unregister_sync_callbacks(PEP_SESSION session);
    1.74  
    1.75  
    1.76 +// do_sync_protocol - function to be run on an extra thread
    1.77 +//
    1.78 +//  parameters:
    1.79 +//      session                 pEp session to use
    1.80 +//      retrieve_next_sync_msg  pointer to retrieve_next_identity() callback
    1.81 +//                              which returns at least a valid address field in
    1.82 +//                              the identity struct
    1.83 +//      management              management data to give to keymanagement
    1.84 +//                              (implementation defined)
    1.85 +//
    1.86 +//  return value:
    1.87 +//      PEP_STATUS_OK if thread has to terminate successfully or any other
    1.88 +//      value on failure
    1.89 +//
    1.90 +//  caveat:
    1.91 +//      to ensure proper working of this library, a thread has to be started
    1.92 +//      with this function immediately after initialization
    1.93 +//      do_keymanagement() calls retrieve_next_identity(management)
    1.94 +
    1.95 +DYNAMIC_API PEP_STATUS do_sync_protocol(
    1.96 +        PEP_SESSION session,
    1.97 +        void *management
    1.98 +    );
    1.99 +
   1.100 +
   1.101  #ifdef __cplusplus
   1.102  }
   1.103  #endif