version 1.10, 2002/03/27 20:42:07
|
version 1.11, 2002/03/28 22:56:24
|
|
|
#include <Pegasus/Common/Cimom.h> | #include <Pegasus/Common/Cimom.h> |
#include <Pegasus/Common/CimomMessage.h> | #include <Pegasus/Common/CimomMessage.h> |
#include <Pegasus/Common/MessageQueueService.h> | #include <Pegasus/Common/MessageQueueService.h> |
|
|
|
#ifndef min |
|
#define min(a, b) ((a) < (b) ? (a) : (b) ) |
|
#endif |
|
|
|
#include <bitset> |
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
class ModuleController; | class ModuleController; |
|
|
class PEGASUS_COMMON_LINKAGE ModuleController : public MessageQueueService | class PEGASUS_COMMON_LINKAGE ModuleController : public MessageQueueService |
{ | { |
| |
|
|
public: | public: |
typedef MessageQueueService Base; | typedef MessageQueueService Base; |
| |
|
enum |
|
{ |
|
GET_CLIENT_HANDLE, |
|
REGISTER_MODULE, |
|
DEREGISTER_MODULE, |
|
FIND_SERVICE, |
|
FIND_MODULE_IN_SERVICE, |
|
GET_MODULE_REFERENCE, |
|
MODULE_SEND_WAIT, |
|
MODULE_SEND_WAIT_MODULE, |
|
MODULE_SEND_ASYNC, |
|
MODULE_SEND_ASYNC_MODULE, |
|
BLOCKING_THREAD_EXEC, |
|
ASYNC_THREAD_EXEC, |
|
NUMBER_OPERATIONS |
|
} ; |
|
private: |
|
class PEGASUS_COMMON_LINKAGE client_handle |
|
{ |
|
public: |
|
client_handle(void) |
|
: _allowed_operations(0), |
|
_allowed_destinations(0), |
|
_allowed_sources(0), |
|
_identity(NULL) |
|
{ |
|
} |
|
|
|
~client_handle(void); |
|
|
|
private: |
|
friend class ModuleController; |
|
client_handle(Uint32 operations, |
|
Uint32 destinations, |
|
Uint32 sources, |
|
void *identity) |
|
: _allowed_operations(operations), |
|
_allowed_destinations(destinations), |
|
_allowed_sources(sources), |
|
_identity(identity) |
|
{ |
|
} |
|
|
|
bitset<NUMBER_OPERATIONS> _allowed_operations; |
|
bitset<128> _allowed_destinations; |
|
bitset<128> _allowed_sources; |
|
void *_identity; |
|
|
|
Boolean allowed(Uint32 operation, |
|
Uint32 destination, |
|
Uint32 source, |
|
void *identity) |
|
{ |
|
return true; |
|
} |
|
}; |
|
|
|
public: |
|
|
|
|
ModuleController(const char *name); | ModuleController(const char *name); |
ModuleController(const char *name, | ModuleController(const char *name, |
Sint16 min_threads, | Sint16 min_threads, |
|
|
| |
~ModuleController(void); | ~ModuleController(void); |
| |
|
static ModuleController & get_client_handle(const String & controller_name, |
|
void **handle); |
|
|
|
|
// module api | // module api |
static ModuleController & register_module(const String & controller_name, | static ModuleController & register_module(const String & controller_name, |
const String & module_name, | const String & module_name, |
|
|
pegasus_module **instance = NULL) | pegasus_module **instance = NULL) |
throw(AlreadyExists, IncompatibleTypes); | throw(AlreadyExists, IncompatibleTypes); |
| |
Boolean deregister_module(const String & module_name); |
Boolean deregister_module(const String & module_name) |
|
throw(Permission); |
| |
Uint32 find_service(pegasus_module & handle, const String & name) throw(Permission); | Uint32 find_service(pegasus_module & handle, const String & name) throw(Permission); |
| |
|
|
String & destination_module, | String & destination_module, |
AsyncRequest *message) throw(Permission, Deadlock, IPCException); | AsyncRequest *message) throw(Permission, Deadlock, IPCException); |
| |
// send a message to another service |
// send an async message to another service |
Boolean ModuleSendAsync(pegasus_module & handle, | Boolean ModuleSendAsync(pegasus_module & handle, |
Uint32 msg_handle, | Uint32 msg_handle, |
Uint32 destination_q, | Uint32 destination_q, |
AsyncRequest *message) throw(Permission, IPCException); | AsyncRequest *message) throw(Permission, IPCException); |
| |
// send a message to another module via another service |
// send an async message to another module via another service |
Boolean ModuleSendAsync(pegasus_module & handle, | Boolean ModuleSendAsync(pegasus_module & handle, |
Uint32 msg_handle, | Uint32 msg_handle, |
Uint32 destination_q, | Uint32 destination_q, |