public TestIORInterceptor(string name, string testId, Codec codec) { m_name = name; m_testId = testId; m_tc = new TaggedComponent(1000, codec.encode_value(new TestComponent(1))); }
/// <summary> /// adds the specified tagged component to all profiles. /// </summary> public void add_ior_component(TaggedComponent component) { for (int i = 0; i < m_profiles.Length; i++) { m_profiles[i].AddTaggedComponent(component); } }
/// <summary><see cref="Ch.Elca.Iiop.IServerConnectionListener.StartListening"</summary> public int StartListening(IPAddress bindTo, int listeningPortSuggestion, out TaggedComponent[] additionalTaggedComponents) { if (!m_isInitalized) { throw CreateNotInitalizedException(); } if (m_listenerActive) { throw CreateAlreadyListeningException(); } additionalTaggedComponents = new TaggedComponent[0]; int resultPort = listeningPortSuggestion; m_listener = new TcpListener(bindTo, listeningPortSuggestion); // start TCP-Listening m_listener.Start(); if (listeningPortSuggestion == 0) { // auto-assign port selected resultPort = ((IPEndPoint)m_listener.LocalEndpoint).Port; } m_listenerActive = true; // start the handler thread m_listenerThread.Start(); return(resultPort); }
/// <summary> /// adds the specified tagged component to the profile with the given id. /// </summary> public void add_ior_component_to_profile(TaggedComponent component, int profileId) { for (int i = 0; i < m_profiles.Length; i++) { if (m_profiles[i].ProfileId == profileId) { m_profiles[i].AddTaggedComponent(component); } } }
public override IorProfile GetProfileForAddr(byte[] objectKey, Codec codec) { InternetIiopProfile result = new InternetIiopProfile(Version, Host, 0, objectKey); SSLComponentData sslComp = new SSLComponentData(SecurityAssociationOptions.EstablishTrustInClient, SecurityAssociationOptions.EstablishTrustInTarget, (short)Port); TaggedComponent sslTaggedComp = new TaggedComponent(TAG_SSL_SEC_TRANS.ConstVal, codec.encode_value(sslComp)); result.AddTaggedComponent(sslTaggedComp); return(result); }
/// <summary><see cref="Ch.Elca.Iiop.IServerConnectionListener.StartListening"</summary> public int StartListening(IPAddress bindTo, int listeningPortSuggestion, out TaggedComponent[] taggedComponents) { if (!m_isInitalized) { throw CreateNotInitalizedException(); } if (m_listenerActive) { throw CreateAlreadyListeningException(); } int resultPort = listeningPortSuggestion; m_listener = new SecureTcpListener(bindTo, listeningPortSuggestion, m_sslOpts); // start TCP-Listening m_listener.Start(); if (listeningPortSuggestion == 0) { // auto-assign port selected resultPort = ((IPEndPoint)m_listener.LocalEndpoint).Port; } if (m_isSecured) { // create ssl tagged component SSLComponentData sslData = new SSLComponentData(Convert.ToInt16(m_supportedOptions), Convert.ToInt16(m_requiredOptions), (short)resultPort); taggedComponents = new TaggedComponent[] { new TaggedComponent(TAG_SSL_SEC_TRANS.ConstVal, m_codec.encode_value(sslData)) }; resultPort = 0; // don't allow unsecured connections -> port is in ssl components } else { taggedComponents = new TaggedComponent[0]; } m_listenerActive = true; // start the handler thread m_listenerThread.Start(); return(resultPort); }
public void TestOverrideCodeSetsWhenAlreadySet() { TaggedComponent defaultComponent = CodeSetService.CreateDefaultCodesetComponent(m_codec); CodeSetComponentData codeSetData = (CodeSetComponentData) m_codec.decode_value(defaultComponent.component_data, CodeSetComponentData.TypeCode); Assert.IsTrue(Enum.IsDefined(typeof(CharSet), codeSetData.NativeCharSet)); Assert.IsTrue(Enum.IsDefined(typeof(WCharSet), codeSetData.NativeWCharSet)); IOrbServices orbServices = OrbServices.GetSingleton(); try { orbServices.OverrideDefaultCharSets(CharSet.UTF8, WCharSet.UTF16); Assert.Fail("expected bad_inv_order exception"); } catch (BAD_INV_ORDER) { // expected, because already set } }
public void TestAddTaggedComponent() { CodeSetComponentData codeSetCompVal = new CodeSetComponentData((int)CharSet.LATIN1, new int[] { (int)CharSet.LATIN1 }, (int)WCharSet.UTF16, new int[] { (int)WCharSet.UTF16 }); TaggedComponent codeSetComponent = new TaggedComponent(TAG_CODE_SETS.ConstVal, m_codec.encode_value(codeSetCompVal)); m_profile.AddTaggedComponent(codeSetComponent); Assert.AreEqual(1, m_profile.TaggedComponents.Count, "tagged components one entry"); Assert.IsTrue(m_profile.ContainsTaggedComponent(TAG_CODE_SETS.ConstVal), "not found code set component"); CodeSetComponentData retrieved = (CodeSetComponentData)m_profile.TaggedComponents.GetComponentData(TAG_CODE_SETS.ConstVal, m_codec, CodeSetComponentData.TypeCode); Assert.NotNull(retrieved, "not found code set component"); Assert.AreEqual(codeSetCompVal.NativeCharSet, retrieved.NativeCharSet, "char set"); Assert.AreEqual(codeSetCompVal.NativeWCharSet, retrieved.NativeWCharSet, "wchar set"); }
public void send_request(ClientRequestInfo ri) { if (MustNonInterceptCall(ri)) { return; } m_invokedOnOutPath = true; TestServiceContext contextEntry = new TestServiceContext(); contextEntry.TestEntry = m_contextEntryBegin; ServiceContext context = new ServiceContext(1000, m_codec.encode(contextEntry)); ri.add_request_service_context(context, true); try { TaggedComponent taggedComponentEnc = ri.get_effective_component(1000); omg.org.CORBA.TypeCode typeCode = omg.org.CORBA.OrbServices.GetSingleton().create_tc_for_type(typeof(TestComponent)); m_taggedComponent = m_codec.decode_value(taggedComponentEnc.component_data, typeCode); } catch (BAD_PARAM) { m_taggedComponent = null; } }
public void AddTaggedComponent(TaggedComponent component) { m_taggedComponents.AddComponent(component); }