Exemple #1
0
        /// <summary> Return a number of ProtocolConfigurations in a vector</summary>
        /// <param name="configuration">protocol-stack configuration string
        /// </param>
        /// <returns> Vector of ProtocolConfigurations
        /// </returns>
        public virtual System.Collections.ArrayList parseConfigurations(string configuration)
        {
            System.Collections.ArrayList retval            = System.Collections.ArrayList.Synchronized(new System.Collections.ArrayList(10));
            System.Collections.ArrayList component_strings = parseComponentStrings(configuration, ":");
            string component_string;
            ProtocolConfiguration protocol_config;

            if (component_strings == null)
            {
                return(null);
            }
            for (int i = 0; i < component_strings.Count; i++)
            {
                component_string = ((string)component_strings[i]);
                protocol_config  = new ProtocolConfiguration(this, component_string);
                retval.Add(protocol_config);
            }
            return(retval);
        }
Exemple #2
0
        /// <summary> Creates a new protocol given the protocol specification. Initializes the properties and starts the
        /// up and down handler threads.
        /// </summary>
        /// <param name="prot_spec">The specification of the protocol. Same convention as for specifying a protocol stack.
        /// An exception will be thrown if the class cannot be created. Example:
        /// <pre>"VERIFY_SUSPECT(timeout=1500)"</pre> Note that no colons (:) have to be
        /// specified
        /// </param>
        /// <param name="stack">The protocol stack
        /// </param>
        /// <returns> Protocol The newly created protocol
        /// </returns>
        /// <exception cref=""> Exception Will be thrown when the new protocol cannot be created
        /// </exception>
        public virtual Protocol createProtocol(string prot_spec, ProtocolStack stack)
        {
            ProtocolConfiguration config;
            Protocol prot;

            if (prot_spec == null)
            {
                throw new System.Exception("Configurator.createProtocol(): prot_spec is null");
            }

            // parse the configuration for this protocol
            config = new ProtocolConfiguration(this, prot_spec);

            // create an instance of the protocol class and configure it
            prot = config.createLayer(stack);

            // start the handler threads (unless down_thread or up_thread are set to false)
            prot.startDownHandler();
            prot.startUpHandler();

            return(prot);
        }