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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2