version 1.97, 2011/01/13 06:00:28
|
version 1.97.2.3, 2013/06/03 22:36:14
|
|
|
# include <Pegasus/IndicationService/IndicationServiceConfiguration.h> | # include <Pegasus/IndicationService/IndicationServiceConfiguration.h> |
#endif | #endif |
| |
|
#include <Pegasus/General/SubscriptionKey.h> |
|
|
PEGASUS_NAMESPACE_BEGIN | PEGASUS_NAMESPACE_BEGIN |
| |
|
// Holds information of control providers servicing the indications. |
|
struct ControlProvIndReg |
|
{ |
|
CIMName className; |
|
CIMNamespaceName nameSpace; |
|
CIMInstance providerModule; |
|
CIMInstance provider; |
|
}; |
|
|
|
typedef HashTable <String, ControlProvIndReg, EqualFunc <String>, |
|
HashFunc <String> > ControlProvIndRegTable; |
|
|
class SubscriptionRepository; | class SubscriptionRepository; |
class SubscriptionTable; | class SubscriptionTable; |
| |
|
|
| |
static Mutex _mutex; | static Mutex _mutex; |
| |
|
/** |
|
Sets property with name SystemName to sysname if existant. If |
|
property does not exist on instance, adds it. |
|
Should be used for instances of classes Filter, Handler only |
|
Does not change the objectPath of the instance !!! |
|
|
|
@param instance instance to set property on |
|
@param sysname system name to set |
|
*/ |
|
|
|
static void _setOrAddSystemNameInHandlerFilter( |
|
CIMInstance& instance, |
|
const String& sysname); |
|
|
|
/** |
|
Sets key binding with name SystemName to string if existant. Should be |
|
used with Handler and Filter object paths only |
|
|
|
@param objPath object path to change keybinding on |
|
@param sysname system name to set |
|
*/ |
|
static void _setSystemNameInHandlerFilter( |
|
CIMObjectPath& objPath, |
|
const String& sysname); |
|
|
|
/** |
|
Replace the value of SystemName in a String created from a Handler or |
|
Filter reference |
|
*/ |
|
static void _setSystemNameInHandlerFilterReference( |
|
String& reference, |
|
const String& sysname); |
|
|
|
/** |
|
Sets key binding with name SystemName in the two keybinding references |
|
Filter and Handler of a Subscription object path |
|
|
|
@param objPath object path to change SystemNames on |
|
@param sysname system name to set |
|
*/ |
|
static void _setSubscriptionSystemName( |
|
CIMObjectPath& objPath, |
|
const String& sysname); |
|
|
|
/** Replaces value in all occurences of SystemName key with String sysname |
|
used for Handler, Filter and Subscription object paths |
|
|
|
@param objPath object path to change SystemNames on |
|
@param sysname system name to set |
|
*/ |
|
static void _setSystemName(CIMObjectPath& objPath, const String& sysname); |
|
|
|
/** Replaces value in all occurences of SystemName key and SystemName |
|
property with String sysname |
|
|
|
Used for Handler, Filter and Subscription object paths |
|
|
|
@param instance instance to change |
|
@param sysname system name to set |
|
*/ |
|
static void _setSystemName(CIMInstance& instance, const String& sysname); |
|
|
|
|
private: | private: |
| |
void _initialize(); | void _initialize(); |
|
|
@param otherPropertyName name of Other___ property to be validated | @param otherPropertyName name of Other___ property to be validated |
@param defaultValue default value for property | @param defaultValue default value for property |
@param otherValue "Other" value for property | @param otherValue "Other" value for property |
@param validValues set of valid values for property |
|
@param supportedValues set of supported values for property | @param supportedValues set of supported values for property |
| |
@exception CIM_ERR_INVALID_PARAMETER if value of property or Other___ | @exception CIM_ERR_INVALID_PARAMETER if value of property or Other___ |
|
|
const CIMName& otherPropertyName, | const CIMName& otherPropertyName, |
const Uint16 defaultValue, | const Uint16 defaultValue, |
const Uint16 otherValue, | const Uint16 otherValue, |
const Array<Uint16>& validValues, |
|
const Array<Uint16>& supportedValues); | const Array<Uint16>& supportedValues); |
| |
/** | /** |
|
|
const Boolean isArray = false); | const Boolean isArray = false); |
| |
/** | /** |
Validates that all properties in the instance are supported properties, |
|
and throws an exception if an unknown, unsupported property is found. |
|
|
|
@param instance instance to be validated |
|
|
|
@exception CIM_ERR_NOT_SUPPORTED if instance includes an unknown, |
|
unsupported property |
|
*/ |
|
void _checkSupportedProperties( |
|
const CIMInstance& instance); |
|
|
|
/** |
|
Validates value of the specified Uint16 property in the instance. | Validates value of the specified Uint16 property in the instance. |
If the value of the property is not a valid value, or is not a | If the value of the property is not a valid value, or is not a |
supported value, an exception is thrown. | supported value, an exception is thrown. |
| |
@param instance instance to be validated | @param instance instance to be validated |
@param propertyName name of property to be validated | @param propertyName name of property to be validated |
@param validValues set of valid values for property |
|
@param supportedValues set of supported values for property | @param supportedValues set of supported values for property |
| |
@exception CIM_ERR_NOT_SUPPORTED if the property value is not | @exception CIM_ERR_NOT_SUPPORTED if the property value is not |
|
|
void _checkValue( | void _checkValue( |
const CIMInstance& instance, | const CIMInstance& instance, |
const CIMName& propertyName, | const CIMName& propertyName, |
const Array<Uint16>& validValues, |
|
const Array<Uint16>& supportedValues); | const Array<Uint16>& supportedValues); |
| |
/** | /** |
|
|
| |
@return list of CIMInstance subscriptions | @return list of CIMInstance subscriptions |
*/ | */ |
Array<CIMInstance> _getMatchingSubscriptions( |
Array<SubscriptionWithSrcNamespace> _getMatchingSubscriptions( |
const CIMName& supportedClass, | const CIMName& supportedClass, |
const Array<CIMNamespaceName> nameSpaces, | const Array<CIMNamespaceName> nameSpaces, |
const CIMPropertyList& supportedProperties, | const CIMPropertyList& supportedProperties, |
|
|
const Array<CIMNamespaceName>& oldNameSpaces, | const Array<CIMNamespaceName>& oldNameSpaces, |
const CIMPropertyList& newProperties, | const CIMPropertyList& newProperties, |
const CIMPropertyList& oldProperties, | const CIMPropertyList& oldProperties, |
Array<CIMInstance>& newSubscriptions, |
Array<SubscriptionWithSrcNamespace>& newSubscriptions, |
Array<CIMInstance>& formerSubscriptions); |
Array<SubscriptionWithSrcNamespace>& formerSubscriptions); |
| |
/** | /** |
Determines if all of the required properties in the specified list | Determines if all of the required properties in the specified list |
|
|
Retrieves the list of indication providers that serve the specified | Retrieves the list of indication providers that serve the specified |
indication subclasses. | indication subclasses. |
| |
@param queryExpression the query expression |
@param query the query |
@param nameSpace the namespace name |
@param queyLang the query language |
@param indicationClassName the indication class name | @param indicationClassName the indication class name |
@param indicationSubclasses the list of indication subclass names | @param indicationSubclasses the list of indication subclass names |
| |
@return list of ProviderClassList structs | @return list of ProviderClassList structs |
*/ | */ |
Array<ProviderClassList> _getIndicationProviders( | Array<ProviderClassList> _getIndicationProviders( |
const QueryExpression& queryExpression, |
const String &query, |
const CIMNamespaceName& nameSpace, |
const String &queryLang, |
const CIMName& indicationClassName, | const CIMName& indicationClassName, |
const Array<CIMName>& indicationSubclasses) const; |
const Array<NamespaceClassList>& indicationSubclasses) const; |
| |
/** | /** |
Retrieves the list of required properties (all the properties | Retrieves the list of required properties (all the properties |
|
|
void _deleteExpiredSubscription( | void _deleteExpiredSubscription( |
CIMObjectPath& subscription); | CIMObjectPath& subscription); |
| |
|
#ifdef PEGASUS_ENABLE_PROTOCOL_WSMAN |
|
/** |
|
Deletes filter and handler of the specified subscription |
|
|
|
@param subscription instance |
|
*/ |
|
void _deleteFilterHandler( |
|
CIMInstance &subscriptionInstance); |
|
#endif |
|
|
/** | /** |
Gets the Subscription Time Remaining property | Gets the Subscription Time Remaining property |
| |
|
|
classes | classes |
@param propertyList Output list of properties required by the | @param propertyList Output list of properties required by the |
subscription | subscription |
@param sourceNameSpace Output source namespace for filter query |
|
@param condition Output condition part of the filter query | @param condition Output condition part of the filter query |
@param query Output filter query | @param query Output filter query |
@param queryLanguage Output query language in which the filter | @param queryLanguage Output query language in which the filter |
|
|
*/ | */ |
void _getCreateParams( | void _getCreateParams( |
const CIMInstance& subscriptionInstance, | const CIMInstance& subscriptionInstance, |
Array<CIMName>& indicationSubclasses, |
Array<NamespaceClassList>& indicationSubclasses, |
Array<ProviderClassList>& indicationProviders, | Array<ProviderClassList>& indicationProviders, |
CIMPropertyList& propertyList, | CIMPropertyList& propertyList, |
CIMNamespaceName& sourceNameSpace, |
|
String& condition, | String& condition, |
String& query, | String& query, |
String& queryLanguage); | String& queryLanguage); |
|
|
class in filter query | class in filter query |
@param propertyList Output list of properties required by the | @param propertyList Output list of properties required by the |
subscription | subscription |
@param sourceNameSpace Output source namespace for filter query |
|
@param condition Output condition part of the filter query | @param condition Output condition part of the filter query |
@param query Output filter query | @param query Output filter query |
@param queryLanguage Output query language in which the filter | @param queryLanguage Output query language in which the filter |
|
|
*/ | */ |
void _getCreateParams( | void _getCreateParams( |
const CIMInstance& subscriptionInstance, | const CIMInstance& subscriptionInstance, |
Array<CIMName>& indicationSubclasses, |
Array<NamespaceClassList>& indicationSubclasses, |
CIMPropertyList& propertyList, | CIMPropertyList& propertyList, |
CIMNamespaceName& sourceNameSpace, |
|
String& condition, | String& condition, |
String& query, | String& query, |
String& queryLanguage); | String& queryLanguage); |
|
|
@param subscriptionInstance Input subscription instance | @param subscriptionInstance Input subscription instance |
@param indicationSubclasses Output list of subclasses of indication | @param indicationSubclasses Output list of subclasses of indication |
class in filter query | class in filter query |
@param sourceNameSpace Output source namespace for filter query |
|
| |
@return List of providers with associated classes to Delete | @return List of providers with associated classes to Delete |
*/ | */ |
Array<ProviderClassList> _getDeleteParams( | Array<ProviderClassList> _getDeleteParams( |
const CIMInstance& subscriptionInstance, | const CIMInstance& subscriptionInstance, |
Array<CIMName>& indicationSubclasses, |
Array<NamespaceClassList>& indicationSubclasses); |
CIMNamespaceName& sourceNameSpace); |
|
| |
/** | /** |
Sends Create subscription request for the specified subscription | Sends Create subscription request for the specified subscription |
|
|
In case (3), there is no original request and no response is required. | In case (3), there is no original request and no response is required. |
| |
@param indicationProviders list of providers with associated classes | @param indicationProviders list of providers with associated classes |
@param nameSpace the nameSpace name of the resource being |
with the nameSpace name of the resource |
monitored, from the SourceNamespace |
being monitored, from the SourceNamespace |
property of the CIM_IndicationFilter | property of the CIM_IndicationFilter |
instance for the specified | instance for the specified |
subscription | subscription |
|
|
*/ | */ |
void _sendAsyncCreateRequests( | void _sendAsyncCreateRequests( |
const Array<ProviderClassList>& indicationProviders, | const Array<ProviderClassList>& indicationProviders, |
const CIMNamespaceName& nameSpace, |
|
const CIMPropertyList& propertyList, | const CIMPropertyList& propertyList, |
const String& condition, | const String& condition, |
const String& query, | const String& query, |
|
|
const AcceptLanguageList& acceptLangs, | const AcceptLanguageList& acceptLangs, |
const ContentLanguageList& contentLangs, | const ContentLanguageList& contentLangs, |
const CIMRequestMessage * origRequest, | const CIMRequestMessage * origRequest, |
const Array<CIMName>& indicationSubclasses, |
const Array<NamespaceClassList>& indicationSubclasses, |
const String& userName, | const String& userName, |
const String& authType = String::EMPTY); | const String& authType = String::EMPTY); |
| |
|
|
response is required. | response is required. |
| |
@param indicationProviders list of providers with associated classes | @param indicationProviders list of providers with associated classes |
@param nameSpace the nameSpace name of the resource being |
with the nameSpace name of the resource |
monitored, from the SourceNamespace |
being monitored, from the SourceNamespace |
property of the CIM_IndicationFilter | property of the CIM_IndicationFilter |
instance for the specified | instance for the specified |
subscription | subscription |
|
|
*/ | */ |
Array<ProviderClassList> _sendWaitCreateRequests( | Array<ProviderClassList> _sendWaitCreateRequests( |
const Array<ProviderClassList>& indicationProviders, | const Array<ProviderClassList>& indicationProviders, |
const CIMNamespaceName& nameSpace, |
|
const CIMPropertyList& propertyList, | const CIMPropertyList& propertyList, |
const String& condition, | const String& condition, |
const String& query, | const String& query, |
|
|
request to which the Indication Service must respond. | request to which the Indication Service must respond. |
| |
@param indicationProviders list of providers with associated classes | @param indicationProviders list of providers with associated classes |
@param nameSpace the nameSpace name of the resource being |
with the nameSpace name of the resource |
monitored, from the SourceNamespace |
being monitored, from the SourceNamespace |
property of the CIM_IndicationFilter | property of the CIM_IndicationFilter |
instance for the specified | instance for the specified |
subscription | subscription |
|
|
*/ | */ |
void _sendWaitModifyRequests( | void _sendWaitModifyRequests( |
const Array<ProviderClassList>& indicationProviders, | const Array<ProviderClassList>& indicationProviders, |
const CIMNamespaceName& nameSpace, |
|
const CIMPropertyList& propertyList, | const CIMPropertyList& propertyList, |
const String& condition, | const String& condition, |
const String& query, | const String& query, |
|
|
orginal request and no response is required. | orginal request and no response is required. |
| |
@param indicationProviders list of providers with associated classes | @param indicationProviders list of providers with associated classes |
@param nameSpace the nameSpace name of the resource being |
with the nameSpace name of the resource |
monitored, from the SourceNamespace |
being monitored, from the SourceNamespace |
property of the CIM_IndicationFilter | property of the CIM_IndicationFilter |
instance for the specified | instance for the specified |
subscription | subscription |
|
|
*/ | */ |
void _sendAsyncDeleteRequests( | void _sendAsyncDeleteRequests( |
const Array<ProviderClassList>& indicationProviders, | const Array<ProviderClassList>& indicationProviders, |
const CIMNamespaceName& nameSpace, |
|
const CIMInstance& subscription, | const CIMInstance& subscription, |
const AcceptLanguageList& acceptLangs, | const AcceptLanguageList& acceptLangs, |
const ContentLanguageList& contentLangs, | const ContentLanguageList& contentLangs, |
const CIMRequestMessage * origRequest, | const CIMRequestMessage * origRequest, |
const Array<CIMName>& indicationSubclasses, |
const Array<NamespaceClassList>& indicationSubclasses, |
const String& userName, | const String& userName, |
const String& authType = String::EMPTY); | const String& authType = String::EMPTY); |
| |
|
|
Service must respond. | Service must respond. |
| |
@param indicationProviders list of providers with associated classes | @param indicationProviders list of providers with associated classes |
@param nameSpace the nameSpace name of the resource being |
with the nameSpace name of the resource |
monitored, from the SourceNamespace |
being monitored, from the SourceNamespace |
property of the CIM_IndicationFilter | property of the CIM_IndicationFilter |
instance for the specified | instance for the specified |
subscription | subscription |
|
|
*/ | */ |
void _sendWaitDeleteRequests( | void _sendWaitDeleteRequests( |
const Array<ProviderClassList>& indicationProviders, | const Array<ProviderClassList>& indicationProviders, |
const CIMNamespaceName& nameSpace, |
|
const CIMInstance& subscription, | const CIMInstance& subscription, |
const AcceptLanguageList& acceptLangs, | const AcceptLanguageList& acceptLangs, |
const ContentLanguageList& contentLangs, | const ContentLanguageList& contentLangs, |
|
|
String& creator) const; | String& creator) const; |
| |
/** | /** |
Validates the specified SubscriptionState property value. |
|
|
|
@param state SubscriptionState property value |
|
|
|
@return True, if the SubscriptionState property value is valid; |
|
False otherwise |
|
*/ |
|
Boolean _validateState( |
|
const Uint16 state) const; |
|
|
|
/** |
|
This function peforms an authorization test based on the | This function peforms an authorization test based on the |
value of the enableSubscriptionForNonprivilegedUsers. | value of the enableSubscriptionForNonprivilegedUsers. |
| |
|
|
const CIMNamespaceName& nameSpace, | const CIMNamespaceName& nameSpace, |
const CIMInstance& indicationProvider, | const CIMInstance& indicationProvider, |
Array<CIMInstance>& subscriptions, | Array<CIMInstance>& subscriptions, |
Array<String>& subscriptionKeys); |
Array<SubscriptionKey>& subscriptionKeys); |
| |
/** | /** |
Evaluate if the specified subscription matches the indication based on: | Evaluate if the specified subscription matches the indication based on: |
|
|
const CIMInstance& handlerInstance, | const CIMInstance& handlerInstance, |
const CIMInstance& formattedIndication, | const CIMInstance& formattedIndication, |
const CIMNamespaceName& namespaceName, | const CIMNamespaceName& namespaceName, |
const OperationContext& operationContext); |
const OperationContext& operationContext, |
|
DeliveryStatusAggregator *deliveryStatusAggregator); |
| |
/** | /** |
Updates the subscription table with the information of the providers | Updates the subscription table with the information of the providers |
|
|
@param subscription The accepted subscription. | @param subscription The accepted subscription. |
@param acceptedProviders Subscription accepted providers list. | @param acceptedProviders Subscription accepted providers list. |
@param indicationSubclasses The indication subclasses for the | @param indicationSubclasses The indication subclasses for the |
subscription |
subscription with the source namespace. |
@param sourceNameSpace The nameSpace name of the resource being |
|
monitored, from the SourceNamespace |
|
property of the CIM_IndicationFilter |
|
instance for the specified |
|
subscription |
|
| |
*/ | */ |
void _updateAcceptedSubscription( | void _updateAcceptedSubscription( |
CIMInstance &subscription, | CIMInstance &subscription, |
const Array<ProviderClassList> &acceptedProviders, | const Array<ProviderClassList> &acceptedProviders, |
const Array<CIMName> &indicationSubclasses, |
const Array<NamespaceClassList> &indicationSubclasses); |
const CIMNamespaceName &sourceNameSpace); |
|
|
Array<ProviderClassList> _getIndicationProvidersWithNamespaceClassList( |
|
const Array<ProviderClassList> &providers); |
|
|
|
void _addProviderToAcceptedProviderList( |
|
Array<ProviderClassList> &acceptedProviders, |
|
ProviderClassList &provider); |
| |
void _deliverWaitingIndications(); | void _deliverWaitingIndications(); |
void _beginCreateSubscription(const CIMObjectPath &objPath); | void _beginCreateSubscription(const CIMObjectPath &objPath); |
|
|
Uint32 _handlerService; | Uint32 _handlerService; |
| |
/** | /** |
|
Integer representing queue ID for accessing Module Controller |
|
*/ |
|
Uint32 _moduleController; |
|
|
|
/** |
Boolean indicating that the CIM Server has been configured to | Boolean indicating that the CIM Server has been configured to |
allow non-privileged users read and write access to the | allow non-privileged users read and write access to the |
Subscription classes. | Subscription classes. |
|
|
*/ | */ |
CIMClass _getIndicationClass(const CIMInstance& instance); | CIMClass _getIndicationClass(const CIMInstance& instance); |
| |
|
void _buildInternalControlProvidersRegistration(); |
|
|
|
Array<ProviderClassList> _getInternalIndProviders( |
|
const Array<NamespaceClassList>& indicationSubclasses) const; |
|
|
/** | /** |
Arrays of valid and supported property values | Arrays of valid and supported property values |
| |
Notes: | Notes: |
Valid values are defined by the CIM Event Schema MOF |
|
Supported values are a subset of the valid values |
|
Some valid values, as defined in the MOF, are not currently supported |
|
by the Pegasus IndicationService |
|
| |
Supported Values | Supported Values |
SubscriptionState: Enabled, Disabled | SubscriptionState: Enabled, Disabled |
|
|
PersistenceType: Permanent, Transient | PersistenceType: Permanent, Transient |
SNMPVersion: SNMPv1 Trap, SNMPv2C Trap | SNMPVersion: SNMPv1 Trap, SNMPv2C Trap |
*/ | */ |
Array<Uint16> _validStates; |
|
Array<Uint16> _validRepeatPolicies; |
|
Array<Uint16> _validErrorPolicies; |
|
Array<Uint16> _validPersistenceTypes; |
|
Array<Uint16> _validSNMPVersion; |
|
Array<Uint16> _supportedStates; | Array<Uint16> _supportedStates; |
Array<Uint16> _supportedRepeatPolicies; | Array<Uint16> _supportedRepeatPolicies; |
Array<Uint16> _supportedErrorPolicies; | Array<Uint16> _supportedErrorPolicies; |
Array<Uint16> _supportedPersistenceTypes; | Array<Uint16> _supportedPersistenceTypes; |
Array<Uint16> _supportedSNMPVersion; | Array<Uint16> _supportedSNMPVersion; |
| |
/** |
ControlProvIndRegTable _controlProvIndRegTable; |
Arrays of names of supported properties for each class |
|
*/ |
|
Array<CIMName> _supportedSubscriptionProperties; |
|
Array<CIMName> _supportedFormattedSubscriptionProperties; |
|
Array<CIMName> _supportedFilterProperties; |
|
Array<CIMName> _supportedCIMXMLHandlerProperties; |
|
Array<CIMName> _supportedCIMXMLListenerDestinationProperties; |
|
Array<CIMName> _supportedSNMPHandlerProperties; |
|
Array<CIMName> _supportedSyslogListenerDestinationProperties; |
|
Array<CIMName> _supportedEmailListenerDestinationProperties; |
|
}; | }; |
| |
// Use with AutoPtr to automatically decrement AtomicInt | // Use with AutoPtr to automatically decrement AtomicInt |
|
|
} | } |
}; | }; |
| |
|
struct ExpectedResponseCountSetDone |
|
{ |
|
void operator()(DeliveryStatusAggregator* ptr) |
|
{ |
|
if (ptr) |
|
{ |
|
ptr->expectedResponseCountSetDone(); |
|
} |
|
} |
|
}; |
|
|
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |
| |
#endif /* Pegasus_IndicationService_h */ | #endif /* Pegasus_IndicationService_h */ |