1 | /* $Id: CFGMInternal.h 4763 2007-09-13 09:36:50Z vboxsync $ */
|
---|
2 | /** @file
|
---|
3 | * CFGM - Internal header file.
|
---|
4 | */
|
---|
5 |
|
---|
6 | /*
|
---|
7 | * Copyright (C) 2006-2007 innotek GmbH
|
---|
8 | *
|
---|
9 | * This file is part of VirtualBox Open Source Edition (OSE), as
|
---|
10 | * available from http://www.virtualbox.org. This file is free software;
|
---|
11 | * you can redistribute it and/or modify it under the terms of the GNU
|
---|
12 | * General Public License as published by the Free Software Foundation,
|
---|
13 | * in version 2 as it comes in the "COPYING" file of the VirtualBox OSE
|
---|
14 | * distribution. VirtualBox OSE is distributed in the hope that it will
|
---|
15 | * be useful, but WITHOUT ANY WARRANTY of any kind.
|
---|
16 | */
|
---|
17 |
|
---|
18 | #ifndef ___CFGMInternal_h
|
---|
19 | #define ___CFGMInternal_h
|
---|
20 |
|
---|
21 | #include <VBox/cdefs.h>
|
---|
22 | #include <VBox/types.h>
|
---|
23 |
|
---|
24 |
|
---|
25 | /** @defgroup grp_cfgm_int Internals.
|
---|
26 | * @ingroup grp_cfgm
|
---|
27 | * @{
|
---|
28 | */
|
---|
29 |
|
---|
30 |
|
---|
31 | /**
|
---|
32 | * Configuration manager propertype value.
|
---|
33 | */
|
---|
34 | typedef union CFGMVALUE
|
---|
35 | {
|
---|
36 | /** Integer value. */
|
---|
37 | struct CFGMVALUE_INTEGER
|
---|
38 | {
|
---|
39 | /** The integer represented as 64-bit unsigned. */
|
---|
40 | uint64_t u64;
|
---|
41 | } Integer;
|
---|
42 |
|
---|
43 | /** String value. (UTF-8 of course) */
|
---|
44 | struct CFGMVALUE_STRING
|
---|
45 | {
|
---|
46 | /** Length of string. (In bytes, including the terminator.) */
|
---|
47 | RTUINT cch;
|
---|
48 | /** Pointer to the string. */
|
---|
49 | char *psz;
|
---|
50 | } String;
|
---|
51 |
|
---|
52 | /** Byte string value. */
|
---|
53 | struct CFGMVALUE_BYTES
|
---|
54 | {
|
---|
55 | /** Length of byte string. (in bytes) */
|
---|
56 | RTUINT cb;
|
---|
57 | /** Pointer to the byte string. */
|
---|
58 | uint8_t *pau8;
|
---|
59 | } Bytes;
|
---|
60 | } CFGMVALUE;
|
---|
61 | /** Pointer to configuration manager property value. */
|
---|
62 | typedef CFGMVALUE *PCFGMVALUE;
|
---|
63 |
|
---|
64 |
|
---|
65 | /**
|
---|
66 | * Configuration manager tree node.
|
---|
67 | */
|
---|
68 | typedef struct CFGMLEAF
|
---|
69 | {
|
---|
70 | /** Pointer to the next leaf. */
|
---|
71 | PCFGMLEAF pNext;
|
---|
72 | /** Pointer to the previous leaf. */
|
---|
73 | PCFGMLEAF pPrev;
|
---|
74 |
|
---|
75 | /** Property type. */
|
---|
76 | CFGMVALUETYPE enmType;
|
---|
77 | /** Property value. */
|
---|
78 | CFGMVALUE Value;
|
---|
79 |
|
---|
80 | /** Name length. (exclusive) */
|
---|
81 | RTUINT cchName;
|
---|
82 | /** Name. */
|
---|
83 | char szName[1];
|
---|
84 | } CFGMLEAF;
|
---|
85 |
|
---|
86 |
|
---|
87 | /**
|
---|
88 | * Configuration manager tree node.
|
---|
89 | */
|
---|
90 | typedef struct CFGMNODE
|
---|
91 | {
|
---|
92 | /** Pointer to the next node (on this level). */
|
---|
93 | PCFGMNODE pNext;
|
---|
94 | /** Pointer to the previuos node (on this level). */
|
---|
95 | PCFGMNODE pPrev;
|
---|
96 | /** Pointer Parent node. */
|
---|
97 | PCFGMNODE pParent;
|
---|
98 | /** Pointer to first child node. */
|
---|
99 | PCFGMNODE pFirstChild;
|
---|
100 | /** Pointer to first property leaf. */
|
---|
101 | PCFGMLEAF pFirstLeaf;
|
---|
102 |
|
---|
103 | /** Pointer to the VM owning this node. */
|
---|
104 | PVM pVM;
|
---|
105 |
|
---|
106 | /** The root of a 'restricted' subtree, i.e. the parent is
|
---|
107 | * invisible to non-trusted users.
|
---|
108 | */
|
---|
109 | bool fRestrictedRoot;
|
---|
110 |
|
---|
111 | /** Name length. (exclusive) */
|
---|
112 | RTUINT cchName;
|
---|
113 | /** Name. */
|
---|
114 | char szName[1];
|
---|
115 | } CFGMNODE;
|
---|
116 |
|
---|
117 |
|
---|
118 |
|
---|
119 |
|
---|
120 | /**
|
---|
121 | * Converts a CFGM pointer into a VM pointer.
|
---|
122 | * @returns Pointer to the VM structure the CFGM is part of.
|
---|
123 | * @param pCFGM Pointer to CFGM instance data.
|
---|
124 | */
|
---|
125 | #define CFGM2VM(pCFGM) ( (PVM)((char*)pCFGM - pCFGM->offVM) )
|
---|
126 |
|
---|
127 | /**
|
---|
128 | * CFGM VM Instance data.
|
---|
129 | * Changes to this must checked against the padding of the cfgm union in VM!
|
---|
130 | */
|
---|
131 | typedef struct CFGM
|
---|
132 | {
|
---|
133 | /** Offset to the VM structure.
|
---|
134 | * See CFGM2VM(). */
|
---|
135 | RTUINT offVM;
|
---|
136 | /** Alignment padding. */
|
---|
137 | RTUINT uPadding0;
|
---|
138 |
|
---|
139 | /** Pointer to root node. */
|
---|
140 | R3PTRTYPE(PCFGMNODE) pRoot;
|
---|
141 | } CFGM;
|
---|
142 |
|
---|
143 | /** @} */
|
---|
144 |
|
---|
145 | #endif
|
---|