Ejemplo n.º 1
0
 public void AddComponent(TaggedComponent component)
 {
     TaggedComponent[] resultEntries = new TaggedComponent[m_components.Length + 1];
     Array.Copy(m_components, resultEntries, m_components.Length);
     resultEntries[m_components.Length] = component;
     m_components = resultEntries;
 }
Ejemplo n.º 2
0
        private void ReadTaggedComponenttList(CdrInputStream inputStream)
        {
            int nrOfComponents = (int)inputStream.ReadULong();

            m_components = new TaggedComponent[nrOfComponents];
            for (int i = 0; i < nrOfComponents; i++)
            {
                TaggedComponent component = new TaggedComponent(inputStream);
                m_components[i] = component;
            }
        }
Ejemplo n.º 3
0
        /// <summary>
        /// serialise the given component data and adds it to the list of components.
        /// The data is encoded in a cdr encapsulation.
        /// </summary>
        public TaggedComponent AddComponentWithData(int tag, object data, Codec codec)
        {
            if ((data == null) || (codec == null))
            {
                throw new BAD_PARAM(80, CompletionStatus.Completed_MayBe);
            }
            TaggedComponent result = new TaggedComponent(tag, codec.encode_value(data));

            AddComponent(result);
            return(result);
        }
Ejemplo n.º 4
0
 public void AddComponents(TaggedComponent[] components)
 {
     if (components == null)
     {
         throw new BAD_PARAM(80, CompletionStatus.Completed_MayBe);
     }
     if (components.Length == 0)
     {
         return; // nothing to do.
     }
     TaggedComponent[] resultEntries = new TaggedComponent[m_components.Length + components.Length];
     Array.Copy(m_components, resultEntries, m_components.Length);
     Array.Copy(components, 0, resultEntries, m_components.Length, components.Length);
     m_components = resultEntries;
 }
Ejemplo n.º 5
0
 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)));            
 }        
Ejemplo n.º 6
0
 /// <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;
 }
Ejemplo n.º 7
0
 /// <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);
         }
     }
 }
Ejemplo n.º 8
0
 private void SetupChannelData(string hostName, int port, omg.org.IOP.Codec codec,
                               TaggedComponent[] additionalComponents)
 {
     IiopChannelData newChannelData = new IiopChannelData(hostName, port);
     newChannelData.AddAdditionalTaggedComponent(
         Services.CodeSetService.CreateDefaultCodesetComponent(codec));
     if ((additionalComponents != null) && (additionalComponents.Length > 0))
     {
         newChannelData.AddAdditionalTaggedComponents(additionalComponents);
     }
     m_channelData = newChannelData;
 }
Ejemplo n.º 9
0
 public void AddTaggedComponents(TaggedComponent[] components)
 {
     m_taggedComponents.AddComponents(components);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// serialise the given component data and adds it to the list of components.
 /// The data is encoded in a cdr encapsulation.
 /// </summary>
 public TaggedComponent AddComponentWithData(int tag, object data, Codec codec) {
     if ((data == null) || (codec == null)) {
         throw new BAD_PARAM(80, CompletionStatus.Completed_MayBe);
     }                        
     TaggedComponent result = new TaggedComponent(tag, codec.encode_value(data));
     AddComponent(result);
     return result;
 }
Ejemplo n.º 11
0
 private void ReadTaggedComponenttList(CdrInputStream inputStream) {
     int nrOfComponents = (int)inputStream.ReadULong();
     m_components = new TaggedComponent[nrOfComponents];
     for (int i = 0; i < nrOfComponents; i++) {
         TaggedComponent component = new TaggedComponent(inputStream);
         m_components[i] = component;
     }
 }
Ejemplo n.º 12
0
 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;
 }
Ejemplo n.º 13
0
 public void AddComponent()
 {
     TaggedComponent comp =
         new TaggedComponent(TAG_CODE_SETS.ConstVal,
                             m_codec.encode_value(
                                 new Services.CodeSetComponentData(10000,
                                                                   new int[0],
                                                                   20000,
                                                                   new int[0])));
     m_channelData.AddAdditionalTaggedComponent(comp);
     Assert.AreEqual(1,
                            m_channelData.AdditionalTaggedComponents.Length, "Component not added correctly");
     Assert.AreEqual(comp.tag,
                            m_channelData.AdditionalTaggedComponents[0].tag, "Component not added correctly");
 }
Ejemplo n.º 14
0
 /// <summary>adds passed additional tagged components to all IOR for objects hosted by this appdomain.</summary>
 public void AddAdditionalTaggedComponents(TaggedComponent[] newTaggedComponents)
 {
     m_additionTaggedComponents.AddRange(newTaggedComponents);
 }
Ejemplo n.º 15
0
 /// <summary>add passed additional tagged component to all IOR for objects hosted by this appdomain.</summary>
 public void AddAdditionalTaggedComponent(TaggedComponent taggedComponent)
 {
     m_additionTaggedComponents.Add(taggedComponent);
 }
Ejemplo n.º 16
0
 public void AddComponent(TaggedComponent component) {
     TaggedComponent[] resultEntries = new TaggedComponent[m_components.Length + 1];
     Array.Copy(m_components, resultEntries, m_components.Length);
     resultEntries[m_components.Length] = component;                
     m_components = resultEntries;            
 }
Ejemplo n.º 17
0
 public void AddComponents(TaggedComponent[] components) {
     if (components == null) {
         throw new BAD_PARAM(80, CompletionStatus.Completed_MayBe);
     }
     if (components.Length == 0) {
         return; // nothing to do.
     }
     TaggedComponent[] resultEntries = new TaggedComponent[m_components.Length + components.Length];
     Array.Copy(m_components, resultEntries, m_components.Length);
     Array.Copy(components, 0, resultEntries, m_components.Length, components.Length);
     m_components = resultEntries;            
 }
Ejemplo n.º 18
0
 public void AddTaggedComponent(TaggedComponent component)
 {
     m_taggedComponents.AddComponent(component);
 }
Ejemplo n.º 19
0
 /// <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);
     }
 }
Ejemplo n.º 20
0
 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");
 }
 /// <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;
 }