source: trunk/src/gui/embedded/qtransportauthdefs_qws.h@ 742

Last change on this file since 742 was 651, checked in by Dmitry A. Kuminov, 16 years ago

trunk: Merged in qt 4.6.2 sources.

  • Property svn:eol-style set to native
File size: 4.7 KB
Line 
1/****************************************************************************
2**
3** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
4** All rights reserved.
5** Contact: Nokia Corporation ([email protected])
6**
7** This file is part of the QtGui module of the Qt Toolkit.
8**
9** $QT_BEGIN_LICENSE:LGPL$
10** Commercial Usage
11** Licensees holding valid Qt Commercial licenses may use this file in
12** accordance with the Qt Commercial License Agreement provided with the
13** Software or, alternatively, in accordance with the terms contained in
14** a written agreement between you and Nokia.
15**
16** GNU Lesser General Public License Usage
17** Alternatively, this file may be used under the terms of the GNU Lesser
18** General Public License version 2.1 as published by the Free Software
19** Foundation and appearing in the file LICENSE.LGPL included in the
20** packaging of this file. Please review the following information to
21** ensure the GNU Lesser General Public License version 2.1 requirements
22** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
23**
24** In addition, as a special exception, Nokia gives you certain additional
25** rights. These rights are described in the Nokia Qt LGPL Exception
26** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
27**
28** GNU General Public License Usage
29** Alternatively, this file may be used under the terms of the GNU
30** General Public License version 3.0 as published by the Free Software
31** Foundation and appearing in the file LICENSE.GPL included in the
32** packaging of this file. Please review the following information to
33** ensure the GNU General Public License version 3.0 requirements will be
34** met: http://www.gnu.org/copyleft/gpl.html.
35**
36** If you have questions regarding the use of this file, please contact
37** Nokia at [email protected].
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
50QT_BEGIN_HEADER
51
52QT_BEGIN_NAMESPACE
53
54QT_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
68const unsigned char magic[QSXE_MAGIC_BYTES] = { 0xBA, 0xD4, 0xD4, 0xBA };
69const 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*/
77struct 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*/
89struct 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
104/**
105 Auth data as stored in _key
106*/
107struct 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*/
120struct AuthRecord
121{
122 union {
123 AuthCookie auth;
124 char data[sizeof(struct AuthCookie)];
125 };
126 time_t change_time;
127};
128
129/*!
130 \class usr_key_entry
131 This comes from the SXE kernel patch file include/linux/lidsif.h
132
133 This is the (new) data record for the key file (version 2).
134
135 The key file is (now) either /proc/lids/keys (and the per-process
136 keys in /proc/<pid>/lids_key) OR for desktop/development ONLY (not
137 for production) it is $QPEDIR/etc/keyfile
138
139 The key file maps keys to files.
140
141 File are identified by inode and device numbers, not paths.
142
143 (See the "installs" file for path to inode/device mapping)
144*/
145struct usr_key_entry
146{
147 char key[QSXE_KEY_LEN];
148 ino_t ino;
149 dev_t dev;
150};
151
152
153/*!
154 \class IdBlock
155 \brief Data record for the manifest file.
156 The manifest file maps program id's to files
157*/
158struct IdBlock
159{
160 quint64 inode;
161 quint64 device;
162 unsigned char pad;
163 unsigned char progId;
164 unsigned short installId;
165 unsigned int keyOffset;
166 qint64 install_time;
167};
168
169QT_END_NAMESPACE
170
171QT_END_HEADER
172
173#endif // QTRANSPORTAUTHDEFS_QWS_H
174
Note: See TracBrowser for help on using the repository browser.