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

  1 karl  1.42 //%2005////////////////////////////////////////////////////////////////////////
  2 mday  1.1  //
  3 karl  1.41 // Copyright (c) 2000, 2001, 2002 BMC Software; Hewlett-Packard Development
  4            // Company, L.P.; IBM Corp.; The Open Group; Tivoli Systems.
  5            // Copyright (c) 2003 BMC Software; Hewlett-Packard Development Company, L.P.;
  6 karl  1.39 // IBM Corp.; EMC Corporation, The Open Group.
  7 karl  1.41 // Copyright (c) 2004 BMC Software; Hewlett-Packard Development Company, L.P.;
  8            // IBM Corp.; EMC Corporation; VERITAS Software Corporation; The Open Group.
  9 karl  1.42 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
 10            // EMC Corporation; VERITAS Software Corporation; The Open Group.
 11 mday  1.1  //
 12            // Permission is hereby granted, free of charge, to any person obtaining a copy
 13            // of this software and associated documentation files (the "Software"), to
 14            // deal in the Software without restriction, including without limitation the
 15            // rights to use, copy, modify, merge, publish, distribute, sublicense, and/or
 16            // sell copies of the Software, and to permit persons to whom the Software is
 17            // furnished to do so, subject to the following conditions:
 18 david.dillard 1.45 //
 19 mday          1.1  // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
 20                    // ALL COPIES OR SUBSTANTIAL PORTIONS OF THE SOFTWARE. THE SOFTWARE IS PROVIDED
 21                    // "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT
 22                    // LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR
 23                    // PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
 24                    // HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN
 25                    // ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION
 26                    // WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
 27                    //
 28                    //==============================================================================
 29                    //
 30                    // Author: Mike Day (mdday@us.ibm.com)
 31                    //
 32 david.dillard 1.45 // Modified By: David Dillard, VERITAS Software Corp.
 33                    //                  (david.dillard@veritas.com)
 34 mday          1.1  //
 35                    //%/////////////////////////////////////////////////////////////////////////////
 36                    
 37                    #ifndef Pegasus_MessageQueue_Service_h
 38                    #define Pegasus_MessageQueue_Service_h
 39                    
 40                    #include <Pegasus/Common/Config.h>
 41                    #include <Pegasus/Common/Message.h>
 42 kumpf         1.34 #include <Pegasus/Common/InternalException.h>
 43 mday          1.1  #include <Pegasus/Common/IPC.h>
 44                    #include <Pegasus/Common/Thread.h>
 45                    #include <Pegasus/Common/AsyncOpNode.h>
 46                    #include <Pegasus/Common/Cimom.h>
 47                    #include <Pegasus/Common/CimomMessage.h>
 48 kumpf         1.33 #include <Pegasus/Common/Linkage.h>
 49 mday          1.1  
 50                    PEGASUS_NAMESPACE_BEGIN
 51                    
 52 mday          1.10 extern const Uint32 CIMOM_Q_ID;
 53 mday          1.9  
 54 mday          1.3  class message_module;
 55                    
 56 mday          1.1  class PEGASUS_COMMON_LINKAGE MessageQueueService : public MessageQueue
 57                    {
 58 david.dillard 1.45 public:
 59                    
 60                        typedef MessageQueue Base;
 61 mday          1.1  
 62 david.dillard 1.45     MessageQueueService(const char *name,
 63                                Uint32 queueID = MessageQueue::getNextQueueId(),
 64                                Uint32 capabilities = 0,
 65                                Uint32 mask = message_mask::type_cimom |
 66                                message_mask::type_service |
 67                                message_mask::ha_request |
 68                                message_mask::ha_reply |
 69                                message_mask::ha_async );
 70                    
 71                        virtual ~MessageQueueService();
 72                    
 73                        virtual Boolean isAsync() const {  return true;  }
 74                    
 75                        // enqueue may throw an IPCException
 76                        virtual void enqueue(Message *);
 77                    
 78                        AsyncReply *SendWait(AsyncRequest *request);
 79                        Boolean SendAsync(AsyncOpNode *op,
 80                                Uint32 destination,
 81                                void (*callback)(AsyncOpNode *, MessageQueue *, void *),
 82                                MessageQueue *callback_q,
 83 david.dillard 1.45             void *callback_ptr);
 84                    
 85                        Boolean SendAsync(Message *msg,
 86                                Uint32 destination,
 87                                void (*callback)(Message *response, void *handle, void *parameter),
 88                                void *handle,
 89                                void *parameter);
 90                    
 91                        Boolean SendForget(Message *msg);
 92                        Boolean ForwardOp(AsyncOpNode *, Uint32 destination);
 93                    
 94                    
 95                        Boolean register_service(String name, Uint32 capabilities, Uint32 mask);
 96                        Boolean update_service(Uint32 capabilities, Uint32 mask);
 97                        Boolean deregister_service();
 98                        virtual void _shutdown_incoming_queue();
 99                    
100                        void find_services(String name,
101                                Uint32 capabilities,
102                                Uint32 mask,
103                                Array<Uint32> *results);
104 david.dillard 1.45     void enumerate_service(Uint32 queue, message_module *result);
105                        Uint32 get_next_xid();
106                        static AsyncOpNode *get_op();
107                        void return_op(AsyncOpNode *op);
108                    
109                        Boolean operator ==(const MessageQueueService & svce) const
110                        {
111                            return operator==((const void *)&svce);
112                        }
113                    
114                        Boolean operator ==(const void *svce) const
115                        {
116                            if((const void *)this == svce)
117                                return true;
118                            return false;
119                        }
120                    
121                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL polling_routine(void *);
122                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL kill_idle_threads(void *);
123                        static ThreadPool *get_thread_pool();
124                    
125 david.dillard 1.45     Uint32 _mask;
126                        AtomicInt _die;
127                    
128                    protected:
129                        virtual Boolean accept_async(AsyncOpNode *op);
130                        virtual Boolean messageOK(const Message *msg);
131                        virtual void handleEnqueue() = 0;
132                        virtual void handleEnqueue(Message *) = 0;
133                        Boolean _enqueueResponse(Message *, Message *);
134 mday          1.22 //      virtual void _handle_incoming_operation(AsyncOpNode *operation, Thread *thread, MessageQueue *queue);
135 david.dillard 1.45     virtual void _handle_incoming_operation(AsyncOpNode *);
136                    
137                        virtual void _handle_async_request(AsyncRequest *req);
138                        virtual void _handle_async_callback(AsyncOpNode *operation);
139                        virtual void _make_response(Message *req, Uint32 code);
140                    
141                        virtual void handle_heartbeat_request(AsyncRequest *req);
142                        virtual void handle_heartbeat_reply(AsyncReply *rep);
143                    
144                        virtual void handle_AsyncIoctl(AsyncIoctl *req);
145                        virtual void handle_CimServiceStart(CimServiceStart *req);
146                        virtual void handle_CimServiceStop(CimServiceStop *req);
147                        virtual void handle_CimServicePause(CimServicePause *req);
148                        virtual void handle_CimServiceResume(CimServiceResume *req);
149                    
150                        virtual void handle_AsyncOperationStart(AsyncOperationStart *req);
151                        virtual void handle_AsyncOperationResult(AsyncOperationResult *rep);
152                        virtual void handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req);
153                        virtual void handle_AsyncLegacyOperationResult(AsyncLegacyOperationResult *rep);
154                    
155                        void _completeAsyncResponse(AsyncRequest *request,
156 david.dillard 1.45                 AsyncReply *reply,
157                                    Uint32 state,
158                                    Uint32 flag);
159                        void _complete_op_node(AsyncOpNode *, Uint32, Uint32, Uint32);
160                    
161                        static cimom *_meta_dispatcher;
162                        static AtomicInt _service_count;
163                        static Mutex _meta_dispatcher_mutex;
164                    
165                    private:
166                        AsyncDQueue<AsyncOpNode> _incoming;
167                        static Thread* _polling_thread;
168                        static Semaphore _polling_sem;
169                        static AtomicInt _stop_polling;
170                        static AtomicInt _check_idle_flag;
171                    
172                        static DQueue<MessageQueueService> _polling_list;
173                    
174                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _req_proc(void *);
175                    
176                        static void _sendwait_callback(AsyncOpNode *, MessageQueue *, void *);
177 david.dillard 1.45 
178                        AtomicInt _incoming_queue_shutdown;
179                    
180                    protected:
181                        static ThreadPool *_thread_pool;
182                    
183                    private:
184                        struct timeval _default_op_timeout;
185                        static AtomicInt _xid;
186                        friend class cimom;
187                        friend class CIMServer;
188 mday          1.1  };
189                    
190                    PEGASUS_NAMESPACE_END
191                    
192                    #endif /* Pegasus_MessageQueue_Service_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2