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

 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              #include "AggregationContext.h"
26              #include "SubMgr.h"
27              #include <indication/common/indilog.h>
28              
29              AggregationContext* AggrContext_New()
30              {
31                  AggregationContext* newContext = (AggregationContext*)PAL_Calloc(1, sizeof(AggregationContext));
32                  if (!newContext)
33                  {
34                      LOGD_ALLOC_OOM;
35                      return NULL;
36                  }
37                  else
38                  {
39                      return newContext;
40                  }
41              }
42              
43 krisbash 1.1 _Use_decl_annotations_
44              void AggrContext_Delete(
45                  AggregationContext* self )
46              {
47                  DEBUG_ASSERT (self && (self->baseCtx.magic == 0x35eb3d3b));
48                  AggrContext_Close( self );
49                  PAL_Free(self);
50              }
51              
52              /*
53               * Perform initialization of an AggregationContext object.
54               */
55              _Use_decl_annotations_
56              MI_Result AggrContext_Init(
57                  AggregationContext* self,
58                  Provider* provider,
59                  struct _SubscriptionManager* mgr )
60              {
61                  MI_Result result = MI_RESULT_OK;
62                  DEBUG_ASSERT (self && provider && mgr);
63              
64 krisbash 1.1     /* Do AggregationContext set up prior to initializing its underlying 
65                   * Context because Context_Init also ACKs the Strand open request. 
66                   */
67                  self->mgr = mgr;
68              
69                  result = Context_Init_ByType(&self->baseCtx, provider, NULL, CTX_TYPE_IND_AGGREGATION );
70                  if (MI_RESULT_OK != result)
71                      self->mgr = NULL;
72              
73                  return result;
74              }
75              
76              _Use_decl_annotations_
77              void AggrContext_Close(
78                  AggregationContext* self )
79              {
80                  DEBUG_ASSERT( self && (self->baseCtx.magic == 0x35eb3d3b) );
81                  Context_Close(&self->baseCtx);
82              }
83              
84              _Use_decl_annotations_
85 krisbash 1.1 struct _SubscriptionManager* AggrContext_GetManager(
86                  AggregationContext* self )
87              {
88                  return self->mgr;
89              }

ViewCVS 0.9.2