(file) Return to messages.h CVS log (file) (dir) Up to [OMI] / omi / base

  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 _omi_messages_h
 26           #define _omi_messages_h
 27           
 28           #include "config.h"
 29           #include <common.h>
 30           #include <stdio.h>
 31           #include "batch.h"
 32           #include "instance.h"
 33           #include "stringarray.h"
 34           #include "atomic.h"
 35           #include "user.h"
 36           
 37           BEGIN_EXTERNC
 38           
 39           /*
 40           **==============================================================================
 41           **
 42           ** MessageTag
 43 mike  1.1 **
 44           **     Enumeration of all message tags.
 45           **
 46           **==============================================================================
 47           */
 48           
 49           typedef enum _MessageTag
 50           {
 51               GetInstanceReqTag = 1,
 52               PostInstanceMsgTag = 2,
 53               EnumerateInstancesReqTag = 3,
 54               PostResultMsgTag = 4,
 55               NoOpReqTag = 5,
 56               NoOpRspTag = 6,
 57               DispResultMsgTag = 7,
 58               InvokeReqTag = 8,
 59               AssociatorsOfReqTag = 9,
 60               ReferencesOfReqTag = 10,
 61               SubscribeReqTag = 11,
 62               SubscribeResTag = 12,
 63               DeleteInstanceReqTag = 13,
 64 mike  1.1     CreateInstanceReqTag = 14,
 65               ModifyInstanceReqTag = 15,
 66               BinProtocolNotificationTag = 16
 67           }
 68           MessageTag;
 69           
 70           /*
 71           **==============================================================================
 72           **
 73           ** MessageFlag
 74           **
 75           **     Supported flags for message.
 76           **
 77           **==============================================================================
 78           */
 79           
 80           typedef enum _MessageFlag
 81           {
 82               /* Instance encoding type (only one can be set at a time) */
 83               BinaryProtocolFlag =    0x0001,
 84               WSMANFlag =             0x0002,
 85 mike  1.1     CIMXMLFlag =            0x0004,
 86           
 87               /* WSMAN-specific encoding options */
 88               WSMAN_ObjectAndEPRFlag =0x0018,
 89               WSMAN_EPRFlag =         0x0008,
 90               WSMAN_ObjectFlag =      0x0010,
 91               WSMAN_CreatedEPRFlag =  0x0020
 92           
 93           }
 94           MessageFlag;
 95           
 96           /*
 97           **==============================================================================
 98           **
 99           ** Message
100           **
101           **     Base type for all messages.
102           **
103           **==============================================================================
104           */
105           
106 mike  1.1 typedef struct _Message Message;
107           
108           struct _Message
109           {
110               /* Links for inserting messages onto linked-lists */
111               struct _Message* next;
112               struct _Message* prev;
113           
114               /* The batch this message was allocated from */
115               Batch *batch;
116           
117               /* original request (can be NULL); lifetime controlled by ref-counter */
118               struct _Message* request;
119           
120               /* The message tag (see MessageTag enum above) */
121               MI_Uint32 tag;
122           
123               /* Flags for message processing - like instance encoding type (see MessageFlag enum above) */
124               MI_Uint32 flags;
125           
126               /* ref counter */
127 mike  1.1     AtomicInt refCounter;
128           
129               /* Message identifier derived from the original request */
130               MI_Uint64 msgID;
131           
132               /* Client identifier derived from requestor */
133               MI_Uint64 clientID;
134           
135               /* Callback used to deliver response to this message */
136               void (*callback)(Message* message, void* callbackData);
137           
138               /* Data passed as 2nd argument of 'callback' */
139               void* callbackData;
140           
141               /* Message's destructor [opt] 
142                   'Release' will call dtor (if set) right before destroying the message */
143               void (*dtor)(Message* message, void* callbackData);
144           
145               /* Data passed as 2nd argument of 'dtor' */
146               void* dtorData;
147           
148 mike  1.1     /* Server -> agent IPC specific */
149               const char* libraryName;
150           
151               /* Requestor information */
152               uid_t uid;
153               gid_t gid;
154           };
155           
156           Message* __Message_New(
157               MessageTag tag,
158               size_t structSize,
159               MI_Uint64 msgID,
160               MI_Uint32 flags);
161           
162           void Message_Release(
163               Message* self);
164           
165           MI_INLINE void Message_AddRef(
166               Message* self)
167           {
168               AtomicInc(&self->refCounter);
169 mike  1.1 }
170           
171           MI_INLINE void Message_SetRequest(
172               Message* self,
173               Message* request)
174           {
175               if (self->request)
176                   Message_Release(self->request);
177           
178               self->request = request;
179           
180               if (self->request)
181                   Message_AddRef(self->request);
182           }
183           
184           /*
185               Verifies if message is final reposne to the initial request
186           */
187           MI_INLINE MI_Boolean Message_IsFinalRepsonse(
188               const Message* msg)
189           {
190 mike  1.1     if (PostResultMsgTag == msg->tag ||
191                   NoOpRspTag == msg->tag ||
192                   SubscribeResTag == msg->tag)
193                   return MI_TRUE;
194           
195               return MI_FALSE;
196           }
197           
198           /*
199           **==============================================================================
200           **
201           ** PostResultMsg
202           **
203           **     generic error response
204           **
205           **==============================================================================
206           */
207           
208           typedef struct _PostResultMsg
209           {
210               Message base;
211 mike  1.1     MI_Result result;
212           }
213           PostResultMsg;
214           
215           MI_INLINE PostResultMsg* PostResultMsg_New(
216               MI_Uint64 msgID)
217           {
218               return (PostResultMsg*)__Message_New(
219                   PostResultMsgTag, sizeof(PostResultMsg), msgID, 0);
220           }
221           
222           MI_INLINE void PostResultMsg_Release(
223               PostResultMsg* self)
224           {
225               Message_Release(&self->base);
226           }
227           
228           void PostResultMsg_Print(const PostResultMsg* msg, FILE* os);
229           
230           /*
231           **==============================================================================
232 mike  1.1 **
233           ** DispResultMsg
234           **
235           **     interanl strucutre for dispatcher 
236           **     dispatcher keeps track of multiple 'enumerate' responses
237           **
238           **==============================================================================
239           */
240           
241           typedef struct _DispResultMsg
242           {
243               Message base;
244           
245               /* number of outstanding requests */
246               AtomicInt requestCounter;
247           
248               /* current result */
249               MI_Result result;
250           }
251           DispResultMsg;
252           
253 mike  1.1 MI_INLINE DispResultMsg* DispResultMsg_New(
254               MI_Uint64 msgID)
255           {
256               return (DispResultMsg*)__Message_New(
257                   DispResultMsgTag, sizeof(DispResultMsg), msgID, 0);
258           }
259           
260           MI_INLINE void DispResultMsg_Release(
261               DispResultMsg* self)
262           {
263               Message_Release(&self->base);
264           }
265           
266           void DispResultMsg_Print(const DispResultMsg* msg, FILE* os);
267           
268           /*
269           **==============================================================================
270           **
271           ** GetInstanceReq
272           **
273           **     A CIM GetInstance request (see DSP0200).
274 mike  1.1 **
275           **==============================================================================
276           */
277           
278           typedef struct _GetInstanceReq
279           {
280               Message base;
281               MI_ConstString nameSpace;
282               /* un-packed version of instance */
283               MI_Instance* instanceName;
284               /* packed version of instance */
285               void*        packedInstanceNamePtr;
286               MI_Uint32    packedInstanceNameSize;
287           
288               MI_Boolean includeClassOrigin;
289               StringArray* propertySet;
290           }
291           GetInstanceReq;
292           
293           MI_INLINE GetInstanceReq* GetInstanceReq_New(
294               MI_Uint64 msgID,
295 mike  1.1     MI_Uint32 flags)
296           {
297               return (GetInstanceReq*)__Message_New(
298                   GetInstanceReqTag, sizeof(GetInstanceReq), msgID, flags);
299           }
300           
301           MI_INLINE void GetInstanceReq_Release(
302               GetInstanceReq* self)
303           {
304               Message_Release(&self->base);
305           }
306           
307           void GetInstanceReq_Print(const GetInstanceReq* msg, FILE* os);
308           
309           /*
310           **==============================================================================
311           **
312           ** CreateInstanceReq
313           **
314           **     A CIM CreateInstance request (see DSP0200).
315           **
316 mike  1.1 **==============================================================================
317           */
318           
319           typedef struct _CreateInstanceReq
320           {
321               Message base;
322               MI_ConstString nameSpace;
323               MI_Instance* instance;
324               void* packedInstancePtr;
325               MI_Uint32 packedInstanceSize;
326               StringArray* propertySet;
327           }
328           CreateInstanceReq;
329           
330           MI_INLINE CreateInstanceReq* CreateInstanceReq_New(
331               MI_Uint64 msgID,
332               MI_Uint32 flags)
333           {
334               return (CreateInstanceReq*)__Message_New(
335                   CreateInstanceReqTag, sizeof(CreateInstanceReq), msgID, flags);
336           }
337 mike  1.1 
338           MI_INLINE void CreateInstanceReq_Release(
339               CreateInstanceReq* self)
340           {
341               Message_Release(&self->base);
342           }
343           
344           void CreateInstanceReq_Print(const CreateInstanceReq* msg, FILE* os);
345           
346           /*
347           **==============================================================================
348           **
349           ** ModifyInstanceReq
350           **
351           **     A CIM ModifyInstance request (see DSP0200).
352           **
353           **==============================================================================
354           */
355           
356           typedef struct _ModifyInstanceReq
357           {
358 mike  1.1     Message base;
359               MI_ConstString nameSpace;
360               MI_Instance* instance;
361               void* packedInstancePtr;
362               MI_Uint32 packedInstanceSize;
363               StringArray* propertySet;
364           }
365           ModifyInstanceReq;
366           
367           MI_INLINE ModifyInstanceReq* ModifyInstanceReq_New(
368               MI_Uint64 msgID,
369               MI_Uint32 flags)
370           {
371               return (ModifyInstanceReq*)__Message_New(
372                   ModifyInstanceReqTag, sizeof(ModifyInstanceReq), msgID, flags);
373           }
374           
375           MI_INLINE void ModifyInstanceReq_Release(
376               ModifyInstanceReq* self)
377           {
378               Message_Release(&self->base);
379 mike  1.1 }
380           
381           void ModifyInstanceReq_Print(const ModifyInstanceReq* msg, FILE* os);
382           
383           /*
384           **==============================================================================
385           **
386           ** DeleteInstanceReq
387           **
388           **     A CIM DeleteInstance request (see DSP0200).
389           **
390           **==============================================================================
391           */
392           
393           typedef struct _DeleteInstanceReq
394           {
395               Message base;
396               MI_ConstString nameSpace;
397               MI_Instance* instanceName;
398               void* packedInstanceNamePtr;
399               MI_Uint32 packedInstanceNameSize;
400 mike  1.1 }
401           DeleteInstanceReq;
402           
403           MI_INLINE DeleteInstanceReq* DeleteInstanceReq_New(
404               MI_Uint64 msgID,
405               MI_Uint32 flags)
406           {
407               return (DeleteInstanceReq*)__Message_New(
408                   DeleteInstanceReqTag, sizeof(DeleteInstanceReq), msgID, flags);
409           }
410           
411           MI_INLINE void DeleteInstanceReq_Release(
412               DeleteInstanceReq* self)
413           {
414               Message_Release(&self->base);
415           }
416           
417           void DeleteInstanceReq_Print(
418               const DeleteInstanceReq* msg, 
419               FILE* os);
420           
421 mike  1.1 /*
422           **==============================================================================
423           **
424           ** InvokeReq
425           **
426           **     A CIM Invoke request (see DSP0200).
427           **
428           **==============================================================================
429           */
430           
431           typedef struct _InvokeReq
432           {
433               Message base;
434               MI_ConstString nameSpace;
435               MI_ConstString function;
436               MI_ConstString className; /* for static functions only, otherwise null */
437           
438               /* un-packed version of instance (for non-static functions) and parameters */
439               MI_Instance* instance;
440               MI_Instance* instanceParams;
441               /* packed version of instance */
442 mike  1.1     void*        packedInstancePtr;
443               void*        packedInstanceParamsPtr;
444               MI_Uint32    packedInstanceSize;
445               MI_Uint32    packedInstanceParamsSize;
446           }
447           InvokeReq;
448           
449           MI_INLINE InvokeReq* InvokeReq_New(
450               MI_Uint64 msgID,
451               MI_Uint32 flags)
452           {
453               return (InvokeReq*)__Message_New(
454                   InvokeReqTag, sizeof(InvokeReq), msgID, flags);
455           }
456           
457           MI_INLINE void InvokeReq_Release(
458               InvokeReq* self)
459           {
460               Message_Release(&self->base);
461           }
462           
463 mike  1.1 void InvokeReq_Print(const InvokeReq* msg, FILE* os);
464           
465           /*
466           **==============================================================================
467           **
468           ** AssociatorsOfReq
469           **
470           **     A CIM "Associators of" request (see DSP0200).
471           **
472           **==============================================================================
473           */
474           
475           typedef struct _AssociatorsOfReq
476           {
477               Message base;
478               MI_ConstString nameSpace;
479               MI_ConstString assocClass;
480               MI_ConstString resultClass;
481               MI_ConstString role;
482               MI_ConstString resultRole;
483           
484 mike  1.1     /* dispatcher to provider only */
485               MI_ConstString className;
486           
487               /* un-packed version of instance */
488               MI_Instance* instance;
489               /* packed version of instance */
490               void*        packedInstancePtr;
491               MI_Uint32    packedInstanceSize;
492           }
493           AssociatorsOfReq;
494           
495           MI_INLINE AssociatorsOfReq* AssociatorsOfReq_New(
496               MI_Uint64 msgID,
497               MI_Uint32 flags)
498           {
499               return (AssociatorsOfReq*)__Message_New(
500                   AssociatorsOfReqTag, sizeof(AssociatorsOfReq), msgID, flags);
501           }
502           
503           MI_INLINE void AssociatorsOfReq_Release(
504               AssociatorsOfReq* self)
505 mike  1.1 {
506               Message_Release(&self->base);
507           }
508           
509           void AssociatorsOfReq_Print(const AssociatorsOfReq* msg, FILE* os);
510           
511           /*
512           **==============================================================================
513           **
514           ** ReferencesOfReq
515           **
516           **     A CIM "References of" request (see DSP0200).
517           **
518           **==============================================================================
519           */
520           
521           typedef struct _ReferencesOfReq
522           {
523               Message base;
524               MI_ConstString nameSpace;
525               MI_ConstString assocClass;
526 mike  1.1     MI_ConstString role;
527           
528               /* dispatcher to provider only */
529               MI_ConstString className;
530           
531               /* un-packed version of instance */
532               MI_Instance* instance;
533               /* packed version of instance */
534               void*        packedInstancePtr;
535               MI_Uint32    packedInstanceSize;
536           }
537           ReferencesOfReq;
538           
539           MI_INLINE ReferencesOfReq* ReferencesOfReq_New(
540               MI_Uint64 msgID,
541               MI_Uint32 flags)
542           {
543               return (ReferencesOfReq*)__Message_New(
544                   ReferencesOfReqTag, sizeof(ReferencesOfReq), msgID, flags);
545           }
546           
547 mike  1.1 MI_INLINE void ReferencesOfReq_Release(
548               ReferencesOfReq* self)
549           {
550               Message_Release(&self->base);
551           }
552           
553           void ReferencesOfReq_Print(const ReferencesOfReq* msg, FILE* os);
554           
555           /*
556           **==============================================================================
557           **
558           ** PostInstanceMsg
559           **
560           **     A CIM GetInstance response (see DSP0200).
561           **
562           **==============================================================================
563           */
564           
565           typedef struct _PostInstanceMsg
566           {
567               Message base;
568 mike  1.1     /* un-packed version of instance */
569               MI_Instance* instance;
570               /* packed version of instance */
571               void*        packedInstancePtr;
572               MI_Uint32    packedInstanceSize;
573           
574           }
575           PostInstanceMsg;
576           
577           MI_INLINE PostInstanceMsg* PostInstanceMsg_New(
578               MI_Uint64 msgID)
579           {
580               return (PostInstanceMsg*)__Message_New(
581                   PostInstanceMsgTag, sizeof(PostInstanceMsg), msgID, 0);
582           }
583           
584           MI_INLINE void PostInstanceMsg_Release(
585               PostInstanceMsg* self)
586           {
587               Message_Release(&self->base);
588           }
589 mike  1.1 
590           void PostInstanceMsg_Print(const PostInstanceMsg* msg, FILE* os);
591           
592           /*
593           **==============================================================================
594           **
595           ** EnumerateInstancesReq
596           **
597           **     A CIM EnumerateInstances request (see DSP0200).
598           **
599           **==============================================================================
600           */
601           
602           typedef struct _EnumerateInstancesReq
603           {
604               Message base;
605               MI_ConstString nameSpace;
606               MI_ConstString className;
607               /* Used for 'base-properties-only' mode to transfer 
608                   request's class-name */
609               MI_ConstString requestClassName;
610 mike  1.1     StringArray* propertySet;
611               MI_Boolean deepInheritance;
612               MI_Boolean includeClassOrigin;
613               MI_Boolean basePropertiesOnly;
614           
615               /* Query language (or null none) */
616               const MI_Char* queryLanguage;
617           
618               /* Query expression (or null none) */
619               const MI_Char* queryExpression;
620           
621               /* Compiled WQL query */
622               struct _WQL* wql;
623           }
624           EnumerateInstancesReq;
625           
626           MI_INLINE EnumerateInstancesReq* EnumerateInstancesReq_New(
627               MI_Uint64 msgID,
628               MI_Uint32 flags)
629           {
630               return (EnumerateInstancesReq*)__Message_New(
631 mike  1.1         EnumerateInstancesReqTag, sizeof(EnumerateInstancesReq), msgID, flags);
632           }
633           
634           MI_INLINE void EnumerateInstancesReq_Release(
635               EnumerateInstancesReq* self)
636           {
637               Message_Release(&self->base);
638           }
639           
640           void EnumerateInstancesReq_Print(const EnumerateInstancesReq* msg, FILE* os);
641           
642           /*
643           **==============================================================================
644           **
645           ** SubscribeReq
646           **
647           **     Subscribe request (internal representation of it)
648           **
649           **==============================================================================
650           */
651           
652 mike  1.1 typedef struct _SubscribeReq
653           {
654               Message base;
655               MI_ConstString nameSpace;
656               MI_ConstString className;
657               MI_ConstString filter;
658               MI_ConstString language;
659           
660               /* used for disp -> provmgr */
661               MI_Uint64      ctxID;
662               /* used for disp -> provider */
663               MI_Uint64      subscriptionID;
664           }
665           SubscribeReq;
666           
667           MI_INLINE SubscribeReq* SubscribeReq_New(
668               MI_Uint64 msgID,
669               MI_Uint32 flags)
670           {
671               return (SubscribeReq*)__Message_New(
672                   SubscribeReqTag, sizeof(SubscribeReq), msgID, flags);
673 mike  1.1 }
674           
675           MI_INLINE void SubscribeReq_Release(
676               SubscribeReq* self)
677           {
678               Message_Release(&self->base);
679           }
680           
681           void SubscribeReq_Print(const SubscribeReq* msg, FILE* os);
682           
683           /*
684           **==============================================================================
685           **
686           ** SubscribeRes
687           **
688           **     Subscribe request (internal representation of it)
689           **
690           **==============================================================================
691           */
692           
693           typedef struct _SubscribeRes
694 mike  1.1 {
695               Message base;
696               MI_ConstString subscriptionID;
697           }
698           SubscribeRes;
699           
700           MI_INLINE SubscribeRes* SubscribeRes_New(
701               MI_Uint64 msgID)
702           {
703               return (SubscribeRes*)__Message_New(
704                   SubscribeResTag, sizeof(SubscribeRes), msgID, 0);
705           }
706           
707           MI_INLINE void SubscribeRes_Release(
708               SubscribeRes* self)
709           {
710               Message_Release(&self->base);
711           }
712           
713           void SubscribeRes_Print(const SubscribeRes* msg, FILE* os);
714           
715 mike  1.1 /*
716           **==============================================================================
717           **
718           ** NoOpReq
719           **
720           **     A NoOp request.
721           **
722           **==============================================================================
723           */
724           
725           typedef struct _NoOpReq
726           {
727               Message base;
728           }
729           NoOpReq;
730           
731           MI_INLINE NoOpReq* NoOpReq_New(
732               MI_Uint64 msgID)
733           {
734               return (NoOpReq*)__Message_New(
735                   NoOpReqTag, sizeof(NoOpReq), msgID, BinaryProtocolFlag);
736 mike  1.1 }
737           
738           MI_INLINE void NoOpReq_Release(
739               NoOpReq* self)
740           {
741               Message_Release(&self->base);
742           }
743           
744           void NoOpReq_Print(const NoOpReq* msg, FILE* os);
745           
746           /*
747           **==============================================================================
748           **
749           ** NoOpRsp
750           **
751           **     A NoOp request.
752           **
753           **==============================================================================
754           */
755           
756           typedef struct _NoOpRsp
757 mike  1.1 {
758               Message base;
759           }
760           NoOpRsp;
761           
762           MI_INLINE NoOpRsp* NoOpRsp_New(
763               MI_Uint64 msgID)
764           {
765               return (NoOpRsp*)__Message_New(
766                   NoOpRspTag, sizeof(NoOpRsp), msgID, 0);
767           }
768           
769           MI_INLINE void NoOpRsp_Release(
770               NoOpRsp* self)
771           {
772               Message_Release(&self->base);
773           }
774           
775           void NoOpRsp_Print(const NoOpRsp* msg, FILE* os);
776           
777           /*
778 mike  1.1 **==============================================================================
779           **
780           ** BinProtocolNotification
781           **
782           **     A internal notification transfered over bin protocol.
783           **
784           **==============================================================================
785           */
786           typedef enum _BinProtNotificationType
787           {
788               BinNotificationAgentIdle = 0,
789               BinNotificationConnectRequest = 1,
790               BinNotificationConnectResponse = 2
791           }
792           BinProtNotificationType;
793           
794           #define AUTH_RANDOM_DATA_SIZE   64
795           
796           typedef struct _BinProtocolNotification
797           {
798               Message base;
799 mike  1.1 
800               /* see BinProtNotificationType for supported types */
801               MI_Uint32   type;
802           
803               /* **** Connect-request specific data **** */
804               /* explicit auth [opt] */
805               const char* user;
806               const char* password;
807           
808               /* implicit auth - Requestor information */
809               uid_t uid;
810               gid_t gid;
811           
812               /* File-based authentication - files's content */
813               unsigned char authData[AUTH_RANDOM_DATA_SIZE];
814           
815               /* **** Connect-response specific data **** */
816               /* ok/access-denied */
817               MI_Result   result;
818           
819               /* file name - client has to read it and send back content */
820 mike  1.1     const char* authFile;
821           
822           }
823           BinProtocolNotification;
824           
825           MI_INLINE BinProtocolNotification* BinProtocolNotification_New(BinProtNotificationType type)
826           {
827               BinProtocolNotification* res = (BinProtocolNotification*)__Message_New(
828                   BinProtocolNotificationTag, sizeof(BinProtocolNotification), 0, 0);
829           
830               if (res)
831                   res->type = type;
832           
833               return res;
834           }
835           
836           MI_INLINE void BinProtocolNotification_Release(
837               BinProtocolNotification* self)
838           {
839               Message_Release(&self->base);
840           }
841 mike  1.1 
842           void BinProtocolNotification_Print(const BinProtocolNotification* msg, FILE* os);
843           
844           /*
845           **==============================================================================
846           **
847           **     binary transport with batch support
848           **
849           **     
850           **
851           **==============================================================================
852           */
853           
854           MI_Result MessageFromBatch(
855               Batch* batch,
856               void* originalMsgPtr,
857               const Header_BatchInfoItem* ptrAdjustmentInfo,
858               size_t ptrAdjustmentInfoCount,
859               MI_Boolean skipInstanceUnpack,
860               Message** msgOut
861               );
862 mike  1.1 
863           
864           /*
865           **==============================================================================
866           **
867           **     Creates a clone of given message, 
868           **      suitable for sending with binary protocol
869           **      This is needed to:
870           **      - make batch smaller (no small blocks form instance's parts
871           **      - all instances are packed
872           **
873           **      Note: requests without instances (like Enum) don't need a copy - 
874           **      add-ref-ed original message is returned in that case
875           **
876           **==============================================================================
877           */
878           MI_Result MessagePackCloneForBinarySending(
879               Message* msgSrc,
880               Message** msgOut);
881           
882           
883 mike  1.1 /*
884           **==============================================================================
885           **
886           ** Print the message
887           **
888           **==============================================================================
889           */
890           void MessagePrint(const Message* msg, FILE* os);
891           
892           /*
893           **==============================================================================
894           **
895           ** Uint64ToPtr()
896           ** PtrToUint64()
897           **
898           **==============================================================================
899           */
900           
901           MI_INLINE void* Uint64ToPtr(MI_Uint64 x)
902           {
903               union U
904 mike  1.1     {
905                   void* ptr;
906                   MI_Uint64 x;
907               };
908           
909               union U u;
910               u.x = x;
911           
912               return u.ptr;
913           }
914           
915           MI_INLINE MI_Uint64 PtrToUint64(void* ptr)
916           {
917               union U
918               {
919                   void* ptr;
920                   MI_Uint64 x;
921               };
922           
923               union U u;
924               u.ptr = ptr;
925 mike  1.1 
926               return u.x;
927           }
928           
929           END_EXTERNC
930           
931           #endif /* _omi_messages_h */

ViewCVS 0.9.2