(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                        Uint32 get_pending_callback_count();
 92                    
 93                        Boolean SendForget(Message *msg);
 94                        Boolean ForwardOp(AsyncOpNode *, Uint32 destination);
 95                    
 96                    
 97                        Boolean register_service(String name, Uint32 capabilities, Uint32 mask);
 98                        Boolean update_service(Uint32 capabilities, Uint32 mask);
 99                        Boolean deregister_service();
100                        virtual void _shutdown_incoming_queue();
101                    
102                        void find_services(String name,
103                                Uint32 capabilities,
104 david.dillard 1.45             Uint32 mask,
105                                Array<Uint32> *results);
106                        void enumerate_service(Uint32 queue, message_module *result);
107                        Uint32 get_next_xid();
108                        static AsyncOpNode *get_op();
109                        void return_op(AsyncOpNode *op);
110                    
111                        Boolean operator ==(const MessageQueueService & svce) const
112                        {
113                            return operator==((const void *)&svce);
114                        }
115                    
116                        Boolean operator ==(const void *svce) const
117                        {
118                            if((const void *)this == svce)
119                                return true;
120                            return false;
121                        }
122                    
123                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL polling_routine(void *);
124                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL kill_idle_threads(void *);
125 david.dillard 1.45     static ThreadPool *get_thread_pool();
126                    
127                        Uint32 _mask;
128                        AtomicInt _die;
129                    
130                    protected:
131                        virtual Boolean accept_async(AsyncOpNode *op);
132                        virtual Boolean messageOK(const Message *msg);
133                        virtual void handleEnqueue() = 0;
134                        virtual void handleEnqueue(Message *) = 0;
135                        Boolean _enqueueResponse(Message *, Message *);
136 mday          1.22 //      virtual void _handle_incoming_operation(AsyncOpNode *operation, Thread *thread, MessageQueue *queue);
137 david.dillard 1.45     virtual void _handle_incoming_operation(AsyncOpNode *);
138                    
139                        virtual void _handle_async_request(AsyncRequest *req);
140                        virtual void _handle_async_callback(AsyncOpNode *operation);
141                        virtual void _make_response(Message *req, Uint32 code);
142                    
143                        virtual void handle_heartbeat_request(AsyncRequest *req);
144                        virtual void handle_heartbeat_reply(AsyncReply *rep);
145                    
146                        virtual void handle_AsyncIoctl(AsyncIoctl *req);
147                        virtual void handle_CimServiceStart(CimServiceStart *req);
148                        virtual void handle_CimServiceStop(CimServiceStop *req);
149                        virtual void handle_CimServicePause(CimServicePause *req);
150                        virtual void handle_CimServiceResume(CimServiceResume *req);
151                    
152                        virtual void handle_AsyncOperationStart(AsyncOperationStart *req);
153                        virtual void handle_AsyncOperationResult(AsyncOperationResult *rep);
154                        virtual void handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req);
155                        virtual void handle_AsyncLegacyOperationResult(AsyncLegacyOperationResult *rep);
156                    
157                        void _completeAsyncResponse(AsyncRequest *request,
158 david.dillard 1.45                 AsyncReply *reply,
159                                    Uint32 state,
160                                    Uint32 flag);
161                        void _complete_op_node(AsyncOpNode *, Uint32, Uint32, Uint32);
162                    
163                        static cimom *_meta_dispatcher;
164                        static AtomicInt _service_count;
165                        static Mutex _meta_dispatcher_mutex;
166                    
167                    private:
168                        AsyncDQueue<AsyncOpNode> _incoming;
169                        DQueue<AsyncOpNode> _callback;
170                        static Thread* _polling_thread;
171                        static Semaphore _polling_sem;
172                        static AtomicInt _stop_polling;
173                        static AtomicInt _check_idle_flag;
174                    
175                        static DQueue<MessageQueueService> _polling_list;
176                    
177                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _req_proc(void *);
178                        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _callback_proc(void *);
179 david.dillard 1.45 
180                        static void _sendwait_callback(AsyncOpNode *, MessageQueue *, void *);
181                    
182                        AtomicInt _incoming_queue_shutdown;
183                        Semaphore _callback_ready;
184                    
185                        Thread _callback_thread;
186                    
187                    protected:
188                        static ThreadPool *_thread_pool;
189                    
190                    private:
191                        struct timeval _default_op_timeout;
192                        static AtomicInt _xid;
193                        friend class cimom;
194                        friend class CIMServer;
195 mday          1.1  };
196                    
197                    PEGASUS_NAMESPACE_END
198                    
199                    #endif /* Pegasus_MessageQueue_Service_h */

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2