Esempio n. 1
0
 /// <summary>
 /// <see cref="Ch.Elca.Iiop.IClientTransportFactory.CanCreateTransportForIor"/>
 /// </summary>
 public bool CanCreateTranporForIor(Ior target) {
     // check for SSL component
     for (int i = 0; i < target.Profiles.Length; i++) {
         if (CanUseProfile(target.Profiles[i])) {
             return true;
         }
     }
     return false;
 }
Esempio n. 2
0
 public void TestWithSslComponent()
 {
     string iorString = "IOR:000000000000003749444C3A43682F456C63612F49696F702F5475746F7269616C2F47657474696E67537461727465642F4164646572496D706C3A312E30000000000001000000000000005C000102000000000D3139322E3136382E312E33370000000000000005616464657200000000000002000000010000001C0000000000010001000000010001002000010109000000010001010000000014000000080000006000601F97";
     Ior ior = new Ior(iorString);
     Assert.AreEqual(1, ior.Profiles.Length, "wrong number of profiles");
     Assert.AreEqual(TAG_INTERNET_IOP.ConstVal, ior.Profiles[0].ProfileId, "first profile type");
     InternetIiopProfile iiopProf = (InternetIiopProfile)ior.Profiles[0];
     Assert.AreEqual("192.168.1.37", iiopProf.HostName, "wrong hostname");
     Assert.AreEqual(1, iiopProf.Version.Major, "wrong major");
     Assert.AreEqual(2, iiopProf.Version.Minor, "wrong minor");
     Assert.AreEqual(2, iiopProf.TaggedComponents.Count, "wrong number of components in profile");
     Assert.NotNull(iiopProf.TaggedComponents.GetComponentData(TAG_SSL_SEC_TRANS.ConstVal, m_codec,
                                                                        Ch.Elca.Iiop.Security.Ssl.SSLComponentData.TypeCode), "no ssl tagged component found");
 }
Esempio n. 3
0
 /// <summary>
 /// This method parses an url for the IIOP channel. 
 /// It extracts the channel URI and the objectURI
 /// </summary>
 /// <param name="url">the url to parse</param>
 /// <param name="objectURI">the objectURI</param>
 /// <returns>the channel-Uri</returns>
 internal Uri ParseUrl(string url, out string objectUri,
                       out GiopVersion version)
 {
     Uri uri = null;
     if (url.StartsWith("iiop"))
     {
         IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                       m_defaultAdditionalTaggedComponents);
         uri = iiopLoc.ParseUrl(out objectUri, out version);
     }
     else if (url.StartsWith("IOR"))
     {
         Ior ior = new Ior(url);
         IInternetIiopProfile profile = ior.FindInternetIiopProfile();
         if (profile != null)
         {
             uri = new Uri("iiop" + profile.Version.Major + "." + profile.Version.Minor +
                       Uri.SchemeDelimiter + profile.HostName + ":" + profile.Port);
             objectUri = IorUtil.GetObjectUriForObjectKey(profile.ObjectKey);
             version = profile.Version;
         }
         else
         {
             uri = null;
             objectUri = null;
             version = new GiopVersion(1, 0);
         }
     }
     else if (url.StartsWith("corbaloc"))
     {
         Corbaloc loc = new Corbaloc(url, m_codec,
                                     m_defaultAdditionalTaggedComponents);
         uri = loc.ParseUrl(out objectUri, out version);
     }
     else
     {
         // not possible
         uri = null;
         objectUri = null;
         version = new GiopVersion(1, 0);
     }
     return uri;
 }
Esempio n. 4
0
 public void TestCodeSetComponent() {
     IOrbServices orb = OrbServices.GetSingleton();
     string iorString = orb.object_to_string(m_newTestService);
     Ior ior = new Ior(iorString);
     Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
     IIorProfile profile = ior.Profiles[0];
     omg.org.IOP.CodecFactory codecFactory = (omg.org.IOP.CodecFactory)
         orb.resolve_initial_references("CodecFactory");
     object codeset = 
         profile.TaggedComponents.GetComponentData(1, codecFactory.create_codec(new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal, 1, 2)),
                                                   CodeSetComponentData.TypeCode);
     Assert.NotNull(codeset);
     Assert.AreEqual((int)CharSet.UTF8, ((CodeSetComponentData)codeset).NativeCharSet);
     Assert.AreEqual((int)WCharSet.UTF16, ((CodeSetComponentData)codeset).NativeWCharSet);            
 }
