(file) Return to IndicationRouter.h CVS log (file) (dir) Up to [Pegasus] / pegasus / src / Pegasus / Common

  1 venkat.puvvada 1.1 //%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 venkat.puvvada 1.1 // 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 venkat.puvvada 1.1 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 venkat.puvvada 1.1     };
 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 venkat.puvvada 1.1     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 venkat.puvvada 1.1     DeliveryStatusAggregator(
107                            const String &origMessageId_,
108                            Uint32 responseQid_,
109 venkat.puvvada 1.2         const String &oopAgentName_,
110                            Boolean waitUntilDelivered_);
111 venkat.puvvada 1.1 
112                        // Verifies if the ExpectedResponseCount matches the CurrentResponseCount
113                        // and delivers the CIMProcessIndicationResponseMessage to the waiter.
114                        void complete();
115                    
116                        // Increments the ExpectedResponseCount for each matched subscription.
117                        void incExpectedResponseCount();
118                    
119                        // Sets the flag to indicate the setting the ExpectedResponseCount is
120                        // completed.
121                        void expectedResponseCountSetDone();
122                    
123                        ~DeliveryStatusAggregator(){}
124                        String origMessageId;
125                        Uint32 responseQid;
126                        String oopAgentName;
127 venkat.puvvada 1.2     // If this flag is set to true, CIMProcessIndicationResponseMessage will
128                        // be sent only after the indication is delivered.
129                        Boolean waitUntilDelivered;
130 venkat.puvvada 1.1 private:
131                        void _sendDeliveryStausResponse();
132                        DeliveryStatusAggregator(
133                            const DeliveryStatusAggregator &x);
134                        DeliveryStatusAggregator& operator=(
135                            const DeliveryStatusAggregator &x);
136                        Uint32 _expectedResponseCount;
137                        Uint32 _currentResponseCount;
138                        Boolean _expectedResponseCountSetDone;
139                        Mutex _responseCountMutex;
140                    };
141                    
142                    PEGASUS_NAMESPACE_END
143                    
144                    #endif /* Pegasus_IndicationRouter_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2