1 martin 1.29 //%LICENSE////////////////////////////////////////////////////////////////
|
2 martin 1.30 //
|
3 martin 1.29 // Licensed to The Open Group (TOG) under one or more contributor license
4 // agreements. Refer to the OpenPegasusNOTICE.txt file distributed with
5 // this work for additional information regarding copyright ownership.
6 // Each contributor licenses this file to you under the OpenPegasus Open
7 // Source License; you may not use this file except in compliance with the
8 // License.
|
9 martin 1.30 //
|
10 martin 1.29 // Permission is hereby granted, free of charge, to any person obtaining a
11 // copy of this software and associated documentation files (the "Software"),
12 // to deal in the Software without restriction, including without limitation
13 // the rights to use, copy, modify, merge, publish, distribute, sublicense,
14 // and/or sell copies of the Software, and to permit persons to whom the
15 // Software is furnished to do so, subject to the following conditions:
|
16 martin 1.30 //
|
17 martin 1.29 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
|
19 martin 1.30 //
|
20 martin 1.29 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
|
21 martin 1.30 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
|
22 martin 1.29 // MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
23 // IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
24 // CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
25 // TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
26 // SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
27 martin 1.30 //
|
28 martin 1.29 //////////////////////////////////////////////////////////////////////////
|
29 kumpf 1.1 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32
|
33 kumpf 1.3 #ifndef Pegasus_IndicationHandlerService_h
34 #define Pegasus_IndicationHandlerService_h
|
35 kumpf 1.1
36 #include <sys/types.h>
37 #include <iostream>
38 #include <stdio.h>
39 #include <string.h>
40
41 #include <Pegasus/Common/Config.h>
42 #include <Pegasus/Common/AsyncOpNode.h>
43 #include <Pegasus/Common/MessageQueueService.h>
44 #include <Pegasus/Common/CIMMessage.h>
45 #include <Pegasus/Handler/CIMHandler.h>
46 #include <Pegasus/Repository/CIMRepository.h>
47
|
48 kumpf 1.27 #include <Pegasus/HandlerService/HandlerTable.h>
|
49 chuck 1.13 #include <Pegasus/HandlerService/Linkage.h>
|
50 kumpf 1.1
|
51 venkat.puvvada 1.32 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
52 #include <Pegasus/HandlerService/DestinationQueue.h>
53 #endif
54
|
55 kumpf 1.1 PEGASUS_NAMESPACE_BEGIN
56
|
57 kumpf 1.27 class PEGASUS_HANDLER_SERVICE_LINKAGE IndicationHandlerService :
58 public MessageQueueService
|
59 kumpf 1.1 {
|
60 kumpf 1.27 public:
|
61 kumpf 1.31
|
62 kumpf 1.27 typedef MessageQueueService Base;
|
63 kumpf 1.31
|
64 kumpf 1.27 IndicationHandlerService(CIMRepository* repository);
|
65 kumpf 1.3
|
66 venkat.puvvada 1.32 ~IndicationHandlerService();
|
67 kumpf 1.31
|
68 kumpf 1.27 virtual void _handle_async_request(AsyncRequest* req);
|
69 kumpf 1.4
|
70 kumpf 1.27 virtual void handleEnqueue(Message*);
|
71 kumpf 1.4
|
72 kumpf 1.27 virtual void handleEnqueue();
|
73 kumpf 1.1
|
74 kumpf 1.27 AtomicInt dienow;
|
75 carolann.graves 1.26
|
76 kumpf 1.27 private:
77 IndicationHandlerService(); // unimplemented
|
78 kumpf 1.3
|
79 kumpf 1.27 CIMRepository* _repository;
|
80 anusha.kandepu 1.33
81 void filterInstance(bool includeQualifiers,bool includeClassOrigin,
82 const CIMPropertyList& propertyList,CIMInstance & newInstance);
|
83 kumpf 1.1
|
84 kumpf 1.27 CIMHandleIndicationResponseMessage* _handleIndication(
|
85 venkat.puvvada 1.36 CIMHandleIndicationRequestMessage* request);
|
86 kumpf 1.1
|
87 kumpf 1.27 HandlerTable _handlerTable;
|
88 kumpf 1.1
|
89 kumpf 1.27 CIMHandler* _lookupHandlerForClass(const CIMName& className);
|
90 yi.zhou 1.22
|
91 kumpf 1.27 Boolean _loadHandler(
92 CIMHandleIndicationRequestMessage* request,
93 CIMException& cimException);
|
94 venkat.puvvada 1.32
95 Boolean _loadHandler(
96 const OperationContext& context,
97 const String nameSpace,
98 CIMInstance& indicationInstance,
99 CIMInstance& indicationHandlerInstance,
100 CIMInstance& indicationSubscriptionInstance,
|
101 venkat.puvvada 1.37 CIMException& cimException,
102 IndicationExportConnection **connection);
|
103 venkat.puvvada 1.32
104 #ifdef PEGASUS_ENABLE_DMTF_INDICATION_PROFILE_SUPPORT
105
106 /**
107 This method is called when HandlerService receives the
108 CIMNotifySubscriptionNotActiveRequestMessage. Indications matching the
109 subscription will be discarded from the queue and traced.
110 */
111 CIMNotifySubscriptionNotActiveResponseMessage*
112 _handleSubscriptionNotActiveRequest(
113 CIMNotifySubscriptionNotActiveRequestMessage *message);
114
115 /**
116 This method is called when HandlerService receives the
117 CIMNotifySubscriptionNotActiveRequestMessage. Queue will be deleted.
118 */
119 CIMNotifyListenerNotActiveResponseMessage* _handleListenerNotActiveRequest(
120 CIMNotifyListenerNotActiveRequestMessage *message);
121
122 /**
|
123 ashok.pathak 1.39 This method is called when HandlerService receives the
124 CIMNotifyConfigChangeRequestMessage. Property DeliveryRetryAttempts
125 & DeliveryRetryInterval get updated
126 */
127 CIMNotifyConfigChangeResponseMessage*
128 _handlePropertyUpdateRequest(
129 CIMNotifyConfigChangeRequestMessage *message);
130
131
132 /**
|
133 venkat.puvvada 1.32 This method is called to stop dispatcher thread when HandlerService
134 receives the CimServiceStop request.
135 */
136 void _stopDispatcher();
137
138 /**
139 Tries to deliver the indication, returns true if delivery is successful
140 else false.
141 */
142 void _deliverIndication(IndicationInfo *info);
143
144 /**
145 This method is called when indication in the form of
146 CIMHandleIndicationRequestMessage arrives to HandlerService from
147 IndicationService. This method sets the sequence-identfier to the
|
148 marek 1.34 indication and enqueues the indication into the destination queue.
|
149 venkat.puvvada 1.32 */
|
150 marek 1.34 void _setSequenceIdentifierAndEnqueue(
|
151 venkat.puvvada 1.32 CIMHandleIndicationRequestMessage *message);
152
153 /**
|
154 marek 1.34 Starts the dispatcher thread.
155 */
156 void _startDispatcher();
|
157 venkat.puvvada 1.32
158 /**
159 This method is called when indication delivery has failed.
160 This method enqueues the indication on to the DestinationQueue.
161 */
162 void _destinationQueueEnqueue(
163 CIMHandleIndicationRequestMessage *message);
164
165 CIMResponseMessage*
166 _handleEnumerateInstancesRequest(
167 CIMEnumerateInstancesRequestMessage *message);
168
169 CIMResponseMessage*
170 _handleEnumerateInstanceNamesRequest(
171 CIMEnumerateInstanceNamesRequestMessage *message);
172
|
173 venkat.puvvada 1.38 CIMResponseMessage*
174 _handleGetInstanceRequest(
175 CIMGetInstanceRequestMessage *message);
176
177 Array<CIMInstance> _getDestinationQueues(
178 const CIMObjectPath &getInstanceName,
179 Boolean includeQualifiers,
180 Boolean includeClassOrigin,
181 const CIMPropertyList &propList);
182
|
183 venkat.puvvada 1.32 /**
184 Gets the Queue name from either subscriptionName or handlerName,
185 constructed as follows.
186 namespace:ClassName.Name=\"HandlerName\".
187 */
188 String _getQueueName(
189 const CIMObjectPath &instancePath);
190
191 typedef HashTable<
192 String,
193 DestinationQueue*,
194 EqualFunc<String>,
195 HashFunc<String> > DestinationQueueTable;
196
197 DestinationQueueTable _destinationQueueTable;
198 ReadWriteSem _destinationQueueTableLock;
199
200 AtomicInt _deliveryThreadsRunningCount;
201 AtomicInt _dispatcherThreadRunning;
202 List<IndicationInfo, Mutex> _deliveryQueue;
203 ThreadPool _deliveryThreadPool;
204 venkat.puvvada 1.32 Thread _dispatcherThread;
205 AtomicInt _stopDispatcherThread;
206 const Uint32 _maxDeliveryThreads;
|
207 marek 1.34 Semaphore _dispatcherWaitSemaphore;
|
208 venkat.puvvada 1.32 static ThreadReturnType PEGASUS_THREAD_CDECL
209 _dispatcherRoutine(void *param);
210 static ThreadReturnType PEGASUS_THREAD_CDECL _deliveryRoutine(void *param);
211 #endif
|
212 kumpf 1.1 };
213
214 PEGASUS_NAMESPACE_END
215
216 #endif
|