1 krisbash 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 krisbash 1.1 **==============================================================================
23 */
24
25 #ifndef _Interaction_h
26 #define _Interaction_h
27
28 #include <base/messages.h>
29
30 BEGIN_EXTERNC
31
32 typedef struct _Interaction Interaction;
33
34 typedef struct _InteractionFT
35 {
36 void (*Post)( _In_ Interaction* self, _In_ Message* msg);
37 void (*PostControl)( _In_ Interaction* self, _In_ Message* msg);
38 void (*Ack)( _In_ Interaction* self);
39 void (*Cancel)( _In_ Interaction* self);
40 void (*Close)( _In_ Interaction* self);
41 }
42 InteractionFT;
43 krisbash 1.1
44 struct _Interaction
45 {
46 InteractionFT * ft;
47 Interaction * other;
48 };
49
50 Interaction* Interaction_New(
51 _In_ Batch *batch,
52 _In_opt_ InteractionFT* ft,
53 size_t structSize );
54
55 typedef struct _Strand Strand;
56
57 typedef struct _InteractionOpenParams
58 {
59 Interaction* interaction;
60 void* callbackData; // Optional callbackData (usually the object being called back)
61 Message* msg; // Optional initial message, if not NULL receiver SHOULD Ack when is ready
62 Strand* origin; // Optional origin strand, used by strand to provide a Strand object that should be released (leave) once the interaction is open
63 } InteractionOpenParams;
64 krisbash 1.1
65 MI_INLINE
66 void InteractionOpenParams_Init( _Out_ InteractionOpenParams* params )
67 {
68 memset( params, 0, sizeof(InteractionOpenParams) );
69 }
70
71 // It should always succeed, return any error thru the interaction
72 typedef void (*OpenCallback)( _Inout_ InteractionOpenParams* params );
73
74 END_EXTERNC
75
76 #endif /* _Interaction_h */
77
|