private void createSnmpRequestHandler(SnmpAdaptorServer server, int id, DatagramSocket s, DatagramPacket p, SnmpMibTree tree, Vector<SnmpMibAgent> m, InetAddressAcl a, SnmpPduFactory factory, SnmpUserDataFactory dataFactory, MBeanServer f, ObjectName n) { final SnmpRequestHandler handler = new SnmpRequestHandler(this, id, s, p, tree, m, a, factory, dataFactory, f, n); threadService.submitTask(handler); }
/** * Common initializations. */ private void init(InetAddressAcl acl, int p, InetAddress a) { root= new SnmpMibTree(); // The default Agent is initialized with a SnmpErrorHandlerAgent agent. root.setDefaultAgent(new SnmpErrorHandlerAgent()); // For the trap time, use the time the agent started ... // startUpTime= java.lang.System.currentTimeMillis(); maxActiveClientCount = 10; // Create the default message factory pduFactory = new SnmpPduFactoryBER() ; port = p ; ipacl = acl ; address = a ; if ((ipacl == null) && (useAcl == true)) throw new IllegalArgumentException("ACL object cannot be null") ; threadService = new ThreadService(threadNumber); }
/** * Full constructor */ public SnmpRequestHandler(SnmpAdaptorServer server, int id, DatagramSocket s, DatagramPacket p, SnmpMibTree tree, Vector<SnmpMibAgent> m, InetAddressAcl a, SnmpPduFactory factory, SnmpUserDataFactory dataFactory, MBeanServer f, ObjectName n) { super(server, id, f, n); // Need a reference on SnmpAdaptorServer for getNext & getBulk, // in case of oid equality (mib overlapping). // adaptor = server; socket = s; packet = p; root= tree; mibs = new Vector<>(m); subs= new Hashtable<>(mibs.size()); ipacl = a; pduFactory = factory ; userDataFactory = dataFactory ; //thread.start(); }
/** * Retrieve the Trap Target List from the ACL file. **/ @SuppressWarnings("unchecked") private static List<NotificationTarget> getTargetList(InetAddressAcl acl, int defaultTrapPort) { final ArrayList<NotificationTarget> result = new ArrayList<>(); if (acl != null) { if (log.isDebugOn()) log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing")); final Enumeration<InetAddress> td = acl.getTrapDestinations(); for (; td.hasMoreElements() ;) { final InetAddress targetAddr = td.nextElement(); final Enumeration<String> tc = acl.getTrapCommunities(targetAddr); for (;tc.hasMoreElements() ;) { final String community = tc.nextElement(); final NotificationTarget target = new NotificationTargetImpl(targetAddr, defaultTrapPort, community); if (log.isDebugOn()) log.debug("getTargetList", Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.adding", target.toString())); result.add(target); } } } return result; }
/** * Retrieve the Trap Target List from the ACL file. **/ private static List<NotificationTarget> getTargetList(InetAddressAcl acl, int defaultTrapPort) { final ArrayList<NotificationTarget> result = new ArrayList<NotificationTarget>(); if (acl != null) { if (log.isDebugOn()) log.debug("getTargetList",Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.processing")); final Enumeration td=acl.getTrapDestinations(); for (; td.hasMoreElements() ;) { final InetAddress targetAddr = (InetAddress)td.nextElement(); final Enumeration tc = acl.getTrapCommunities(targetAddr); for (;tc.hasMoreElements() ;) { final String community = (String) tc.nextElement(); final NotificationTarget target = new NotificationTargetImpl(targetAddr, defaultTrapPort, community); if (log.isDebugOn()) log.debug("getTargetList", Agent.getText("jmxremote.AdaptorBootstrap.getTargetList.adding", target.toString())); result.add(target); } } } return result; }
/** * Initializes this SNMP protocol adaptor using the default port (161) * and the specified IP address based ACL implementation. * * @param acl The <CODE>InetAddressAcl</CODE> implementation. * <code>null</code> means no ACL - everybody is authorized. * * @since 1.5 */ public SnmpAdaptorServer(InetAddressAcl acl) { this(false, acl, com.sun.jmx.snmp.ServiceName.SNMP_ADAPTOR_PORT, null) ; }
/** * Initializes this SNMP protocol adaptor using the specified port and the * specified IP address based ACL implementation. * * @param acl The <CODE>InetAddressAcl</CODE> implementation. * <code>null</code> means no ACL - everybody is authorized. * @param port The port number for sending SNMP responses. * * @since 1.5 */ public SnmpAdaptorServer(InetAddressAcl acl, int port) { this(false, acl, port, null) ; }
/** * Initializes this SNMP protocol adaptor using the specified IP * address based ACL implementation and the specified * <CODE>InetAddress</CODE>. * * @param acl The <CODE>InetAddressAcl</CODE> implementation. * @param addr The IP address to bind. * * @since 1.5 */ public SnmpAdaptorServer(InetAddressAcl acl, InetAddress addr) { this(false, acl, com.sun.jmx.snmp.ServiceName.SNMP_ADAPTOR_PORT, addr) ; }
/** * Initializes this SNMP protocol adaptor using the specified port, the * specified address based ACL implementation and the specified * <CODE>InetAddress</CODE>. * * @param acl The <CODE>InetAddressAcl</CODE> implementation. * @param port The port number for sending SNMP responses. * @param addr The IP address to bind. * * @since 1.5 */ public SnmpAdaptorServer(InetAddressAcl acl, int port, InetAddress addr) { this(false, acl, port, addr); }
/** * Returns the Ip address based ACL used by this SNMP protocol adaptor. * @return The <CODE>InetAddressAcl</CODE> implementation. * * @since 1.5 */ @Override public InetAddressAcl getInetAddressAcl() { return ipacl; }
/** * Returns the Ip address based ACL used by this SNMP protocol adaptor. * @return The <CODE>InetAddressAcl</CODE> implementation. * * @since 1.5 */ public InetAddressAcl getInetAddressAcl();