Qt 4.8
qt-4.8.6
src
gui
embedded
qtransportauth_qws_p.h
Go to the documentation of this file.
1
/****************************************************************************
2
**
3
** Copyright (C) 2014 Digia Plc and/or its subsidiary(-ies).
4
** Contact: http://www.qt-project.org/legal
5
**
6
** This file is part of the QtGui module of the Qt Toolkit.
7
**
8
** $QT_BEGIN_LICENSE:LGPL$
9
** Commercial License Usage
10
** Licensees holding valid commercial Qt licenses may use this file in
11
** accordance with the commercial license agreement provided with the
12
** Software or, alternatively, in accordance with the terms contained in
13
** a written agreement between you and Digia. For licensing terms and
14
** conditions see http://qt.digia.com/licensing. For further information
15
** use the contact form at http://qt.digia.com/contact-us.
16
**
17
** GNU Lesser General Public License Usage
18
** Alternatively, this file may be used under the terms of the GNU Lesser
19
** General Public License version 2.1 as published by the Free Software
20
** Foundation and appearing in the file LICENSE.LGPL included in the
21
** packaging of this file. Please review the following information to
22
** ensure the GNU Lesser General Public License version 2.1 requirements
23
** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
24
**
25
** In addition, as a special exception, Digia gives you certain additional
26
** rights. These rights are described in the Digia Qt LGPL Exception
27
** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
28
**
29
** GNU General Public License Usage
30
** Alternatively, this file may be used under the terms of the GNU
31
** General Public License version 3.0 as published by the Free Software
32
** Foundation and appearing in the file LICENSE.GPL included in the
33
** packaging of this file. Please review the following information to
34
** ensure the GNU General Public License version 3.0 requirements will be
35
** met: http://www.gnu.org/copyleft/gpl.html.
36
**
37
**
38
** $QT_END_LICENSE$
39
**
40
****************************************************************************/
41
42
#ifndef QTRANSPORTAUTH_QWS_P_H
43
#define QTRANSPORTAUTH_QWS_P_H
44
45
//
46
// W A R N I N G
47
// -------------
48
//
49
// This file is not part of the Qt API. It exists purely as an
50
// implementation detail. This header file may change from version to
51
// version without notice, or even be removed.
52
//
53
// We mean it.
54
//
55
56
#include <QtCore/qglobal.h>
57
58
#ifndef QT_NO_SXE
59
60
#include "
qtransportauth_qws.h
"
61
#include "
qtransportauthdefs_qws.h
"
62
#include "
qbuffer.h
"
63
64
#include <
qmutex.h
>
65
#include <
qdatetime.h
>
66
#include "private/qobject_p.h"
67
68
#include <QtCore/qcache.h>
69
70
QT_BEGIN_NAMESPACE
71
72
// Uncomment to generate debug output
73
// #define QTRANSPORTAUTH_DEBUG 1
74
75
#ifdef QTRANSPORTAUTH_DEBUG
76
void
hexstring(
char
*buf,
const
unsigned
char
*
key
,
size_t
sz );
77
#endif
78
79
// proj id for ftok usage in sxe
80
#define SXE_PROJ 10022
81
87
void
*
guaranteed_memset
(
void
*v,
int
c
,
size_t
n);
88
89
class
QUnixSocketMessage
;
90
96
#define QSXE_HEADER_LEN 24
97
119
#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN]))
120
#define AUTH_KEY(k) ((unsigned char *)(k))
121
122
#define AUTH_DATA(x) (unsigned char *)((x) + QSXE_HEADER_LEN)
123
#define AUTH_SPACE(x) ((x) + QSXE_HEADER_LEN)
124
#define QSXE_LEN_IDX 4
125
#define QSXE_KEY_IDX 6
126
#define QSXE_PROG_IDX 22
127
#define QSXE_SEQ_IDX 23
128
129
class
SxeRegistryLocker
:
public
QObject
130
{
131
Q_OBJECT
132
public
:
133
SxeRegistryLocker
(
QObject
* );
134
~SxeRegistryLocker
();
135
bool
success
()
const
{
return
m_success
; }
136
private
:
137
bool
m_success
;
138
QObject
*
m_reg
;
139
};
140
141
class
QTransportAuthPrivate
:
public
QObjectPrivate
142
{
143
Q_DECLARE_PUBLIC
(
QTransportAuth
)
144
public
:
145
QTransportAuthPrivate
();
146
~
QTransportAuthPrivate
();
147
148
const
unsigned
char
*getClientKey(
unsigned
char
progId );
149
void
invalidateClientKeyCache();
150
151
bool
keyInitialised
;
152
QString
m_logFilePath
;
153
QString
m_keyFilePath
;
154
QObject
*
m_packageRegistry
;
155
AuthCookie
authKey
;
156
QCache<unsigned char, char>
keyCache
;
157
QHash< QObject*, QIODevice*>
buffersByClient
;
158
QMutex
keyfileMutex
;
159
};
160
169
class
FAREnforcer
170
{
171
public
:
172
static
FAREnforcer
*getInstance();
173
void
logAuthAttempt(
QDateTime
time =
QDateTime::currentDateTime
() );
174
void
reset
();
175
176
#ifndef TEST_FAR_ENFORCER
177
private
:
178
#endif
179
FAREnforcer
();
180
FAREnforcer
(
const
FAREnforcer
& );
181
FAREnforcer
&operator=(
FAREnforcer
const
& );
182
183
static
const
QString
FARMessage
;
184
static
const
int
minutelyRate
;
185
static
const
QString
SxeTag
;
186
static
const
int
minute
;
187
188
QList<QDateTime>
authAttempts
;
189
};
190
191
QT_END_NAMESPACE
192
193
#endif // QT_NO_SXE
194
#endif // QTRANSPORTAUTH_QWS_P_H
195
c
unsigned char c[8]
Definition:
qnumeric_p.h:62
QT_END_NAMESPACE
#define QT_END_NAMESPACE
This macro expands to.
Definition:
qglobal.h:90
QMutex
The QMutex class provides access serialization between threads.
Definition:
qmutex.h:60
QTransportAuthPrivate::keyCache
QCache< unsigned char, char > keyCache
Definition:
qtransportauth_qws_p.h:156
QTransportAuthPrivate::keyInitialised
bool keyInitialised
Definition:
qtransportauth_qws_p.h:151
QCache< unsigned char, char >
reset
Q_CORE_EXPORT QTextStream & reset(QTextStream &s)
qdatetime.h
FAREnforcer::SxeTag
static const QString SxeTag
Definition:
qtransportauth_qws_p.h:185
qbuffer.h
SxeRegistryLocker::m_reg
QObject * m_reg
Definition:
qtransportauth_qws_p.h:138
QTransportAuthPrivate::m_keyFilePath
QString m_keyFilePath
Definition:
qtransportauth_qws_p.h:153
QTransportAuthPrivate
Definition:
qtransportauth_qws_p.h:141
QString
The QString class provides a Unicode character string.
Definition:
qstring.h:83
QHash
The QHash class is a template class that provides a hash-table-based dictionary.
Definition:
qdatastream.h:66
QObject
The QObject class is the base class of all Qt objects.
Definition:
qobject.h:111
SxeRegistryLocker::success
bool success() const
Definition:
qtransportauth_qws_p.h:135
QTransportAuthPrivate::authKey
AuthCookie authKey
Definition:
qtransportauth_qws_p.h:155
FAREnforcer::authAttempts
QList< QDateTime > authAttempts
Definition:
qtransportauth_qws_p.h:188
qtransportauthdefs_qws.h
SxeRegistryLocker::m_success
bool m_success
Definition:
qtransportauth_qws_p.h:137
qtransportauth_qws.h
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition:
qglobal.h:89
QTransportAuthPrivate::keyfileMutex
QMutex keyfileMutex
Definition:
qtransportauth_qws_p.h:158
SxeRegistryLocker::SxeRegistryLocker
SxeRegistryLocker(QObject *)
Definition:
qtransportauth_qws.cpp:167
FAREnforcer::minutelyRate
static const int minutelyRate
Definition:
qtransportauth_qws_p.h:184
SxeRegistryLocker::~SxeRegistryLocker
~SxeRegistryLocker()
Definition:
qtransportauth_qws.cpp:177
guaranteed_memset
void * guaranteed_memset(void *v, int c, size_t n)
Definition:
qtransportauth_qws.cpp:84
FAREnforcer::FARMessage
static const QString FARMessage
Definition:
qtransportauth_qws_p.h:183
QTransportAuthPrivate::m_packageRegistry
QObject * m_packageRegistry
Definition:
qtransportauth_qws_p.h:154
qmutex.h
Q_OBJECT
#define Q_OBJECT
Definition:
qobjectdefs.h:157
FAREnforcer
Enforces the False Authentication Rate.
Definition:
qtransportauth_qws_p.h:169
QTransportAuthPrivate::buffersByClient
QHash< QObject *, QIODevice * > buffersByClient
Definition:
qtransportauth_qws_p.h:157
Q_DECLARE_PUBLIC
#define Q_DECLARE_PUBLIC(Class)
Definition:
qglobal.h:2477
QDateTime
The QDateTime class provides date and time functions.
Definition:
qdatetime.h:216
FAREnforcer::minute
static const int minute
Definition:
qtransportauth_qws_p.h:186
key
int key
Definition:
qkeysequence.cpp:395
QDateTime::currentDateTime
static QDateTime currentDateTime()
Returns the current datetime, as reported by the system clock, in the local time zone.
Definition:
qdatetime.cpp:3138
QTransportAuthPrivate::m_logFilePath
QString m_logFilePath
Definition:
qtransportauth_qws_p.h:152
QObjectPrivate
Definition:
qobject_p.h:98
AuthCookie
Definition:
qtransportauthdefs_qws.h:107
QTransportAuth
Authenticate a message transport.
Definition:
qtransportauth_qws.h:69
SxeRegistryLocker
Definition:
qtransportauth_qws_p.h:129
QUnixSocketMessage
The QUnixSocketMessage class encapsulates a message sent or received through the QUnixSocket class...
Definition:
qunixsocket_p.h:92
QList< QDateTime >
Qt 4.8 Source Code Browser