<?xml version="1.0"?>
<configuration>
  <configSections>
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
    <!-- Register a section handler for the log4net section -->
    <section name="log4net" type="System.Configuration.IgnoreSectionHandler" />
  </configSections>
  <unity>
    <namespace name="Lextm.SharpSnmpLib.Pipeline" />
    <namespace name="Lextm.SharpSnmpLib.Messaging" />
    <namespace name="Lextm.SharpSnmpLib.Agent" />
    <namespace name="Lextm.SharpSnmpLib.Security" />
    <namespace name="Lextm.SharpSnmpLib" />
    <assembly name="snmpd" />
    <assembly name="SharpSnmpLib" />
    <aliases>
      <add alias="Logger" type="Lextm.SharpSnmpLib.Agent.RollingLogger, snmpd" />
      <add alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
    </aliases>
    <containers>
      <container name="agent">
        <register type="Listener">
          <lifetime type="singleton" />
          <property name="Users" dependencyType="UserRegistry" />
        </register>
        <register type="UserRegistry">
          <lifetime type="singleton" />
          <constructor>
            <param name="users" dependencyType="User[]" />
          </constructor>
        </register>
        <!-- message handler settings-->
        <register type="MessageHandlerFactory" name="MessageFactory">
          <lifetime type="singleton" />
          <constructor>
            <param name="mappings">
              <array>
                <!--here we only have four-->
                <dependency name="GET" />
                <dependency name="GET23" />
                <dependency name="SET" />
                <dependency name="SET23" />
                <dependency name="GETNEXT" />
                <dependency name="GETNEXT23" />
                <dependency name="GETBULK" />
                <dependency name="ALL" />
              </array>
            </param>
          </constructor>
        </register>
        <register type="HandlerMapping" name="GET">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v1" />
            <param name="command" value="GET" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="GetHandler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="GET23">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v2,v3" />
            <param name="command" value="GET" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="GetV2V3Handler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="SET">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v1" />
            <param name="command" value="SET" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="SetHandler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="SET23">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v2,v3" />
            <param name="command" value="SET" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="SetV2V3Handler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="GETNEXT">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v1" />
            <param name="command" value="GETNEXT" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="GetNextHandler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="GETNEXT23">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v2,v3" />
            <param name="command" value="GETNEXT" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="GetNextV2V3Handler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="GETBULK">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v2,v3" />
            <param name="command" value="GETBULK" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="GetBulkHandler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="ALL">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="*" />
            <param name="command" value="*" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="NullHandler" />
          </constructor>
        </register>
        <register type="IMessageHandler" mapTo="GetV1MessageHandler" name="GetHandler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="GetMessageHandler" name="GetV2V3Handler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="SetV1MessageHandler" name="SetHandler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="SetMessageHandler" name="SetV2V3Handler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="GetNextV1MessageHandler" name="GetNextHandler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="GetNextMessageHandler" name="GetNextV2V3Handler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="GetBulkMessageHandler" name="GetBulkHandler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="NullMessageHandler" name="NullHandler">
          <lifetime type="singleton" />
        </register>
        <!-- application factory and its parts -->
        <register type="SnmpApplicationFactory">
          <lifetime type="singleton" />
          <constructor>
            <param name="logger" dependencyType="ILogger" />
            <param name="store" dependencyType="ObjectStore" />
            <param name="membershipProvider" dependencyType="IMembershipProvider" dependencyName="Composed" />
            <param name="factory" dependencyType="MessageHandlerFactory" />
          </constructor>
        </register>
        <register type="ILogger" mapTo="Logger">
          <lifetime type="singleton" />
        </register>
        <register type="ObjectStore">
          <lifetime type="singleton" />
        </register>
        <!-- this is the membership provider -->
        <register type="IMembershipProvider" mapTo="ComposedMembershipProvider" name="Composed">
          <lifetime type="singleton" />
          <constructor>
            <param name="providers">
              <array>
                <dependency name="v1" />
                <dependency name="v2" />
                <dependency name="v3" />
              </array>
            </param>
          </constructor>
        </register>
        <register type="IMembershipProvider" mapTo="Version1MembershipProvider" name="v1">
          <lifetime type="singleton" />
          <constructor>
            <param name="getCommunity" dependencyType="OctetString" dependencyName="get" />
            <param name="setCommunity" dependencyType="OctetString" dependencyName="set" />
          </constructor>
        </register>
        <register type="IMembershipProvider" mapTo="Version2MembershipProvider" name="v2">
          <lifetime type="singleton" />
          <constructor>
            <param name="getCommunity" dependencyType="OctetString" dependencyName="get" />
            <param name="setCommunity" dependencyType="OctetString" dependencyName="set" />
          </constructor>
        </register>
        <register type="IMembershipProvider" mapTo="Version3MembershipProvider" name="v3">
          <lifetime type="singleton" />
        </register>
        <register type="OctetString" name="get">
          <lifetime type="singleton" />
          <constructor>
            <param name="content" value="public" />
          </constructor>
        </register>
        <register type="OctetString" name="set">
          <lifetime type="singleton" />
          <constructor>
            <param name="content" value="public" />
          </constructor>
        </register>
        <!-- finally we construct the engine -->
        <register type="SnmpEngine">
          <lifetime type="singleton" />
          <constructor>
            <param name="factory" dependencyType="SnmpApplicationFactory" />
            <param name="listener" dependencyType="Listener" />
            <param name="group" dependencyType="EngineGroup" />
          </constructor>
        </register>
      </container>
    </containers>
  </unity>
  <!-- This section contains the log4net configuration settings -->
  <log4net>
    <!-- Define some output appenders -->
    <appender name="RollingLogFileAppender" type="Lextm.Common.RollingFileAppender">
      <file value="snmp" />
      <appendToFile value="true" />
      <rollingStyle value="Date" />
      <datePattern value="yyMMdd" />
      <staticLogFileName value="false" />
      <layout type="log4net.Layout.PatternLayout">
        <conversionPattern value="%message%newline" />
      </layout>
    </appender>
    <!-- Setup the root category, add the appenders and set the default level -->
    <root>
      <level value="WARN" />
    </root>
    <!-- Specify the level for some specific categories -->
    <logger name="Lextm.SharpSnmpLib.Agent.RollingLogger">
      <level value="ALL" />
      <appender-ref ref="RollingLogFileAppender" />
    </logger>
  </log4net>
  <startup>
    <supportedRuntime version="v2.0.50727" />
  </startup>
  <!--<system.diagnostics>
    <trace autoflush="true" />
    <sources>
      <source name="System.Net">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
      <source name="System.Net.HttpListener">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
      <source name="System.Net.Sockets">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
      <source name="System.Net.Cache">
        <listeners>
          <add name="System.Net"/>
        </listeners>
      </source>
    </sources>
    <sharedListeners>
      <add
      name="System.Net"
      type="System.Diagnostics.TextWriterTraceListener"
      initializeData="d:\\snmp.log" traceOutputOptions = "DateTime" />
    </sharedListeners>
    <switches>
      <add name="System.Net" value="Verbose" />
      <add name="System.Net.Sockets" value="Verbose" />
      <add name="System.Net.Cache" value="Verbose" />
      <add name="System.Net.HttpListener" value="Verbose" />
    </switches>
  </system.diagnostics>-->
</configuration>