1 mike 1.1 /*
2 **==============================================================================
3 **
4 ** Open Management Infrastructure (OMI)
5 **
6 ** Copyright (c) Microsoft Corporation
7 **
8 ** Licensed under the Apache License, Version 2.0 (the "License"); you may not
9 ** use this file except in compliance with the License. You may obtain a copy
10 ** of the License at
11 **
12 ** http://www.apache.org/licenses/LICENSE-2.0
13 **
14 ** THIS CODE IS PROVIDED *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 ** KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
16 ** WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
17 ** MERCHANTABLITY OR NON-INFRINGEMENT.
18 **
19 ** See the Apache 2 License for the specific language governing permissions
20 ** and limitations under the License.
21 **
22 mike 1.1 **==============================================================================
23 */
24
25 #ifndef _MI_h
26 #define _MI_h
27
28 #define OMI_ONLY
29
30 #include <stddef.h>
31 #include <stdio.h>
32 #include <string.h>
33
34 /*
35 **==============================================================================
36 **
37 ** Use eight-byte packing for structures (on Windows)
38 **
39 **==============================================================================
40 */
41
42 #if defined(_MSC_VER)
43 mike 1.1 # pragma pack(push,8)
44 #endif
45
46 /*
47 **==============================================================================
48 **
49 ** MI_CHAR_TYPE
50 **
51 ** Indicates the character type to use (1='char', 2='wchar_t'). This
52 ** can be overridden prior to including this file or on the compiler
53 ** command line (e.g., -DMI_CHAR_TYPE=1).
54 **
55 **==============================================================================
56 */
57
58 #if defined(MI_CHAR_TYPE)
59 # if (MI_CHAR_TYPE != 1) && (MI_CHAR_TYPE != 2)
60 # error "MI_CHAR_TYPE must be 1 or 2"
61 # endif
62 #else
63 # if defined(_MSC_VER)
64 mike 1.1 # define MI_CHAR_TYPE 2
65 # else
66 # define MI_CHAR_TYPE 1
67 # endif
68 #endif
69
70 #if (MI_CHAR_TYPE == 2)
71 # define MI_USE_WCHAR
72 #endif
73
74 #if (MI_CHAR_TYPE == 2)
75 # define MI_USE_WCHAR
76 #endif
77
78 /*
79 **==============================================================================
80 **
81 ** MI_CONST
82 **
83 ** Provider managers and client transport implementations predefine this
84 ** macro to relax const checking on various structures within this file.
85 mike 1.1 **
86 **==============================================================================
87 */
88
89 #ifndef MI_CONST
90 # define MI_CONST const
91 #endif
92
93 /*
94 **==============================================================================
95 **
96 ** MI_VERSION
97 **
98 ** Define the version number used the MI_Module.version field, which is
99 ** set in the MI_Main() entry point as follows:
100 **
101 ** module.version = MI_VERSION;
102 **
103 **==============================================================================
104 */
105
106 mike 1.1 #define MI_MAJOR ((MI_Uint32)1)
107 #define MI_MINOR ((MI_Uint32)0)
108 #define MI_REVISON ((MI_Uint32)0)
109 #define MI_MAKE_VERSION(MAJ, MIN, REV) ((MAJ << 16) | (MIN << 8) | REV)
110 #define MI_VERSION MI_MAKE_VERSION(MI_MAJOR, MI_MINOR, MI_REVISON)
111
112 #define MI_UNREFERENCED_PARAMETER(P) (P)
113
114 /*
115 **==============================================================================
116 **
117 ** SAL notation (Windows only)
118 **
119 ** If the SAL macros are undefined, define empty ones.
120 **
121 **==============================================================================
122 */
123
124 #if !defined(_In_)
125 # define _In_
126 #endif
127 mike 1.1
128 #if !defined(_In_opt_)
129 # define _In_opt_
130 #endif
131
132 #if !defined(_In_z_)
133 # define _In_z_
134 #endif
135
136 #if !defined(_In_opt_z_)
137 # define _In_opt_z_
138 #endif
139
140 #if !defined(_Out_)
141 # define _Out_
142 #endif
143
144 #if !defined(_Outptr_)
145 # define _Outptr_
146 #endif
147
148 mike 1.1 #if !defined(_Out_writes_z_)
149 # define _Out_writes_z_(count)
150 #endif
151
152 #if !defined(_Outptr_result_z_)
153 # define _Outptr_result_z_
154 #endif
155
156 #if !defined(_Outptr_result_maybenull_)
157 # define _Outptr_result_maybenull_
158 #endif
159
160 #if !defined(_Outptr_opt_result_maybenull_)
161 # define _Outptr_opt_result_maybenull_
162 #endif
163
164 #if !defined(_Outptr_result_maybenull_z_)
165 # define _Outptr_result_maybenull_z_
166 #endif
167
168 #if !defined(_Outptr_opt_result_z_)
169 mike 1.1 # define _Outptr_opt_result_z_
170 #endif
171
172 #if !defined(_Outptr_opt_result_maybenull_z_)
173 # define _Outptr_opt_result_maybenull_z_
174 #endif
175
176 #if !defined(_Return_type_success_)
177 # define _Return_type_success_(expr)
178 #endif
179
180 #if !defined(_In_reads_opt_)
181 # define _In_reads_opt_(expr)
182 #endif
183
184 #if !defined(_Out_writes_to_opt_)
185 # define _Out_writes_to_opt_(length, lengthwritten)
186 #endif
187
188 #if !defined(_Inout_)
189 # define _Inout_
190 mike 1.1 #endif
191
192 #if !defined(_Out_opt_)
193 # define _Out_opt_
194 #endif
195
196 #if !defined(_Out_writes_bytes_)
197 # define _Out_writes_bytes_(count)
198 #endif
199
200 #if !defined(_In_reads_)
201 # define _In_reads_(count)
202 #endif
203
204 #if !defined(_Out_writes_opt_)
205 # define _Out_writes_opt_(count)
206 #endif
207
208 /*
209 **==============================================================================
210 **
211 mike 1.1 ** MI_EXPORT
212 **
213 ** This macro exports the MI_Main() entry point. For example:
214 **
215 ** MI_EXPORT MI_Module* MI_MAIN_CALL MI_Main(MI_Server* server)
216 ** {
217 ** }
218 **
219 ** The macro appears first in the definition.
220 **
221 **==============================================================================
222 */
223
224 #if defined(_MSC_VER)
225 # define MI_EXPORT __declspec(dllexport)
226 # define MI_IMPORT __declspec(dllimport)
227 #elif defined(__GNUC__)
228 # define MI_EXPORT __attribute__((visibility("default")))
229 # define MI_IMPORT /* empty */
230 #elif defined(sun)
231 # define MI_EXPORT __global
232 mike 1.1 # define MI_IMPORT /* empty */
233 #else
234 # define MI_EXPORT
235 # define MI_IMPORT
236 #endif
237
238 /*
239 **==============================================================================
240 **
241 ** MI_MAIN_CALL
242 **
243 ** This macro specifies the MI_Main() calling convention. For example:
244 **
245 ** MI_EXPORT MI_Module* MI_MAIN_CALL MI_Main(MI_Server* server)
246 ** {
247 ** ...
248 ** }
249 **
250 ** The macro appears directly before the function name.
251 **
252 **==============================================================================
253 mike 1.1 */
254
255 #if defined(_MSC_VER)
256 # define MI_MAIN_CALL __cdecl
257 #else
258 # define MI_MAIN_CALL /* empty */
259 #endif
260
261 /*
262 **==============================================================================
263 **
264 ** MI_CALL
265 **
266 ** This macros specifies the calling convention for all functions other
267 ** than MI_Main(). For example:
268 **
269 ** MI_INLINE MI_Result MI_CALL MI_Context_PostResult(...);
270 **
271 ** The macro appears directly before the function name.
272 **
273 **==============================================================================
274 mike 1.1 */
275
276 #if defined(_MSC_VER)
277 # define MI_CALL __stdcall
278 #else
279 # define MI_CALL /* empty */
280 #endif
281
282 /*
283 **==============================================================================
284 **
285 ** MI_INLINE
286 **
287 ** This macro provides a platform-independent method for specifying that
288 ** a function is in-line. For compilers that do not support in-lining, define
289 ** MI_INLINE as 'static' instead.
290 **
291 **==============================================================================
292 */
293
294 #if defined(_MSC_VER)
295 mike 1.1 # define MI_INLINE static __inline
296 #elif defined(__GNUC__)
297 # define MI_INLINE static __inline
298 #elif defined(sun)
299 # define MI_INLINE static inline
300 #else
301 # define MI_INLINE static __inline
302 #endif
303
304 /*
305 **==============================================================================
306 **
307 ** MI_OFFSETOF
308 **
309 ** This macro obtains the byte-offset of a field within a structure. It is
310 ** used in schema.c to obtain the offsets of generated structure fields.
311 **
312 **==============================================================================
313 */
314
315 #define MI_OFFSETOF(STRUCT,FIELD) (((ptrdiff_t)&(((STRUCT*)1)->FIELD))-1)
316 mike 1.1
317 /*
318 **==============================================================================
319 **
320 ** MI_EXTERN_C
321 **
322 ** This macro forces a function to use the C function naming convention
323 ** (rather than C++ mangled naming convention).
324 **
325 **==============================================================================
326 */
327
328 #ifdef __cplusplus
329 # define MI_EXTERN_C extern "C"
330 #else
331 # define MI_EXTERN_C extern
332 #endif
333
334 /*
335 **==============================================================================
336 **
337 mike 1.1 ** MI_COUNT()
338 **
339 ** This macro obtains the element count of an array. For example:
340 **
341 ** const char* DATA[] = { "Red", "Green", "Blue" };
342 ** size_t COUNT = MI_COUNT(DATA);
343 **
344 ** 'COUNT' in this example is 3 (the number of array elements). This
345 ** macro is used by schema.c to obtain array lengths.
346 **
347 **==============================================================================
348 */
349
350 #define MI_COUNT(X) (sizeof(X)/sizeof(X[0]))
351
352 /*
353 **==============================================================================
354 **
355 ** MI_T()
356 **
357 ** This macro conditionally places the 'L' character in front of a string
358 mike 1.1 ** literal (when using wide-character strings).
359 **
360 **==============================================================================
361 */
362
363 #if (MI_CHAR_TYPE == 1)
364 # define MI_T(STR) STR
365 #else
366 # define MI_T(STR) L##STR
367 #endif
368
369 /*
370 **==============================================================================
371 **
372 ** MI_LL()
373 ** MI_ULL()
374 **
375 ** Macros for adding endings for sint64 and uint64 literals (used within
376 ** schema.c).
377 **
378 **==============================================================================
379 mike 1.1 */
380
381 #if defined (_MSC_VER)
382 # define MI_LL(X) X##i64
383 # define MI_ULL(X) X##ui64
384 #else
385 # define MI_LL(X) X##LL
386 # define MI_ULL(X) X##ULL
387 #endif
388
389 /*
390 **==============================================================================
391 **
392 ** Forward structure typedef declarations.
393 **
394 **==============================================================================
395 */
396
397 typedef struct _MI_Server MI_Server;
398 typedef struct _MI_Context MI_Context;
399 typedef struct _MI_ClassDecl MI_ClassDecl;
400 mike 1.1 typedef struct _MI_Instance MI_Instance;
401 typedef struct _MI_Filter MI_Filter;
402 typedef struct _MI_PropertySet MI_PropertySet;
403 typedef struct _MI_Qualifier MI_Qualifier;
404 typedef struct _MI_Session MI_Session;
405 typedef struct _MI_ServerFT MI_ServerFT;
406 typedef struct _MI_ProviderFT MI_ProviderFT;
407 typedef struct _MI_PropertySetFT MI_PropertySetFT;
408 typedef struct _MI_InstanceFT MI_InstanceFT;
409 typedef struct _MI_ContextFT MI_ContextFT;
410 typedef struct _MI_FilterFT MI_FilterFT;
411 typedef struct _MI_Class MI_Class;
412
413 /*
414 **==============================================================================
415 **
416 ** MI_Result
417 **
418 ** This enumeration defines function return codes. These codes are
419 ** specified in [1].
420 **
421 mike 1.1 ** [1] See DSP0004 (DMTF document number).
422 **
423 **==============================================================================
424 */
425
426 typedef _Return_type_success_(return == MI_RESULT_OK) enum _MI_Result
427 {
428 /* The operation was successful */
429 MI_RESULT_OK = 0,
430
431 /* A general error occurred, not covered by a more specific error code. */
432 MI_RESULT_FAILED = 1,
433
434 /* Access to a CIM resource is not available to the client. */
435 MI_RESULT_ACCESS_DENIED = 2,
436
437 /* The target namespace does not exist. */
438 MI_RESULT_INVALID_NAMESPACE = 3,
439
440 /* One or more parameter values passed to the method are not valid. */
441 MI_RESULT_INVALID_PARAMETER = 4,
442 mike 1.1
443 /* The specified class does not exist. */
444 MI_RESULT_INVALID_CLASS = 5,
445
446 /* The requested object cannot be found. */
447 MI_RESULT_NOT_FOUND = 6,
448
449 /* The requested operation is not supported. */
450 MI_RESULT_NOT_SUPPORTED = 7,
451
452 /* The operation cannot be invoked because the class has subclasses. */
453 MI_RESULT_CLASS_HAS_CHILDREN = 8,
454
455 /* The operation cannot be invoked because the class has instances. */
456 MI_RESULT_CLASS_HAS_INSTANCES = 9,
457
458 /* The operation cannot be invoked because the superclass does not exist. */
459 MI_RESULT_INVALID_SUPERCLASS = 10,
460
461 /* The operation cannot be invoked because an object already exists. */
462 MI_RESULT_ALREADY_EXISTS = 11,
463 mike 1.1
464 /* The specified property does not exist. */
465 MI_RESULT_NO_SUCH_PROPERTY = 12,
466
467 /* The value supplied is not compatible with the type. */
468 MI_RESULT_TYPE_MISMATCH = 13,
469
470 /* The query language is not recognized or supported. */
471 MI_RESULT_QUERY_LANGUAGE_NOT_SUPPORTED = 14,
472
473 /* The query is not valid for the specified query language. */
474 MI_RESULT_INVALID_QUERY = 15,
475
476 /* The extrinsic method cannot be invoked. */
477 MI_RESULT_METHOD_NOT_AVAILABLE = 16,
478
479 /* The specified extrinsic method does not exist. */
480 MI_RESULT_METHOD_NOT_FOUND = 17,
481
482 /* The specified namespace is not empty. */
483 MI_RESULT_NAMESPACE_NOT_EMPTY = 20,
484 mike 1.1
485 /* The enumeration identified by the specified context is invalid. */
486 MI_RESULT_INVALID_ENUMERATION_CONTEXT = 21,
487
488 /* The specified operation timeout is not supported by the CIM Server. */
489 MI_RESULT_INVALID_OPERATION_TIMEOUT = 22,
490
491 /* The Pull operation has been abandoned. */
492 MI_RESULT_PULL_HAS_BEEN_ABANDONED = 23,
493
494 /* The attempt to abandon a concurrent Pull operation failed. */
495 MI_RESULT_PULL_CANNOT_BE_ABANDONED = 24,
496
497 /* Using a filter in the enumeration is not supported by the CIM server. */
498 MI_RESULT_FILTERED_ENUMERATION_NOT_SUPPORTED = 25,
499
500 /* The CIM server does not support continuation on error. */
501 MI_RESULT_CONTINUATION_ON_ERROR_NOT_SUPPORTED = 26,
502
503 /* The operation failed because server limits were exceeded. */
504 MI_RESULT_SERVER_LIMITS_EXCEEDED = 27,
505 mike 1.1
506 /* The CIM server is shutting down and cannot process the operation. */
507 MI_RESULT_SERVER_IS_SHUTTING_DOWN = 28
508 }
509 MI_Result;
510
511 /*
512 **==============================================================================
513 **
514 ** MI_ErrorCategory
515 **
516 ** This enumeration defines error categories for the CIM extensions.
517 **
518 **==============================================================================
519 */
520
521 typedef enum _MI_ErrorCategory
522 {
523 MI_ERRORCATEGORY_NOT_SPECIFIED = 0,
524 MI_ERRORCATEGORY_OPEN_ERROR = 1,
525 MI_ERRORCATEGORY_CLOS_EERROR = 2,
526 mike 1.1 MI_ERRORCATEGORY_DEVICE_ERROR = 3,
527 MI_ERRORCATEGORY_DEADLOCK_DETECTED = 4,
528 MI_ERRORCATEGORY_INVALID_ARGUMENT = 5,
529 MI_ERRORCATEGORY_INVALID_DATA = 6,
530 MI_ERRORCATEGORY_INVALID_OPERATION = 7,
531 MI_ERRORCATEGORY_INVALID_RESULT = 8,
532 MI_ERRORCATEGORY_INVALID_TYPE = 9,
533 MI_ERRORCATEGORY_METADATA_ERROR = 10,
534 MI_ERRORCATEGORY_NOT_IMPLEMENTED = 11,
535 MI_ERRORCATEGORY_NOT_INSTALLED = 12,
536 MI_ERRORCATEGORY_OBJECT_NOT_FOUND = 13,
537 MI_ERRORCATEGORY_OPERATION_STOPPED = 14,
538 MI_ERRORCATEGORY_OPERATION_TIMEOUT = 15,
539 MI_ERRORCATEGORY_SYNTAX_ERROR = 16,
540 MI_ERRORCATEGORY_PARSER_ERROR = 17,
541 MI_ERRORCATEGORY_ACCESS_DENIED = 18,
542 MI_ERRORCATEGORY_RESOURCE_BUSY = 19,
543 MI_ERRORCATEGORY_RESOURCE_EXISTS = 20,
544 MI_ERRORCATEGORY_RESOURCE_UNAVAILABLE = 21,
545 MI_ERRORCATEGORY_READ_ERROR = 22,
546 MI_ERRORCATEGORY_WRITE_ERROR = 23,
547 mike 1.1 MI_ERRORCATEGORY_FROM_STDERR = 24,
548 MI_ERRORCATEGORY_SECURITY_ERROR = 25,
549 MI_ERRORCATEGORY_PROTOCOL_ERROR = 26,
550 MI_ERRORCATEGORY_CONNECTION_ERROR = 27,
551 MI_ERRORCATEGORY_AUTHENTICATION_ERROR = 28,
552 MI_ERRORCATEGORY_LIMITS_EXCEEDED = 29,
553 MI_ERRORCATEGORY_QUOTA_EXCEEDED = 30,
554 MI_ERRORCATEGORY_NOT_ENABLED = 31
555 }
556 MI_ErrorCategory;
557
558 /*
559 **==============================================================================
560 **
561 ** MI_PromptType
562 **
563 ** This enumeration defines prompt types for the CIM extensions.
564 **
565 **==============================================================================
566 */
567
568 mike 1.1 typedef enum _MI_PromptType
569 {
570 MI_PROMPTTYPE_NORMAL,
571 MI_PROMPTTYPE_CRITICAL
572 }
573 MI_PromptType;
574
575 /*
576 **==============================================================================
577 **
578 ** MI_CallbackMode
579 **
580 ** This enumeration defines callback mode for the CIM extensions for WriteError and PromptUser APIs.
581 **
582 **==============================================================================
583 */
584
585 typedef enum _MI_CallbackMode
586 {
587 MI_CALLBACKMODE_REPORT,
588 MI_CALLBACKMODE_INQUIRE,
589 mike 1.1 MI_CALLBACKMODE_IGNORE
590 }
591 MI_CallbackMode;
592
593 /*
594 **==============================================================================
595 **
596 ** MI_ProviderArchitecture
597 **
598 ** This enumeration defines the provider to be used on the server.
599 **
600 **==============================================================================
601 */
602
603 typedef enum _MI_ProviderArchitecture
604 {
605 MI_PROVIDER_ARCHITECTURE_32BIT,
606 MI_PROVIDER_ARCHITECTURE_64BIT,
607 }
608 MI_ProviderArchitecture;
609
610 mike 1.1
611 /*
612 **==============================================================================
613 **
614 ** Bit flags
615 **
616 **==============================================================================
617 */
618
619 /* CIM meta types (or qualifier scopes) */
620 #define MI_FLAG_CLASS (1 << 0)
621 #define MI_FLAG_METHOD (1 << 1)
622 #define MI_FLAG_PROPERTY (1 << 2)
623 #define MI_FLAG_PARAMETER (1 << 3)
624 #define MI_FLAG_ASSOCIATION (1 << 4)
625 #define MI_FLAG_INDICATION (1 << 5)
626 #define MI_FLAG_REFERENCE (1 << 6)
627 #define MI_FLAG_ANY (1|2|4|8|16|32|64)
628
629 /* Qualifier flavors */
630 #define MI_FLAG_ENABLEOVERRIDE (1 << 7)
631 mike 1.1 #define MI_FLAG_DISABLEOVERRIDE (1 << 8)
632 #define MI_FLAG_RESTRICTED (1 << 9)
633 #define MI_FLAG_TOSUBCLASS (1 << 10)
634 #define MI_FLAG_TRANSLATABLE (1 << 11)
635
636 /* Select boolean qualifier */
637 #define MI_FLAG_KEY (1 << 12)
638 #define MI_FLAG_IN (1 << 13)
639 #define MI_FLAG_OUT (1 << 14)
640 #define MI_FLAG_REQUIRED (1 << 15)
641 #define MI_FLAG_STATIC (1 << 16)
642 #define MI_FLAG_ABSTRACT (1 << 17)
643 #define MI_FLAG_TERMINAL (1 << 18)
644 #define MI_FLAG_EXPENSIVE (1 << 19)
645 #define MI_FLAG_STREAM (1 << 20)
646 #define MI_FLAG_READONLY (1 << 21)
647
648
649 /* Special flags */
650 #define MI_FLAG_NOT_MODIFIED (1 << 25) // indicates that the property is not modified
651 #define MI_FLAG_VERSION (1<<26|1<<27|1<<28)
652 mike 1.1 #define MI_FLAG_NULL (1 << 29)
653 #define MI_FLAG_BORROW (1 << 30)
654 #define MI_FLAG_ADOPT ((MI_Uint32)(1 << 31))
655
656 /*
657 **==============================================================================
658 **
659 ** enum MI_Type
660 **
661 ** This enumeration defines type tags for the CIM data types [1]. These
662 ** tags specify the data type of qualifiers, properties, references,
663 ** parameters, and method return values. Tags ending in 'A' signify
664 ** arrays. All tags are within the range of 0 to 31, allowing them to be
665 ** stored in a single byte. The 0x10 bit of array tags is non-zero.
666 **
667 ** [1] See DSP0004 (DMTF document number).
668 **
669 **==============================================================================
670 */
671
672 typedef enum _MI_Type
673 mike 1.1 {
674 MI_BOOLEAN = 0,
675 MI_UINT8 = 1,
676 MI_SINT8 = 2,
677 MI_UINT16 = 3,
678 MI_SINT16 = 4,
679 MI_UINT32 = 5,
680 MI_SINT32 = 6,
681 MI_UINT64 = 7,
682 MI_SINT64 = 8,
683 MI_REAL32 = 9,
684 MI_REAL64 = 10,
685 MI_CHAR16 = 11,
686 MI_DATETIME = 12,
687 MI_STRING = 13,
688 MI_REFERENCE = 14,
689 MI_INSTANCE = 15,
690 MI_BOOLEANA = 16,
691 MI_UINT8A = 17,
692 MI_SINT8A = 18,
693 MI_UINT16A = 19,
694 mike 1.1 MI_SINT16A = 20,
695 MI_UINT32A = 21,
696 MI_SINT32A = 22,
697 MI_UINT64A = 23,
698 MI_SINT64A = 24,
699 MI_REAL32A = 25,
700 MI_REAL64A = 26,
701 MI_CHAR16A = 27,
702 MI_DATETIMEA = 28,
703 MI_STRINGA = 29,
704 MI_REFERENCEA = 30,
705 MI_INSTANCEA = 31,
706
707 /* MI_ARRAY is not an actual type, rather this is the bit that signifies
708 * the type is an array */
709 MI_ARRAY = 16
710 }
711 MI_Type;
712
713 /*
714 **==============================================================================
715 mike 1.1 **
716 ** MI_Uint8
717 ** MI_Sint8
718 ** MI_Uint16
719 ** MI_Sint16
720 ** MI_Uint32
721 ** MI_Sint32
722 ** MI_Uint64
723 ** MI_Sint64
724 ** MI_Real32
725 ** MI_Real64
726 ** MI_Char16
727 ** MI_Char
728 **
729 ** The following represent CIM data types.
730 **
731 **==============================================================================
732 */
733
734 typedef unsigned char MI_Boolean;
735 typedef unsigned char MI_Uint8;
736 mike 1.1 typedef signed char MI_Sint8;
737 typedef unsigned short MI_Uint16;
738 typedef signed short MI_Sint16;
739 typedef unsigned int MI_Uint32;
740 typedef signed int MI_Sint32;
741
742 #if defined(_MSC_VER)
743 typedef unsigned __int64 MI_Uint64;
744 typedef signed __int64 MI_Sint64;
745 #else
746 typedef unsigned long long MI_Uint64;
747 typedef signed long long MI_Sint64;
748 #endif
749
750 typedef float MI_Real32;
751 typedef double MI_Real64;
752 typedef unsigned short MI_Char16;
753
754 #if (MI_CHAR_TYPE == 1)
755 typedef char MI_Char;
756 #else
757 mike 1.1 typedef wchar_t MI_Char;
758 #endif
759
760 #define MI_TRUE ((MI_Boolean)1)
761 #define MI_FALSE ((MI_Boolean)0)
762
763 /*
764 **==============================================================================
765 **
766 ** MI_Timestamp
767 **
768 ** Represents a timestamp as described in the CIM Infrastructure
769 ** specification
770 **
771 ** [1] MI_ee DSP0004 (http://www.dmtf.org/standards/published_documents)
772 **
773 **==============================================================================
774 */
775
776 typedef struct _MI_Timestamp
777 {
778 mike 1.1 /* YYYYMMDDHHMMSS.MMMMMMSUTC */
779 MI_Uint32 year;
780 MI_Uint32 month;
781 MI_Uint32 day;
782 MI_Uint32 hour;
783 MI_Uint32 minute;
784 MI_Uint32 second;
785 MI_Uint32 microseconds;
786 MI_Sint32 utc;
787 }
788 MI_Timestamp;
789
790 /*
791 **==============================================================================
792 **
793 ** struct MI_Interval
794 **
795 ** Represents an interval as described in the CIM Infrastructure
796 ** specification. This structure is padded to have the same length
797 ** as a MI_Timestamp structure.
798 **
799 mike 1.1 ** [1] MI_ee DSP0004 (http://www.dmtf.org/standards/published_documents)
800 **
801 **==============================================================================
802 */
803
804 typedef struct _MI_Interval
805 {
806 /* DDDDDDDDHHMMSS.MMMMMM:000 */
807 MI_Uint32 days;
808 MI_Uint32 hours;
809 MI_Uint32 minutes;
810 MI_Uint32 seconds;
811 MI_Uint32 microseconds;
812 MI_Uint32 __padding1;
813 MI_Uint32 __padding2;
814 MI_Uint32 __padding3;
815 }
816 MI_Interval;
817
818 /*
819 **==============================================================================
820 mike 1.1 **
821 ** struct MI_Datetime
822 **
823 ** Represents a CIM datetime type as described in the CIM Infrastructure
824 ** specification. It contains a union of MI_Timestamp and MI_Interval.
825 **
826 **==============================================================================
827 */
828
829 typedef struct _MI_Datetime
830 {
831 MI_Uint32 isTimestamp;
832 union
833 {
834 MI_Timestamp timestamp;
835 MI_Interval interval;
836 }
837 u;
838 }
839 MI_Datetime;
840
841 mike 1.1 /*
842 **==============================================================================
843 **
844 ** struct MI_<TYPE>A
845 **
846 ** These structure represent arrays of the types introduced above.
847 **
848 **==============================================================================
849 */
850
851 typedef struct _MI_BooleanA
852 {
853 MI_Boolean* data;
854 MI_Uint32 size;
855 }
856 MI_BooleanA;
857
858 typedef struct _MI_Uint8A
859 {
860 MI_Uint8* data;
861 MI_Uint32 size;
862 mike 1.1 }
863 MI_Uint8A;
864
865 typedef struct _MI_Sint8A
866 {
867 MI_Sint8* data;
868 MI_Uint32 size;
869 }
870 MI_Sint8A;
871
872 typedef struct _MI_Uint16A
873 {
874 MI_Uint16* data;
875 MI_Uint32 size;
876 }
877 MI_Uint16A;
878
879 typedef struct _MI_Sint16A
880 {
881 MI_Sint16* data;
882 MI_Uint32 size;
883 mike 1.1 }
884 MI_Sint16A;
885
886 typedef struct _MI_Uint32A
887 {
888 MI_Uint32* data;
889 MI_Uint32 size;
890 }
891 MI_Uint32A;
892
893 typedef struct _MI_Sint32A
894 {
895 MI_Sint32* data;
896 MI_Uint32 size;
897 }
898 MI_Sint32A;
899
900 typedef struct _MI_Uint64A
901 {
902 MI_Uint64* data;
903 MI_Uint32 size;
904 mike 1.1 }
905 MI_Uint64A;
906
907 typedef struct _MI_Sint64A
908 {
909 MI_Sint64* data;
910 MI_Uint32 size;
911 }
912 MI_Sint64A;
913
914 typedef struct _MI_Real32A
915 {
916 MI_Real32* data;
917 MI_Uint32 size;
918 }
919 MI_Real32A;
920
921 typedef struct _MI_Real64A
922 {
923 MI_Real64* data;
924 MI_Uint32 size;
925 mike 1.1 }
926 MI_Real64A;
927
928 typedef struct _MI_Char16A
929 {
930 MI_Char16* data;
931 MI_Uint32 size;
932 }
933 MI_Char16A;
934
935 typedef struct _MI_DatetimeA
936 {
937 MI_Datetime* data;
938 MI_Uint32 size;
939 }
940 MI_DatetimeA;
941
942 typedef struct _MI_StringA
943 {
944 MI_Char** data;
945 MI_Uint32 size;
946 mike 1.1 }
947 MI_StringA;
948
949 typedef struct _MI_ReferenceA
950 {
951 struct _MI_Instance** data;
952 MI_Uint32 size;
953 }
954 MI_ReferenceA;
955
956 typedef struct _MI_InstanceA
957 {
958 MI_Instance** data;
959 MI_Uint32 size;
960 }
961 MI_InstanceA;
962
963 typedef struct _MI_Array
964 {
965 void* data;
966 MI_Uint32 size;
967 mike 1.1 }
968 MI_Array;
969
970 /*
971 **==============================================================================
972 **
973 ** struct MI_Const<TYPE>A
974 **
975 ** These structure represent arrays of the types introduced above.
976 **
977 **==============================================================================
978 */
979
980 typedef struct _MI_ConstBooleanA
981 {
982 MI_CONST MI_Boolean* data;
983 MI_Uint32 size;
984 }
985 MI_ConstBooleanA;
986
987 typedef struct _MI_ConstUint8A
988 mike 1.1 {
989 MI_CONST MI_Uint8* data;
990 MI_Uint32 size;
991 }
992 MI_ConstUint8A;
993
994 typedef struct _MI_ConstSint8A
995 {
996 MI_CONST MI_Sint8* data;
997 MI_Uint32 size;
998 }
999 MI_ConstSint8A;
1000
1001 typedef struct _MI_ConstUint16A
1002 {
1003 MI_CONST MI_Uint16* data;
1004 MI_Uint32 size;
1005 }
1006 MI_ConstUint16A;
1007
1008 typedef struct _MI_ConstSint16A
1009 mike 1.1 {
1010 MI_CONST MI_Sint16* data;
1011 MI_Uint32 size;
1012 }
1013 MI_ConstSint16A;
1014
1015 typedef struct _MI_ConstUint32A
1016 {
1017 MI_CONST MI_Uint32* data;
1018 MI_Uint32 size;
1019 }
1020 MI_ConstUint32A;
1021
1022 typedef struct _MI_ConstSint32A
1023 {
1024 MI_CONST MI_Sint32* data;
1025 MI_Uint32 size;
1026 }
1027 MI_ConstSint32A;
1028
1029 typedef struct _MI_ConstUint64A
1030 mike 1.1 {
1031 MI_CONST MI_Uint64* data;
1032 MI_Uint32 size;
1033 }
1034 MI_ConstUint64A;
1035
1036 typedef struct _MI_ConstSint64A
1037 {
1038 MI_CONST MI_Sint64* data;
1039 MI_Uint32 size;
1040 }
1041 MI_ConstSint64A;
1042
1043 typedef struct _MI_ConstReal32A
1044 {
1045 MI_CONST MI_Real32* data;
1046 MI_Uint32 size;
1047 }
1048 MI_ConstReal32A;
1049
1050 typedef struct _MI_ConstReal64A
1051 mike 1.1 {
1052 MI_CONST MI_Real64* data;
1053 MI_Uint32 size;
1054 }
1055 MI_ConstReal64A;
1056
1057 typedef struct _MI_ConstChar16A
1058 {
1059 MI_CONST MI_Char16* data;
1060 MI_Uint32 size;
1061 }
1062 MI_ConstChar16A;
1063
1064 typedef struct _MI_ConstDatetimeA
1065 {
1066 MI_CONST MI_Datetime* data;
1067 MI_Uint32 size;
1068 }
1069 MI_ConstDatetimeA;
1070
1071 typedef struct _MI_ConstStringA
1072 mike 1.1 {
1073 MI_CONST MI_Char* MI_CONST* data;
1074 MI_Uint32 size;
1075 }
1076 MI_ConstStringA;
1077
1078 typedef struct _MI_ConstReferenceA
1079 {
1080 MI_CONST MI_Instance* MI_CONST* data;
1081 MI_Uint32 size;
1082 }
1083 MI_ConstReferenceA;
1084
1085 typedef struct _MI_ConstInstanceA
1086 {
1087 MI_CONST MI_Instance* MI_CONST* data;
1088 MI_Uint32 size;
1089 }
1090 MI_ConstInstanceA;
1091
1092 /*
1093 mike 1.1 **==============================================================================
1094 **
1095 ** union MI_Value
1096 **
1097 ** This structure defines a union of all CIM data types.
1098 **
1099 **==============================================================================
1100 */
1101
1102 typedef union _MI_Value
1103 {
1104 MI_Boolean boolean;
1105 MI_Uint8 uint8;
1106 MI_Sint8 sint8;
1107 MI_Uint16 uint16;
1108 MI_Sint16 sint16;
1109 MI_Uint32 uint32;
1110 MI_Sint32 sint32;
1111 MI_Uint64 uint64;
1112 MI_Sint64 sint64;
1113 MI_Real32 real32;
1114 mike 1.1 MI_Real64 real64;
1115 MI_Char16 char16;
1116 MI_Datetime datetime;
1117 MI_Char* string;
1118 MI_Instance* instance;
1119 MI_Instance* reference;
1120 MI_BooleanA booleana;
1121 MI_Uint8A uint8a;
1122 MI_Sint8A sint8a;
1123 MI_Uint16A uint16a;
1124 MI_Sint16A sint16a;
1125 MI_Uint32A uint32a;
1126 MI_Sint32A sint32a;
1127 MI_Uint64A uint64a;
1128 MI_Sint64A sint64a;
1129 MI_Real32A real32a;
1130 MI_Real64A real64a;
1131 MI_Char16A char16a;
1132 MI_DatetimeA datetimea;
1133 MI_StringA stringa;
1134 MI_ReferenceA referencea;
1135 mike 1.1 MI_InstanceA instancea;
1136 MI_Array array;
1137 }
1138 MI_Value;
1139
1140 /*
1141 **==============================================================================
1142 **
1143 ** struct MI_<TYPE>Field
1144 **
1145 ** These structures represent property or parameter fields within generated
1146 ** structures. Each structure definition defines two fields.
1147 **
1148 ** value - a field of the given type.
1149 ** exists - a flag indicating whether the field is non-null.
1150 **
1151 ** The flags field is used for internal use.
1152 **
1153 **
1154 **==============================================================================
1155 */
1156 mike 1.1
1157 typedef struct _MI_BooleanField
1158 {
1159 MI_Boolean value;
1160 MI_Boolean exists;
1161 MI_Uint8 flags;
1162 }
1163 MI_BooleanField;
1164
1165 typedef struct _MI_Sint8Field
1166 {
1167 MI_Sint8 value;
1168 MI_Boolean exists;
1169 MI_Uint8 flags;
1170 }
1171 MI_Sint8Field;
1172
1173 typedef struct _MI_Uint8Field
1174 {
1175 MI_Uint8 value;
1176 MI_Boolean exists;
1177 mike 1.1 MI_Uint8 flags;
1178 }
1179 MI_Uint8Field;
1180
1181 typedef struct _MI_Sint16Field
1182 {
1183 MI_Sint16 value;
1184 MI_Boolean exists;
1185 MI_Uint8 flags;
1186 }
1187 MI_Sint16Field;
1188
1189 typedef struct _MI_Uint16Field
1190 {
1191 MI_Uint16 value;
1192 MI_Boolean exists;
1193 MI_Uint8 flags;
1194 }
1195 MI_Uint16Field;
1196
1197 typedef struct _MI_Sint32Field
1198 mike 1.1 {
1199 MI_Sint32 value;
1200 MI_Boolean exists;
1201 MI_Uint8 flags;
1202 }
1203 MI_Sint32Field;
1204
1205 typedef struct _MI_Uint32Field
1206 {
1207 MI_Uint32 value;
1208 MI_Boolean exists;
1209 MI_Uint8 flags;
1210 }
1211 MI_Uint32Field;
1212
1213 typedef struct _MI_Sint64Field
1214 {
1215 MI_Sint64 value;
1216 MI_Boolean exists;
1217 MI_Uint8 flags;
1218 }
1219 mike 1.1 MI_Sint64Field;
1220
1221 typedef struct _MI_Uint64Field
1222 {
1223 MI_Uint64 value;
1224 MI_Boolean exists;
1225 MI_Uint8 flags;
1226 }
1227 MI_Uint64Field;
1228
1229 typedef struct _MI_Real32Field
1230 {
1231 MI_Real32 value;
1232 MI_Boolean exists;
1233 MI_Uint8 flags;
1234 }
1235 MI_Real32Field;
1236
1237 typedef struct _MI_Real64Field
1238 {
1239 MI_Real64 value;
1240 mike 1.1 MI_Boolean exists;
1241 MI_Uint8 flags;
1242 }
1243 MI_Real64Field;
1244
1245 typedef struct _MI_Char16Field
1246 {
1247 MI_Char16 value;
1248 MI_Boolean exists;
1249 MI_Uint8 flags;
1250 }
1251 MI_Char16Field;
1252
1253 typedef struct _MI_DatetimeField
1254 {
1255 MI_Datetime value;
1256 MI_Boolean exists;
1257 MI_Uint8 flags;
1258 }
1259 MI_DatetimeField;
1260
1261 mike 1.1 typedef struct _MI_StringField
1262 {
1263 MI_Char* value;
1264 MI_Boolean exists;
1265 MI_Uint8 flags;
1266 }
1267 MI_StringField;
1268
1269 typedef struct _MI_ReferenceField
1270 {
1271 MI_Instance* value;
1272 MI_Boolean exists;
1273 MI_Uint8 flags;
1274 }
1275 MI_ReferenceField;
1276
1277 typedef struct _MI_InstanceField
1278 {
1279 MI_Instance* value;
1280 MI_Boolean exists;
1281 MI_Uint8 flags;
1282 mike 1.1 }
1283 MI_InstanceField;
1284
1285 typedef struct _MI_BooleanAField
1286 {
1287 MI_BooleanA value;
1288 MI_Boolean exists;
1289 MI_Uint8 flags;
1290 }
1291 MI_BooleanAField;
1292
1293 typedef struct _MI_Uint8AField
1294 {
1295 MI_Uint8A value;
1296 MI_Boolean exists;
1297 MI_Uint8 flags;
1298 }
1299 MI_Uint8AField;
1300
1301 typedef struct _MI_Sint8AField
1302 {
1303 mike 1.1 MI_Sint8A value;
1304 MI_Boolean exists;
1305 MI_Uint8 flags;
1306 }
1307 MI_Sint8AField;
1308
1309 typedef struct _MI_Uint16AField
1310 {
1311 MI_Uint16A value;
1312 MI_Boolean exists;
1313 MI_Uint8 flags;
1314 }
1315 MI_Uint16AField;
1316
1317 typedef struct _MI_Sint16AField
1318 {
1319 MI_Sint16A value;
1320 MI_Boolean exists;
1321 MI_Uint8 flags;
1322 }
1323 MI_Sint16AField;
1324 mike 1.1
1325 typedef struct _MI_Uint32AField
1326 {
1327 MI_Uint32A value;
1328 MI_Boolean exists;
1329 MI_Uint8 flags;
1330 }
1331 MI_Uint32AField;
1332
1333 typedef struct _MI_Sint32AField
1334 {
1335 MI_Sint32A value;
1336 MI_Boolean exists;
1337 MI_Uint8 flags;
1338 }
1339 MI_Sint32AField;
1340
1341 typedef struct _MI_Uint64AField
1342 {
1343 MI_Uint64A value;
1344 MI_Boolean exists;
1345 mike 1.1 MI_Uint8 flags;
1346 }
1347 MI_Uint64AField;
1348
1349 typedef struct _MI_Sint64AField
1350 {
1351 MI_Sint64A value;
1352 MI_Boolean exists;
1353 MI_Uint8 flags;
1354 }
1355 MI_Sint64AField;
1356
1357 typedef struct _MI_Real32AField
1358 {
1359 MI_Real32A value;
1360 MI_Boolean exists;
1361 MI_Uint8 flags;
1362 }
1363 MI_Real32AField;
1364
1365 typedef struct _MI_Real64AField
1366 mike 1.1 {
1367 MI_Real64A value;
1368 MI_Boolean exists;
1369 MI_Uint8 flags;
1370 }
1371 MI_Real64AField;
1372
1373 typedef struct _MI_Char16AField
1374 {
1375 MI_Char16A value;
1376 MI_Boolean exists;
1377 MI_Uint8 flags;
1378 }
1379 MI_Char16AField;
1380
1381 typedef struct _MI_DatetimeAField
1382 {
1383 MI_DatetimeA value;
1384 MI_Boolean exists;
1385 MI_Uint8 flags;
1386 }
1387 mike 1.1 MI_DatetimeAField;
1388
1389 typedef struct _MI_StringAField
1390 {
1391 MI_StringA value;
1392 MI_Boolean exists;
1393 MI_Uint8 flags;
1394 }
1395 MI_StringAField;
1396
1397 typedef struct _MI_ReferenceAField
1398 {
1399 MI_ReferenceA value;
1400 MI_Boolean exists;
1401 MI_Uint8 flags;
1402 }
1403 MI_ReferenceAField;
1404
1405 typedef struct _MI_InstanceAField
1406 {
1407 MI_InstanceA value;
1408 mike 1.1 MI_Boolean exists;
1409 MI_Uint8 flags;
1410 }
1411 MI_InstanceAField;
1412
1413 typedef struct _MI_ArrayField
1414 {
1415 MI_Array value;
1416 MI_Boolean exists;
1417 MI_Uint8 flags;
1418 }
1419 MI_ArrayField;
1420
1421
1422 /*
1423 **==============================================================================
1424 **
1425 ** struct MI_Const<TYPE>Field
1426 **
1427 ** These structures represent property or parameter fields within generated
1428 ** structures. Each structure definition defines two fields.
1429 mike 1.1 **
1430 ** value - a field of the given type.
1431 ** exists - a flag indicating whether the field is non-null.
1432 **
1433 ** The flags field is used for internal use.
1434 **
1435 **==============================================================================
1436 */
1437
1438 typedef struct _MI_ConstBooleanField
1439 {
1440 MI_Boolean value;
1441 MI_Boolean exists;
1442 MI_Uint8 flags;
1443 }
1444 MI_ConstBooleanField;
1445
1446 typedef struct _MI_ConstSint8Field
1447 {
1448 MI_Sint8 value;
1449 MI_Boolean exists;
1450 mike 1.1 MI_Uint8 flags;
1451 }
1452 MI_ConstSint8Field;
1453
1454 typedef struct _MI_ConstUint8Field
1455 {
1456 MI_Uint8 value;
1457 MI_Boolean exists;
1458 MI_Uint8 flags;
1459 }
1460 MI_ConstUint8Field;
1461
1462 typedef struct _MI_ConstSint16Field
1463 {
1464 MI_Sint16 value;
1465 MI_Boolean exists;
1466 MI_Uint8 flags;
1467 }
1468 MI_ConstSint16Field;
1469
1470 typedef struct _MI_ConstUint16Field
1471 mike 1.1 {
1472 MI_Uint16 value;
1473 MI_Boolean exists;
1474 MI_Uint8 flags;
1475 }
1476 MI_ConstUint16Field;
1477
1478 typedef struct _MI_ConstSint32Field
1479 {
1480 MI_Sint32 value;
1481 MI_Boolean exists;
1482 MI_Uint8 flags;
1483 }
1484 MI_ConstSint32Field;
1485
1486 typedef struct _MI_ConstUint32Field
1487 {
1488 MI_Uint32 value;
1489 MI_Boolean exists;
1490 MI_Uint8 flags;
1491 }
1492 mike 1.1 MI_ConstUint32Field;
1493
1494 typedef struct _MI_ConstSint64Field
1495 {
1496 MI_Sint64 value;
1497 MI_Boolean exists;
1498 MI_Uint8 flags;
1499 }
1500 MI_ConstSint64Field;
1501
1502 typedef struct _MI_ConstUint64Field
1503 {
1504 MI_Uint64 value;
1505 MI_Boolean exists;
1506 MI_Uint8 flags;
1507 }
1508 MI_ConstUint64Field;
1509
1510 typedef struct _MI_ConstReal32Field
1511 {
1512 MI_Real32 value;
1513 mike 1.1 MI_Boolean exists;
1514 MI_Uint8 flags;
1515 }
1516 MI_ConstReal32Field;
1517
1518 typedef struct _MI_ConstReal64Field
1519 {
1520 MI_Real64 value;
1521 MI_Boolean exists;
1522 MI_Uint8 flags;
1523 }
1524 MI_ConstReal64Field;
1525
1526 typedef struct _MI_ConstChar16Field
1527 {
1528 MI_Char16 value;
1529 MI_Boolean exists;
1530 MI_Uint8 flags;
1531 }
1532 MI_ConstChar16Field;
1533
1534 mike 1.1 typedef struct _MI_ConstDatetimeField
1535 {
1536 MI_Datetime value;
1537 MI_Boolean exists;
1538 MI_Uint8 flags;
1539 }
1540 MI_ConstDatetimeField;
1541
1542 typedef struct _MI_ConstStringField
1543 {
1544 MI_CONST MI_Char* value;
1545 MI_Boolean exists;
1546 MI_Uint8 flags;
1547 }
1548 MI_ConstStringField;
1549
1550 typedef struct _MI_ConstReferenceField
1551 {
1552 MI_CONST MI_Instance* value;
1553 MI_Boolean exists;
1554 MI_Uint8 flags;
1555 mike 1.1 }
1556 MI_ConstReferenceField;
1557
1558 typedef struct _MI_ConstInstanceField
1559 {
1560 MI_CONST MI_Instance* value;
1561 MI_Boolean exists;
1562 MI_Uint8 flags;
1563 }
1564 MI_ConstInstanceField;
1565
1566 typedef struct _MI_ConstBooleanAField
1567 {
1568 MI_ConstBooleanA value;
1569 MI_Boolean exists;
1570 MI_Uint8 flags;
1571 }
1572 MI_ConstBooleanAField;
1573
1574 typedef struct _MI_ConstUint8AField
1575 {
1576 mike 1.1 MI_ConstUint8A value;
1577 MI_Boolean exists;
1578 MI_Uint8 flags;
1579 }
1580 MI_ConstUint8AField;
1581
1582 typedef struct _MI_ConstSint8AField
1583 {
1584 MI_ConstSint8A value;
1585 MI_Boolean exists;
1586 MI_Uint8 flags;
1587 }
1588 MI_ConstSint8AField;
1589
1590 typedef struct _MI_ConstUint16AField
1591 {
1592 MI_ConstUint16A value;
1593 MI_Boolean exists;
1594 MI_Uint8 flags;
1595 }
1596 MI_ConstUint16AField;
1597 mike 1.1
1598 typedef struct _MI_ConstSint16AField
1599 {
1600 MI_ConstSint16A value;
1601 MI_Boolean exists;
1602 MI_Uint8 flags;
1603 }
1604 MI_ConstSint16AField;
1605
1606 typedef struct _MI_ConstUint32AField
1607 {
1608 MI_ConstUint32A value;
1609 MI_Boolean exists;
1610 MI_Uint8 flags;
1611 }
1612 MI_ConstUint32AField;
1613
1614 typedef struct _MI_ConstSint32AField
1615 {
1616 MI_ConstSint32A value;
1617 MI_Boolean exists;
1618 mike 1.1 MI_Uint8 flags;
1619 }
1620 MI_ConstSint32AField;
1621
1622 typedef struct _MI_ConstUint64AField
1623 {
1624 MI_ConstUint64A value;
1625 MI_Boolean exists;
1626 MI_Uint8 flags;
1627 }
1628 MI_ConstUint64AField;
1629
1630 typedef struct _MI_ConstSint64AField
1631 {
1632 MI_ConstSint64A value;
1633 MI_Boolean exists;
1634 MI_Uint8 flags;
1635 }
1636 MI_ConstSint64AField;
1637
1638 typedef struct _MI_ConstReal32AField
1639 mike 1.1 {
1640 MI_ConstReal32A value;
1641 MI_Boolean exists;
1642 MI_Uint8 flags;
1643 }
1644 MI_ConstReal32AField;
1645
1646 typedef struct _MI_ConstReal64AField
1647 {
1648 MI_ConstReal64A value;
1649 MI_Boolean exists;
1650 MI_Uint8 flags;
1651 }
1652 MI_ConstReal64AField;
1653
1654 typedef struct _MI_ConstChar16AField
1655 {
1656 MI_ConstChar16A value;
1657 MI_Boolean exists;
1658 MI_Uint8 flags;
1659 }
1660 mike 1.1 MI_ConstChar16AField;
1661
1662 typedef struct _MI_ConstDatetimeAField
1663 {
1664 MI_ConstDatetimeA value;
1665 MI_Boolean exists;
1666 MI_Uint8 flags;
1667 }
1668 MI_ConstDatetimeAField;
1669
1670 typedef struct _MI_ConstStringAField
1671 {
1672 MI_ConstStringA value;
1673 MI_Boolean exists;
1674 MI_Uint8 flags;
1675 }
1676 MI_ConstStringAField;
1677
1678 typedef struct _MI_ConstReferenceAField
1679 {
1680 MI_ConstReferenceA value;
1681 mike 1.1 MI_Boolean exists;
1682 MI_Uint8 flags;
1683 }
1684 MI_ConstReferenceAField;
1685
1686 typedef struct _MI_ConstInstanceAField
1687 {
1688 MI_ConstInstanceA value;
1689 MI_Boolean exists;
1690 MI_Uint8 flags;
1691 }
1692 MI_ConstInstanceAField;
1693
1694 /*
1695 **==============================================================================
1696 **
1697 ** MI_Server
1698 **
1699 **==============================================================================
1700 */
1701
1702 mike 1.1 struct _MI_ServerFT
1703 {
1704 MI_Result (MI_CALL *GetVersion)(
1705 MI_Uint32* version);
1706
1707 MI_Result (MI_CALL *GetSystemName)(
1708 const MI_Char** systemName);
1709 };
1710
1711 /**
1712 * This structure defines the global server object. It defines the interface
1713 * for communicating with the server. It also defines default function tables
1714 * for all other types (Context, Instance, PropertySet, and Filter).
1715 *
1716 */
1717 struct _MI_Server
1718 {
1719 const MI_ServerFT* serverFT;
1720 const MI_ContextFT* contextFT;
1721 const MI_InstanceFT* instanceFT;
1722 const MI_PropertySetFT* propertySetFT;
1723 mike 1.1 const MI_FilterFT* filterFT;
1724 };
1725
1726 /**
1727 * Obtains the value of the MI_VERSION macro used when compiling the server.
1728 *
1729 * param: version contains the version number upon return.
1730 *
1731 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER
1732 *
1733 */
1734 MI_Result MI_CALL MI_Server_GetVersion(MI_Uint32* version);
1735
1736 /**
1737 * Obtains the 'system name' for this server. The system name is used in
1738 * several standard CIM key properties (e.g., CIM_Fan.SystemName). The name
1739 * is only known by the server. The provider should never attempt to determine
1740 * the system name on its own. The system name is typically the hostname
1741 * for the system but the server may add additional qualification.
1742 *
1743 * param: systemName points to the system name upon return (remains in scope
1744 mike 1.1 * for the lifetime of the process.
1745 *
1746 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER
1747 *
1748 */
1749 MI_Result MI_CALL MI_Server_GetSystemName(const MI_Char** systemName);
1750
1751 /*
1752 **==============================================================================
1753 **
1754 ** MI_Filter
1755 **
1756 **==============================================================================
1757 */
1758
1759 /** The MI_FilterFT function table */
1760 struct _MI_FilterFT
1761 {
1762 MI_Result (MI_CALL *Evaluate)(
1763 _In_ const MI_Filter* self,
1764 _In_ const MI_Instance* instance,
1765 mike 1.1 _Out_ MI_Boolean* result);
1766
1767 MI_Result (MI_CALL *GetExpression)(
1768 _In_ const MI_Filter* self,
1769 _Outptr_result_maybenull_z_ const MI_Char** queryLang,
1770 _Outptr_result_maybenull_z_ const MI_Char** queryExpr);
1771 };
1772
1773 struct _MI_Filter
1774 {
1775 /* Function table */
1776 const MI_FilterFT* ft;
1777
1778 /* Reserved for internal use */
1779 ptrdiff_t reserved[3];
1780 };
1781
1782 /**
1783 *
1784 * Provider calls this function to evaluate an instance against given filter.
1785 *
1786 mike 1.1 * param: self pointer to the filter.
1787 * param: instance to evaluate.
1788 * param: on completion, result indicates whether the instance matched the filter.
1789 *
1790 * return: MI_RESULT_OK, MI_RESULT_FAILED
1791 *
1792 */
1793 MI_INLINE MI_Result MI_CALL MI_Filter_Evaluate(
1794 _In_ const MI_Filter* self,
1795 _In_ const MI_Instance* instance,
1796 _Out_ MI_Boolean* result)
1797 {
1798 if (self && self->ft)
1799 {
1800 return self->ft->Evaluate(self, instance, result);
1801 }
1802 else
1803 {
1804 return MI_RESULT_INVALID_PARAMETER;
1805 }
1806 }
1807 mike 1.1
1808 /**
1809 *
1810 * This function returns filter language and expression.
1811 *
1812 * param: self pointer to the filter.
1813 * param: queryExpr the query string upon return.
1814 * param: queryLang the query language upon return.
1815 *
1816 * return: MI_RESULT_OK, MI_RESULT_FAILED
1817 *
1818 */
1819 MI_INLINE MI_Result MI_CALL MI_Filter_GetExpression(
1820 _In_ const MI_Filter* self,
1821 _Outptr_result_maybenull_z_ const MI_Char** queryLang,
1822 _Outptr_result_maybenull_z_ const MI_Char** queryExpr)
1823 {
1824 if (self && self->ft)
1825 {
1826 return self->ft->GetExpression(self, queryLang, queryExpr);
1827 }
1828 mike 1.1 else
1829 {
1830 return MI_RESULT_INVALID_PARAMETER;
1831 }
1832 }
1833
1834 /*
1835 **==============================================================================
1836 **
1837 ** The MI_PropertySet Module
1838 **
1839 **==============================================================================
1840 */
1841
1842
1843 /** The MI_PropertySet function table. */
1844 struct _MI_PropertySetFT
1845 {
1846 MI_Result (MI_CALL *GetElementCount)(
1847 _In_ const MI_PropertySet* self,
1848 _Out_ MI_Uint32* count);
1849 mike 1.1
1850 MI_Result (MI_CALL *ContainsElement)(
1851 _In_ const MI_PropertySet* self,
1852 _In_z_ const MI_Char* name,
1853 _Out_ MI_Boolean* flag);
1854
1855 MI_Result (MI_CALL *AddElement)(
1856 _Inout_ MI_PropertySet* self,
1857 _In_z_ const MI_Char* name);
1858
1859 MI_Result (MI_CALL *GetElementAt)(
1860 _In_ const MI_PropertySet* self,
1861 MI_Uint32 index,
1862 _Outptr_result_z_ const MI_Char** name);
1863
1864 MI_Result (MI_CALL *Clear)(
1865 _Inout_ MI_PropertySet* self);
1866
1867 MI_Result (MI_CALL *Destruct)(
1868 _Inout_ MI_PropertySet* self);
1869
1870 mike 1.1 MI_Result (MI_CALL *Delete)(
1871 _Inout_ MI_PropertySet* self);
1872
1873 MI_Result (MI_CALL *Clone)(
1874 _In_ const MI_PropertySet* self,
1875 _Outptr_ MI_PropertySet** newPropertySet);
1876 };
1877
1878 /**
1879 * This type implements a set of property names. It supports building of
1880 * property sets and interrogation of property sets. In general, clients
1881 * build property sets and providers interrogate them.
1882 *
1883 */
1884 struct _MI_PropertySet
1885 {
1886 /* Function table */
1887 const MI_PropertySetFT* ft;
1888
1889 /* Reserved for internal use */
1890 ptrdiff_t reserved[3];
1891 mike 1.1 };
1892
1893 /**
1894 * Gets the number of properties in the list.
1895 *
1896 * param: self the property list
1897 * param: count the number of properties upon return.
1898 *
1899 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
1900 *
1901 */
1902 MI_INLINE MI_Result MI_CALL MI_PropertySet_GetElementCount(
1903 _In_ const MI_PropertySet* self,
1904 _Out_ MI_Uint32* count)
1905 {
1906 if (self && self->ft)
1907 {
1908 return self->ft->GetElementCount(self, count);
1909 }
1910 else
1911 {
1912 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
1913 }
1914 }
1915
1916 /**
1917 * Determines whether the property list contains the given property.
1918 *
1919 * param: self the property list
1920 * param: name check whether this property is contained in list.
1921 * param: flag MI_TRUE upon return if property was found. MI_FALSE otherwise.
1922 *
1923 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
1924 *
1925 */
1926 MI_INLINE MI_Result MI_CALL MI_PropertySet_ContainsElement(
1927 _In_ const MI_PropertySet* self,
1928 _In_z_ const MI_Char* name,
1929 _Out_ MI_Boolean* flag)
1930 {
1931 if (self && self->ft)
1932 {
1933 mike 1.1 return self->ft->ContainsElement(self, name, flag);
1934 }
1935 else
1936 {
1937 return MI_RESULT_INVALID_PARAMETER;
1938 }
1939 }
1940
1941 /**
1942 * Adds a name to the property list.
1943 *
1944 * param: self the property list
1945 * param: name add this name to the property list.
1946 *
1947 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_ALREADY_EXISTS, MI_RESULT_INVALID_PARAMETER
1948 *
1949 */
1950 MI_INLINE MI_Result MI_CALL MI_PropertySet_AddElement(
1951 _Inout_ MI_PropertySet* self,
1952 _In_z_ const MI_Char* name)
1953 {
1954 mike 1.1 if (self && self->ft)
1955 {
1956 return self->ft->AddElement(self, name);
1957 }
1958 else
1959 {
1960 return MI_RESULT_INVALID_PARAMETER;
1961 }
1962 }
1963
1964 /**
1965 * Gets the i-th name from the list.
1966 *
1967 * param: self the property list.
1968 * param: index get the name with this index.
1969 * param: name set this to point to the name (the lifetime of this string
1970 * is tied to the property list).
1971 *
1972 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
1973 *
1974 */
1975 mike 1.1 MI_INLINE MI_Result MI_CALL MI_PropertySet_GetElementAt(
1976 _In_ const MI_PropertySet* self,
1977 MI_Uint32 index,
1978 _Outptr_result_z_ const MI_Char** name)
1979 {
1980 if (self && self->ft)
1981 {
1982 return self->ft->GetElementAt(self, index, name);
1983 }
1984 else
1985 {
1986 return MI_RESULT_INVALID_PARAMETER;
1987 }
1988 }
1989
1990 /**
1991 * Remove all names from the property list. Afterwards, the count is zero
1992 * This allows property lists to be reused (without having to be destructed
1993 * and reconstructed).
1994 *
1995 * param: self the property list
1996 mike 1.1 *
1997 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
1998 *
1999 */
2000 MI_INLINE MI_Result MI_CALL MI_PropertySet_Clear(
2001 _Inout_ MI_PropertySet* self)
2002 {
2003 if (self && self->ft)
2004 {
2005 return self->ft->Clear(self);
2006 }
2007 else
2008 {
2009 return MI_RESULT_INVALID_PARAMETER;
2010 }
2011 }
2012
2013 /**
2014 * Destructs the property list (releasing memory resources). The property list
2015 * must have been constructed on the stack and not on the heap.
2016 *
2017 mike 1.1 * param: self the property list
2018 *
2019 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
2020 *
2021 */
2022 MI_INLINE MI_Result MI_CALL MI_PropertySet_Destruct(
2023 _Inout_ MI_PropertySet* self)
2024 {
2025 if (self && self->ft)
2026 {
2027 return self->ft->Destruct(self);
2028 }
2029 else
2030 {
2031 return MI_RESULT_INVALID_PARAMETER;
2032 }
2033 }
2034
2035 /**
2036 * Deletes the property list (releasing memory resources). The property list
2037 * must have been constructed on the heap (not the stack).
2038 mike 1.1 *
2039 * param: self the property list
2040 *
2041 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
2042 *
2043 */
2044 MI_INLINE MI_Result MI_CALL MI_PropertySet_Delete(
2045 _Inout_ MI_PropertySet* self)
2046 {
2047 if (self && self->ft)
2048 {
2049 return self->ft->Delete(self);
2050 }
2051 else
2052 {
2053 return MI_RESULT_INVALID_PARAMETER;
2054 }
2055 }
2056
2057
2058 /**
2059 mike 1.1 * This function creates a copy of the given Property set on the heap. Upon
2060 * a successful return, new property set points to a newly created property set object.
2061 * The new property set should eventually be passed to MI_PropertySet_Delete().
2062 *
2063 * param: self pointer to the property set to be cloned.
2064 * param: newPropertySet a pointer to the new property set upon return.
2065 *
2066 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
2067 *
2068 */
2069 MI_INLINE MI_Result MI_CALL MI_PropertySet_Clone(
2070 _In_ const MI_PropertySet* self,
2071 _Outptr_ MI_PropertySet** newPropertySet)
2072 {
2073 if (self && self->ft)
2074 {
2075 return self->ft->Clone(self, newPropertySet);
2076 }
2077 else
2078 {
2079 return MI_RESULT_INVALID_PARAMETER;
2080 mike 1.1 }
2081 }
2082
2083
2084
2085 /*
2086 **==============================================================================
2087 **
2088 ** struct MI_ObjectDecl
2089 **
2090 ** A base type for MI_ClassDecl and MI_PropertyDecl, which allows functions
2091 ** to be written that work on the common fields of these two types.
2092 **
2093 **==============================================================================
2094 */
2095
2096 typedef struct _MI_ObjectDecl /* extends MI_FeatureDecl */
2097 {
2098 /* Fields inherited from MI_FeatureDecl */
2099 MI_Uint32 flags;
2100 MI_Uint32 code;
2101 mike 1.1 MI_CONST MI_Char* name;
2102 MI_Qualifier MI_CONST* MI_CONST* qualifiers;
2103 MI_Uint32 numQualifiers;
2104
2105 /* The properties or parameters of this object. Note that for methods
2106 * the type will be MI_ParameterDecl rather than MI_PropertyDecl.
2107 */
2108 struct _MI_PropertyDecl MI_CONST* MI_CONST* properties;
2109 MI_Uint32 numProperties;
2110
2111 /* Size of structure described by MI_MethodDecl or MI_ClassDecl */
2112 MI_Uint32 size;
2113 }
2114 MI_ObjectDecl;
2115
2116 /*
2117 **==============================================================================
2118 **
2119 ** struct MI_ClassDecl
2120 **
2121 ** Represents a CIM class.
2122 mike 1.1 **
2123 ** Flags:
2124 ** MI_FLAG_CLASS
2125 ** MI_FLAG_ASSOCIATION
2126 ** MI_FLAG_INDICATION
2127 ** MI_FLAG_ABSTRACT
2128 ** MI_FLAG_TERMINAL
2129 **
2130 **==============================================================================
2131 */
2132
2133 struct _MI_ClassDecl /* extends MI_ObjectDecl */
2134 {
2135 /* Fields inherited from MI_FeatureDecl */
2136 MI_Uint32 flags;
2137 MI_Uint32 code;
2138 MI_CONST MI_Char* name;
2139 struct _MI_Qualifier MI_CONST* MI_CONST* qualifiers;
2140 MI_Uint32 numQualifiers;
2141
2142 /* Fields inherited from MI_ObjectDecl */
2143 mike 1.1 struct _MI_PropertyDecl MI_CONST* MI_CONST* properties;
2144 MI_Uint32 numProperties;
2145 MI_Uint32 size;
2146
2147 /* Name of superclass */
2148 MI_CONST MI_Char* superClass;
2149
2150 /* Superclass declaration */
2151 MI_ClassDecl MI_CONST* superClassDecl;
2152
2153 /* The methods of this class */
2154 struct _MI_MethodDecl MI_CONST* MI_CONST* methods;
2155 MI_Uint32 numMethods;
2156
2157 /* Pointer to scema this class belongs to */
2158 struct _MI_SchemaDecl MI_CONST* schema;
2159
2160 /* Provider functions */
2161 MI_CONST MI_ProviderFT* providerFT;
2162
2163 /* Owning MI_Class object, if any. NULL if static classDecl, -1 is from a dynamic instance */
2164 mike 1.1 MI_Class *owningClass;
2165 };
2166
2167 /*
2168 **==============================================================================
2169 **
2170 ** struct MI_InstanceDecl
2171 **
2172 ** Represents an instance declaration (as encountered in MOF).
2173 **
2174 **==============================================================================
2175 */
2176
2177 typedef struct _MI_InstanceDecl MI_InstanceDecl;
2178
2179 struct _MI_InstanceDecl /* extends MI_ObjectDecl */
2180 {
2181 /* Fields inherited from MI_FeatureDecl */
2182 MI_Uint32 flags;
2183 MI_Uint32 code;
2184 MI_CONST MI_Char* name; /* name of class of which this is an instance */
2185 mike 1.1 struct _MI_Qualifier MI_CONST* MI_CONST* qualifiers; /* unused */
2186 MI_Uint32 numQualifiers; /* unused */
2187
2188 /* Fields inherited from MI_ObjectDecl */
2189 struct _MI_PropertyDecl MI_CONST* MI_CONST* properties;
2190 MI_Uint32 numProperties;
2191 MI_Uint32 size;
2192 };
2193
2194 /*
2195 **==============================================================================
2196 **
2197 ** struct MI_FeatureDecl
2198 **
2199 ** This structure functions as a base type for these structures:
2200 ** MI_PropertyDecl
2201 ** MI_ParameterDecl
2202 ** MI_MethodDecl
2203 **
2204 **==============================================================================
2205 */
2206 mike 1.1
2207 typedef struct _MI_FeatureDecl
2208 {
2209 /* Flags */
2210 MI_Uint32 flags;
2211
2212 /* Hash code: (name[0] << 16) | (name[len-1] << 8) | len */
2213 MI_Uint32 code;
2214
2215 /* Name of this feature */
2216 MI_CONST MI_Char* name;
2217
2218 /* Qualifiers */
2219 MI_Qualifier MI_CONST* MI_CONST * qualifiers;
2220 MI_Uint32 numQualifiers;
2221 }
2222 MI_FeatureDecl;
2223
2224 /*
2225 **==============================================================================
2226 **
2227 mike 1.1 ** struct MI_ParameterDecl
2228 **
2229 ** Represents a CIM property (or reference)
2230 **
2231 ** Flags:
2232 ** MI_FLAG_PROPERTY
2233 ** MI_FLAG_KEY
2234 **
2235 **==============================================================================
2236 */
2237
2238 typedef struct _MI_ParameterDecl /* extends MI_FeatureDecl */
2239 {
2240 /* Fields inherited from MI_FeatureDecl */
2241 MI_Uint32 flags;
2242 MI_Uint32 code;
2243 MI_CONST MI_Char* name;
2244 MI_Qualifier MI_CONST* MI_CONST* qualifiers;
2245 MI_Uint32 numQualifiers;
2246
2247 /* Type of this field */
2248 mike 1.1 MI_Uint32 type;
2249
2250 /* Name of reference class */
2251 MI_CONST MI_Char* className;
2252
2253 /* Array subscript */
2254 MI_Uint32 subscript;
2255
2256 /* Offset of this field within the structure */
2257 MI_Uint32 offset;
2258 }
2259 MI_ParameterDecl;
2260
2261 /*
2262 **==============================================================================
2263 **
2264 ** struct MI_PropertyDecl
2265 **
2266 ** Represents a CIM property (or reference)
2267 **
2268 ** Flags:
2269 mike 1.1 ** MI_FLAG_PROPERTY
2270 ** MI_FLAG_KEY
2271 **
2272 **==============================================================================
2273 */
2274
2275 typedef struct _MI_PropertyDecl /* extends MI_ParameterDecl */
2276 {
2277 /* Fields inherited from MI_FeatureDecl */
2278 MI_Uint32 flags;
2279 MI_Uint32 code;
2280 MI_CONST MI_Char* name;
2281 MI_Qualifier MI_CONST* MI_CONST* qualifiers;
2282 MI_Uint32 numQualifiers;
2283
2284 /* Fields inherited from MI_ParameterDecl */
2285 MI_Uint32 type;
2286 MI_CONST MI_Char* className;
2287 MI_Uint32 subscript;
2288 MI_Uint32 offset;
2289
2290 mike 1.1 /* Ancestor class that first defined a property with this name */
2291 MI_CONST MI_Char* origin;
2292
2293 /* Ancestor class that last defined a property with this name */
2294 MI_CONST MI_Char* propagator;
2295
2296 /* Value of this property */
2297 MI_CONST void* value;
2298 }
2299 MI_PropertyDecl;
2300
2301 /*
2302 **==============================================================================
2303 **
2304 ** struct MI_MethodDecl
2305 **
2306 ** Represents a CIM method.
2307 **
2308 ** Flags:
2309 ** MI_FLAG_METHOD
2310 ** MI_FLAG_STATIC
2311 mike 1.1 **
2312 **==============================================================================
2313 */
2314
2315 typedef void (MI_CALL *MI_MethodDecl_Invoke)(
2316 _In_opt_ void* self,
2317 _In_ MI_Context* context,
2318 _In_z_ const MI_Char* nameSpace,
2319 _In_z_ const MI_Char* className,
2320 _In_z_ const MI_Char* methodName,
2321 _In_ const MI_Instance* instanceName,
2322 _In_ const MI_Instance* parameters);
2323
2324 typedef struct _MI_MethodDecl /* extends MI_ObjectDecl */
2325 {
2326 /* Fields inherited from MI_FeatureDecl */
2327 MI_Uint32 flags;
2328 MI_Uint32 code;
2329 MI_CONST MI_Char* name;
2330 struct _MI_Qualifier MI_CONST* MI_CONST* qualifiers;
2331 MI_Uint32 numQualifiers;
2332 mike 1.1
2333 /* Fields inherited from MI_ObjectDecl */
2334 struct _MI_ParameterDecl MI_CONST* MI_CONST* parameters;
2335 MI_Uint32 numParameters;
2336 MI_Uint32 size;
2337
2338 /* PostResult type of this method */
2339 MI_Uint32 returnType;
2340
2341 /* Ancestor class that first defined a property with this name */
2342 MI_CONST MI_Char* origin;
2343
2344 /* Ancestor class that last defined a property with this name */
2345 MI_CONST MI_Char* propagator;
2346
2347 /* Pointer to scema this class belongs to */
2348 struct _MI_SchemaDecl MI_CONST* schema;
2349
2350 /* Pointer to extrinsic method */
2351 MI_MethodDecl_Invoke function;
2352 }
2353 mike 1.1 MI_MethodDecl;
2354
2355 /*
2356 **==============================================================================
2357 **
2358 ** struct MI_QualifierDecl
2359 **
2360 ** Represents a CIM qualifier declaration.
2361 **
2362 **==============================================================================
2363 */
2364
2365 typedef struct _MI_QualifierDecl
2366 {
2367 /* Name of this qualifier */
2368 MI_CONST MI_Char* name;
2369
2370 /* Type of this qualifier */
2371 MI_Uint32 type;
2372
2373 /* Qualifier scope */
2374 mike 1.1 MI_Uint32 scope;
2375
2376 /* Qualifier flavor */
2377 MI_Uint32 flavor;
2378
2379 /* Array subscript (for arrays only) */
2380 MI_Uint32 subscript;
2381
2382 /* Pointer to value */
2383 MI_CONST void* value;
2384 }
2385 MI_QualifierDecl;
2386
2387 /*
2388 **==============================================================================
2389 **
2390 ** struct MI_Qualifier
2391 **
2392 ** Represents a CIM qualifier.
2393 **
2394 **==============================================================================
2395 mike 1.1 */
2396
2397 struct _MI_Qualifier
2398 {
2399 /* Qualifier name */
2400 MI_CONST MI_Char* name;
2401
2402 /* Qualifier type */
2403 MI_Uint32 type;
2404
2405 /* Qualifier flavor */
2406 MI_Uint32 flavor;
2407
2408 /* Pointer to value */
2409 MI_CONST void* value;
2410 };
2411
2412 /*
2413 **==============================================================================
2414 **
2415 ** struct MI_SchemaDecl
2416 mike 1.1 **
2417 ** This structure represents the schema objects in a CIM schemas, which
2418 ** include CIM classes and CIM qualifier declarations.
2419 **
2420 **==============================================================================
2421 */
2422
2423 typedef struct _MI_SchemaDecl
2424 {
2425 /* Qualifier declarations */
2426 MI_QualifierDecl MI_CONST* MI_CONST* qualifierDecls;
2427 MI_Uint32 numQualifierDecls;
2428
2429 /* Class declarations */
2430 MI_ClassDecl MI_CONST* MI_CONST* classDecls;
2431 MI_Uint32 numClassDecls;
2432 }
2433 MI_SchemaDecl;
2434
2435 /*
2436 **==============================================================================
2437 mike 1.1 **
2438 ** The MI_ProviderFT Module
2439 **
2440 **==============================================================================
2441 */
2442
2443 /* The developer may optionally define this structure in module.c */
2444 typedef struct _MI_Module_Self MI_Module_Self;
2445
2446 /**
2447 * The server invokes this function to initialize the provider, which
2448 * performs initialization activities. The provider may set the 'self'
2449 * parameter to refer to any provider state data (or null if no state data
2450 * is required). Whatever value the provider sets for 'self' is passed into
2451 * other calls to the provider.
2452 *
2453 * param: self the provider may set this to refer to any provider state data
2454 * (or NULL if no state data is required).
2455 * param: selfModule the 'self' parameter obtained when loading the module.
2456 * param: context the current request context
2457 *
2458 mike 1.1 * return: MI_RESULT_OK, MI_RESULT_FAILED
2459 *
2460 */
2461 typedef void (MI_CALL *MI_ProviderFT_Load)(
2462 _Outptr_ void** self,
2463 _In_opt_ MI_Module_Self* selfModule,
2464 _In_ MI_Context* context);
2465
2466 /**
2467 * The server invokes this function to release any resources held by the
2468 * provider. The provider should close any file handles and release any
2469 * memory associated with the execution of the provider.
2470 *
2471 * The implementation should pass MI_RESULT_OK or MI_RESULT_FAILED to
2472 * MI_Context_PostResult.
2473 *
2474 * param: self the provider state data.
2475 * param: context the request context.
2476 *
2477 * Result posting: nothing
2478 *
2479 mike 1.1 * return: MI_RESULT_OK, MI_RESULT_DO_NOT_UNLOAD, MI_RESULT_FAILED
2480 *
2481 */
2482 typedef void (MI_CALL *MI_ProviderFT_Unload)(
2483 _In_opt_ void* self,
2484 _In_ MI_Context* context);
2485
2486 /**
2487 * The server invokes the GetInstance function to obtain a single CIM
2488 * instance from the provider. The 'instanceName' property defines the
2489 * name of the instance to be retrieved.
2490 *
2491 * If the 'propertySet' parameter is not null, the elements of the set define
2492 * zero or more property names. The returned instance shall not include
2493 * elements for properties missing from this set. If the 'propertySet' input
2494 * parameter is an empty set, no properties are included in the response. If
2495 * the 'propertySet' input parameter is null, no properties shall be filtered.
2496 *
2497 * If the provider returns MI_RESULT_NOT_SUPPORTED (via MI_Context_PostResult), the
2498 * server attempts to satisfy the request by calling the provider's
2499 * 'EnumerateInstances' method. Do not rely on this behavior unless the
2500 mike 1.1 * number of instances is reasonably small.
2501 *
2502 * If GetInstance is successful, the provider should pass the new instance
2503 * to MI_Context_PostInstance(). If GetInstance is unsuccessful, the provider should
2504 * return one of the results listed below (via MI_Context_PostResult).
2505 *
2506 * param: self the provider state data
2507 * param: context the request context
2508 * param: nameSpace the namespace of the request.
2509 * param: className the name of the class.
2510 * param: instanceName name of the requested instance
2511 * param: propertySet list of required properties or NULL for all.
2512 *
2513 * Result posting: resulting instance.
2514 *
2515 * return:
2516 * MI_RESULT_OK
2517 * MI_RESULT_ACCESS_DENIED
2518 * MI_RESULT_INVALID_NAMESPACE
2519 * MI_RESULT_INVALID_PARAMETER
2520 * MI_RESULT_INVALID_CLASS
2521 mike 1.1 * MI_RESULT_NOT_FOUND
2522 * MI_RESULT_FAILED
2523 *
2524 */
2525 typedef void (MI_CALL *MI_ProviderFT_GetInstance)(
2526 _In_opt_ void* self,
2527 _In_ MI_Context* context,
2528 _In_z_ const MI_Char* nameSpace,
2529 _In_z_ const MI_Char* className,
2530 _In_ const MI_Instance* instanceName,
2531 _In_opt_ const MI_PropertySet* propertySet);
2532
2533 /**
2534 * The server calls EnumerateInstances to enumerate instances of a CIM class
2535 * in the target namespace. Note that the enumeration is not polymoprhic; the
2536 * implementaiton should provide instances of the exact class given by the
2537 * 'className' input parameter, and should not include instances of any
2538 * derived classes.
2539 *
2540 * The 'className' input parameter defines the exact class to be enumerated.
2541 *
2542 mike 1.1 * If the 'propertySet' parameter is not null, the elements of the set define
2543 * zero or more property names. The returned instances shall not include
2544 * elements for properties missing from this set. If the 'propertySet' input
2545 * parameter is an empty set, no properties are included in the response. If
2546 * the 'propertySet' input parameter is null, no properties shall be filtered.
2547 *
2548 * If the 'keysOnly' input parameter is true, then the implementaiton should
2549 * provide only key properties.
2550 *
2551 * If not null, the 'filter' input parameter defines a query filter that all
2552 * provided instances must match. If the MI_Module.flags field contains
2553 * MI_MODULE_FLAG_FILTER_SUPPORT (set by the MI_Main() entry point), this
2554 * filter may be non-null. Otherwise, the 'filter' input paramerter is null.
2555 *
2556 * If EnumerateInstances is successful, the method returns zero or more
2557 * instances.
2558 *
2559 * param: self the provider state data.
2560 * param: context the request context.
2561 * param: nameSpace enumerate instances of this namespace.
2562 * param: className enumerate instances of this class.
2563 mike 1.1 * param: propertySet list of required properties or NULL for all.
2564 * param: keysOnly true if only key properties are required
2565 * param: filter Used to filter instances.
2566 *
2567 * Result posting: zero or more instances.
2568 *
2569 * return:
2570 * MI_RESULT_OK
2571 * MI_RESULT_ACCESS_DENIED
2572 * MI_RESULT_INVALID_NAMESPACE
2573 * MI_RESULT_INVALID_PARAMETER
2574 * MI_RESULT_INVALID_CLASS
2575 * MI_RESULT_NOT_SUPPORTED
2576 * MI_RESULT_FAILED
2577 *
2578 */
2579 typedef void (MI_CALL *MI_ProviderFT_EnumerateInstances)(
2580 _In_opt_ void* self,
2581 _In_ MI_Context* context,
2582 _In_z_ const MI_Char* nameSpace,
2583 _In_z_ const MI_Char* className,
2584 mike 1.1 _In_opt_ const MI_PropertySet* propertySet,
2585 MI_Boolean keysOnly,
2586 _In_opt_ const MI_Filter* filter);
2587
2588 /**
2589 * The server calls the CreateInstance function to create a single CIM
2590 * instance in the target namespace.
2591 *
2592 * The 'newInstance' input parameter defines the properties of the new
2593 * instance. The null properties of this instance are ignored and are not
2594 * part of the new instance.
2595 *
2596 * The 'newInstance' input parameter may define some but not all of the key
2597 * properties (leaving some keys null). If so, the implementation must
2598 * allocate values for the undefined keys. This occurs with keys that the
2599 * requestor cannot define, since their values are only known by the server.
2600 * Typical examples include 'SystemName' and 'SystemCreationClassName'.
2601 *
2602 * If CreateInstance is successful, the implementation should post the
2603 * instance name of the new instance and then post MI_RESULT_OK.
2604 *
2605 mike 1.1 * If CreateInstance is successful, the implementation should post the
2606 * result error code in the return section.
2607 *
2608 * If an instances with the same keys already exists, the implementation
2609 * should post MI_RESULT_ALREADY_EXISTS.
2610 *
2611 * param: self the provider state data.
2612 * param: context the request context.
2613 * param: nameSpace enumerate instances of this namespace.
2614 * param: className enumerate instances of this class.
2615 * param: newInstance the instance that will be created.
2616 *
2617 * Result posting: a single instance.
2618 *
2619 * return:
2620 * MI_RESULT_OK
2621 * MI_RESULT_ACCESS_DENIED
2622 * MI_RESULT_NOT_SUPPORTED
2623 * MI_RESULT_INVALID_NAMESPACE
2624 * MI_RESULT_INVALID_PARAMETER
2625 * MI_RESULT_INVALID_CLASS
2626 mike 1.1 * MI_RESULT_ALREADY_EXISTS
2627 * MI_RESULT_FAILED
2628 *
2629 */
2630 typedef void (MI_CALL *MI_ProviderFT_CreateInstance)(
2631 _In_opt_ void* self,
2632 _In_ MI_Context* context,
2633 _In_z_ const MI_Char* nameSpace,
2634 _In_z_ const MI_Char* className,
2635 _In_ const MI_Instance* newInstance);
2636
2637 /**
2638 * The server calls the ModifyInstance function to modify an existing CIM
2639 * instance in the target namespace. The instance must already exist.
2640 *
2641 * The 'modifiedInstance' input parameter identifies the instance that shall
2642 * be modified (through its key properties) and provides new property values
2643 * for it.
2644 *
2645 * The set of properties that are modified are determined as follows:
2646 *
2647 mike 1.1 * If the propertySet input parameter is not null, the elements of the set
2648 * define zero or more property names. Only properties specified in this set
2649 * are modified. Properties of the modifiedInstance that are missing from the
2650 * set shall be ingored. If the set is empty, no properties are modified. If
2651 * propertySet is null, the set of properties to be modified consists of those
2652 * of modifiedInstance that are not null and whose values are different from
2653 * the current values of the instance to be modified.
2654 *
2655 * If propertySet contains invalid property names, the implementation shall
2656 * reject the request. If a property cannot be modified because, it is a key,
2657 * it is non-writable, or for any other reason, the implementation shall
2658 * reject the request.
2659 *
2660 * If ModifyInstance is successful, all properties to modified are updated
2661 * in the specified instance.
2662 *
2663 * If ModifyInstance is unsuccessful, no change is made to the specified
2664 * instance and an error is returned.
2665 *
2666 * param: self the provider state data
2667 * param: context the request context
2668 mike 1.1 * param: nameSpace enumerate instances of this namespace.
2669 * param: className enumerate instances of this class.
2670 * param: modifiedInstance contains the new property values for the instance
2671 * param: propertySet specifies which properties to modify or NULL for all.
2672 *
2673 * return:
2674 * MI_RESULT_OK
2675 * MI_RESULT_ACCESS_DENIED
2676 * MI_RESULT_INVALID_NAMESPACE
2677 * MI_RESULT_INVALID_CLASS
2678 * MI_RESULT_INVALID_PARAMETER
2679 * MI_RESULT_NOT_SUPPORTED
2680 * MI_RESULT_NOT_FOUND
2681 * MI_RESULT_FAILED
2682 *
2683 */
2684 typedef void (MI_CALL *MI_ProviderFT_ModifyInstance)(
2685 void* self,
2686 MI_Context* context,
2687 _In_z_ const MI_Char* nameSpace,
2688 _In_z_ const MI_Char* className,
2689 mike 1.1 const MI_Instance* modifiedInstance,
2690 const MI_PropertySet* propertySet);
2691
2692 /**
2693 * The server calls the DeleteInstance function to delete a single CIM
2694 * instance from the target namespace.
2695 *
2696 * The instanceName input parameter defines the name (keys) of the instance
2697 * to be deleted.
2698 *
2699 * Deleting an instance may cause the automatic deletion of other instances,
2700 * such as associations that refer to that instance.
2701 *
2702 * If DeleteInstance is successful, the implementation removes the specified
2703 * instance.
2704 *
2705 * If DeleteInstance is unsuccessful, the implementation should return the
2706 * appropriate result code.
2707 *
2708 * param: self the provider state data
2709 * param: context the request context
2710 mike 1.1 * param: nameSpace enumerate instances of this namespace.
2711 * param: className enumerate instances of this class.
2712 * param: instanceName the name of the instance to be deleted
2713 *
2714 * Result posting: nothing
2715 *
2716 * return:
2717 * MI_RESULT_OK
2718 * MI_RESULT_ACCESS_DENIED
2719 * MI_RESULT_INVALID_NAMESPACE
2720 * MI_RESULT_INVALID_CLASS
2721 * MI_RESULT_INVALID_PARAMETER
2722 * MI_RESULT_NOT_SUPPORTED
2723 * MI_RESULT_NOT_FOUND
2724 * MI_RESULT_FAILED
2725 *
2726 */
2727 typedef void (MI_CALL *MI_ProviderFT_DeleteInstance)(
2728 _In_opt_ void* self,
2729 _In_ MI_Context* context,
2730 _In_z_ const MI_Char* nameSpace,
2731 mike 1.1 _In_z_ const MI_Char* className,
2732 _In_ const MI_Instance* instanceName);
2733
2734 /**
2735 * The server calls the AssociatorInstances function to find all CIM instances
2736 * associated with a particular 'source' CIM instance.
2737 *
2738 * The instanceName input parameter defines the source CIM instance, whose
2739 * associated instances shall be returned.
2740 *
2741 * The className input parameter, if not null, is the name of an association
2742 * class. It filters the returned set of instances by requiring that each
2743 * returned instance is associated to the source instance through an instance
2744 * of this class or one of its subclasses.
2745 *
2746 * The resultClass input parameter, if not null, is the name of a class.
2747 * It filters the returned set of instances by requiring that each returned
2748 * instance is either this class or one of its subclasses. Note that the
2749 * resultClass shall not refer to an association class.
2750 *
2751 * The role input parameter, if not null, is a valid property name. It filters
2752 mike 1.1 * the returned set of instances by requiring that each returned instance be
2753 * associated with the source instance through an association that contains
2754 * a reference property with this name that refers to the source instance.
2755 *
2756 * The resultRole input parameter, if not null, is a valid property name. It
2757 * filters the returned set of instances by requiring that each returned
2758 * instance shall be associated to the source instance through an association
2759 * that contains a reference property with this name that refers to the
2760 * returned instance.
2761 *
2762 * If the propertySet input parameter is not null, the elements of the set
2763 * define zero or more property names. Each returned instance shall include
2764 * only properties in that set. If propertySet is empty, no properties are
2765 * included in each returned instance. If propertySet is null, no additional
2766 * filtering is performed.
2767 *
2768 * If the propertySet input parameter contains invalid properties, the
2769 * implementation shall reject the request.
2770 *
2771 * If the resultClass input parameter is null, the propertySet shall be null
2772 * as well (otherwise the class to which the property names refer, would be
2773 mike 1.1 * unknown).
2774 *
2775 * If keysOnly is true, only key properties are included in the result
2776 * instances.
2777 *
2778 * If AssociatorInstances returns MI_RESULT_NOT_SUPPORTED, the server
2779 * attempts to satisfy the request by calling EnumerateInstances. Unless
2780 * the number of associators is very small, the AssociatorInstances operation
2781 * shall be implemented.
2782 *
2783 * If AssociatorInstances is successful, it returns zero or more CIM instances.
2784 * Note that these instances may reside in a different namespace than the
2785 * source instance (given by instanceName). The implementation must ensure that
2786 * the namespace of the MI_Instance is set correctly.
2787 *
2788 * If AssociatorInstances is unsuccessful, it returns the appropriate result
2789 * code.
2790 *
2791 * param: self the provider state data
2792 * param: context the request context
2793 * param: nameSpace the target namespace
2794 mike 1.1 * param: className the name of the association class (or NULL)
2795 * param: instanceName the source class for the association.
2796 * param: resultClass the name of the result class (or NULL)
2797 * param: role the property name referring to the source instance.
2798 * param: resultRole the property name referring to the result instances.
2799 * param: propertySet names of properties to include or NULL for all.
2800 * param: keysOnly true if only key properties are requested.
2801 * param: filter used to filter the result instances, which could be of
2802 * different types.
2803 *
2804 * Result posting: zero or more instances
2805 *
2806 * return:
2807 * MI_RESULT_OK
2808 * MI_RESULT_ACCESS_DENIED
2809 * MI_RESULT_INVALID_NAMESPACE
2810 * MI_RESULT_INVALID_PARAMETER
2811 * MI_RESULT_NOT_SUPPORTED
2812 * MI_RESULT_FAILED
2813 */
2814 typedef void (MI_CALL *MI_ProviderFT_AssociatorInstances)(
2815 mike 1.1 _In_opt_ void* self,
2816 _In_ MI_Context* context,
2817 _In_z_ const MI_Char* nameSpace,
2818 _In_z_ const MI_Char* className,
2819 _In_ const MI_Instance* instanceName,
2820 _In_opt_z_ const MI_Char* resultClass,
2821 _In_opt_z_ const MI_Char* role,
2822 _In_opt_z_ const MI_Char* resultRole,
2823 _In_opt_ const MI_PropertySet* propertySet,
2824 MI_Boolean keysOnly,
2825 _In_opt_ const MI_Filter* filter);
2826
2827 /**
2828 * The server calls the ReferenceInstances function to enumerate association
2829 * instances that refer to a particular CIM instance.
2830 *
2831 * The instanceName input parameter defines the target instance whose
2832 * referring instances shall be returned.
2833 *
2834 * The resultClass input parameter, if not null, is a CIM class name. It
2835 * filters the returned set of association instances by requiring that each
2836 mike 1.1 * returned instance shall be an instance of this class or one of its
2837 * subclasses.
2838 *
2839 * The role input parameter, if not null, is a CIM property name. It filters
2840 * the returned set of association instances by requiring that each returned
2841 * instance refers to the target instance through a property with this name.
2842 *
2843 * If the propertySet input parameter is not null, the elements of the set
2844 * define zero or more property names. Each returned instance shall include
2845 * only properties in that set. If propertySet is empty, no properties are
2846 * included in each returned instance. If propertySet is null, no additional
2847 * filtering is performed.
2848 *
2849 * If the propertySet input parameter contains invalid properties, the
2850 * implementation shall reject the request.
2851 *
2852 * If the className input parameter is null, the propertySet shall be null
2853 * as well (otherwise the class to which the property names refer, would be
2854 * unknown).
2855 *
2856 * If keysOnly is true, only key properties are included in the result
2857 mike 1.1 * instances.
2858 *
2859 * If ReferenceInstances returns MI_RESULT_NOT_SUPPORTED, the server
2860 * attempts to satisfy the request by calling EnumerateInstances. Unless
2861 * the number of associators is very small, the ReferenceInstances operation
2862 * shall be implemented.
2863 *
2864 * If ReferenceInstances is successful, the implementation returns zero
2865 * or more instances.
2866 *
2867 * If ReferenceInstances is unsuccessful, the implementation returns the
2868 * appropriate error result.
2869 *
2870 * param: self the provider state data.
2871 * param: context the request context.
2872 * param: nameSpace the target namespace.
2873 * param: className the name of the result class.
2874 * param: instanceName find references of the instance with this name.
2875 * param: role the association property name that refers to instanceName.
2876 * param: propertySet get these properties or all if NULL.
2877 * param: keysOnly get only key properties.
2878 mike 1.1 * param: filter use to filter instances.
2879 *
2880 * Result posting: zero or more reference instances.
2881 *
2882 * return:
2883 * MI_RESULT_OK
2884 * MI_RESULT_ACCESS_DENIED
2885 * MI_RESULT_INVALID_NAMESPACE
2886 * MI_RESULT_INVALID_PARAMETER
2887 * MI_RESULT_NOT_SUPPORTED
2888 * MI_RESULT_FAILED
2889 */
2890 typedef void (MI_CALL *MI_ProviderFT_ReferenceInstances)(
2891 _In_opt_ void* self,
2892 _In_ MI_Context* context,
2893 _In_z_ const MI_Char* nameSpace,
2894 _In_z_ const MI_Char* className,
2895 _In_ const MI_Instance* instanceName,
2896 _In_opt_z_ const MI_Char* role,
2897 _In_opt_ const MI_PropertySet* propertySet,
2898 MI_Boolean keysOnly,
2899 mike 1.1 _In_opt_ const MI_Filter* filter);
2900
2901 /**
2902 * The server calls this function to enable indications delivery
2903 * from the provider. Provider must store context and use it later
2904 * for posting indications whenever it has new event.
2905 * Simple implementation of providers may ignore Subscribe and
2906 * Unsubscribe calls and always post new indications.
2907 * Advanced providers may analyze filters in subscribe to perform
2908 * fine filtering of the indications (mostly for performance reasons).
2909 * Note: that's the only function where provider does not call
2910 * PostResult and stores context until DisableIndications call.
2911 *
2912 * param: self the provider state data.
2913 * param: indicationsContext the context for indications delivery
2914 *
2915 * Result posting: zero or more indication instances.
2916 *
2917 * return: MI_RESULT_OK, MI_RESULT_FAILED
2918 *
2919 */
2920 mike 1.1 typedef void (MI_CALL *MI_ProviderFT_EnableIndications)(
2921 _In_opt_ void* self,
2922 _In_ MI_Context* indicationsContext,
2923 _In_z_ const MI_Char* nameSpace,
2924 _In_z_ const MI_Char* className);
2925
2926 /**
2927 * The server calls this function to disable indications delivery
2928 * from the provider. Provider must stop emitting indications and
2929 * confirm operations by PostResult(OK) on given context.
2930 * Server provides the same context pointer as it did in
2931 * corresponding EnableIndication call before.
2932 *
2933 * param: self the provider state data.
2934 * param: indicationsContext the context for indications delivery
2935 *
2936 * Result posting: nothing
2937 *
2938 * return: MI_RESULT_OK, MI_RESULT_FAILED.
2939 *
2940 */
2941 mike 1.1 typedef void (MI_CALL *MI_ProviderFT_DisableIndications)(
2942 _In_opt_ void* self,
2943 _In_ MI_Context* indicationsContext,
2944 _In_z_ const MI_Char* nameSpace,
2945 _In_z_ const MI_Char* className);
2946
2947 /**
2948 * The server invokes this function to subscribe to indications. The
2949 * provider may highjack the calling thread (not recommended) or create a new
2950 * thread in order to process indications. As events occur, the provider
2951 * should create indication instances and pass them to MI_Context_PostInstance(),
2952 * with context provided by EnableIndications call. See EnableIndications for
2953 * details.
2954 *
2955 * Subscribe is called between calls to EnableIndications and DisableIndications.
2956 *
2957 * param: self the provider state data.
2958 * param: context the request context used only for request confirmation.
2959 * param: filter used to filter indications.
2960 * param: subscriptionID unique id of the subscription.
2961 *
2962 mike 1.1 * Result posting: nothing
2963 *
2964 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_ACCESS_DENIED,
2965 * MI_RESULT_CANCELED
2966 *
2967 */
2968 typedef void (MI_CALL *MI_ProviderFT_Subscribe)(
2969 _In_opt_ void* self,
2970 _In_ MI_Context* context,
2971 _In_z_ const MI_Char* nameSpace,
2972 _In_z_ const MI_Char* className,
2973 _In_opt_ const MI_Filter* filter,
2974 _In_opt_z_ const MI_Char* bookmark,
2975 MI_Uint64 subscriptionID,
2976 _Outptr_result_maybenull_ void** subscriptionSelf);
2977
2978 /**
2979 * The server invokes this function to unsubscribe from indications.
2980 * The provider can match subscribe/unsubscribe calls by subscriptionID.
2981 *
2982 * Unsubscribe is called between calls to EnableIndications and
2983 mike 1.1 * DisableIndications.
2984 *
2985 * param: self the provider state data.
2986 * param: context the request context
2987 * param: subscriptionID unique id of the subscription.
2988 *
2989 * Result posting:
2990 * MI_Context_PostInstance()
2991 *
2992 * return: MI_RESULT_OK, MI_RESULT_FAILED
2993 *
2994 */
2995 typedef void (MI_CALL *MI_ProviderFT_Unsubscribe)(
2996 _In_opt_ void* self,
2997 _In_ MI_Context* context,
2998 _In_z_ const MI_Char* nameSpace,
2999 _In_z_ const MI_Char* className,
3000 MI_Uint64 subscriptionID,
3001 _In_opt_ void* subscriptionSelf);
3002
3003 /**
3004 mike 1.1 * The server calls this function to carry out a CIM extrinsic method
3005 * invocation on behalf of a requestor. The provider receives input parameters,
3006 * carries out the invoke request, and posts output parameters.
3007 *
3008 * For static methods, the 'instanceName' parameter is null. For non-static
3009 * methods, 'instanceName' defines a target instance (through its keys).
3010 *
3011 * Note: the implementation must set the 'MIReturn' output parameter.
3012 *
3013 * param: self the provider state data.
3014 * param: context the request context
3015 * param: nameSpace the namespace of the request.
3016 * param: className the name of the class.
3017 * param: methodName the name of the method.
3018 * param: instanceName the name of the target instance (null if static method).
3019 * param: inputParameters the input parameters for the method invocation.
3020 *
3021 * Result posting: the output parameters.
3022 *
3023 * return:
3024 * MI_RESULT_OK
3025 mike 1.1 * MI_RESULT_ACCESS_DENIED
3026 * MI_RESULT_NOT_SUPPORTED,
3027 * MI_RESULT_INVALID_NAMESPACE
3028 * MI_RESULT_NOT_FOUND
3029 * MI_RESULT_METHOD_NOT_FOUND
3030 * MI_RESULT_METHOD_NOT_AVAILABLE
3031 * MI_RESULT_FAILED
3032 *
3033 */
3034 typedef void (MI_CALL *MI_ProviderFT_Invoke)(
3035 _In_opt_ void* self,
3036 _In_ MI_Context* context,
3037 _In_z_ const MI_Char* nameSpace,
3038 _In_z_ const MI_Char* className,
3039 _In_z_ const MI_Char* methodName,
3040 _In_ const MI_Instance* instanceName,
3041 _In_ const MI_Instance* inputParameters);
3042
3043 /** Defines the function table for providers. */
3044 struct _MI_ProviderFT
3045 {
3046 mike 1.1 MI_ProviderFT_Load Load;
3047 MI_ProviderFT_Unload Unload;
3048 MI_ProviderFT_GetInstance GetInstance;
3049 MI_ProviderFT_EnumerateInstances EnumerateInstances;
3050 MI_ProviderFT_CreateInstance CreateInstance;
3051 MI_ProviderFT_ModifyInstance ModifyInstance;
3052 MI_ProviderFT_DeleteInstance DeleteInstance;
3053 MI_ProviderFT_AssociatorInstances AssociatorInstances;
3054 MI_ProviderFT_ReferenceInstances ReferenceInstances;
3055 MI_ProviderFT_EnableIndications EnableIndications;
3056 MI_ProviderFT_DisableIndications DisableIndications;
3057 MI_ProviderFT_Subscribe Subscribe;
3058 MI_ProviderFT_Unsubscribe Unsubscribe;
3059 MI_ProviderFT_Invoke Invoke;
3060 };
3061
3062
3063 /*
3064 **==============================================================================
3065 **
3066 ** The MI_Module Module
3067 mike 1.1 **
3068 **==============================================================================
3069 */
3070
3071 /** Whether standard qualifiers were generated */
3072 #define MI_MODULE_FLAG_STANDARD_QUALIFIERS (1 << 0)
3073
3074 /** Whether description qualifiers were generated */
3075 #define MI_MODULE_FLAG_DESCRIPTIONS (1 << 1)
3076
3077 /** Whether Values and ValueMap qualifiers were generated */
3078 #define MI_MODULE_FLAG_VALUES (1 << 2)
3079
3080 /** Whether the MappingStrings qualifiers were generated */
3081 #define MI_MODULE_FLAG_MAPPING_STRINGS (1 << 3)
3082
3083 /** Whether the boolean qualifiers were generated */
3084 #define MI_MODULE_FLAG_BOOLEANS (1 << 4)
3085
3086 /** Whether C++ extensions were generated */
3087 #define MI_MODULE_FLAG_CPLUSPLUS (1 << 5)
3088 mike 1.1
3089 /** Whether translatable qualifiers were localized (and STRING.RC generated) */
3090 #define MI_MODULE_FLAG_LOCALIZED (1 << 6)
3091
3092 /** Whether filters are supported */
3093 #define MI_MODULE_FLAG_FILTER_SUPPORT (1 << 7)
3094
3095
3096 /**
3097 * This function is called to load the main provider module. The implementation
3098 * resides in the file named module.c. The provider developer may define a
3099 * suitable MI_Module_Self structure in module.c.
3100 *
3101 * Note: this function is asynchronous.
3102 *
3103 * param: self the module state data.
3104 * param: context the invocation context.
3105 *
3106 * See also: MI_Module_Unload()
3107 *
3108 */
3109 mike 1.1 typedef void (MI_CALL *MI_Module_Load)(
3110 _Out_ MI_Module_Self** self,
3111 _In_ MI_Context* context);
3112
3113 /**
3114 * This function is called to unload the main provider module. The
3115 * implementation resides in the file named module.c.
3116 *
3117 * Note: this function is synchronous.
3118 *
3119 * param: self the module state data.
3120 * param: context the invocation context.
3121 *
3122 * See also: MI_Module_Load()
3123 *
3124 */
3125 typedef void (MI_CALL *MI_Module_Unload)(
3126 _In_opt_ MI_Module_Self* self,
3127 _In_ MI_Context* context);
3128
3129 /** This structure is returned by the MI_Main() entry point. It contains
3130 mike 1.1 * all data needed by the provider manager to manage the providers within this
3131 * module. A typical implementation of MI_Main() looks something like this.
3132 *
3133 * The module may specify both static and dynamic providers. The provider
3134 * manager first attempts to find a static provider function table through
3135 * the MI_Module.schemaDecl field. If this fails (or if the field is NULL),
3136 * it then uses the MI_Module.dynamicProviderFT (if non-NULL). Static
3137 * providers provides only CIM instances, but dynamic providers may provider
3138 * CIM instances, CIM classes, and CIM qualifier declarations.
3139 *
3140 */
3141 typedef struct _MI_Module
3142 {
3143 /** The version the provider was compiled with (MI_VERSION) */
3144 MI_Uint32 version;
3145
3146 /** The hex value of MI_VERSION when the generator was compiled */
3147 MI_Uint32 generatorVersion;
3148
3149 /** Module flags (see MI_MODULE_FLAG_* enumerations) */
3150 MI_Uint32 flags;
3151 mike 1.1
3152 /** Size of the MI_Char in bytes */
3153 MI_Uint32 charSize;
3154
3155 /** Pointer to generated schema declarations (static providers only). */
3156 MI_SchemaDecl* schemaDecl;
3157
3158 /** Library initializer */
3159 MI_Module_Load Load;
3160
3161 /** Library cleanup */
3162 MI_Module_Unload Unload;
3163
3164 /** The module may implement a single 'dynamic provider' (one that
3165 * provides CIM instances, CIM classes and CIM qualifier declarations).
3166 * The provider manager uses this function table when (1) it is non-null,
3167 * and (2) MI_Module.schemaDecl is null or does not contain an RTTI
3168 * corresponding to the given request.
3169 */
3170 const MI_ProviderFT* dynamicProviderFT;
3171 }
3172 mike 1.1 MI_Module;
3173
3174 /*
3175 **==============================================================================
3176 **
3177 ** The MI_Instance Module
3178 **
3179 **==============================================================================
3180 */
3181
3182 /** The MI_Instance function table */
3183 struct _MI_InstanceFT
3184 {
3185 MI_Result (MI_CALL *Clone)(
3186 _In_ const MI_Instance* self,
3187 _Outptr_ MI_Instance** newInstance);
3188
3189 MI_Result (MI_CALL *Destruct)(
3190 _Inout_ MI_Instance* self);
3191
3192 MI_Result (MI_CALL *Delete)(
3193 mike 1.1 _Inout_ MI_Instance* self);
3194
3195 MI_Result (MI_CALL *IsA)(
3196 _In_ const MI_Instance* self,
3197 _In_ const MI_ClassDecl* classDecl,
3198 _Out_ MI_Boolean* flag);
3199
3200 MI_Result (MI_CALL *GetClassName)(
3201 _In_ const MI_Instance* self,
3202 _Outptr_result_maybenull_z_ const MI_Char** className);
3203
3204 MI_Result (MI_CALL *SetNameSpace)(
3205 _Inout_ MI_Instance* self,
3206 _In_z_ const MI_Char* nameSpace);
3207
3208 MI_Result (MI_CALL *GetNameSpace)(
3209 _In_ const MI_Instance* self,
3210 _Outptr_result_maybenull_z_ const MI_Char** nameSpace);
3211
3212 MI_Result (MI_CALL *GetElementCount)(
3213 _In_ const MI_Instance* self,
3214 mike 1.1 _Out_ MI_Uint32* count);
3215
3216 MI_Result (MI_CALL *AddElement)(
3217 _Inout_ MI_Instance* self,
3218 _In_z_ const MI_Char* name,
3219 _In_opt_ const MI_Value* value,
3220 MI_Type type,
3221 MI_Uint32 flags);
3222
3223 MI_Result (MI_CALL *SetElement)(
3224 _Inout_ MI_Instance* self,
3225 _In_z_ const MI_Char* name,
3226 _In_opt_ const MI_Value* value,
3227 MI_Type type,
3228 MI_Uint32 flags);
3229
3230 MI_Result (MI_CALL *SetElementAt)(
3231 _Inout_ MI_Instance* self,
3232 MI_Uint32 index,
3233 _In_reads_opt_(_Inexpressible_("varies depending on type")) const MI_Value* value,
3234 MI_Type type,
3235 mike 1.1 MI_Uint32 flags);
3236
3237 MI_Result (MI_CALL *GetElement)(
3238 _In_ const MI_Instance* self,
3239 _In_z_ const MI_Char* name,
3240 _Out_opt_ MI_Value* value,
3241 _Out_opt_ MI_Type* type,
3242 _Out_opt_ MI_Uint32* flags,
3243 _Out_opt_ MI_Uint32* index);
3244
3245 MI_Result (MI_CALL *GetElementAt)(
3246 _In_ const MI_Instance* self,
3247 MI_Uint32 index,
3248 _Outptr_result_maybenull_z_ const MI_Char** name,
3249 _Out_opt_ MI_Value* value,
3250 _Out_opt_ MI_Type* type,
3251 _Out_opt_ MI_Uint32* flags);
3252
3253 MI_Result (MI_CALL *ClearElement)(
3254 _Inout_ MI_Instance* self,
3255 _In_z_ const MI_Char* name);
3256 mike 1.1
3257 MI_Result (MI_CALL *ClearElementAt)(
3258 _Inout_ MI_Instance* self,
3259 MI_Uint32 index);
3260
3261 MI_Result (MI_CALL *GetServerName)(
3262 _In_ const MI_Instance* self,
3263 _Outptr_result_maybenull_z_ const MI_Char** name);
3264
3265 MI_Result (MI_CALL *SetServerName)(
3266 _Inout_ MI_Instance* self,
3267 _In_z_ const MI_Char* name);
3268
3269 MI_Result (MI_CALL *GetClass)(
3270 _In_ const MI_Instance* self,
3271 _Outptr_ MI_Class** instanceClass);
3272
3273 #ifdef OMI_ONLY
3274
3275 MI_Result (MI_CALL *Print)(
3276 _In_ const MI_Instance* self,
3277 mike 1.1 _In_ FILE* os,
3278 MI_Uint32 level);
3279
3280 #endif /* OMI_ONLY */
3281 };
3282
3283 /**
3284 * This structure represents a CIM instance. Both dynamic and static instances
3285 * implement this interface. Static instance structures include this structure
3286 * as the initial data field.
3287 *
3288 * Knowledge of this structure allows provider to create its own,
3289 * server-compatible (for RO operations) instances to improve performance.
3290 *
3291 * The following restrictions are made for 'reserved' part of MI_Instance:
3292 * - when server sends instance to the provider, it has to initialize
3293 * ft, classDecl, serverName and namespace (last two may be null).
3294 * 'reserved' space is server-specific and provider may not
3295 * make any assumptions about its content.
3296 *
3297 * - when provider sends instance to the server (PostResult, PostIndication)
3298 mike 1.1 * it has to initialize classDecl, serverName (optional) and
3299 * namespace (optional). ft and reserved space must be 0-initialized.
3300 * Server may perform only read only operations on such instance.
3301
3302 */
3303 struct _MI_Instance
3304 {
3305 /** Function table */
3306 const MI_InstanceFT* ft;
3307
3308 /** The class declaration for this instance */
3309 const MI_ClassDecl* classDecl;
3310
3311 /** The server name (optional) */
3312 const MI_Char* serverName;
3313
3314 /** The namespace (optional) */
3315 const MI_Char* nameSpace;
3316
3317 /** Reserved for internal use */
3318 ptrdiff_t reserved[4];
3319 mike 1.1 };
3320
3321 /**
3322 *
3323 * This function creates a copy of the given instance on the heap. Upon
3324 * a successful return, newInstance points to a newly created instance. The
3325 * new instance should eventually be passed to MI_Instance_Delete().
3326 *
3327 * param: self pointer to the instance to be cloned.
3328 * param: newInstance a pointer to the new instance upon return.
3329 *
3330 * return: MI_RESULT_OK, MI_RESULT_FAILED
3331 *
3332 * See also: MI_Instance_Delete()
3333 *
3334 */
3335 MI_INLINE MI_Result MI_CALL MI_Instance_Clone(
3336 _In_ const MI_Instance* self,
3337 _Outptr_ MI_Instance** newInstance)
3338 {
3339 if (self && self->ft)
3340 mike 1.1 {
3341 return self->ft->Clone(self, newInstance);
3342 }
3343 else
3344 {
3345 return MI_RESULT_INVALID_PARAMETER;
3346 }
3347 }
3348
3349 /**
3350 *
3351 * This function releases an instance that was created on the stack. This
3352 * function applies to instances constructed on the stack using generated
3353 * functions of the form CLASSNAME_Construct().
3354 *
3355 * param: self pointer to the instance to be destructed.
3356 *
3357 * return: MI_RESULT_OK, MI_RESULT_FAILED
3358 *
3359 * See also: MI_Instance_Delete()
3360 *
3361 mike 1.1 */
3362 MI_INLINE MI_Result MI_CALL MI_Instance_Destruct(
3363 _Inout_ MI_Instance* self)
3364 {
3365 if (self && self->ft)
3366 {
3367 return self->ft->Destruct(self);
3368 }
3369 else
3370 {
3371 return MI_RESULT_INVALID_PARAMETER;
3372 }
3373 }
3374
3375 /**
3376 *
3377 * This function releases an instance that was created on the heap. Functions
3378 * created with MI_Instance_Clone() should eventually be passed to this
3379 * function.
3380 *
3381 * param: self pointer to the instance to be released.
3382 mike 1.1 *
3383 * return: MI_RESULT_OK, MI_RESULT_FAILED
3384 */
3385 MI_INLINE MI_Result MI_CALL MI_Instance_Delete(
3386 _Inout_ MI_Instance* self)
3387 {
3388 if (self && self->ft)
3389 {
3390 return self->ft->Delete(self);
3391 }
3392 else
3393 {
3394 return MI_RESULT_INVALID_PARAMETER;
3395 }
3396 }
3397
3398 /**
3399 * This function checks to see if the instance given by 'self' is an
3400 * instance of the class given by 'classDecl'. If so it return
3401 * MI_TRUE in flag. Otherwise it returns MI_FALSE in flag out parameter.
3402 *
3403 mike 1.1 * param: self pointer to an instance.
3404 * param: classDecl the potential 'super' class declaration.
3405 * param: flag [out] boolean outcome of the operation.
3406 *
3407 *
3408 * return: MI_RESULT_OK, MI_RESULT_FAILED
3409 *
3410 */
3411 MI_INLINE MI_Result MI_CALL MI_Instance_IsA(
3412 _In_ const MI_Instance* self,
3413 _In_ const MI_ClassDecl* classDecl,
3414 _Out_ MI_Boolean* flag)
3415 {
3416 if (self && self->ft)
3417 {
3418 return self->ft->IsA(self, classDecl, flag);
3419 }
3420 else
3421 {
3422 return MI_RESULT_INVALID_PARAMETER;
3423 }
3424 mike 1.1 }
3425
3426 /**
3427 * Gets the className of the given instance.
3428 *
3429 * param: self instance whose className will be gotten.
3430 * param: className the class name of the instance upon return.
3431 *
3432 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER
3433 *
3434 */
3435 MI_INLINE MI_Result MI_CALL MI_Instance_GetClassName(
3436 _In_ const MI_Instance* self,
3437 _Outptr_result_maybenull_z_ const MI_Char** className)
3438 {
3439 if (self && self->ft)
3440 {
3441 return self->ft->GetClassName(self, className);
3442 }
3443 else
3444 {
3445 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
3446 }
3447 }
3448
3449 /**
3450 * Sets the namespace name of the given instance. Namespace names must conform
3451 * to the following productions:
3452 *
3453 * Examples:
3454 * root
3455 * root/cimv2
3456 * aaa/bbb/ccc
3457 *
3458 * param: self the instance whose property will be gotten.
3459 * param: nameSpace the new namespace of the instance.
3460 *
3461 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER, MI_RESULT_FAILED
3462 * MI_RESULT_INVALID_PARAMETER
3463 *
3464 */
3465 MI_INLINE MI_Result MI_CALL MI_Instance_SetNameSpace(
3466 mike 1.1 _Inout_ MI_Instance* self,
3467 _In_z_ const MI_Char* nameSpace)
3468 {
3469 if (self && self->ft)
3470 {
3471 return self->ft->SetNameSpace(self, nameSpace);
3472 }
3473 else
3474 {
3475 return MI_RESULT_INVALID_PARAMETER;
3476 }
3477 }
3478
3479 /**
3480 * Gets the namespace name of the given instance.
3481 *
3482 * param: self a pointer to an instance.
3483 * param: nameSpace the namespace name upon return.
3484 *
3485 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER
3486 *
3487 mike 1.1 */
3488 MI_INLINE MI_Result MI_CALL MI_Instance_GetNameSpace(
3489 _In_ const MI_Instance* self,
3490 _Outptr_result_maybenull_z_ const MI_Char** nameSpace)
3491 {
3492 if (self && self->ft)
3493 {
3494 return self->ft->GetNameSpace(self, nameSpace);
3495 }
3496 else
3497 {
3498 return MI_RESULT_INVALID_PARAMETER;
3499 }
3500 }
3501
3502 /**
3503 * Retrieves the number of properties in an instance.
3504 *
3505 * param: self the instance
3506 * param: count the number of properties in the instance upon return
3507 *
3508 mike 1.1 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER, MI_RESULT_INVALID_PARAMETER
3509 *
3510 * See also: MI_Instance_GetAt(), MI_Instance_SetAt()
3511 *
3512 */
3513 MI_INLINE MI_Result MI_CALL MI_Instance_GetElementCount(
3514 _In_ const MI_Instance* self,
3515 _Out_ MI_Uint32* count)
3516 {
3517 if (self && self->ft)
3518 {
3519 return self->ft->GetElementCount(self, count);
3520 }
3521 else
3522 {
3523 return MI_RESULT_INVALID_PARAMETER;
3524 }
3525 }
3526
3527 /**
3528 *
3529 mike 1.1 * Adds a new property to a dynamic instance (supported only by dynamic
3530 * instances whose schema may be extended at run time).
3531 *
3532 * param: self the instance
3533 * param: name the name of the new property
3534 * param: value the value of the new property
3535 * param: type the type of the new property
3536 * param: flags the flags of the new property (MI_FLAG_KEY, MI_FLAG_IN,
3537 * MI_FLAG_OUT, MI_FLAG_REQUIRED, MI_FLAG_STREAM)
3538 * also indicates memory management policy
3539 * (MI_FLAG_BORROW, MI_FLAG_ADOPT)
3540 * null value (MI_FLAG_NULL), and
3541 * CIM meta types (MI_FLAG_ANY).
3542 *
3543 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER
3544 */
3545 MI_INLINE MI_Result MI_CALL MI_Instance_AddElement(
3546 _Inout_ MI_Instance* self,
3547 _In_z_ const MI_Char* name,
3548 _In_opt_ const MI_Value* value,
3549 MI_Type type,
3550 mike 1.1 MI_Uint32 flags)
3551 {
3552 if (self && self->ft)
3553 {
3554 return self->ft->AddElement(self, name, value, type, flags);
3555 }
3556 else
3557 {
3558 return MI_RESULT_INVALID_PARAMETER;
3559 }
3560 }
3561
3562 /**
3563 * Set the value of the property at the given index.
3564 *
3565 * param: self a pointer to an instance.
3566 * param: index the integer position of the property.
3567 * param: value the new value for the property.
3568 * param: type the CIM type of the property that will be set.
3569 * param: flags bit flags indicating memory management policy
3570 * (MI_FLAG_BORROW, MI_FLAG_ADOPT) and null value
3571 mike 1.1 * (MI_FLAG_NULL).
3572 *
3573 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_TYPE_MISMATCH
3574 * MI_RESULT_INVALID_PARAMETER, MI_RESULT_NOT_FOUND, MI_RESULT_FAILED
3575 *
3576 * See also: MI_Instance_GetAt()
3577 * See also: MI_Instance_GetElementCount()
3578 *
3579 */
3580 MI_INLINE MI_Result MI_CALL MI_Instance_SetElementAt(
3581 _Inout_ MI_Instance* self,
3582 MI_Uint32 index,
3583 _In_reads_opt_(_Inexpressible_("varies depending on type")) const MI_Value* value,
3584 MI_Type type,
3585 MI_Uint32 flags)
3586 {
3587 if (self && self->ft)
3588 {
3589 return self->ft->SetElementAt(self, index, value, type, flags);
3590 }
3591 else
3592 mike 1.1 {
3593 return MI_RESULT_INVALID_PARAMETER;
3594 }
3595 }
3596
3597 /**
3598 * Set the value of the property with the given name. By default, all memory
3599 * referred to by the value parameter is copied. By passing the flag
3600 * MI_FLAG_BORROW, memory pointers within the value structure are stored
3601 * directly in the instance's property. The caller must guarantee that the
3602 * memory outlives the instance.
3603 *
3604 * param: self a pointer to an instance.
3605 * param: name the name of the property that will be set.
3606 * param: value the new value for the property.
3607 * param: type the CIM type of the property that will be set.
3608 * param: flags bit flags indicating memory management policy
3609 * (MI_FLAG_BORROW, MI_FLAG_ADOPT) and null value
3610 * (MI_FLAG_NULL).
3611 *
3612 * return: MI_RESULT_O, KMI_RESULT_TYPE_MISMATCH, MI_RESULT_INVALID_PARAMETER
3613 mike 1.1 * MI_RESULT_NOT_FOUND, MI_RESULT_FAILED
3614 *
3615 * See also: MI_Instance_GetElement()
3616 *
3617 */
3618 MI_INLINE MI_Result MI_CALL MI_Instance_SetElement(
3619 _Inout_ MI_Instance* self,
3620 _In_z_ const MI_Char* name,
3621 _In_opt_ const MI_Value* value,
3622 MI_Type type,
3623 MI_Uint32 flags)
3624 {
3625 if (self && self->ft)
3626 {
3627 return self->ft->SetElement(self, name, value, type, flags);
3628 }
3629 else
3630 {
3631 return MI_RESULT_INVALID_PARAMETER;
3632 }
3633 }
3634 mike 1.1
3635 /**
3636 *
3637 * Gets the value of the property with the given name.
3638 *
3639 * param: self the instance whose property will be gotten.
3640 * param: name the name of the property that will be gotten.
3641 * param: value contains the value of the property upon return.
3642 * param: type contains the type of the property upon return.
3643 * param: flags the flags associated with property (MI_FLAG_NULL, MI_FLAG_KEY,
3644 * MI_FLAG_IN, MI_FLAG_OUT).
3645 * param: index the index of the named attribute.
3646 *
3647 * return: MI_RESULT_OK, MI_RESULT_TYPE_MISMATCH, MI_RESULT_INVALID_PARAMETER
3648 * MI_RESULT_NOT_FOUND, MI_RESULT_FAILED
3649 *
3650 */
3651 MI_INLINE MI_Result MI_CALL MI_Instance_GetElement(
3652 _In_ const MI_Instance* self,
3653 _In_z_ const MI_Char* name,
3654 _Out_opt_ MI_Value* value,
3655 mike 1.1 _Out_opt_ MI_Type* type,
3656 _Out_opt_ MI_Uint32* flags,
3657 _Out_opt_ MI_Uint32* index)
3658 {
3659 if (self && self->ft)
3660 {
3661 return self->ft->GetElement(self, name, value, type, flags, index);
3662 }
3663 else
3664 {
3665 return MI_RESULT_INVALID_PARAMETER;
3666 }
3667 }
3668
3669 /**
3670 *
3671 * Get the value of the property at the given index.
3672 *
3673 * param: self the instance whose property will be gotten.
3674 * param: index the position of the property that will be set.
3675 * param: name the name of the property upon return.
3676 mike 1.1 * param: value the value of the property upon return.
3677 * param: type the type of the property upon return.
3678 * param: flags the flags of the property upon return.
3679 *
3680 * return: MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER, MI_RESULT_FAILED,
3681 * MI_RESULT_FAILED
3682 *
3683 * See also: MI_Instance_SetAt()
3684 * See also: MI_Instance_GetElementCount()
3685 *
3686 */
3687 MI_INLINE MI_Result MI_CALL MI_Instance_GetElementAt(
3688 _In_ const MI_Instance* self,
3689 MI_Uint32 index,
3690 _Outptr_result_maybenull_z_ const MI_Char** name,
3691 _Out_opt_ MI_Value* value,
3692 _Out_opt_ MI_Type* type,
3693 _Out_opt_ MI_Uint32* flags)
3694 {
3695 if (self && self->ft)
3696 {
3697 mike 1.1 return self->ft->GetElementAt(self, index, name, value, type, flags);
3698 }
3699 else
3700 {
3701 return MI_RESULT_INVALID_PARAMETER;
3702 }
3703 }
3704
3705 /**
3706 *
3707 * Clears the value of the property with the given name. Afterwards, the
3708 * property has a null value.
3709 *
3710 * param: self the instance whose property will be set.
3711 * param: name the name of the property that will be cleared.
3712 *
3713 * return: MI_RESULT_OK, MI_RESULT_FAILED
3714 */
3715 MI_INLINE MI_Result MI_CALL MI_Instance_ClearElement(
3716 _Inout_ MI_Instance* self,
3717 _In_z_ const MI_Char* name)
3718 mike 1.1 {
3719 if (self && self->ft)
3720 {
3721 return self->ft->ClearElement(self, name);
3722 }
3723 else
3724 {
3725 return MI_RESULT_INVALID_PARAMETER;
3726 }
3727 }
3728
3729 /**
3730 *
3731 * Clears the value of the property at the given index. Afterwards, the
3732 * property has a null value.
3733 *
3734 * param: self the instance whose property will be cleared.
3735 * param: index the position of the property that will be cleared.
3736 *
3737 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_FAILED
3738 *
3739 mike 1.1 */
3740 MI_INLINE MI_Result MI_CALL MI_Instance_ClearElementAt(
3741 _Inout_ MI_Instance* self,
3742 MI_Uint32 index)
3743 {
3744 if (self && self->ft)
3745 {
3746 return self->ft->ClearElementAt(self, index);
3747 }
3748 else
3749 {
3750 return MI_RESULT_INVALID_PARAMETER;
3751 }
3752 }
3753
3754 #ifdef OMI_ONLY
3755
3756 /**
3757 *
3758 * Prints an instance to the given stream object.
3759 *
3760 mike 1.1 * @param self the instance
3761 * @param os the output stream the instance will be printed on.
3762 * @param level the indentation level
3763 *
3764 * @return MI_RESULT_OK, MI_RESULT_INVALID_PARAMETER
3765 *
3766 */
3767 MI_INLINE MI_Result MI_CALL MI_Instance_Print(
3768 _In_ const MI_Instance* self,
3769 _In_ FILE* os,
3770 MI_Uint32 level)
3771 {
3772 return self->ft->Print(self, os, level);
3773 }
3774
3775 #endif /* OMI_ONLY */
3776
3777 /**
3778 *
3779 * Gets the server name from the instance. The resultant name
3780 * memory is owned by the instance and will be destroyed when
3781 mike 1.1 * the instance is deleted.
3782 *
3783 * param: self the instance whose property will be cleared.
3784 * param: name is the outbound server name string.
3785 *
3786 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_FAILED
3787 *
3788 */
3789 MI_INLINE MI_Result MI_CALL MI_Instance_GetServerName(
3790 _In_ const MI_Instance* self,
3791 _Outptr_result_maybenull_z_ const MI_Char** name)
3792 {
3793 if (self && self->ft)
3794 {
3795 return self->ft->GetServerName(self, name);
3796 }
3797 else
3798 {
3799 return MI_RESULT_INVALID_PARAMETER;
3800 }
3801 }
3802 mike 1.1
3803 MI_INLINE MI_Result MI_CALL MI_Instance_SetServerName(
3804 _Inout_ MI_Instance* self,
3805 _In_z_ const MI_Char* name)
3806 {
3807 if (self && self->ft)
3808 {
3809 return self->ft->SetServerName(self, name);
3810 }
3811 else
3812 {
3813 return MI_RESULT_INVALID_PARAMETER;
3814 }
3815 }
3816
3817 MI_INLINE MI_Result MI_CALL MI_Instance_GetClass(
3818 _In_ const MI_Instance* self,
3819 _Outptr_ MI_Class** instanceClass)
3820 {
3821 if (self && self->ft)
3822 {
3823 mike 1.1 return self->ft->GetClass(self, instanceClass);
3824 }
3825 else
3826 {
3827 return MI_RESULT_INVALID_PARAMETER;
3828 }
3829 }
3830
3831 /*
3832 **==============================================================================
3833 **
3834 ** The MI_Context Module
3835 **
3836 **==============================================================================
3837 */
3838
3839 /* The maximum size of a locale string (including zero-terminator). */
3840 #define MI_MAX_LOCALE_SIZE 128
3841
3842 /* Defines the support locale enum tags used by the MI_Context.GetLocale() */
3843 typedef enum _MI_LocaleType
3844 mike 1.1 {
3845 MI_LOCALE_TYPE_REQUESTED_UI,
3846 MI_LOCALE_TYPE_REQUESTED_DATA,
3847 MI_LOCALE_TYPE_CLOSEST_UI,
3848 MI_LOCALE_TYPE_CLOSEST_DATA
3849 }
3850 MI_LocaleType;
3851
3852 typedef enum _MI_CancellationReason
3853 {
3854 MI_REASON_NONE,
3855 MI_REASON_TIMEOUT,
3856 MI_REASON_SHUTDOWN,
3857 MI_REASON_SERVICESTOP
3858 }
3859 MI_CancellationReason;
3860
3861
3862 typedef void (MI_CALL *MI_CancelCallback)(
3863 MI_CancellationReason reason,
3864 _In_opt_ void* callbackData);
3865 mike 1.1
3866 /* Defines the channel numbers for WriteMessage PS semantic callback */
3867 #define MI_WRITEMESSAGE_CHANNEL_WARNING 0
3868 #define MI_WRITEMESSAGE_CHANNEL_VERBOSE 1
3869 #define MI_WRITEMESSAGE_CHANNEL_DEBUG 2
3870
3871 /* Defines the resultType for the result code */
3872
3873 #define MI_RESULT_TYPE_MI MI_T("MI") /* MI Result type*/
3874 #define MI_RESULT_TYPE_HRESULT MI_T("HRESULT") /* HRESULT Result type */
3875 #define MI_RESULT_TYPE_WIN32 MI_T("WIN32") /* WIN32 Result type*/
3876
3877
3878 /** Defines the function table used by MI_Context */
3879 struct _MI_ContextFT
3880 {
3881 /*
3882 **--------------------------------------------------------------------------
3883 **
3884 ** Post Methods
3885 **
3886 mike 1.1 **--------------------------------------------------------------------------
3887 */
3888
3889 MI_Result (MI_CALL *PostResult)(
3890 _In_ MI_Context* context,
3891 MI_Result result);
3892
3893 #ifdef OMI_ONLY
3894
3895 MI_Result (MI_CALL *PostResultWithMessage)(
3896 _In_ MI_Context* context,
3897 MI_Result result,
3898 _In_z_ const MI_Char* message);
3899
3900 MI_Result (MI_CALL *PostResultWithError)(
3901 _In_ MI_Context* context,
3902 MI_Result result,
3903 _In_ const MI_Instance* error);
3904
3905 #endif /* OMI_ONLY */
3906
3907 mike 1.1 MI_Result (MI_CALL *PostInstance)(
3908 _In_ MI_Context* context,
3909 _In_ const MI_Instance* instance);
3910
3911 MI_Result (MI_CALL *PostIndication)(
3912 _In_ MI_Context* context,
3913 _In_ const MI_Instance* indication,
3914 MI_Uint32 subscriptionIDCount,
3915 _In_opt_z_ const MI_Char* bookmark);
3916
3917 /*
3918 **--------------------------------------------------------------------------
3919 **
3920 ** Factory Methods
3921 **
3922 **--------------------------------------------------------------------------
3923 */
3924
3925 MI_Result (MI_CALL *ConstructInstance)(
3926 _In_ MI_Context* context,
3927 _In_ const MI_ClassDecl* classDecl,
3928 mike 1.1 _Out_ MI_Instance* instance);
3929
3930 MI_Result (MI_CALL *ConstructParameters)(
3931 _In_ MI_Context* context,
3932 _In_ const MI_MethodDecl* methodDecl,
3933 _Out_ MI_Instance* instance);
3934
3935 MI_Result (MI_CALL *NewInstance)(
3936 _In_ MI_Context* context,
3937 _In_ const MI_ClassDecl* classDecl,
3938 _Outptr_ MI_Instance** instance);
3939
3940 MI_Result (MI_CALL *NewDynamicInstance)(
3941 _In_ MI_Context* context,
3942 _In_ const MI_Char* className,
3943 MI_Uint32 flags,
3944 _Outptr_ MI_Instance** instance);
3945
3946 MI_Result (MI_CALL *NewParameters)(
3947 _In_ MI_Context* context,
3948 _In_ const MI_MethodDecl* methodDecl,
3949 mike 1.1 _Outptr_ MI_Instance** instance);
3950
3951 /*
3952 **--------------------------------------------------------------------------
3953 **
3954 ** Misc. Methods
3955 **
3956 **--------------------------------------------------------------------------
3957 */
3958
3959 MI_Result (MI_CALL *Canceled)(
3960 _In_ const MI_Context* context,
3961 _Out_ MI_Boolean* flag);
3962
3963 MI_Result (MI_CALL *GetLocale)(
3964 _In_ const MI_Context* context,
3965 MI_LocaleType localeType,
3966 _Out_writes_z_(MI_MAX_LOCALE_SIZE) MI_Char locale[MI_MAX_LOCALE_SIZE]);
3967
3968 MI_Result (MI_CALL *RegisterCancel)(
3969 _In_ MI_Context* context,
3970 mike 1.1 _In_ MI_CancelCallback callback,
3971 _In_opt_ void* callbackData);
3972
3973 MI_Result (MI_CALL *RequestUnload)(
3974 _In_ MI_Context* context);
3975
3976 MI_Result (MI_CALL *RefuseUnload)(
3977 _In_ MI_Context* context);
3978
3979 MI_Result (MI_CALL *GetLocalSession)(
3980 _In_ const MI_Context* context,
3981 _Out_ MI_Session* session);
3982
3983 MI_Result (MI_CALL *SetStringOption)(
3984 _In_ MI_Context* context,
3985 _In_z_ const MI_Char* name,
3986 _In_z_ const MI_Char* value);
3987
3988 /*
3989 **--------------------------------------------------------------------------
3990 **
3991 mike 1.1 ** Operation Options methods
3992 **
3993 **--------------------------------------------------------------------------
3994 */
3995
3996 MI_Result (MI_CALL *GetStringOption)(
3997 _In_ MI_Context* context,
3998 _In_z_ const MI_Char* name,
3999 _Outptr_result_z_ const MI_Char** value);
4000
4001 MI_Result (MI_CALL *GetNumberOption)(
4002 _In_ MI_Context* context,
4003 _In_z_ const MI_Char *name,
4004 _Out_opt_ MI_Uint32* value);
4005
4006 MI_Result (MI_CALL *GetCustomOption)(
4007 _In_ MI_Context* context,
4008 _In_z_ const MI_Char* name,
4009 _Out_opt_ MI_Type* valueType,
4010 _Out_opt_ MI_Value* value);
4011
4012 mike 1.1 MI_Result (MI_CALL *GetCustomOptionCount)(
4013 _In_ MI_Context* context,
4014 _Out_opt_ MI_Uint32* count);
4015
4016 MI_Result (MI_CALL *GetCustomOptionAt)(
4017 _In_ MI_Context* context,
4018 _In_ MI_Uint32 index,
4019 _Outptr_opt_result_maybenull_z_ const MI_Char** name,
4020 _Out_opt_ MI_Type* valueType,
4021 _Out_opt_ MI_Value* value);
4022
4023 /*
4024 **--------------------------------------------------------------------------
4025 **
4026 ** CIM Extension Methods
4027 **
4028 **--------------------------------------------------------------------------
4029 */
4030
4031 MI_Result (MI_CALL *WriteMessage)(
4032 _In_ MI_Context* context,
4033 mike 1.1 MI_Uint32 channel,
4034 _In_z_ const MI_Char* message);
4035
4036 MI_Result (MI_CALL *WriteProgress)(
4037 _In_ MI_Context* context,
4038 _In_z_ const MI_Char* activity,
4039 _In_z_ const MI_Char* currentOperation,
4040 _In_z_ const MI_Char* statusDescription,
4041 MI_Uint32 percentComplete,
4042 MI_Uint32 secondsRemaining);
4043
4044 MI_Result (MI_CALL *WriteStreamParameter)(
4045 _In_ MI_Context* context,
4046 _In_z_ const MI_Char* name,
4047 _In_ const MI_Value* value,
4048 _In_ MI_Type type,
4049 _In_ MI_Uint32 flags);
4050
4051 MI_Result (MI_CALL *WriteCimError)(
4052 _In_ MI_Context* context,
4053 _In_ const MI_Instance *error,
4054 mike 1.1 _Out_ MI_Boolean *flag);
4055
4056 MI_Result (MI_CALL *PromptUser)(
4057 _In_ MI_Context* context,
4058 _In_z_ const MI_Char* message,
4059 MI_PromptType promptType,
4060 _Out_ MI_Boolean* result );
4061
4062
4063
4064 /*
4065 **--------------------------------------------------------------------------
4066 **
4067 ** CIM Extension Helper Methods
4068 **
4069 **--------------------------------------------------------------------------
4070 */
4071
4072 MI_Result (MI_CALL *ShouldProcess)(
4073 _In_ MI_Context* context,
4074 _In_z_ const MI_Char* target,
4075 mike 1.1 _In_z_ const MI_Char* action,
4076 _Out_ MI_Boolean* result);
4077
4078 MI_Result (MI_CALL *ShouldContinue)(
4079 _In_ MI_Context* context,
4080 _In_z_ const MI_Char* message,
4081 _Out_ MI_Boolean* result);
4082
4083 /*
4084 **--------------------------------------------------------------------------
4085 **
4086 ** New Methods
4087 **
4088 **--------------------------------------------------------------------------
4089 */
4090
4091 MI_Result (MI_CALL *PostError)(
4092 _In_ MI_Context* context,
4093 MI_Uint32 resultCode,
4094 _In_z_ const MI_Char* resultType,
4095 _In_z_ const MI_Char* errorMessage);
4096 mike 1.1
4097 MI_Result (MI_CALL *PostCimError)(
4098 _In_ MI_Context* context,
4099 _In_ const MI_Instance *error);
4100
4101 MI_Result (MI_CALL *WriteError)(
4102 _In_ MI_Context* context,
4103 MI_Uint32 resultCode,
4104 _In_z_ const MI_Char* resultType,
4105 _In_z_ const MI_Char* errorMessage,
4106 _Out_ MI_Boolean *flag);
4107 };
4108
4109 /** Operations are defined on this structure for (1) posting results,
4110 * (2) posting instances, (3) creating new objects.
4111 *
4112 */
4113 struct _MI_Context
4114 {
4115 /* Function table */
4116 const MI_ContextFT* ft;
4117 mike 1.1
4118 /* Reserved for internal use */
4119 ptrdiff_t reserved[3];
4120 };
4121
4122 /**
4123 * Providers call this function to post a return code to the server in
4124 * response to a request.
4125 *
4126 * param: context the request context
4127 * param: result the result code
4128 *
4129 * return: MI_RESULT_OK, MI_RESULT_FAILED
4130 *
4131 */
4132 MI_INLINE MI_Result MI_CALL MI_Context_PostResult(
4133 _In_ MI_Context* context,
4134 MI_Result result)
4135 {
4136 if (context && context->ft)
4137 {
4138 mike 1.1 return context->ft->PostResult(context, result);
4139 }
4140 else
4141 {
4142 return MI_RESULT_INVALID_PARAMETER;
4143 }
4144 }
4145
4146 #ifdef OMI_ONLY
4147
4148 /**
4149 * Providers call this function to post a return code and an error message
4150 * to the server in response to a request.
4151 *
4152 * @param context the request context.
4153 * @param result the result code.
4154 * @param message an error message containing detail about the error.
4155 *
4156 * @return MI_RESULT_OK, MI_RESULT_FAILED
4157 *
4158 */
4159 mike 1.1 MI_INLINE MI_Result MI_CALL MI_Context_PostResultWithMessage(
4160 _In_ MI_Context* context,
4161 MI_Result result,
4162 _In_ const MI_Char* message)
4163 {
4164 return context->ft->PostResultWithMessage(context, result, message);
4165 }
4166
4167 /**
4168 * Providers call this function to post a return code and a CIM error
4169 * instance to the server in response to a request. The instance is of
4170 * the standard CIM class 'CIM_Error' (or derived from it), which the provider
4171 * developer must generate and include in the provider.
4172 *
4173 * @param context the request context.
4174 * @param result the result code.
4175 * @param error an instance of the CIM error class
4176 *
4177 * @return MI_RESULT_OK, MI_RESULT_FAILED
4178 *
4179 */
4180 mike 1.1 MI_INLINE MI_Result MI_CALL MI_Context_PostResultWithError(
4181 _In_ MI_Context* context,
4182 MI_Result result,
4183 _In_ const MI_Instance* error)
4184 {
4185 return context->ft->PostResultWithError(context, result, error);
4186 }
4187
4188 #endif /* OMI_ONLY */
4189
4190 /**
4191 * Providers call this function to post a return code and an error message
4192 * to the server in response to a request.
4193 *
4194 * param: context the request context. * param: error representing CIM_Error.
4195 *
4196 * return: MI_RESULT_OK, MI_RESULT_FAILED
4197 *
4198 */
4199 MI_INLINE MI_Result MI_CALL MI_Context_PostCimError(
4200 _In_ MI_Context* context,
4201 mike 1.1 _In_ const MI_Instance *error)
4202 {
4203 if (context && context->ft)
4204 {
4205 return context->ft->PostCimError(context, error);
4206 }
4207 else
4208 {
4209 return MI_RESULT_INVALID_PARAMETER;
4210 }
4211 }
4212
4213 /**
4214 * Providers call this function to post a return code and a CIM error
4215 * instance to the server in response to a request.
4216 *
4217 * param: context the request context.
4218 * param: result the result code.
4219 * param: resultType of the result
4220 *
4221 * return: MI_RESULT_OK, MI_RESULT_FAILED
4222 mike 1.1 *
4223 */
4224 MI_INLINE MI_Result MI_CALL MI_Context_PostError(
4225 _In_ MI_Context* context,
4226 MI_Uint32 resultCode,
4227 _In_z_ const MI_Char* resultType,
4228 _In_z_ const MI_Char* errorMessage)
4229 {
4230 if (context && context->ft)
4231 {
4232 return context->ft->PostError(context, resultCode, resultType, errorMessage);
4233 }
4234 else
4235 {
4236 return MI_RESULT_INVALID_PARAMETER;
4237 }
4238 }
4239
4240
4241 /**
4242 * Providers call this function to post an instance to the server in
4243 mike 1.1 * response to a request. The server is responsible for copying the
4244 * instance so the provider is free to dispose of the instance afterwards.
4245 *
4246 * param: context the request context
4247 * param: instance instance to be posted
4248 *
4249 * return: MI_RESULT_OK, MI_RESULT_FAILED
4250 *
4251 */
4252 MI_INLINE MI_Result MI_CALL MI_Context_PostInstance(
4253 _In_ MI_Context* context,
4254 _In_ const MI_Instance* instance)
4255 {
4256 if (context && context->ft)
4257 {
4258 return context->ft->PostInstance(context, instance);
4259 }
4260 else
4261 {
4262 return MI_RESULT_INVALID_PARAMETER;
4263 }
4264 mike 1.1 }
4265
4266 /**
4267 * Providers call this function to post an indication to the server in
4268 * response to a request. The server is responsible for copying the
4269 * instance so the provider is free to dispose of the instance afterwards.
4270 *
4271 * param: context the request context
4272 * param: indication the indication to be posted
4273 * param: subscriptionIDCount the number of subscription identifiers.
4274 * param: bookmark the bookmark for this subscription.
4275 *
4276 * return: MI_RESULT_OK, MI_RESULT_FAILED
4277 *
4278 */
4279 MI_INLINE MI_Result MI_CALL MI_Context_PostIndication(
4280 _In_ MI_Context* context,
4281 _In_ const MI_Instance* indication,
4282 MI_Uint32 subscriptionIDCount,
4283 _In_opt_z_ const MI_Char* bookmark)
4284 {
4285 mike 1.1 if (context && context->ft)
4286 {
4287 return context->ft->PostIndication(
4288 context, indication, subscriptionIDCount, bookmark);
4289 }
4290 else
4291 {
4292 return MI_RESULT_INVALID_PARAMETER;
4293 }
4294 }
4295
4296 /**
4297 * A provider calls this function to initialize an instance. The caller
4298 * is responsible for reserving the memory for the instance (either on
4299 * the stack or the heap). The caller should eventually pass
4300 * the instance to MI_Instance_Destruct().
4301 *
4302 * param: context the request context.
4303 * param: instance the instance to be initialized.
4304 * param: classDecl the class declaration used to initialize the instance.
4305 *
4306 mike 1.1 * return: MI_RESULT_OK, MI_RESULT_FAILED
4307 *
4308 */
4309 MI_INLINE MI_Result MI_CALL MI_Context_ConstructInstance(
4310 _In_ MI_Context* context,
4311 _In_ const MI_ClassDecl* classDecl,
4312 _Out_ MI_Instance* instance)
4313 {
4314 if (context && context->ft)
4315 {
4316 return context->ft->ConstructInstance(context, classDecl, instance);
4317 }
4318 else
4319 {
4320 return MI_RESULT_INVALID_PARAMETER;
4321 }
4322 }
4323
4324 /**
4325 * A provider calls this function to initialize a parameters instance.
4326 * The caller is responsible for reserving the memory for the instance
4327 mike 1.1 * (either on the stack or the heap). The caller should eventually pass
4328 * the instance to MI_Instance_Destruct().
4329 *
4330 * param: context the request context.
4331 * param: instance the instance to be initialized.
4332 * param: methodDecl the method declaration used to initialize the instance.
4333 *
4334 * return: MI_RESULT_OK, MI_RESULT_FAILED
4335 *
4336 */
4337 MI_INLINE MI_Result MI_CALL MI_Context_ConstructParameters(
4338 _In_ MI_Context* context,
4339 _In_ const MI_MethodDecl* methodDecl,
4340 _Out_ MI_Instance* instance)
4341 {
4342 if (context && context->ft)
4343 {
4344 return context->ft->ConstructParameters(context, methodDecl, instance);
4345 }
4346 else
4347 {
4348 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
4349 }
4350 }
4351
4352 /**
4353 * This function creates a new instance of the class given by the classDecl
4354 * parameter. The caller should eventually pass the instance to
4355 * MI_Instance_Delete().
4356 *
4357 * param: context the request context
4358 * param: classDecl the class declaration used to initialize the instance.
4359 * param: instance points to a new instance upon successful return.
4360 *
4361 * return: MI_RESULT_OK, MI_RESULT_FAILED
4362 *
4363 */
4364 MI_INLINE MI_Result MI_CALL MI_Context_NewInstance(
4365 _In_ MI_Context* context,
4366 _In_ const MI_ClassDecl* classDecl,
4367 _Outptr_ MI_Instance** instance)
4368 {
4369 mike 1.1 if (context && context->ft)
4370 {
4371 return context->ft->NewInstance(context, classDecl, instance);
4372 }
4373 else
4374 {
4375 return MI_RESULT_INVALID_PARAMETER;
4376 }
4377 }
4378
4379 /**
4380 * This function creates a new dynamic instance of the class whose name is
4381 * given by the className parameter. The caller should eventually pass the
4382 * instance to MI_Instance_Delete().
4383 *
4384 * param: context the request context
4385 * param: className the name of the new class.
4386 * param: flags create flags (include class meta type).
4387 * param: instance points to a new instance upon successful return.
4388 *
4389 * return: MI_RESULT_OK, MI_RESULT_FAILED
4390 mike 1.1 *
4391 */
4392 MI_INLINE MI_Result MI_CALL MI_Context_NewDynamicInstance(
4393 _In_ MI_Context* context,
4394 _In_ const MI_Char* className,
4395 MI_Uint32 flags,
4396 _Outptr_ MI_Instance** instance)
4397 {
4398 if (context && context->ft)
4399 {
4400 return context->ft->NewDynamicInstance(context, className, flags, instance);
4401 }
4402 else
4403 {
4404 return MI_RESULT_INVALID_PARAMETER;
4405 }
4406 }
4407
4408 /**
4409 * This function creates a new instance of the method given by the
4410 * methodDecl parameter. The caller should eventually pass the instance to
4411 mike 1.1 * MI_Instance_Delete().
4412 *
4413 * param: context the request context
4414 * param: methodDecl the method declaration used to initialize the instance.
4415 * param: instance points to a new instance upon successful return.
4416 *
4417 * return: MI_RESULT_OK, MI_RESULT_FAILED
4418 *
4419 */
4420 MI_INLINE MI_Result MI_CALL MI_Context_NewParameters(
4421 _In_ MI_Context* context,
4422 _In_ const MI_MethodDecl* methodDecl,
4423 _Outptr_ MI_Instance** instance)
4424 {
4425 if (context && context->ft)
4426 {
4427 return context->ft->NewParameters(context, methodDecl, instance);
4428 }
4429 else
4430 {
4431 return MI_RESULT_INVALID_PARAMETER;
4432 mike 1.1 }
4433 }
4434
4435 /**
4436 * Providers call this function periodically to determine whether the
4437 * operation has been canceled. If so, the flag parameter is set to
4438 * MI_TRUE and MI_RESULT_OK is returned.
4439 *
4440 * param: context the request context
4441 * param: flag upon return this flag indicates whether the operation has been
4442 * canceled.
4443 *
4444 * return: MI_RESULT_OK, MI_RESULT_FAILED
4445 *
4446 */
4447 MI_INLINE MI_Result MI_CALL MI_Context_Canceled(
4448 _In_ const MI_Context* context,
4449 _Out_ MI_Boolean* flag)
4450 {
4451 if (context && context->ft)
4452 {
4453 mike 1.1 return context->ft->Canceled(context, flag);
4454 }
4455 else
4456 {
4457 return MI_RESULT_INVALID_PARAMETER;
4458 }
4459 }
4460
4461 /**
4462 * This function returns the locale of the given type.
4463 *
4464 * param: context the request context
4465 * param: localeType the type of locale to be returned.
4466 * param: locale the locale upon return.
4467 *
4468 * return: MI_RESULT_OK, MI_RESULT_FAILED
4469 *
4470 */
4471 MI_INLINE MI_Result MI_CALL MI_Context_GetLocale(
4472 _In_ const MI_Context* context,
4473 MI_LocaleType localeType,
4474 mike 1.1 _Out_writes_z_(MI_MAX_LOCALE_SIZE) MI_Char locale[MI_MAX_LOCALE_SIZE])
4475 {
4476 if (locale)
4477 {
4478 locale[0] = L'\0';
4479 }
4480
4481 if (context && context->ft)
4482 {
4483 return context->ft->GetLocale(context, localeType, locale);
4484 }
4485 else
4486 {
4487 return MI_RESULT_INVALID_PARAMETER;
4488 }
4489 }
4490
4491 /**
4492 * This function registers a callback that is called when the operation
4493 * is canceled.
4494 *
4495 mike 1.1 * param: context the request context.
4496 * param: callback call this function on cancel.
4497 * param: callbackData pass this data to the callback.
4498 *
4499 * return: MI_RESULT_OK, MI_RESULT_FAILED
4500 *
4501 */
4502 MI_INLINE MI_Result MI_CALL MI_Context_RegisterCancel(
4503 _In_ MI_Context* context,
4504 _In_ MI_CancelCallback callback,
4505 _In_opt_ void* callbackData)
4506 {
4507 if (context && context->ft)
4508 {
4509 return context->ft->RegisterCancel(context, callback, callbackData);
4510 }
4511 else
4512 {
4513 return MI_RESULT_INVALID_PARAMETER;
4514 }
4515 }
4516 mike 1.1
4517 /**
4518 * This function requests to unload the module or the provider (depending
4519 * on the location of invocation). Providers should call this function within
4520 * their load methods. The provider will be unloaded soon after this call.
4521 *
4522 * param: context the request context.
4523 *
4524 * return: MI_RESULT_OK, MI_RESULT_FAILED
4525 *
4526 */
4527 MI_INLINE MI_Result MI_CALL MI_Context_RequestUnload(
4528 _In_ MI_Context* context)
4529 {
4530 if (context && context->ft)
4531 {
4532 return context->ft->RequestUnload(context);
4533 }
4534 else
4535 {
4536 return MI_RESULT_INVALID_PARAMETER;
4537 mike 1.1 }
4538 }
4539
4540 /**
4541 * By calling this, the provider prevents itself from being unloaded after
4542 * provider unload timeout (but it does not prevent it from being unloaded
4543 * during CIM server shutdown). After calling this, the provider manages
4544 * its own lifetime. The provider may call MI_Context_RequestUnload() to request an
4545 * unload at any time. This function should be called with the load method.
4546 *
4547 * param: context the request context.
4548 *
4549 * return: MI_RESULT_OK, MI_RESULT_FAILED
4550 *
4551 */
4552 MI_INLINE MI_Result MI_CALL MI_Context_RefuseUnload(
4553 _In_ MI_Context* context)
4554 {
4555 if (context && context->ft)
4556 {
4557 return context->ft->RefuseUnload(context);
4558 mike 1.1 }
4559 else
4560 {
4561 return MI_RESULT_INVALID_PARAMETER;
4562 }
4563 };
4564
4565 /**
4566 * Gets the local session (MI_Session), which allows the provider to
4567 * communicate with the CIM server. This session is pre-instantiated
4568 * and has the lifetime of the context (from which the session was
4569 * obtained. The provider MUST NOT destruct this session, since its
4570 * lifetime is bound to the context.
4571 *
4572 * param: context the request context.
4573 * param: session the local session handle.
4574 *
4575 * return: MI_RESULT_OK, MI_RESULT_FAILED
4576 *
4577 */
4578 MI_INLINE MI_Result MI_CALL MI_Context_GetLocalSession(
4579 mike 1.1 _In_ const MI_Context* context,
4580 _Out_ MI_Session* session)
4581 {
4582 if (context && context->ft)
4583 {
4584 return context->ft->GetLocalSession(context, session);
4585 }
4586 else
4587 {
4588 return MI_RESULT_INVALID_PARAMETER;
4589 }
4590 }
4591
4592 /**
4593 * Sets context-specific option. It allows the provider to
4594 * adjust server's behavior. Typically is server-specific.
4595 *
4596 * param: context the request context.
4597 * param: name of the option to change.
4598 * param: value - new value for the option.
4599 *
4600 mike 1.1 * return: MI_RESULT_OK, MI_RESULT_FAILED
4601 */
4602
4603 /**
4604 * MI_Context_SetStringOption only supports
4605 * "SECURITY" option, and is only used by indication
4606 * provider to control which users have permission to
4607 * subscrbe to the indication class. The API is valid if
4608 * and only if being called inside <Indication Class>_Load
4609 * function. Following example allows only adminstrators
4610 * group to subscribe to MyIndication class.
4611 *
4612 * void MI_CALL <MyIndication>_Load(
4613 * My_Alarm_Self** self,
4614 * MI_Module_Self* selfModule,
4615 * MI_Context* context)
4616 * {
4617 * MI_Result r;
4618 * *self = NULL;
4619 * r = MI_Context_SetStringOption(context,
4620 * MI_T("SECURITY"),
4621 mike 1.1 * MI_T("O:BAG:BAD:(A;;0x40;;;BA)"));
4622 * MI_PostResult(context, r);
4623 * }
4624 *
4625 * The SDDL string "O:BAG:BAD:(A;;0x40;;;BA)" contains 0x40 flag, which means
4626 * WBEM_RIGHT_SUBSCRIBE permission, the SDDL must contain this flag, please
4627 * see http://msdn.microsoft.com/en-us/library/aa390415.aspx for details.
4628 */
4629 MI_INLINE MI_Result MI_CALL MI_Context_SetStringOption(
4630 _In_ MI_Context* context,
4631 _In_z_ const MI_Char* name,
4632 _In_z_ const MI_Char* value)
4633 {
4634 if (context && context->ft)
4635 {
4636 return context->ft->SetStringOption(context, name, value);
4637 }
4638 else
4639 {
4640 return MI_RESULT_INVALID_PARAMETER;
4641 }
4642 mike 1.1 }
4643
4644 /**
4645 * Gets context-specific option.
4646 *
4647 * param: context the request context.
4648 * param: name of the option to get.
4649 * param: value [out] of the option.
4650 *
4651 * return: MI_RESULT_OK, MI_RESULT_FAILED
4652 *
4653 */
4654 MI_INLINE MI_Result MI_CALL MI_Context_GetStringOption(
4655 _In_ MI_Context* context,
4656 _In_z_ const MI_Char* name,
4657 _Outptr_result_z_ const MI_Char** value)
4658 {
4659 if (context && context->ft)
4660 {
4661 return context->ft->GetStringOption(context, name, value);
4662 }
4663 mike 1.1 else
4664 {
4665 return MI_RESULT_INVALID_PARAMETER;
4666 }
4667 }
4668
4669 /**
4670 * Gets context-specific option.
4671 *
4672 * param: context the request context.
4673 * param: name of the option to get.
4674 * param: value [out] of the option.
4675 *
4676 * return: MI_RESULT_OK, MI_RESULT_FAILED
4677 *
4678 */
4679 MI_INLINE MI_Result MI_CALL MI_Context_GetNumberOption(
4680 _In_ MI_Context* context,
4681 _In_z_ const MI_Char* name,
4682 _Out_opt_ MI_Uint32* value)
4683 {
4684 mike 1.1 if (context && context->ft)
4685 {
4686 return context->ft->GetNumberOption(context, name, value);
4687 }
4688 else
4689 {
4690 return MI_RESULT_INVALID_PARAMETER;
4691 }
4692 }
4693
4694 /**
4695 * Gets context-specific option.
4696 *
4697 * param: context the request context.
4698 * param: name of the option to get.
4699 * param: value [out] of the option.
4700 *
4701 * return: MI_RESULT_OK, MI_RESULT_FAILED
4702 *
4703 */
4704 MI_INLINE MI_Result MI_CALL MI_Context_GetCustomOption(
4705 mike 1.1 _In_ MI_Context* context,
4706 _In_z_ const MI_Char* name,
4707 _Out_opt_ MI_Type* valueType,
4708 _Out_opt_ MI_Value* value)
4709 {
4710 if (context && context->ft)
4711 {
4712 return context->ft->GetCustomOption(context, name, valueType,value);
4713 }
4714 else
4715 {
4716 return MI_RESULT_INVALID_PARAMETER;
4717 }
4718 }
4719
4720 /**
4721 * Gets context-specific option.
4722 *
4723 * param: context the request context.
4724 * param: name of the option to get.
4725 * param: value [out] of the option.
4726 mike 1.1 *
4727 * return: MI_RESULT_OK, MI_RESULT_FAILED
4728 *
4729 */
4730 MI_INLINE MI_Result MI_CALL MI_Context_GetCustomOptionCount(
4731 _In_ MI_Context* context,
4732 _Out_opt_ MI_Uint32* count)
4733 {
4734 if (context && context->ft)
4735 {
4736 return context->ft->GetCustomOptionCount(context, count);
4737 }
4738 else
4739 {
4740 return MI_RESULT_INVALID_PARAMETER;
4741 }
4742 }
4743
4744 /**
4745 * Gets context-specific option.
4746 *
4747 mike 1.1 * param: context the request context.
4748 * param: name of the option to get.
4749 * param: value [out] of the option.
4750 *
4751 * return: MI_RESULT_OK, MI_RESULT_FAILED
4752 *
4753 */
4754 MI_INLINE MI_Result MI_CALL MI_Context_GetCustomOptionAt(
4755 _In_ MI_Context* context,
4756 _In_ MI_Uint32 index,
4757 _Outptr_opt_result_maybenull_z_ const MI_Char** name,
4758 _Out_opt_ MI_Type* valueType,
4759 _Out_opt_ MI_Value* value)
4760 {
4761 if (context && context->ft)
4762 {
4763 return context->ft->GetCustomOptionAt(context, index, name, valueType,value);
4764 }
4765 else
4766 {
4767 return MI_RESULT_INVALID_PARAMETER;
4768 mike 1.1 }
4769 }
4770
4771
4772 /**
4773 * This function implements the ShouldProcess CIM Extensions operation.
4774 *
4775 * param: context the request context.
4776 * param: message the message.
4777 * param: flag MI_TRUE if for 'should process'.
4778 *
4779 * return: MI_RESULT_OK, MI_RESULT_FAILED.
4780 *
4781 */
4782 MI_INLINE MI_Result MI_CALL MI_Context_ShouldProcess(
4783 _In_ MI_Context* context,
4784 _In_z_ const MI_Char *target,
4785 _In_z_ const MI_Char* action,
4786 _Out_ MI_Boolean* flag)
4787 {
4788 if (context && context->ft)
4789 mike 1.1 {
4790 return context->ft->ShouldProcess(context, target, action , flag);
4791 }
4792 else
4793 {
4794 return MI_RESULT_INVALID_PARAMETER;
4795 }
4796 }
4797
4798 /**
4799 * This function implements the ShouldContinue CIM Extensions operation.
4800 *
4801 * param: context the request context.
4802 * param: message a message.
4803 * param: flag MI_TRUE if for 'should continue'.
4804 *
4805 * return: MI_RESULT_OK, MI_RESULT_FAILED.
4806 *
4807 */
4808 MI_INLINE MI_Result MI_CALL MI_Context_ShouldContinue(
4809 _In_ MI_Context* context,
4810 mike 1.1 _In_z_ const MI_Char* message,
4811 _Out_ MI_Boolean* flag)
4812 {
4813 if (context && context->ft)
4814 {
4815 return context->ft->ShouldContinue(context, message, flag);
4816 }
4817 else
4818 {
4819 return MI_RESULT_INVALID_PARAMETER;
4820 }
4821 }
4822
4823
4824 /**
4825 * This function implements the MI_PromptUser CIM Extensions operation.
4826 *
4827 * param: context the request context.
4828 * param: message a message.
4829 * param: promptType prompt type (critical, normal)
4830 * param: flag MI_TRUE if for 'should continue'.
4831 mike 1.1 *
4832 * return: MI_RESULT_OK, MI_RESULT_FAILED.
4833 *
4834 */
4835 MI_INLINE MI_Result MI_CALL MI_Context_PromptUser(
4836 _In_ MI_Context* context,
4837 _In_z_ const MI_Char* message,
4838 MI_PromptType promptType,
4839 _Out_ MI_Boolean*flag )
4840
4841 {
4842 if (context && context->ft)
4843 {
4844 return context->ft->PromptUser(context, message, promptType, flag);
4845 }
4846 else
4847 {
4848 return MI_RESULT_INVALID_PARAMETER;
4849 }
4850 }
4851
4852 mike 1.1
4853 /**
4854 * This function implements the WriteError CIM operation.
4855 *
4856 * param: context the request context.
4857 * param: resultCode
4858 * param: resultType
4859 * param: flag
4860 *
4861 * return: MI_RESULT_OK, MI_RESULT_FAILED.
4862 *
4863 */
4864 MI_INLINE MI_Result MI_CALL MI_Context_WriteError(
4865 _In_ MI_Context* context,
4866 MI_Uint32 resultCode,
4867 _In_z_ const MI_Char* resultType,
4868 _In_z_ const MI_Char* errorMessage,
4869 _Out_ MI_Boolean *flag)
4870 {
4871 if (context && context->ft)
4872 {
4873 mike 1.1 return context->ft->WriteError(context, resultCode, resultType, errorMessage, flag);
4874 }
4875 else
4876 {
4877 return MI_RESULT_INVALID_PARAMETER;
4878 }
4879 }
4880
4881 /**
4882 * This function implements the WriteCimError CIM Extensions operation.
4883 *
4884 * param: context the request context.
4885 * param: error CIM_Error type object.
4886 * param: flag
4887 *
4888 * return: MI_RESULT_OK, MI_RESULT_FAILED.
4889 *
4890 */
4891 MI_INLINE MI_Result MI_CALL MI_Context_WriteCimError(
4892 _In_ MI_Context* context,
4893 _In_ const MI_Instance *error,
4894 mike 1.1 _Out_ MI_Boolean *flag)
4895
4896 {
4897 if (context && context->ft)
4898 {
4899 return context->ft->WriteCimError(context, error, flag);
4900 }
4901 else
4902 {
4903 return MI_RESULT_INVALID_PARAMETER;
4904 }
4905 }
4906
4907
4908
4909 /**
4910 * This function implements the WriteMessage CIM Extensions operation.
4911 *
4912 * param: context the request context.
4913 * param: channel
4914 * param: message
4915 mike 1.1 *
4916 * return: MI_TRUE or MI_FALSE.
4917 *
4918 */
4919 MI_INLINE MI_Result MI_CALL MI_Context_WriteMessage(
4920 _In_ MI_Context* context,
4921 MI_Uint32 channel,
4922 _In_z_ const MI_Char* message)
4923 {
4924 if (context && context->ft)
4925 {
4926 return context->ft->WriteMessage(context, channel, message);
4927 }
4928 else
4929 {
4930 return MI_RESULT_INVALID_PARAMETER;
4931 }
4932 }
4933
4934 /**
4935 * This function implements the WriteProgress CIM Extentions operation.
4936 mike 1.1 *
4937 * param: context the request context.
4938 * param: activity
4939 * param: currentOperation
4940 * param: statusDescription
4941 * param: percentComplete
4942 * param: secondsRemaining
4943 *
4944 * return: MI_TRUE or MI_FALSE.
4945 *
4946 */
4947 MI_INLINE MI_Result MI_CALL MI_Context_WriteProgress(
4948 _In_ MI_Context* context,
4949 _In_z_ const MI_Char* activity,
4950 _In_z_ const MI_Char* currentOperation,
4951 _In_z_ const MI_Char* statusDescription,
4952 MI_Uint32 percentComplete,
4953 MI_Uint32 secondsRemaining)
4954 {
4955 if (context && context->ft)
4956 {
4957 mike 1.1 return context->ft->WriteProgress(context, activity, currentOperation,
4958 statusDescription, percentComplete, secondsRemaining);
4959 }
4960 else
4961 {
4962 return MI_RESULT_INVALID_PARAMETER;
4963 }
4964 }
4965
4966
4967 /**
4968 * The provider calls this function to send streamed data to the requestor.
4969 * The value is an array that contains one or more elements of the specified
4970 * type. Call this function repeatedly to send the entire stream.
4971 *
4972 * param: self the request context
4973 * param: name the name of a parameter.
4974 * param: value an array value with at least one element.
4975 * param: type the type (must be an array type).
4976 * param: flags is reserved and the value must be 0.
4977 *
4978 mike 1.1 * return: MI_RESULT_OK, MI_RESULT_FAILED.
4979 *
4980 */
4981 MI_INLINE MI_Result MI_CALL MI_Context_WriteStreamParameter(
4982 _In_ MI_Context* self,
4983 _In_z_ const MI_Char* name,
4984 _In_ const MI_Value* value,
4985 _In_ MI_Type type,
4986 _In_ MI_Uint32 flags)
4987 {
4988 if (self && self->ft)
4989 {
4990 return self->ft->WriteStreamParameter(self, name, value, type, flags);
4991 }
4992 else
4993 {
4994 return MI_RESULT_INVALID_PARAMETER;
4995 }
4996 }
4997
4998 /**
4999 mike 1.1 * This function implements the WriteWarning functionality of WriteMessage CIM Extensions operation.
5000 *
5001 * param: context the request context.
5002 * param: message
5003 *
5004 * return: MI_TRUE or MI_FALSE.
5005 *
5006 */
5007 MI_INLINE MI_Result MI_CALL MI_Context_WriteWarning(
5008 _In_ MI_Context* context,
5009 _In_z_ const MI_Char* message)
5010 {
5011 if (context && context->ft)
5012 {
5013 return context->ft->WriteMessage(context, MI_WRITEMESSAGE_CHANNEL_WARNING, message);
5014 }
5015 else
5016 {
5017 return MI_RESULT_INVALID_PARAMETER;
5018 }
5019 }
5020 mike 1.1
5021 /**
5022 * This function implements the WriteVerbose functionality of WriteMessage CIM Extensions operation.
5023 *
5024 * param: context the request context.
5025 * param: message
5026 *
5027 * return: MI_TRUE or MI_FALSE.
5028 *
5029 */
5030 MI_INLINE MI_Result MI_CALL MI_Context_WriteVerbose(
5031 _In_ MI_Context* context,
5032 _In_z_ const MI_Char* message)
5033 {
5034 if (context && context->ft)
5035 {
5036 return context->ft->WriteMessage(context, MI_WRITEMESSAGE_CHANNEL_VERBOSE, message);
5037 }
5038 else
5039 {
5040 return MI_RESULT_INVALID_PARAMETER;
5041 mike 1.1 }
5042 }
5043
5044 /**
5045 * This function implements the WriteDebug functionality of WriteMessage CIM Extensions operation.
5046 *
5047 * param: context the request context.
5048 * param: message
5049 *
5050 * return: MI_TRUE or MI_FALSE.
5051 *
5052 */
5053 MI_INLINE MI_Result MI_CALL MI_Context_WriteDebug(
5054 _In_ MI_Context* context,
5055 _In_z_ const MI_Char* message)
5056 {
5057 if (context && context->ft)
5058 {
5059 return context->ft->WriteMessage(context, MI_WRITEMESSAGE_CHANNEL_DEBUG, message);
5060 }
5061 else
5062 mike 1.1 {
5063 return MI_RESULT_INVALID_PARAMETER;
5064 }
5065 }
5066
5067
5068
5069
5070 /*
5071 **==============================================================================
5072 **
5073 ** MI_InstanceOf
5074 ** converts pointer to concrete instance to pointer to MI_Instance
5075 **
5076 **==============================================================================
5077 */
5078 #define MI_InstanceOf(inst) (&(inst)->__instance)
5079
5080
5081
5082 /*
5083 mike 1.1 **==============================================================================
5084 **
5085 ** Undo eight-byte packing for structures (on Windows)
5086 **
5087 **==============================================================================
5088 */
5089
5090 #if defined(_MSC_VER)
5091 # pragma pack(pop)
5092 #endif
5093
5094 #endif /* _MI_h */
5095
5096 /*============================================================================
5097 * Copyright (C) Microsoft Corporation, All rights reserved.
5098 *============================================================================
5099 */
5100
5101 /*
5102 **=============================================================================
5103 **
5104 mike 1.1 ** CIM Client Management Interface (MI) APIs
5105 **
5106 **=============================================================================
5107 */
5108 #ifndef __MI_C_API_H
5109 #define __MI_C_API_H
5110
5111 #ifndef MI_CALL_VERSION
5112 /* Always default to version 1 of API */
5113 #define MI_CALL_VERSION 1
5114 #endif
5115
5116 #if (MI_CALL_VERSION > 1)
5117 #error "Unsupported version of MI_CALL_VERSION. This SDK only supports version 1."
5118 #endif
5119
5120 #ifdef __cplusplus
5121 extern "C" {
5122 #endif
5123
5124 typedef MI_Module* (MI_MAIN_CALL *MI_MainFunction)(MI_Server* server);
5125 mike 1.1
5126 typedef struct _MI_QualifierSet MI_QualifierSet;
5127
5128 /* make sure ordering of methods and arguments is consistent with other function tables */
5129
5130 typedef struct _MI_QualifierSetFT
5131 {
5132 MI_Result (MI_CALL *GetQualifierCount)(
5133 _In_ const MI_QualifierSet *self,
5134 _Out_ MI_Uint32 *count);
5135
5136 MI_Result (MI_CALL *GetQualifierAt)(
5137 _In_ const MI_QualifierSet *self,
5138 MI_Uint32 index,
5139 _Outptr_result_z_ const MI_Char **name,
5140 _Out_ MI_Type *qualifierType,
5141 _Out_ MI_Uint32 *qualifierFlags, /* scope information */
5142 _Out_ MI_Value *qualifierValue
5143 );
5144
5145 MI_Result (MI_CALL *GetQualifier)(
5146 mike 1.1 _In_ const MI_QualifierSet *self,
5147 _In_z_ const MI_Char *name,
5148 _Out_ MI_Type *qualifierType,
5149 _Out_ MI_Uint32 *qualifierFlags, /* scope information */
5150 _Out_ MI_Value *qualifierValue,
5151 _Out_ MI_Uint32 *index
5152 );
5153 } MI_QualifierSetFT;
5154
5155 struct _MI_QualifierSet
5156 {
5157 MI_Uint64 reserved1;
5158 ptrdiff_t reserved2;
5159
5160 const MI_QualifierSetFT *ft;
5161 };
5162
5163 typedef struct _MI_ParameterSet MI_ParameterSet;
5164
5165 typedef struct _MI_ParameterSetFT
5166 {
5167 mike 1.1 MI_Result (MI_CALL *GetMethodReturnType)(
5168 _In_ const MI_ParameterSet *self,
5169 _Out_ MI_Type *returnType,
5170 _Out_ MI_QualifierSet *qualifierSet);
5171
5172 MI_Result (MI_CALL *GetParameterCount)(
5173 _In_ const MI_ParameterSet *self,
5174 _Out_ MI_Uint32 *count);
5175
5176 MI_Result (MI_CALL *GetParameterAt)(
5177 _In_ const MI_ParameterSet *self,
5178 MI_Uint32 index,
5179 _Outptr_result_z_ const MI_Char **name,
5180 MI_Type *parameterType,
5181 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
5182 _Out_ MI_QualifierSet *qualifierSet);
5183
5184 MI_Result (MI_CALL *GetParameter)(
5185 _In_ const MI_ParameterSet *self,
5186 _In_z_ const MI_Char *name,
5187 _Out_ MI_Type *parameterType,
5188 mike 1.1 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
5189 _Out_ MI_QualifierSet *qualifierSet,
5190 _Out_ MI_Uint32 *index);
5191
5192 } MI_ParameterSetFT;
5193
5194 struct _MI_ParameterSet
5195 {
5196 MI_Uint64 reserved1;
5197 ptrdiff_t reserved2;
5198
5199 const MI_ParameterSetFT * ft;
5200 };
5201
5202 typedef struct _MI_ClassFT
5203 {
5204 MI_Result (MI_CALL *GetClassName)(
5205 _In_ const MI_Class* self,
5206 _Outptr_result_maybenull_z_ const MI_Char** className);
5207
5208 MI_Result (MI_CALL *GetNameSpace)(
5209 mike 1.1 _In_ const MI_Class* self,
5210 _Outptr_result_maybenull_z_ const MI_Char** nameSpace);
5211
5212 MI_Result (MI_CALL *GetServerName)(
5213 _In_ const MI_Class* self,
5214 _Outptr_result_maybenull_z_ const MI_Char** serverName);
5215
5216 MI_Result (MI_CALL *GetElementCount)(
5217 _In_ const MI_Class* self,
5218 _Out_ MI_Uint32* count);
5219
5220 MI_Result (MI_CALL *GetElement)(
5221 _In_ const MI_Class* self,
5222 _In_z_ const MI_Char* name,
5223 _Out_opt_ MI_Value* value,
5224 _Out_opt_ MI_Boolean* valueExists,
5225 _Out_opt_ MI_Type* type,
5226 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
5227 _Out_opt_ MI_QualifierSet *qualifierSet,
5228 _Out_opt_ MI_Uint32* flags,
5229 _Out_opt_ MI_Uint32* index);
5230 mike 1.1
5231 MI_Result (MI_CALL *GetElementAt)(
5232 _In_ const MI_Class* self,
5233 MI_Uint32 index,
5234 _Outptr_opt_result_maybenull_z_ const MI_Char** name,
5235 _Out_opt_ MI_Value* value,
5236 _Out_opt_ MI_Boolean* valueExists,
5237 _Out_opt_ MI_Type* type,
5238 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
5239 _Out_opt_ MI_QualifierSet *qualifierSet,
5240 _Out_opt_ MI_Uint32* flags);
5241
5242 MI_Result (MI_CALL *GetClassQualifierSet)(
5243 _In_ const MI_Class* self,
5244 _Out_opt_ MI_QualifierSet *qualifierSet
5245 );
5246
5247 MI_Result (MI_CALL *GetMethodCount)(
5248 _In_ const MI_Class* self,
5249 _Out_ MI_Uint32* count);
5250
5251 mike 1.1 MI_Result (MI_CALL *GetMethodAt)(
5252 _In_ const MI_Class *self,
5253 MI_Uint32 index,
5254 _Outptr_result_z_ const MI_Char **name,
5255 _Out_opt_ MI_QualifierSet *qualifierSet,
5256 _Out_opt_ MI_ParameterSet *parameterSet
5257 );
5258
5259 MI_Result (MI_CALL *GetMethod)(
5260 _In_ const MI_Class *self,
5261 _In_z_ const MI_Char *name,
5262 _Out_opt_ MI_QualifierSet *qualifierSet,
5263 _Out_opt_ MI_ParameterSet *parameterSet,
5264 _Out_opt_ MI_Uint32 *index
5265 );
5266
5267 MI_Result (MI_CALL *GetParentClassName)(
5268 _In_ const MI_Class *self,
5269 _Outptr_result_maybenull_z_ const MI_Char **name);
5270
5271 MI_Result (MI_CALL *GetParentClass)(
5272 mike 1.1 _In_ const MI_Class *self,
5273 _Outptr_ MI_Class **parentClass);
5274
5275 MI_Result (MI_CALL *Delete)(
5276 _Inout_ MI_Class* self);
5277
5278 MI_Result (MI_CALL *Clone)(
5279 _In_ const MI_Class* self,
5280 _Outptr_ MI_Class** newClass);
5281 } MI_ClassFT;
5282
5283 struct _MI_Class
5284 {
5285 const MI_ClassFT *ft;
5286
5287 MI_CONST MI_ClassDecl *classDecl;
5288 MI_CONST MI_Char *namespaceName;
5289 MI_CONST MI_Char *serverName;
5290
5291 ptrdiff_t reserved[4];
5292 };
5293 mike 1.1
5294 /*
5295 **=============================================================================
5296 **
5297 ** typedef struct _MI_Application MI_Application
5298 **
5299 ** The application needs to initialize the MI infrastructure. This handle
5300 ** represents the initialized infrastructure and must be closed before
5301 ** application exit.
5302 ** The application object represents a collection of any number of remote
5303 ** sessions.
5304 ** It is expected that a single client object is created per management
5305 ** application, whereby it is created at startup and closed on shutdown.
5306 ** Having one may reduce the amount of memory used by the management
5307 ** infrastructure.
5308 **
5309 ** This handle is created through a call to MI_Application_Initialize
5310 ** and must be closed through MI_Application_Close.
5311 **
5312 ** See MI_Application_* functions for operations on this handle.
5313 **
5314 mike 1.1 ** An application must initialize a variable of this type with
5315 ** MI_APPLICATION_NULL.
5316 **
5317 ** Members
5318 **
5319 ** ft - This is the function table for accessing the
5320 ** management infrastructure. It also holds the
5321 ** application shutdown function.
5322 ** See _MI_Application for actual methods available.
5323 **
5324 ** reserved - Used internally and must not be changed.
5325 **=============================================================================
5326 */
5327 typedef struct _MI_Application MI_Application;
5328
5329 /*
5330 **=============================================================================
5331 **
5332 ** typedef struct _MI_Session MI_Session
5333 **
5334 ** The session object represents a destination, and any configuration
5335 mike 1.1 ** associated with the destination. The creation of a session generally does
5336 ** not talk to the server. A session can have multiple operations
5337 ** running in parallel. There is as much transport connection pooling and reuse
5338 ** as is possible, so two sequential operations will try and share the same
5339 ** connection if that makes sense for the underlying transport. New connections
5340 ** will be made if necessary to run two operations in parallel. This object
5341 ** holds the internal function tables for carrying out actions on the operation.
5342 **
5343 ** This handle is created through a call to MI_Application_NewSession
5344 ** and must be closed through MI_Session_Close.
5345 **
5346 ** See MI_Session_* functions for operations on this handle.
5347 **
5348 ** An application must initialize a variable of this type with
5349 ** MI_SESSION_NULL.
5350 **
5351 ** Members
5352 **
5353 ** ft - This is the function table for accessing carrying out
5354 ** operations on a destination machine, along with
5355 ** configuration of the session. It also has the
5356 mike 1.1 ** session shutdown function.
5357 ** See _MI_SessionFT for actual methods available.
5358 **
5359 ** reserved - Used internally and must not be changed.
5360 **=============================================================================
5361 */
5362 #if 0
5363 typedef struct _MI_Session MI_Session;
5364 #endif
5365
5366 /*
5367 **=============================================================================
5368 **
5369 ** typedef struct _MI_Operation MI_Operation
5370 **
5371 ** The operation object represents a single operations execution. This object
5372 ** holds the internal function tables for carrying out actions on the
5373 ** operation.
5374 **
5375 ** This handle is created through a call to one of the MI_Session_* operation
5376 ** functions and must be closed through MI_Operation_Close. An operation
5377 mike 1.1 ** can be cancelled through a call to MI_Operation_Cancel.
5378 **
5379 ** See MI_Operation_* functions for operations on this handle.
5380 **
5381 ** An application must initialize a variable of this type with
5382 ** MI_OPERATON_NULL.
5383 **
5384 ** Members
5385 **
5386 ** ft - This is the function table for accessing results
5387 ** from the request (if synchronous), and operation
5388 ** cancellation and shutdown.
5389 **
5390 ** reserved - Used internally and must not be changed.
5391 **=============================================================================
5392 */
5393 typedef struct _MI_Operation MI_Operation;
5394
5395 /*
5396 **=============================================================================
5397 **
5398 mike 1.1 ** struct _MI_HostedProvider
5399 **
5400 ** The object represents the registration of a hosted provider with the
5401 ** server.
5402 **
5403 ** This handle is created through a call to MI_Application_NewHostedProvider
5404 ** and must be closed through MI_HostedProvider_Close.
5405 **
5406 ** See MI_HostedProvider_* functions for operations on this handle.
5407 **
5408 ** An application must initialize a variable of this type with
5409 ** MI_DECOUPLEDPROVIDER_NULL.
5410 **
5411 ** Members
5412 **
5413 ** ft - This is the function table for unregistering the
5414 ** hosted provder from the server.
5415 **
5416 ** reserved - Used internally and must not be changed.
5417 **=============================================================================
5418 */
5419 mike 1.1 typedef struct _MI_HostedProvider MI_HostedProvider;
5420
5421 /*
5422 **=============================================================================
5423 **
5424 ** typedef const struct _MI_DestinationOptions MI_DestinationOptions
5425 **
5426 ** The object represents a set of destionation options. The options can be
5427 ** used on a session or for discovering destination capabilities. The object
5428 ** can be used multiple times is required.
5429 **
5430 ** This handle is created through a call to MI_Application_NewDestinationOptions
5431 ** and must be closed through MI_DestinationOptions_Delete.
5432 **
5433 ** See MI_DestinationOptions_* functions for operations on this handle.
5434 **
5435 ** An application must initialize a variable of this type with
5436 ** MI_DESTINATIONOPTIONS_NULL.
5437
5438 **** Members
5439 **
5440 mike 1.1 ** ft - This is the function table for setting the options.
5441 **
5442 ** reserved - Used internally and must not be changed.
5443 **=============================================================================
5444 */
5445 typedef struct _MI_DestinationOptions MI_DestinationOptions;
5446
5447 /*
5448 **=============================================================================
5449 **
5450 ** typedef struct _MI_OperationOptions MI_OperationOptions
5451 **
5452 ** The object represents a set of operation options. The options can be
5453 ** used on operations. The object can be used multiple times is required.
5454 ** Some options are overrides of those set in the destination options.
5455 **
5456 ** This handle is created through a call to MI_Application_NewOperationOptions
5457 ** and must be closed through MI_OperationOptions_Delete.
5458 **
5459 ** See MI_OperationOptions_* functions for operations on this handle.
5460 **
5461 mike 1.1 ** An application must initialize a variable of this type with
5462 ** MI_OPERATIONOPTIONS_NULL.
5463 **
5464 ** Members
5465 **
5466 ** ft - This is the function table for setting the options.
5467 **
5468 ** reserved - Used internally and must not be changed.
5469 **=============================================================================
5470 */
5471 typedef struct _MI_OperationOptions MI_OperationOptions;
5472
5473 /*
5474 **=============================================================================
5475 **
5476 ** (_MI_OperationCallback_ResponseType)
5477 **
5478 **
5479 **=============================================================================
5480 */
5481
5482 mike 1.1 typedef enum _MI_OperationCallback_ResponseType
5483 {
5484 MI_OperationCallback_ResponseType_No,
5485 MI_OperationCallback_ResponseType_Yes,
5486 MI_OperationCallback_ResponseType_NoToAll,
5487 MI_OperationCallback_ResponseType_YesToAll
5488
5489 } MI_OperationCallback_ResponseType;
5490
5491
5492 /*
5493 **=============================================================================
5494 **
5495 ** (*MI_OperationCallback_PromptUser)()
5496 **
5497 ** CIM Extension callback ask the client if the operation should process the
5498 ** request. The callback calls the promptUserResult() method to return the
5499 ** response, either from the current thread or from a different one.
5500 ** MI_OperationCallback_ResponseType_Yes tells the operation to continue,
5501 ** MI_OperationCallback_ResponseType_No tells the operation to abort. If
5502 ** CallbackMode for MI_OperationCallback_PromptUser is
5503 mike 1.1 ** MI_CALLBACKMODE_REPORT promptUserResult() is NULL.
5504 ** If promptUserResult() is not NULL application must call this method
5505 ** otherwise the request will not progress.
5506 ** All parameters are valid until the call into promptUserResult().
5507 **
5508 **=============================================================================
5509 */
5510 typedef void (MI_CALL *MI_OperationCallback_PromptUser)(
5511 _In_ MI_Operation *operation,
5512 _In_opt_ void *callbackContext,
5513 _In_z_ const MI_Char *message,
5514 MI_PromptType promptType,
5515 _In_opt_ MI_Result (MI_CALL * promptUserResult)(_In_ MI_Operation *operation,
5516 MI_OperationCallback_ResponseType response));
5517
5518 /*
5519 **=============================================================================
5520 **
5521 ** (*MI_OperationCallback_WriteError)()
5522 **
5523 ** CIM Extension callback reports an error and ask the user if the operation
5524 mike 1.1 ** should continue.
5525
5526 ** The callback calls the writeErrorResult() method to return the response,
5527 ** wither from the current thread or from a different one. MI_TRUE tells the
5528 ** operation to continue, MI_FALSE tells the operation to abort. The
5529 ** application must call this method otherwise the request will not progress.
5530 ** All parameters are valid until the call into writeErrorResult().
5531 **
5532 **=============================================================================
5533 */
5534 typedef void (MI_CALL *MI_OperationCallback_WriteError)(
5535 _In_ MI_Operation *operation,
5536 _In_opt_ void *callbackContext,
5537 _In_ MI_Instance*instance,
5538 _In_opt_ MI_Result (MI_CALL * writeErrorResult)(_In_ MI_Operation *operation,
5539 MI_OperationCallback_ResponseType response));
5540
5541
5542 /*
5543 **=============================================================================
5544 **
5545 mike 1.1 ** (*MI_OperationCallback_WriteMessage)()
5546 **
5547 ** CIM Extension callback reports a message back to the client. The channel
5548 ** says if it is warning, error, debug, etc. This is purely informational and
5549 ** it does not effect the operation.
5550 ** All parameters are valid for the lifetime of the callback only.
5551 **
5552 ** channel: Can be one of the MI_WRITEMESSAGE_CHANNEL_* defines or a custom one
5553 **=============================================================================
5554 */
5555 #define MI_WRITEMESSAGE_CHANNEL_WARNING 0
5556 #define MI_WRITEMESSAGE_CHANNEL_VERBOSE 1
5557 #define MI_WRITEMESSAGE_CHANNEL_DEBUG 2
5558
5559 typedef void (MI_CALL *MI_OperationCallback_WriteMessage)(
5560 _In_ MI_Operation *operation,
5561 _In_opt_ void *callbackContext,
5562 MI_Uint32 channel,
5563 _In_z_ const MI_Char *message);
5564 /*
5565 **=============================================================================
5566 mike 1.1 **
5567 ** (*MI_OperationCallback_WriteProgress)()
5568 **
5569 ** CIM Extension callback indicates the progress of an operation. This is
5570 ** informational and does not effect the operation.
5571 ** All parameters are valid for the lifetime of the callback only.
5572 **
5573 **=============================================================================
5574 */
5575 typedef void (MI_CALL *MI_OperationCallback_WriteProgress)(
5576 _In_ MI_Operation *operation,
5577 _In_opt_ void *callbackContext,
5578 _In_z_ const MI_Char *activity,
5579 _In_z_ const MI_Char *currentOperation,
5580 _In_z_ const MI_Char *statusDescription,
5581 MI_Uint32 percentageComplete,
5582 MI_Uint32 secondsRemaining);
5583
5584 /*
5585 **=============================================================================
5586 **
5587 mike 1.1 ** (*MI_OperationCallback_Instance)()
5588 **
5589 ** Registering for this callback will cause asynchronous notification of this
5590 ** method to be called for instance operation results for Get, Modify,
5591 ** Create, Delete, Enumeration and Invoke operations. For Enumeration this
5592 ** callback will be called once for each available result.
5593 **
5594 ** Application must call the resultAcknowledgement callback when they are
5595 ** done with the instance. Not doing so will stop the operation from,
5596 ** completing and will cause enumerations to not progress.
5597 **
5598 ** Not calling the resultAcknowledgement callback will stop the CloseOperaton
5599 ** from completing.
5600 **
5601 ** For method invocations, the instance will be a property bag for each
5602 ** of the out parameters of the method.
5603 ** All parameters are valid until the call into resultAcknowledgement().
5604 **
5605 ** Return
5606 **
5607 **=============================================================================
5608 mike 1.1 */
5609 typedef void (MI_CALL *MI_OperationCallback_Instance)(
5610 _In_opt_ MI_Operation *operation,
5611 _In_ void *callbackContext,
5612 _In_opt_ const MI_Instance *instance,
5613 MI_Boolean moreResults,
5614 _In_ MI_Result resultCode,
5615 _In_opt_z_ const MI_Char *errorString,
5616 _In_opt_ const MI_Instance *errorDetails,
5617 _In_opt_ MI_Result (MI_CALL * resultAcknowledgement)(_In_ MI_Operation *operation));
5618
5619
5620 /*
5621 **=============================================================================
5622 **
5623 ** (*MI_OperationCallback_StreamedParameter)()
5624 **
5625 ** Registering this async callback is necessary if an outbound paramter is
5626 ** marked as streamed. This callback will be called as streamed parameter data
5627 ** is available. Streaming can only happen on array parameters. Call the
5628 ** resultAcknowledgement to acknowledge the result. Not doing so will stop
5629 mike 1.1 ** more data from arriving and will stop the operation from completing. It
5630 ** will also stop the operation from closing.
5631 ** All parameters are valid until the call into resultAcknowledgement().
5632 **
5633 ** Return
5634 **
5635 **=============================================================================
5636 */
5637 typedef void (MI_CALL *MI_OperationCallback_StreamedParameter)(
5638 _In_ MI_Operation *operation,
5639 _In_ void *callbackContext,
5640 _In_z_ const MI_Char *parameterName,
5641 _In_ MI_Type resultType,
5642 _In_ const MI_Value *result,
5643 _In_opt_ MI_Result (MI_CALL * resultAcknowledgement)(_In_ MI_Operation *operation));
5644
5645 /*
5646 **=============================================================================
5647 **
5648 ** (*MI_OperationCallback_Indication)()
5649 **
5650 mike 1.1 ** Registering for this callback will cause asynchronous notification of this
5651 ** method to be called when results of a subscription are delivered. Call
5652 ** resultAcknowledgement when done with the indication. Not doing so will
5653 ** result in no more results being received and will stop the subscription from
5654 ** shutting down.
5655 ** All parameters are valid until the call into resultAcknowledgement().
5656 **
5657 ** Return
5658 **
5659 **=============================================================================
5660 */
5661 typedef void (MI_CALL *MI_OperationCallback_Indication)(
5662 _In_opt_ MI_Operation *operation,
5663 _In_ void *callbackContext,
5664 _In_opt_ const MI_Instance *instance,
5665 _In_opt_z_ const MI_Char *bookmark,
5666 _In_opt_z_ const MI_Char *machineID,
5667 MI_Boolean moreResults,
5668 _In_ MI_Result resultCode,
5669 _In_opt_z_ const MI_Char *errorString,
5670 _In_opt_ const MI_Instance *errorDetails,
5671 mike 1.1 _In_opt_ MI_Result (MI_CALL * resultAcknowledgement)(_In_ MI_Operation *operation));
5672
5673 /*
5674 **=============================================================================
5675 **
5676 ** (*MI_OperationCallback_Class)()
5677 **
5678 ** Registering for this callback will cause asynchronous notification when
5679 ** results of a class operations are completed. For enumerations this callback
5680 ** is called for each result. Call resultAcknowledgement when done with the
5681 ** class. Not doing so will result in no more results being received and will
5682 ** stop the operation from shutting down.
5683 ** All parameters are valid until the call into resultAcknowledgement().
5684 **
5685 ** Return
5686 **
5687 **=============================================================================
5688 */
5689 typedef void (MI_CALL *MI_OperationCallback_Class)(
5690 _In_opt_ MI_Operation *operation,
5691 _In_ void *callbackContext,
5692 mike 1.1 _In_opt_ const MI_Class *classResult,
5693 MI_Boolean moreResults,
5694 _In_ MI_Result resultCode,
5695 _In_opt_z_ const MI_Char *errorString,
5696 _In_opt_ const MI_Instance *errorDetails,
5697 _In_opt_ MI_Result (MI_CALL * resultAcknowledgement)(_In_ MI_Operation *operation));
5698
5699 /*
5700 **=============================================================================
5701 **
5702 ** typedef MI_OperationCallbacks
5703 **
5704 ** Structure that holds all callback function pointers. Fill in the ones
5705 ** you want to receive. If the associated operation callback for the operation
5706 ** is not set the operation will be carried out synchronously. All CIM
5707 ** extension and streamed result callbacks are optional. The callbackContext
5708 ** is application specific data that is passed back in the callback so the
5709 ** application can correlate the callbacks with the request.
5710 **
5711 **=============================================================================
5712 */
5713 mike 1.1 typedef struct _MI_OperationCallbacks
5714 {
5715 /* User callback context */
5716 void *callbackContext;
5717
5718 /* CIM Extension callbacks */
5719 MI_OperationCallback_PromptUser promptUser;
5720 MI_OperationCallback_WriteError writeError;
5721 MI_OperationCallback_WriteMessage writeMessage;
5722 MI_OperationCallback_WriteProgress writeProgress;
5723
5724 /* Result callbacks */
5725 MI_OperationCallback_Instance instanceResult;
5726 MI_OperationCallback_Indication indicationResult;
5727 MI_OperationCallback_Class classResult;
5728
5729 /* Invoke streamed outbound parameter result callback */
5730 MI_OperationCallback_StreamedParameter streamedParameterResult;
5731 }
5732 MI_OperationCallbacks;
5733
5734 mike 1.1
5735 /*
5736 **=============================================================================
5737 **
5738 ** #define MI_OPERATIONCALLBACKS_NULL
5739 **
5740 ** Initializer for the MI_OperationCallbacks structure
5741 **=============================================================================
5742 */
5743 #define MI_OPERATIONCALLBACKS_NULL {NULL}
5744
5745 /*
5746 **=============================================================================
5747 **
5748 ** typedef MI_SessionCallbacks
5749 **
5750 ** Structure that holds all callback function pointers. Fill in the ones
5751 ** you want to receive. All callbacks are CIM extensions for tracking
5752 ** logging and error messages.
5753 **
5754 **=============================================================================
5755 mike 1.1 */
5756 typedef struct _MI_SessionCallbacks
5757 {
5758 /* User callback context that is passed into callback */
5759 void *callbackContext;
5760
5761 /*=========================================================================
5762 ** CIM Extension callback for recieving logging from the session creation.
5763 ** All parameters are valid only for the lifetime of the callback.
5764 **=========================================================================
5765 */
5766 void (MI_CALL *writeMessage)(
5767 _In_ MI_Application *application,
5768 _In_opt_ void *callbackContext,
5769 MI_Uint32 channel,
5770 _In_z_ const MI_Char * message);
5771
5772 /*=========================================================================
5773 ** CIM Extension callback for errors. The session version of this API is
5774 ** information only. The session will fail to create and will return an
5775 ** error. All parameters are valid only for the lifetime of the callback.
5776 mike 1.1 **=========================================================================
5777 */
5778 void (MI_CALL *writeError)(
5779 _In_ MI_Application *application,
5780 _In_opt_ void *callbackContext,
5781 _In_ MI_Instance *instance);
5782 }
5783 MI_SessionCallbacks;
5784
5785 #define MI_SESSIONCALLBACKS_NULL { NULL }
5786
5787
5788 /* Flags to be passed into Session operation functions.
5789 * One item from each group can be bit-wise combined.
5790 */
5791 /*#define MI_OPERATIONFLAGS_AUTOMATIC_ACK_RESULTS default, 0x0000 */
5792 #define MI_OPERATIONFLAGS_MANUAL_ACK_RESULTS 0x0001
5793
5794 /* RTTI bitmasks in order to specify what options are acceptable to the client */
5795 #define MI_OPERATIONFLAGS_NO_RTTI 0x0400 /* All instance elements are string except embedded objects and references, but their elements will be strings also */
5796 #define MI_OPERATIONFLAGS_BASIC_RTTI 0x0002 /* All instance elements may be strings or the correct type */
5797 mike 1.1 #define MI_OPERATIONFLAGS_STANDARD_RTTI 0x0800 /* All instance elements are of the correct type, but some hierarchy information may be lost due to optimizations */
5798 #define MI_OPERATIONFLAGS_FULL_RTTI 0x0004 /* All instance elements at every level of the instances class hierarchy will be accurate. This may be very expensive */
5799
5800 /* If no RTTI flag is specified (i.e. 0 for relevant RTTI bits) then the protocol handler itself will pick the best option */
5801 #define MI_OPERATIONFLAGS_DEFAULT_RTTI 0
5802
5803 /*#define MI_OPERATIONFLAGS_NON_LOCALIZED_QUALIFIERS default, 0x0000 */
5804 #define MI_OPERATIONFLAGS_LOCALIZED_QUALIFIERS 0x0008
5805
5806 /*#define MI_OPERATIONFLAGS_NON_EXPENSIVE_PROPERTIES_ONLY default, 0x0040 */
5807 #define MI_OPERATIONFLAGS_EXPENSIVE_PROPERTIES 0x0040
5808
5809 /*#define MI_OPERATIONFLAGS_POLYMORPHISM_DEEP default, 0x0000 */
5810 #define MI_OPERATIONFLAGS_POLYMORPHISM_SHALLOW 0x0080
5811 #define MI_OPERATIONFLAGS_POLYMORPHISM_DEEP_BASE_PROPS_ONLY 0x0180
5812
5813 /* Report an empty result when the operation has successfully started.
5814 * The first result may have a NULL instance/class/indication, with
5815 * moreResults set to MI_TRUE. If a result is delivered very quickly
5816 * the actual result will be delivered instead.
5817 * Not all operations or protocol handlers can achieve this.
5818 mike 1.1 */
5819 #define MI_OPERATIONFLAGS_REPORT_OPERATION_STARTED 0x0200
5820
5821 /*
5822 **=============================================================================
5823 **
5824 ** #define MI_AUTH_TYPE_*
5825 **
5826 ** Set of defines for different types of supported authentication. Note that
5827 ** not all protocols and transports support this list, and some protocols and
5828 ** transports may support others.
5829 **
5830 **=============================================================================
5831 */
5832 #define MI_AUTH_TYPE_DEFAULT MI_T("Default") /* transport picks default specific to it. Ex: winrm uses Kerberos and NegotiateWithoutCredentials as default*/
5833 #define MI_AUTH_TYPE_NONE MI_T("None") /* do not authenticate, most servers require some kind of authentication */
5834 #define MI_AUTH_TYPE_DIGEST MI_T("Digest") /* Needs username/password */
5835 #define MI_AUTH_TYPE_NEGO_WITH_CREDS MI_T("NegoWithCreds") /* needs username/password */
5836 #define MI_AUTH_TYPE_NEGO_NO_CREDS MI_T("NegoNoCreds") /* current thread user, need to trust destination! */
5837 #define MI_AUTH_TYPE_BASIC MI_T("Basic") /* needs username/password */
5838 #define MI_AUTH_TYPE_KERBEROS MI_T("Kerberos") /* username/password optional */
5839 mike 1.1 #define MI_AUTH_TYPE_CLIENT_CERTS MI_T("ClientCerts") /* needs cert thumbprint */
5840 #define MI_AUTH_TYPE_NTLM MI_T("Ntlmdomain") /* username/password optional */
5841 #if (WINVER >= 0x600)
5842 #define MI_AUTH_TYPE_CREDSSP MI_T("CredSSP") /* username/password optional */
5843 #endif
5844 #define MI_AUTH_TYPE_ISSUER_CERT MI_T("IssuerCert") /* Push/Source Initiated subscriptions only */
5845
5846 /*
5847 **=============================================================================
5848 **
5849 ** typedef MI_UsernamePasswordCreds
5850 **
5851 ** A username/password combination used for subscription operations.
5852 **
5853 **=============================================================================
5854 */
5855 typedef struct _MI_UsernamePasswordCreds
5856 {
5857 const MI_Char *domain;
5858 const MI_Char *username;
5859 const MI_Char *password;
5860 mike 1.1 }
5861 MI_UsernamePasswordCreds;
5862
5863 /*
5864 **=============================================================================
5865 **
5866 ** typedef MI_UserCredentials
5867 **
5868 ** A user credential. It includes an authentication type and either a username
5869 ** and password or a certificate thumbprint, depending on the authentication
5870 ** type.
5871 **
5872 **=============================================================================
5873 */
5874 typedef struct _MI_UserCredentials
5875 {
5876 const MI_Char *authenticationType; /* MI_AUTH_TYPE_... values */
5877 union
5878 {
5879 MI_UsernamePasswordCreds usernamePassword;
5880 const MI_Char *certificateThumbprint;
5881 mike 1.1 } credentials;
5882 }
5883 MI_UserCredentials;
5884
5885 /*
5886 **=============================================================================
5887 **
5888 ** enum MI_SubscriptionDeliveryType
5889 **
5890 ** Subsciption type.
5891 **
5892 ** A Pull subscription polls the destination for indications. If the
5893 ** subscription can get through the firewall of the destination machine then
5894 ** pulling events from the machine is more lifely to work.
5895 **
5896 ** Push subscriptions has the destination machine push the indication to the
5897 ** client machine. This is more efficient as it does not need to keep a
5898 ** connection to the destination open, however the firewall on the client
5899 ** machine also needs to be opened up as well as on the destination machine.
5900 ** The security around this type of subscription is a little more difficult
5901 ** to get working than Pull.
5902 mike 1.1 **
5903 ** Source initiated subscriptions is when something starts the subscription
5904 ** on a destination machine through some other means and starts pushing the
5905 ** events to this machine. This subscription can collect events from a
5906 ** large number of sources if required, and is configurable based on the
5907 ** clients needs.
5908 **=============================================================================
5909 */
5910 typedef enum _MI_SubscriptionDeliveryType
5911 {
5912 MI_SubscriptionDeliveryType_Pull = 1,
5913 MI_SubscriptionDeliveryType_Push = 2,
5914 }
5915 MI_SubscriptionDeliveryType;
5916
5917 typedef struct _MI_SubscriptionDeliveryOptions MI_SubscriptionDeliveryOptions;
5918
5919 typedef struct _MI_SubscriptionDeliveryOptionsFT
5920 {
5921 MI_Result (MI_CALL *SetString)(
5922 _Inout_ MI_SubscriptionDeliveryOptions *options,
5923 mike 1.1 _In_z_ const MI_Char *optionName,
5924 _In_z_ const MI_Char *value,
5925 MI_Uint32 flags);
5926
5927 MI_Result (MI_CALL *SetNumber)(
5928 _Inout_ MI_SubscriptionDeliveryOptions *options,
5929 _In_z_ const MI_Char *optionName,
5930 _In_ MI_Uint32 value,
5931 MI_Uint32 flags);
5932
5933 MI_Result (MI_CALL *SetDateTime)(
5934 _Inout_ MI_SubscriptionDeliveryOptions *options,
5935 _In_z_ const MI_Char *optionName,
5936 _In_ const MI_Datetime *value,
5937 MI_Uint32 flags);
5938
5939 MI_Result (MI_CALL *SetInterval)(
5940 _Inout_ MI_SubscriptionDeliveryOptions *options,
5941 _In_z_ const MI_Char *optionName,
5942 _In_ const MI_Interval *value,
5943 MI_Uint32 flags);
5944 mike 1.1
5945 MI_Result (MI_CALL *AddCredentials)(
5946 _Inout_ MI_SubscriptionDeliveryOptions *options,
5947 _In_z_ const MI_Char *optionName,
5948 _In_ const MI_UserCredentials *credentials,
5949 MI_Uint32 flags);
5950
5951 MI_Result (MI_CALL *Delete)(
5952 _Inout_ MI_SubscriptionDeliveryOptions* self);
5953
5954 MI_Result (MI_CALL *GetString)(
5955 _In_ MI_SubscriptionDeliveryOptions *options,
5956 _In_z_ const MI_Char *optionName,
5957 _Outptr_result_z_ const MI_Char **value,
5958 _Out_opt_ MI_Uint32 *index,
5959 _Out_opt_ MI_Uint32 *flags);
5960
5961 MI_Result (MI_CALL *GetNumber)(
5962 _In_ MI_SubscriptionDeliveryOptions *options,
5963 _In_z_ const MI_Char *optionName,
5964 _Out_ MI_Uint32 *value,
5965 mike 1.1 _Out_opt_ MI_Uint32 *index,
5966 _Out_opt_ MI_Uint32 *flags);
5967
5968 MI_Result (MI_CALL *GetDateTime)(
5969 _In_ MI_SubscriptionDeliveryOptions *options,
5970 _In_z_ const MI_Char *optionName,
5971 _Out_ MI_Datetime *value,
5972 _Out_opt_ MI_Uint32 *index,
5973 _Out_opt_ MI_Uint32 *flags);
5974
5975 MI_Result (MI_CALL *GetInterval)(
5976 _In_ MI_SubscriptionDeliveryOptions *options,
5977 _In_z_ const MI_Char *optionName,
5978 _Out_ MI_Interval *value,
5979 _Out_opt_ MI_Uint32 *index,
5980 _Out_opt_ MI_Uint32 *flags);
5981
5982 MI_Result (MI_CALL *GetOptionCount)(
5983 _In_ MI_SubscriptionDeliveryOptions *options,
5984 _Out_opt_ MI_Uint32 *count);
5985
5986 mike 1.1 MI_Result (MI_CALL *GetOptionAt)(
5987 _In_ MI_SubscriptionDeliveryOptions *options,
5988 MI_Uint32 index,
5989 _Outptr_result_z_ const MI_Char **optionName,
5990 _Out_ MI_Value *value,
5991 _Out_ MI_Type *type,
5992 _Out_opt_ MI_Uint32 *flags);
5993
5994 MI_Result (MI_CALL *GetOption)(
5995 _In_ MI_SubscriptionDeliveryOptions *options,
5996 _In_z_ const MI_Char *optionName,
5997 _Out_ MI_Value *value,
5998 _Out_ MI_Type *type,
5999 _Out_opt_ MI_Uint32 *index,
6000 _Out_opt_ MI_Uint32 *flags);
6001
6002 MI_Result (MI_CALL *GetCredentialsCount)(
6003 _In_ MI_SubscriptionDeliveryOptions *options,
6004 _Out_ MI_Uint32 *count);
6005
6006 MI_Result (MI_CALL *GetCredentialsAt)(
6007 mike 1.1 _In_ MI_SubscriptionDeliveryOptions *options,
6008 MI_Uint32 index,
6009 _Outptr_result_z_ const MI_Char **optionName,
6010 _Out_ MI_UserCredentials *credentials, // output credentials always has password set to '******'
6011 _Out_opt_ MI_Uint32 *flags);
6012
6013 MI_Result (MI_CALL *GetCredentialsPasswordAt)(
6014 _In_ MI_SubscriptionDeliveryOptions *options,
6015 MI_Uint32 index,
6016 _Outptr_result_z_ const MI_Char **optionName,
6017 _Out_writes_to_opt_(bufferLength, *passwordLength) MI_Char *password,
6018 _In_ MI_Uint32 bufferLength,
6019 _Out_ MI_Uint32 *passwordLength,
6020 _Out_opt_ MI_Uint32 *flags);
6021
6022 MI_Result (MI_CALL *Clone)(
6023 _In_ const MI_SubscriptionDeliveryOptions* self,
6024 _Out_ MI_SubscriptionDeliveryOptions* newSubscriptionDeliveryOptions);
6025
6026 } MI_SubscriptionDeliveryOptionsFT;
6027 /*
6028 mike 1.1 **=============================================================================
6029 **
6030 ** typedef MI_SubscriptionDeliveryOptions
6031 **
6032 ** Subscription configuration options.
6033 **
6034 **=============================================================================
6035 */
6036 struct _MI_SubscriptionDeliveryOptions
6037 {
6038 MI_Uint64 reserved1;
6039 ptrdiff_t reserved2;
6040
6041 const MI_SubscriptionDeliveryOptionsFT * ft;
6042 };
6043
6044 #define MI_SUBSCRIPTIONDELIVERYOPTIONS_NULL { 0, 0, NULL }
6045
6046 typedef struct _MI_Serializer MI_Serializer;
6047 typedef struct _MI_SerializerFT MI_SerializerFT;
6048 typedef struct _MI_Deserializer MI_Deserializer;
6049 mike 1.1 typedef struct _MI_DeserializerFT MI_DeserializerFT;
6050
6051 struct _MI_Serializer
6052 {
6053 MI_Uint64 reserved1;
6054 ptrdiff_t reserved2;
6055 } ;
6056
6057 struct _MI_Deserializer
6058 {
6059 MI_Uint64 reserved1;
6060 ptrdiff_t reserved2;
6061 } ;
6062
6063 struct _MI_SerializerFT
6064 {
6065 MI_Result (MI_CALL *Close)(
6066 _Inout_ MI_Serializer *serializer);
6067
6068 MI_Result (MI_CALL *SerializeClass)(
6069 _Inout_ MI_Serializer *serializer,
6070 mike 1.1 MI_Uint32 flags,
6071 _In_ const MI_Class *classObject,
6072 _Out_writes_bytes_(clientBufferLength) MI_Uint8 *clientBuffer,
6073 MI_Uint32 clientBufferLength,
6074 _Inout_ MI_Uint32 *clientBufferNeeded);
6075
6076 MI_Result (MI_CALL *SerializeInstance)(
6077 _Inout_ MI_Serializer *serializer,
6078 MI_Uint32 flags,
6079 _In_ const MI_Instance *instanceObject,
6080 _Out_writes_bytes_(clientBufferLength) MI_Uint8 *clientBuffer,
6081 MI_Uint32 clientBufferLength,
6082 _Inout_ MI_Uint32 *clientBufferNeeded);
6083 };
6084
6085 /*
6086 **=============================================================================
6087 **
6088 ** typedef MI_Deserializer_ClassObjectNeeded
6089 **
6090 ** Callback function used to provider requested class object during deserialization.
6091 mike 1.1 **
6092 **=============================================================================
6093 */
6094 typedef MI_Result (MI_CALL *MI_Deserializer_ClassObjectNeeded)(
6095 _In_opt_ void *context,
6096 _In_opt_z_ const MI_Char *serverName,
6097 _In_opt_z_ const MI_Char *namespaceName,
6098 _In_z_ const MI_Char *className,
6099 _Outptr_ MI_Class **requestedClassObject);
6100
6101 /*
6102 **=============================================================================
6103 **
6104 ** MI_DeserializerFT
6105 **
6106 ** Deserialier function table.
6107 **
6108 **=============================================================================
6109 */
6110 struct _MI_DeserializerFT
6111 {
6112 mike 1.1 MI_Result (MI_CALL *Close)(
6113 _Inout_ MI_Deserializer *deserializer);
6114
6115 MI_Result (MI_CALL *DeserializeClass)(
6116 _Inout_ MI_Deserializer *deserializer,
6117 MI_Uint32 flags,
6118 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
6119 MI_Uint32 serializedBufferLength,
6120 _In_opt_ MI_Class *parentClass,
6121 _In_opt_z_ const MI_Char *serverName,
6122 _In_opt_z_ const MI_Char *namespaceName,
6123 _In_opt_ MI_Deserializer_ClassObjectNeeded classObjectNeeded,
6124 _In_opt_ void *classObjectNeededContext,
6125 _Out_opt_ MI_Uint32 *serializedBufferRead,
6126 _Outptr_opt_result_maybenull_ MI_Class **classObject,
6127 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails);
6128
6129 MI_Result (MI_CALL *Class_GetClassName)(
6130 _Inout_ MI_Deserializer *deserializer,
6131 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
6132 MI_Uint32 serializedBufferLength,
6133 mike 1.1 _Out_writes_opt_(*classNameLength) MI_Char *className,
6134 _Inout_ MI_Uint32 *classNameLength,
6135 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails);
6136
6137 MI_Result (MI_CALL *Class_GetParentClassName)(
6138 _Inout_ MI_Deserializer *deserializer,
6139 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
6140 MI_Uint32 serializedBufferLength,
6141 _Out_writes_opt_(*parentClassNameLength) MI_Char *parentClassName,
6142 _Inout_ MI_Uint32 *parentClassNameLength,
6143 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails);
6144
6145 MI_Result (MI_CALL *DeserializeInstance)(
6146 _Inout_ MI_Deserializer *deserializer,
6147 MI_Uint32 flags,
6148 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
6149 MI_Uint32 serializedBufferLength,
6150 _In_reads_opt_(numberClassObjects) MI_Class **classObjects,
6151 MI_Uint32 numberClassObjects,
6152 _In_opt_ MI_Deserializer_ClassObjectNeeded classObjectNeeded,
6153 _In_opt_ void *classObjectNeededContext,
6154 mike 1.1 _Out_opt_ MI_Uint32 *serializedBufferRead,
6155 _Outptr_opt_result_maybenull_ MI_Instance **instanceObject,
6156 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails);
6157
6158 MI_Result (MI_CALL *Instance_GetClassName)(
6159 _Inout_ MI_Deserializer *deserializer,
6160 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
6161 MI_Uint32 serializedBufferLength,
6162 _Out_writes_opt_(*classNameLength) MI_Char *className,
6163 _Inout_ MI_Uint32 *classNameLength,
6164 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails);
6165
6166 };
6167
6168 /*
6169 **=============================================================================
6170 **
6171 ** typedef _MI_ApplicationFT MI_ApplicationFT
6172 **
6173 ** Function table for all actions on a application object.
6174 **
6175 mike 1.1 ** See MI_Application_<method name> functions for details.
6176 **
6177 **=============================================================================
6178 */
6179 typedef struct _MI_ApplicationFT
6180 {
6181 MI_Result (MI_CALL *Close)(
6182 _Inout_ MI_Application *application);
6183
6184 MI_Result (MI_CALL *NewSession)(
6185 _In_ MI_Application *application,
6186 _In_opt_z_ const MI_Char *protocol,
6187 _In_opt_z_ const MI_Char *destination,
6188 _In_opt_ MI_DestinationOptions *options,
6189 _In_opt_ MI_SessionCallbacks *callbacks,
6190 _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
6191 _Out_ MI_Session *session);
6192
6193 MI_Result (MI_CALL *NewHostedProvider)(
6194 _In_ MI_Application *application,
6195 _In_z_ const MI_Char *namespaceName,
6196 mike 1.1 _In_z_ const MI_Char *providerName,
6197 _In_ MI_MainFunction mi_Main,
6198 _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
6199 _Out_ MI_HostedProvider *provider
6200 );
6201
6202 MI_Result (MI_CALL *NewInstance)(
6203 _In_ MI_Application *application,
6204 _In_z_ const MI_Char *className,
6205 _In_opt_ const MI_ClassDecl *classRTTI,
6206 _Outptr_ MI_Instance **instance);
6207
6208 MI_Result (MI_CALL *NewDestinationOptions)(
6209 _In_ MI_Application *application,
6210 _Out_ MI_DestinationOptions *options);
6211
6212 MI_Result (MI_CALL *NewOperationOptions)(
6213 _In_ MI_Application *application,
6214 _In_ MI_Boolean customOptionsMustUnderstand,
6215 _Out_ MI_OperationOptions *options);
6216
6217 mike 1.1 MI_Result (MI_CALL *NewSubscriptionDeliveryOptions)(
6218 _In_ MI_Application *application,
6219 _In_ MI_SubscriptionDeliveryType deliveryType,
6220 _Out_ MI_SubscriptionDeliveryOptions *deliveryOptions);
6221
6222 MI_Result (MI_CALL *NewSerializer)(
6223 _Inout_ MI_Application *application,
6224 MI_Uint32 flags,
6225 _In_z_ MI_Char *format,
6226 _Out_ MI_Serializer *serializer);
6227
6228 MI_Result (MI_CALL *NewDeserializer)(
6229 _Inout_ MI_Application *application,
6230 MI_Uint32 flags,
6231 _In_z_ MI_Char *format,
6232 _Out_ MI_Deserializer *deserializer);
6233
6234 MI_Result (MI_CALL *NewInstanceFromClass)(
6235 _In_ MI_Application *application,
6236 _In_z_ const MI_Char *className,
6237 _In_opt_ const MI_Class *classObject,
6238 mike 1.1 _Outptr_ MI_Instance **instance);
6239 }
6240 MI_ApplicationFT;
6241
6242 /*
6243 **=============================================================================
6244 **
6245 ** typedef const _MI_HostedProviderFT MI_HostedProviderFT
6246 **
6247 ** Function table for all actions on a hosted provider object.
6248 **
6249 ** See MI_HostedProvider_<method name> functions for details.
6250 **
6251 **=============================================================================
6252 */
6253 typedef struct _MI_HostedProviderFT
6254 {
6255 MI_Result (MI_CALL *Close)(
6256 _Inout_ MI_HostedProvider *hostedProvider);
6257
6258 MI_Result (MI_CALL *GetApplication)(
6259 mike 1.1 _In_ MI_HostedProvider *hostedProvider,
6260 _Out_ MI_Application *application);
6261 }
6262 MI_HostedProviderFT;
6263
6264 /*
6265 **=============================================================================
6266 **
6267 ** typedef const _MI_SessionFT MI_SessionFT
6268 **
6269 ** Function table for all actions on a session object.
6270 **
6271 ** See MI_Session_<method name> functions for details.
6272 **
6273 **=============================================================================
6274 */
6275 typedef struct _MI_SessionFT
6276 {
6277 MI_Result (MI_CALL *Close)(
6278 _Inout_ MI_Session *session,
6279 _In_opt_ void *completionContext,
6280 mike 1.1 _In_opt_ void (MI_CALL *completionCallback)(_In_opt_ void *completionContext));
6281
6282 MI_Result (MI_CALL *GetApplication)(
6283 _In_ MI_Session *session,
6284 _Out_ MI_Application *application);
6285
6286 void (MI_CALL *GetInstance)(
6287 _In_ MI_Session *session,
6288 MI_Uint32 flags,
6289 _In_opt_ MI_OperationOptions *options,
6290 _In_opt_z_ const MI_Char *namespaceName,
6291 _In_ const MI_Instance *inboundInstance,
6292 _In_opt_ MI_OperationCallbacks *callbacks,
6293 _Out_ MI_Operation *operation);
6294
6295 void (MI_CALL *ModifyInstance)(
6296 _In_ MI_Session *session,
6297 MI_Uint32 flags,
6298 _In_opt_ MI_OperationOptions *options,
6299 _In_opt_z_ const MI_Char *namespaceName,
6300 _In_ const MI_Instance *inboundInstance,
6301 mike 1.1 _In_opt_ MI_OperationCallbacks *callbacks,
6302 _Out_ MI_Operation *operation);
6303
6304 void (MI_CALL *CreateInstance)(
6305 _In_ MI_Session *session,
6306 MI_Uint32 flags,
6307 _In_opt_ MI_OperationOptions *options,
6308 _In_opt_z_ const MI_Char *namespaceName,
6309 _In_ const MI_Instance *inboundInstance,
6310 _In_opt_ MI_OperationCallbacks *callbacks,
6311 _Out_ MI_Operation *operation);
6312
6313 void (MI_CALL *DeleteInstance)(
6314 _In_ MI_Session *session,
6315 MI_Uint32 flags,
6316 _In_opt_ MI_OperationOptions *options,
6317 _In_opt_z_ const MI_Char *namespaceName,
6318 _In_ const MI_Instance *inboundInstance,
6319 _In_opt_ MI_OperationCallbacks *callbacks,
6320 _Out_ MI_Operation *operation);
6321
6322 mike 1.1 void (MI_CALL *Invoke)(
6323 _In_ MI_Session *session,
6324 MI_Uint32 flags,
6325 _In_opt_ MI_OperationOptions *options,
6326 _In_opt_z_ const MI_Char *namespaceName,
6327 _In_opt_z_ const MI_Char *className,
6328 _In_z_ const MI_Char *methodName,
6329 _In_opt_ const MI_Instance *inboundInstance,
6330 _In_opt_ const MI_Instance *inboundProperties,
6331 _In_opt_ MI_OperationCallbacks *callbacks,
6332 _Out_ MI_Operation *operation);
6333
6334 void (MI_CALL *EnumerateInstances)(
6335 _In_ MI_Session *session,
6336 MI_Uint32 flags,
6337 _In_opt_ MI_OperationOptions *options,
6338 _In_opt_z_ const MI_Char *namespaceName,
6339 _In_opt_z_ const MI_Char *className,
6340 MI_Boolean keysOnly,
6341 _In_opt_ MI_OperationCallbacks *callbacks,
6342 _Out_ MI_Operation *operation);
6343 mike 1.1
6344 void (MI_CALL *QueryInstances)(
6345 _In_ MI_Session *session,
6346 MI_Uint32 flags,
6347 _In_opt_ MI_OperationOptions *options,
6348 _In_opt_z_ const MI_Char *namespaceName,
6349 _In_opt_z_ const MI_Char *queryDialect,
6350 _In_opt_z_ const MI_Char *queryExpression,
6351 _In_opt_ MI_OperationCallbacks *callbacks,
6352 _Out_ MI_Operation *operation);
6353
6354 void (MI_CALL *AssociatorInstances)(
6355 _In_ MI_Session *session,
6356 MI_Uint32 flags,
6357 _In_opt_ MI_OperationOptions *options,
6358 _In_opt_z_ const MI_Char *namespaceName,
6359 _In_ const MI_Instance *instanceKeys,
6360 _In_opt_z_ const MI_Char *assocClass,
6361 _In_opt_z_ const MI_Char *resultClass,
6362 _In_opt_z_ const MI_Char *role,
6363 _In_opt_z_ const MI_Char *resultRole,
6364 mike 1.1 MI_Boolean keysOnly,
6365 _In_opt_ MI_OperationCallbacks *callbacks,
6366 _Out_ MI_Operation *operation);
6367
6368 void (MI_CALL *ReferenceInstances)(
6369 _In_ MI_Session *session,
6370 MI_Uint32 flags,
6371 _In_opt_ MI_OperationOptions *options,
6372 _In_opt_z_ const MI_Char *namespaceName,
6373 _In_ const MI_Instance *instanceKeys,
6374 _In_opt_z_ const MI_Char *resultClass,
6375 _In_opt_z_ const MI_Char *role,
6376 MI_Boolean keysOnly,
6377 _In_opt_ MI_OperationCallbacks *callbacks,
6378 _Out_ MI_Operation *operation);
6379
6380 void (MI_CALL *Subscribe)(
6381 _In_ MI_Session *session,
6382 MI_Uint32 flags,
6383 _In_opt_ MI_OperationOptions *options,
6384 _In_opt_z_ const MI_Char *namespaceName,
6385 mike 1.1 _In_opt_z_ const MI_Char *queryDialect,
6386 _In_opt_z_ const MI_Char *queryExpression,
6387 _In_opt_ const MI_SubscriptionDeliveryOptions *deliverOptions,
6388 _In_opt_ MI_OperationCallbacks *callbacks,
6389 _Out_ MI_Operation *operation);
6390
6391 void (MI_CALL *GetClass)(
6392 _In_ MI_Session *session,
6393 MI_Uint32 flags,
6394 _In_opt_ MI_OperationOptions *options,
6395 _In_opt_z_ const MI_Char *namespaceName,
6396 _In_opt_z_ const MI_Char *className,
6397 _In_opt_ MI_OperationCallbacks *callbacks,
6398 _Out_ MI_Operation *operation);
6399
6400 void (MI_CALL *EnumerateClasses)(
6401 _In_ MI_Session *session,
6402 MI_Uint32 flags,
6403 _In_opt_ MI_OperationOptions *options,
6404 _In_opt_z_ const MI_Char *namespaceName,
6405 _In_opt_z_ const MI_Char *className,
6406 mike 1.1 MI_Boolean classNamesOnly,
6407 _In_opt_ MI_OperationCallbacks *callbacks,
6408 _Out_ MI_Operation *operation);
6409
6410 void (MI_CALL *TestConnection)(
6411 _In_ MI_Session *session,
6412 MI_Uint32 flags,
6413 _In_opt_ MI_OperationCallbacks *callbacks,
6414 _Out_ MI_Operation *operation
6415 );
6416 }
6417 MI_SessionFT;
6418
6419 /*
6420 **=============================================================================
6421 **
6422 ** typedef const _MI_OperationFT MI_OperationFT
6423 **
6424 ** Function table for all actions on a operation object.
6425 **
6426 ** See MI_Operation_<method name> functions for details.
6427 mike 1.1 **
6428 **=============================================================================
6429 */
6430 typedef struct _MI_OperationFT
6431 {
6432 MI_Result (MI_CALL *Close)(
6433 _Inout_ MI_Operation *operation);
6434
6435 MI_Result (MI_CALL *Cancel)(
6436 _Inout_ MI_Operation *operation,
6437 MI_CancellationReason reason);
6438
6439 MI_Result (MI_CALL *GetSession)(
6440 _In_ MI_Operation *operation,
6441 _Out_ MI_Session *session);
6442
6443 MI_Result (MI_CALL *GetInstance)(
6444 _In_ MI_Operation *operation,
6445 _Outptr_result_maybenull_ const MI_Instance **instance,
6446 _Out_opt_ MI_Boolean *moreResults,
6447 _Out_opt_ MI_Result *result,
6448 mike 1.1 _Outptr_opt_result_maybenull_z_ const MI_Char **errorMessage,
6449 _Outptr_opt_result_maybenull_ const MI_Instance **completionDetails);
6450
6451 MI_Result (MI_CALL *GetIndication)(
6452 _In_ MI_Operation *operation,
6453 _Outptr_result_maybenull_ const MI_Instance **instance,
6454 _Outptr_opt_result_maybenull_z_ const MI_Char **bookmark,
6455 _Outptr_opt_result_maybenull_z_ const MI_Char **machineID,
6456 _Out_opt_ MI_Boolean *moreResults,
6457 _Out_opt_ MI_Result *result,
6458 _Outptr_opt_result_maybenull_z_ const MI_Char **errorMessage,
6459 _Outptr_opt_result_maybenull_ const MI_Instance **completionDetails);
6460
6461 MI_Result (MI_CALL *GetClass)(
6462 _In_ MI_Operation *operation,
6463 _Outptr_result_maybenull_ const MI_Class **classResult,
6464 _Out_opt_ MI_Boolean *moreResults,
6465 _Out_opt_ MI_Result *result,
6466 _Outptr_opt_result_maybenull_z_ const MI_Char **errorMessage,
6467 _Outptr_opt_result_maybenull_ const MI_Instance **completionDetails);
6468
6469 mike 1.1 }
6470 MI_OperationFT;
6471
6472 /*
6473 **=============================================================================
6474 **
6475 ** typedef const _MI_DestinationOptionsFT MI_DestinationOptionsFT
6476 **
6477 ** Function table for all actions on a destination options object.
6478 **
6479 ** See MI_DestinationOptions_<method name> functions for details.
6480 **
6481 **=============================================================================
6482 */
6483 typedef struct _MI_DestinationOptionsFT
6484 {
6485 void (MI_CALL *Delete)(
6486 _Inout_ MI_DestinationOptions *options);
6487
6488 MI_Result (MI_CALL *SetString)(
6489 _Inout_ MI_DestinationOptions *options,
6490 mike 1.1 _In_z_ const MI_Char *optionName,
6491 _In_z_ const MI_Char *value,
6492 MI_Uint32 flags);
6493
6494 MI_Result (MI_CALL *SetNumber)(
6495 _Inout_ MI_DestinationOptions *options,
6496 _In_z_ const MI_Char *optionName,
6497 _In_ MI_Uint32 value,
6498 MI_Uint32 flags);
6499
6500 MI_Result (MI_CALL *AddCredentials)(
6501 _Inout_ MI_DestinationOptions *options,
6502 _In_z_ const MI_Char *optionName,
6503 _In_ const MI_UserCredentials *credentials,
6504 MI_Uint32 flags);
6505
6506 MI_Result (MI_CALL *GetString)(
6507 _In_ MI_DestinationOptions *options,
6508 _In_z_ const MI_Char *optionName,
6509 _Outptr_result_z_ const MI_Char **value,
6510 _Out_opt_ MI_Uint32 *index,
6511 mike 1.1 _Out_opt_ MI_Uint32 *flags);
6512
6513 MI_Result (MI_CALL *GetNumber)(
6514 _In_ MI_DestinationOptions *options,
6515 _In_z_ const MI_Char *optionName,
6516 _Out_ MI_Uint32 *value,
6517 _Out_opt_ MI_Uint32 *index,
6518 _Out_opt_ MI_Uint32 *flags);
6519
6520 MI_Result (MI_CALL *GetOptionCount)(
6521 _In_ MI_DestinationOptions *options,
6522 _Out_ MI_Uint32 *count);
6523
6524 MI_Result (MI_CALL *GetOptionAt)(
6525 _In_ MI_DestinationOptions *options,
6526 MI_Uint32 index,
6527 _Outptr_result_z_ const MI_Char **optionName,
6528 _Out_ MI_Value *value,
6529 _Out_ MI_Type *type,
6530 _Out_opt_ MI_Uint32 *flags);
6531
6532 mike 1.1 MI_Result (MI_CALL *GetOption)(
6533 _In_ MI_DestinationOptions *options,
6534 _In_z_ const MI_Char *optionName,
6535 _Out_ MI_Value *value,
6536 _Out_ MI_Type *type,
6537 _Out_opt_ MI_Uint32 *index,
6538 _Out_opt_ MI_Uint32 *flags);
6539
6540 MI_Result (MI_CALL *GetCredentialsCount)(
6541 _In_ MI_DestinationOptions *options,
6542 _Out_ MI_Uint32 *count);
6543
6544 MI_Result (MI_CALL *GetCredentialsAt)(
6545 _In_ MI_DestinationOptions *options,
6546 MI_Uint32 index,
6547 _Outptr_result_z_ const MI_Char **optionName,
6548 _Out_ MI_UserCredentials *credentials, // output credentials always has password set to '******'
6549 _Out_opt_ MI_Uint32 *flags);
6550
6551 MI_Result (MI_CALL *GetCredentialsPasswordAt)(
6552 _In_ MI_DestinationOptions *options,
6553 mike 1.1 MI_Uint32 index,
6554 _Outptr_result_z_ const MI_Char **optionName,
6555 _Out_writes_to_opt_(bufferLength, *passwordLength) MI_Char *password,
6556 _In_ MI_Uint32 bufferLength,
6557 _Out_ MI_Uint32 *passwordLength,
6558 _Out_opt_ MI_Uint32 *flags);
6559
6560 MI_Result (MI_CALL *Clone)(
6561 _In_ const MI_DestinationOptions* self,
6562 _Out_ MI_DestinationOptions* newDestinationOptions);
6563
6564 MI_Result (MI_CALL *SetInterval)(
6565 _Inout_ MI_DestinationOptions *options,
6566 _In_z_ const MI_Char *optionName,
6567 _In_ const MI_Interval *value,
6568 MI_Uint32 flags);
6569
6570 MI_Result (MI_CALL *GetInterval)(
6571 _In_ MI_DestinationOptions *options,
6572 _In_z_ const MI_Char *optionName,
6573 _Out_ MI_Interval *value,
6574 mike 1.1 _Out_opt_ MI_Uint32 *index,
6575 _Out_opt_ MI_Uint32 *flags);
6576 }
6577 MI_DestinationOptionsFT;
6578
6579 /*
6580 **=============================================================================
6581 **
6582 ** typedef const _MI_OperationOptionsFT MI_OperationOptionsFT
6583 **
6584 ** Function table for all actions on a destination options object.
6585 **
6586 ** See MI_DestinationOptions_<method name> functions for details.
6587 **
6588 **=============================================================================
6589 */
6590 typedef struct _MI_OperationOptionsFT
6591 {
6592 void (MI_CALL *Delete)(
6593 _Inout_ MI_OperationOptions *options);
6594
6595 mike 1.1 MI_Result (MI_CALL *SetString)(
6596 _Inout_ MI_OperationOptions *options,
6597 _In_z_ const MI_Char *optionName,
6598 _In_z_ const MI_Char *value,
6599 MI_Uint32 flags);
6600
6601 MI_Result (MI_CALL *SetNumber)(
6602 _Inout_ MI_OperationOptions *options,
6603 _In_z_ const MI_Char *optionName,
6604 _In_ MI_Uint32 value,
6605 MI_Uint32 flags);
6606
6607 MI_Result (MI_CALL *SetCustomOption)(
6608 _Inout_ MI_OperationOptions *options,
6609 _In_z_ const MI_Char *optionName,
6610 _In_ MI_Type valueType,
6611 _In_ const MI_Value *value,
6612 MI_Boolean mustComply,
6613 MI_Uint32 flags);
6614
6615 MI_Result (MI_CALL *GetString)(
6616 mike 1.1 _In_ MI_OperationOptions *options,
6617 _In_z_ const MI_Char *optionName,
6618 _Outptr_result_z_ const MI_Char **value,
6619 _Out_opt_ MI_Uint32 *index,
6620 _Out_opt_ MI_Uint32 *flags);
6621
6622 MI_Result (MI_CALL *GetNumber)(
6623 _In_ MI_OperationOptions *options,
6624 _In_z_ const MI_Char *optionName,
6625 _Out_ MI_Uint32 *value,
6626 _Out_opt_ MI_Uint32 *index,
6627 _Out_opt_ MI_Uint32 *flags);
6628
6629 MI_Result (MI_CALL *GetOptionCount)(
6630 _In_ MI_OperationOptions *options,
6631 _Out_ MI_Uint32 *count);
6632
6633 MI_Result (MI_CALL *GetOptionAt)(
6634 _In_ MI_OperationOptions *options,
6635 MI_Uint32 index,
6636 _Outptr_result_z_ const MI_Char **optionName,
6637 mike 1.1 _Out_ MI_Value *value,
6638 _Out_ MI_Type *type,
6639 _Out_opt_ MI_Uint32 *flags);
6640
6641 MI_Result (MI_CALL *GetOption)(
6642 _In_ MI_OperationOptions *options,
6643 _In_z_ const MI_Char *optionName,
6644 _Out_ MI_Value *value,
6645 _Out_ MI_Type *type,
6646 _Out_opt_ MI_Uint32 *index,
6647 _Out_opt_ MI_Uint32 *flags);
6648
6649 MI_Result (MI_CALL *GetEnabledChannels)(
6650 _In_ MI_OperationOptions *options,
6651 _In_z_ const MI_Char *optionName,
6652 _Out_writes_to_opt_(bufferLength, *channelCount) MI_Uint32 *channels,
6653 _In_ MI_Uint32 bufferLength,
6654 _Out_ MI_Uint32 *channelCount,
6655 _Out_opt_ MI_Uint32 *flags);
6656
6657 MI_Result (MI_CALL *Clone)(
6658 mike 1.1 _In_ const MI_OperationOptions* self,
6659 _Out_ MI_OperationOptions* newOperationOptions);
6660
6661
6662 MI_Result (MI_CALL *SetInterval)(
6663 _Inout_ MI_OperationOptions *options,
6664 _In_z_ const MI_Char *optionName,
6665 _In_ const MI_Interval *value,
6666 MI_Uint32 flags);
6667
6668 MI_Result (MI_CALL *GetInterval)(
6669 _In_ MI_OperationOptions *options,
6670 _In_z_ const MI_Char *optionName,
6671 _Out_ MI_Interval *value,
6672 _Out_opt_ MI_Uint32 *index,
6673 _Out_opt_ MI_Uint32 *flags);
6674 }
6675 MI_OperationOptionsFT;
6676
6677 /*
6678 **=============================================================================
6679 mike 1.1 **
6680 ** struct _MI_Application
6681 **
6682 ** Note: Use MI_Application typedef instead of this structure.
6683 **
6684 **=============================================================================
6685 */
6686 struct _MI_Application
6687 {
6688 MI_Uint64 reserved1;
6689 ptrdiff_t reserved2;
6690 const MI_ApplicationFT * ft;
6691 } ;
6692
6693 #define MI_APPLICATION_NULL { 0, 0, NULL }
6694
6695 /*
6696 **=============================================================================
6697 **
6698 ** struct _MI_Session
6699 **
6700 mike 1.1 ** Note: Use MI_Session typedef instead of this structure.
6701 **
6702 **=============================================================================
6703 */
6704 struct _MI_Session
6705 {
6706 MI_Uint64 reserved1;
6707 ptrdiff_t reserved2;
6708 const MI_SessionFT * ft;
6709 } ;
6710
6711 #define MI_SESSION_NULL { 0, 0, NULL }
6712
6713 /*
6714 **=============================================================================
6715 **
6716 ** struct _MI_Operation
6717 **
6718 ** Note: Use MI_Operation typedef instead of this structure.
6719 **=============================================================================
6720 */
6721 mike 1.1 struct _MI_Operation
6722 {
6723 MI_Uint64 reserved1;
6724 ptrdiff_t reserved2;
6725 const MI_OperationFT * ft;
6726 };
6727
6728 #define MI_OPERATION_NULL { 0, 0, NULL }
6729
6730 /*
6731 **=============================================================================
6732 **
6733 ** struct _MI_HostedProvider
6734 **
6735 ** Note: Use MI_HostedProvider typedef instead of this structure.
6736 **=============================================================================
6737 */
6738 struct _MI_HostedProvider
6739 {
6740 MI_Uint64 reserved1;
6741 ptrdiff_t reserved2;
6742 mike 1.1 const MI_HostedProviderFT * ft;
6743 } ;
6744
6745 #define MI_HOSTEDPROVIDER_NULL { 0, 0, NULL }
6746
6747 /*
6748 **=============================================================================
6749 **
6750 ** struct _MI_DestinationOptions
6751 **
6752 ** Note: Use MI_DestinationOptions typedef instead of this structure.
6753 **=============================================================================
6754 */
6755 struct _MI_DestinationOptions
6756 {
6757 MI_Uint64 reserved1;
6758 ptrdiff_t reserved2;
6759 const MI_DestinationOptionsFT * ft;
6760 } ;
6761
6762 #define MI_DESTINATIONOPTIONS_NULL { 0, 0, NULL }
6763 mike 1.1
6764 /*
6765 **=============================================================================
6766 **
6767 ** struct _MI_OperationOptions
6768 **
6769 ** Note: Use MI_OperationOptions typedef instead of this structure.
6770 **=============================================================================
6771 */
6772 struct _MI_OperationOptions
6773 {
6774 MI_Uint64 reserved1;
6775 ptrdiff_t reserved2;
6776 const MI_OperationOptionsFT * ft;
6777 } ;
6778
6779 #define MI_OPERATIONOPTIONS_NULL { 0, 0, NULL }
6780
6781 typedef struct _MI_UtilitiesFT
6782 {
6783 MI_ErrorCategory (MI_CALL *MapErrorToMiErrorCategory)(
6784 mike 1.1 _In_z_ MI_Char *errorType,
6785 MI_Uint32 error);
6786
6787 MI_Result (MI_CALL *CimErrorFromErrorCode)(
6788 MI_Uint32 error,
6789 _In_z_ const MI_Char *errorType,
6790 _In_z_ const MI_Char* errorMessage,
6791 _Outptr_ MI_Instance **cimError);
6792
6793
6794 } MI_UtilitiesFT;
6795
6796 typedef struct _MI_ClientFT_V1
6797 {
6798 const MI_ApplicationFT *applicationFT;
6799 const MI_SessionFT *sessionFT;
6800 const MI_OperationFT *operationFT;
6801 const MI_HostedProviderFT *hostedProviderFT;
6802 const MI_SerializerFT *serializerFT;
6803 const MI_DeserializerFT *deserializerFT;
6804 const MI_SubscriptionDeliveryOptionsFT *subscribeDeliveryOptionsFT;
6805 mike 1.1 const MI_DestinationOptionsFT *destinationOptionsFT;
6806 const MI_OperationOptionsFT *operationOptionsFT;
6807 const MI_UtilitiesFT *utilitiesFT;
6808 } MI_ClientFT_V1;
6809
6810 extern const MI_ClientFT_V1 *mi_clientFT_V1;
6811
6812 #if (MI_CALL_VERSION == 1)
6813 #define mi_clientFT mi_clientFT_V1
6814 #endif
6815 /*
6816 **=============================================================================
6817 **
6818 ** MI_Application_InitializeV1()
6819 **
6820 ** NOTE: Do not call this method directly, instead call through
6821 ** MI_Application_Initialize. Not doing so can cause API versioning
6822 ** problems.
6823 **
6824 ** Initialize the management infrastructure to allow calling into client-side
6825 ** management APIs. Call MI_Application_Close() to shut down the
6826 mike 1.1 ** management infrastructure, not doing so can cause crashes and memory leaks.
6827 **
6828 ** This API is versioned based on the definition of MI_CALL_VERSION. If this
6829 ** is not specified version 1 is assumed.
6830 **
6831 ** flags: Must be 0
6832 ** applicationID: optional application identifier. This can be a GUID or
6833 ** in the form company/product/version. It can be used for
6834 ** application specific configuration.
6835 ** application: Returned application handle that must be closed through
6836 ** MI_Application_Close().
6837 **
6838 ** Return: MI_RESULT_OK success, other errors indicate specific failure
6839 **=============================================================================
6840 */
6841 MI_Result MI_MAIN_CALL MI_Application_InitializeV1(
6842 MI_Uint32 flags,
6843 _In_opt_z_ const MI_Char *applicationID,
6844 _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
6845 _Out_ MI_Application *application);
6846
6847 mike 1.1 #if MI_CALL_VERSION == 1
6848 #define MI_Application_Initialize MI_Application_InitializeV1
6849 #endif
6850 /*
6851 **=============================================================================
6852 **
6853 ** MI_Application_Close()
6854 **
6855 ** Deinitializes the management infrastructure. This API is synchronous.
6856 ** It must not be called from within an asynchronous callback otherwise it will
6857 ** cause deadlocks. This API will cancel all active sessions and operations.
6858 ** All operations and sessions must be closed before this API will complete.
6859 **
6860 ** application: Handle returned from MI_Application_Initialize.
6861 **=============================================================================
6862 */
6863 MI_INLINE MI_Result MI_Application_Close(
6864 _Inout_ MI_Application *application)
6865 {
6866 if (application && application->ft)
6867 {
6868 mike 1.1 return application->ft->Close(application);
6869 }
6870 else
6871 {
6872 return MI_RESULT_INVALID_PARAMETER;
6873 }
6874 }
6875
6876 /*
6877 **=============================================================================
6878 **
6879 ** MI_Application_NewInstance()
6880 **
6881 ** Creates an instance. It may be strongly typed if an MI_ClassDecl is
6882 ** specified, although it can be created dynamically through instance API calls.
6883 ** The instance must be closed through MI_Instance_Delete.
6884 **
6885 ** application: Handle returned from MI_Application_Initialize.
6886 ** className: class name of instance.
6887 ** classRTTI: Run-time type information that represents a class definition
6888 ** instance: Resultant instance
6889 mike 1.1 **
6890 ** Return: MI_RESULT_OK success, other errors indicate specific failure
6891 **=============================================================================
6892 */
6893 MI_INLINE MI_Result MI_Application_NewInstance(
6894 _In_ MI_Application *application,
6895 _In_z_ const MI_Char *className,
6896 _In_opt_ const MI_ClassDecl *classRTTI,
6897 _Outptr_ MI_Instance **instance)
6898 {
6899 if (application && application->ft)
6900 {
6901 return application->ft->NewInstance(application, className, classRTTI, instance);
6902 }
6903 else
6904 {
6905 if (instance)
6906 {
6907 *instance = NULL;
6908 }
6909 return MI_RESULT_INVALID_PARAMETER;
6910 mike 1.1 }
6911 }
6912 MI_INLINE MI_Result MI_Application_NewInstanceFromClass(
6913 _In_ MI_Application *application,
6914 _In_z_ const MI_Char *className,
6915 _In_opt_ const MI_Class *classObject,
6916 _Outptr_ MI_Instance **instance)
6917 {
6918 if (application && application->ft)
6919 {
6920 return application->ft->NewInstanceFromClass(application, className, classObject, instance);
6921 }
6922 else
6923 {
6924 if (instance)
6925 {
6926 *instance = NULL;
6927 }
6928 return MI_RESULT_INVALID_PARAMETER;
6929 }
6930 }
6931 mike 1.1
6932 MI_INLINE MI_Result MI_Application_NewParameterSet(
6933 _In_ MI_Application *application,
6934 _In_opt_ const MI_ClassDecl *classRTTI,
6935 _Outptr_ MI_Instance **instance)
6936 {
6937 if (application && application->ft)
6938 {
6939 return application->ft->NewInstance(application, MI_T("Parameters"), classRTTI, instance);
6940 }
6941 else
6942 {
6943 if (instance)
6944 {
6945 *instance = NULL;
6946 }
6947 return MI_RESULT_INVALID_PARAMETER;
6948 }
6949 }
6950
6951 /*
6952 mike 1.1 **=============================================================================
6953 **
6954 ** MI_Application_NewDestinationOptions()
6955 **
6956 ** Creates an MI_DestinationOptions object. It represents configuration needed
6957 ** to talk to the destination endpoint.
6958 ** The destination options must be closed through MI_DestinationOptions_Delete.
6959 **
6960 ** application: Handle returned from MI_Application_Initialize.
6961 ** options: Resultant options handle for which options can be set
6962 **
6963 ** Return: MI_RESULT_OK success, other errors indicate specific failure
6964 **=============================================================================
6965 */
6966 MI_INLINE MI_Result MI_Application_NewDestinationOptions(
6967 _In_ MI_Application *application,
6968 _Out_ MI_DestinationOptions *options)
6969 {
6970 if (application && application->ft)
6971 {
6972 return application->ft->NewDestinationOptions(application, options);
6973 mike 1.1 }
6974 else
6975 {
6976 if (options)
6977 {
6978 memset(options, 0, sizeof(MI_DestinationOptions));
6979 }
6980 return MI_RESULT_INVALID_PARAMETER;
6981 }
6982 }
6983
6984 /*
6985 **=============================================================================
6986 **
6987 ** MI_Application_NewOperationOptions()
6988 **
6989 ** Creates an MI_OperationOptions object. It represents configuration needed
6990 ** to carry out an operation.
6991 ** The operaton options must be closed through MI_OperationOptions_Delete.
6992 **
6993 ** application: Handle returned from MI_Application_Initialize.
6994 mike 1.1 ** options: Resultant options handle for which options can be set
6995 **
6996 ** Return: MI_RESULT_OK success, other errors indicate specific failure
6997 **=============================================================================
6998 */
6999 MI_INLINE MI_Result MI_Application_NewOperationOptions(
7000 _In_ MI_Application *application,
7001 MI_Boolean mustUnderstand,
7002 _Out_ MI_OperationOptions *options)
7003 {
7004 if (application && application->ft)
7005 {
7006 return application->ft->NewOperationOptions(application, mustUnderstand, options);
7007 }
7008 else
7009 {
7010 if (options)
7011 {
7012 memset(options, 0, sizeof(MI_OperationOptions));
7013 }
7014 return MI_RESULT_INVALID_PARAMETER;
7015 mike 1.1 }
7016 }
7017
7018 MI_INLINE MI_Result MI_Application_NewSubscriptionDeliveryOptions(
7019 _In_ MI_Application *application,
7020 _In_ MI_SubscriptionDeliveryType deliveryType,
7021 _Out_ MI_SubscriptionDeliveryOptions *deliveryOptions)
7022 {
7023 if (application && application->ft)
7024 {
7025 return application->ft->NewSubscriptionDeliveryOptions(application, deliveryType, deliveryOptions);
7026 }
7027 else
7028 {
7029 if (deliveryOptions)
7030 {
7031 memset(deliveryOptions, 0, sizeof(MI_SubscriptionDeliveryOptions));
7032 }
7033 return MI_RESULT_INVALID_PARAMETER;
7034 }
7035 }
7036 mike 1.1 /*
7037 **=============================================================================
7038 **
7039 ** MI_Application_NewSession()
7040 **
7041 ** Creates a session that allows a group of operations that go to the same
7042 ** destination to be grouped so they can share connections. MI_CloseSession()
7043 ** needs to be called on the outbound session handle otherwise operations may
7044 ** crash or leak memory. Close all operations before closing the session.
7045 **
7046 **=============================================================================
7047 */
7048 MI_INLINE MI_Result MI_Application_NewSession(
7049 _In_ MI_Application *application,
7050 _In_opt_z_ const MI_Char *protocol,
7051 _In_opt_z_ const MI_Char *destination,
7052 _In_opt_ MI_DestinationOptions *options,
7053 _In_opt_ MI_SessionCallbacks *callbacks,
7054 _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
7055 _Out_ MI_Session *session)
7056 {
7057 mike 1.1 if (application && application->ft)
7058 {
7059 return application->ft->NewSession(application, protocol, destination, options, callbacks, extendedError, session);
7060 }
7061 else
7062 {
7063 if (session)
7064 {
7065 memset(session, 0, sizeof(MI_Session));
7066 }
7067 return MI_RESULT_INVALID_PARAMETER;
7068 }
7069 }
7070
7071 /*
7072 **=============================================================================
7073 **
7074 ** MI_Application_NewHostedProvider()
7075 **
7076 **=============================================================================
7077 */
7078 mike 1.1 MI_INLINE MI_Result MI_Application_NewHostedProvider(
7079 _In_ MI_Application *application,
7080 _In_z_ const MI_Char *namespaceName,
7081 _In_z_ const MI_Char *providerName,
7082 _In_ MI_MainFunction mi_Main,
7083 _Outptr_opt_result_maybenull_ MI_Instance **extendedError,
7084 _Out_ MI_HostedProvider *hostedProvider)
7085 {
7086 if (application && application->ft)
7087 {
7088 return application->ft->NewHostedProvider(application, namespaceName, providerName, mi_Main, extendedError, hostedProvider);
7089 }
7090 else
7091 {
7092 if (hostedProvider)
7093 {
7094 memset(hostedProvider, 0, sizeof(MI_HostedProvider));
7095 }
7096 return MI_RESULT_INVALID_PARAMETER;
7097 }
7098 }
7099 mike 1.1
7100 MI_INLINE MI_Result MI_Application_NewSerializer(
7101 _Inout_ MI_Application *application,
7102 MI_Uint32 flags,
7103 _In_z_ MI_Char *format,
7104 _Out_ MI_Serializer *serializer)
7105 {
7106 if (application && application->ft)
7107 {
7108 return application->ft->NewSerializer(application, flags, format, serializer);
7109 }
7110 else
7111 {
7112 if (serializer)
7113 {
7114 memset(serializer, 0, sizeof(MI_Serializer));
7115 }
7116 return MI_RESULT_INVALID_PARAMETER;
7117 }
7118 }
7119
7120 mike 1.1 MI_INLINE MI_Result MI_Application_NewDeserializer(
7121 _Inout_ MI_Application *application,
7122 MI_Uint32 flags,
7123 _In_z_ MI_Char *format,
7124 _Out_ MI_Deserializer *deserializer)
7125 {
7126 if (application && application->ft)
7127 {
7128 return application->ft->NewDeserializer(application, flags, format, deserializer);
7129 }
7130 else
7131 {
7132 if (deserializer)
7133 {
7134 memset(deserializer, 0, sizeof(MI_Deserializer));
7135 }
7136 return MI_RESULT_INVALID_PARAMETER;
7137 }
7138 }
7139
7140
7141 mike 1.1
7142 /*
7143 **=============================================================================
7144 **
7145 ** MI_HostedProvider_Close()
7146 **
7147 **=============================================================================
7148 */
7149 MI_INLINE MI_Result MI_HostedProvider_Close(
7150 _Inout_ MI_HostedProvider *hostedProvider)
7151 {
7152 if (hostedProvider && hostedProvider->ft)
7153 {
7154 return hostedProvider->ft->Close(hostedProvider);
7155 }
7156 else
7157 {
7158 return MI_RESULT_INVALID_PARAMETER;
7159 }
7160 }
7161
7162 mike 1.1 /*
7163 **=============================================================================
7164 **
7165 ** MI_HostedProvider_GetApplication()
7166 **
7167 **=============================================================================
7168 */
7169 MI_INLINE MI_Result MI_HostedProvider_GetApplication(
7170 _In_ MI_HostedProvider *hostedProvider,
7171 _Out_ MI_Application *application)
7172 {
7173 if (hostedProvider && hostedProvider->ft)
7174 {
7175 return hostedProvider->ft->GetApplication(hostedProvider, application);
7176 }
7177 else if (application)
7178 {
7179 memset(application, 0, sizeof(MI_Application));
7180 }
7181 return MI_RESULT_INVALID_PARAMETER;
7182 }
7183 mike 1.1
7184 /*
7185 **=============================================================================
7186 **
7187 ** MI_Session_Close()
7188 **
7189 ** Closes the session and frees up all memory associated with it. If there
7190 ** are unfinished operations, those operatons will be cancelled. All
7191 ** operations must have their handles closed before the session finishes closing.
7192 **
7193 ** This can be called from inside an asynchronous callback only if the callback
7194 ** is used. Waiting for the completion of this callback from inside the callback
7195 ** will cause a deadlock, which is the same reason that calling this API synchronously
7196 ** will cause a deadlock on an asynchronous callback.
7197 **
7198 **=============================================================================
7199 */
7200 MI_INLINE MI_Result MI_Session_Close(
7201 _Inout_ MI_Session *session,
7202 _In_opt_ void *completionContext,
7203 _In_opt_ void (MI_CALL *completionCallback)(_In_opt_ void *completionContext))
7204 mike 1.1 {
7205 if (session && session->ft)
7206 {
7207 return session->ft->Close(session, completionContext, completionCallback);
7208 }
7209 else if (completionCallback)
7210 {
7211 completionCallback(completionContext);
7212 return MI_RESULT_OK;
7213 }
7214 else
7215 {
7216 return MI_RESULT_INVALID_PARAMETER;
7217 }
7218 }
7219
7220 /*
7221 **=============================================================================
7222 **
7223 ** MI_Session_GetApplication()
7224 **
7225 mike 1.1 **=============================================================================
7226 */
7227 MI_INLINE MI_Result MI_Session_GetApplication(
7228 _In_ MI_Session *session,
7229 _Out_ MI_Application *application)
7230 {
7231 if (session && session->ft)
7232 {
7233 return session->ft->GetApplication(session, application);
7234 }
7235 if (application)
7236 {
7237 memset(application, 0, sizeof(MI_Application));
7238 }
7239 return MI_RESULT_INVALID_PARAMETER;
7240 }
7241
7242 /*
7243 **=============================================================================
7244 **
7245 ** MI_Session_GetInstance()
7246 mike 1.1 **
7247 ** Initiates a Get operation. If a result callback is specified, the callback
7248 ** will be called when the operation completes. For synchronous, the client
7249 ** must call MI_Operation_GetInstance to receive the object and/or operation
7250 ** return code. Even if the operation is cancelled the client must still
7251 ** call MI_Operation_GetInstance as cancellation is scynchronous.
7252 **
7253 **=============================================================================
7254 */
7255 MI_INLINE void MI_Session_GetInstance(
7256 _In_ MI_Session *session,
7257 MI_Uint32 flags,
7258 _In_opt_ MI_OperationOptions *options,
7259 _In_opt_z_ const MI_Char *namespaceName,
7260 _In_ const MI_Instance *inboundInstance,
7261 _In_opt_ MI_OperationCallbacks *callbacks,
7262 _Out_ MI_Operation *operation)
7263 {
7264 if (session && session->ft)
7265 {
7266 session->ft->GetInstance(session, flags, options, namespaceName, inboundInstance, callbacks, operation);
7267 mike 1.1 }
7268 else
7269 {
7270 if (operation)
7271 {
7272 memset(operation, 0, sizeof(*operation));
7273 }
7274 if (callbacks && callbacks->instanceResult)
7275 {
7276 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7277 }
7278 }
7279 }
7280
7281 /*
7282 **=============================================================================
7283 **
7284 ** MI_Session_ModifyInstance()
7285 **
7286 ** Initiates a Modify operation. If a result callback is specified, the callback
7287 ** will be called when the operation completes. For synchronous, the client
7288 mike 1.1 ** must call MI_Operation_GetInstance to receive the object and/or operation
7289 ** return code. Even if the operation is cancelled the client must still
7290 ** call MI_Operation_GetInstance as cancellation is scynchronous.
7291 **
7292 **=============================================================================
7293 */
7294 MI_INLINE void MI_Session_ModifyInstance(
7295 _In_ MI_Session *session,
7296 MI_Uint32 flags,
7297 _In_opt_ MI_OperationOptions *options,
7298 _In_opt_z_ const MI_Char *namespaceName,
7299 _In_ const MI_Instance *inboundInstance,
7300 _In_opt_ MI_OperationCallbacks *callbacks,
7301 _Out_ MI_Operation *operation)
7302 {
7303 if (session && session->ft)
7304 {
7305 session->ft->ModifyInstance(session, flags, options, namespaceName, inboundInstance, callbacks, operation);
7306 }
7307 else
7308 {
7309 mike 1.1 if (operation)
7310 {
7311 memset(operation, 0, sizeof(*operation));
7312 }
7313 if (callbacks && callbacks->instanceResult)
7314 {
7315 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7316 }
7317 }
7318 }
7319
7320 /*
7321 **=============================================================================
7322 **
7323 ** MI_Session_CreateInstance()
7324 **
7325 ** Initiates a Create operation. If a result callback is specified, the callback
7326 ** will be called when the operation completes. For synchronous, the client
7327 ** must call MI_Operation_GetInstance to receive the object and/or operation
7328 ** return code. Even if the operation is cancelled the client must still
7329 ** call MI_Operation_GetInstance as cancellation is scynchronous.
7330 mike 1.1 **
7331 **=============================================================================
7332 */
7333 MI_INLINE void MI_Session_CreateInstance(
7334 _In_ MI_Session *session,
7335 MI_Uint32 flags,
7336 _In_opt_ MI_OperationOptions *options,
7337 _In_opt_z_ const MI_Char *namespaceName,
7338 _In_ const MI_Instance *inboundInstance,
7339 _In_opt_ MI_OperationCallbacks *callbacks,
7340 _Out_ MI_Operation *operation)
7341 {
7342 if (session && session->ft)
7343 {
7344 session->ft->CreateInstance(session, flags, options, namespaceName, inboundInstance, callbacks, operation);
7345 }
7346 else
7347 {
7348 if (operation)
7349 {
7350 memset(operation, 0, sizeof(*operation));
7351 mike 1.1 }
7352 if (callbacks && callbacks->instanceResult)
7353 {
7354 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7355 }
7356 }
7357 }
7358 /*
7359 **=============================================================================
7360 **
7361 ** MI_Session_DeleteInstance()
7362 **
7363 ** Initiates a Delete operation. If a result callback is specified, the callback
7364 ** will be called when the operation completes. For synchronous, the client
7365 ** must call MI_Operation_GetInstance to receive the operation return code.
7366 ** Even if the operation is cancelled the client must still call
7367 ** MI_Operation_GetInstance as cancellation is scynchronous.
7368 **
7369 **=============================================================================
7370 */
7371 MI_INLINE void MI_Session_DeleteInstance(
7372 mike 1.1 _In_ MI_Session *session,
7373 MI_Uint32 flags,
7374 _In_opt_ MI_OperationOptions *options,
7375 _In_opt_z_ const MI_Char *namespaceName,
7376 _In_ const MI_Instance *inboundInstance,
7377 _In_opt_ MI_OperationCallbacks *callbacks,
7378 _Out_ MI_Operation *operation)
7379 {
7380 if (session && session->ft)
7381 {
7382 session->ft->DeleteInstance(session, flags, options, namespaceName, inboundInstance, callbacks, operation);
7383 }
7384 else
7385 {
7386 if (operation)
7387 {
7388 memset(operation, 0, sizeof(*operation));
7389 }
7390 if (callbacks && callbacks->instanceResult)
7391 {
7392 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7393 mike 1.1 }
7394 }
7395 }
7396
7397 /*
7398 **=============================================================================
7399 **
7400 ** MI_Session_Invoke()
7401 **
7402 ** Initiates a Delete operation. If a result callback is specified, the callback
7403 ** will be called when the operation completes. For synchronous, the client
7404 ** must call MI_Operation_GetInstance to receive the object and/or operation
7405 ** return code. Even if the operation is cancelled the client must still
7406 ** call MI_Operation_GetInstance as cancellation is scynchronous.
7407 **
7408 **=============================================================================
7409 */
7410 MI_INLINE void MI_Session_Invoke(
7411 _In_ MI_Session *session,
7412 MI_Uint32 flags,
7413 _In_opt_ MI_OperationOptions *options,
7414 mike 1.1 _In_opt_z_ const MI_Char *namespaceName,
7415 _In_opt_z_ const MI_Char *className,
7416 _In_z_ const MI_Char *methodName,
7417 _In_opt_ const MI_Instance *inboundInstance,
7418 _In_opt_ const MI_Instance *inboundProperties,
7419 _In_opt_ MI_OperationCallbacks *callbacks,
7420 _Out_ MI_Operation *operation)
7421 {
7422 if (session && session->ft)
7423 {
7424 session->ft->Invoke(session, flags, options, namespaceName, className, methodName, inboundInstance, inboundProperties, callbacks, operation);
7425 }
7426 else
7427 {
7428 if (operation)
7429 {
7430 memset(operation, 0, sizeof(*operation));
7431 }
7432 if (callbacks && callbacks->instanceResult)
7433 {
7434 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7435 mike 1.1 }
7436 }
7437 }
7438
7439 /*
7440 **=============================================================================
7441 **
7442 ** MI_Session_EnumerateInstances()
7443 **
7444 ** Initiates a Enumerate operation. If a result callback is specified, the callback
7445 ** will be called for each result in the result set and when complete gives the
7446 ** return code of the operation. For synchronous, the client
7447 ** must call MI_Operation_GetInstance to receive the objects, once for each object
7448 ** until the operation return code is also included. Even if the operation is
7449 ** cancelled the client must still call MI_Operation_GetInstance until the return
7450 ** code is given.
7451 **
7452 **=============================================================================
7453 */
7454 MI_INLINE void MI_Session_EnumerateInstances(
7455 _In_ MI_Session *session,
7456 mike 1.1 MI_Uint32 flags,
7457 _In_opt_ MI_OperationOptions *options,
7458 _In_opt_z_ const MI_Char *namespaceName,
7459 _In_opt_z_ const MI_Char *className,
7460 MI_Boolean keysOnly,
7461 _In_opt_ MI_OperationCallbacks *callbacks,
7462 _Out_ MI_Operation *operation)
7463 {
7464 if (session && session->ft)
7465 {
7466 session->ft->EnumerateInstances(session, flags, options, namespaceName, className, keysOnly, callbacks, operation);
7467 }
7468 else
7469 {
7470 if (operation)
7471 {
7472 memset(operation, 0, sizeof(*operation));
7473 }
7474 if (callbacks && callbacks->instanceResult)
7475 {
7476 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7477 mike 1.1 }
7478 }
7479 }
7480
7481 MI_INLINE void MI_Session_QueryInstances(
7482 _In_ MI_Session *session,
7483 MI_Uint32 flags,
7484 _In_opt_ MI_OperationOptions *options,
7485 _In_opt_z_ const MI_Char *namespaceName,
7486 _In_opt_z_ const MI_Char *queryDialect,
7487 _In_opt_z_ const MI_Char *queryExpression,
7488 _In_opt_ MI_OperationCallbacks *callbacks,
7489 _Out_ MI_Operation *operation)
7490 {
7491 if (session && session->ft)
7492 {
7493 session->ft->QueryInstances(session, flags, options, namespaceName, queryDialect, queryExpression, callbacks, operation);
7494 }
7495 else
7496 {
7497 if (operation)
7498 mike 1.1 {
7499 memset(operation, 0, sizeof(*operation));
7500 }
7501 if (callbacks && callbacks->instanceResult)
7502 {
7503 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7504 }
7505 }
7506 }
7507
7508 /*
7509 **=============================================================================
7510 **
7511 ** MI_Session_Associators()
7512 **
7513 ** Initiates a Associators operation. If a result callback is specified, the
7514 ** callback will be called for each result in the result set and when complete
7515 ** gives the return code of the operation. For synchronous, the client
7516 ** must call MI_Operation_GetInstance to receive the objects, once for each object
7517 ** until the operation return code is also included. Even if the operation is
7518 ** cancelled the client must still call MI_Operation_GetInstance until the return
7519 mike 1.1 ** code is given.
7520 **
7521 **=============================================================================
7522 */
7523 MI_INLINE void MI_Session_AssociatorInstances(
7524 _In_ MI_Session *session,
7525 MI_Uint32 flags,
7526 _In_opt_ MI_OperationOptions *options,
7527 _In_opt_z_ const MI_Char *namespaceName,
7528 _In_ const MI_Instance *instanceKey,
7529 _In_opt_z_ const MI_Char *assocClass,
7530 _In_opt_z_ const MI_Char *resultClass,
7531 _In_opt_z_ const MI_Char *role,
7532 _In_opt_z_ const MI_Char *resultRole,
7533 MI_Boolean keysOnly,
7534 _In_opt_ MI_OperationCallbacks *callbacks,
7535 _Out_ MI_Operation *operation)
7536 {
7537 if (session && session->ft)
7538 {
7539 session->ft->AssociatorInstances(session, flags, options, namespaceName, instanceKey, assocClass, resultClass, role, resultRole, keysOnly, callbacks, operation);
7540 mike 1.1 }
7541 else
7542 {
7543 if (operation)
7544 {
7545 memset(operation, 0, sizeof(*operation));
7546 }
7547 if (callbacks && callbacks->instanceResult)
7548 {
7549 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7550 }
7551 }
7552 }
7553
7554 /*
7555 **=============================================================================
7556 **
7557 ** MI_Session_References()
7558 **
7559 ** Initiates a References operation. If a result callback is specified, the
7560 ** callback will be called for each result in the result set and when complete
7561 mike 1.1 ** gives the return code of the operation. For synchronous, the client
7562 ** must call MI_Operation_GetInstance to receive the objects, once for each object
7563 ** until the operation return code is also included. Even if the operation is
7564 ** cancelled the client must still call MI_Operation_GetInstance until the return
7565 ** code is given.
7566 **
7567 **=============================================================================
7568 */
7569 MI_INLINE void MI_Session_ReferenceInstances(
7570 _In_ MI_Session *session,
7571 MI_Uint32 flags,
7572 _In_opt_ MI_OperationOptions *options,
7573 _In_opt_z_ const MI_Char *namespaceName,
7574 _In_ const MI_Instance *instanceKey,
7575 _In_opt_z_ const MI_Char *resultClass,
7576 _In_opt_z_ const MI_Char *role,
7577 MI_Boolean keysOnly,
7578 _In_opt_ MI_OperationCallbacks *callbacks,
7579 _Out_ MI_Operation *operation)
7580 {
7581 if (session && session->ft)
7582 mike 1.1 {
7583 session->ft->ReferenceInstances(session, flags, options, namespaceName, instanceKey, resultClass, role, keysOnly, callbacks, operation);
7584 }
7585 else
7586 {
7587 if (operation)
7588 {
7589 memset(operation, 0, sizeof(*operation));
7590 }
7591 if (callbacks && callbacks->instanceResult)
7592 {
7593 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7594 }
7595 }
7596 }
7597
7598 /*
7599 **=============================================================================
7600 **
7601 ** MI_Session_Subscribe()
7602 **
7603 mike 1.1 ** Initiates a Subscribe operation. If a indicate callback is specified, the
7604 ** callback will be called for each indications in the result set and when
7605 ** complete gives the return code of the operation. For synchronous, the client
7606 ** must call MI_Operation_GetIndication to receive the objects, once for each object
7607 ** until the operation return code is also included. Even if the operation is
7608 ** cancelled the client must still call MI_Operation_GetIndication until the return
7609 ** code is given.
7610 **
7611 **=============================================================================
7612 */
7613
7614 MI_INLINE void MI_Session_Subscribe(
7615 _In_ MI_Session *session,
7616 MI_Uint32 flags,
7617 _In_opt_ MI_OperationOptions *options,
7618 _In_opt_z_ const MI_Char *namespaceName,
7619 _In_opt_z_ const MI_Char *queryDialect,
7620 _In_opt_z_ const MI_Char *queryExpression,
7621 _In_opt_ const MI_SubscriptionDeliveryOptions *deliverOptions,
7622 _In_opt_ MI_OperationCallbacks *callbacks,
7623 _Out_ MI_Operation *operation)
7624 mike 1.1 {
7625 if (session && session->ft)
7626 {
7627 session->ft->Subscribe(session, flags, options, namespaceName, queryDialect, queryExpression, deliverOptions, callbacks, operation);
7628 }
7629 else
7630 {
7631 if (operation)
7632 {
7633 memset(operation, 0, sizeof(*operation));
7634 }
7635 if (callbacks && callbacks->indicationResult)
7636 {
7637 callbacks->indicationResult(NULL, callbacks->callbackContext, NULL, NULL, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7638 }
7639 }
7640 }
7641
7642 /*
7643 **=============================================================================
7644 **
7645 mike 1.1 ** MI_Session_GetClass()
7646 **
7647 **=============================================================================
7648 */
7649 MI_INLINE void MI_Session_GetClass(
7650 _In_ MI_Session *session,
7651 MI_Uint32 flags,
7652 _In_opt_ MI_OperationOptions *options,
7653 _In_opt_z_ const MI_Char *namespaceName,
7654 _In_opt_z_ const MI_Char *className,
7655 _In_opt_ MI_OperationCallbacks *callbacks,
7656 _Out_ MI_Operation *operation)
7657 {
7658 if (session && session->ft)
7659 {
7660 session->ft->GetClass(session, flags, options, namespaceName, className, callbacks, operation);
7661 }
7662 else
7663 {
7664 if (operation)
7665 {
7666 mike 1.1 memset(operation, 0, sizeof(*operation));
7667 }
7668 if (callbacks && callbacks->classResult)
7669 {
7670 callbacks->classResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7671 }
7672 }
7673 }
7674
7675 /*
7676 **=============================================================================
7677 **
7678 ** MI_Session_EnumerateClasses()
7679 **
7680 **=============================================================================
7681 */
7682 MI_INLINE void MI_Session_EnumerateClasses(
7683 _In_ MI_Session *session,
7684 MI_Uint32 flags,
7685 _In_opt_ MI_OperationOptions *options,
7686 _In_opt_z_ const MI_Char *namespaceName,
7687 mike 1.1 _In_opt_z_ const MI_Char *className,
7688 MI_Boolean classNamesOnly,
7689 _In_opt_ MI_OperationCallbacks *callbacks,
7690 _Out_ MI_Operation *operation)
7691 {
7692 if (session && session->ft)
7693 {
7694 session->ft->EnumerateClasses(session, flags, options, namespaceName, className, classNamesOnly, callbacks, operation);
7695 }
7696 else
7697 {
7698 if (operation)
7699 {
7700 memset(operation, 0, sizeof(*operation));
7701 }
7702 if (callbacks && callbacks->classResult)
7703 {
7704 callbacks->classResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7705 }
7706 }
7707 }
7708 mike 1.1
7709 MI_INLINE void MI_Session_TestConnection(
7710 _In_ MI_Session *session,
7711 MI_Uint32 flags,
7712 _In_opt_ MI_OperationCallbacks *callbacks,
7713 _Out_ MI_Operation *operation)
7714 {
7715 if (session && session->ft)
7716 {
7717 session->ft->TestConnection(session, flags, callbacks, operation);
7718 }
7719 else
7720 {
7721 if (operation)
7722 {
7723 memset(operation, 0, sizeof(*operation));
7724 }
7725 if (callbacks && callbacks->instanceResult)
7726 {
7727 callbacks->instanceResult(NULL, callbacks->callbackContext, NULL, MI_FALSE, MI_RESULT_INVALID_PARAMETER, NULL, NULL, NULL);
7728 }
7729 mike 1.1 }
7730 }
7731
7732 /*
7733 **=============================================================================
7734 **
7735 ** MI_Operation_GetInstance()
7736 **
7737 ** This method is called to get a syncronous result for all operations except
7738 ** subscriptions, where MI_Operation_GetIndication should be used.
7739 ** It is an error to call this function if a result callback is registered.
7740 ** This method will block until a result is available. If this is an
7741 ** enumeration operation then this function should be called until a
7742 ** returnCode is returned.
7743 ** Calls to this method for enumerations could cause many network round trips
7744 ** to happen if it is a large enumeration.
7745 **
7746 **=============================================================================
7747 */
7748 MI_INLINE MI_Result MI_Operation_GetInstance(
7749 _In_ MI_Operation *operation,
7750 mike 1.1 _Outptr_result_maybenull_ const MI_Instance **instance,
7751 _Out_opt_ MI_Boolean *moreResults,
7752 _Out_opt_ MI_Result *result,
7753 _Outptr_opt_result_maybenull_z_ const MI_Char **errorMessage,
7754 _Outptr_opt_result_maybenull_ const MI_Instance **completionDetails)
7755 {
7756 if (operation && operation->ft)
7757 {
7758 return operation->ft->GetInstance(operation, instance, moreResults, result, errorMessage, completionDetails);
7759 }
7760 if (result) *result = MI_RESULT_INVALID_PARAMETER;
7761 if (moreResults) *moreResults = MI_FALSE;
7762 return MI_RESULT_INVALID_PARAMETER;
7763 }
7764
7765 /*
7766 **=============================================================================
7767 **
7768 ** MI_Operation_GetIndication()
7769 **
7770 ** This method is called to get a syncronous result for a subscription.
7771 mike 1.1 ** It is an error to call this function if a Indication callback is registered.
7772 ** This method will block until a result is available. This function should be
7773 ** called until a returnCode object is returned.
7774 ** Calls to this method are likely to cause many network round trips
7775 ** to happen.
7776 **
7777 **=============================================================================
7778 */
7779 MI_INLINE MI_Result MI_Operation_GetIndication(
7780 _In_ MI_Operation *operation,
7781 _Outptr_result_maybenull_ const MI_Instance **instance,
7782 _Outptr_opt_result_maybenull_z_ const MI_Char **bookmark,
7783 _Outptr_opt_result_maybenull_z_ const MI_Char **machineID,
7784 _Out_opt_ MI_Boolean *moreResults,
7785 _Out_opt_ MI_Result *result,
7786 _Outptr_opt_result_maybenull_z_ const MI_Char **errorMessage,
7787 _Outptr_opt_result_maybenull_ const MI_Instance **completionDetails)
7788 {
7789 if (operation && operation->ft)
7790 {
7791 return operation->ft->GetIndication(operation, instance, bookmark, machineID, moreResults, result, errorMessage, completionDetails);
7792 mike 1.1 }
7793 if (result) *result = MI_RESULT_INVALID_PARAMETER;
7794 if (moreResults) *moreResults = MI_FALSE;
7795 return MI_RESULT_INVALID_PARAMETER;
7796 }
7797
7798 /*
7799 **=============================================================================
7800 **
7801 ** MI_Operation_GetClass()
7802 **
7803 **=============================================================================
7804 */
7805 MI_INLINE MI_Result MI_Operation_GetClass(
7806 _In_ MI_Operation *operation,
7807 _Outptr_result_maybenull_ const MI_Class **classResult,
7808 _Out_opt_ MI_Boolean *moreResults,
7809 _Out_opt_ MI_Result *result,
7810 _Outptr_opt_result_maybenull_z_ const MI_Char **errorMessage,
7811 _Outptr_opt_result_maybenull_ const MI_Instance **completionDetails)
7812 {
7813 mike 1.1 if (operation && operation->ft)
7814 {
7815 return operation->ft->GetClass(operation, classResult, moreResults, result, errorMessage, completionDetails);
7816 }
7817 if (result) *result = MI_RESULT_INVALID_PARAMETER;
7818 if (moreResults) *moreResults = MI_FALSE;
7819 return MI_RESULT_INVALID_PARAMETER;
7820 }
7821
7822 /*
7823 **=============================================================================
7824 **
7825 ** MI_Operation_Close()
7826 **
7827 ** This method closes down an operation. Normally this will happen after a
7828 ** result is returned, however this can be called to cancel a running
7829 ** operation.
7830 ** This is asynchronous if the operation is asynchronous, or synchronous and blocks
7831 ** if the operation is synchronous.
7832 **
7833 **=============================================================================
7834 mike 1.1 */
7835 MI_INLINE MI_Result MI_Operation_Close(
7836 _Inout_ MI_Operation *operation)
7837 {
7838 if (operation && operation->ft)
7839 {
7840 return operation->ft->Close(operation);
7841 }
7842 return MI_RESULT_INVALID_PARAMETER;
7843 }
7844
7845 /*
7846 **=============================================================================
7847 **
7848 ** MI_Operation_Cancel()
7849 **
7850 ** Cancels a running operation. All results need to be consumed until moreResults
7851 ** returns MI_FALSE. The operation also must still be closed with MI_Operation_Close.
7852 **=============================================================================
7853 */
7854 MI_INLINE MI_Result MI_Operation_Cancel(
7855 mike 1.1 _Inout_ MI_Operation *operation,
7856 MI_CancellationReason reason)
7857 {
7858 if (operation && operation->ft)
7859 {
7860 return operation->ft->Cancel(operation, reason);
7861 }
7862 return MI_RESULT_INVALID_PARAMETER;
7863 }
7864
7865 /*
7866 **=============================================================================
7867 **
7868 ** MI_Operation_GetSession()
7869 **
7870 **=============================================================================
7871 */
7872 MI_INLINE MI_Result MI_Operation_GetSession(
7873 _In_ MI_Operation *operation,
7874 _Out_ MI_Session *session)
7875 {
7876 mike 1.1 if (session)
7877 {
7878 memset(session, 0, sizeof(MI_Session));
7879 }
7880
7881 if (operation && operation->ft)
7882 {
7883 return operation->ft->GetSession(operation, session);
7884 }
7885 return MI_RESULT_INVALID_PARAMETER;
7886 }
7887
7888 /*
7889 **=============================================================================
7890 **
7891 ** MI_DestinationOptions_Delete()
7892 **
7893 **=============================================================================
7894 */
7895 MI_INLINE void MI_DestinationOptions_Delete(
7896 _Inout_ MI_DestinationOptions *options)
7897 mike 1.1 {
7898 if (options && options->ft)
7899 {
7900 options->ft->Delete(options);
7901 }
7902 }
7903
7904 /*
7905 **=============================================================================
7906 **
7907 ** MI_DestinationOptions_SetTimeout()
7908 **
7909 **=============================================================================
7910 */
7911 MI_INLINE MI_Result MI_DestinationOptions_SetTimeout(
7912 _Inout_ MI_DestinationOptions *options,
7913 _In_ const MI_Interval *timeout)
7914 {
7915 if (options && options->ft)
7916 {
7917 return options->ft->SetInterval(options, MI_T("__MI_DESTINATIONOPTIONS_TIMEOUT"), timeout, 0);
7918 mike 1.1 }
7919 else
7920 {
7921 return MI_RESULT_INVALID_PARAMETER;
7922 }
7923 }
7924
7925 /*
7926 **=============================================================================
7927 **
7928 ** MI_DestinationOptions_GetTimeout()
7929 **
7930 **=============================================================================
7931 */
7932 MI_INLINE MI_Result MI_DestinationOptions_GetTimeout(
7933 _In_ MI_DestinationOptions *options,
7934 _Out_ MI_Interval *timeout)
7935 {
7936 if (options && options->ft)
7937 {
7938 return options->ft->GetInterval(options, MI_T("__MI_DESTINATIONOPTIONS_TIMEOUT"), timeout, 0, 0);
7939 mike 1.1 }
7940 else
7941 {
7942 return MI_RESULT_INVALID_PARAMETER;
7943 }
7944 }
7945
7946 /*
7947 **=============================================================================
7948 **
7949 ** MI_DestinationOptions_SetCertCACheck()
7950 **
7951 **=============================================================================
7952 */
7953 /* Check/skip CA check when doing SSL, default TRUE, check*/
7954 MI_INLINE MI_Result MI_DestinationOptions_SetCertCACheck(
7955 _Inout_ MI_DestinationOptions *options,
7956 MI_Boolean check)
7957 {
7958 if (options && options->ft)
7959 {
7960 mike 1.1 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_CERT_CA_CHECK"), check, 0);
7961 }
7962 else
7963 {
7964 return MI_RESULT_INVALID_PARAMETER;
7965 }
7966 }
7967
7968 /*
7969 **=============================================================================
7970 **
7971 ** MI_DestinationOptions_GetCertCACheck()
7972 **
7973 ** Description
7974 ** Get Check/skip CA check when doing SSL
7975 **
7976 **=============================================================================
7977 */
7978 MI_INLINE MI_Result MI_DestinationOptions_GetCertCACheck(
7979 _In_ MI_DestinationOptions *options,
7980 _Out_ MI_Boolean *check)
7981 mike 1.1 {
7982 if (options && options->ft)
7983 {
7984 MI_Uint32 value;
7985 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_CERT_CA_CHECK"), &value, 0, 0);
7986 if (result == MI_RESULT_OK)
7987 *check = (MI_Boolean) value;
7988 return result;
7989 }
7990 else
7991 {
7992 return MI_RESULT_INVALID_PARAMETER;
7993 }
7994 }
7995
7996
7997 /*
7998 **=============================================================================
7999 **
8000 ** MI_DestinationOptions_SetCertCNCheck()
8001 **
8002 mike 1.1 **=============================================================================
8003 */
8004 /* Check/skip CN check when doing SSL, default TRUE, check*/
8005 MI_INLINE MI_Result MI_DestinationOptions_SetCertCNCheck(
8006 _Inout_ MI_DestinationOptions *options,
8007 MI_Boolean check)
8008 {
8009 if (options && options->ft)
8010 {
8011 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_CERT_CN_CHECK"), check, 0);
8012 }
8013 else
8014 {
8015 return MI_RESULT_INVALID_PARAMETER;
8016 }
8017 }
8018
8019 /*
8020 **=============================================================================
8021 **
8022 ** MI_DestinationOptions_GetCertCNCheck()
8023 mike 1.1 **
8024 ** Description:
8025 ** Get check/skip CN check when doing SSL
8026 **
8027 **=============================================================================
8028 */
8029 MI_INLINE MI_Result MI_DestinationOptions_GetCertCNCheck(
8030 _In_ MI_DestinationOptions *options,
8031 _Out_ MI_Boolean *check)
8032 {
8033 if (options && options->ft)
8034 {
8035 MI_Uint32 value;
8036 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_CERT_CN_CHECK"), &value, 0, 0);
8037 if (result == MI_RESULT_OK)
8038 *check = (MI_Boolean) value;
8039 return result;
8040 }
8041 else
8042 {
8043 return MI_RESULT_INVALID_PARAMETER;
8044 mike 1.1 }
8045 }
8046
8047 /*
8048 **=============================================================================
8049 **
8050 ** MI_DestinationOptions_SetCertRevocationCheck()
8051 **
8052 **=============================================================================
8053 */
8054 /* Check/skip cert revocation check when doing SSL, default TRUE, check*/
8055 MI_INLINE MI_Result MI_DestinationOptions_SetCertRevocationCheck(
8056 _Inout_ MI_DestinationOptions *options,
8057 MI_Boolean check)
8058 {
8059 if (options && options->ft)
8060 {
8061 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_CERT_REVOCATION_CHECK"), check, 0);
8062 }
8063 else
8064 {
8065 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
8066 }
8067 }
8068
8069 /*
8070 **=============================================================================
8071 **
8072 ** MI_DestinationOptions_GetCertRevocationCheck()
8073 **
8074 ** Description:
8075 ** Get Check/skip cert revocation check when doing SSL
8076 **
8077 **=============================================================================
8078 */
8079 MI_INLINE MI_Result MI_DestinationOptions_GetCertRevocationCheck(
8080 _In_ MI_DestinationOptions *options,
8081 _Out_ MI_Boolean *check)
8082 {
8083 if (options && options->ft)
8084 {
8085 MI_Uint32 value;
8086 mike 1.1 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_CERT_REVOCATION_CHECK"), &value, 0, 0);
8087 if (result == MI_RESULT_OK)
8088 *check = (MI_Boolean) value;
8089 return result;
8090 }
8091 else
8092 {
8093 return MI_RESULT_INVALID_PARAMETER;
8094 }
8095 }
8096
8097 /*
8098 **=============================================================================
8099 **
8100 ** MI_DestinationOptions_SetPacketPrivacy()
8101 **
8102 ** Ensure packet privacy (encryption), default TRUE
8103 **=============================================================================
8104 */
8105 MI_INLINE MI_Result MI_DestinationOptions_SetPacketPrivacy(
8106 _Inout_ MI_DestinationOptions *options,
8107 mike 1.1 MI_Boolean privacy)
8108 {
8109 if (options && options->ft)
8110 {
8111 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_PACKET_PRIVACY"), privacy, 0);
8112 }
8113 else
8114 {
8115 return MI_RESULT_INVALID_PARAMETER;
8116 }
8117 }
8118
8119 /*
8120 **=============================================================================
8121 **
8122 ** MI_DestinationOptions_GetPacketPrivacy()
8123 **
8124 ** Description:
8125 ** Get packet privacy (encryption)
8126 **
8127 **=============================================================================
8128 mike 1.1 */
8129 MI_INLINE MI_Result MI_DestinationOptions_GetPacketPrivacy(
8130 _In_ MI_DestinationOptions *options,
8131 _Out_ MI_Boolean *privacy)
8132 {
8133 if (options && options->ft)
8134 {
8135 MI_Uint32 value;
8136 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_PACKET_PRIVACY"), &value, 0, 0);
8137 if (result == MI_RESULT_OK)
8138 *privacy = (MI_Boolean) value;
8139 return result;
8140 }
8141 else
8142 {
8143 return MI_RESULT_INVALID_PARAMETER;
8144 }
8145 }
8146
8147 /*
8148 **=============================================================================
8149 mike 1.1 **
8150 ** MI_DestinationOptions_SetPacketIntegrity()
8151 **
8152 **=============================================================================
8153 */
8154 /* Ensure packet integrity (sign), default TRUE*/
8155 MI_INLINE MI_Result MI_DestinationOptions_SetPacketIntegrity(
8156 _Inout_ MI_DestinationOptions *options,
8157 MI_Boolean integrity)
8158 {
8159 if (options && options->ft)
8160 {
8161 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_PACKET_INTEGRITY"), integrity, 0);
8162 }
8163 else
8164 {
8165 return MI_RESULT_INVALID_PARAMETER;
8166 }
8167 }
8168
8169 /*
8170 mike 1.1 **=============================================================================
8171 **
8172 ** MI_DestinationOptions_GetPacketIntegrity()
8173 **
8174 ** Description
8175 ** Get packet integrity (sign)
8176 **
8177 **=============================================================================
8178 */
8179 MI_INLINE MI_Result MI_DestinationOptions_GetPacketIntegrity(
8180 _In_ MI_DestinationOptions *options,
8181 _Out_ MI_Boolean *integrity)
8182 {
8183 if (options && options->ft)
8184 {
8185 MI_Uint32 value;
8186 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_PACKET_INTEGRITY"), &value, 0, 0);
8187 if (result == MI_RESULT_OK)
8188 *integrity = (MI_Boolean) value;
8189 return result;
8190 }
8191 mike 1.1 else
8192 {
8193 return MI_RESULT_INVALID_PARAMETER;
8194 }
8195 }
8196
8197 /*
8198 **=============================================================================
8199 **
8200 **
8201 **=============================================================================
8202 */
8203 #define MI_DESTINATIONOPTIONS_PACKET_ENCODING_DEFAULT MI_T("default")
8204 #define MI_DESTINATIONOPTIONS_PACKET_ENCODING_UTF8 MI_T("UTF8")
8205 #define MI_DESTINATIONOPTIONS_PACKET_ENCODING_UTF16 MI_T("UTF16")
8206
8207 /*
8208 **=============================================================================
8209 **
8210 ** MI_DestinationOptions_SetPacketEncoding()
8211 **
8212 mike 1.1 **=============================================================================
8213 */
8214 MI_INLINE MI_Result MI_DestinationOptions_SetPacketEncoding(
8215 _Inout_ MI_DestinationOptions *options,
8216 _In_z_ const MI_Char *encoding)
8217 {
8218 if (options && options->ft)
8219 {
8220 return options->ft->SetString(options, MI_T("__MI_DESTINATIONOPTIONS_PACKET_ENCODING"), encoding, 0);
8221 }
8222 else
8223 {
8224 return MI_RESULT_INVALID_PARAMETER;
8225 }
8226 }
8227
8228 /*
8229 **=============================================================================
8230 **
8231 ** MI_DestinationOptions_GetPacketEncoding()
8232 **
8233 mike 1.1 **=============================================================================
8234 */
8235 MI_INLINE MI_Result MI_DestinationOptions_GetPacketEncoding(
8236 _In_ MI_DestinationOptions *options,
8237 _Outptr_result_z_ const MI_Char **encoding)
8238 {
8239 if (options && options->ft)
8240 {
8241 return options->ft->GetString(options, MI_T("__MI_DESTINATIONOPTIONS_PACKET_ENCODING"), encoding, 0, 0);
8242 }
8243 else
8244 {
8245 return MI_RESULT_INVALID_PARAMETER;
8246 }
8247 }
8248
8249 /*
8250 **=============================================================================
8251 **
8252 ** MI_DestinationOptions_SetDataLocale()
8253 **
8254 mike 1.1 ** Description:
8255 ** Overrides the default data locale that is used for requests.
8256 ** By default the data locale of the calling thread is used and this
8257 ** method will override with the specified locale.
8258 ** Data locale is used to determine string formats for things like
8259 ** decimal nunbers in string format and date/time formats.
8260 **
8261 ** Parameters
8262 ** Option: Valid MI_DestinationOptions created through
8263 ** MI_Application_NewDestinationOptions.
8264 ** locale: Valid data locale string. Example: en-us
8265 **
8266 **=============================================================================
8267 */
8268 MI_INLINE MI_Result MI_DestinationOptions_SetDataLocale(
8269 _Inout_ MI_DestinationOptions *options,
8270 _In_z_ const MI_Char *locale)
8271 {
8272 if (options && options->ft)
8273 {
8274 return options->ft->SetString(options, MI_T("__MI_DESTINATIONOPTIONS_DATA_LOCALE"), locale, 0);
8275 mike 1.1 }
8276 else
8277 {
8278 return MI_RESULT_INVALID_PARAMETER;
8279 }
8280 }
8281
8282 /*
8283 **=============================================================================
8284 **
8285 ** MI_DestinationOptions_GetDataLocale()
8286 **
8287 ** Description:
8288 ** Gets the data locale set by user.
8289 **
8290 ** Parameters
8291 ** Option: Valid MI_DestinationOptions created through
8292 ** MI_Application_NewDestinationOptions.
8293 ** locale: data locale string has been set.
8294 **
8295 **=============================================================================
8296 mike 1.1 */
8297 MI_INLINE MI_Result MI_DestinationOptions_GetDataLocale(
8298 _In_ MI_DestinationOptions *options,
8299 _Outptr_result_z_ const MI_Char **locale)
8300 {
8301 if (options && options->ft)
8302 {
8303 return options->ft->GetString(options, MI_T("__MI_DESTINATIONOPTIONS_DATA_LOCALE"), locale, 0, 0);
8304 }
8305 else
8306 {
8307 return MI_RESULT_INVALID_PARAMETER;
8308 }
8309 }
8310
8311 /*
8312 **=============================================================================
8313 **
8314 ** MI_DestinationOptions_SetUILocale()
8315 **
8316 ** Description:
8317 mike 1.1 ** Overrides the default UI locale that is used for requests.
8318 ** By default the UI locale of the calling thread is used and this
8319 ** method will override with the specified locale.
8320 ** UI locale is used to determine the language used for localizable
8321 ** strings, such as error messages.
8322 **
8323 ** Parameters
8324 ** Option: Valid MI_DestinationOptions created through
8325 ** MI_Application_NewDestinationOptions.
8326 ** locale: Valid UI locale string. Example: en-us
8327 **=============================================================================
8328 */
8329 MI_INLINE MI_Result MI_DestinationOptions_SetUILocale(
8330 _Inout_ MI_DestinationOptions *options,
8331 _In_z_ const MI_Char *locale)
8332 {
8333 if (options && options->ft)
8334 {
8335 return options->ft->SetString(options, MI_T("__MI_DESTINATIONOPTIONS_UI_LOCALE"), locale, 0);
8336 }
8337 else
8338 mike 1.1 {
8339 return MI_RESULT_INVALID_PARAMETER;
8340 }
8341 }
8342
8343 /*
8344 **=============================================================================
8345 **
8346 ** MI_DestinationOptions_GetUILocale()
8347 **
8348 ** Description:
8349 ** Gets the UI locale set by user.
8350 **
8351 ** Parameters
8352 ** Option: Valid MI_DestinationOptions created through
8353 ** MI_Application_NewDestinationOptions.
8354 ** locale: UI locale string has been set.
8355 **=============================================================================
8356 */
8357 MI_INLINE MI_Result MI_DestinationOptions_GetUILocale(
8358 _In_ MI_DestinationOptions *options,
8359 mike 1.1 _Outptr_result_z_ const MI_Char **locale)
8360 {
8361 if (options && options->ft)
8362 {
8363 return options->ft->GetString(options, MI_T("__MI_DESTINATIONOPTIONS_UI_LOCALE"), locale, 0, 0);
8364 }
8365 else
8366 {
8367 return MI_RESULT_INVALID_PARAMETER;
8368 }
8369 }
8370
8371 /*
8372 **=============================================================================
8373 **
8374 ** MI_DestinationOptions_SetMaxEnvelopeSize()
8375 **
8376 **=============================================================================
8377 */
8378 MI_INLINE MI_Result MI_DestinationOptions_SetMaxEnvelopeSize(
8379 _Inout_ MI_DestinationOptions *options,
8380 mike 1.1 MI_Uint32 sizeInKB)
8381 {
8382 if (options && options->ft)
8383 {
8384 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_MAX_ENVELOPE_SIZE"), sizeInKB, 0);
8385 }
8386 else
8387 {
8388 return MI_RESULT_INVALID_PARAMETER;
8389 }
8390 }
8391
8392 /*
8393 **=============================================================================
8394 **
8395 ** MI_DestinationOptions_GetMaxEnvelopeSize()
8396 **
8397 **=============================================================================
8398 */
8399 MI_INLINE MI_Result MI_DestinationOptions_GetMaxEnvelopeSize(
8400 _In_ MI_DestinationOptions *options,
8401 mike 1.1 _Out_ MI_Uint32 *sizeInKB)
8402 {
8403 if (options && options->ft)
8404 {
8405 return options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_MAX_ENVELOPE_SIZE"), sizeInKB, 0, 0);
8406 }
8407 else
8408 {
8409 return MI_RESULT_INVALID_PARAMETER;
8410 }
8411 }
8412
8413 /*
8414 **=============================================================================
8415 **
8416 ** MI_DestinationOptions_SetEncodePortInSPN()
8417 **
8418 ** default MI_FALSE = don't, MI_TRUE = do encode, WinRM transport specific
8419 **=============================================================================
8420 */
8421 MI_INLINE MI_Result MI_DestinationOptions_SetEncodePortInSPN(
8422 mike 1.1 _Inout_ MI_DestinationOptions *options,
8423 MI_Boolean encodePort)
8424 {
8425 if (options && options->ft)
8426 {
8427 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_ENCODE_PORT_IN_SPN"), encodePort, 0);
8428 }
8429 else
8430 {
8431 return MI_RESULT_INVALID_PARAMETER;
8432 }
8433 }
8434
8435 /*
8436 **=============================================================================
8437 **
8438 ** MI_DestinationOptions_GetEncodePortInSPN()
8439 **
8440 ** default MI_FALSE = don't, MI_TRUE = do encode, WinRM transport specific
8441 **=============================================================================
8442 */
8443 mike 1.1 MI_INLINE MI_Result MI_DestinationOptions_GetEncodePortInSPN(
8444 _In_ MI_DestinationOptions *options,
8445 _Out_ MI_Boolean *encodePort)
8446 {
8447 if (options && options->ft)
8448 {
8449 MI_Uint32 value;
8450 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_ENCODE_PORT_IN_SPN"), &value, 0, 0);
8451 if (result == MI_RESULT_OK)
8452 *encodePort = (MI_Boolean) value;
8453 return result;
8454 }
8455 else
8456 {
8457 return MI_RESULT_INVALID_PARAMETER;
8458 }
8459 }
8460
8461 /*
8462 **=============================================================================
8463 **
8464 mike 1.1 ** MI_DestinationOptions_SetHttpUrlPrefix()
8465 **
8466 **Specific to HTTP/HTTP based transports, WinRM default is /wsman, other transports are transports/protocols specific
8467 **=============================================================================
8468 */
8469 MI_INLINE MI_Result MI_DestinationOptions_SetHttpUrlPrefix(
8470 _Inout_ MI_DestinationOptions *options,
8471 _In_z_ const MI_Char *prefix)
8472 {
8473 if (options && options->ft)
8474 {
8475 return options->ft->SetString(options, MI_T("__MI_DESTINATIONOPTIONS_HTTP_URL_PREFIX"), prefix, 0);
8476 }
8477 else
8478 {
8479 return MI_RESULT_INVALID_PARAMETER;
8480 }
8481 }
8482
8483 /*
8484 **=============================================================================
8485 mike 1.1 **
8486 ** MI_DestinationOptions_GetHttpUrlPrefix()
8487 **
8488 **Specific to HTTP/HTTP based transports, WinRM default is /wsman, other transports are transports/protocols specific
8489 **=============================================================================
8490 */
8491 MI_INLINE MI_Result MI_DestinationOptions_GetHttpUrlPrefix(
8492 _In_ MI_DestinationOptions *options,
8493 _Outptr_result_z_ const MI_Char **prefix)
8494 {
8495 if (options && options->ft)
8496 {
8497 return options->ft->GetString(options, MI_T("__MI_DESTINATIONOPTIONS_HTTP_URL_PREFIX"), prefix, 0, 0);
8498 }
8499 else
8500 {
8501 return MI_RESULT_INVALID_PARAMETER;
8502 }
8503 }
8504
8505 /*
8506 mike 1.1 **=============================================================================
8507 **
8508 ** MI_DestinationOptions_SetDestinationPort()
8509 **
8510 ** Transport specific, Default port for transport.
8511 **=============================================================================
8512 */
8513 MI_INLINE MI_Result MI_DestinationOptions_SetDestinationPort(
8514 _Inout_ MI_DestinationOptions *options,
8515 MI_Uint32 port)
8516 {
8517 if (options && options->ft)
8518 {
8519 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_DESTINATION_PORT"), port, 0);
8520 }
8521 else
8522 {
8523 return MI_RESULT_INVALID_PARAMETER;
8524 }
8525 }
8526
8527 mike 1.1 /*
8528 **=============================================================================
8529 **
8530 ** MI_DestinationOptions_GetDestinationPort()
8531 **
8532 ** Transport specific, Default port for transport.
8533 **=============================================================================
8534 */
8535 MI_INLINE MI_Result MI_DestinationOptions_GetDestinationPort(
8536 _In_ MI_DestinationOptions *options,
8537 _Out_ MI_Uint32 *port)
8538 {
8539 if (options && options->ft)
8540 {
8541 return options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_DESTINATION_PORT"), port, 0, 0);
8542 }
8543 else
8544 {
8545 return MI_RESULT_INVALID_PARAMETER;
8546 }
8547 }
8548 mike 1.1
8549 /*
8550 **=============================================================================
8551 **
8552 ** #define
8553 **
8554 **
8555 **=============================================================================
8556 */
8557 /*Transports vary depending on protocol. For WSMAN, HTTP and HTTPS are supported */
8558 #define MI_DESTINATIONOPTIONS_TRANSPORT_HTTP MI_T("HTTP")
8559 #define MI_DESTINATIONOPTIONS_TRANPSORT_HTTPS MI_T("HTTPS")
8560
8561 /*
8562 **=============================================================================
8563 **
8564 ** MI_DestinationOptions_SetTransport()
8565 **
8566 **=============================================================================
8567 */
8568 MI_INLINE MI_Result MI_DestinationOptions_SetTransport(
8569 mike 1.1 _Inout_ MI_DestinationOptions *options,
8570 _In_z_ const MI_Char *transport)
8571 {
8572 if (options && options->ft)
8573 {
8574 return options->ft->SetString(options, MI_T("__MI_DESTINATIONOPTIONS_TRANSPORT"), transport, 0);
8575 }
8576 else
8577 {
8578 return MI_RESULT_INVALID_PARAMETER;
8579 }
8580 }
8581
8582 /*
8583 **=============================================================================
8584 **
8585 ** MI_DestinationOptions_GetTransport()
8586 **
8587 **=============================================================================
8588 */
8589 MI_INLINE MI_Result MI_DestinationOptions_GetTransport(
8590 mike 1.1 _In_ MI_DestinationOptions *options,
8591 _Outptr_result_z_ const MI_Char **transport)
8592 {
8593 if (options && options->ft)
8594 {
8595 return options->ft->GetString(options, MI_T("__MI_DESTINATIONOPTIONS_TRANSPORT"), transport, 0, 0);
8596 }
8597 else
8598 {
8599 return MI_RESULT_INVALID_PARAMETER;
8600 }
8601 }
8602
8603 /*
8604 **=============================================================================
8605 **
8606 ** #define
8607 **
8608 **=============================================================================
8609 */
8610 #define MI_DESTINATIONOPTIONS_PROXY_TYPE_IE MI_T("IE")
8611 mike 1.1 #define MI_DESTINATIONOPTIONS_PROXY_TYPE_WINHTTP MI_T("WinHTTP")
8612 #define MI_DESTINATIONOPTIONS_PROXY_TYPE_AUTO MI_T("Auto")
8613 #define MI_DESTINATIONOPTIONS_PROXY_TYPE_NONE MI_T("None")
8614
8615 /*
8616 **=============================================================================
8617 **
8618 ** MI_DestinationOptions_SetProxyType()
8619 **
8620 **=============================================================================
8621 */
8622 MI_INLINE MI_Result MI_DestinationOptions_SetProxyType(
8623 _Inout_ MI_DestinationOptions *options,
8624 _In_z_ const MI_Char *proxyType)
8625 {
8626 if (options && options->ft)
8627 {
8628 return options->ft->SetString(options, MI_T("__MI_DESTINATIONOPTIONS_PROXY_TYPE"), proxyType, 0);
8629 }
8630 else
8631 {
8632 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
8633 }
8634 }
8635
8636 /*
8637 **=============================================================================
8638 **
8639 ** MI_DestinationOptions_GetProxyType()
8640 **
8641 **=============================================================================
8642 */
8643 MI_INLINE MI_Result MI_DestinationOptions_GetProxyType(
8644 _In_ MI_DestinationOptions *options,
8645 _Outptr_result_z_ const MI_Char **proxyType)
8646 {
8647 if (options && options->ft)
8648 {
8649 return options->ft->GetString(options, MI_T("__MI_DESTINATIONOPTIONS_PROXY_TYPE"), proxyType, 0, 0);
8650 }
8651 else
8652 {
8653 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
8654 }
8655 }
8656
8657 /*
8658 **=============================================================================
8659 **
8660 ** MI_DestinationOptions_AddProxyCredentials()
8661 **
8662 ** Cumulative meaning if you add 2 it will be dual auth. Not all cred types
8663 ** can be combined, not all transport handles support dual auth.
8664 **
8665 **=============================================================================
8666 */
8667 MI_INLINE MI_Result MI_DestinationOptions_AddProxyCredentials(
8668 _Inout_ MI_DestinationOptions *options,
8669 _In_ const MI_UserCredentials *credentials)
8670 {
8671 if (options && options->ft)
8672 {
8673 return options->ft->AddCredentials(options, MI_T("__MI_DESTINATIONOPTIONS_PROXY_CREDENTIALS"), credentials, 0);
8674 mike 1.1 }
8675 else
8676 {
8677 return MI_RESULT_INVALID_PARAMETER;
8678 }
8679 }
8680
8681 /*
8682 **=============================================================================
8683 **
8684 ** MI_DestinationOptions_AddDestinationCredentials()
8685 **
8686 ** Cumulative meaning if you add 2 it will be dual auth. Not all cred types
8687 ** can be combined, not all transport handles support dual auth.
8688 **=============================================================================
8689 */
8690 MI_INLINE MI_Result MI_DestinationOptions_AddDestinationCredentials(
8691 _Inout_ MI_DestinationOptions *options,
8692 _In_ const MI_UserCredentials *credentials)
8693 {
8694 if (options && options->ft)
8695 mike 1.1 {
8696 return options->ft->AddCredentials(options, MI_T("__MI_DESTINATIONOPTIONS_DESTINATION_CREDENTIALS"), credentials, 0);
8697 }
8698 else
8699 {
8700 return MI_RESULT_INVALID_PARAMETER;
8701 }
8702 }
8703
8704 typedef enum _MI_DestinationOptions_ImpersonationType
8705 {
8706 MI_DestinationOptions_ImpersonationType_Default = 0,
8707 MI_DestinationOptions_ImpersonationType_None = 1,
8708 MI_DestinationOptions_ImpersonationType_Identify = 2,
8709 MI_DestinationOptions_ImpersonationType_Impersonate = 3,
8710 MI_DestinationOptions_ImpersonationType_Delegate = 4
8711 } MI_DestinationOptions_ImpersonationType;
8712
8713 MI_INLINE MI_Result MI_DestinationOptions_SetImpersonationType(
8714 _Inout_ MI_DestinationOptions *options,
8715 _In_ MI_DestinationOptions_ImpersonationType impersonationType)
8716 mike 1.1 {
8717 if (options && options->ft)
8718 {
8719 return options->ft->SetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_IMPERSONATION_TYPE"), impersonationType, 0);
8720 }
8721 else
8722 {
8723 return MI_RESULT_INVALID_PARAMETER;
8724 }
8725 }
8726
8727 MI_INLINE MI_Result MI_DestinationOptions_GetImpersonationType(
8728 _Inout_ MI_DestinationOptions *options,
8729 _Out_ MI_DestinationOptions_ImpersonationType * impersonationType)
8730 {
8731 if (options && options->ft)
8732 {
8733 MI_Uint32 value;
8734 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_DESTINATIONOPTIONS_IMPERSONATION_TYPE"), &value, 0, 0);
8735 if (result == MI_RESULT_OK)
8736 *impersonationType = (MI_DestinationOptions_ImpersonationType) value;
8737 mike 1.1 return result;
8738 }
8739 else
8740 {
8741 return MI_RESULT_INVALID_PARAMETER;
8742 }
8743 }
8744
8745 /*
8746 **=============================================================================
8747 **
8748 ** MI_DestinationOptions_SetString()
8749 **
8750 **=============================================================================
8751 */
8752 MI_INLINE MI_Result MI_DestinationOptions_SetString(
8753 _Inout_ MI_DestinationOptions *options,
8754 _In_z_ const MI_Char *optionName,
8755 _In_z_ const MI_Char *optionValue)
8756 {
8757 if (options && options->ft)
8758 mike 1.1 {
8759 return options->ft->SetString(options, optionName, optionValue, 0);
8760 }
8761 else
8762 {
8763 return MI_RESULT_INVALID_PARAMETER;
8764 }
8765 }
8766
8767 /*
8768 **=============================================================================
8769 **
8770 ** MI_DestinationOptions_GetString()
8771 **
8772 **=============================================================================
8773 */
8774 MI_INLINE MI_Result MI_DestinationOptions_GetString(
8775 _In_ MI_DestinationOptions *options,
8776 _In_z_ const MI_Char *optionName,
8777 _Outptr_result_z_ const MI_Char **optionValue,
8778 _Out_opt_ MI_Uint32 *index)
8779 mike 1.1 {
8780 if (options && options->ft)
8781 {
8782 return options->ft->GetString(options, optionName, optionValue, index, 0);
8783 }
8784 else
8785 {
8786 return MI_RESULT_INVALID_PARAMETER;
8787 }
8788 }
8789
8790 /*
8791 **=============================================================================
8792 **
8793 ** MI_DestinationOptions_SetNumber()
8794 **
8795 **=============================================================================
8796 */
8797 MI_INLINE MI_Result MI_DestinationOptions_SetNumber(
8798 _Inout_ MI_DestinationOptions *options,
8799 _In_z_ const MI_Char *optionName,
8800 mike 1.1 _In_ MI_Uint32 optionValue)
8801 {
8802 if (options && options->ft)
8803 {
8804 return options->ft->SetNumber(options, optionName, optionValue, 0);
8805 }
8806 else
8807 {
8808 return MI_RESULT_INVALID_PARAMETER;
8809 }
8810 }
8811
8812 /*
8813 **=============================================================================
8814 **
8815 ** MI_DestinationOptions_GetNumber()
8816 **
8817 **=============================================================================
8818 */
8819 MI_INLINE MI_Result MI_DestinationOptions_GetNumber(
8820 _In_ MI_DestinationOptions *options,
8821 mike 1.1 _In_z_ const MI_Char *optionName,
8822 _Out_ MI_Uint32 *optionValue,
8823 _Out_opt_ MI_Uint32 *index)
8824 {
8825 if (options && options->ft)
8826 {
8827 return options->ft->GetNumber(options, optionName, optionValue, index, 0);
8828 }
8829 else
8830 {
8831 return MI_RESULT_INVALID_PARAMETER;
8832 }
8833 }
8834
8835
8836 /*
8837 **=============================================================================
8838 **
8839 ** MI_DestinationOptions_GetOptionCount()
8840 **
8841 **=============================================================================
8842 mike 1.1 */
8843 MI_INLINE MI_Result MI_DestinationOptions_GetOptionCount(
8844 _In_ MI_DestinationOptions *options,
8845 _Out_ MI_Uint32 *count)
8846 {
8847 if (options && options->ft)
8848 {
8849 return options->ft->GetOptionCount(options, count);
8850 }
8851 else
8852 {
8853 return MI_RESULT_INVALID_PARAMETER;
8854 }
8855 }
8856
8857
8858 /*
8859 **=============================================================================
8860 **
8861 ** MI_DestinationOptions_GetOptionAt()
8862 **
8863 mike 1.1 **=============================================================================
8864 */
8865 MI_INLINE MI_Result MI_DestinationOptions_GetOptionAt(
8866 _In_ MI_DestinationOptions *options,
8867 MI_Uint32 index,
8868 _Outptr_result_z_ const MI_Char **optionName,
8869 _Out_ MI_Value *value,
8870 _Out_ MI_Type *type,
8871 _Out_opt_ MI_Uint32 *flags)
8872 {
8873 if (options && options->ft)
8874 {
8875 return options->ft->GetOptionAt(options, index, optionName, value, type, flags);
8876 }
8877 else
8878 {
8879 return MI_RESULT_INVALID_PARAMETER;
8880 }
8881 }
8882
8883 /*
8884 mike 1.1 **=============================================================================
8885 **
8886 ** MI_DestinationOptions_GetOption()
8887 **
8888 **=============================================================================
8889 */
8890 MI_INLINE MI_Result MI_DestinationOptions_GetOption(
8891 _In_ MI_DestinationOptions *options,
8892 _In_z_ const MI_Char *optionName,
8893 _Out_ MI_Value *value,
8894 _Out_ MI_Type *type,
8895 _Out_opt_ MI_Uint32 *index,
8896 _Out_opt_ MI_Uint32 *flags)
8897 {
8898 if (options && options->ft)
8899 {
8900 return options->ft->GetOption(options, optionName, value, type, index, flags);
8901 }
8902 else
8903 {
8904 return MI_RESULT_INVALID_PARAMETER;
8905 mike 1.1 }
8906 }
8907
8908
8909 /*
8910 **=============================================================================
8911 **
8912 ** MI_DestinationOptions_GetCredentialsCount()
8913 **
8914 **=============================================================================
8915 */
8916 MI_INLINE MI_Result MI_DestinationOptions_GetCredentialsCount(
8917 _In_ MI_DestinationOptions *options,
8918 _Out_ MI_Uint32 *count)
8919 {
8920 if (options && options->ft)
8921 {
8922 return options->ft->GetCredentialsCount(options, count);
8923 }
8924 else
8925 {
8926 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
8927 }
8928 }
8929
8930
8931 /*
8932 **=============================================================================
8933 **
8934 ** MI_DestinationOptions_GetCredentialsAt()
8935 **
8936 **=============================================================================
8937 */
8938 MI_INLINE MI_Result MI_DestinationOptions_GetCredentialsAt(
8939 _In_ MI_DestinationOptions *options,
8940 MI_Uint32 index,
8941 _Outptr_result_z_ const MI_Char **optionName,
8942 _Out_ MI_UserCredentials *credentials, // output credentials always has password set to '******'
8943 _Out_opt_ MI_Uint32 *flags)
8944 {
8945 if (options && options->ft)
8946 {
8947 mike 1.1 return options->ft->GetCredentialsAt(options, index, optionName, credentials, flags);
8948 }
8949 else
8950 {
8951 return MI_RESULT_INVALID_PARAMETER;
8952 }
8953 }
8954
8955
8956 /*
8957 **=============================================================================
8958 **
8959 ** MI_DestinationOptions_GetCredentialsPasswordAt()
8960 **
8961 **=============================================================================
8962 */
8963 MI_INLINE MI_Result MI_DestinationOptions_GetCredentialsPasswordAt(
8964 _In_ MI_DestinationOptions *options,
8965 MI_Uint32 index,
8966 _Outptr_result_z_ const MI_Char **optionName,
8967 _Out_writes_to_opt_(bufferLength, *passwordLength) MI_Char *password,
8968 mike 1.1 _In_ MI_Uint32 bufferLength,
8969 _Out_ MI_Uint32 *passwordLength,
8970 _Out_opt_ MI_Uint32 *flags)
8971 {
8972 if (options && options->ft)
8973 {
8974 return options->ft->GetCredentialsPasswordAt(options, index, optionName, password, bufferLength, passwordLength, flags);
8975 }
8976 else
8977 {
8978 return MI_RESULT_INVALID_PARAMETER;
8979 }
8980 }
8981
8982 /*
8983 **=============================================================================
8984 **
8985 ** MI_DestinationOptions_Clone()
8986 **
8987 ** This function creates a copy of the given MI_DestinationOptions. Upon
8988 ** a successful return, new MI_DestinationOptions points to a newly
8989 mike 1.1 ** created destination options object.
8990 ** The new destination options should eventually be passed to MI_DestinationOptions_Delete().
8991 **
8992 ** param: self pointer to the destination options to be cloned.
8993 ** param: newDestinationOptions a pointer to the new destination options upon return.
8994 **
8995 ** return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
8996 **
8997 ** See also: MI_DestinationOptions_Delete()
8998 **
8999 **=============================================================================
9000 */
9001 MI_INLINE MI_Result MI_CALL MI_DestinationOptions_Clone(
9002 _In_ const MI_DestinationOptions* self,
9003 _Out_ MI_DestinationOptions* newDestinationOptions)
9004 {
9005 if (self && self->ft)
9006 {
9007 return self->ft->Clone(self, newDestinationOptions);
9008 }
9009 else
9010 mike 1.1 {
9011 return MI_RESULT_INVALID_PARAMETER;
9012 }
9013 }
9014
9015 /*
9016 **=============================================================================
9017 **
9018 ** MI_OperationOptions_Delete()
9019 **
9020 **=============================================================================
9021 */
9022 MI_INLINE void MI_OperationOptions_Delete(
9023 _Inout_ MI_OperationOptions *options)
9024 {
9025 if (options && options->ft)
9026 {
9027 options->ft->Delete(options);
9028 }
9029 }
9030
9031 mike 1.1 /*
9032 **=============================================================================
9033 **
9034 ** MI_OperationOptions_SetWriteErrorMode()
9035 **
9036 **=============================================================================
9037 */
9038 MI_INLINE MI_Result MI_OperationOptions_SetWriteErrorMode(
9039 _Inout_ MI_OperationOptions *options,
9040 _In_ MI_CallbackMode mode)
9041 {
9042 if (options && options->ft)
9043 {
9044 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_WRITEERRORMODE"), mode, 0);
9045 }
9046 else
9047 {
9048 return MI_RESULT_INVALID_PARAMETER;
9049 }
9050 }
9051
9052 mike 1.1 /*
9053 **=============================================================================
9054 **
9055 ** MI_OperationOptions_GetWriteErrorMode()
9056 **
9057 **=============================================================================
9058 */
9059 MI_INLINE MI_Result MI_OperationOptions_GetWriteErrorMode(
9060 _In_ MI_OperationOptions *options,
9061 _Out_ MI_CallbackMode *mode)
9062 {
9063 if (options && options->ft)
9064 {
9065 MI_Uint32 value;
9066 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_WRITEERRORMODE"), &value, 0, 0);
9067 if (result == MI_RESULT_OK)
9068 *mode = (MI_CallbackMode) value;
9069 return result;
9070 }
9071 else
9072 {
9073 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
9074 }
9075 }
9076
9077 /*
9078 **=============================================================================
9079 **
9080 ** MI_OperationOptions_SetPromptUserMode()
9081 **
9082 **=============================================================================
9083 */
9084 MI_INLINE MI_Result MI_OperationOptions_SetPromptUserMode(
9085 _Inout_ MI_OperationOptions *options,
9086 _In_ MI_CallbackMode mode)
9087 {
9088 if (options && options->ft)
9089 {
9090 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROMPTUSERMODE"), mode, 0);
9091 }
9092 else
9093 {
9094 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
9095 }
9096 }
9097
9098
9099
9100
9101 /*
9102 **=============================================================================
9103 **
9104 ** MI_OperationOptions_GetPromptUserMode()
9105 **
9106 **=============================================================================
9107 */
9108 MI_INLINE MI_Result MI_OperationOptions_GetPromptUserMode(
9109 _In_ MI_OperationOptions *options,
9110 _Out_ MI_CallbackMode *mode)
9111 {
9112 if (options && options->ft)
9113 {
9114 MI_Uint32 value;
9115 mike 1.1 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROMPTUSERMODE"), &value, 0, 0);
9116 if (result == MI_RESULT_OK)
9117 *mode = (MI_CallbackMode) value;
9118 return result;
9119 }
9120 else
9121 {
9122 return MI_RESULT_INVALID_PARAMETER;
9123 }
9124 }
9125
9126 /*
9127 **=============================================================================
9128 **
9129 ** MI_OperationOptions_SetPromptUserRegularMode()
9130 **
9131 **=============================================================================
9132 */
9133 MI_INLINE MI_Result MI_OperationOptions_SetPromptUserRegularMode(
9134 _Inout_ MI_OperationOptions *options,
9135 _In_ MI_CallbackMode mode,
9136 mike 1.1 _In_ MI_Boolean ackValue)
9137 {
9138 if (options && options->ft)
9139 {
9140 MI_Result result = options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROMPTUSERMODE"), mode, 0);
9141 if( result == MI_RESULT_OK)
9142 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROMPTUSERMODEREGULAR_ACKVALUE"), ackValue, 0);
9143 else
9144 return result;
9145 }
9146 else
9147 {
9148 return MI_RESULT_INVALID_PARAMETER;
9149 }
9150 }
9151
9152 /*
9153 **=============================================================================
9154 **
9155 ** MI_OperationOptions_GetPromptUserRegularMode()
9156 **
9157 mike 1.1 **=============================================================================
9158 */
9159 MI_INLINE MI_Result MI_OperationOptions_GetPromptUserRegularMode(
9160 _Inout_ MI_OperationOptions *options,
9161 _Out_ MI_CallbackMode *mode,
9162 _Out_ MI_Boolean *ackValue)
9163 {
9164 if (options && options->ft)
9165 {
9166 MI_Uint32 _mode;
9167 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROMPTUSERMODE"), &_mode, 0, 0);
9168 if( result == MI_RESULT_OK)
9169 {
9170 MI_Uint32 _ackValue;
9171 result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROMPTUSERMODEREGULAR_ACKVALUE"), &_ackValue, 0, 0);
9172 if( result == MI_RESULT_OK)
9173 {
9174 *mode = (MI_CallbackMode)_mode;
9175 *ackValue = (MI_Boolean) _ackValue;
9176 }
9177 }
9178 mike 1.1 return result;
9179 }
9180 else
9181 {
9182 return MI_RESULT_INVALID_PARAMETER;
9183 }
9184 }
9185
9186
9187
9188 /*
9189 **=============================================================================
9190 **
9191 ** MI_OperationOptions_SetProviderArchitecture()
9192 **
9193 **=============================================================================
9194 */
9195 MI_INLINE MI_Result MI_OperationOptions_SetProviderArchitecture(
9196 _Inout_ MI_OperationOptions *options,
9197 _In_ MI_ProviderArchitecture architecture,
9198 _In_ MI_Boolean mustComply)
9199 mike 1.1 {
9200 if (options && options->ft)
9201 {
9202 MI_Result result = options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROVIDER_ARCHITECTURE"), architecture, 0);
9203 if(result == MI_RESULT_OK)
9204 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_REQUIRED_ARCHITECTURE"), mustComply, 0);
9205 else
9206 return result;
9207 }
9208 else
9209 {
9210 return MI_RESULT_INVALID_PARAMETER;
9211 }
9212 }
9213
9214 /*
9215 **=============================================================================
9216 **
9217 ** MI_OperationOptions_GetProviderArchitecture()
9218 **
9219 **=============================================================================
9220 mike 1.1 */
9221 MI_INLINE MI_Result MI_OperationOptions_GetProviderArchitecture(
9222 _In_ MI_OperationOptions *options,
9223 _Out_ MI_ProviderArchitecture *architecture,
9224 _Out_ MI_Boolean *mustComply)
9225 {
9226 if (options && options->ft)
9227 {
9228 MI_Uint32 _architecture;
9229 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_PROVIDER_ARCHITECTURE"), &_architecture, 0, 0);
9230 if(result == MI_RESULT_OK)
9231 {
9232 MI_Uint32 _mustComply;
9233 result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_REQUIRED_ARCHITECTURE"), &_mustComply, 0, 0);
9234 if(result == MI_RESULT_OK)
9235 {
9236 *architecture = (MI_ProviderArchitecture)_architecture;
9237 *mustComply = (MI_Boolean)_mustComply;
9238 }
9239 }
9240 return result;
9241 mike 1.1 }
9242 else
9243 {
9244 return MI_RESULT_INVALID_PARAMETER;
9245 }
9246 }
9247
9248 /*
9249 **=============================================================================
9250 **
9251 ** MI_OperationOptions_EnableChannel()
9252 **
9253 **=============================================================================
9254 */
9255 MI_INLINE MI_Result MI_OperationOptions_EnableChannel(
9256 _Inout_ MI_OperationOptions *options,
9257 _In_ MI_Uint32 channel)
9258 {
9259 if (options && options->ft)
9260 {
9261 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_CHANNEL"), channel, 0);
9262 mike 1.1 }
9263 else
9264 {
9265 return MI_RESULT_INVALID_PARAMETER;
9266 }
9267 }
9268
9269 /*
9270 **=============================================================================
9271 **
9272 ** MI_OperationOptions_DisableChannel()
9273 **
9274 **=============================================================================
9275 */
9276 MI_INLINE MI_Result MI_OperationOptions_DisableChannel(
9277 _Inout_ MI_OperationOptions *options,
9278 _In_ MI_Uint32 channel)
9279 {
9280 if (options && options->ft)
9281 {
9282 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_CHANNEL"), channel, 1);
9283 mike 1.1 }
9284 else
9285 {
9286 return MI_RESULT_INVALID_PARAMETER;
9287 }
9288 }
9289
9290 /*
9291 **=============================================================================
9292 **
9293 ** MI_OperationOptions_GetEnabledChannels()
9294 **
9295 **=============================================================================
9296 */
9297 MI_INLINE MI_Result MI_OperationOptions_GetEnabledChannels(
9298 _In_ MI_OperationOptions *options,
9299 _Out_writes_to_opt_(bufferLength, *channelCount) MI_Uint32 *channels,
9300 _In_ MI_Uint32 bufferLength,
9301 _Out_ MI_Uint32 *channelCount,
9302 _Out_opt_ MI_Uint32 *flags)
9303 {
9304 mike 1.1 if (options && options->ft)
9305 {
9306 return options->ft->GetEnabledChannels(options, MI_T("__MI_OPERATIONOPTIONS_CHANNEL"), channels, bufferLength, channelCount, flags);
9307 }
9308 else
9309 {
9310 return MI_RESULT_INVALID_PARAMETER;
9311 }
9312 }
9313
9314 /*
9315 **=============================================================================
9316 **
9317 ** MI_OperationOptions_SetTimeout()
9318 **
9319 **=============================================================================
9320 */
9321 MI_INLINE MI_Result MI_OperationOptions_SetTimeout(
9322 _Inout_ MI_OperationOptions *options,
9323 _In_ const MI_Interval *timeout)
9324 {
9325 mike 1.1 if (options && options->ft)
9326 {
9327 return options->ft->SetInterval(options, MI_T("__MI_OPERATIONOPTIONS_TIMEOUT"), timeout, 0);
9328 }
9329 else
9330 {
9331 return MI_RESULT_INVALID_PARAMETER;
9332 }
9333 }
9334
9335 /*
9336 **=============================================================================
9337 **
9338 ** MI_OperationOptions_GetTimeout()
9339 **
9340 **=============================================================================
9341 */
9342 MI_INLINE MI_Result MI_OperationOptions_GetTimeout(
9343 _In_ MI_OperationOptions *options,
9344 _Out_ MI_Interval *timeout)
9345 {
9346 mike 1.1 if (options && options->ft)
9347 {
9348 return options->ft->GetInterval(options, MI_T("__MI_OPERATIONOPTIONS_TIMEOUT"), timeout, 0, 0);
9349 }
9350 else
9351 {
9352 return MI_RESULT_INVALID_PARAMETER;
9353 }
9354 }
9355
9356 /*
9357 **=============================================================================
9358 **
9359 ** MI_OperationOptions_SetResourceUriPrefix()
9360 **
9361 **=============================================================================
9362 */
9363 MI_INLINE MI_Result MI_OperationOptions_SetResourceUriPrefix(
9364 _Inout_ MI_OperationOptions *options,
9365 _In_z_ const MI_Char *ruriPrefix)
9366 {
9367 mike 1.1 if (options && options->ft)
9368 {
9369 return options->ft->SetString(options, MI_T("__MI_OPERATIONOPTIONS_RESOURCE_URI_PREFIX"), ruriPrefix, 0);
9370 }
9371 else
9372 {
9373 return MI_RESULT_INVALID_PARAMETER;
9374 }
9375 }
9376
9377 /*
9378 **=============================================================================
9379 **
9380 ** MI_OperationOptions_GetResourceUriPrefix()
9381 **
9382 **=============================================================================
9383 */
9384 MI_INLINE MI_Result MI_OperationOptions_GetResourceUriPrefix(
9385 _In_ MI_OperationOptions *options,
9386 _Outptr_result_z_ const MI_Char **ruriPrefix)
9387 {
9388 mike 1.1 if (options && options->ft)
9389 {
9390 return options->ft->GetString(options, MI_T("__MI_OPERATIONOPTIONS_RESOURCE_URI_PREFIX"), ruriPrefix, 0, 0);
9391 }
9392 else
9393 {
9394 return MI_RESULT_INVALID_PARAMETER;
9395 }
9396 }
9397
9398 /*
9399 **=============================================================================
9400 **
9401 ** MI_OperationOptions_SetResourceUri()
9402 **
9403 **=============================================================================
9404 */
9405 MI_INLINE MI_Result MI_OperationOptions_SetResourceUri(
9406 _Inout_ MI_OperationOptions *options,
9407 _In_z_ const MI_Char *rUri)
9408 {
9409 mike 1.1 if (options && options->ft)
9410 {
9411 return options->ft->SetString(options, MI_T("__MI_OPERATIONOPTIONS_RESOURCE_URI"), rUri, 0);
9412 }
9413 else
9414 {
9415 return MI_RESULT_INVALID_PARAMETER;
9416 }
9417 }
9418
9419 /*
9420 **=============================================================================
9421 **
9422 ** MI_OperationOptions_GetResourceUri()
9423 **
9424 **=============================================================================
9425 */
9426 MI_INLINE MI_Result MI_OperationOptions_GetResourceUri(
9427 _In_ MI_OperationOptions *options,
9428 _Outptr_result_z_ const MI_Char **rUri)
9429 {
9430 mike 1.1 if (options && options->ft)
9431 {
9432 return options->ft->GetString(options, MI_T("__MI_OPERATIONOPTIONS_RESOURCE_URI"), rUri, 0, 0);
9433 }
9434 else
9435 {
9436 return MI_RESULT_INVALID_PARAMETER;
9437 }
9438 }
9439
9440
9441 /*
9442 **=============================================================================
9443 **
9444 ** MI_OperationOptions_SetUseMachineID()
9445 **
9446 **=============================================================================
9447 */
9448 MI_INLINE MI_Result MI_OperationOptions_SetUseMachineID(
9449 _Inout_ MI_OperationOptions *options,
9450 _In_ MI_Boolean machineID)
9451 mike 1.1 {
9452 if (options && options->ft)
9453 {
9454 return options->ft->SetNumber(options, MI_T("__MI_OPERATIONOPTIONS_USE_MACHINE_ID"), machineID, 0);
9455 }
9456 else
9457 {
9458 return MI_RESULT_INVALID_PARAMETER;
9459 }
9460 }
9461
9462 /*
9463 **=============================================================================
9464 **
9465 ** MI_OperationOptions_GetUseMachineID()
9466 **
9467 **=============================================================================
9468 */
9469 MI_INLINE MI_Result MI_OperationOptions_GetUseMachineID(
9470 _In_ MI_OperationOptions *options,
9471 _Out_ MI_Boolean *machineID)
9472 mike 1.1 {
9473 if (options && options->ft)
9474 {
9475 MI_Uint32 value;
9476 MI_Result result = options->ft->GetNumber(options, MI_T("__MI_OPERATIONOPTIONS_USE_MACHINE_ID"), &value, 0, 0);
9477 if (result == MI_RESULT_OK)
9478 *machineID = (MI_Boolean) value;
9479 return result;
9480 }
9481 else
9482 {
9483 return MI_RESULT_INVALID_PARAMETER;
9484 }
9485 }
9486
9487 /*
9488 **=============================================================================
9489 **
9490 ** MI_OperationOptions_SetCustomOption()
9491 **
9492 **=============================================================================
9493 mike 1.1 */
9494 MI_INLINE MI_Result MI_OperationOptions_SetCustomOption(
9495 _Inout_ MI_OperationOptions *options,
9496 _In_z_ const MI_Char *optionName,
9497 _In_ MI_Type optionValueType,
9498 _In_ const MI_Value *optionValue,
9499 MI_Boolean mustComply)
9500 {
9501 if (options && options->ft)
9502 {
9503 return options->ft->SetCustomOption(options, optionName, optionValueType, optionValue, mustComply, 0);
9504 }
9505 else
9506 {
9507 return MI_RESULT_INVALID_PARAMETER;
9508 }
9509 }
9510
9511 /*
9512 **=============================================================================
9513 **
9514 mike 1.1 ** MI_OperationOptions_GetOptionCount()
9515 **
9516 **=============================================================================
9517 */
9518 MI_INLINE MI_Result MI_OperationOptions_GetOptionCount(
9519 _In_ MI_OperationOptions *options,
9520 _Out_ MI_Uint32 *count)
9521 {
9522 if (options && options->ft)
9523 {
9524 return options->ft->GetOptionCount(options, count);
9525 }
9526 else
9527 {
9528 return MI_RESULT_INVALID_PARAMETER;
9529 }
9530 }
9531
9532 /*
9533 **=============================================================================
9534 **
9535 mike 1.1 ** MI_OperationOptions_GetOptionAt()
9536 **
9537 **=============================================================================
9538 */
9539 MI_INLINE MI_Result MI_OperationOptions_GetOptionAt(
9540 _In_ MI_OperationOptions *options,
9541 MI_Uint32 index,
9542 _Outptr_result_z_ const MI_Char **optionName,
9543 _Out_ MI_Value *value,
9544 _Out_ MI_Type *type,
9545 _Out_opt_ MI_Uint32 *flags)
9546 {
9547 if (options && options->ft)
9548 {
9549 return options->ft->GetOptionAt(options, index, optionName, value, type, flags);
9550 }
9551 else
9552 {
9553 return MI_RESULT_INVALID_PARAMETER;
9554 }
9555 }
9556 mike 1.1
9557 /*
9558 **=============================================================================
9559 **
9560 ** MI_OperationOptions_SetString()
9561 **
9562 **=============================================================================
9563 */
9564 MI_INLINE MI_Result MI_OperationOptions_SetString(
9565 _Inout_ MI_OperationOptions *options,
9566 _In_z_ const MI_Char *optionName,
9567 _In_z_ const MI_Char *value,
9568 MI_Uint32 flags)
9569 {
9570 if (options && options->ft)
9571 {
9572 return options->ft->SetString(options, optionName, value, flags);
9573 }
9574 else
9575 {
9576 return MI_RESULT_INVALID_PARAMETER;
9577 mike 1.1 }
9578 }
9579
9580 /*
9581 **=============================================================================
9582 **
9583 ** MI_OperationOptions_GetString()
9584 **
9585 **=============================================================================
9586 */
9587 MI_INLINE MI_Result MI_OperationOptions_GetString(
9588 _In_ MI_OperationOptions *options,
9589 _In_z_ const MI_Char *optionName,
9590 _Outptr_result_z_ const MI_Char **value,
9591 _Out_opt_ MI_Uint32 *index,
9592 _Out_opt_ MI_Uint32 *flags)
9593 {
9594 if (options && options->ft)
9595 {
9596 return options->ft->GetString(options, optionName, value, index, flags);
9597 }
9598 mike 1.1 else
9599 {
9600 return MI_RESULT_INVALID_PARAMETER;
9601 }
9602 }
9603
9604 /*
9605 **=============================================================================
9606 **
9607 ** MI_OperationOptions_SetNumber()
9608 **
9609 **=============================================================================
9610 */
9611 MI_INLINE MI_Result MI_OperationOptions_SetNumber(
9612 _Inout_ MI_OperationOptions *options,
9613 _In_z_ const MI_Char *optionName,
9614 _In_ MI_Uint32 value,
9615 MI_Uint32 flags)
9616 {
9617 if (options && options->ft)
9618 {
9619 mike 1.1 return options->ft->SetNumber(options, optionName, value, flags);
9620 }
9621 else
9622 {
9623 return MI_RESULT_INVALID_PARAMETER;
9624 }
9625 }
9626
9627 /*
9628 **=============================================================================
9629 **
9630 ** MI_OperationOptions_GetNumber()
9631 **
9632 **=============================================================================
9633 */
9634 MI_INLINE MI_Result MI_OperationOptions_GetNumber(
9635 _In_ MI_OperationOptions *options,
9636 _In_z_ const MI_Char *optionName,
9637 _Out_ MI_Uint32 *value,
9638 _Out_opt_ MI_Uint32 *index,
9639 _Out_opt_ MI_Uint32 *flags)
9640 mike 1.1 {
9641 if (options && options->ft)
9642 {
9643 return options->ft->GetNumber(options, optionName, value, index, flags);
9644 }
9645 else
9646 {
9647 return MI_RESULT_INVALID_PARAMETER;
9648 }
9649 }
9650
9651 /*
9652 **=============================================================================
9653 **
9654 ** MI_OperationOptions_GetOption()
9655 **
9656 **=============================================================================
9657 */
9658 MI_INLINE MI_Result MI_OperationOptions_GetOption(
9659 _In_ MI_OperationOptions *options,
9660 _In_z_ const MI_Char *optionName,
9661 mike 1.1 _Out_ MI_Value *value,
9662 _Out_ MI_Type *type,
9663 _Out_opt_ MI_Uint32 *index,
9664 _Out_opt_ MI_Uint32 *flags)
9665 {
9666 if (options && options->ft)
9667 {
9668 return options->ft->GetOption(options, optionName, value, type, index, flags);
9669 }
9670 else
9671 {
9672 return MI_RESULT_INVALID_PARAMETER;
9673 }
9674 }
9675
9676 /*
9677 **=============================================================================
9678 **
9679 ** MI_OperationOptions_Clone()
9680 **
9681 ** This function creates a copy of the given MI_OperationOptions. Upon
9682 mike 1.1 ** a successful return, new MI_OperationOptions points to a newly
9683 ** created operation options object.
9684 ** The new operation options should eventually be passed to MI_OperationOptions_Delete().
9685 **
9686 ** param: self pointer to the operation options to be cloned.
9687 ** param: newOperationOptions a pointer to the new operation options upon return.
9688 **
9689 ** return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
9690 **
9691 ** See also: MI_OperationOptions_Delete()
9692 **
9693 **=============================================================================
9694 */
9695 MI_INLINE MI_Result MI_CALL MI_OperationOptions_Clone(
9696 _In_ const MI_OperationOptions* self,
9697 _Out_ MI_OperationOptions* newOperationOptions)
9698 {
9699 if (self && self->ft)
9700 {
9701 return self->ft->Clone(self, newOperationOptions);
9702 }
9703 mike 1.1 else
9704 {
9705 return MI_RESULT_INVALID_PARAMETER;
9706 }
9707 }
9708
9709
9710 MI_INLINE MI_Result MI_Class_GetClassName(
9711 _In_ const MI_Class* self,
9712 _Outptr_result_maybenull_z_ const MI_Char** className)
9713 {
9714 if (self && self->ft)
9715 {
9716 return self->ft->GetClassName(self, className);
9717 }
9718 else
9719 {
9720 return MI_RESULT_INVALID_PARAMETER;
9721 }
9722 }
9723
9724 mike 1.1 MI_INLINE MI_Result MI_Class_GetNameSpace(
9725 _In_ const MI_Class* self,
9726 _Outptr_result_maybenull_z_ const MI_Char** nameSpace)
9727 {
9728 if (self && self->ft)
9729 {
9730 return self->ft->GetNameSpace(self, nameSpace);
9731 }
9732 else
9733 {
9734 return MI_RESULT_INVALID_PARAMETER;
9735 }
9736 }
9737
9738
9739 MI_INLINE MI_Result MI_Class_GetServerName(
9740 _In_ const MI_Class* self,
9741 _Outptr_result_maybenull_z_ const MI_Char** serverName)
9742 {
9743 if (self && self->ft)
9744 {
9745 mike 1.1 return self->ft->GetServerName(self, serverName);
9746 }
9747 else
9748 {
9749 return MI_RESULT_INVALID_PARAMETER;
9750 }
9751 }
9752
9753
9754 MI_INLINE MI_Result MI_Class_GetElementCount(
9755 _In_ const MI_Class* self,
9756 _Out_ MI_Uint32* count)
9757 {
9758 if (self && self->ft)
9759 {
9760 return self->ft->GetElementCount(self, count);
9761 }
9762 else
9763 {
9764 return MI_RESULT_INVALID_PARAMETER;
9765 }
9766 mike 1.1 }
9767
9768
9769 MI_INLINE MI_Result MI_Class_GetElement(
9770 _In_ const MI_Class* self,
9771 _In_z_ const MI_Char* name,
9772 _Out_opt_ MI_Value* value,
9773 _Out_opt_ MI_Boolean* valueExists,
9774 _Out_opt_ MI_Type* type,
9775 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
9776 _Out_opt_ MI_QualifierSet *qualifierSet,
9777 _Out_opt_ MI_Uint32* flags,
9778 _Out_opt_ MI_Uint32* index)
9779 {
9780 if (self && self->ft)
9781 {
9782 return self->ft->GetElement(self, name, value, valueExists, type, referenceClass, qualifierSet, flags, index);
9783 }
9784 else
9785 {
9786 return MI_RESULT_INVALID_PARAMETER;
9787 mike 1.1 }
9788 }
9789
9790
9791 MI_INLINE MI_Result MI_Class_GetElementAt(
9792 _In_ const MI_Class* self,
9793 MI_Uint32 index,
9794 _Outptr_opt_result_maybenull_z_ const MI_Char** name,
9795 _Out_opt_ MI_Value* value,
9796 _Out_opt_ MI_Boolean* valueExists,
9797 _Out_opt_ MI_Type* type,
9798 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
9799 _Out_opt_ MI_QualifierSet *qualifierSet,
9800 _Out_opt_ MI_Uint32* flags)
9801 {
9802 if (self && self->ft)
9803 {
9804 return self->ft->GetElementAt(self, index, name, value, valueExists, type, referenceClass, qualifierSet, flags);
9805 }
9806 else
9807 {
9808 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
9809 }
9810 }
9811
9812 MI_INLINE MI_Result MI_Class_GetClassQualifierSet(
9813 _In_ const MI_Class* self,
9814 _Out_opt_ MI_QualifierSet *qualifierSet
9815 )
9816 {
9817 if (self && self->ft)
9818 {
9819 return self->ft->GetClassQualifierSet(self, qualifierSet);
9820 }
9821 else
9822 {
9823 return MI_RESULT_INVALID_PARAMETER;
9824 }
9825 }
9826
9827 MI_INLINE MI_Result MI_Class_GetMethodCount(
9828 _In_ const MI_Class* self,
9829 mike 1.1 _Out_ MI_Uint32* count)
9830 {
9831 if (self && self->ft)
9832 {
9833 return self->ft->GetMethodCount(self, count);
9834 }
9835 else
9836 {
9837 return MI_RESULT_INVALID_PARAMETER;
9838 }
9839 }
9840
9841 MI_INLINE MI_Result MI_Class_GetMethodAt(
9842 _In_ const MI_Class *self,
9843 MI_Uint32 index,
9844 _Outptr_result_z_ const MI_Char **name,
9845 _Out_opt_ MI_QualifierSet *qualifierSet,
9846 _Out_opt_ MI_ParameterSet *parameterSet)
9847 {
9848 if (self && self->ft)
9849 {
9850 mike 1.1 return self->ft->GetMethodAt(self, index, name, qualifierSet, parameterSet);
9851 }
9852 else
9853 {
9854 return MI_RESULT_INVALID_PARAMETER;
9855 }
9856 }
9857
9858 MI_INLINE MI_Result MI_Class_GetMethod(
9859 _In_ const MI_Class *self,
9860 _In_z_ const MI_Char *name,
9861 _Out_opt_ MI_QualifierSet *qualifierSet,
9862 _Out_opt_ MI_ParameterSet *parameterSet,
9863 _Out_opt_ MI_Uint32 *index)
9864 {
9865 if (self && self->ft)
9866 {
9867 return self->ft->GetMethod(self, name, qualifierSet, parameterSet, index);
9868 }
9869 else
9870 {
9871 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
9872 }
9873 }
9874
9875 MI_INLINE MI_Result MI_Class_GetParentClassName(
9876 _In_ const MI_Class *self,
9877 _Outptr_result_maybenull_z_ const MI_Char **name)
9878 {
9879 if (self && self->ft)
9880 {
9881 return self->ft->GetParentClassName(self, name);
9882 }
9883 else
9884 {
9885 return MI_RESULT_INVALID_PARAMETER;
9886 }
9887 }
9888
9889 MI_INLINE MI_Result MI_Class_GetParentClass(
9890 _In_ const MI_Class *self,
9891 _Outptr_ MI_Class **parentClass)
9892 mike 1.1 {
9893 if (self && self->ft)
9894 {
9895 return self->ft->GetParentClass(self, parentClass);
9896 }
9897 else
9898 {
9899 return MI_RESULT_INVALID_PARAMETER;
9900 }
9901 }
9902
9903 MI_INLINE MI_Result MI_Class_Delete(
9904 _Inout_ MI_Class* self)
9905 {
9906 if (self && self->ft)
9907 {
9908 return self->ft->Delete(self);
9909 }
9910 else
9911 {
9912 return MI_RESULT_INVALID_PARAMETER;
9913 mike 1.1 }
9914 }
9915
9916 MI_INLINE MI_Result MI_CALL MI_Class_Clone(
9917 _In_ const MI_Class* self,
9918 _Outptr_ MI_Class** newClass)
9919 {
9920 if (self && self->ft)
9921 {
9922 return self->ft->Clone(self, newClass);
9923 }
9924 else
9925 {
9926 return MI_RESULT_INVALID_PARAMETER;
9927 }
9928 }
9929
9930
9931 MI_INLINE MI_Result MI_ParameterSet_GetMethodReturnType(
9932 _In_ const MI_ParameterSet *self,
9933 _Out_ MI_Type *returnType,
9934 mike 1.1 _Out_ MI_QualifierSet *qualifierSet)
9935 {
9936 if (self && self->ft)
9937 {
9938 return self->ft->GetMethodReturnType(self, returnType, qualifierSet);
9939 }
9940 else
9941 {
9942 return MI_RESULT_INVALID_PARAMETER;
9943 }
9944 }
9945
9946 MI_INLINE MI_Result MI_ParameterSet_GetParameterCount(
9947 _In_ const MI_ParameterSet *self,
9948 _Out_ MI_Uint32 *count)
9949 {
9950 if (self && self->ft)
9951 {
9952 return self->ft->GetParameterCount(self, count);
9953 }
9954 else
9955 mike 1.1 {
9956 return MI_RESULT_INVALID_PARAMETER;
9957 }
9958 }
9959
9960 MI_INLINE MI_Result MI_ParameterSet_GetParameterAt(
9961 _In_ const MI_ParameterSet *self,
9962 MI_Uint32 index,
9963 _Outptr_result_z_ const MI_Char **name,
9964 _Out_ MI_Type *parameterType,
9965 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
9966 _Out_ MI_QualifierSet *qualifierSet)
9967 {
9968 if (self && self->ft)
9969 {
9970 return self->ft->GetParameterAt(self, index, name, parameterType, referenceClass, qualifierSet);
9971 }
9972 else
9973 {
9974 return MI_RESULT_INVALID_PARAMETER;
9975 }
9976 mike 1.1 }
9977
9978 MI_INLINE MI_Result MI_ParameterSet_GetParameter(
9979 _In_ const MI_ParameterSet *self,
9980 _In_z_ const MI_Char *name,
9981 _Out_ MI_Type *parameterType,
9982 _Outptr_opt_result_maybenull_z_ MI_Char **referenceClass,
9983 _Out_ MI_QualifierSet *qualifierSet,
9984 _Out_ MI_Uint32 *index)
9985 {
9986 if (self && self->ft)
9987 {
9988 return self->ft->GetParameter(self, name, parameterType, referenceClass, qualifierSet, index);
9989 }
9990 else
9991 {
9992 return MI_RESULT_INVALID_PARAMETER;
9993 }
9994 }
9995
9996 MI_INLINE MI_Result MI_QualifierSet_GetQualifierCount(
9997 mike 1.1 _In_ const MI_QualifierSet *self,
9998 _Out_ MI_Uint32 *count)
9999 {
10000 if (self && self->ft)
10001 {
10002 return self->ft->GetQualifierCount(self, count);
10003 }
10004 else
10005 {
10006 return MI_RESULT_INVALID_PARAMETER;
10007 }
10008 }
10009
10010 MI_INLINE MI_Result MI_QualifierSet_GetQualifierAt(
10011 _In_ const MI_QualifierSet *self,
10012 MI_Uint32 index,
10013 _Outptr_result_z_ const MI_Char **name,
10014 _Out_ MI_Type *qualifierType,
10015 _Out_ MI_Uint32 *qualifierFlags, /* scope information */
10016 _Out_ MI_Value *qualifierValue)
10017 {
10018 mike 1.1 if (self && self->ft)
10019 {
10020 return self->ft->GetQualifierAt(self, index, name, qualifierType, qualifierFlags, qualifierValue);
10021 }
10022 else
10023 {
10024 return MI_RESULT_INVALID_PARAMETER;
10025 }
10026 }
10027
10028 MI_INLINE MI_Result MI_QualifierSet_GetQualifier(
10029 _In_ const MI_QualifierSet *self,
10030 _In_z_ const MI_Char *name,
10031 _Out_ MI_Type *qualifierType,
10032 _Out_ MI_Uint32 *qualifierFlags, /* scope information */
10033 _Out_ MI_Value *qualifierValue,
10034 _Out_ MI_Uint32 *index)
10035 {
10036 if (self && self->ft)
10037 {
10038 return self->ft->GetQualifier(self, name, qualifierType, qualifierFlags, qualifierValue, index);
10039 mike 1.1 }
10040 else
10041 {
10042 return MI_RESULT_INVALID_PARAMETER;
10043 }
10044 }
10045
10046 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetMaximumLatency(
10047 _Inout_ MI_SubscriptionDeliveryOptions *self,
10048 _In_ MI_Interval *value)
10049 {
10050 if (self && self->ft)
10051 {
10052 return self->ft->SetInterval(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_MAXIMUM_LATENCY"), value, 0);
10053 }
10054 else
10055 {
10056 return MI_RESULT_INVALID_PARAMETER;
10057 }
10058 }
10059
10060 mike 1.1 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetMaximumLatency(
10061 _In_ MI_SubscriptionDeliveryOptions *self,
10062 _Out_ MI_Interval *value)
10063 {
10064 if (self && self->ft)
10065 {
10066 return self->ft->GetInterval(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_MAXIMUM_LATENCY"), value, 0, 0);
10067 }
10068 else
10069 {
10070 return MI_RESULT_INVALID_PARAMETER;
10071 }
10072 }
10073
10074 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetHeartbeatInterval(
10075 _Inout_ MI_SubscriptionDeliveryOptions *self,
10076 _In_ MI_Interval *value)
10077 {
10078 if (self && self->ft)
10079 {
10080 return self->ft->SetInterval(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_HEARTBEAT_INTERVAL"), value, 0);
10081 mike 1.1 }
10082 else
10083 {
10084 return MI_RESULT_INVALID_PARAMETER;
10085 }
10086 }
10087
10088 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetHeartbeatInterval(
10089 _In_ MI_SubscriptionDeliveryOptions *self,
10090 _Out_ MI_Interval *value)
10091 {
10092 if (self && self->ft)
10093 {
10094 return self->ft->GetInterval(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_HEARTBEAT_INTERVAL"), value, 0, 0);
10095 }
10096 else
10097 {
10098 return MI_RESULT_INVALID_PARAMETER;
10099 }
10100 }
10101
10102 mike 1.1 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetExpirationTime(
10103 _Inout_ MI_SubscriptionDeliveryOptions *self,
10104 _In_ MI_Datetime *value)
10105 {
10106 if (self && self->ft)
10107 {
10108 return self->ft->SetDateTime(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_EXPIRATION_TIME"), value, 0);
10109 }
10110 else
10111 {
10112 return MI_RESULT_INVALID_PARAMETER;
10113 }
10114 }
10115
10116 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetExpirationTime(
10117 _Inout_ MI_SubscriptionDeliveryOptions *self,
10118 _Out_ MI_Datetime *value)
10119 {
10120 if (self && self->ft)
10121 {
10122 return self->ft->GetDateTime(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_EXPIRATION_TIME"), value, 0, 0);
10123 mike 1.1 }
10124 else
10125 {
10126 return MI_RESULT_INVALID_PARAMETER;
10127 }
10128 }
10129
10130 /* If bookmarks are required for subscriptions a bookmark needs to be set.
10131 * To indicate you want the indication events to start delivering from the
10132 * oldest possible event that is available use MI_SUBSCRIBE_BOOKMARK_OLDEST.
10133 * To start delivering from the latest events only specify MI_SUBSCRIBE_BOOKMARK_NEWEST.
10134 * To start delivering from a previously sent bookmark (if possible) pass in the boookmark
10135 * value that was delivered with the last event.
10136 * If no bookmark is set then the providers may not deliver bookmarks with the events.
10137 */
10138 #define MI_SUBSCRIBE_BOOKMARK_OLDEST L"MI_SUBSCRIBE_BOOKMARK_OLDEST"
10139 #define MI_SUBSCRIBE_BOOKMARK_NEWEST L"MI_SUBSCRIBE_BOOKMARK_NEWEST"
10140
10141 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetBookmark(
10142 _Inout_ MI_SubscriptionDeliveryOptions *self,
10143 _In_z_ const MI_Char *value)
10144 mike 1.1 {
10145 if (self && self->ft)
10146 {
10147 return self->ft->SetString(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_BOOKMARK"), value, 0);
10148 }
10149 else
10150 {
10151 return MI_RESULT_INVALID_PARAMETER;
10152 }
10153 }
10154
10155 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetBookmark(
10156 _In_ MI_SubscriptionDeliveryOptions *self,
10157 _Outptr_result_z_ const MI_Char **value)
10158 {
10159 if (self && self->ft)
10160 {
10161 return self->ft->GetString(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_BOOKMARK"), value, 0, 0);
10162 }
10163 else
10164 {
10165 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
10166 }
10167 }
10168
10169 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetDeliveryDestination(
10170 _Inout_ MI_SubscriptionDeliveryOptions *self,
10171 _In_z_ const MI_Char *value)
10172 {
10173 if (self && self->ft)
10174 {
10175 return self->ft->SetString(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_DESTINATION"), value, 0);
10176 }
10177 else
10178 {
10179 return MI_RESULT_INVALID_PARAMETER;
10180 }
10181 }
10182
10183 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetDeliveryDestination(
10184 _In_ MI_SubscriptionDeliveryOptions *self,
10185 _Outptr_result_z_ const MI_Char **value)
10186 mike 1.1 {
10187 if (self && self->ft)
10188 {
10189 return self->ft->GetString(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_DESTINATION"), value, 0, 0);
10190 }
10191 else
10192 {
10193 return MI_RESULT_INVALID_PARAMETER;
10194 }
10195 }
10196
10197 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetDeliveryPortNumber(
10198 _Inout_ MI_SubscriptionDeliveryOptions *self,
10199 _In_ MI_Uint32 value)
10200 {
10201 if (self && self->ft)
10202 {
10203 return self->ft->SetNumber(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_PORT_NUMBER"), value, 0);
10204 }
10205 else
10206 {
10207 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
10208 }
10209 }
10210
10211 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetDeliveryPortNumber(
10212 _In_ MI_SubscriptionDeliveryOptions *self,
10213 _Out_ MI_Uint32 *value)
10214 {
10215 if (self && self->ft)
10216 {
10217 return self->ft->GetNumber(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_PORT_NUMBER"), value, 0, 0);
10218 }
10219 else
10220 {
10221 return MI_RESULT_INVALID_PARAMETER;
10222 }
10223 }
10224
10225 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_AddDeliveryCredentials(
10226 _Inout_ MI_SubscriptionDeliveryOptions *self,
10227 _In_ const MI_UserCredentials *value)
10228 mike 1.1 {
10229 if (self && self->ft)
10230 {
10231 return self->ft->AddCredentials(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_ADD_DELIVERY_CREDENTIALS"), value, 0);
10232 }
10233 else
10234 {
10235 return MI_RESULT_INVALID_PARAMETER;
10236 }
10237 }
10238
10239 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetDeliveryRetryInterval(
10240 _Inout_ MI_SubscriptionDeliveryOptions *self,
10241 _In_ const MI_Interval *value)
10242 {
10243 if (self && self->ft)
10244 {
10245 return self->ft->SetInterval(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_RETRY_INTERVAL"), value, 0);
10246 }
10247 else
10248 {
10249 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
10250 }
10251 }
10252
10253 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetDeliveryRetryInterval(
10254 _In_ MI_SubscriptionDeliveryOptions *self,
10255 _Out_ MI_Interval *value)
10256 {
10257 if (self && self->ft)
10258 {
10259 return self->ft->GetInterval(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_RETRY_INTERVAL"), value, 0, 0);
10260 }
10261 else
10262 {
10263 return MI_RESULT_INVALID_PARAMETER;
10264 }
10265 }
10266
10267 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetDeliveryRetryAttempts(
10268 _Inout_ MI_SubscriptionDeliveryOptions *self,
10269 _In_ MI_Uint32 value)
10270 mike 1.1 {
10271 if (self && self->ft)
10272 {
10273 return self->ft->SetNumber(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_RETRY_ATTEMPTS"), value, 0);
10274 }
10275 else
10276 {
10277 return MI_RESULT_INVALID_PARAMETER;
10278 }
10279 }
10280
10281 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetDeliveryRetryAttempts(
10282 _In_ MI_SubscriptionDeliveryOptions *self,
10283 _Out_ MI_Uint32 *value)
10284 {
10285 if (self && self->ft)
10286 {
10287 return self->ft->GetNumber(self, MI_T("__MI_SUBSCRIPTIONDELIVERYOPTIONS_SET_DELIVERY_RETRY_ATTEMPTS"), value, 0, 0);
10288 }
10289 else
10290 {
10291 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
10292 }
10293 }
10294
10295
10296 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_Delete(
10297 _Inout_ MI_SubscriptionDeliveryOptions* self)
10298 {
10299 if (self && self->ft)
10300 {
10301 return self->ft->Delete(self);
10302 }
10303 else
10304 {
10305 return MI_RESULT_INVALID_PARAMETER;
10306 }
10307 }
10308
10309 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetString(
10310 _Inout_ MI_SubscriptionDeliveryOptions *self,
10311 _In_z_ const MI_Char *optionName,
10312 mike 1.1 _In_z_ const MI_Char *value,
10313 MI_Uint32 flags)
10314 {
10315 if (self && self->ft)
10316 {
10317 return self->ft->SetString(self, optionName, value, flags);
10318 }
10319 else
10320 {
10321 return MI_RESULT_INVALID_PARAMETER;
10322 }
10323 }
10324
10325 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetNumber(
10326 _Inout_ MI_SubscriptionDeliveryOptions *self,
10327 _In_z_ const MI_Char *optionName,
10328 _In_ MI_Uint32 value,
10329 MI_Uint32 flags)
10330 {
10331 if (self && self->ft)
10332 {
10333 mike 1.1 return self->ft->SetNumber(self, optionName, value, flags);
10334 }
10335 else
10336 {
10337 return MI_RESULT_INVALID_PARAMETER;
10338 }
10339 }
10340
10341 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetDateTime(
10342 _Inout_ MI_SubscriptionDeliveryOptions *self,
10343 _In_z_ const MI_Char *optionName,
10344 _In_ const MI_Datetime *value,
10345 MI_Uint32 flags)
10346 {
10347 if (self && self->ft)
10348 {
10349 return self->ft->SetDateTime(self, optionName, value, flags);
10350 }
10351 else
10352 {
10353 return MI_RESULT_INVALID_PARAMETER;
10354 mike 1.1 }
10355 }
10356
10357 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_SetInterval(
10358 _Inout_ MI_SubscriptionDeliveryOptions *self,
10359 _In_z_ const MI_Char *optionName,
10360 _In_ const MI_Interval *value,
10361 MI_Uint32 flags)
10362 {
10363 if (self && self->ft)
10364 {
10365 return self->ft->SetInterval(self, optionName, value, flags);
10366 }
10367 else
10368 {
10369 return MI_RESULT_INVALID_PARAMETER;
10370 }
10371 }
10372
10373 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetString(
10374 _In_ MI_SubscriptionDeliveryOptions *self,
10375 mike 1.1 _In_z_ const MI_Char *optionName,
10376 _Outptr_result_z_ const MI_Char **value,
10377 _Out_opt_ MI_Uint32 *index,
10378 _Out_opt_ MI_Uint32 *flags)
10379 {
10380 if (self && self->ft)
10381 {
10382 return self->ft->GetString(self, optionName, value, index, flags);
10383 }
10384 else
10385 {
10386 return MI_RESULT_INVALID_PARAMETER;
10387 }
10388 }
10389
10390 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetNumber(
10391 _Inout_ MI_SubscriptionDeliveryOptions *self,
10392 _In_z_ const MI_Char *optionName,
10393 _Out_ MI_Uint32 *value,
10394 _Out_opt_ MI_Uint32 *index,
10395 _Out_opt_ MI_Uint32 *flags)
10396 mike 1.1 {
10397 if (self && self->ft)
10398 {
10399 return self->ft->GetNumber(self, optionName, value, index, flags);
10400 }
10401 else
10402 {
10403 return MI_RESULT_INVALID_PARAMETER;
10404 }
10405 }
10406
10407 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetDateTime(
10408 _In_ MI_SubscriptionDeliveryOptions *self,
10409 _In_z_ const MI_Char *optionName,
10410 _Out_ MI_Datetime *value,
10411 _Out_opt_ MI_Uint32 *index,
10412 _Out_opt_ MI_Uint32 *flags)
10413 {
10414 if (self && self->ft)
10415 {
10416 return self->ft->GetDateTime(self, optionName, value, index, flags);
10417 mike 1.1 }
10418 else
10419 {
10420 return MI_RESULT_INVALID_PARAMETER;
10421 }
10422 }
10423
10424 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetInterval(
10425 _In_ MI_SubscriptionDeliveryOptions *self,
10426 _In_z_ const MI_Char *optionName,
10427 _Out_ MI_Interval *value,
10428 _Out_opt_ MI_Uint32 *index,
10429 _Out_opt_ MI_Uint32 *flags)
10430 {
10431 if (self && self->ft)
10432 {
10433 return self->ft->GetInterval(self, optionName, value, index, flags);
10434 }
10435 else
10436 {
10437 return MI_RESULT_INVALID_PARAMETER;
10438 mike 1.1 }
10439 }
10440
10441 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetOptionCount(
10442 _In_ MI_SubscriptionDeliveryOptions *self,
10443 _Out_opt_ MI_Uint32 *count)
10444 {
10445 if (self && self->ft)
10446 {
10447 return self->ft->GetOptionCount(self, count);
10448 }
10449 else
10450 {
10451 return MI_RESULT_INVALID_PARAMETER;
10452 }
10453 }
10454
10455 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetOptionAt(
10456 _In_ MI_SubscriptionDeliveryOptions *self,
10457 MI_Uint32 index,
10458 _Outptr_result_z_ const MI_Char **optionName,
10459 mike 1.1 _Out_ MI_Value *value,
10460 _Out_ MI_Type *type,
10461 _Out_opt_ MI_Uint32 *flags)
10462 {
10463 if (self && self->ft)
10464 {
10465 return self->ft->GetOptionAt(self, index, optionName, value, type, flags);
10466 }
10467 else
10468 {
10469 return MI_RESULT_INVALID_PARAMETER;
10470 }
10471 }
10472
10473 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetOption(
10474 _In_ MI_SubscriptionDeliveryOptions *self,
10475 _In_z_ const MI_Char *optionName,
10476 _Out_ MI_Value *value,
10477 _Out_ MI_Type *type,
10478 _Out_opt_ MI_Uint32 *index,
10479 _Out_opt_ MI_Uint32 *flags)
10480 mike 1.1 {
10481 if (self && self->ft)
10482 {
10483 return self->ft->GetOption(self, optionName, value, type, index, flags);
10484 }
10485 else
10486 {
10487 return MI_RESULT_INVALID_PARAMETER;
10488 }
10489 }
10490
10491 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetCredentialsCount(
10492 _In_ MI_SubscriptionDeliveryOptions *self,
10493 _Out_ MI_Uint32 *count)
10494 {
10495 if (self && self->ft)
10496 {
10497 return self->ft->GetCredentialsCount(self, count);
10498 }
10499 else
10500 {
10501 mike 1.1 return MI_RESULT_INVALID_PARAMETER;
10502 }
10503 }
10504
10505 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetCredentialsAt(
10506 _In_ MI_SubscriptionDeliveryOptions *self,
10507 MI_Uint32 index,
10508 _Outptr_result_z_ const MI_Char **optionName,
10509 _Out_ MI_UserCredentials *credentials, // output credentials always has password set to '******'
10510 _Out_opt_ MI_Uint32 *flags)
10511 {
10512 if (self && self->ft)
10513 {
10514 return self->ft->GetCredentialsAt(self, index, optionName, credentials, flags);
10515 }
10516 else
10517 {
10518 return MI_RESULT_INVALID_PARAMETER;
10519 }
10520 }
10521
10522 mike 1.1 MI_INLINE MI_Result MI_SubscriptionDeliveryOptions_GetCredentialsPasswordAt(
10523 _In_ MI_SubscriptionDeliveryOptions *self,
10524 MI_Uint32 index,
10525 _Outptr_result_z_ const MI_Char **optionName,
10526 _Out_writes_to_opt_(bufferLength, *passwordLength) MI_Char *password,
10527 _In_ MI_Uint32 bufferLength,
10528 _Out_ MI_Uint32 *passwordLength,
10529 _Out_opt_ MI_Uint32 *flags)
10530 {
10531 if (self && self->ft)
10532 {
10533 return self->ft->GetCredentialsPasswordAt(self, index, optionName, password, bufferLength, passwordLength, flags);
10534 }
10535 else
10536 {
10537 return MI_RESULT_INVALID_PARAMETER;
10538 }
10539 }
10540
10541 /**
10542 * This function creates a copy of the given MI_SubscriptionDeliveryOptions. Upon
10543 mike 1.1 * a successful return, new MI_SubscriptionDeliveryOptions points to a newly
10544 * created delivery options.
10545 * The new delivery options should eventually be passed to MI_SubscriptionDeliveryOptions_Delete().
10546 *
10547 * param: self pointer to the delivery options to be cloned.
10548 * param: newSubscriptionDeliveryOptions a pointer to the new delivery options upon return.
10549 *
10550 * return: MI_RESULT_OK, MI_RESULT_FAILED, MI_RESULT_INVALID_PARAMETER
10551 *
10552 * See also: MI_SubscriptionDeliveryOptions_Delete()
10553 *
10554 */
10555 MI_INLINE MI_Result MI_CALL MI_SubscriptionDeliveryOptions_Clone(
10556 _In_ const MI_SubscriptionDeliveryOptions* self,
10557 _Out_ MI_SubscriptionDeliveryOptions* newSubscriptionDeliveryOptions)
10558 {
10559 if (self && self->ft)
10560 {
10561 return self->ft->Clone(self, newSubscriptionDeliveryOptions);
10562 }
10563 else
10564 mike 1.1 {
10565 return MI_RESULT_INVALID_PARAMETER;
10566 }
10567 }
10568
10569 #define MI_SERIALIZER_FLAGS_CLASS_DEEP 1
10570 #define MI_SERIALIZER_FLAGS_INSTANCE_WITH_CLASS 1
10571
10572 MI_INLINE MI_Result MI_Serializer_Close(
10573 _Inout_ MI_Serializer *serializer)
10574 {
10575 return mi_clientFT->serializerFT->Close(serializer);
10576 }
10577
10578 MI_INLINE MI_Result MI_Serializer_SerializeClass(
10579 _Inout_ MI_Serializer *serializer,
10580 MI_Uint32 flags,
10581 _In_ const MI_Class *classObject,
10582 _Out_writes_bytes_(clientBufferLength) MI_Uint8 *clientBuffer,
10583 MI_Uint32 clientBufferLength,
10584 _Inout_ MI_Uint32 *clientBufferNeeded)
10585 mike 1.1 {
10586 return mi_clientFT->serializerFT->SerializeClass(serializer, flags, classObject, clientBuffer, clientBufferLength, clientBufferNeeded);
10587 }
10588
10589 MI_INLINE MI_Result MI_Serializer_SerializeInstance(
10590 _Inout_ MI_Serializer *serializer,
10591 MI_Uint32 flags,
10592 _In_ const MI_Instance *instanceObject,
10593 _Out_writes_bytes_(clientBufferLength) MI_Uint8 *clientBuffer,
10594 MI_Uint32 clientBufferLength,
10595 _Inout_ MI_Uint32 *clientBufferNeeded)
10596 {
10597 return mi_clientFT->serializerFT->SerializeInstance(serializer, flags, instanceObject, clientBuffer, clientBufferLength, clientBufferNeeded);
10598 }
10599
10600
10601 MI_INLINE MI_Result MI_Deserializer_Close(
10602 _Inout_ MI_Deserializer *deserializer)
10603 {
10604 const MI_ClientFT_V1 *clientFT = mi_clientFT;
10605 const MI_DeserializerFT *deserializerFT = clientFT->deserializerFT;
10606 mike 1.1 return deserializerFT->Close(deserializer);
10607 }
10608
10609 MI_INLINE MI_Result MI_Deserializer_DeserializeClass(
10610 _Inout_ MI_Deserializer *deserializer,
10611 MI_Uint32 flags,
10612 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
10613 MI_Uint32 serializedBufferLength,
10614 _In_opt_ MI_Class *parentClass,
10615 _In_opt_z_ const MI_Char *serverName,
10616 _In_opt_z_ const MI_Char *namespaceName,
10617 _In_opt_ MI_Deserializer_ClassObjectNeeded classObjectNeeded,
10618 _In_opt_ void *classObjectNeededContext,
10619 _Out_opt_ MI_Uint32 *serializedBufferRead,
10620 _Outptr_opt_result_maybenull_ MI_Class **classObject,
10621 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails)
10622 {
10623 return mi_clientFT->deserializerFT->DeserializeClass(deserializer, flags, serializedBuffer, serializedBufferLength, parentClass, serverName, namespaceName, classObjectNeeded, classObjectNeededContext, serializedBufferRead, classObject, cimErrorDetails);
10624 }
10625
10626 MI_INLINE MI_Result MI_Deserializer_Class_GetClassName(
10627 mike 1.1 _Inout_ MI_Deserializer *deserializer,
10628 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
10629 MI_Uint32 serializedBufferLength,
10630 _Out_writes_opt_(*classNameLength) MI_Char *className,
10631 _Inout_ MI_Uint32 *classNameLength,
10632 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails)
10633 {
10634 return mi_clientFT->deserializerFT->Class_GetClassName(deserializer, serializedBuffer, serializedBufferLength, className, classNameLength, cimErrorDetails);
10635 }
10636
10637
10638 MI_INLINE MI_Result MI_Deserializer_Class_GetParentClassName(
10639 _Inout_ MI_Deserializer *deserializer,
10640 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
10641 MI_Uint32 serializedBufferLength,
10642 _Out_writes_opt_(*parentClassNameLength) MI_Char *parentClassName,
10643 _Inout_ MI_Uint32 *parentClassNameLength,
10644 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails)
10645 {
10646 return mi_clientFT->deserializerFT->Class_GetParentClassName(deserializer, serializedBuffer, serializedBufferLength, parentClassName, parentClassNameLength, cimErrorDetails);
10647 }
10648 mike 1.1
10649 MI_INLINE MI_Result MI_Deserializer_DeserializeInstance(
10650 _Inout_ MI_Deserializer *deserializer,
10651 MI_Uint32 flags,
10652 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
10653 MI_Uint32 serializedBufferLength,
10654 _In_reads_opt_(numberClassObjects) MI_Class **classObjects,
10655 MI_Uint32 numberClassObjects,
10656 _In_opt_ MI_Deserializer_ClassObjectNeeded classObjectNeeded,
10657 _In_opt_ void *classObjectNeededContext,
10658 _Out_opt_ MI_Uint32 *serializedBufferRead,
10659 _Outptr_opt_result_maybenull_ MI_Instance **instanceObject,
10660 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails)
10661 {
10662 return mi_clientFT->deserializerFT->DeserializeInstance(deserializer, flags, serializedBuffer, serializedBufferLength, classObjects, numberClassObjects, classObjectNeeded, classObjectNeededContext, serializedBufferRead, instanceObject, cimErrorDetails);
10663 }
10664
10665
10666 MI_INLINE MI_Result MI_Deserializer_Instance_GetClassName(
10667 _Inout_ MI_Deserializer *deserializer,
10668 _In_reads_(serializedBufferLength) MI_Uint8 *serializedBuffer,
10669 mike 1.1 MI_Uint32 serializedBufferLength,
10670 _Out_writes_opt_(*classNameLength) MI_Char *className,
10671 _Inout_ MI_Uint32 *classNameLength,
10672 _Outptr_opt_result_maybenull_ MI_Instance **cimErrorDetails)
10673 {
10674 return mi_clientFT->deserializerFT->Instance_GetClassName(deserializer, serializedBuffer, serializedBufferLength, className, classNameLength, cimErrorDetails);
10675 }
10676
10677 /* Map an OS specific error code to an error category */
10678 MI_INLINE MI_ErrorCategory MI_Utilities_MapErrorToMiErrorCategory(
10679 _In_z_ MI_Char *errorType,
10680 MI_Uint32 error)
10681 {
10682 return mi_clientFT->utilitiesFT->MapErrorToMiErrorCategory(errorType, error);
10683 }
10684
10685 /* Map an OS specific error code to an CIM error instance.
10686 * Ca ll MI_Instance_Delete on the CIM when finished
10687 * using it.
10688 */
10689 MI_INLINE MI_Result MI_Utilities_CimErrorFromErrorCode(
10690 mike 1.1 MI_Uint32 error,
10691 _In_z_ const MI_Char *errorType,
10692 _In_z_ const MI_Char* errorMessage,
10693 _Outptr_ MI_Instance **cimError)
10694 {
10695 return mi_clientFT->utilitiesFT->CimErrorFromErrorCode(error, errorType, errorMessage, cimError);
10696
10697 }
10698
10699 /* Mappings from obsolete names to new names */
10700 #define MI_CancelationReason MI_CancellationReason
10701 #define _MI_CancelationReason _MI_CancellationReason
10702 #define MI_PostResult MI_Context_PostResult
10703 #define MI_PostResultWithMessage MI_Context_PostResultWithMessage
10704 #define MI_PostResultWithError MI_Context_PostResultWithError
10705 #define MI_PostCimError MI_Context_PostCimError
10706 #define MI_PostError MI_Context_PostError
10707 #define MI_PostInstance MI_Context_PostInstance
10708 #define MI_PostIndication MI_Context_PostIndication
10709 #define MI_ConstructInstance MI_Context_ConstructInstance
10710 #define MI_ConstructParameters MI_Context_ConstructParameters
10711 mike 1.1 #define MI_NewInstance MI_Context_NewInstance
10712 #define MI_NewDynamicInstance MI_Context_NewDynamicInstance
10713 #define MI_NewParameters MI_Context_NewParameters
10714 #define MI_Canceled MI_Context_Canceled
10715 #define MI_GetLocale MI_Context_GetLocale
10716 #define MI_RegisterCancel MI_Context_RegisterCancel
10717 #define MI_RequestUnload MI_Context_RequestUnload
10718 #define MI_RefuseUnload MI_Context_RefuseUnload
10719 #define MI_GetLocalSession MI_Context_GetLocalSession
10720 #define MI_SetStringOption MI_Context_SetStringOption
10721 #define MI_GetStringOption MI_Context_GetStringOption
10722 #define MI_GetNumberOption MI_Context_GetNumberOption
10723 #define MI_GetCustomOption MI_Context_GetCustomOption
10724 #define MI_GetCustomOptionCount MI_Context_GetCustomOptionCount
10725 #define MI_GetCustomOptionAt MI_Context_GetCustomOptionAt
10726 #define MI_ShouldProcess MI_Context_ShouldProcess
10727 #define MI_ShouldContinue MI_Context_ShouldContinue
10728 #define MI_PromptUser MI_Context_PromptUser
10729 #define MI_WriteError MI_Context_WriteError
10730 #define MI_WriteCimError MI_Context_WriteCimError
10731 #define MI_WriteMessage MI_Context_WriteMessage
10732 mike 1.1 #define MI_WriteProgress MI_Context_WriteProgress
10733 #define MI_WriteStreamParameter MI_Context_WriteStreamParameter
10734 #define MI_WriteWarning MI_Context_WriteWarning
10735 #define MI_WriteVerbose MI_Context_WriteVerbose
10736 #define MI_WriteDebug MI_Context_WriteDebug
10737 #define MI_SubscriptionDeliveryOptions__SetExpirationTime MI_SubscriptionDeliveryOptions_SetExpirationTime
10738 #define MI_SubscriptionDeliveryOptions__GetExpirationTime MI_SubscriptionDeliveryOptions_GetExpirationTime
10739 #define MI_PropertySet_GetElement MI_PropertySet_GetElementAt
10740
10741
10742 #ifdef __cplusplus
10743 } // end of extern C
10744 #endif // __cplusplus
10745
10746 #endif /* __MI_C_API_H */
|