(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 kumpf 1.33 #include <Pegasus/Common/Linkage.h>
 42 mday  1.1  
 43            PEGASUS_NAMESPACE_BEGIN
 44            
 45 mday  1.10 extern const Uint32 CIMOM_Q_ID;
 46 mday  1.9  
 47 mday  1.3  class message_module;
 48            
 49 mday  1.1  class PEGASUS_COMMON_LINKAGE MessageQueueService : public MessageQueue
 50            {
 51               public:
 52            
 53                  typedef MessageQueue Base;
 54                  
 55 kumpf 1.23       MessageQueueService(const char *name,
 56            			  Uint32 queueID = MessageQueue::getNextQueueId(),
 57 mday  1.10 			  Uint32 capabilities = 0, 
 58            			  Uint32 mask = message_mask::type_cimom | 
 59            			  message_mask::type_service | 
 60            			  message_mask::ha_request | 
 61            			  message_mask::ha_reply | 
 62            			  message_mask::ha_async ) ;
 63 mday  1.1        
 64                  virtual ~MessageQueueService(void);
 65 mday  1.20             
 66 mday  1.10       virtual Boolean isAsync(void) {  return true;  }
 67 mday  1.20             
 68 mday  1.15       virtual void enqueue(Message *) throw(IPCException);
 69                  
 70 mday  1.3        AsyncReply *SendWait(AsyncRequest *request);
 71 mday  1.14       Boolean SendAsync(AsyncOpNode *op, 
 72            			Uint32 destination,
 73 mday  1.18 			void (*callback)(AsyncOpNode *, MessageQueue *, void *),
 74            			MessageQueue *callback_q,
 75            			void *callback_ptr);
 76 mday  1.24 
 77                  Boolean SendAsync(Message *msg,
 78            			Uint32 destination,
 79            			void (*callback)(Message *response, void *handle, void *parameter),
 80            			void *handle, 
 81            			void *parameter);
 82                  
 83 mday  1.25       Uint32 get_pending_callback_count(void);
 84                  
 85 mday  1.12       Boolean  SendForget(Message *msg);
 86 mday  1.17       Boolean ForwardOp(AsyncOpNode *, Uint32 destination);
 87                  
 88 mday  1.19 
 89 mday  1.1        Boolean register_service(String name, Uint32 capabilities, Uint32 mask);
 90                  Boolean update_service(Uint32 capabilities, Uint32 mask);
 91                  Boolean deregister_service(void);
 92 mday  1.6        virtual void _shutdown_incoming_queue(void);
 93 mday  1.20       
 94 mday  1.1        void find_services(String name,
 95            			 Uint32 capabilities, 
 96            			 Uint32 mask, 
 97            			 Array<Uint32> *results);
 98                  void enumerate_service(Uint32 queue, message_module *result);
 99                  Uint32 get_next_xid(void);
100 mday  1.27       static AsyncOpNode *get_op(void);
101 mday  1.1        void return_op(AsyncOpNode *op);
102 mday  1.15 
103 mday  1.27       Boolean operator ==(const MessageQueueService & svce)
104                  {
105            	 return operator==((const void *)&svce);
106                  }
107                  Boolean operator ==(const void *svce)
108                  {
109            	 if((void *)this == svce)
110            	    return true;
111            	 return false;
112                  }
113            
114                  static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL polling_routine(void *);
115                  static int kill_idle_threads(void);
116                  static int pooled_threads(void) 
117                  {
118 mday  1.29 	 return _thread_pool->running_count() + _thread_pool->dead_count() + _thread_pool->pool_count();
119 mday  1.27       }
120                  
121 mday  1.1        Uint32 _mask;
122                  AtomicInt _die;
123               protected:
124 mday  1.19       virtual Boolean accept_async(AsyncOpNode *op);
125                  virtual Boolean messageOK(const Message *msg) ;
126 mday  1.16       virtual void handleEnqueue(void) = 0;
127                  virtual void handleEnqueue(Message *) = 0;
128                  Boolean _enqueueResponse(Message *, Message *);
129 mday  1.22 //      virtual void _handle_incoming_operation(AsyncOpNode *operation, Thread *thread, MessageQueue *queue);
130                  virtual void _handle_incoming_operation(AsyncOpNode *);
131                  
132 mday  1.3        virtual void _handle_async_request(AsyncRequest *req);
133 mday  1.15       virtual void _handle_async_callback(AsyncOpNode *operation);     
134 mday  1.12       virtual void _make_response(Message *req, Uint32 code);
135 mday  1.13       
136 mday  1.19 
137                  virtual void handle_heartbeat_request(AsyncRequest *req);
138                  virtual void handle_heartbeat_reply(AsyncReply *rep);
139                  
140                  virtual void handle_AsyncIoctl(AsyncIoctl *req);
141                  virtual void handle_CimServiceStart(CimServiceStart *req);
142                  virtual void handle_CimServiceStop(CimServiceStop *req);
143                  virtual void handle_CimServicePause(CimServicePause *req);
144                  virtual void handle_CimServiceResume(CimServiceResume *req);
145                  
146                  virtual void handle_AsyncOperationStart(AsyncOperationStart *req);
147                  virtual void handle_AsyncOperationResult(AsyncOperationResult *rep);
148                  virtual void handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req);
149                  virtual void handle_AsyncLegacyOperationResult(AsyncLegacyOperationResult *rep);
150            
151                  void _completeAsyncResponse(AsyncRequest *request, 
152            				 AsyncReply *reply, 
153            				 Uint32 state, 
154            				 Uint32 flag);
155 mday  1.20       void _complete_op_node(AsyncOpNode *, Uint32, Uint32, Uint32);
156                  
157 mday  1.19 
158 mday  1.10       static cimom *_meta_dispatcher;
159                  static AtomicInt _service_count;
160                  static Mutex _meta_dispatcher_mutex;
161                  
162 mday  1.1     private: 
163 mday  1.12       
164 mday  1.5        AsyncDQueue<AsyncOpNode> _incoming;
165 mday  1.24       DQueue<AsyncOpNode> _callback;
166 kumpf 1.31       static Thread* _polling_thread;
167 mday  1.27       static Semaphore _polling_sem;
168                  static AtomicInt _stop_polling;
169                  
170                  static DQueue<MessageQueueService> _polling_list;
171 mday  1.20       
172 mday  1.3        static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _req_proc(void *);
173 mday  1.24       static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _callback_proc(void *);
174                  
175 mday  1.21       static void _sendwait_callback(AsyncOpNode *, MessageQueue *, void *);
176 mday  1.30       
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