com.sun.jmx.snmp.SnmpPduFactory Java Examples
The following examples show how to use
com.sun.jmx.snmp.SnmpPduFactory.
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: SnmpRequestHandler.java From openjdk-jdk8u-backup 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 #2
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 #3
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 #4
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 #5
Source File: SnmpRequestHandler.java From jdk8u-jdk 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 #6
Source File: SnmpAdaptorServer.java From dragonwell8_jdk 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 #7
Source File: SnmpRequestHandler.java From jdk8u60 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 #8
Source File: SnmpAdaptorServer.java From JDKSourceCode1.8 with MIT License | 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 #9
Source File: SnmpRequestHandler.java From JDKSourceCode1.8 with MIT License | 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 #10
Source File: SnmpAdaptorServer.java From openjdk-jdk8u 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 #11
Source File: SnmpRequestHandler.java From openjdk-jdk8u 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 #12
Source File: SnmpAdaptorServer.java From openjdk-jdk8u-backup 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 openjdk-jdk8u with GNU General Public License v2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #14
Source File: SnmpAdaptorServer.java From TencentKona-8 with GNU General Public License v2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #15
Source File: SnmpAdaptorServer.java From jdk8u-jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #16
Source File: SnmpAdaptorServer.java From dragonwell8_jdk with GNU General Public License v2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #17
Source File: SnmpAdaptorServer.java From jdk8u60 with GNU General Public License v2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #18
Source File: SnmpAdaptorServer.java From JDKSourceCode1.8 with MIT License | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #19
Source File: SnmpAdaptorServer.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #20
Source File: SnmpAdaptorServer.java From jdk1.8-source-analysis with Apache License 2.0 | 5 votes |
/** * Sets the message factory of this SNMP protocol adaptor. * * @param factory The factory object (null means the default factory). */ @Override public void setPduFactory(SnmpPduFactory factory) { if (factory == null) pduFactory = new SnmpPduFactoryBER() ; else pduFactory = factory ; }
Example #21
Source File: SnmpResponseHandler.java From JDKSourceCode1.8 with MIT License | 4 votes |
public synchronized void processDatagram(DatagramPacket dgrm) { byte []data = dgrm.getData(); int datalen = dgrm.getLength(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpResponseHandler.class.getName(), "action", "processDatagram", "Received from " + dgrm.getAddress().toString() + " Length = " + datalen + "\nDump : \n" + SnmpMessage.dumpHexBuffer(data, 0, datalen)); } try { SnmpMessage msg = new SnmpMessage(); msg.decodeMessage(data, datalen); msg.address = dgrm.getAddress(); msg.port = dgrm.getPort(); // Retreive the PDU factory of the SNMP adaptor to decode the received inform response. // SnmpPduFactory pduFactory = adaptor.getPduFactory(); if (pduFactory == null) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. Unable to find the pdu factory of the SNMP adaptor server"); } } else { SnmpPduPacket snmpProt = (SnmpPduPacket)pduFactory.decodeSnmpPdu(msg); if (snmpProt == null) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. Pdu factory returned a null value"); } } else if (snmpProt instanceof SnmpPduRequest) { SnmpPduRequest pduReq = (SnmpPduRequest)snmpProt; SnmpInformRequest req = snmpq.removeRequest(pduReq.requestId) ; if (req != null) { req.invokeOnResponse(pduReq); } else { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. Unable to find corresponding for InformRequestId = " + pduReq.requestId); } } } else { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. The packet does not contain an inform response"); } } snmpProt = null ; } } catch (Exception e) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Exception while processsing", e); } } }
Example #22
Source File: SnmpInformRequest.java From JDKSourceCode1.8 with MIT License | 4 votes |
boolean sendPdu() { try { responsePdu = null; SnmpPduFactory pduFactory = adaptor.getPduFactory(); SnmpMessage msg = (SnmpMessage)pduFactory.encodeSnmpPdu((SnmpPduPacket)requestPdu, adaptor.getBufferSize().intValue()); if (msg == null) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpInformRequest.class.getName(), "sendPdu", "pdu factory returned a null value"); } throw new SnmpStatusException(snmpReqUnknownError); // This exception will caught hereafter and reported as an snmpReqUnknownError // FIXME: may be it's not the best behaviour ? } int maxPktSize = adaptor.getBufferSize().intValue(); byte[] encoding = new byte[maxPktSize]; int encodingLength = msg.encodeMessage(encoding); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpInformRequest.class.getName(), "sendPdu", "Dump : \n" + msg.printMessage()); } sendPduPacket(encoding, encodingLength); return true; } catch (SnmpTooBigException ar) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpInformRequest.class.getName(), "sendPdu", "Got unexpected exception", ar); } setErrorStatusAndIndex(snmpReqPacketOverflow, ar.getVarBindCount()); requestPdu = null; reason = ar.getMessage(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpInformRequest.class.getName(), "sendPdu", "Packet Overflow while building inform request"); } } catch (java.io.IOException ioe) { setErrorStatusAndIndex(snmpReqSocketIOError, 0); reason = ioe.getMessage(); } catch (Exception e) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpInformRequest.class.getName(), "sendPdu", "Got unexpected exception", e); } setErrorStatusAndIndex(snmpReqUnknownError, 0); reason = e.getMessage(); } return false; }
Example #23
Source File: SnmpResponseHandler.java From jdk1.8-source-analysis with Apache License 2.0 | 4 votes |
public synchronized void processDatagram(DatagramPacket dgrm) { byte []data = dgrm.getData(); int datalen = dgrm.getLength(); if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINER)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINER, SnmpResponseHandler.class.getName(), "action", "processDatagram", "Received from " + dgrm.getAddress().toString() + " Length = " + datalen + "\nDump : \n" + SnmpMessage.dumpHexBuffer(data, 0, datalen)); } try { SnmpMessage msg = new SnmpMessage(); msg.decodeMessage(data, datalen); msg.address = dgrm.getAddress(); msg.port = dgrm.getPort(); // Retreive the PDU factory of the SNMP adaptor to decode the received inform response. // SnmpPduFactory pduFactory = adaptor.getPduFactory(); if (pduFactory == null) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. Unable to find the pdu factory of the SNMP adaptor server"); } } else { SnmpPduPacket snmpProt = (SnmpPduPacket)pduFactory.decodeSnmpPdu(msg); if (snmpProt == null) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. Pdu factory returned a null value"); } } else if (snmpProt instanceof SnmpPduRequest) { SnmpPduRequest pduReq = (SnmpPduRequest)snmpProt; SnmpInformRequest req = snmpq.removeRequest(pduReq.requestId) ; if (req != null) { req.invokeOnResponse(pduReq); } else { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. Unable to find corresponding for InformRequestId = " + pduReq.requestId); } } } else { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Dropping packet. The packet does not contain an inform response"); } } snmpProt = null ; } } catch (Exception e) { if (SNMP_ADAPTOR_LOGGER.isLoggable(Level.FINEST)) { SNMP_ADAPTOR_LOGGER.logp(Level.FINEST, SnmpResponseHandler.class.getName(), "processDatagram", "Exception while processsing", e); } } }
Example #24
Source File: SnmpMsgProcessingSubSystem.java From openjdk-jdk8u-backup with GNU General Public License v2.0 | 2 votes |
/** * This method is called when a call is to be sent to the network. The sub system routes the call to the dedicated model according to the model ID. * @param model The model ID. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the sending (mainly marshalling and security). */ public SnmpOutgoingRequest getOutgoingRequest(int model, SnmpPduFactory factory) throws SnmpUnknownMsgProcModelException ;
Example #25
Source File: SnmpMsgProcessingSubSystem.java From JDKSourceCode1.8 with MIT License | 2 votes |
/** * This method is called when a call is received from the network. * @param model The model ID. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). */ public SnmpIncomingRequest getIncomingRequest(int model, SnmpPduFactory factory) throws SnmpUnknownMsgProcModelException;
Example #26
Source File: SnmpMsgProcessingModel.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * This method is called when a call is received from the network. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). */ public SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory);
Example #27
Source File: SnmpMsgProcessingSubSystem.java From JDKSourceCode1.8 with MIT License | 2 votes |
/** * This method is called when a call is to be sent to the network. The sub system routes the call to the dedicated model according to the model ID. * @param model The model ID. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the sending (mainly marshalling and security). */ public SnmpOutgoingRequest getOutgoingRequest(int model, SnmpPduFactory factory) throws SnmpUnknownMsgProcModelException ;
Example #28
Source File: SnmpAdaptorServerMBean.java From jdk8u-jdk with GNU General Public License v2.0 | 2 votes |
/** * Returns the message factory of this SNMP protocol adaptor. * * @return The factory object. */ public SnmpPduFactory getPduFactory();
Example #29
Source File: SnmpMsgProcessingSubSystem.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * This method is called when a call is to be sent to the network. The sub system routes the call to the dedicated model according to the model ID. * @param model The model ID. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the sending (mainly marshalling and security). */ public SnmpOutgoingRequest getOutgoingRequest(int model, SnmpPduFactory factory) throws SnmpUnknownMsgProcModelException ;
Example #30
Source File: SnmpMsgProcessingModel.java From jdk8u60 with GNU General Public License v2.0 | 2 votes |
/** * This method is called when a response is received from the network. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). */ public SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory);