Example #1
0
SaAisErrorT ntfsv_alloc_ntf_state_change(SaNtfStateChangeNotificationT *stateChangeNotification,
					 SaUint16T numStateChanges)
{
	SaAisErrorT rc = SA_AIS_OK;

	stateChangeNotification->numStateChanges = numStateChanges;
	stateChangeNotification->changedStates = NULL;
	stateChangeNotification->sourceIndicator = NULL;
	/* Source indicator */
	stateChangeNotification->sourceIndicator = malloc(sizeof(SaNtfSourceIndicatorT));
	if (stateChangeNotification->sourceIndicator == NULL) {
		TRACE_1("Out of memory in sourceIndicator field");
		rc = SA_AIS_ERR_NO_MEMORY;
		goto done;
	}

	*(stateChangeNotification->sourceIndicator) = SA_NTF_UNKNOWN_OPERATION;

	/* Changed states */
	if (numStateChanges != 0) {
		stateChangeNotification->changedStates = (SaNtfStateChangeT *)
		    malloc(numStateChanges * sizeof(SaNtfStateChangeT));
		if (stateChangeNotification->changedStates == NULL) {
			TRACE_1("Out of memory in changedStates field");
			rc = SA_AIS_ERR_NO_MEMORY;
			goto done;
		}
	}
 done:
	if (rc != SA_AIS_OK) {
		ntfsv_free_state_change(stateChangeNotification, false);
	}
	return rc;
}
Example #2
0
void ntfsv_dealloc_notification(ntfsv_send_not_req_t *param)
{
	TRACE_ENTER2("ntfsv_send_not_req_t ptr = %p " "notificationType = %#x", param, (int)param->notificationType);
	switch (param->notificationType) {
	case SA_NTF_TYPE_ALARM:
		ntfsv_free_alarm(&param->notification.alarm, true);
		break;
	case SA_NTF_TYPE_OBJECT_CREATE_DELETE:
		ntfsv_free_obj_create_del(&param->notification.objectCreateDelete, true);
		break;
	case SA_NTF_TYPE_ATTRIBUTE_CHANGE:
		ntfsv_free_attribute_change(&param->notification.attributeChange, true);
		break;
	case SA_NTF_TYPE_STATE_CHANGE:
		ntfsv_free_state_change(&param->notification.stateChange, true);
		break;
	case SA_NTF_TYPE_SECURITY_ALARM:
		ntfsv_free_security_alarm(&param->notification.securityAlarm, true);
		break;
	default:
		TRACE("notificationType not valid");
	}
	TRACE_1("free v_data.p_base %p", param->variable_data.p_base);
	free(param->variable_data.p_base);
	param->variable_data.p_base = NULL;
	param->variable_data.size = 0;
	TRACE_LEAVE();
}
Example #3
0
/**
 * 
 * @param instance
 */
void ntfa_hdl_rec_destructor(ntfa_notification_hdl_rec_t *instance)
{
	ntfa_notification_hdl_rec_t *notificationInstance = instance;

	switch (notificationInstance->ntfNotificationType) {
	case SA_NTF_TYPE_ALARM:
		ntfsv_free_alarm(&notificationInstance->ntfNotification.ntfAlarmNotification);
		break;

	case SA_NTF_TYPE_STATE_CHANGE:
		ntfsv_free_state_change(&notificationInstance->ntfNotification.ntfStateChangeNotification);
		break;

	case SA_NTF_TYPE_OBJECT_CREATE_DELETE:
		ntfsv_free_obj_create_del(&notificationInstance->ntfNotification.ntfObjectCreateDeleteNotification);
		break;

	case SA_NTF_TYPE_ATTRIBUTE_CHANGE:
		ntfsv_free_attribute_change(&notificationInstance->ntfNotification.ntfAttributeChangeNotification);

		break;

	case SA_NTF_TYPE_SECURITY_ALARM:
		ntfsv_free_security_alarm(&notificationInstance->ntfNotification.ntfSecurityAlarmNotification);
		break;

	default:
		TRACE("Invalid Notification Type!");
		break;
	}
	if (NULL != notificationInstance->cbk_notification) {
		free(notificationInstance->cbk_notification);
	}
	TRACE_1("free v_data.p_base %p", notificationInstance->variable_data.p_base);
	free(notificationInstance->variable_data.p_base);
	notificationInstance->variable_data.p_base = NULL;
	notificationInstance->variable_data.size = 0;
}