// File: Messaging.idl
// CORBA 3.0, Chapter 22

#ifndef _MESSAGING_IDL_
#define _MESSAGING_IDL_

#ifdef _PRE_3_0_COMPILER_ 
#pragma prefix "omg.org"
#include <orb.idl>
#include <Dynamic.idl>
#include <IOP.idl>
#include <TimeBase.idl>
#else
import ::CORBA;
//PolyORB:NI:import ::Dynamic;
//PolyORB:NI:import ::IOP;
//PolyORB:NI:import ::TimeBase;
#endif // _PRE_3_0_COMPILER_

// App developers should never have to use this IDL file. The ORB vendor
// should supply an implementation language version of this file, and
// that should be used by app developers if necessary.

// Most IDL compilers don't accept the "native" keyword in application IDL 
//    files. In order to compile an IDL (really PIDL) file that has it, the 
//    following trick can be used: change what the compiler sees. Instead
//    of letting the compiler see the keyword "native", use a preprocessor
//    definition that results in valid IDL, even if it doesn't yield
//    useful stubs and skeletons. Of course, PIDL never results in
//    the standard stubs so that's not a problem.
//
// Set the variable _MASK_NATIVE_ in the IDL compiler to enable it to
// parse this file.

#ifdef _MASK_NATIVE_
#define native typedef long
#endif // _MASK_NATIVE_

module Messaging {

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

    typedef short RebindMode;
    const RebindMode TRANSPARENT = 0;
    const RebindMode NO_REBIND = 1;
    const RebindMode NO_RECONNECT = 2;

    typedef short SyncScope;
    const SyncScope SYNC_NONE = 0;
    const SyncScope SYNC_WITH_TRANSPORT = 1;
    const SyncScope SYNC_WITH_SERVER = 2;
    const SyncScope SYNC_WITH_TARGET = 3;

    typedef short RoutingType;
    const RoutingType ROUTE_NONE = 0;
    const RoutingType ROUTE_FORWARD = 1;
    const RoutingType ROUTE_STORE_AND_FORWARD =2;

    typedef short Priority;

    typedef unsigned short Ordering;
    const Ordering ORDER_ANY = 0x01;
    const Ordering ORDER_TEMPORAL = 0x02;
    const Ordering ORDER_PRIORITY = 0x04;
    const Ordering ORDER_DEADLINE = 0x08;

    // Rebind Policy (default = TRANSPARENT)
    const CORBA::PolicyType REBIND_POLICY_TYPE = 23;

//PolyORB:NI:    local interface RebindPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute RebindMode rebind_mode;
//PolyORB:NI:    };

    // Synchronization Policy (default = SYNC_WITH_TRANSPORT)
    const CORBA::PolicyType SYNC_SCOPE_POLICY_TYPE = 24;

//PolyORB:NI:    local interface SyncScopePolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute SyncScope synchronization;
//PolyORB:NI:    };

    // Priority Policies
    const CORBA::PolicyType REQUEST_PRIORITY_POLICY_TYPE = 25;

    struct PriorityRange {
        Priority min;
        Priority max;
    };

//PolyORB:NI:    local interface RequestPriorityPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute PriorityRange priority_range;
//PolyORB:NI:    };

    const CORBA::PolicyType REPLY_PRIORITY_POLICY_TYPE = 26;

//PolyORB:NI:    interface ReplyPriorityPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute PriorityRange priority_range;
//PolyORB:NI:    };

    // Timeout Policies
    const CORBA::PolicyType REQUEST_START_TIME_POLICY_TYPE = 27;

//PolyORB:NI:    local interface RequestStartTimePolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute TimeBase::UtcT start_time;
//PolyORB:NI:    };

    const CORBA::PolicyType REQUEST_END_TIME_POLICY_TYPE = 28;

//PolyORB:NI:    local interface RequestEndTimePolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute TimeBase::UtcT end_time;
//PolyORB:NI:    };

    const CORBA::PolicyType REPLY_START_TIME_POLICY_TYPE = 29;

//PolyORB:NI:    local interface ReplyStartTimePolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute TimeBase::UtcT start_time;
//PolyORB:NI:    };

    const CORBA::PolicyType REPLY_END_TIME_POLICY_TYPE = 30;

//PolyORB:NI:    local interface ReplyEndTimePolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute TimeBase::UtcT end_time;
//PolyORB:NI:    };

    const CORBA::PolicyType RELATIVE_REQ_TIMEOUT_POLICY_TYPE = 31;

//PolyORB:NI:    local interface RelativeRequestTimeoutPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute TimeBase::TimeT relative_expiry;
//PolyORB:NI:    };

    const CORBA::PolicyType RELATIVE_RT_TIMEOUT_POLICY_TYPE = 32;

//PolyORB:NI:    local interface RelativeRoundtripTimeoutPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute TimeBase::TimeT relative_expiry;
//PolyORB:NI:    };

    const CORBA::PolicyType ROUTING_POLICY_TYPE = 33;

    struct RoutingTypeRange {
        RoutingType min;
        RoutingType max;
    };

//PolyORB:NI:    local interface RoutingPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute RoutingTypeRange routing_range;
//PolyORB:NI:    };

    const CORBA::PolicyType MAX_HOPS_POLICY_TYPE = 34;

//PolyORB:NI:    local interface MaxHopsPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute unsigned short max_hops;
//PolyORB:NI:    };

    // Router Delivery-ordering Policy (default = ORDER_TEMPORAL)
    const CORBA::PolicyType QUEUE_ORDER_POLICY_TYPE = 35;

//PolyORB:NI:    local interface QueueOrderPolicy : CORBA::Policy {
//PolyORB:NI:        readonly attribute Ordering allowed_orders;
//PolyORB:NI:    };

    // Profile components through which policy values are expressed in IORs

    struct PolicyValue {
        CORBA::PolicyType ptype;
        sequence<octet> pvalue;
    };

    typedef sequence<PolicyValue> PolicyValueSeq;

//PolyORB:NI:    native UserExceptionBase;
//PolyORB:NI:    valuetype ExceptionHolder {
//PolyORB:NI:      void raise_exception() raises (UserExceptionBase);
//PolyORB:NI:      void raise_exception_with_list(
//PolyORB:NI:	  in Dynamic::ExceptionList exc_list)
//PolyORB:NI:	raises (UserExceptionBase);
//PolyORB:NI:      private boolean is_system_exception;
//PolyORB:NI:      private boolean byte_order;
//PolyORB:NI:      private sequence<octet> marshaled_exception;
//PolyORB:NI:    };
//PolyORB:NI:
//PolyORB:NI:    // For handling Routing
//PolyORB:NI:    interface ReplyHandler { };
//PolyORB:NI:
//PolyORB:NI:    // Generic Poller Valuetype
//PolyORB:NI:
//PolyORB:NI:    valuetype Poller : CORBA::Pollable {
//PolyORB:NI:        readonly attribute Object operation_target;
//PolyORB:NI:        readonly attribute string operation_name;
//PolyORB:NI:        attribute ReplyHandler associated_handler;
//PolyORB:NI:        readonly attribute boolean is_from_poller;
//PolyORB:NI:        private Object target;
//PolyORB:NI:        private string op_name;
//PolyORB:NI:    };

}; // module Messaging
#endif // _MESSAGING_IDL_
