1 mday 1.1 //%////-*-c++-*-////////////////////////////////////////////////////////////////
2 //
3 // Copyright (c) 2000, 2001 The Open group, BMC Software, Tivoli Systems, IBM
4 //
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 //
12 // 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 mday 1.1 //
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 #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.12 Boolean SendForget(Message *msg);
|
82 mday 1.17 Boolean ForwardOp(AsyncOpNode *, Uint32 destination);
83
|
84 mday 1.19
|
85 mday 1.1 Boolean register_service(String name, Uint32 capabilities, Uint32 mask);
86 Boolean update_service(Uint32 capabilities, Uint32 mask);
87 Boolean deregister_service(void);
|
88 mday 1.6 virtual void _shutdown_incoming_queue(void);
|
89 mday 1.20
|
90 mday 1.1 void find_services(String name,
91 Uint32 capabilities,
92 Uint32 mask,
93 Array<Uint32> *results);
94 void enumerate_service(Uint32 queue, message_module *result);
95 Uint32 get_next_xid(void);
96 AsyncOpNode *get_op(void);
97 void return_op(AsyncOpNode *op);
|
98 mday 1.15
|
99 mday 1.1 Uint32 _mask;
100 AtomicInt _die;
101 protected:
|
102 mday 1.19 virtual Boolean accept_async(AsyncOpNode *op);
103 virtual Boolean messageOK(const Message *msg) ;
|
104 mday 1.16 virtual void handleEnqueue(void) = 0;
105 virtual void handleEnqueue(Message *) = 0;
106 Boolean _enqueueResponse(Message *, Message *);
|
107 mday 1.22 // virtual void _handle_incoming_operation(AsyncOpNode *operation, Thread *thread, MessageQueue *queue);
108 virtual void _handle_incoming_operation(AsyncOpNode *);
109
|
110 mday 1.3 virtual void _handle_async_request(AsyncRequest *req);
|
111 mday 1.15 virtual void _handle_async_callback(AsyncOpNode *operation);
|
112 mday 1.12 virtual void _make_response(Message *req, Uint32 code);
|
113 mday 1.13
|
114 mday 1.19
115 virtual void handle_heartbeat_request(AsyncRequest *req);
116 virtual void handle_heartbeat_reply(AsyncReply *rep);
117
118 virtual void handle_AsyncIoctl(AsyncIoctl *req);
119 virtual void handle_CimServiceStart(CimServiceStart *req);
120 virtual void handle_CimServiceStop(CimServiceStop *req);
121 virtual void handle_CimServicePause(CimServicePause *req);
122 virtual void handle_CimServiceResume(CimServiceResume *req);
123
124 virtual void handle_AsyncOperationStart(AsyncOperationStart *req);
125 virtual void handle_AsyncOperationResult(AsyncOperationResult *rep);
126 virtual void handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req);
127 virtual void handle_AsyncLegacyOperationResult(AsyncLegacyOperationResult *rep);
128
129 void _completeAsyncResponse(AsyncRequest *request,
130 AsyncReply *reply,
131 Uint32 state,
132 Uint32 flag);
|
133 mday 1.20 void _complete_op_node(AsyncOpNode *, Uint32, Uint32, Uint32);
134
|
135 mday 1.19
|
136 mday 1.10 static cimom *_meta_dispatcher;
137 static AtomicInt _service_count;
138 static Mutex _meta_dispatcher_mutex;
139
|
140 mday 1.1 private:
|
141 mday 1.12
|
142 mday 1.5 AsyncDQueue<AsyncOpNode> _incoming;
|
143 mday 1.24 DQueue<AsyncOpNode> _callback;
|
144 mday 1.20
|
145 mday 1.3 static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _req_proc(void *);
|
146 mday 1.24 static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _callback_proc(void *);
147
|
148 mday 1.21 static void _sendwait_callback(AsyncOpNode *, MessageQueue *, void *);
|
149 mday 1.6 AtomicInt _incoming_queue_shutdown;
|
150 mday 1.24 Semaphore _callback_ready;
151
|
152 mday 1.3 Thread _req_thread;
|
153 mday 1.24 Thread _callback_thread;
154
|
155 mday 1.1 struct timeval _default_op_timeout;
156 static AtomicInt _xid;
|
157 mday 1.19 friend class cimom;
|
158 mday 1.1 };
159
160 PEGASUS_NAMESPACE_END
161
162 #endif /* Pegasus_MessageQueue_Service_h */
163
164
|