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 mday 1.10 MessageQueueService(const char *name, Uint32 queueID,
54 Uint32 capabilities = 0,
55 Uint32 mask = message_mask::type_cimom |
56 message_mask::type_service |
57 message_mask::ha_request |
58 message_mask::ha_reply |
59 message_mask::ha_async ) ;
|
60 mday 1.1
61 virtual ~MessageQueueService(void);
62
63 virtual void handle_heartbeat_request(AsyncRequest *req);
64 virtual void handle_heartbeat_reply(AsyncReply *rep);
65
66 virtual void handle_AsyncIoctl(AsyncIoctl *req);
67 virtual void handle_CimServiceStart(CimServiceStart *req);
68 virtual void handle_CimServiceStop(CimServiceStop *req);
69 virtual void handle_CimServicePause(CimServicePause *req);
70 virtual void handle_CimServiceResume(CimServiceResume *req);
71
72 virtual void handle_AsyncOperationStart(AsyncOperationStart *req);
|
73 mday 1.9 virtual void handle_AsyncOperationResult(AsyncOperationResult *rep);
74 virtual void handle_AsyncLegacyOperationStart(AsyncLegacyOperationStart *req);
75 virtual void handle_AsyncLegacyOperationResult(AsyncLegacyOperationResult *rep);
76
|
77 mday 1.10 virtual Boolean isAsync(void) { return true; }
78
|
79 mday 1.4 virtual Boolean accept_async(AsyncOpNode *op);
|
80 mday 1.3 virtual Boolean messageOK(const Message *msg) ;
|
81 mday 1.15
82 virtual void enqueue(Message *) throw(IPCException);
83
|
84 mday 1.3 AsyncReply *SendWait(AsyncRequest *request);
|
85 mday 1.14 Boolean SendAsync(AsyncOpNode *op,
86 Uint32 destination,
|
87 mday 1.18 void (*callback)(AsyncOpNode *, MessageQueue *, void *),
88 MessageQueue *callback_q,
89 void *callback_ptr);
|
90 mday 1.12 Boolean SendForget(Message *msg);
|
91 mday 1.17 Boolean ForwardOp(AsyncOpNode *, Uint32 destination);
92
|
93 mday 1.3 void _completeAsyncResponse(AsyncRequest *request,
|
94 mday 1.1 AsyncReply *reply,
95 Uint32 state,
96 Uint32 flag);
97 Boolean register_service(String name, Uint32 capabilities, Uint32 mask);
98 Boolean update_service(Uint32 capabilities, Uint32 mask);
99 Boolean deregister_service(void);
|
100 mday 1.6 virtual void _shutdown_incoming_queue(void);
|
101 mday 1.1 void find_services(String name,
102 Uint32 capabilities,
103 Uint32 mask,
104 Array<Uint32> *results);
105 void enumerate_service(Uint32 queue, message_module *result);
106 Uint32 get_next_xid(void);
107 AsyncOpNode *get_op(void);
108 void return_op(AsyncOpNode *op);
|
109 mday 1.15
|
110 mday 1.1 Uint32 _mask;
111 AtomicInt _die;
112 protected:
|
113 mday 1.16 virtual void handleEnqueue(void) = 0;
114 virtual void handleEnqueue(Message *) = 0;
115 Boolean _enqueueResponse(Message *, Message *);
|
116 mday 1.7 virtual void _handle_incoming_operation(AsyncOpNode *operation, Thread *thread, MessageQueue *queue);
|
117 mday 1.3 virtual void _handle_async_request(AsyncRequest *req);
|
118 mday 1.15 virtual void _handle_async_callback(AsyncOpNode *operation);
|
119 mday 1.12 virtual void _make_response(Message *req, Uint32 code);
|
120 mday 1.13
|
121 mday 1.10 static cimom *_meta_dispatcher;
122 static AtomicInt _service_count;
123 static Mutex _meta_dispatcher_mutex;
124
|
125 mday 1.1
126 private:
|
127 mday 1.12
|
128 mday 1.4 DQueue<AsyncOpNode> _pending;
|
129 mday 1.5 AsyncDQueue<AsyncOpNode> _incoming;
|
130 mday 1.3
131 static PEGASUS_THREAD_RETURN PEGASUS_THREAD_CDECL _req_proc(void *);
|
132 mday 1.6 AtomicInt _incoming_queue_shutdown;
133
|
134 mday 1.3 Thread _req_thread;
|
135 mday 1.1
136 struct timeval _default_op_timeout;
137
138 static AtomicInt _xid;
|
139 mday 1.6
|
140 mday 1.4
|
141 mday 1.3
142
|
143 mday 1.1 };
144
145 PEGASUS_NAMESPACE_END
146
147 #endif /* Pegasus_MessageQueue_Service_h */
148
149
|