module IOP {
	//
	// Standard Protocol Profile tag values
	//
	typedef unsigned long ProfileId;
	const ProfileId TAG_INTERNET_IOP=0;
	const ProfileId TAG_MULTIPLE_COMPONENTS=1;

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

	//
	// an Interoperable Object Reference is a sequence of
	// object-specific protocol profiles, plus a type ID.
	//
	struct IOR {
		string type_id;
		sequence<TaggedProfile> profiles;
	};

	//
	// Standard way of representing multicomponent profiles.
	// This would be encapsulated in a TaggedProfile.
	//
	typedef unsigned long ComponentId;
	struct TaggedComponent {
		ComponentId tag;
		sequence<octet> component_data;
	};

	typedef sequence<TaggedComponent> MultipleComponentProfile;

	const ComponentId TAG_ORB_TYPE=0;
	const ComponentId TAG_CODE_SETS=1;
	const ComponentId TAG_SEC_NAME=14;
	const ComponentId TAG_ASSOCIATION_OPTIONS=13;
	const ComponentId TAG_GENERIC_SEC_MECH=12;

	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;
};

module CONV_FRAME {
	typedef unsigned long CodeSetId;

	struct CodeSetComponent {
		CodeSetId native_code_set;
		sequence<CodeSetId> conversion_code_sets;
	};

	struct CodeSetComponentInfo {
		CodeSetComponent ForCharData;
		CodeSetComponent ForWcharData;
	};

	struct CodeSetContext {
		CodeSetId char_data;
		CodeSetId wchar_data;
	};
};

module GIOP {
	struct Version {
		octet major;
		octet minor;
	};

	#ifndef GIOP_1_1
	// GIOP 1.0
	enum MsgType_1_0 {
		Request, Reply, CancelRequest,
		LocateRequest, LocateReply,
		CloseConnection, MessageError
	};
	#else
	// GIOP 1.1
	enum MsgType_1_1 {
		Request, Reply, CancelRequest,
		LocateRequest, LocateReply,
		CloseConnection, MessageError,
		Fragment
	};
	#endif

	// GIOP 1.0
	struct MessageHeader_1_0 {
		char magic[4];
		Version GIOP_version;
		boolean byte_order;
		octet message_type;
		unsigned long message_size;
	};

	// GIOP 1.1
	struct MessageHeader_1_1 {
		char magic[4];
		Version GIOP_version;
		octet flags;
		octet message_type;
		unsigned long message_size;
	};

	// GIOP 1.0
	struct RequestHeader_1_0 {
		IOP::ServiceContextList service_context;
		unsigned long request_id;
		boolean response_expected;
		sequence<octet> object_key;
		string operation;
		CORBA::Principal requesting_principal;
	};

	// GIOP 1.1
	struct RequestHeader_1_1 {
		IOP::ServiceContextList service_context;
		unsigned long request_id;
		boolean response_expected;
		octet reserved[3];
		sequence<octet> object_key;
		string operation;
		CORBA::Principal requesting_principal;
	};

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

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

	struct SystemExceptionReplyBody {
		string exception_id;
		unsigned long minor_code_value;
		unsigned long completion_status;
	};

	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;
	};
};

module IIOP {
	struct Version {
		octet major;
		octet minor;
	};

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

	struct ProfileBody_1_1 {
		Version iiop_version;
		string host;
		unsigned short port;
		sequence<octet> object_key;
		sequence<IOP::TaggedComponent> components;
	};
};
