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