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

Diff for /omi/provmgr/provmgr.h between version 1.3 and 1.4

version 1.3, 2015/04/20 18:10:13 version 1.4, 2015/04/20 18:19:56
Line 26 
Line 26 
 #define _provmgr_h #define _provmgr_h
  
 #include <common.h> #include <common.h>
   #include <pal/shlib.h>
   #include <pal/lock.h>
 #include <base/base.h> #include <base/base.h>
 #include <base/messages.h> #include <base/messages.h>
   #include <base/interaction.h>
 #include <sock/selector.h> #include <sock/selector.h>
   #include <provreg/provreg.h>
   #include <omi_error/errorutil.h>
  
 BEGIN_EXTERNC BEGIN_EXTERNC
  
   #define PROVMGR_IDLE_TIMEOUT_USEC   (MI_ULL(90) * MI_ULL(1000000))
   
 typedef struct _ProvMgr     ProvMgr; typedef struct _ProvMgr     ProvMgr;
   struct _SubscriptionManager;
   typedef struct _SubscriptionContext SubscriptionContext;
  
 /* /*
     Callback to notify that prov-mgr unloaded all libraries     Callback to notify that prov-mgr unloaded all libraries
Line 43 
Line 52 
  
 struct _ProvMgr struct _ProvMgr
 { {
     char providerDir[MAX_PATH_SIZE];      char providerDir[PAL_MAX_PATH_SIZE];
  
     /* Linked list of loaded providers */     /* Linked list of loaded providers */
     struct _Library* head;     struct _Library* head;
     struct _Library* tail;     struct _Library* tail;
       /* make library list threadsafe */
       Lock liblock;
  
     /* timer notification */     /* timer notification */
     Handler     timeoutHandler;     Handler     timeoutHandler;
