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

#ifndef OB_POLICIES_IDL
#define OB_POLICIES_IDL

#include <OB/Policy.idl>
#include <OB/OCITypes.idl>

#pragma prefix "ooc.com"

module OB
{

/**
 *
 * This policy type identifies the protocol policy.
 *
 **/
const CORBA::PolicyType PROTOCOL_POLICY_ID = 2 | 0x4f4f0000;

/**
 *
 * The protocol policy. This policy specifies the order in which profiles
 * should be tried.
 *
 **/
local interface ProtocolPolicy : CORBA::Policy
{
    /**
     *
     * If a <code>ProtocolPolicy</code> is set, then the value specifies
     * the list of plugins that may be used. The profiles of an IOR will
     * be used in the order specified by this policy. If no profile in an
     * IOR matches any of the plugins specified by this policy, a
     * <code>CORBA::TRANSIENT</code> exception will be raised. By
     * default, the ORB chooses the protocol to be used.
     *
     **/
    readonly attribute OCI::PluginIdSeq value;

    /**
     *
     * Determines if this policy includes the given plugin id.
     *
     **/
    boolean contains(in OCI::PluginId id);
};

/**
 *
 * This policy type identifies the connection reuse policy.
 *
 **/
const CORBA::PolicyType CONNECTION_REUSE_POLICY_ID = 3 | 0x4f4f0000;

/**
 *
 * The connection reuse policy. This policy determines whether
 * connections may be reused or are private to specific objects.
 *
 **/
local interface ConnectionReusePolicy : CORBA::Policy
{
    /**
     *
     * If an object has a <code>ConnectionReusePolicy</code> set with
     * <code>value</code> set to <code>FALSE</code>, then other
     * object references will not be permitted to use connections
     * made on behalf of this object. If set to <code>TRUE</code>,
     * then connections are shared. The default value is
     * <code>TRUE</code>.
     *
     **/
    readonly attribute boolean value;
};

/**
 *
 * The <code>RETRY_NEVER</code> RetryPolicy value.
 *
 **/
const short RETRY_NEVER = 0;

/**
 *
 * The <code>RETRY_STRICT</code> RetryPolicy value.
 *
 **/
const short RETRY_STRICT = 1;

/**
 *
 * The <code>RETRY_ALWAYS</code> RetryPolicy value.
 *
 **/
const short RETRY_ALWAYS = 2;

/**
 *
 * The retry information
 *
 **/
struct RetryAttributes
{
    short mode;
    unsigned long interval;
    unsigned long max;
    boolean remote;
};

/**
 *
 * This policy type identifies the retry policy.
 *
 **/
const CORBA::PolicyType RETRY_POLICY_ID = 4 | 0x4f4f0000;

/**
 *
 * The retry policy. This policy is used to specify retry behavior after
 * communication failures (i.e., <code>CORBA::TRANSIENT</code> and
 * <code>CORBA::COMM_FAILURE</code> exceptions).
 *
 **/
local interface RetryPolicy : CORBA::Policy
{
    /**
     *
     * For retry_mode <code>RETRY_NEVER</code> indicates that requests
     * should never be retried, and the exception is re-thrown to the
     * application. <code>RETRY_STRICT</code> will retry once if the
     * exception completion status is <code>COMPLETED_NO</code>, in
     * order to guarantee at-most-once semantics. <code>RETRY_ALWAYS</code>
     * will retry once, regardless of the exception completion
     * status. The default value is <code>RETRY_STRICT</code>.
     * 
     * retry_interval is the time in milliseconds between reties. The
     * default is 0.
     * 
     * retry_max is the maximum number of retries. The default is 1.
     * 
     * retry_remote determines whether or not to retry on exceptions
     * received over-the-wire. The default is false: only retry on
     * locally generated exceptions.
     *
     * <B>Note:</B> Many TCP/IP stacks do not provide a reliable
     * indication of communication failure when sending smaller
     * requests, therefore the failure may not be detected until the
     * ORB attempts to read the reply.  In this case, the ORB must
     * assume that the remote end has received the request, in order
     * to guarantee at-most-once semantics for the request. The
     * implication is that when using the default setting of
     * <code>RETRY_STRICT</code>, most communication failures will not
     * cause a retry. This behavior can be relaxed using
     * <code>RETRY_ALWAYS</code>.
     *
     **/
    readonly attribute short retry_mode;
    readonly attribute unsigned long retry_interval;
    readonly attribute unsigned long retry_max;
    readonly attribute boolean retry_remote;
}; 

/**
 *
 * This policy type identifies the timeout policy.
 *
 **/
const CORBA::PolicyType TIMEOUT_POLICY_ID = 5 | 0x4f4f0000;

/**
 *
 * The timeout policy. This policy can be used to specify the
 * default timeout for connection establishment and requests.
 * If an object also has <code>ConnectionTimeoutPolicy</code> or
 * <code>RequestTimeoutPolicy</code> set, those values have precedence.
 *
 * @see ConnectionTimeoutPolicy
 * @see RequestTimeoutPolicy
 *
 **/
local interface TimeoutPolicy : CORBA::Policy
{
    /**
     *
     * If an object has a <code>TimeoutPolicy</code> set and a
     * connection cannot be established or no response to a request
     * is available after <code>value</code> milliseconds, a
     * <code>CORBA::NO_RESPONSE</code> exception is raised.
     * The default value is <code>-1</code>, which means no timeout.
     *
     **/
    readonly attribute unsigned long value;
};

/**
 *
 * The <code>LOCATION_TRANSPARENCY_STRICT</code>
 * LocationTransparencyPolicy value.
 *
 **/
const short LOCATION_TRANSPARENCY_STRICT = 0;

/**
 *
 * The <code>LOCATION_TRANSPARENCY_RELAXED</code>
 * LocationTransparencyPolicy value.
 *
 **/
const short LOCATION_TRANSPARENCY_RELAXED = 1;

/**
 *
 * This policy type identifies the location transparency policy.
 *
 **/
const CORBA::PolicyType LOCATION_TRANSPARENCY_POLICY_ID = 6 | 0x4f4f0000;

/**
 *
 * The location transparency policy. This policy is used to control
 * how strict the ORB is in enforcing location transparency. This is
 * useful for performance reasons.
 *
 **/
local interface LocationTransparencyPolicy : CORBA::Policy
{
    /**
     *
     * <code>LOCATION_TRANSPARENCY_STRICT</code> ensures strict
     * location transparency is followed.
     * <code>LOCATION_TRANSPARENCY_RELAXED</code> relaxes the location
     * transparency guarantees for performance reasons.  Specifically
     * for collocated method invocations, the dispatch concurrency
     * model will be ignored, and policy overrides are not
     * removed. The default value is
     * <code>LOCATION_TRANSPARENCY_STRICT</code>.
     *
     **/
    readonly attribute short value;
};

/**
 *
 * This policy type identifies the interceptor policy.
 *
 **/
const CORBA::PolicyType INTERCEPTOR_POLICY_ID = 7 | 0x4f4f0000;

/**
 *
 * The interceptor policy. This policy can be used to control whether
 * the client-side interceptors are called.
 *
 **/
local interface InterceptorPolicy : CORBA::Policy
{
    /**
     *
     * If an object reference has an <code>InterceptorPolicy</code>
     * set and <code>value</code> is <code>FALSE</code> then any
     * installed client-side interceptors are not called.  Otherwise,
     * interceptors are called for each method invocation. The default
     * value is <code>TRUE</code>.
     *
     **/
    readonly attribute boolean value;
};

/**
 *
 * This policy type identifies the connect timeout policy.
 *
 **/
const CORBA::PolicyType CONNECT_TIMEOUT_POLICY_ID = 8 | 0x4f4f0000;

/**
 *
 * The connect timeout policy. This policy can be used to specify
 * a maximum time limit for connection establishment.
 *
 * @see TimeoutPolicy
 *
 **/
local interface ConnectTimeoutPolicy : CORBA::Policy
{
    /**
     *
     * If an object has a <code>ConnectTimeoutPolicy</code> set and
     * a connection cannot be established after <code>value</code>
     * milliseconds, a <code>CORBA::NO_RESPONSE</code> exception is
     * raised. The default value is <code>-1</code>, which means no
     * timeout.
     *
     **/
    readonly attribute unsigned long value;
};

/**
 *
 * This policy type identifies the request timeout policy.
 *
 **/
const CORBA::PolicyType REQUEST_TIMEOUT_POLICY_ID = 9 | 0x4f4f0000;

/**
 *
 * The request timeout policy. This policy can be used to specify
 * a maximum time limit for requests.
 *
 * @see TimeoutPolicy
 *
 **/
local interface RequestTimeoutPolicy : CORBA::Policy
{
    /**
     *
     * If an object has a <code>RequestTimeoutPolicy</code> set and no
     * response to a request is available after <code>value</code>
     * milliseconds, a <code>CORBA::NO_RESPONSE</code> exception is
     * raised. The default value is <code>-1</code>, which means no
     * timeout.
     *
     **/
    readonly attribute unsigned long value;
};

/**
 *
 * This policy type identifies the locate request policy.
 *
 **/
const CORBA::PolicyType LOCATE_REQUEST_POLICY_ID = 10 | 0x4f4f0000;

/**
 *
 * The locate request policy. This policy can be used to specify
 * whether the ORB sends locate request messages.
 *
 **/
local interface LocateRequestPolicy : CORBA::Policy
{
    /**
     *
     * If an object has a <code>LocateRequestPolicy</code> set to
     * <code>false</code> then the ORB will not send locate request
     * messages for the object.
     *
     **/
    readonly attribute boolean value;
};

}; // End module OB

#endif
