1 karl 1.23 //%2006////////////////////////////////////////////////////////////////////////
|
2 mday 1.1 //
|
3 karl 1.20 // 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.19 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.20 // 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.21 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.23 // 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 kumpf 1.14 // 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 mday 1.1 // 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.23 //
|
21 kumpf 1.14 // THE ABOVE COPYRIGHT NOTICE AND THIS PERMISSION NOTICE SHALL BE INCLUDED IN
|
22 mday 1.1 // 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 kumpf 1.14 // 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 mday 1.1 // 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 //%/////////////////////////////////////////////////////////////////////////////
33
|
34 kumpf 1.30 #ifndef Pegasus_Cimom_h
35 #define Pegasus_Cimom_h
|
36 mday 1.1
37 #include <Pegasus/Common/Config.h>
|
38 kumpf 1.16 #include <Pegasus/Common/InternalException.h>
|
39 mday 1.1 #include <Pegasus/Common/MessageQueue.h>
|
40 mike 1.25 #include <Pegasus/Common/AsyncQueue.h>
|
41 mday 1.1 #include <Pegasus/Common/Thread.h>
|
42 kumpf 1.17 #include <Pegasus/Common/ArrayInternal.h>
|
43 mday 1.1 #include <Pegasus/Common/AsyncOpNode.h>
44 #include <Pegasus/Common/CimomMessage.h>
|
45 mday 1.3 #include <Pegasus/Common/MessageQueueService.h>
|
46 mday 1.1 //#include <Pegasus/Server/CIMOperationRequestDispatcher.h>
47 //#include <Pegasus/Server/CIMOperationResponseEncoder.h>
48 //#include <Pegasus/Server/CIMOperationRequestDecoder.h>
|
49 kumpf 1.15 #include <Pegasus/Common/Linkage.h>
|
50 mike 1.25 #include <Pegasus/Common/List.h>
|
51 mike 1.28 #include <Pegasus/Common/Mutex.h>
52 #include <Pegasus/Common/Time.h>
|
53 mday 1.1
54 PEGASUS_NAMESPACE_BEGIN
55
|
56 mday 1.9 extern const Uint32 CIMOM_Q_ID;
|
57 mday 1.1
|
58 david.dillard 1.22 class PEGASUS_COMMON_LINKAGE module_capabilities
|
59 mday 1.1 {
|
60 kumpf 1.30 public:
61 static Uint32 async;
62 static Uint32 remote;
63 static Uint32 trusted;
64 static Uint32 paused;
65 static Uint32 stopped;
66 static Uint32 module_controller;
67 };
|
68 mday 1.1
|
69 mike 1.25 class PEGASUS_COMMON_LINKAGE message_module : public Linkable
|
70 mday 1.1 {
|
71 kumpf 1.30 public:
72 message_module() : _name(), _capabilities(0), _mask(0), _q_id(0) { }
|
73 david.dillard 1.22
|
74 kumpf 1.30 message_module(
75 const String & name,
76 Uint32 capabilities,
77 Uint32 mask,
78 Uint32 queue)
79 : _name(name), _modules(), _capabilities(capabilities),
80 _mask(mask), _q_id(queue) { }
81
82 Boolean operator==(const message_module* mm) const;
83 Boolean operator==(const String& name) const;
84 Boolean operator==(Uint32) const;
85 const String& get_name() const;
86 Uint32 get_capabilities() const;
87 Uint32 get_mask() const;
88 Uint32 get_queue() const;
89
90 void put_name(String& name);
91 void put_capabilities(Uint32 capabilities);
92 void put_mask(Uint32 mask);
93 void put_queue(Uint32 queue);
94
95 kumpf 1.30 private:
96 String _name;
97 Array<String> _modules;
98 Uint32 _capabilities;
99 Uint32 _mask;
100 struct timeval _heartbeat;
|
101 mday 1.1
|
102 kumpf 1.30 Uint32 _q_id;
103 friend class cimom;
|
104 mday 1.1 };
105
|
106 mday 1.10 class MessageQueueService;
107
|
108 mday 1.1 class PEGASUS_COMMON_LINKAGE cimom : public MessageQueue
109 {
|
110 kumpf 1.30 public:
111 cimom();
112 virtual ~cimom();
113
114 Boolean moduleChange(struct timeval last);
115
116 Uint32 getModuleCount();
117 Uint32 getModuleIDs(Uint32* ids, Uint32 count);
118
119 AsyncOpNode* get_cached_op();
120 void cache_op(AsyncOpNode* op);
121
122 void set_default_op_timeout(const struct timeval* buffer);
123 void get_default_op_timeout(struct timeval* timeout) const;
124
125 protected:
126 Uint32 get_module_q(const String& name);
127 static void _make_response(Message* req, Uint32 code);
128 static void _completeAsyncResponse(
129 AsyncRequest* request,
130 AsyncReply* reply,
131 kumpf 1.30 Uint32 state,
132 Uint32 flag);
133 static void _complete_op_node(
134 AsyncOpNode* op,
135 Uint32 state,
136 Uint32 flag,
137 Uint32 code);
138 static void _default_callback(AsyncOpNode*, MessageQueue*, void*);
139
140 private:
141 struct timeval _default_op_timeout;
142 struct timeval _last_module_change;
143 List<message_module, Mutex> _modules;
144
145 AsyncQueue<AsyncOpNode> _routed_ops;
146
147 static ThreadReturnType PEGASUS_THREAD_CDECL _routing_proc(void*);
148
149 Thread _routing_thread;
150
151 void _handle_cimom_op(
152 kumpf 1.30 AsyncOpNode* op,
153 Thread* thread,
154 MessageQueue* queue);
155 Uint32 _ioctl(Uint32, Uint32, void*);
156
157 virtual void handleEnqueue();
158 void register_module(RegisterCimService* msg);
159 void deregister_module(Uint32 quid);
160 void update_module(UpdateCimService* msg);
161 void ioctl(AsyncIoctl* msg);
162
163 void find_service_q(FindServiceQueue* msg);
164 void enumerate_service(EnumerateService* msg);
165 Boolean route_async(AsyncOpNode* operation);
166 void _shutdown_routed_queue();
167
168 void _registered_module_in_service(RegisteredModule* msg);
169 void _deregistered_module_in_service(DeRegisteredModule* msg);
170 void _find_module_in_service(FindModuleInService* msg);
|
171 mday 1.1
|
172 kumpf 1.30 AtomicInt _die;
173 AtomicInt _routed_queue_shutdown;
|
174 david.dillard 1.22
|
175 kumpf 1.30 static cimom *_global_this;
|
176 mday 1.1
|
177 kumpf 1.30 friend class MessageQueueService;
|
178 mday 1.1 };
179
180 PEGASUS_NAMESPACE_END
181
|
182 kumpf 1.30 #endif // Pegasus_Cimom_h
|