/*
 *    @(#) 1.27 src/somd/comm_fw/include/unotypes.idl, somd, som3.0 1/25/96 22:24:32 [12/22/96 21:28:36]
 */

//
//   COMPONENT_NAME: somd
//
//   ORIGINS: 27
//
//
//    25H7912  (C)  COPYRIGHT International Business Machines Corp. 1992,1996,1996
//   All Rights Reserved
//   Licensed Materials - Property of IBM
//   US Government Users Restricted Rights - Use, duplication or
//   disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
//

#ifndef __unotypes_idl_
#define __unotypes_idl_

#include <somdtype.idl>
interface Principal;
module IIOP {

        struct Version {
                char            major;
                char            minor;
        };

        struct ProfileBody {
                Version         iiop_version;
                string          host;
                unsigned short  port;
                sequence<octet> object_key;
        };

        struct ObjectLocator {
                Version         iiop_version;
                string          host;
                unsigned short  port;
                sequence<octet> object_key;
        };
        //
        // An ObjectLocator is encapsulted in a IIOP profile
        // within an IOR

        enum MsgType {
                Request, Reply, CancelRequest,
                LocateRequest, LocateReply,
                CloseConnection, MessageError,
                Reserved1, Reserved2, Reserved3, Reserved4, Reserved5,
                Reserved6, Reserved7, Reserved8, Reserved9, Reserved10,
                Reserved11, Reserved12, Reserved13, Reserved14, Reserved15,
                CreateConnection,                /* not in OMG spec. */
                AcceptConnection,                /* not in OMG spec. */
                BrokenConnection,                /* not in OMG spec. */
                RegisterImpl,                    /* not in OMG spec. */
                UnregisterImpl,                  /* not in OMG spec. */
                RegisterAck,                     /* not in OMG spec. */
                QueryImpl,                       /* not in OMG spec. */
                ReplyQueryImpl                   /* not in OMG spec. */
        };

        struct MessageHeader {
                char            magic[4];
                Version         iiop_version;
                boolean         byte_order;
                octet           message_type;
                unsigned long   message_size;
        };

        typedef unsigned long   ServiceID;

        struct ServiceContext {
                ServiceID       context_id;
                sequence<octet> context_data;
        };
        //
        // Support for Implicit ORB Service Context
        //

        typedef sequence <ServiceContext>       ServiceContextList;

        const   ServiceID       TransactionService = 0;
        const   ServiceID       DebuggerService = 0x49424d00;
        const   ServiceID       SecurityService = 0x49424d01;


        struct RequestHeader {
                ServiceContextList      service_context;
                unsigned long           request_id; /* correlation id */
                boolean                 response_expected;
                sequence <octet>        object_key;
                string                  operation;
                Principal               requesting_principal;
        };

        enum ReplyStatusType {
                NO_EXCEPTION,
                USER_EXCEPTION,
                SYSTEM_EXCEPTION,
                LOCATION_FORWARD
        };

        struct ReplyHeader {
                ServiceContextList      service_context;
                unsigned long           request_id;
                ReplyStatusType         reply_status;
        };

        struct ConnectHeader {
                unsigned long  port; /* local port */
        };

        struct AcceptHeader {
                unsigned long port; /* remote port */
        };

        struct CancelRequestHeader {
                unsigned long request_id;
        };

        struct LocateRequestHeader {
                unsigned long           request_id;
                sequence <octet>        object_key;
        };


        enum LocateStatusType {
                UNKNOWN_OBJECT,
                OBJECT_HERE,
                OBJECT_FORWARD
        };
        struct LocateReplyHeader {
                unsigned long           request_id;
                LocateStatusType        locate_status;
        };

        struct ImplementationHeader  {
                unsigned long request_id;
                string  impl_id;
                unsigned long tag;
        };


        typedef struct SOMDServiceContext {
                ServiceID               context_tag;
                sequence<octet>         context_data;
                somToken                context_body;
        } SOMDServiceContexts;

        // Object references have one service context for each of the object
        // service that require service-specific context information passed
        // between the client and server. This context information is used
        // by some factories to bind to the object and is used by some call
        // streams in the invocation of a request. The profile_body struct
        // context body is defined by the object service that is identified
        // by the context_tag
        // NOTE: When a new SOMDServiceContext is created context_body must be
        // initialized to NULL

         typedef sequence<SOMDServiceContexts> SOMDServiceContextList;
};


module IOR {

        typedef unsigned long ProfileId;

        //# Standard Protocol Profile tag values

        const ProfileId                 TAG_INTERNET_IOP = 0;
        const ProfileId                 TAG_MULTIPLE_COMPONENTS = 1;
        const ProfileId                 TAG_SOMD_NB     = 1229081859;
        const ProfileId                 TAG_SOMD_IPX    = 1229081858;
        const ProfileId                 TAG_SOMD_IPC    = 1229081857;
        const ProfileId                 TAG_SNA_PROFILE = 1229081856;

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

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

        #pragma modifier IOR : cxxmap="ior";

        typedef unsigned long   ComponentId;

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

        typedef sequence <TaggedComponent> MultipleComponentProfile;
        //
        // Standard way of representing multicomponent profiles
        // This would be encapsulated in a TaggedComponent
        //


        typedef struct SOMDTaggedProfile {
                ProfileId               profile_tag;
                sequence<octet>         profile_data;
                somToken                profile_body;
        } SOMDTaggedProfiles;

        typedef sequence<SOMDTaggedProfiles> seq_SOMDTaggedProfiles;

        // Object references have one tagged profile per call stream factory
        // supported. Those profiles together with the service context (see
        // above) encapsulate all the informationthat the factory needs to
        // bind to the object. The structure of the profile_body is wholly
        // specified by its factory that is identified by the profile_tag.
        // NOTE: When a new SOMDTaggedProfile is created profile_body must be
        // initialized to NULL

        struct SOMDTaggedComponent {
                ComponentId             component_tag;
                sequence<octet>         component_data;
                somToken                component_body;
        };

        struct SOMDIOR {
                string                          type_id;
                sequence<SOMDTaggedProfile>     profiles;
        };


};

#endif  /* __unotypes_idl */
