Class SNMPServerConnector

  • All Implemented Interfaces:
    ConnectorInterface, VersionInfoInterface

    public class SNMPServerConnector
    extends Connector
    The SNMP Server Connector is used by a monitoring console (an SNMP Manager). The SNMP Server Connector receives SNMP packets on a specified port, and returns appropriate SNMP response packets.
    • Constructor Detail

      • SNMPServerConnector

        public SNMPServerConnector()
        Default constructor.
    • Method Detail

      • getServerConnector

        public SNMPServerConnector getServerConnector()
        Returns the server Connector if this Connector is handling a client session.
        Returns:
        SNMPServerConnector The parent SNMPServerConnector
      • setCommunity

        public void setCommunity​(java.lang.String aCommunity)
        Sets community parameter
        Parameters:
        aCommunity - The community
      • setServerConnector

        public void setServerConnector​(SNMPServerConnector aServerConnector)
        Sets the server Connector for this Connector.
        Parameters:
        aServerConnector - The serverConnector.
      • isAccepting

        public boolean isAccepting()
        Checks if this Connector is currently waiting for a client connection.
        Returns:
        true if this Connector is currently waiting for a client connection.
      • isTerminating

        public boolean isTerminating()
        Checks if termination is requested.
        Returns:
        true if this Connector has the termination flag set.
      • initialize

        public void initialize​(java.lang.Object aObj)
                        throws java.lang.Exception
        Initialize the Connector. To initialize this Connector with a DatagramPacket object for the obj parameter. In all other cases, the Connector will initialize an SNMP server(Agent) session.
        Specified by:
        initialize in interface ConnectorInterface
        Overrides:
        initialize in class Connector
        Parameters:
        aObj - Null, DatagramPacket or ConnectorMode class
        Throws:
        java.lang.Exception - If invalid Connector parameter values are supplied.
      • getNextClient

        public ConnectorInterface getNextClient()
                                         throws java.lang.Exception
        Server mode - returns a new instance of the Connector for each client connection.
        Specified by:
        getNextClient in interface ConnectorInterface
        Overrides:
        getNextClient in class Connector
        Returns:
        ConnectorInterface child SNMPServerConnector object that process client request
        Throws:
        java.lang.Exception - if an error occurs.
      • replyEntry

        public void replyEntry​(Entry aEntry)
                        throws java.lang.Exception
        Send response to the SNMP client (Manager).
        Specified by:
        replyEntry in interface ConnectorInterface
        Overrides:
        replyEntry in class Connector
        Parameters:
        aEntry - The entry.
        Throws:
        java.lang.Exception - If sending response fails.
      • putEntry

        public void putEntry​(Entry aEntry)
                      throws java.lang.Exception
        Send response to the SNMP client (Manager).
        Specified by:
        putEntry in interface ConnectorInterface
        Overrides:
        putEntry in class Connector
        Parameters:
        aEntry - The entry.
        Throws:
        java.lang.Exception - If sending response fails.
      • terminateServer

        public void terminateServer()
                             throws java.lang.Exception
        This method tries to terminate the server by setting the termination flag for the Connector returned by getServerConnector and immediatly connecting to its port.
        Specified by:
        terminateServer in interface ConnectorInterface
        Overrides:
        terminateServer in class Connector
        Throws:
        java.lang.Exception - if an error occurs
      • terminate

        public void terminate()
                       throws java.lang.Exception
        Terminate the connector.
        Specified by:
        terminate in interface ConnectorInterface
        Overrides:
        terminate in class Connector
        Throws:
        java.lang.Exception - if an error occurs.
      • createBadValue

        public com.tivoli.snmp.data.BadValue createBadValue()
        Convenient methods to create SNMP object types.
        Returns:
        the BadValue instance.
      • createBoolean

        public com.tivoli.snmp.data.Boolean createBoolean​(boolean aValue)
        Creates boolean object.
        Parameters:
        aValue - The boolean value to set.
        Returns:
        the Boolean instance.
      • createCounter

        public com.tivoli.snmp.data.Counter createCounter​(long aValue)
        Creates Counter object.
        Parameters:
        aValue - The long value to set.
        Returns:
        the Counter instance.
      • createCounter64

        public com.tivoli.snmp.data.Counter64 createCounter64​(long aValue)
        Creates Counter64 object.
        Parameters:
        aValue - The long value to set.
        Returns:
        the Counter64 instance.
      • createFixedLengthOctetString

        public com.tivoli.snmp.data.FixedLengthOctetString createFixedLengthOctetString​(java.lang.String aValue)
        Creates FixedLengthOctetString object.
        Parameters:
        aValue - The String value to set.
        Returns:
        the FixedLengthOctetString instance.
      • createFullCounter64

        public com.tivoli.snmp.data.FullCounter64 createFullCounter64​(java.math.BigInteger aValue)
        Creates FullCounter64 object.
        Parameters:
        aValue - The java.math.BigInteger value to set.
        Returns:
        the FullCounter64 instance.
      • createGauge

        public com.tivoli.snmp.data.Gauge createGauge​(long aValue)
        Creates Gauge object.
        Parameters:
        aValue - The long value to set.
        Returns:
        the Gauge instance.
      • createIPAddress

        public com.tivoli.snmp.data.IPAddress createIPAddress​(java.lang.String aValue)
        Creates IPAddress object.
        Parameters:
        aValue - The String value to set.
        Returns:
        the IPAddress instance.
      • createNoChange

        public com.tivoli.snmp.data.NoChange createNoChange()
        Creates NoChange object.
        Returns:
        theNoChange instance.
      • createNoSuchInstance

        public com.tivoli.snmp.data.NoSuchInstance createNoSuchInstance()
        Creates NoSuchInstance object.
        Returns:
        the NoSuchInstance instance.
      • createNoSuchObject

        public com.tivoli.snmp.data.NoSuchObject createNoSuchObject()
        Creates NoSuchObject object.
        Returns:
        the NoSuchObject instance.
      • createNotSupported

        public com.tivoli.snmp.data.NotSupported createNotSupported()
        Creates NotSupported object.
        Returns:
        theNotSupported instance.
      • createNull

        public com.tivoli.snmp.data.Null createNull()
        Creates Null object.
        Returns:
        the Null instance.
      • createOctetString

        public com.tivoli.snmp.data.OctetString createOctetString​(java.lang.String aValue)
        Creates OctetString object.
        Parameters:
        aValue - The String value to set.
        Returns:
        the OctetString instance.
      • createOID

        public com.tivoli.snmp.data.OID createOID​(java.lang.String aValue)
        Creates OID object.
        Parameters:
        aValue - The String value to set.
        Returns:
        the OID instance.
      • createOpaque

        public com.tivoli.snmp.data.Opaque createOpaque​(byte[] aValue)
        Creates Opaque object.
        Parameters:
        aValue - The byte[] value to set.
        Returns:
        the Opaque instance.
      • createTimeTicks

        public com.tivoli.snmp.data.TimeTicks createTimeTicks​(long aValue)
        Creates TimeTicks object.
        Parameters:
        aValue - The long value to set.
        Returns:
        the TimeTicks instance.
      • getVersion

        public java.lang.String getVersion()
        Version information.
        Returns:
        version information