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

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

No CVS admin address has been configured
Powered by
ViewCVS 0.9.2