Esempio n. 5
0
 public void TestNonUsableProfileIncluded()
 {
     string iorString = "IOR:000000000000001b49444c3a636d6956322f5573657241636365737356323a312e3000020000000210ca1000000000650000000800000008646576312d73660033de6f8e0000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf80120000009400000000000000980001023100000008646576312d736600200b00020000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf8012000000140000000200000002000000140000000400000001000000230000000400000001000000000000000800000000cb0e0001";
     Ior ior = new Ior(iorString);
     Assert.AreEqual("IDL:cmiV2/UserAccessV2:1.0", ior.TypID, "wrong RepositoryId");
     IInternetIiopProfile iiopProf = ior.FindInternetIiopProfile();
     Assert.NotNull(iiopProf, "iiop ior profile not found");
     Assert.AreEqual("dev1-sf", iiopProf.HostName, "wrong hostname");
     Assert.AreEqual(8203, iiopProf.Port, "wrong port");
     Assert.AreEqual(1, iiopProf.Version.Major, "wrong major");
     Assert.AreEqual(2, iiopProf.Version.Minor, "wrong minor");
     Assert.AreEqual(2, ior.Profiles.Length, "wrong number of profiles");
 }
Esempio n. 6
0
 public void TestSystemIdForMbr() {
     Adder adder = m_testService.CreateNewWithSystemID();
     string marshalUrl = RemotingServices.GetObjectUri(adder);
     Ior adderIor = new Ior(marshalUrl);
     IInternetIiopProfile prof = adderIor.FindInternetIiopProfile();
     byte[] objectKey = prof.ObjectKey;
     ASCIIEncoding enc = new ASCIIEncoding();
     string marshalUri = new String(enc.GetChars(objectKey));
     if (marshalUri.StartsWith("/")) {
         marshalUri = marshalUri.Substring(1);
     }
     Assert.IsTrue(marshalUri.IndexOf("/") > 0, "no appdomain-guid");
     string guid_string = marshalUri.Substring(0, marshalUri.IndexOf("/"));
     guid_string = guid_string.Replace("_", "-");
     try {
         Guid guid = new Guid(guid_string);
     } catch (Exception ex) {
         Assert.Fail("guid not in uri: " + ex);
     }
     
     // check if callable
     int arg1 = 1;
     int arg2 = 2;
     Assert.AreEqual(arg1 + arg2, adder.Add(arg1, arg2), "wrong adder result");
 }
Esempio n. 7
0
 public void TestIdsIncludingNonAscii() {
     string id = "myAdderId" + '\u0765' + "1" + @"\uA";
     string expectedMarshalledId = @"myAdderId\u07651\\uA";
     Adder adder = m_testService.CreateNewWithUserID(id);
     string marshalUrl = RemotingServices.GetObjectUri(adder);
     Ior adderIor = new Ior(marshalUrl);
     IInternetIiopProfile prof = adderIor.FindInternetIiopProfile();
     byte[] objectKey = prof.ObjectKey;
     ASCIIEncoding enc = new ASCIIEncoding();
     string marshalUri = new String(enc.GetChars(objectKey));
     Assert.AreEqual(expectedMarshalledId, marshalUri, "wrong user id");
     
     // check if callable
     int arg1 = 1;
     int arg2 = 2;
     Assert.AreEqual(arg1 + arg2, adder.Add(arg1, arg2), "wrong adder result");
 }
Esempio n. 8
0
 private bool IsInterfaceCompatible(Ior target, Type neededTargetType, string targetUrl) {
     Type interfaceType;
     // local check first otherwise remote
     return Repository.IsInterfaceCompatible(neededTargetType, target.TypID, out interfaceType) ||
            CheckAssignableRemote(neededTargetType, targetUrl);
 }
