//handle host config protected void HandleConfiguration() { Core core = Core.Instance(); // the path of the driver assembly ConfigElement config = ParseConfiguration(false); // we start with the configuration tag... // we assume that the XML is valid! // if we have children, and we have... if (config.ChildElements.Count > 0) { foreach (ConfigElement element in config.ChildElements) { switch (element.TagName) { case "creator": break; case "date": break; case "hostname": break; case "forwarding": break; case "OutQHandlerTimeout": core.SetOutQueueHandlerInterval(Convert.ToInt32(element.Text, 10)); break; case "protocol-path": protocolsPath = element.Text; break; case "drivers-path": driversPath = element.Text; break; case "backlog-size": int freeListSize = Convert.ToInt32(element.Text, 10); core.ProvisionDemux( freeListSize, EthernetFormat.MaxFrameSize ); break; case "protocols": // handle the protocols // use a generic scheme and apply // it to the adapters in the future ;-) // the args include the name and type! ProtocolParams args = new ProtocolParams();; foreach (ConfigElement prot in element.ChildElements) { args.Clear(); foreach (string attr in prot.Attributes.Keys) { args.Add(attr, prot.Attribute(attr)); } foreach (ConfigElement protInfo in prot.ChildElements) { args.Add(protInfo.TagName, protInfo.Text); } // done with one... if (!LoadProtocolModule(args)) { Core.Panic("Error while loading Protocol"); } } break; case "adapters": // handle the adapters ProtocolParams adArgs = new ProtocolParams();; foreach (ConfigElement ad in element.ChildElements) { adArgs.Clear(); foreach (string attr in ad.Attributes.Keys) { adArgs.Add(attr, ad.Attribute(attr)); } foreach (ConfigElement adInfo in ad.ChildElements) { adArgs.Add(adInfo.TagName, adInfo.Text); } // done with one... if (!LoadAdapter(adArgs, driversPath)) { Core.Panic("Error while loading an Adapter"); } } break; } } } }