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 _base_packing_h
26 #define _base_packing_h
27
28 #include "instance.h"
29
30 BEGIN_EXTERNC
31
32 /*
33 **==============================================================================
34 **
35 ** Instance_Pack()
36 **
37 ** Serializes an instance into a buffer.
38 **
39 ** Parameters:
40 ** self - the instance to be serialized.
41 ** keysOnly - pack only KEY properties.
42 ** buf - the buffer to put instance into.
43 mike 1.1 **
44 ** Returns:
45 ** MI_RESULT_OK on success.
46 **
47 **==============================================================================
48 */
49 MI_Result Instance_Pack(
50 const MI_Instance* self,
51 MI_Boolean keysOnly,
52 MI_Boolean (*filterProperty)(const MI_Char* name, void* data),
53 void* filterPropertyData,
54 Buf* buf);
55
56 /*
57 **==============================================================================
58 **
59 ** Instance_Unpack()
60 **
61 ** Unpacks an instance from a buffer.
62 **
63 ** Parameters:
64 mike 1.1 ** self - shall point to a newly allocated instance.
65 ** buf - buffer form whicn instance will be unpacked.
66 ** batch - if non-null, use this batch to allocate all elements.
67 ** copy - if false, use pointers into batch (otherwise make copy).
68 **
69 ** Returns:
70 ** MI_RESULT_OK on success.
71 **
72 **==============================================================================
73 */
74 MI_Result Instance_Unpack(
75 MI_Instance** self,
76 Buf* buf,
77 Batch* batch,
78 MI_Boolean copy);
79
80 /*
81 **==============================================================================
82 **
83 ** InstanceToBatch()
84 **
85 mike 1.1 ** Serializes an instance into a batch.
86 **
87 ** Parameters:
88 ** instance - the instance to be serialized.
89 ** batch - the batch to put instance into.
90 ** ptrOut - pointer to the packed instance in the batch
91 ** sizeOut - size of the packed instance
92 **
93 ** Returns:
94 ** MI_RESULT_OK on success.
95 **
96 **==============================================================================
97 */
98 MI_Result InstanceToBatch(
99 const MI_Instance* instance,
100 MI_Boolean (*filterProperty)(const MI_Char* name, void* data),
101 void* filterPropertyData,
102 Batch* batch,
103 void** ptrOut,
104 MI_Uint32* sizeOut);
105
106 mike 1.1 END_EXTERNC
107
108 #endif /* _base_packing_h */
|