// **********************************************************************
//
// Copyright (c) 2002
// IONA Technologies, Inc.
// Waltham, MA, USA
//
// All Rights Reserved
//
// **********************************************************************

#ifndef POLICY_IDL
#define POLICY_IDL

#include <OB/PolicyTypes.idl>

#pragma prefix "omg.org"

module CORBA
{

typedef unsigned long PolicyType;
typedef sequence<PolicyType> PolicyTypeSeq;

//
// Although Policy isn't marked as local in the specification we're
// going to compile as such.
//
local interface Policy
{
    readonly attribute PolicyType policy_type;
    Policy copy();
    void destroy();
};
typedef sequence<Policy> PolicyList;

typedef short PolicyErrorCode;

const PolicyErrorCode BAD_POLICY = 0;
const PolicyErrorCode UNSUPPORTED_POLICY = 1;
const PolicyErrorCode BAD_POLICY_TYPE = 2;
const PolicyErrorCode BAD_POLICY_VALUE = 3;
const PolicyErrorCode UNSUPPORTED_POLICY_VALUE = 4;

exception PolicyError
{
    PolicyErrorCode reason;
};

exception InvalidPolicies
{
    sequence<unsigned short> indices;
};

local interface PolicyManager
{
    PolicyList get_policy_overrides(in PolicyTypeSeq ts);
    void set_policy_overrides(
	in PolicyList policies,
	in SetOverrideType set_add
    )
	raises(InvalidPolicies);
};

#ifndef OB_CPLUSPLUS

interface InterfaceDef;

local interface DomainManager
{
    Policy get_domain_policy(in PolicyType policy_type);
};

const PolicyType SecConstruction = 11;

local interface ConstructionPolicy : Policy
{
    void make_domain_manager(
	in CORBA::InterfaceDef object_type,
	in boolean constr_policy);
};

typedef sequence<DomainManager> DomainManagersList;

#endif

}; // End module CORBA

#endif
