//File: CosLicensingManager.idl
//The only module of the Licensing Service
//OMG File: 98-10-13

#ifndef _COS_LICENSING_MANAGER_IDL_
#define _COS_LICENSING_MANAGER_IDL_

#ifdef _PRE_3_0_COMPILER_
#include <CosEventComm.idl>
#include <CosPropertyService.idl>
#include <CosEventComm.idl>
#pragma prefix "omg.org"
#else
import ::CosEventComm;
import ::CosPropertyService;
import ::CosEventComm;
#endif // _PRE_3_0_COMPILER_

module CosLicensingManager {

#ifndef _PRE_3_0_COMPILER_
	typeprefix CosLicensingManager "omg.org";
#endif // _PRE_3_0_COMPILER_

	exception InvalidProducer{}; 
	exception InvalidParameter{};
	exception ComponentNotRegistered{};

	typedef Object ProducerSpecificNotification;

	enum ActionRequired { continue, terminate}; 

	enum Answer { yes, no };

	struct Action {
//PolyORB:WACORBA: We rename action to the_action for avoid name conflict
//PolyORB:WACORBA:		ActionRequired action ;		
		ActionRequired the_action ;		
		Answer notification_required ;
		Answer wait_for_user_confirmation_after_notification ;
		unsigned long notification_duration;	
		ProducerSpecificNotification producer_notification; 
		string notification_text; 
	};

	struct ChallengeData {
		unsigned long challenge_index; 
		unsigned long random_number; 
		string digest; 
	};


	enum ChallengeProtocol { default_protocol, producer_defined };	
	struct Challenge {
		ChallengeProtocol challenge_protocol;
		unsigned long challenge_data_size;
		any challenge_data; 
	};

	typedef any LicenseHandle;
	
	interface ProducerSpecificLicenseService {

	readonly attribute   string producer_contact_info;
	readonly attribute   string producer_specific_license_service_info;

//PolyORB:NI: CORBA::Principal is not defined
//PolyORB:NI:	LicenseHandle start_use ( 
//PolyORB:NI:		in CORBA::Principal aPrincipal,
//PolyORB:NI:		in string component_name, 
//PolyORB:NI:		in string component_version,
//PolyORB:NI:		in CosPropertyService::PropertySet license_use_context,
//PolyORB:NI:		in CosEventComm::PushConsumer call_back, 
//PolyORB:NI:		inout CosLicensingManager::Challenge Challenge)
//PolyORB:NI:
//PolyORB:NI:		raises ( InvalidParameter, ComponentNotRegistered);

  		void check_use (
			in LicenseHandle handle, 
			in CosPropertyService::PropertySet license_use_context,
			out unsigned long recommended_check_interval,
			out Action action_to_be_taken, 
			inout CosLicensingManager::Challenge Challenge)

			raises ( InvalidParameter );

		void end_use (
			in LicenseHandle handle, 
			in CosPropertyService::PropertySet license_use_context,
			inout CosLicensingManager::Challenge Challenge)

			raises ( InvalidParameter );
	};

	interface LicenseServiceManager {
		ProducerSpecificLicenseService
		obtain_producer_specific_license_service (
			in string producer_name, 
			inout CosLicensingManager::Challenge Challenge)

			raises ( InvalidProducer, InvalidParameter ) ; 
	};
};

#endif /* ifndef _COS_LICENSING_MANAGER_IDL_ */