Line 59 
Line 70 
  
     /* selector (for timeouts support) */     /* selector (for timeouts support) */
     Selector* selector;     Selector* selector;
   
       /* Support for local session */
       MI_Application localApplication;
       MI_Session localSession;
       ptrdiff_t localSessionInitialized; /* 0 =  no, 1 = initializing, 2 = initialized */
   
       ThreadID ioThreadId;
 }; };
  
 MI_Result ProvMgr_Init( MI_Result ProvMgr_Init(
Line 71 
Line 89 
 MI_Result ProvMgr_Destroy( MI_Result ProvMgr_Destroy(
     ProvMgr* self);     ProvMgr* self);
  
 MI_Result ProvMgr_PostMessage(  MI_Result ProvMgr_NewRequest(
     ProvMgr* self,      _In_ ProvMgr* self,
     const char* libraryName,      _In_ const ProvRegEntry* proventry,
     Message* msg);      _Inout_ InteractionOpenParams* params );
   
   typedef struct _ProvMgr_OpenCallbackData
   {
       ProvMgr*        self;
       ProvRegEntry*   provRegEntry;
   } ProvMgr_OpenCallbackData;
   
   MI_INLINE
   void ProvMgr_OpenCallback(
       _Inout_ InteractionOpenParams* params )
   {
       MI_Result result;
       ProvMgr_OpenCallbackData* data =  (ProvMgr_OpenCallbackData*)params->callbackData;
   
       result = ProvMgr_NewRequest( data->self, data->provRegEntry, params );
       if( MI_RESULT_OK != result )
       {
           Strand_FailOpenWithResult(params, result, PostResultMsg_NewAndSerialize);
       }
   }
  
 /* MI_ServerFT is preceded directly by one of these. Providers may /* MI_ServerFT is preceded directly by one of these. Providers may
  * inerally case backwards to find this structure but they should verify  * inerally case backwards to find this structure but they should verify
Line 92 
Line 130 
 /* /*
     Provider access     Provider access
 */ */
 typedef struct _Provider    Provider;  
   typedef struct _Library Library;
   
   typedef struct _Provider
   {
       struct _Provider* next;
       struct _Provider* prev;
   
       MI_CONST MI_ClassDecl* classDecl;
       void* self;
   
       /* number of outstanding requests */
       volatile ptrdiff_t   refCounter;
   
       /* time when last outstanding request was handled */
       MI_Uint64   idleSince;
   
       /* indicator if Provider refused idle-unload */
       MI_Boolean  refusedUnload;
   
       /* pointer to lib object */
       Library* lib;
   
   #ifndef DISABLE_INDICATION
       /* memory of subMgr was allocated along with Provider object */
       /* which will be released upon freeing Provider */
       struct _SubscriptionManager* subMgr;
   #endif /* #ifndef DISABLE_INDICATION */
   
   }Provider;
   
   struct _Library
   {
       struct _Library* next;
       struct _Library* prev;
       char libraryName[PAL_MAX_PATH_SIZE];
       Shlib* handle;
       const MI_Module* module;
       MI_Module_Self* self;
       struct _Provider* head;
       struct _Provider* tail;
       /* make provider list threadsafe */
       Lock provlock;
       ProvMgr* provmgr;
       int instanceLifetimeContext;
   };
  
 /* /*
     Adding reference to the provider:     Adding reference to the provider:
Line 101 
Line 184 
 void Provider_Addref(Provider* provider); void Provider_Addref(Provider* provider);
  
 /* /*
    * Finalize provider before free memory
    */
   void Provider_Finalize(_In_ _Post_invalid_ Provider* provider);
   
   /*
     Decrementing provider's reference     Decrementing provider's reference
     so prov mgr knows when provider becomes idle     so prov mgr knows when provider becomes idle
 */ */
Line 111 
Line 199 
 */ */
 void Provider_SetRefuseUnloadFlag(Provider* provider, MI_Boolean flag); void Provider_SetRefuseUnloadFlag(Provider* provider, MI_Boolean flag);
  
   
   #ifndef DISABLE_INDICATION
   
   /*
    * Disables indications on the specified provider.  Must be called once the
    * last subscription has been removed from the provider.
    */
   MI_Result Provider_TerminateIndication(
       _In_ Provider* provider,
       _In_ MI_Result result,
       _In_opt_ const ZChar* errorMessage,
       _In_opt_ const MI_Instance* cimError );
   
 /* /*
     Informs system that new instance was created   * Invoke EnableIndication if not called yet;
    * and invoke Subscribe call to provider;
    *
    * To ensure enable/disable thread-safe, and since
    * OMI has single IO thread, this function has to be scheduled
    * on separate thread for OMI.
    * TODO: remove separate thread if have multi-IO threads implemented
 */ */
 void Provider_NewInstanceCreated(  void Provider_InvokeSubscribe(
     Provider* provider,      _In_ Provider* provider,
     Message* msg);      _In_ SubscribeReq* msg,
       _In_ SubscriptionContext* subscrContext);
   
   MI_Result Provider_InvokeDisable(
       _Inout_ Provider* provider);
   
   /*
    * Deletes the specified subscription.  This should only be called from a
    * SubscriptionContext's Post handler.  Calls DisableIndications if it is the
    * last subscription for a provider.
    */
   MI_Result Provider_RemoveSubscription(
       _Inout_ Provider* provider,
       _In_ MI_Uint64 subscriptionID);
   
   /*
    * For Internal use only
    *
    * Designed for use by Context handlers for invoking Unsubscribe requests on
    * the specified provider
    */
   MI_Result Provider_ContextInvokeUnsubscribe(
       _Inout_ Provider* provider,
       _Inout_ SubscribeReq* originalMsg,
       _In_ MI_Uint64 subscriptionID);
   
   #endif /* #ifndef DISABLE_INDICATION */
   
   
   /* Implementation for MI_Context_GetLocalSession as the actual session is owned by the ProvMgr */
   MI_Result ProvMgr_GetLocalSesson(
       _Inout_ ProvMgr* self,
       _Out_ MI_Session *localSession);
  
 END_EXTERNC END_EXTERNC
  


Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

ViewCVS 0.9.2