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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2