test/include/SyncTests.h
author Volker Birk <vb@pep.foundation>
Thu, 23 Aug 2018 17:14:41 +0200
branchsync
changeset 2888 5359f8f5cc5c
parent 2887 c5ab1f6ad3ee
child 2899 63b619aef131
permissions -rw-r--r--
signalling of receiving sync message
     1 // This file is under GNU General Public License 3.0
     2 // see LICENSE.txt
     3 
     4 #ifndef SYNC_H
     5 #define SYNC_H
     6 
     7 #include <string>
     8 #include <thread>
     9 #include "EngineTestSessionSuite.h"
    10 #include "locked_queue.hh"
    11 #include "sync_api.h"
    12 #include "Sync_impl.h"
    13 
    14 using namespace std;
    15 
    16 class Sync_Adapter {
    17 public:
    18     utility::locked_queue< Sync_event_t * > q;
    19 
    20     void processing();
    21 
    22     static PEP_STATUS notifyHandshake(
    23             void *obj,
    24             pEp_identity *me,
    25             pEp_identity *partner,
    26             sync_handshake_signal signal
    27         );
    28     static int inject_sync_event(SYNC_EVENT ev, void *management);
    29     static Sync_event_t *retrieve_next_sync_event(void *management);
    30     static PEP_STATUS messageToSend(void *obj, struct _message *msg);
    31 
    32     static void sync_thread(PEP_SESSION session, Sync_Adapter *adapter);
    33 };
    34 
    35 class SyncTests : public EngineTestSessionSuite {
    36     public:
    37         SyncTests(string test_suite, string test_home_dir);
    38 
    39         void setup();
    40         void tear_down();
    41 
    42     private:
    43         Sync_Adapter adapter;
    44         PEP_SESSION sync = NULL;
    45         thread *sync_thread;
    46 
    47         void check_sync();
    48 };
    49 
    50 #endif