QtGui/qtransportauthdefs_qws.h Source File

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  };
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  };
126  time_t change_time;
127 };
128 
146 {
148  ino_t ino;
149  dev_t dev;
150 };
151 
152 
158 struct IdBlock
159 {
162  unsigned char pad;
163  unsigned char progId;
164  unsigned short installId;
165  unsigned int keyOffset;
167 };
168 
170 
172 
173 #endif // QTRANSPORTAUTHDEFS_QWS_H
174 
const unsigned char magic[QSXE_MAGIC_BYTES]
#define QT_END_NAMESPACE
Definition: qglobal.h:128
char authData[sizeof(AuthHeader)]
#define QT_BEGIN_HEADER
Definition: qglobal.h:141
#define AMOUNT_TO_AUTHENTICATE
unsigned int keyOffset
long long qint64
Definition: qglobal.h:947
#define QSXE_KEY_LEN
unsigned long long quint64
Definition: qglobal.h:948
unsigned char pad_magic[QSXE_MAGIC_BYTES]
Data record for the manifest file.
#define QT_BEGIN_NAMESPACE
Definition: qglobal.h:127
GLsizei GLsizei GLenum GLenum const GLvoid * data
Definition: GLee.h:880
dev_t dev
This comes from the SXE kernel patch file include/linux/lidsif.h.
unsigned char progId
unsigned char pad
unsigned short installId
unsigned char len
unsigned char digest[QSXE_KEY_LEN]
#define QSXE_MAGIC_BYTES
unsigned char id
unsigned char seq
const int magicInt
char key[QSXE_KEY_LEN]
unsigned char pad
#define QT_END_HEADER
Definition: qglobal.h:142
char payLoad[AMOUNT_TO_AUTHENTICATE]
ino_t ino