home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / include / objectty.h < prev    next >
C/C++ Source or Header  |  1998-04-25  |  13KB  |  376 lines

  1. // *************************************************************************
  2. //
  3. //  File: OBJECTTY.H
  4. //
  5. //  Copyright (c) 1994, 1995 Microsoft Corp.
  6. //
  7. //  This is the header file for the obejctity engine. The objectity
  8. //  engine is the core of the SMS API set.
  9. //
  10. //  This file contains externally visible structures, and certain manifests
  11. //  needed by them.
  12. //
  13. //
  14. // *************************************************************************
  15. //
  16.  
  17. #ifndef _OBJECTITY_H_
  18. #define _OBJECTITY_H_
  19.  
  20. // ====================================================================
  21. //
  22. //      Manifests.
  23. //
  24. // ====================================================================
  25.  
  26. typedef DWORD   SMS_STATUS;         // API return codes are all of this type.
  27.  
  28. #define F_ANY   0                   // Indicates any folder type.
  29.  
  30.  
  31. // ====================================================================
  32. //  Scalar values can be strings, integers (DWORDs), time, or binary.
  33. //NOTE: binary not yet implemented.
  34. // ====================================================================
  35. typedef enum {
  36.     SCALAR_STRING,
  37.     SCALAR_INT,
  38.     SCALAR_TIME,
  39.     SCALAR_BINARY
  40. } SCALARTYPE;
  41.  
  42.  
  43. // ====================================================================
  44. //      SCALAR
  45. //  This structure is used by the application and the engine to
  46. //  communicate a scalar's details.
  47. //
  48. //  All scalars have a type (SCALARTYPE), a name (a character string),
  49. //  and a value, which is determined by the scalar's type.
  50. //  There are separate fields here for the value in all its guises.
  51. //  Additionally, if the scalar is a string or a binary, a length
  52. //  field indicates the datum's size.
  53. //
  54. //  This length field can also be set by the application when
  55. //  retrieving a scalar. In this case it indicates the size of the
  56. //  receiving buffer (string and binary).
  57. //
  58. // ====================================================================
  59. typedef struct _SCALAR {
  60.     SCALARTYPE scType;          // string, int, time etc
  61.     char *pszName;              // Scalar name.
  62.     char *pszValue;             // Scalar value as a string.
  63.     DWORD dwValue;              // Scalar value as a DWORD.
  64.     time_t tValue;              // Scalar value as a time.
  65.     void *pValue;               // Scalar as a binary.
  66.     DWORD dwLen;                // Size of the scalar value either as a string
  67.                                 // or as a binary.
  68.                                 // If a get scalar API is called with NULL
  69.                                 // for the appropriate value, then the
  70.                                 // length of that value is returned here.
  71.     BOOL bStringEquivalence;    // True if a string exists for an INT or
  72.                                 // TIME scalar. String will be in pszValue.
  73.     DWORD fAccess;              // Access mode.
  74. } SCALAR;
  75.  
  76.  
  77.  
  78.  
  79. // --------------------------------------------------------------------
  80. // Manifests used in filter token APIs.
  81. // --------------------------------------------------------------------
  82. #define OTT_AT_START    -1              // Token will be inserted at start of
  83.                                         // expression.
  84. #define OTT_AT_END      -2              // Token will be appended to end of
  85.                                         // expression.
  86.  
  87.  
  88.  
  89. // ====================================================================
  90. //
  91. //  Return codes from the objectity engine.
  92. //
  93. // ====================================================================
  94. #define OTT_OK                      0
  95. #define OTT_MORE_DATA               1
  96. #define OTT_NO_MORE_DATA            2
  97. #define OTT_FOLDER_NO_UPDATE        3
  98. #define OTT_DUPLICATE_CONTAINER_ID  4
  99. #define OTT_DUPLICATE_FOLDER_ID     5
  100. #define OTT_DUPLICATE_FILTER_ID     6
  101. #define OTT_SCALAR_NO_UPDATE        7
  102. #define OTT_SCALAR_WRONG_TYPE       8
  103. #define OTT_INVALID_CONTAINER_ID    9
  104. #define OTT_INVALID_FOLDER_ID       10
  105. #define OTT_INVALID_FILTER_ID       11
  106.  
  107. #define OTT_CONTAINER_NO_UPDATE     12
  108.  
  109. #define OTT_PARAMETER_ERROR         13
  110. #define OTT_UNSUPPORTED             14
  111. #define OTT_NOT_FOUND               15
  112. #define OTT_PARENT_NOT_FOUND        16
  113. #define OTT_CANT_DELETE             17
  114. #define OTT_NEW_FOLDER              18
  115.  
  116. // Error when attempting to multiply link a folder.
  117. #define OTT_FOLDER_LINKED           19
  118.  
  119. //
  120. // Filter operations.
  121. #define OTT_RANGE_ERROR             20
  122.  
  123. #define OTT_DUPLICATE_FILTER        21
  124.  
  125. // Container operations that are out of sequence.
  126. #define OTT_CONTAINER_NOT_POPULATED 22
  127. #define OTT_CONTAINER_POPULATED     23
  128.  
  129. // Only persistent filters have scalars.
  130. #define OTT_FILTER_NOT_PERSISTENT   24
  131.  
  132. // Error return if the connection handle of a filter doesn't match
  133. // that of a container to which the filter is being applied.
  134. #define OTT_INVALID_CONNECTION_HANDLE 25
  135.  
  136. #define OTT_INVALID_FILTER_TYPE     26
  137.  
  138. // Folder's can't be unlinked if there are multiple handles
  139. // to the same object.
  140. #define OTT_IN_USE_BY_OTHER         27
  141.  
  142.  
  143. // The last one, user codes start from here to give
  144. // leaway for future expansion.
  145. //
  146. #define OTT_END                     50
  147.  
  148.  
  149. // ====================================================================
  150. //
  151. //  Other manifests.
  152. //
  153. // ====================================================================
  154.  
  155. // Access rights to containers/folders/scalars.
  156. // -------------------------------------------------------------
  157. #define ACCESS_READ                 0x0001
  158. #define ACCESS_CREATE               0x0002
  159. #define ACCESS_MODIFY               0x0004
  160. #define ACCESS_DELETE               0x0008
  161.  
  162. // Modification flags
  163. // ------------------
  164. #define MOD_UNMODIFIED              0x0000
  165. #define MOD_CREATED                 0x0001
  166. #define MOD_DELETED                 0x0002
  167. #define MOD_DENY_ACCESS             0x0004
  168.  
  169. // Tokens are ANDed or ORed into filters.
  170. // -------------------------------------------------------------
  171. typedef enum { OP_AND = 0x03, OP_OR = 0x02 } ANDOR;
  172.  
  173.  
  174. // Options for Rewind on a folder.
  175. // -------------------------------------------------------------
  176. #define RW_FOLDER               0x080000000       // Rewind folder lists.
  177. #define RW_SCALAR               0x040000000       // Rewind scalar list only.
  178. #define RW_ALL                  (RW_FOLDER | RW_SCALAR) // Rewind both.
  179.  
  180.  
  181.  
  182.  
  183.  
  184.  
  185.  
  186. // These structures are used to retrieve container and filter
  187. // information from the engine.
  188. // These are used in enumertaing containers and filters.
  189. // -------------------------------------------------------------
  190. #define BUFF_SIZE 256
  191.  
  192.  
  193. // An objectity is either a container or a folder.
  194. // -------------------------------------------------------------
  195. typedef enum {
  196.     T_CONTAINER,
  197.     T_FOLDER
  198. } BASETYPE;
  199.  
  200.  
  201.  
  202. // ====================================================================
  203. //
  204. //  The structures.
  205. //
  206. // ====================================================================
  207.  
  208. //
  209. // NOTIFY structure.
  210. //
  211. // This struct used for async population. Enables async operation to
  212. // use either event handle or window handle/message.
  213.  
  214. typedef struct _NOTIFY {
  215.     DWORD dwFreq;       // Notify after this number of rows retrieved.
  216.     HANDLE hEvent;      // Event handle if type=POP_EVENT
  217.     HWND hwnd;          // hwnd if type=POP_WINDOW
  218.     UINT uiMsg;         // Message if type=POP_WINDOW
  219. } NOTIFY;
  220.  
  221.  
  222. //
  223. // TOKEN structure.
  224. //
  225. #define TOKEN_STRING_SIZE   4608    // 4.5k
  226. // The manifest is this large because it can used in the package inventory
  227. // rules. In these rules we are allowed to define upto four string fields,
  228. // each of which can be 1k long. This size allows us to accommodate it all.
  229.  
  230. typedef struct _TOKEN {
  231.     INT tokenType;                  // Returns: type of token (ie USER, AND,
  232.                                         // OR, LEFT_PAREN, RIGHT_PAREN).
  233.     char  szName[BUFF_SIZE];
  234.     char  szValue[BUFF_SIZE];
  235.     DWORD dwOp;
  236.  
  237.     char  szArchitecture[BUFF_SIZE];
  238.     char  szGroupClass[BUFF_SIZE];
  239.     char  szAttributeName[BUFF_SIZE];
  240.     char  szTokenString[TOKEN_STRING_SIZE]; // Display form of the token.
  241.     BOOL  bIndent;                  // Request display indentation.
  242. } TOKEN;
  243.  
  244.  
  245.  
  246. //
  247. // FILTER_INFO
  248. //
  249. //  This structure is used to provide the user a filter template.
  250. //  An array of these structures is returned via the SmsEnumFilters API.
  251. //  This returns information about all filters registered with the engine.
  252. //
  253. //  It is considered that the user will use this information in order to
  254. //  display information. The information that is provided here is:
  255. //  a) the type and tag of the filter, b) the fields that comprise a
  256. //  particular filter's tokens, and c) the names that should be used
  257. //  for these fields for display purposes. That is, for a GUI application,
  258. //  they provide the labels for edit controls. If a field in the structure
  259. //  is empty (ie NULL) then that field is not used for that particular
  260. //  filter.
  261. //
  262. //  As an example consider a group filter. If the developer wants to
  263. //  present, say, a dialogue box to the end user, they would use the
  264. //  following fields: szName, szValue. Looking at the template they
  265. //  will see that the strings associated with these fields are 'Name'
  266. //  and 'GroupClass'. They would thus display a dialogue box with
  267. //  two edit controls, the first labelled 'Name', the second labelled
  268. //  'GroupClass. Since these are the only two fields that are filled in
  269. //  no other fields should be presented to the user.
  270. //
  271. //
  272. //  Job filter:
  273. //      szName          = 'Type'
  274. //      szValue         = 'Value'
  275. //      szOperator      = 'Operator'
  276. //
  277. //  Machine filter:
  278. //      szArchitecture  = 'Architecture'
  279. //      szGroupClass    = 'GroupClass'
  280. //      szAttributeName = 'Attribute name'
  281. //      szValue         = 'Value'
  282. //      szOperator      = 'Operator'
  283. //
  284. //  Site filter:
  285. //      szName          = 'Type'
  286. //      szValue         = 'Site code'
  287. //      szOperator      = 'Operator'
  288. //
  289. //  Group filter:
  290. //      szName          = 'Name'
  291. //      szValue         = 'GroupClass'
  292. //      szOperator      = 'Operator'
  293. //
  294. //  Architecture filter:
  295. //      szName          = 'Name'
  296. //      szValue         = 'Architecture'
  297. //      szOperator      = 'Operator'
  298. //
  299. //  Package filter:
  300. //      szName          = 'Type'
  301. //      szValue         = 'Value'
  302. //      szOperator      = 'Operator'
  303. //
  304. //  Attribute filter:
  305. //      szArchitecture  = 'Architecture'
  306. //      szGroupClass    = 'GroupClass'
  307. //      szAttributeName = 'Attribute name'
  308. //
  309. //  SiteLimit filter:
  310. //      szName          = 'Site'
  311. //      szValue         = 'Domain'
  312. //
  313. //
  314. #define NAME_SIZE   52
  315.  
  316. typedef struct _FILTER_INFO {
  317.     char  szTag[NAME_SIZE];         // Filter tag (eg "Architecture filter").
  318.     DWORD filterType;               // Type number (eg ARCHITECTURE_FILTER).
  319.  
  320.     // The filter descriptor information.
  321.     char szName[NAME_SIZE];
  322.     char szValue[NAME_SIZE];
  323.     char szOperator[NAME_SIZE];
  324.  
  325.     char szArchitecture[NAME_SIZE];
  326.     char szGroupClass[NAME_SIZE];
  327.     char szAttributeName[NAME_SIZE];
  328. } FILTER_INFO;
  329.  
  330.  
  331.  
  332. // This is what the user gets as a description of a scalar.
  333. // Currently this is only used internally in objectty.cpp (RegisterObjectity).
  334. // I'll proably make this externally visible though very soon now.
  335. typedef struct _SCALAR_INFO {
  336.     char szName[BUFF_SIZE];         // Scalar's name.
  337.     SCALARTYPE scType;              // Type: SCALAR_STRING, INT, TIME etc
  338.     DWORD fAccess;                  // Access mode: ACCESS_READ, MODIFY etc
  339. } SCALAR_INFO;
  340.  
  341.  
  342. // Now the C struct form of CFolderInfo. This is what we'll
  343. // return in a call to DescribeFolder().
  344. // This is created during a call to RegisterObjectity. It is stored
  345. // in the CFolderInfo object, itself held in the Folder registry.
  346. // 29-Sep-94. Expanded to deal with Containers as well as folders.
  347.  
  348.  
  349. typedef struct _FOLDER_INFO {
  350.     BASETYPE tObjectity;            // T_CONTAINER or T_FOLDER.
  351.     char *pszTag;
  352.     DWORD dwTag;
  353.  
  354.     DWORD ctFolders;
  355.     DWORD *pFolderTags;
  356.  
  357.     DWORD ctFilters;
  358.     DWORD *pFilterTags;
  359.  
  360.     DWORD ctScalars;                // Not used by for containers.
  361.     SCALAR_INFO *pScalars;          // ditto.
  362.  
  363.     void *pNewFunc;                 // needs cast!! Used when registering
  364.                                     // a container. This is a pointer to
  365.                                     // the container's 'new' function.
  366. } FOLDER_INFO;
  367.  
  368.  
  369.  
  370.  
  371.  
  372. #endif  // _OBJECTITY_H_
  373.  
  374. /* EOF: objectty.h */
  375.  
  376.