#ifndef _IOP_IDL_
#define _IOP_IDL_

#include <orb.idl>

#pragma prefix "omg.org"

module IOP
{ 
    local interface Codec
    {
        exception InvalidTypeForEncoding {};
        exception FormatMismatch {};
        exception TypeMismatch {};

        CORBA::OctetSeq encode (in any data) raises (InvalidTypeForEncoding);
        any decode (in CORBA::OctetSeq data) raises (FormatMismatch);
        CORBA::OctetSeq encode_value (in any data) raises (InvalidTypeForEncoding);
        any decode_value (in CORBA::OctetSeq data, in CORBA::TypeCode tc)
            raises (FormatMismatch, TypeMismatch);
    };

    typedef short EncodingFormat;
    const EncodingFormat ENCODING_CDR_ENCAPS = 0;

    struct Encoding {
        EncodingFormat format;
        octet major_version;
        octet minor_version;
    };

    local interface CodecFactory
    {
        exception UnknownEncoding {};

        Codec create_codec (in Encoding enc) raises (UnknownEncoding);
    };

    typedef unsigned long  ProfileId;
    const ProfileId	 TAG_INTERNET_IOP = 0;
    const ProfileId	 TAG_MULTIPLE_COMPONENTS = 1;

    struct TaggedProfile {
        ProfileId  tag;
        sequence <octet> profile_data;
    };

    struct IOR {
        string	type_id;
        sequence <TaggedProfile> profiles;
    };

    typedef unsigned long ComponentId;

    const ComponentId TAG_ORB_TYPE = 0;
    const ComponentId TAG_CODE_SETS= 1;
    const ComponentId TAG_POLICIES= 2;
    const ComponentId TAG_ALTERNATE_IIOP_ADDRESS = 3;
    const ComponentId TAG_ASSOCIATION_OPTIONS = 13;
    const ComponentId TAG_JAVA_CODEBASE = 25;
    // ... others

    struct TaggedComponent {
        ComponentId  tag;
        sequence <octet> component_data;
    };

    typedef sequence <TaggedComponent> MultipleComponentProfile;
    typedef sequence<TaggedComponent> TaggedComponentSeq;

    typedef unsigned long ServiceId;

    struct ServiceContext {
        ServiceId context_id;
        sequence <octet> context_data;
    };
    typedef sequence <ServiceContext> ServiceContextList;

    const ServiceId	TransactionService = 0;
    const ServiceId	CodeSets = 1;
    const ServiceId	ChainBypassCheck = 2;
    const ServiceId	ChainBypassInfo = 3;
    const ServiceId	LogicalThreadId = 4;
    const ServiceId	BI_DIR_IIOP = 5;
    const ServiceId	SendingContextRunTime = 6;
    const ServiceId	INVOCATION_POLICIES = 7;
    const ServiceId	FORWARDED_IDENTITY = 8;
    const ServiceId	UnknownExceptionInfo = 9;
    const ServiceId ExceptionDetailMessage = 14;
    const ServiceId	SecurityAttributeService = 15;

};  // IOP module

#endif
