// Path: src/jnetman/session/SnmpPref.java
// public class SnmpPref {
// 
// 	static private PropertiesParser prop = new PropertiesParser(
// 			Session.getSnmpPropertiesFile());
// 
// 	static public String getUser() {
// 		return prop.getString("V3_USER");
// 	}
// 
// 	static public String getPassword() {
// 		return prop.getString("V3_AUTHPRIV_PASSWORD");
// 	}
// 
// 	static public int getPort() {
// 		return prop.getInt("AGENT_PORT");
// 	}
// 
// 	static public int getTrapsPort() {
// 		return prop.getInt("TRAPS_PORT");
// 	}
// 
// 	static public int getTimeout() {
// 		return prop.getInt("TIMEOUT");
// 	}
// 
// 	static public int getMaxRetries() {
// 		return prop.getInt("MAX_RETRIES");
// 	}
// 
// 	static public boolean isSnmp4jLogEnabled() {
// 		return prop.getBoolean("ENABLE_SNMP4J_LOG");
// 	}
// 
// }


import java.io.IOException;
import java.net.UnknownHostException;
import jnetman.session.SnmpPref;
import org.apache.log4j.Logger;
import org.snmp4j.CommandResponder;
import org.snmp4j.CommandResponderEvent;
import org.snmp4j.MessageDispatcherImpl;
import org.snmp4j.Snmp;
import org.snmp4j.mp.MPv1;
import org.snmp4j.mp.MPv2c;
import org.snmp4j.mp.MPv3;
import org.snmp4j.security.SecurityModels;
import org.snmp4j.security.SecurityProtocols;
import org.snmp4j.security.USM;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.UdpAddress;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import org.snmp4j.util.MultiThreadedMessageDispatcher;
import org.snmp4j.util.ThreadPool;
package jnetman.snmp;




public class SnmpTrapReceiver implements CommandResponder {

	// initialize Log4J logging
	static Logger logger = Logger.getLogger("snmp.snmpTrapReceiver");

	private MultiThreadedMessageDispatcher dispatcher;
	private Snmp snmp = null;
	private Address listenAddress;
	private ThreadPool threadPool;

	private int n = 0;
	private long start = -1;

	public SnmpTrapReceiver() {
		logger.debug("Created");
	}

	private void init() throws UnknownHostException, IOException {
		threadPool = ThreadPool.create("Trap", 4);
		dispatcher = new MultiThreadedMessageDispatcher(threadPool,
				new MessageDispatcherImpl());

		listenAddress = GenericAddress.parse("udp:0.0.0.0/"
// Path: src/jnetman/session/SnmpPref.java
// public class SnmpPref {
// 
// 	static private PropertiesParser prop = new PropertiesParser(
// 			Session.getSnmpPropertiesFile());
// 
// 	static public String getUser() {
// 		return prop.getString("V3_USER");
// 	}
// 
// 	static public String getPassword() {
// 		return prop.getString("V3_AUTHPRIV_PASSWORD");
// 	}
// 
// 	static public int getPort() {
// 		return prop.getInt("AGENT_PORT");
// 	}
// 
// 	static public int getTrapsPort() {
// 		return prop.getInt("TRAPS_PORT");
// 	}
// 
// 	static public int getTimeout() {
// 		return prop.getInt("TIMEOUT");
// 	}
// 
// 	static public int getMaxRetries() {
// 		return prop.getInt("MAX_RETRIES");
// 	}
// 
// 	static public boolean isSnmp4jLogEnabled() {
// 		return prop.getBoolean("ENABLE_SNMP4J_LOG");
// 	}
// 
// }


// Path: src/jnetman/snmp/SnmpTrapReceiver.java
import java.io.IOException;
import java.net.UnknownHostException;
import jnetman.session.SnmpPref;
import org.apache.log4j.Logger;
import org.snmp4j.CommandResponder;
import org.snmp4j.CommandResponderEvent;
import org.snmp4j.MessageDispatcherImpl;
import org.snmp4j.Snmp;
import org.snmp4j.mp.MPv1;
import org.snmp4j.mp.MPv2c;
import org.snmp4j.mp.MPv3;
import org.snmp4j.security.SecurityModels;
import org.snmp4j.security.SecurityProtocols;
import org.snmp4j.security.USM;
import org.snmp4j.smi.Address;
import org.snmp4j.smi.GenericAddress;
import org.snmp4j.smi.OctetString;
import org.snmp4j.smi.UdpAddress;
import org.snmp4j.transport.DefaultUdpTransportMapping;
import org.snmp4j.util.MultiThreadedMessageDispatcher;
import org.snmp4j.util.ThreadPool;

package jnetman.snmp;




public class SnmpTrapReceiver implements CommandResponder {

	// initialize Log4J logging
	static Logger logger = Logger.getLogger("snmp.snmpTrapReceiver");

	private MultiThreadedMessageDispatcher dispatcher;
	private Snmp snmp = null;
	private Address listenAddress;
	private ThreadPool threadPool;

	private int n = 0;
	private long start = -1;

	public SnmpTrapReceiver() {
		logger.debug("Created");
	}

	private void init() throws UnknownHostException, IOException {
		threadPool = ThreadPool.create("Trap", 4);
		dispatcher = new MultiThreadedMessageDispatcher(threadPool,
				new MessageDispatcherImpl());

		listenAddress = GenericAddress.parse("udp:0.0.0.0/"
				+ SnmpPref.getTrapsPort());