adding error status
authorVolker Birk <vb@pep-project.org>
Thu, 12 May 2016 00:23:23 +0200
changeset 604ba04c2bd81a1
parent 603 8bff69e425d3
child 605 70e80b27b624
child 606 cb3965eed567
adding error status
src/pEp_internal.h
src/sync.c
src/sync.h
src/sync_internal.h
     1.1 --- a/src/pEp_internal.h	Wed May 11 20:06:23 2016 +0200
     1.2 +++ b/src/pEp_internal.h	Thu May 12 00:23:23 2016 +0200
     1.3 @@ -68,6 +68,7 @@
     1.4  #include "keymanagement.h"
     1.5  #include "cryptotech.h"
     1.6  #include "transport.h"
     1.7 +#include "sync.h"
     1.8  
     1.9  #define NOT_IMPLEMENTED assert(0); return PEP_UNKNOWN_ERROR;
    1.10  
    1.11 @@ -115,6 +116,8 @@
    1.12      examine_identity_t examine_identity;
    1.13      void *examine_management;
    1.14      void *sync_obj;
    1.15 +    messageToSend_t messageToSend;
    1.16 +    showHandshake_t showHandshake;
    1.17  
    1.18      // runtime config
    1.19  
     2.1 --- a/src/sync.c	Wed May 11 20:06:23 2016 +0200
     2.2 +++ b/src/sync.c	Thu May 12 00:23:23 2016 +0200
     2.3 @@ -1,12 +1,9 @@
     2.4  #include "pEp_internal.h"
     2.5 -#include "sync_internal.h"
     2.6  
     2.7  #include <memory.h>
     2.8  #include <assert.h>
     2.9  
    2.10  
    2.11 -PEP_sync_callbacks_t PEP_sync_callbacks = { NULL, NULL };
    2.12 -
    2.13  DYNAMIC_API PEP_STATUS register_sync_callbacks(
    2.14          PEP_SESSION session,
    2.15          void *obj,
    2.16 @@ -15,15 +12,15 @@
    2.17      )
    2.18  {
    2.19      session->sync_obj = obj;
    2.20 -    PEP_sync_callbacks.messageToSend = messageToSend;
    2.21 -    PEP_sync_callbacks.showHandshake = showHandshake;
    2.22 +    session->messageToSend = messageToSend;
    2.23 +    session->showHandshake = showHandshake;
    2.24  
    2.25      return PEP_STATUS_OK;
    2.26  }
    2.27  
    2.28  DYNAMIC_API void unregister_sync_callbacks(PEP_SESSION session) {
    2.29      session->sync_obj = NULL;
    2.30 -    PEP_sync_callbacks.messageToSend = NULL;
    2.31 -    PEP_sync_callbacks.showHandshake = NULL;
    2.32 +    session->messageToSend = NULL;
    2.33 +    session->showHandshake = NULL;
    2.34  }
    2.35  
     3.1 --- a/src/sync.h	Wed May 11 20:06:23 2016 +0200
     3.2 +++ b/src/sync.h	Thu May 12 00:23:23 2016 +0200
     3.3 @@ -18,7 +18,7 @@
     3.4  //      msg (in)        message struct with message to send
     3.5  //
     3.6  //  return value:
     3.7 -//      must return PEP_STATUS_OK or any other value on error
     3.8 +//      PEP_STATUS_OK or any other value on error
     3.9  
    3.10  typedef PEP_STATUS (*messageToSend_t)(void *obj, const message *msg);
    3.11  
    3.12 @@ -35,14 +35,16 @@
    3.13  //      obj (in)        object handle (implementation defined)
    3.14  //      self (in)       own identity
    3.15  //      partner (in)    identity of partner
    3.16 +//      result (out)    result of handshake
    3.17  //
    3.18  //  return value:
    3.19 -//      result of handshake
    3.20 +//      PEP_STATUS_OK or any other value on error
    3.21  
    3.22 -typedef sync_handshake_result (*showHandshake_t)(
    3.23 +typedef PEP_STATUS (*showHandshake_t)(
    3.24          void *obj,
    3.25          const pEp_identity *self,
    3.26 -        const pEp_identity *partner
    3.27 +        const pEp_identity *partner,
    3.28 +        sync_handshake_result *result
    3.29      );
    3.30  
    3.31  
     4.1 --- a/src/sync_internal.h	Wed May 11 20:06:23 2016 +0200
     4.2 +++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
     4.3 @@ -1,11 +0,0 @@
     4.4 -#include "sync.h"
     4.5 -
     4.6 -typedef messageToSend_t sendHandshakeRequest_t;
     4.7 -
     4.8 -typedef struct _PEP_sync_callbacks_t {
     4.9 -    messageToSend_t messageToSend;
    4.10 -    showHandshake_t showHandshake;
    4.11 -} PEP_sync_callbacks_t;
    4.12 -
    4.13 -extern PEP_sync_callbacks_t PEP_sync_callbacks;
    4.14 -