blob: bf35220d1b8b8a0fefa152d433d625c423318582 (
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
|
// Copyright 2005-2016 The Mumble Developers. All rights reserved.
// Use of this source code is governed by a BSD-style license
// that can be found in the LICENSE file at the root of the
// Mumble source tree or at <https://www.mumble.info/LICENSE>.
#ifndef MUMBLE_MUMBLE_SOCKETRPC_H_
#define MUMBLE_MUMBLE_SOCKETRPC_H_
#include <QtCore/QObject>
#include <QtCore/QString>
#include <QtCore/QVariant>
#include <QtCore/QXmlStreamReader>
#include <QtNetwork/QLocalSocket>
class QBuffer;
class QLocalServer;
class SocketRPCClient : public QObject {
private:
Q_OBJECT
Q_DISABLE_COPY(SocketRPCClient)
protected:
QLocalSocket *qlsSocket;
QXmlStreamReader qxsrReader;
QXmlStreamWriter qxswWriter;
QBuffer *qbBuffer;
QByteArray qbaOutput;
void processXml();
public:
SocketRPCClient(QLocalSocket *s, QObject *p = NULL);
public slots:
void disconnected();
void error(QLocalSocket::LocalSocketError);
void readyRead();
};
class SocketRPC : public QObject {
private:
Q_OBJECT
Q_DISABLE_COPY(SocketRPC)
protected:
QLocalServer *qlsServer;
public:
typedef QMap<QString, QVariant> ParameterMap;
SocketRPC(const QString &basename, QObject *p = NULL);
static bool send(const QString &basename, const QString &request, const ParameterMap ¶m = ParameterMap());
public slots:
void newConnection();
};
#endif
|