Qt 4.8
qt-4.8.6
src
gui
embedded
qtransportauthdefs_qws.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 QTRANSPORTAUTHDEFS_QWS_H
43
#define QTRANSPORTAUTHDEFS_QWS_H
44
45
#include <sys/types.h>
46
#include <string.h>
47
48
#include <QtCore/qglobal.h>
49
50
QT_BEGIN_HEADER
51
52
QT_BEGIN_NAMESPACE
53
54
QT_MODULE
(Gui)
55
56
#define QSXE_KEY_LEN 16
57
#define QSXE_MAGIC_BYTES 4
58
59
// Number of bytes of each message to authenticate. Just need to ensure
60
// that the command at the beginning hasn't been tampered with. This value
61
// does not matter for trusted transports.
62
#define AMOUNT_TO_AUTHENTICATE 200
63
64
#define AUTH_ID(k) ((unsigned char)(k[QSXE_KEY_LEN]))
65
#define AUTH_KEY(k) ((unsigned char *)(k))
66
67
// must be a largish -ve number under any endianess when cast as an int
68
const
unsigned
char
magic
[
QSXE_MAGIC_BYTES
] = { 0xBA, 0xD4, 0xD4, 0xBA };
69
const
int
magicInt
= 0xBAD4D4BA;
70
71
#define QSXE_KEYFILE "keyfile"
72
73
/*
74
Header in above format, less the magic bytes.
75
Useful for reading off the socket
76
*/
77
struct
AuthHeader
78
{
79
unsigned
char
len
;
80
unsigned
char
pad
;
81
unsigned
char
digest
[
QSXE_KEY_LEN
];
82
unsigned
char
id
;
83
unsigned
char
seq
;
84
};
85
86
/*
87
Header in a form suitable for authentication routines
88
*/
89
struct
AuthMessage
90
{
91
AuthMessage
()
92
{
93
::memset( authData, 0,
sizeof
(authData) );
94
::memcpy( pad_magic, magic,
QSXE_MAGIC_BYTES
);
95
}
96
unsigned
char
pad_magic[
QSXE_MAGIC_BYTES
];
97
union
{
98
AuthHeader
hdr
;
99
char
authData[
sizeof
(
AuthHeader
)];
100
};
101
char
payLoad[
AMOUNT_TO_AUTHENTICATE
];
102
};
103
107
struct
AuthCookie
108
{
109
unsigned
char
key
[
QSXE_KEY_LEN
];
110
unsigned
char
pad
;
111
unsigned
char
progId
;
112
};
113
114
/*
115
Auth data as written to the key file - SUPERSEDED by usr_key_entry
116
117
This is still used internally for some functions, ie the socket
118
related calls.
119
*/
120
struct
AuthRecord
121
{
122
union
{
123
AuthCookie
auth
;
124
char
data
[
sizeof
(
struct
AuthCookie
)];
125
};
126
time_t
change_time
;
127
};
128
148
struct
usr_key_entry
149
{
150
char
key
[
QSXE_KEY_LEN
];
151
ino_t
ino
;
152
dev_t
dev
;
153
};
154
155
164
struct
IdBlock
165
{
166
quint64
inode
;
167
quint64
device
;
168
unsigned
char
pad
;
169
unsigned
char
progId
;
170
unsigned
short
installId
;
171
unsigned
int
keyOffset
;
172
qint64
install_time
;
173
};
174
175
QT_END_NAMESPACE
176
177
QT_END_HEADER
178
179
#endif // QTRANSPORTAUTHDEFS_QWS_H
180
IdBlock::device
quint64 device
Definition:
qtransportauthdefs_qws.h:167
magic
const unsigned char magic[QSXE_MAGIC_BYTES]
Definition:
qtransportauthdefs_qws.h:68
IdBlock::progId
unsigned char progId
Definition:
qtransportauthdefs_qws.h:169
QT_END_NAMESPACE
#define QT_END_NAMESPACE
This macro expands to.
Definition:
qglobal.h:90
QT_MODULE
#define QT_MODULE(x)
Definition:
qglobal.h:2783
AuthRecord
Definition:
qtransportauthdefs_qws.h:120
QT_BEGIN_HEADER
#define QT_BEGIN_HEADER
Definition:
qglobal.h:136
AuthCookie::progId
unsigned char progId
Definition:
qtransportauthdefs_qws.h:111
AMOUNT_TO_AUTHENTICATE
#define AMOUNT_TO_AUTHENTICATE
Definition:
qtransportauthdefs_qws.h:62
AuthMessage
Definition:
qtransportauthdefs_qws.h:89
IdBlock
Data record for the manifest file.
Definition:
qtransportauthdefs_qws.h:164
AuthRecord::change_time
time_t change_time
Definition:
qtransportauthdefs_qws.h:126
QSXE_KEY_LEN
#define QSXE_KEY_LEN
Definition:
qtransportauthdefs_qws.h:56
IdBlock::installId
unsigned short installId
Definition:
qtransportauthdefs_qws.h:170
AuthHeader::id
unsigned char id
Definition:
qtransportauthdefs_qws.h:82
QT_BEGIN_NAMESPACE
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition:
qglobal.h:89
time_t
unsigned long time_t
Definition:
qfunctions_wince.h:274
quint64
unsigned __int64 quint64
Definition:
qglobal.h:943
AuthHeader::len
unsigned char len
Definition:
qtransportauthdefs_qws.h:79
usr_key_entry
This comes from the SXE kernel patch file include/linux/lidsif.
Definition:
qtransportauthdefs_qws.h:148
AuthHeader
Definition:
qtransportauthdefs_qws.h:77
AuthMessage::AuthMessage
AuthMessage()
Definition:
qtransportauthdefs_qws.h:91
data
static const char * data(const QByteArray &arr)
Definition:
qdbusmessage.cpp:60
qint64
__int64 qint64
Definition:
qglobal.h:942
AuthMessage::hdr
AuthHeader hdr
Definition:
qtransportauthdefs_qws.h:98
usr_key_entry::dev
dev_t dev
Definition:
qtransportauthdefs_qws.h:152
AuthCookie::pad
unsigned char pad
Definition:
qtransportauthdefs_qws.h:110
IdBlock::keyOffset
unsigned int keyOffset
Definition:
qtransportauthdefs_qws.h:171
AuthRecord::auth
AuthCookie auth
Definition:
qtransportauthdefs_qws.h:123
key
int key
Definition:
qkeysequence.cpp:395
AuthHeader::seq
unsigned char seq
Definition:
qtransportauthdefs_qws.h:83
IdBlock::pad
unsigned char pad
Definition:
qtransportauthdefs_qws.h:168
QSXE_MAGIC_BYTES
#define QSXE_MAGIC_BYTES
Definition:
qtransportauthdefs_qws.h:57
magicInt
const int magicInt
Definition:
qtransportauthdefs_qws.h:69
usr_key_entry::ino
ino_t ino
Definition:
qtransportauthdefs_qws.h:151
AuthCookie
Definition:
qtransportauthdefs_qws.h:107
AuthHeader::pad
unsigned char pad
Definition:
qtransportauthdefs_qws.h:80
IdBlock::install_time
qint64 install_time
Definition:
qtransportauthdefs_qws.h:172
QT_END_HEADER
#define QT_END_HEADER
Definition:
qglobal.h:137
AuthHeader::digest
unsigned char digest[QSXE_KEY_LEN]
Definition:
qtransportauthdefs_qws.h:81
IdBlock::inode
quint64 inode
Definition:
qtransportauthdefs_qws.h:166
Qt 4.8 Source Code Browser