version 1.8, 2009/03/20 07:36:05
|
version 1.9, 2012/07/30 11:18:27
|
|
|
WsenEnumerateResponse* response; | WsenEnumerateResponse* response; |
}; | }; |
| |
|
/** |
|
SubscriptionContextTable is a hash table containing entries of |
|
SubscriptionContext.The contxt ID is the subscription message ID. |
|
This context is used to process create and delete instance requests |
|
for subscription, filter and handler serially.An entry is made while |
|
proceesing Subscribe or Unsubscribe request via the addReqToSubContext() |
|
by WsmRequestDecoder. Once all the requests are complete, |
|
the entry is deleted. |
|
|
|
For subscribe request, all the three create instance requests for filter, |
|
handler and subscription are filled. Only filter request is first processed |
|
and once the filter response is recieved, the handler request is processed. |
|
Once handler response is recieved,only then is the subscription request |
|
processed. After subscription response is recieved,the context entry is |
|
deleted and the subscribe response is sent back to the client.If any of |
|
the requests get exeception then the cleanup function |
|
_cleanupFilterHandlerInstances() is called appropriatley. |
|
|
|
For unsubscribe the subscription delete instance request is processed |
|
first. Once the response is recieved, then the delete instance requests |
|
for filter and handler are processed. |
|
*/ |
|
class SubscriptionContext |
|
{ |
|
public: |
|
SubscriptionContext() {} |
|
SubscriptionContext(String contextId_) |
|
{ |
|
contextId = contextId_; |
|
filterResponse= false; |
|
handlerResponse= false; |
|
filterReq = NULL; |
|
handlerReq = NULL; |
|
subReq = NULL; |
|
filterDeleteReq = NULL; |
|
handlerDeleteReq = NULL; |
|
} |
|
String contextId; |
|
Boolean filterResponse; |
|
Boolean handlerResponse; |
|
WxfSubCreateRequest* filterReq; |
|
WxfSubCreateRequest* handlerReq; |
|
WxfSubCreateRequest* subReq; |
|
WxfSubDeleteRequest* filterDeleteReq; |
|
WxfSubDeleteRequest* handlerDeleteReq; |
|
}; |
| |
PEGASUS_TEMPLATE_SPECIALIZATION struct HashFunc<Uint64> | PEGASUS_TEMPLATE_SPECIALIZATION struct HashFunc<Uint64> |
{ | { |
|
|
void handleRequest(WsmRequest* wsmRequest); | void handleRequest(WsmRequest* wsmRequest); |
void handleResponse(CIMResponseMessage* cimResponse); | void handleResponse(CIMResponseMessage* cimResponse); |
| |
void sendResponse(WsmResponse* wsmResponse); |
void sendResponse( |
|
WsmResponse* wsmResponse, |
|
WsmRequest* wsmReq = NULL); |
| |
Uint32 getWsmRequestDecoderQueueId(); | Uint32 getWsmRequestDecoderQueueId(); |
| |
|
|
| |
void cleanupExpiredContexts(); | void cleanupExpiredContexts(); |
| |
|
void addReqToSubContext(WsmRequest *, Boolean isCreateReq); |
|
/** |
|
This function returns the information whether subscription is |
|
is created using existing filter or not. |
|
*/ |
|
Boolean isSubCreatedWithExistingFilter( |
|
const String & subId, |
|
String & filterName); |
|
|
private: | private: |
| |
void _handlePullRequest(WsenPullRequest* wsmRequest); | void _handlePullRequest(WsenPullRequest* wsmRequest); |
|
|
void _handleEnumerateResponse( | void _handleEnumerateResponse( |
CIMResponseMessage* cimResponse, | CIMResponseMessage* cimResponse, |
WsenEnumerateRequest* wsmRequest); | WsenEnumerateRequest* wsmRequest); |
|
void _handleSubscriptionResponse( |
|
CIMResponseMessage* cimResponse, |
|
WxfSubCreateRequest* wsmRequest); |
|
void _handleSubscriptionDeleteResponse( |
|
CIMResponseMessage* cimResponse, |
|
WxfSubDeleteRequest* wsmRequest); |
void _handleDefaultResponse( | void _handleDefaultResponse( |
CIMResponseMessage* cimResponse, | CIMResponseMessage* cimResponse, |
WsmRequest* wsmRequest); | WsmRequest* wsmRequest); |
|
|
WsenEnumerateResponse* response, | WsenEnumerateResponse* response, |
Uint32 num); | Uint32 num); |
void _getExpirationDatetime(const String& wsmDT, CIMDateTime& cimDT); | void _getExpirationDatetime(const String& wsmDT, CIMDateTime& cimDT); |
|
void _cleanupFilterHandlerInstances( |
|
String messageId, |
|
Boolean isfilterCleanup, |
|
Boolean isHandlerCleanup); |
| |
|
/** |
|
This function is used to cleanup the filter, handler and |
|
subscription requests in failure scenarios. As we are processing the |
|
filter, handler and subscription requests sequentially, if filter |
|
request fails then the stored handler and subscription requests |
|
should be deleted from the subscription context manually. |
|
*/ |
|
void _cleanupSubContext(String & messageId, |
|
Boolean isFilterCreate=false, |
|
Boolean isHanlderCreate=false, |
|
Boolean isSubCreate=false, |
|
Boolean isFilterDelete=false, |
|
Boolean isHandlerDelete=false); |
|
/** |
|
This function is used to fill the SubscriptionInfoTable. |
|
*/ |
|
void _fillSubscriptionInfoTable(WxfSubCreateRequest * subReq); |
|
|
|
/** |
|
This function is used to initialize the info table during the |
|
cimserver startup. |
|
*/ |
|
void _initializeSubInfoTable(); |
WsmResponseEncoder _wsmResponseEncoder; | WsmResponseEncoder _wsmResponseEncoder; |
WsmRequestDecoder _wsmRequestDecoder; | WsmRequestDecoder _wsmRequestDecoder; |
| |
|
|
EnumerationContextTable _enumerationContextTable; | EnumerationContextTable _enumerationContextTable; |
Mutex _enumerationContextTableLock; | Mutex _enumerationContextTableLock; |
static Uint64 _currentEnumContext; | static Uint64 _currentEnumContext; |
|
|
|
typedef HashTable<String, SubscriptionContext, |
|
EqualFunc<String>, HashFunc<String> > SubscriptionContextTable; |
|
SubscriptionContextTable _subscriptionContextTable; |
|
|
|
/** |
|
The SubscriptionInfoTable stores the subscriptions which are created |
|
using an existing filter. It'll be filled by _fillSubscriptionInfoTable |
|
function. It will be accessed by WsmRequestDecoder while processing |
|
an unsubscribe request to form the subscription EPR. |
|
Entry from this table will be deleted once unsubscribe request is |
|
processed successfully. |
|
*/ |
|
typedef HashTable<String,String,EqualFunc<String>, |
|
HashFunc<String> > SubscriptionInfoTable; |
|
SubscriptionInfoTable _subscriptionInfoTable; |
|
|
|
Mutex _subscriptionContextTableLock; |
|
Mutex _subscriptionInfoTableLock; |
}; | }; |
| |
PEGASUS_NAMESPACE_END | PEGASUS_NAMESPACE_END |