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