Esempio n. 9
0
 private void VerifyInterfaceCompatible(Ior target, IMessage msg) {
     if (msg is IMethodMessage) {
         IMethodMessage methodCall = (IMethodMessage)msg;
         Type targetType = methodCall.MethodBase.DeclaringType;
         lock(m_typesVerified.SyncRoot) {
             if (m_typesVerified.ContainsKey(targetType)) {
                 return;
             } else {
                 if (IsInterfaceCompatible(target, targetType, methodCall.Uri)) {
                     // this sink chain is assigned to a remote proxy for the
                     // methodCall.Uri; for a distinct target url, a different
                     // formatter instance is used -> therefore, don't need to
                     // distinguish for different uris.
                     m_typesVerified[targetType] = true;
                 } else {
                     throw new BAD_PARAM(20010, CompletionStatus.Completed_No,
                                         "The target object with the uri: " + methodCall.Uri +
                                         " doesn't support the interface: " +
                                         targetType.AssemblyQualifiedName);
                 }
             }
         }
     } else {
         // can't verify for this message
         throw new INTERNAL(319, CompletionStatus.Completed_No);
     }
 }
Esempio n. 10
0
 public void TestSSLComponent() {
     IOrbServices orb = OrbServices.GetSingleton();
     string iorString = orb.object_to_string(m_newTestService);
     Ior ior = new Ior(iorString);
     Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
     IIorProfile profile = ior.Profiles[0];
     omg.org.IOP.CodecFactory codecFactory = (omg.org.IOP.CodecFactory)
         orb.resolve_initial_references("CodecFactory");
     object sslData = 
         profile.TaggedComponents.GetComponentData(20, codecFactory.create_codec(new omg.org.IOP.Encoding(omg.org.IOP.ENCODING_CDR_ENCAPS.ConstVal, 1, 2)),
                                                   SSLComponentData.TypeCode);
     Assert.NotNull(sslData);
     Assert.AreEqual((int)8087, ((SSLComponentData)sslData).GetPort());
 }
Esempio n. 11
0
 /// <summary>allocates a connection and adds
 /// the connectionDesc to the message</summary>
 private GiopClientConnectionDesc AllocateConnection(IMessage msg, Ior target, out IIorProfile selectedProfile,
                                                     out uint reqId) {
     for (int i = 0; i < target.Profiles.Length; i++) {
         if (m_conManager.CanConnectWithProfile(target.Profiles[i])) {
             selectedProfile = target.Profiles[i];
             try {
                 return m_conManager.AllocateConnectionFor(msg, selectedProfile, out reqId);
             } catch (Exception ex) {
                 Trace.WriteLine("exception while trying to connect to target: " + ex);
                 continue; // try next profile
             }
         }
     }
     throw new TRANSIENT(CorbaSystemExceptionCodes.TRANSIENT_CANTCONNECT,
                         CompletionStatus.Completed_No, "Unable to connect to target."); // can't connect to ior at the moment.
 }
 /// <summary>
 /// checks, if this connection manager is able to build up a connection to the given target ior
 /// </summary>
 internal bool CanConnectToIor(Ior target) {
     return m_transportFactory.CanCreateTranporForIor(target);
 }
Esempio n. 13
0
 /// <summary>creates an IOR for the object described by the Url url</summary>
 /// <param name="url">an url of the form IOR:--hex-- or iiop://addr/key</param>
 /// <param name="targetType">if the url contains no info about the target type, use this type</param>
 public Ior CreateIorForUrl(string url, string repositoryId)
 {
     Ior ior = null;
     if (IsIorString(url))
     {
         ior = new Ior(url);
     }
     else if (url.StartsWith("iiop"))
     {
         // iiop1.0, iiop1.1, iiop1.2 (=iiop); extract version in protocol tag
         IiopLoc iiopLoc = new IiopLoc(url, m_codec,
                                       m_defaultAdditionalTaggedComponents);
         // now create an IOR with the above information
         ior = new Ior(repositoryId, iiopLoc.GetProfiles());
     }
     else if (url.StartsWith("corbaloc"))
     {
         Corbaloc loc = new Corbaloc(url, m_codec,
                                     m_defaultAdditionalTaggedComponents);
         IorProfile[] profiles = loc.GetProfiles();
         ior = new Ior(repositoryId, profiles);
     }
     else
     {
         throw new INV_OBJREF(1963, CompletionStatus.Completed_MayBe);
     }
     return ior;
 }
