1 karl 1.1.2.2 //%LICENSE////////////////////////////////////////////////////////////////
2 //
3 // 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 //
10 // 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 //
17 // The above copyright notice and this permission notice shall be included
18 // in all copies or substantial portions of the Software.
19 //
20 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS
21 // OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF
22 karl 1.1.2.2 // 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 //
28 //////////////////////////////////////////////////////////////////////////
29 //
30 //%/////////////////////////////////////////////////////////////////////////////
31
32 #ifndef Pegasus_IndicationRouter_h
33 #define Pegasus_IndicationRouter_h
34
35 #include <Pegasus/Common/Config.h>
36 #include <Pegasus/Common/Linkage.h>
37 #include <Pegasus/Common/Mutex.h>
38 #include <Pegasus/Common/String.h>
39 #include <Pegasus/Common/Exception.h>
40 #include <Pegasus/Common/HashTable.h>
41 #include <Pegasus/Common/Semaphore.h>
42
43 karl 1.1.2.2 PEGASUS_NAMESPACE_BEGIN
44
45
46 class CIMProcessIndicationRequestMessage;
47 class CIMProcessIndicationResponseMessage;
48
49 /*
50 * IndicationRouter is used for routing the indications to the indication
51 * service. If indication ordering is enabled, delivery routine waits until
52 * indication is enqueued onto the destination queue in correct order.
53 * This class used by the ProviderManagerService , ModuleController and
54 * ProviderAgent to route the indications.
55 */
56
57 class PEGASUS_COMMON_LINKAGE IndicationRouter
58 {
59 public:
60 struct DeliveryStatusEntry
61 {
62 Semaphore semaphore;
63 DeliveryStatusEntry():semaphore(0) {}
64 karl 1.1.2.2 };
65
66 IndicationRouter(
67 CIMProcessIndicationRequestMessage *request,
68 void (*router)(CIMProcessIndicationRequestMessage*));
69
70 ~IndicationRouter();
71
72 /**
73 * Delivers the indication and waits for its enqueue status if the
74 * indication ordering is enabled.
75 */
76 void deliverAndWaitForStatus();
77
78 /**
79 * Notifies the waiter that the indication delivery is completed to
80 * the HandlerService in correct order.
81 */
82 static void notify(CIMProcessIndicationResponseMessage *response);
83
84 private:
85 karl 1.1.2.2 static Mutex _statusMutex;
86 typedef HashTable<
87 String,
88 DeliveryStatusEntry*,
89 EqualFunc<String>,
90 HashFunc<String> > DeliveryStatusTable;
91
92 static DeliveryStatusTable _statusTable;
93 CIMProcessIndicationRequestMessage *_request;
94 void (*_deliveryRoutine)(CIMProcessIndicationRequestMessage*);
95 DeliveryStatusEntry *_entry;
96 };
97
98 /**
99 * DeliveryStatusAggregator is used to aggregate the handle indication
100 * responses. DeliveryStatusAggregator is created by the IndicationService
101 * if the indication orrdering is enabled.
102 */
103 class PEGASUS_COMMON_LINKAGE DeliveryStatusAggregator
104 {
105 public:
106 karl 1.1.2.2 DeliveryStatusAggregator(
107 const String &origMessageId_,
108 Uint32 responseQid_,
|