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.1
44 class PEGASUS_COMMON_LINKAGE MessageQueueService : public MessageQueue
45 {
46 public:
47
48 typedef MessageQueue Base;
49
50 MessageQueueService(const char *name, Uint32 queueID, Uint32 capabilities, Uint32 mask) ;
51
52 virtual ~MessageQueueService(void);
53
54 // don't allow derived classes to override
55 void handleEnqueue();
56 virtual void handle_heartbeat_request(AsyncRequest *req);
57 virtual void handle_heartbeat_reply(AsyncReply *rep);
58
59 virtual void handle_AsyncIoctl(AsyncIoctl *req);
60 virtual void handle_CimServiceStart(CimServiceStart *req);
61 virtual void handle_CimServiceStop(CimServiceStop *req);
62 virtual void handle_CimServicePause(CimServicePause *req);
63 virtual void handle_CimServiceResume(CimServiceResume *req);
64 mday 1.1
65 virtual void handle_AsyncOperationStart(AsyncOperationStart *req);
66 virtual void handle_AsyncOperationResult(AsyncOperationResult *req);
67
68 // virtual Boolean accept_async(Message *message) throw(IPCException);
69 // virtual Boolean messageOK(const Message *msg) ;
70
71 // virtual Message *openEnvelope(Message *msg);
72
73 void SendWait(AsyncRequest *request, unlocked_dq<AsyncMessage> *reply_list);
74 Boolean SendAsync(AsyncMessage *msg);
75 void _enqueueAsyncResponse(AsyncRequest *request,
76 AsyncReply *reply,
77 Uint32 state,
78 Uint32 flag);
79 Boolean register_service(String name, Uint32 capabilities, Uint32 mask);
80 Boolean update_service(Uint32 capabilities, Uint32 mask);
81 Boolean deregister_service(void);
82
83 void find_services(String name,
84 Uint32 capabilities,
85 mday 1.1 Uint32 mask,
86 Array<Uint32> *results);
87 void enumerate_service(Uint32 queue, message_module *result);
88 Uint32 get_next_xid(void);
89 AsyncOpNode *get_op(void);
90 void return_op(AsyncOpNode *op);
91 Uint32 _capabilities;
92 Uint32 _mask;
93 AtomicInt _die;
94 protected:
95
96 // handle all your messages. call Base:_handle_async_msg to
97 // deal with messages you don't handle
98 virtual void _handle_async_msg(AsyncMessage *msg);
99
100
101 cimom *_meta_dispatcher;
102 private:
103
104
105 struct timeval _default_op_timeout;
106 mday 1.1
107 static AtomicInt _xid;
108 void _handle_async_request(AsyncRequest *req);
109 void _handle_async_reply(AsyncReply *rep);
110 void _make_response(AsyncRequest *req, Uint32 code);
111 };
112
113 PEGASUS_NAMESPACE_END
114
115 #endif /* Pegasus_MessageQueue_Service_h */
116
117
|