Esempio n. 14
0
        private void CheckIorForUrl(Ior iorForUrl, int expectedNumberOfComponents,
                                    bool shouldHaveCodeSetComponent)
        {
            Assert.AreEqual(1, iorForUrl.Profiles.Length, "number of profiles");
            Assert.AreEqual(typeof(MarshalByRefObject),
                                   iorForUrl.Type, "type");
            IIorProfile profile = iorForUrl.FindInternetIiopProfile();
            Assert.NotNull(profile, "internet iiop profile");
            Assert.AreEqual(
                                                 new byte[] { 116, 101, 115, 116 },
                                                 profile.ObjectKey, "profile object key");
            Assert.AreEqual(new GiopVersion(1, 2), profile.Version, "profile giop version");

            if (shouldHaveCodeSetComponent)
            {
                Assert.AreEqual(
                                       expectedNumberOfComponents,
                                       profile.TaggedComponents.Count, "number of components");
                Assert.IsTrue(profile.ContainsTaggedComponent(
                                     CodeSetService.SERVICE_ID), "code set component present");
                CodeSetComponentData data = (CodeSetComponentData)
                    profile.TaggedComponents.GetComponentData(CodeSetService.SERVICE_ID,
                                                              m_codec,
                                                              CodeSetComponentData.TypeCode);
                Assert.AreEqual(
                                       (int)CharSet.LATIN1,
                                       data.NativeCharSet, "code set component: native char set");
                Assert.AreEqual(
                                       (int)WCharSet.UTF16,
                                       data.NativeWCharSet, "code set component: native char set");
            }
            else
            {
                Assert.IsTrue(
                                 !profile.ContainsTaggedComponent(
                                     CodeSetService.SERVICE_ID), "code set component present");
            }
        }
Esempio n. 15
0
 private SSLComponentData GetSSLComponent(Ior ior, Codec codec) {
     object result = null;
     for (int i = 0; i < ior.Profiles.Length; i++) {
         result = GetSSLComponent(ior.Profiles[i], codec);
         if (result != null) {
             break;
         }
     }
     if (result != null) {
         return (SSLComponentData)result;
     } else {
         throw new INTERNAL(734, CompletionStatus.Completed_No);
     }
 }
Esempio n. 16
0
        private IMessage SyncProcessMessageOnce(IMessage msg,
                                                Ior target) {

            IIorProfile selectedProfile;
            uint reqId;
            try {
                // allocate (reserve) connection
                GiopClientConnectionDesc conDesc =
                    AllocateConnection(msg, target, out selectedProfile, out reqId);
                ITransportHeaders requestHeaders;
                Stream requestStream;
                SerialiseRequest(msg, selectedProfile, conDesc, reqId,
                                 out requestHeaders, out requestStream);

                // pass the serialised GIOP-request to the first stream handling sink
                // when the call returns, the response message has been received
                ITransportHeaders responseHeaders;
                Stream responseStream;
                m_nextSink.ProcessMessage(msg, requestHeaders, requestStream,
                                          out responseHeaders, out responseStream);

                // now deserialise the response
                return DeserialiseResponse(responseStream,
                                           responseHeaders, msg, conDesc);
            } finally {
                m_conManager.RequestOnConnectionCompleted(msg); // release the connection, because this interaction is complete
            }
        }
Esempio n. 17
0
 public void TestUserIdForMbr() {
     string id = "myAdderId";
     Adder adder = m_testService.CreateNewWithUserID(id);
     string marshalUrl = RemotingServices.GetObjectUri(adder);
     Ior adderIor = new Ior(marshalUrl);
     IInternetIiopProfile prof = adderIor.FindInternetIiopProfile();
     byte[] objectKey = prof.ObjectKey;
     ASCIIEncoding enc = new ASCIIEncoding();
     string marshalUri = new String(enc.GetChars(objectKey));
     Assert.AreEqual(id, marshalUri, "wrong user id");
     
     // check if callable
     int arg1 = 1;
     int arg2 = 2;
     Assert.AreEqual(arg1 + arg2, adder.Add(arg1, arg2), "wrong adder result");
 }
