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 _provmgr_h
26 #define _provmgr_h
27
28 #include <common.h>
29 #include <base/base.h>
30 #include <base/messages.h>
31 #include <protocol/selector.h>
32
33 BEGIN_EXTERNC
34
35 typedef struct _ProvMgr ProvMgr;
36
37 /*
38 Callback to notify that prov-mgr unloaded all libraries
39 */
40 typedef void (*ProvMgrCallbackOnIdle)(
41 ProvMgr* mgr,
42 void* callbackData);
43 mike 1.1
44 struct _ProvMgr
45 {
46 char providerDir[MAX_PATH_SIZE];
47
48 /* Linked list of loaded providers */
49 struct _Library* head;
50 struct _Library* tail;
51
52 /* timer notification */
53 Handler timeoutHandler;
54 MI_Uint64 idleTimeoutUsec;
55
56 /* idle notifications */
57 ProvMgrCallbackOnIdle idleCallback;
58 void* idleCallbackData;
59
60 /* selector (for timeouts support) */
61 Selector* selector;
62 };
63
64 mike 1.1 MI_Result ProvMgr_Init(
65 ProvMgr* self,
66 Selector* selector,
67 ProvMgrCallbackOnIdle idleCallback,
68 void* idleCallbackData,
69 const char* providerDir);
70
71 MI_Result ProvMgr_Destroy(
72 ProvMgr* self);
73
74 MI_Result ProvMgr_PostMessage(
75 ProvMgr* self,
76 const char* libraryName,
77 Message* msg);
78
79 /* MI_ServerFT is preceded directly by one of these. Providers may
80 * inerally case backwards to find this structure but they should verify
81 * the magic number.
82 */
83 typedef struct _ProvMgrFT
84 {
85 mike 1.1 MI_Uint32 magic;
86 void* (*FindSymbol)(const char* name);
87 }
88 ProvMgrFT;
89
90 #define PROVMGRFT_MAGIC 0xF19768D7
91
92 /*
93 Provider access
94 */
95 typedef struct _Provider Provider;
96
97 /*
98 Adding reference to the provider:
99 used by context functions
100 */
101 void Provider_Addref(Provider* provider);
102
103 /*
104 Decrementing provider's reference
105 so prov mgr knows when provider becomes idle
106 mike 1.1 */
107 void Provider_Release(Provider* provider);
108
109 /*
110 Sets 'refuse-unload' provider option
111 */
112 void Provider_SetRefuseUnloadFlag(Provider* provider, MI_Boolean flag);
113
114 /*
115 Informs system that new instance was created
116 */
117 void Provider_NewInstanceCreated(
118 Provider* provider,
119 Message* msg);
120
121 END_EXTERNC
122
123 #endif /* _provmgr_h */
|