com.sun.jmx.snmp.agent.SnmpMibAgent Java Examples
The following examples show how to use
com.sun.jmx.snmp.agent.SnmpMibAgent.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: SnmpSubRequestHandler.java From JDKSourceCode1.8 with MIT License | 6 votes |
/** * SNMP V1/V2 . To be called with updateRequest. */ protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpSubRequestHandler.class.getName(), "constructor", "creating instance for request " + String.valueOf(req.requestId)); } version= req.version; type= req.type; this.agent= agent; // We get a ref on the pdu in order to pass it to SnmpMibRequest. reqPdu = req; //Pre-allocate room for storing varbindlist and translation table. // int length= req.varBindList.length; translation= new int[length]; varBind= new NonSyncVector<SnmpVarBind>(length); }
Example #2
Source File: SnmpSubRequestHandler.java From jdk8u_jdk with GNU General Public License v2.0 | 6 votes |
/** * SNMP V1/V2 . To be called with updateRequest. */ protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpSubRequestHandler.class.getName(), "constructor", "creating instance for request " + String.valueOf(req.requestId)); } version= req.version; type= req.type; this.agent= agent; // We get a ref on the pdu in order to pass it to SnmpMibRequest. reqPdu = req; //Pre-allocate room for storing varbindlist and translation table. // int length= req.varBindList.length; translation= new int[length]; varBind= new NonSyncVector<SnmpVarBind>(length); }
Example #3
Source File: SnmpSubRequestHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * SNMP V1/V2 The constructor initialize the subrequest with the whole varbind list contained * in the original request. */ @SuppressWarnings("unchecked") // cast to NonSyncVector<SnmpVarBind> protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req, boolean nouse) { this(agent,req); // The translation table is easy in this case ... // int max= translation.length; SnmpVarBind[] list= req.varBindList; for(int i=0; i < max; i++) { translation[i]= i; ((NonSyncVector<SnmpVarBind>)varBind).addNonSyncElement(list[i]); } }
Example #4
Source File: SnmpMibTree.java From openjdk-8-source with GNU General Public License v2.0 | 6 votes |
private void removeAgentFully(SnmpMibAgent agent) { Vector<TreeNode> v = new Vector<>(); for(Enumeration<TreeNode> e= children.elements(); e.hasMoreElements(); ) { TreeNode node= e.nextElement(); node.removeAgentFully(agent); if(node.agents.isEmpty()) v.add(node); } for(Enumeration<TreeNode> e= v.elements(); e.hasMoreElements(); ) { children.removeElement(e.nextElement()); } removeAgent(agent); }
Example #5
Source File: SnmpSubRequestHandler.java From openjdk-jdk8u with GNU General Public License v2.0 | 6 votes |
/** * SNMP V1/V2 . To be called with updateRequest. */ protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpSubRequestHandler.class.getName(), "constructor", "creating instance for request " + String.valueOf(req.requestId)); } version= req.version; type= req.type; this.agent= agent; // We get a ref on the pdu in order to pass it to SnmpMibRequest. reqPdu = req; //Pre-allocate room for storing varbindlist and translation table. // int length= req.varBindList.length; translation= new int[length]; varBind= new NonSyncVector<SnmpVarBind>(length); }
Example #6
Source File: SnmpMibTree.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
private void removeAgentFully(SnmpMibAgent agent) { Vector<TreeNode> v = new Vector<>(); for(Enumeration<TreeNode> e= children.elements(); e.hasMoreElements(); ) { TreeNode node= e.nextElement(); node.removeAgentFully(agent); if(node.agents.isEmpty()) v.add(node); } for(Enumeration<TreeNode> e= v.elements(); e.hasMoreElements(); ) { children.removeElement(e.nextElement()); } removeAgent(agent); }
Example #7
Source File: SnmpSubRequestHandler.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 6 votes |
/** * SNMP V1/V2 . To be called with updateRequest. */ protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpSubRequestHandler.class.getName(), "constructor", "creating instance for request " + String.valueOf(req.requestId)); } version= req.version; type= req.type; this.agent= agent; // We get a ref on the pdu in order to pass it to SnmpMibRequest. reqPdu = req; //Pre-allocate room for storing varbindlist and translation table. // int length= req.varBindList.length; translation= new int[length]; varBind= new NonSyncVector<SnmpVarBind>(length); }
Example #8
Source File: SnmpSubRequestHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * SNMP V1/V2 . To be called with updateRequest. */ protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpSubRequestHandler.class.getName(), "constructor", "creating instance for request " + String.valueOf(req.requestId)); } version= req.version; type= req.type; this.agent= agent; // We get a ref on the pdu in order to pass it to SnmpMibRequest. reqPdu = req; //Pre-allocate room for storing varbindlist and translation table. // int length= req.varBindList.length; translation= new int[length]; varBind= new NonSyncVector<SnmpVarBind>(length); }
Example #9
Source File: SnmpRequestHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * The method takes the incoming get bulk requests and split it into * subrequests. */ private void splitBulkRequest(SnmpPduBulk req, int nonRepeaters, int maxRepetitions, int R) { // Send the getBulk to all agents // for(Enumeration<SnmpMibAgent> e= mibs.elements(); e.hasMoreElements(); ) { final SnmpMibAgent agent = e.nextElement(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "splitBulkRequest", "Create a sub with : " + agent + " " + nonRepeaters + " " + maxRepetitions + " " + R); } subs.put(agent, new SnmpSubBulkRequestHandler(adaptor, agent, req, nonRepeaters, maxRepetitions, R)); } }
Example #10
Source File: SnmpMibTree.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
private void removeAgentFully(SnmpMibAgent agent) { Vector<TreeNode> v = new Vector<>(); for(Enumeration<TreeNode> e= children.elements(); e.hasMoreElements(); ) { TreeNode node= e.nextElement(); node.removeAgentFully(agent); if(node.agents.isEmpty()) v.add(node); } for(Enumeration<TreeNode> e= v.elements(); e.hasMoreElements(); ) { children.removeElement(e.nextElement()); } removeAgent(agent); }
Example #11
Source File: SnmpRequestHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
/** * 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(); }
Example #12
Source File: SnmpAdaptorServer.java From jdk8u60 with GNU General Public License v2.0 | 6 votes |
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); }
Example #13
Source File: SnmpAdaptorServer.java From jdk1.8-source-analysis with Apache License 2.0 | 6 votes |
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); }
Example #14
Source File: SnmpRequestHandler.java From hottub with GNU General Public License v2.0 | 6 votes |
/** * 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(); }
Example #15
Source File: SnmpAdaptorServer.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * Adds a new MIB in the SNMP MIB handler. * This method is to be called to set a specific agent to a specific OID. * This can be useful when dealing with MIB overlapping. * Some OID can be implemented in more than one MIB. In this case, * the OID nearer agent will be used on SNMP operations. * * @param mib The MIB to add. * @param oids The set of OIDs this agent implements. * * @return A reference to the SNMP MIB handler. * * @exception IllegalArgumentException If the parameter is null. * * @since 1.5 */ @Override public SnmpMibHandler addMib(SnmpMibAgent mib, SnmpOid[] oids) throws IllegalArgumentException { if (mib == null) { throw new IllegalArgumentException() ; } //If null oid array, just add it to the mib. if(oids == null) return addMib(mib); if(!mibs.contains(mib)) mibs.addElement(mib); for (int i = 0; i < oids.length; i++) { root.register(mib, oids[i].longValue()); } return this; }
Example #16
Source File: SnmpRequestHandler.java From jdk8u-dev-jdk with GNU General Public License v2.0 | 6 votes |
/** * The method takes the incoming get bulk requests and split it into * subrequests. */ private void splitBulkRequest(SnmpPduBulk req, int nonRepeaters, int maxRepetitions, int R) { // Send the getBulk to all agents // for(Enumeration<SnmpMibAgent> e= mibs.elements(); e.hasMoreElements(); ) { final SnmpMibAgent agent = e.nextElement(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "splitBulkRequest", "Create a sub with : " + agent + " " + nonRepeaters + " " + maxRepetitions + " " + R); } subs.put(agent, new SnmpSubBulkRequestHandler(adaptor, agent, req, nonRepeaters, maxRepetitions, R)); } }
Example #17
Source File: SnmpAdaptorServer.java From hottub with GNU General Public License v2.0 | 6 votes |
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); }
Example #18
Source File: SnmpRequestHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 6 votes |
/** * The method takes the incoming get bulk requests and split it into * subrequests. */ private void splitBulkRequest(SnmpPduBulk req, int nonRepeaters, int maxRepetitions, int R) { // Send the getBulk to all agents // for(Enumeration<SnmpMibAgent> e= mibs.elements(); e.hasMoreElements(); ) { final SnmpMibAgent agent = e.nextElement(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, dbgTag, "splitBulkRequest", "Create a sub with : " + agent + " " + nonRepeaters + " " + maxRepetitions + " " + R); } subs.put(agent, new SnmpSubBulkRequestHandler(adaptor, agent, req, nonRepeaters, maxRepetitions, R)); } }
Example #19
Source File: SnmpSubRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 6 votes |
/** * SNMP V1/V2 . To be called with updateRequest. */ protected SnmpSubRequestHandler(SnmpMibAgent agent, SnmpPdu req) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpSubRequestHandler.class.getName(), "constructor", "creating instance for request " + String.valueOf(req.requestId)); } version= req.version; type= req.type; this.agent= agent; // We get a ref on the pdu in order to pass it to SnmpMibRequest. reqPdu = req; //Pre-allocate room for storing varbindlist and translation table. // int length= req.varBindList.length; translation= new int[length]; varBind= new NonSyncVector<SnmpVarBind>(length); }
Example #20
Source File: SnmpRequestHandler.java From openjdk-8 with GNU General Public License v2.0 | 6 votes |
/** * 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(); }
Example #21
Source File: SnmpSubRequestHandler.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * V3 enabled Adaptor. Each Oid is added using updateRequest method. */ protected SnmpSubRequestHandler(SnmpEngine engine, SnmpIncomingRequest incRequest, SnmpMibAgent agent, SnmpPdu req) { this(agent, req); init(engine, incRequest); }
Example #22
Source File: SnmpMibTree.java From openjdk-8-source with GNU General Public License v2.0 | 5 votes |
private void removeAgent(SnmpMibAgent mib) { if (!agents.contains(mib)) return; agents.removeElement(mib); if (!agents.isEmpty()) agent= agents.firstElement(); }
Example #23
Source File: SnmpAdaptorServer.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * Adds a new MIB in the SNMP MIB handler. * * @param mib The MIB to add. * * @return A reference to the SNMP MIB handler. * * @exception IllegalArgumentException If the parameter is null. */ @Override public SnmpMibHandler addMib(SnmpMibAgent mib) throws IllegalArgumentException { if (mib == null) { throw new IllegalArgumentException() ; } if(!mibs.contains(mib)) mibs.addElement(mib); root.register(mib); return this; }
Example #24
Source File: SnmpMibTree.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
public void unregister(SnmpMibAgent agent, SnmpOid[] oids) { for(int i = 0; i < oids.length; i++) { long[] oid = oids[i].longValue(); TreeNode node = root.retrieveMatchingBranch(oid, 0); if (node == null) continue; node.removeAgent(agent); } }
Example #25
Source File: SnmpAdaptorServer.java From openjdk-8 with GNU General Public License v2.0 | 5 votes |
/** * Returns the names of the MIBs available in this SNMP protocol adaptor. * * @return An array of MIB names. */ @Override public String[] getMibs() { String[] result = new String[mibs.size()] ; int i = 0 ; for (Enumeration<SnmpMibAgent> e = mibs.elements() ; e.hasMoreElements() ;) { SnmpMibAgent mib = e.nextElement() ; result[i++] = mib.getMibName(); } return result ; }
Example #26
Source File: SnmpMibTree.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
public SnmpMibAgent getAgentMib(SnmpOid oid) { TreeNode node= root.retrieveMatchingBranch(oid.longValue(), 0); if (node == null) return defaultAgent; else if(node.getAgentMib() == null) return defaultAgent; else return node.getAgentMib(); }
Example #27
Source File: SnmpSubRequestHandler.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * V3 enabled Adaptor. Each Oid is added using updateRequest method. */ protected SnmpSubRequestHandler(SnmpEngine engine, SnmpIncomingRequest incRequest, SnmpMibAgent agent, SnmpPdu req) { this(agent, req); init(engine, incRequest); }
Example #28
Source File: SnmpMibTree.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
private void removeAgent(SnmpMibAgent mib) { if (!agents.contains(mib)) return; agents.removeElement(mib); if (!agents.isEmpty()) agent= agents.firstElement(); }
Example #29
Source File: SnmpSubRequestHandler.java From hottub with GNU General Public License v2.0 | 5 votes |
/** * V3 enabled Adaptor. Each Oid is added using updateRequest method. */ protected SnmpSubRequestHandler(SnmpEngine engine, SnmpIncomingRequest incRequest, SnmpMibAgent agent, SnmpPdu req) { this(agent, req); init(engine, incRequest); }
Example #30
Source File: SnmpSubRequestHandler.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
SnmpMibRequest createMibRequest(Vector<SnmpVarBind> vblist, int protocolVersion, Object userData) { // This is an optimization: // The SnmpMibRequest created in the check() phase is // reused in the set() phase. // if (type == pduSetRequestPdu && mibRequest != null) return mibRequest; //This is a request comming from an SnmpV3AdaptorServer. //Full power. SnmpMibRequest result = null; if(incRequest != null) { result = SnmpMibAgent.newMibRequest(engine, reqPdu, vblist, protocolVersion, userData, incRequest.getPrincipal(), incRequest.getSecurityLevel(), incRequest.getSecurityModel(), incRequest.getContextName(), incRequest.getAccessContext()); } else { result = SnmpMibAgent.newMibRequest(reqPdu, vblist, protocolVersion, userData); } // If we're doing the check() phase, we store the SnmpMibRequest // so that we can reuse it in the set() phase. // if (type == pduWalkRequest) mibRequest = result; return result; }