Esempio n. 18
0
 private void AsyncProcessMessageOnce(IMessage msg,
                                          Ior target, IMessageSink replySink) {
     IIorProfile selectedProfile;
     uint reqId;
     try {
         // allocate (reserve) connection
         GiopClientConnectionDesc conDesc = AllocateConnection(msg, target, out selectedProfile, out reqId);
         SimpleGiopMsg.SetMessageAsyncRequest(msg); // mark message as async, needed for portable interceptors
         ITransportHeaders requestHeaders;
         Stream requestStream;
         SerialiseRequest(msg, selectedProfile, conDesc, reqId,
                          out requestHeaders, out requestStream);
         // pass the serialised GIOP-request to the first stream handling sink
         // this sink is the last sink in the message handling sink chain, therefore the reply sink chain of all the previous message handling
         // sink is passed to the ClientChannelSinkStack, which will inform this chain of the received reply
         ClientChannelSinkStack clientSinkStack = new ClientChannelSinkStack(replySink);
         AsyncProcessingData asyncData = new AsyncProcessingData(msg, conDesc);
         clientSinkStack.Push(this, asyncData); // push the formatter onto the sink stack, to get the chance to handle the incoming reply stream
         // forward the message to the next sink
         m_nextSink.AsyncProcessRequest(clientSinkStack, msg, requestHeaders, requestStream);
         // for oneway messages, release the connections for future use
         if ((msg is IMethodCallMessage) && GiopMessageHandler.IsOneWayCall((IMethodCallMessage)msg)) {
              m_conManager.RequestOnConnectionCompleted(msg); // release the connection, because this interaction is complete
         }
     } catch {
         // release the connection, if something went wrong during connection allocation and send
         m_conManager.RequestOnConnectionCompleted(msg); // release the connection, because this interaction is complete
         throw;
     }
 }
Esempio n. 19
0
        public void TestObjectToString() {
            OrbServices orbServices = OrbServices.GetSingleton();
            string id = "myAdderId2";
            Adder adder = m_testService.CreateNewWithUserID(id);
            string iorString = orbServices.object_to_string(adder);
            Ior adderIor = new Ior(iorString);
            IInternetIiopProfile prof = adderIor.FindInternetIiopProfile();
            Assert.AreEqual(8087, prof.Port);
            Assert.AreEqual(1, prof.Version.Major);
            Assert.AreEqual(2, prof.Version.Minor);
            
            byte[] oid = { 0x6d, 0x79, 0x41, 0x64, 0x64, 0x65, 0x72, 0x49, 0x64, 0x32 };
            CheckIorKey(oid, prof.ObjectKey);

            string testServiceIorString = m_testService.GetIorStringForThisObject();
            Ior testServiceIor = new Ior(testServiceIorString);
            IInternetIiopProfile profSvcIor = testServiceIor.FindInternetIiopProfile();
            Assert.AreEqual(8087, profSvcIor.Port);
            Assert.AreEqual(1, profSvcIor.Version.Major);
            Assert.AreEqual(2, profSvcIor.Version.Minor);
            
            byte[] oidTestService = { 0x74, 0x65, 0x73, 0x74 };
            CheckIorKey(oidTestService, profSvcIor.ObjectKey);


        }
Esempio n. 20
0
 /// <summary>
 /// creates an IOR for an object hosted in the local appdomain.
 /// </summary>
 /// <param name="obj"></param>
 /// <returns></returns>
 internal static Ior CreateIorForObjectFromThisDomain(MarshalByRefObject obj, Type forType, bool marshalUsingForType) {
     Console.WriteLine("Marshalling using for type: {0}", marshalUsingForType);
     ObjRef objRef = 
         marshalUsingForType ? RemotingServices.Marshal(obj, null, forType)
                             : RemotingServices.Marshal(obj); // make sure, the object is marshalled and get obj-ref
     byte[] objectKey = GetObjectKeyForUri(objRef.URI);
     IiopChannelData serverData = GetIiopChannelData(objRef);
     if (serverData != null) {
         string host = serverData.HostName;
         int port = serverData.Port;
         if ((objectKey == null) || (host == null)) {
             // the objRef: " + refToTarget + ", uri: " +
             // refToTarget.URI + is not serialisable, because connection data is missing
             // hostName=host, objectKey=objectKey
             throw new INV_OBJREF(1961, CompletionStatus.Completed_MayBe);
         }
         string repositoryID = forType == ReflectionHelper.MarshalByRefObjectType
             ? "" // CORBA::Object has "" repository id
             : Repository.GetRepositoryID(forType);
         // this server support GIOP 1.2 --> create an GIOP 1.2 profile
         InternetIiopProfile profile = new InternetIiopProfile(new GiopVersion(1, 2), host,
                                                               (ushort)port, objectKey);
         // add additional tagged components according to the channel options, e.g. for SSL
         profile.AddTaggedComponents(serverData.AdditionalTaggedComponents);
         // add additional tagged components according to registered interceptors:
         AddProfileComponentsFromIorInterceptors(profile);
         
         Ior ior = new Ior(repositoryID, new IorProfile[] { profile });
         return ior;
     } else {
         Debug.WriteLine("ERROR: no server-channel information found!");
         Debug.WriteLine("Please make sure, that an IIOPChannel has been created with specifying a listen port number (0 for automatic)!");
         Debug.WriteLine("e.g. IIOPChannel chan = new IIOPChannel(0);");
         throw new INTERNAL(1960, CompletionStatus.Completed_MayBe);
     }
 }
Esempio n. 21
0
 /// <summary>gets a reference to the init service running at the specified host at the specified port</summary>
 private CORBAInitService GetInitService(string host, int port) {
     lock(m_initalServices.SyncRoot) {
         CORBAInitService initService = null;
         string key = host + ":" + port;
         if (!m_initalServices.ContainsKey(key)) {
             IorProfile initServiceProfile = 
                 new InternetIiopProfile(new GiopVersion(1, 0),
                                                         host, (ushort)port,
                                                         IorUtil.GetKeyBytesForId(CORBAInitServiceImpl.INITSERVICE_NAME));
             // don't add a codeset component, because giop 1.0
             Ior initServiceIor = new Ior(Repository.GetRepositoryID(typeof(CORBAInitService)),
                                          new IorProfile[] { initServiceProfile });
             
             string iorString = initServiceIor.ToString();                    
             initService = (CORBAInitService)RemotingServices.Connect(typeof(CORBAInitService), 
                                                                      iorString); // CORBAInitService type not verifiable remote -> make sure that it's possible to verify locally
             m_initalServices.Add(key, initService);
         } else {
             initService = (CORBAInitService) m_initalServices[key];
         }
         return initService;
     }
 }
        private Stream PrepareLocationFwdStream(string host, ushort port,
                                                MarshalByRefObject target) {
            // loc fwd ior
            byte[] objectKey = IorUtil.GetObjectKeyForObj(target);
            string repositoryID = Repository.GetRepositoryID(target.GetType());
            // this server support GIOP 1.2 --> create an GIOP 1.2 profile
            InternetIiopProfile profile = new InternetIiopProfile(new GiopVersion(1, 2), host,
                                                                  port, objectKey);
            profile.AddTaggedComponent(Services.CodeSetService.CreateDefaultCodesetComponent(m_codec));
            Ior locFwdTarget = new Ior(repositoryID, new IorProfile[] { profile });
            CdrOutputStreamImpl iorStream = new CdrOutputStreamImpl(new MemoryStream(),
                                                                    0, new GiopVersion(1, 2));
            locFwdTarget.WriteToStream(iorStream);
            uint encodedIorLength = (uint)iorStream.GetPosition();
 
            // create the location fwd reply
            MemoryStream sourceStream = new MemoryStream();
            CdrOutputStreamImpl cdrOut = new CdrOutputStreamImpl(sourceStream, 0, new GiopVersion(1, 2));
            cdrOut.WriteOpaque(m_giopMagic);
            // version
            cdrOut.WriteOctet(1);
            cdrOut.WriteOctet(2);
            // flags
            cdrOut.WriteOctet(0);
            // msg-type: reply
            cdrOut.WriteOctet(1);
 
            // msg-length
            cdrOut.WriteULong(28 + encodedIorLength);
            // request-id
            cdrOut.WriteULong(5);
            // reply-status: location fwd
            cdrOut.WriteULong(3);
            // one service context to enforce alignement requirement for giop 1.2
            cdrOut.WriteULong(1);
            cdrOut.WriteULong(162739); // service context id
            cdrOut.WriteULong(2); // length of svc context
            cdrOut.WriteBool(true);
            cdrOut.WriteBool(false);
            // svc context end
            // body: 8 aligned
            cdrOut.ForceWriteAlign(Aligns.Align8);

            locFwdTarget.WriteToStream(cdrOut);
 
            sourceStream.Seek(0, SeekOrigin.Begin);
            return sourceStream;
        }
