Qt 4.8
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 
51 
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 */
90 {
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 {
99  char authData[sizeof(AuthHeader)];
100  };
101  char payLoad[AMOUNT_TO_AUTHENTICATE];
102 };
103 
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 */
121 {
122  union {
124  char data[sizeof(struct AuthCookie)];
125  };
127 };
128 
149 {
151  ino_t ino;
152  dev_t dev;
153 };
154 
155 
164 struct IdBlock
165 {
168  unsigned char pad;
169  unsigned char progId;
170  unsigned short installId;
171  unsigned int keyOffset;
173 };
174 
176 
178 
179 #endif // QTRANSPORTAUTHDEFS_QWS_H
180 
const unsigned char magic[QSXE_MAGIC_BYTES]
unsigned char progId
#define QT_END_NAMESPACE
This macro expands to.
Definition: qglobal.h:90
#define QT_MODULE(x)
Definition: qglobal.h:2783
#define QT_BEGIN_HEADER
Definition: qglobal.h:136
unsigned char progId
#define AMOUNT_TO_AUTHENTICATE
Data record for the manifest file.
#define QSXE_KEY_LEN
unsigned short installId
unsigned char id
#define QT_BEGIN_NAMESPACE
This macro expands to.
Definition: qglobal.h:89
unsigned long time_t
unsigned __int64 quint64
Definition: qglobal.h:943
unsigned char len
This comes from the SXE kernel patch file include/linux/lidsif.
static const char * data(const QByteArray &arr)
__int64 qint64
Definition: qglobal.h:942
dev_t dev
unsigned char pad
unsigned int keyOffset
int key
unsigned char seq
unsigned char pad
#define QSXE_MAGIC_BYTES
const int magicInt
ino_t ino
unsigned char pad
#define QT_END_HEADER
Definition: qglobal.h:137
unsigned char digest[QSXE_KEY_LEN]