<?xml version="1.0" encoding="utf-8" ?>
<configuration>
  <configSections>
    <section name="unity" type="Microsoft.Practices.Unity.Configuration.UnityConfigurationSection, Microsoft.Practices.Unity.Configuration" />
  </configSections>
  <unity>
    <namespace name="Lextm.SharpSnmpLib.Pipeline" />
    <namespace name="Lextm.SharpSnmpLib.Messaging" />
    <namespace name="Lextm.SharpSnmpLib.Security"/>
    <namespace name="Lextm.SharpSnmpLib.Mib" />
    <namespace name="Lextm.SharpSnmpLib" />
    <assembly name="SharpSnmpLib.Mib" />
    <assembly name="SharpSnmpLib" />
    <aliases>
      <add alias="singleton" type="Microsoft.Practices.Unity.ContainerControlledLifetimeManager, Microsoft.Practices.Unity" />
    </aliases>
    <containers>
      <container name="snmptrapd">
        <!-- users -->
        <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="TRAPV1" />
                <dependency name="TRAPV2" />
                <dependency name="INFORM" />
                <dependency name="ALL" />
              </array>
            </param>
          </constructor>
        </register>
        <register type="HandlerMapping" name="TRAPV1">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v1" />
            <param name="command" value="TRAPV1" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="TrapV1Handler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="TRAPV2">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v2,v3" />
            <param name="command" value="TRAPV2" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="TrapV2Handler" />
          </constructor>
        </register>
        <register type="HandlerMapping" name="INFORM">
          <lifetime type="singleton" />
          <constructor>
            <param name="version" value="v2,v3" />
            <param name="command" value="INFORM" />
            <param name="handler" dependencyType="IMessageHandler" dependencyName="InformHandler" />
          </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="TrapV1MessageHandler" name="TrapV1Handler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="TrapV2MessageHandler" name="TrapV2Handler">
          <lifetime type="singleton" />
        </register>
        <register type="IMessageHandler" mapTo="InformRequestMessageHandler" name="InformHandler">
          <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" />-->
            <param name="store" dependencyType="ObjectStore" />
            <param name="membershipProvider" dependencyType="IMembershipProvider" dependencyName="Composed" />
            <param name="factory" dependencyType="MessageHandlerFactory" />
          </constructor>
        </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>
        <!-- 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>
        <register type="Listener">
          <lifetime type="singleton" />
          <property name="Users" dependencyType="UserRegistry" />
        </register>
      </container>
    </containers>
  </unity>
  <startup>
    <supportedRuntime version="v2.0.50727"/>
  </startup>
</configuration>