Esempio n. 23
0
        public void TestIorCreation()
        {
            string iorString = "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050000102000000000c31302e34302e32302e3531001f9500000000000853617948656C6C6F0000000100000001000000200000000000010001000000020501000100010020000101090000000100010100";
            Ior ior = new Ior(iorString);
            Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
            Assert.AreEqual(TAG_INTERNET_IOP.ConstVal, ior.Profiles[0].ProfileId, "first profile type");
            IInternetIiopProfile iiopProf = (IInternetIiopProfile)ior.Profiles[0];
            Assert.AreEqual("10.40.20.51", iiopProf.HostName);
            Assert.AreEqual(8085, iiopProf.Port);
            Assert.AreEqual(1, iiopProf.Version.Major);
            Assert.AreEqual(2, iiopProf.Version.Minor);
            byte[] oid = new byte[] { 0x53, 0x61, 0x79, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
            CheckIorKey(oid, iiopProf.ObjectKey);


            iorString = "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050000102000000000c31302e34302e32302e3531007f9500000000000853617948656C6C6F0000000100000001000000200000000000010001000000020501000100010020000101090000000100010100";
            ior = new Ior(iorString);
            Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
            Assert.AreEqual(TAG_INTERNET_IOP.ConstVal, ior.Profiles[0].ProfileId, "first profile type");
            iiopProf = (IInternetIiopProfile)ior.Profiles[0];
            Assert.AreEqual("10.40.20.51", iiopProf.HostName);
            Assert.AreEqual(32661, iiopProf.Port);
            Assert.AreEqual(1, iiopProf.Version.Major);
            Assert.AreEqual(2, iiopProf.Version.Minor);
            oid = new byte[] { 0x53, 0x61, 0x79, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
            CheckIorKey(oid, iiopProf.ObjectKey);

            iorString = "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050000102000000000c31302e34302e32302e3531008f9500000000000853617948656C6C6F0000000100000001000000200000000000010001000000020501000100010020000101090000000100010100";
            ior = new Ior(iorString);
            Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
            Assert.AreEqual(TAG_INTERNET_IOP.ConstVal, ior.Profiles[0].ProfileId, "first profile type");
            iiopProf = (IInternetIiopProfile)ior.Profiles[0];
            Assert.AreEqual("10.40.20.51", iiopProf.HostName);
            Assert.AreEqual(36757, iiopProf.Port);
            Assert.AreEqual(1, iiopProf.Version.Major);
            Assert.AreEqual(2, iiopProf.Version.Minor);
            oid = new byte[] { 0x53, 0x61, 0x79, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
            CheckIorKey(oid, iiopProf.ObjectKey);

            iorString = "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050000102000000000c31302e34302e32302e353100ffff00000000000853617948656C6C6F0000000100000001000000200000000000010001000000020501000100010020000101090000000100010100";
            ior = new Ior(iorString);
            Assert.IsTrue(ior.Profiles.Length > 0, "nr of profiles");
            Assert.AreEqual(TAG_INTERNET_IOP.ConstVal, ior.Profiles[0].ProfileId, "first profile type");
            iiopProf = (IInternetIiopProfile)ior.Profiles[0];
            Assert.AreEqual("10.40.20.51", iiopProf.HostName);
            Assert.AreEqual(65535, iiopProf.Port);
            Assert.AreEqual(1, iiopProf.Version.Major);
            Assert.AreEqual(2, iiopProf.Version.Minor);
            oid = new byte[] { 0x53, 0x61, 0x79, 0x48, 0x65, 0x6C, 0x6C, 0x6F };
            CheckIorKey(oid, iiopProf.ObjectKey);
        }
 public void TestStringToObjectIORNormal()
 {
     Ior ior = new Ior("IDL:omg.org/CORBA/Object:1.0",
                       new IorProfile[] { m_profile });
     string iorString = ior.ToString();
     object objToString = m_orb.string_to_object(iorString);
     Assert.NotNull(objToString, "obj to string not created");
     Assert.IsTrue(
                      RemotingServices.IsTransparentProxy(objToString), "obj not a proxy");
 }
Esempio n. 25
0
        public void TestParseAndRecreate()
        {
            string iorString = BitConverter.IsLittleEndian
                                ? "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050010102000c00000031302e34302e32302e353100951f00000800000053617948656c6c6f0100000001000000200000000000000000010001000000020501000100010020000101090000000100010100"
                                : "IOR:0000000000000024524d493a48656c6c6f496e746572666163653a3030303030303030303030303030303000000000010000000000000050000102000000000c31302e34302e32302e3531001f9500000000000853617948656C6C6F0000000100000001000000200000000000010001000000020501000100010020000101090000000100010100";
            Ior ior = new Ior(iorString);
            string recreated = ior.ToString();
            Assert.AreEqual(iorString.ToLower(),
                                   recreated.ToLower(), "ior not recreated");

            string iorString2 = BitConverter.IsLittleEndian
                                 ? "IOR:000000000000001B49444C3A636D6956322F5573657241636365737356323A312E3000000000000210CA1000000000650000000800000008646576312D73660033DE6F8E0000004D000000020000000855736572504F41000000001043415355736572416363657373563200C3FBEDFB0000000E007C4C51000000FD57AACDAF801A0000000E007C4C51000000FD57AACDAF80120000000000000000000000980101020008000000646576312D7366000B2000004D000000000000020000000855736572504F41000000001043415355736572416363657373563200C3FBEDFB0000000E007C4C51000000FD57AACDAF801A0000000E007C4C51000000FD57AACDAF8012000000000200000002000000140000000000000400000001000000230000000400000001000000000800000000000000CB0E0001"
                                 : "IOR:000000000000001b49444c3a636d6956322f5573657241636365737356323a312e3000000000000210ca1000000000650000000800000008646576312d73660033de6f8e0000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf80120000000000000000000000980001020000000008646576312d736600200b00000000004d000000020000000855736572504f41000000001043415355736572416363657373563200c3fbedfb0000000e007c4c51000000fd57aacdaf801a0000000e007c4c51000000fd57aacdaf8012000000000000000200000002000000140000000400000001000000230000000400000001000000000000000800000000cb0e0001";
            Ior ior2 = new Ior(iorString2);
            string recreated2 = ior2.ToString();
            Assert.AreEqual(iorString2.ToLower(),
                                   recreated2.ToLower(), "ior2 not recreated");
        }
 public void TestStringToObjectIORUnknownType()
 {
     Ior ior = new Ior("IDL:Ch/Elca/Iiop/Tests/TestClientUnknownIf1:1.0",
                       new IorProfile[] { m_profile });
     string iorString = ior.ToString();
     object objToString = m_orb.string_to_object(iorString);
     Assert.NotNull(objToString, "obj to string not created");
     Assert.IsTrue(
                      RemotingServices.IsTransparentProxy(objToString), "obj not a proxy");
 }
Esempio n. 27
0
 internal LocateReplyMessage(Ior fwdTo) : this(LocateStatus.OBJECT_FORWARD) {
     m_properties[FWD_KEY] = fwdTo;
 }
Esempio n. 28
0
        private void Setup(string idSuffix, int retryNumber)
        {
            IDictionary props = new Hashtable();
            props[IiopServerChannel.PORT_KEY] = TEST_PORT.ToString();
            props[IiopClientChannel.MAX_NUMBER_OF_RETRIES_KEY] = "1";
            props[IiopClientChannel.RETRY_DELAY_KEY] = "10";
            IClientChannelSinkProvider clientSinkProvider =
                new IiopClientFormatterSinkProvider();
            m_testerProvider = new RetryingClientTransportTesterProvider();
            m_testerProvider.ForceNumberOfErrorCount = retryNumber;
            clientSinkProvider.Next = m_testerProvider;
            IServerChannelSinkProvider serverSinkProvider =
                new IiopServerFormatterSinkProvider();
            m_channel = new IiopChannel(props,
                                        clientSinkProvider,
                                        serverSinkProvider);
            ChannelServices.RegisterChannel(m_channel, false);

            m_targetIor = new Ior(Repository.GetRepositoryID(typeof(ISimpleCallTestOnChannel)),
                                  new IorProfile[] {
                                      new InternetIiopProfile(new GiopVersion(1,2),
                                                            "localhost", (ushort)TEST_PORT,
                                                            IorUtil.GetKeyBytesForId(TEST_URI + idSuffix))
                                  });
            m_targetIiopLoc = "iiop://localhost:" + TEST_PORT + "/" + TEST_URI + idSuffix;
            m_mbr = new SimpleCallTestOnChannelImpl();
            RemotingServices.Marshal(m_mbr, TEST_URI + idSuffix);
        }