aboutsummaryrefslogtreecommitdiff
path: root/c++-libbu++/src/gatscon/proxythread.h
blob: 4e01bf570e2325aea2d83206f5cc4030a9511c01 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
/*
 * Copyright (C) 2007-2013 Xagasoft, All rights reserved.
 *
 * This file is part of the libgats library and is released under the
 * terms of the license contained in the file LICENSE.
 */

#ifndef PROXY_THREAD_H
#define PROXY_THREAD_H

#include <QThread>

#include <bu/streamstack.h>
#include <gats/gatsstream.h>

class ProxyThread : public QThread
{
    Q_OBJECT;
public:
    ProxyThread( QObject *pParent, int iPortIn, const QByteArray &baHostOut,
            int iPortOut );
    virtual ~ProxyThread();

    class ProxyHostThread *pHost;

    void send( Gats::Object *pObj );

signals:
    void recv( Gats::Object *pObj );
    void gotConnection();

protected:
    virtual void run();

private:
    int iPortIn;
    QByteArray baHostOut;
    int iPortOut;

    Bu::StreamStack ssCli;
    Gats::GatsStream gsCli;
};

class ProxyHostThread : public QThread
{
    Q_OBJECT;
public:
    ProxyHostThread( QObject *pParent, ProxyThread *pClient );
    virtual ~ProxyHostThread();

    void send( Gats::Object *pObj );

    void setStream( Bu::Stream *pStr );

signals:
    void recv( Gats::Object *pObj );

protected:
    virtual void run();

private:
    ProxyThread *pClient;
    Bu::StreamStack ssHst;
    Gats::GatsStream gsHst;
};

#endif