1 karl 1.8 //%2006////////////////////////////////////////////////////////////////////////
|
2 mday 1.1 //
|
3 karl 1.6 // 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.5 // IBM Corp.; EMC Corporation, The Open Group.
|
7 karl 1.6 // 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.7 // Copyright (c) 2005 Hewlett-Packard Development Company, L.P.; IBM Corp.;
10 // EMC Corporation; VERITAS Software Corporation; The Open Group.
|
11 karl 1.8 // 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.5 //
|
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 // Modified By:
35 //
36 //%/////////////////////////////////////////////////////////////////////////////
37
38
39 #ifndef SERVICE_CONTROL_include
40 #define SERVICE_CONTROL_include
41
42 mday 1.1 #include <Pegasus/Common/Config.h>
|
43 kumpf 1.4 #include <Pegasus/Common/InternalException.h>
|
44 mday 1.1 #include <Pegasus/Common/MessageQueue.h>
45 #include <Pegasus/Common/DQueue.h>
46 #include <Pegasus/Common/Thread.h>
47 #include <Pegasus/Common/Array.h>
48 #include <Pegasus/Common/AsyncOpNode.h>
49 #include <Pegasus/Common/CimomMessage.h>
50 #include <Pegasus/Common/MessageQueueService.h>
51
52 PEGASUS_NAMESPACE_BEGIN
53
54
55
56 // allows us to treat the control service as a regular provider,
57 // but also gives the service a handle into the ControlServiceManager.
58 // this handle provides the control service with access to important
59 // communication methods with "the world"
|
60 mday 1.2 class ControlServiceFacade : public ProviderFacade
|
61 mday 1.1 {
62 public:
|
63 mday 1.2
|
64 mday 1.1 typedef ProviderFacade Base;
65
66 ControlServiceFacade(ControlServiceManager *service_handle,
67 ControlService *control);
68
69 // direct call "ioctl" interface, counterpart of AsyncIoctl message
|
70 mday 1.2 // this is a general-purpose function call mechanism
71 Uint32 control_ioctl(Uint32 code, Uint32 int_param, void *ptr_param);
|
72 mday 1.1
73 virtual ~ControlServiceFacade(void);
74
75 private:
76
77 ControlServiceFacade(void);
78 } ;
79
80
81
82 // needs a reference count
|
83 mday 1.2 class PEGASUS_COMMON_LINKAGE ControlService
|
84 mday 1.1
85
86
87 class PEGASUS_COMMON_LINKAGE ControlServiceManager : public MessageQueueService
88 {
89 public:
90
91 typedef MessageQueueService Base;
92
93 ControlServiceManager(void)
94 : Base("pegasus control service mgr",
95 MessageQueue::getNextQueueId(), 0,
96 message_mask::type_cimom |
97 message_mask::type_service |
98 message_mask::ha_request |
99 message_mask::ha_reply |
100 message_mask::ha_async )
101 {
102
103 }
104
105 mday 1.1 ~ControlServiceManager(void)
106 {
107
108 }
109
110 void register_control_service(ControlService *service);
111
112
113 // caller gets a handle that provides direct calls into a control
114 // service. calls that are not supported throw a not
115 // supported exception
116 ControlServiceFacade *reference_control_service(String name);
117
118 // decrement the reference count so that we know if it
119 // is OK to delete the service
120 void dereference_control_service(String name);
121
122 // send an Async message to a control service, get a response
123 AsyncResponse *send_to_control_service(AsyncRequest *request,
124 String service_name);
125
126 mday 1.1 // for use by control providers that want to send async messages
127 // to the system
128 AsyncResponse *control_send_wait(AsyncRequest *request);
129
130 // allow the control provider to run a function on a pooled thread
131 Uint32 run_on_thread(PEGASUS_THREAD_RETURN (PEGASUS_THREAD_CDECL *work)(void *));
132
133
134
135
136 // virtual methods, not used by the control service directly.
137 virtual Boolean accept_async(AsyncOpNode *op);
138 virtual Boolean messageOK(const Message *msg) ;
139
140 virtual void _handle_incoming_operation(AsyncOpNode *operation,
141 Thread *thread,
142 MessageQueue *queue);
143 virtual void _handle_async_request(AsyncRequest *req);
144
145 private:
146
147 mday 1.1 DQueue<ControlServiceFacade> _control_services;
148 ThreadPool _service_thread_pool;
149
150 };
151
152
153
154 // need to define a message for calling into utility providers
155 // depends upon provider registration so that operations can get
156 // routed to the correct control service
157 //
158
159 PEGASUS_NAMESPACE_END
160 #endif // SERVICE_CONTROL_include
|