SNMP Stack 4_12

uk.co.westhawk.snmp.pdu
Class InterfacePdu

java.lang.Object
  |
  +--java.util.Observable
        |
        +--uk.co.westhawk.snmp.stack.Pdu
              |
              +--uk.co.westhawk.snmp.pdu.InterfacePdu
Direct Known Subclasses:
InterfacesPdu

public class InterfacePdu
extends Pdu

The InterfacePdu class asks one interface for information, useful for admin purposes. See RFC 2863.

Version:
$Revision: 3.14 $ $Date: 2002/10/29 14:44:40 $
Author:
Tim Panton
See Also:
InterfacesPdu

Field Summary
static java.lang.String DOWN
          The current operational state is down
static java.lang.String TESTING
          The current operational state is testing
static java.lang.String UNKNOWN
          The current operational state is unknown
static java.lang.String UP
          The current operational state is up
 
Fields inherited from class uk.co.westhawk.snmp.stack.Pdu
added, answered, context, encodedPacket, errind, errstat, msg_type, reqVarbinds, respVarbinds
 
Constructor Summary
InterfacePdu(SnmpContextBasisFace con, java.util.Observer o, int interf)
          Constructor that will send the request immediately.
 
Method Summary
 java.lang.String getDescription()
          Returns the description of the interface.
 int getIndex()
          Returns the index of the interface.
 long getInOctet()
          Returns the total number of octets received on the interface, including framing characters.
static int getNumIfs(SnmpContextBasisFace con)
          Returns how many interfaces are present.
 int getOperStatus()
          Returns the operational state of the interface.
 java.lang.String getOperStatusString()
          Returns the string representation of the operational state of the interface.
 java.lang.String getOperStatusString(int status)
          Returns the string representation of a operational state.
 long getOutOctet()
          Returns the total number of octets transmitted outOctets of the interface, including framing characters.
 long getSpeed(InterfacePdu old)
          Calculates the speed of the interface.
 long getSysUpTime()
          Returns the time (in hundredths of a second) since the network management portion of the system was last re-initialized.
protected  void new_value(int n, varbind res)
          The value of the request is set.
protected  void tell_them()
          The methods notifies all observers.
 
Methods inherited from class uk.co.westhawk.snmp.stack.Pdu
addOid, addOid, addOid, addOid, addOid, addToTrans, getContext, getErrorIndex, getErrorStatus, getErrorStatusString, getMsgType, getReqId, getRequestVarbinds, getResponseVarbinds, isTimedOut, notifyObservers, send, send, send, sendme, setErrorIndex, setErrorStatus, setErrorStatus, setMsgType, setRetryIntervals, toString, toString, waitForSelf
 
Methods inherited from class java.util.Observable
addObserver, clearChanged, countObservers, deleteObserver, deleteObservers, hasChanged, notifyObservers, setChanged
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UP

public static final java.lang.String UP
The current operational state is up

DOWN

public static final java.lang.String DOWN
The current operational state is down

TESTING

public static final java.lang.String TESTING
The current operational state is testing

UNKNOWN

public static final java.lang.String UNKNOWN
The current operational state is unknown
Constructor Detail

InterfacePdu

public InterfacePdu(SnmpContextBasisFace con,
                    java.util.Observer o,
                    int interf)
             throws PduException,
                    java.io.IOException
Constructor that will send the request immediately.
Parameters:
con - the SnmpContextBasisFace
o - the Observer that will be notified when the answer is received
interf - the index of the requested interface
Method Detail

getIndex

public int getIndex()
Returns the index of the interface.
Returns:
the index

getSysUpTime

public long getSysUpTime()
Returns the time (in hundredths of a second) since the network management portion of the system was last re-initialized.

getDescription

public java.lang.String getDescription()
Returns the description of the interface.
Returns:
the description

getOperStatus

public int getOperStatus()
Returns the operational state of the interface.
Returns:
the operational state

getOperStatusString

public java.lang.String getOperStatusString()
Returns the string representation of the operational state of the interface.
Returns:
the operational state as string
See Also:
getOperStatus(), getOperStatusString(int)

getOperStatusString

public java.lang.String getOperStatusString(int status)
Returns the string representation of a operational state.
See Also:
getOperStatusString()

getInOctet

public long getInOctet()
Returns the total number of octets received on the interface, including framing characters.

getOutOctet

public long getOutOctet()
Returns the total number of octets transmitted outOctets of the interface, including framing characters.

getSpeed

public long getSpeed(InterfacePdu old)
Calculates the speed of the interface. This is done by providing the method with the previous value of this interface. An interface is marked by its index.
Parameters:
old - The previous value of this interface

new_value

protected void new_value(int n,
                         varbind res)
The value of the request is set. This will be called by Pdu.fillin().
Overrides:
new_value in class Pdu
Parameters:
n - the index of the value
a_var - the value
See Also:
Pdu.new_value(int, uk.co.westhawk.snmp.stack.varbind)

tell_them

protected void tell_them()
The methods notifies all observers. This will be called by Pdu.fillin().

Unless an exception occurred the Object to the update() method of the Observer will be a varbind, so any AsnObject type can be returned. In the case of an exception, that exception will be passed.

Overrides:
tell_them in class Pdu

getNumIfs

public static int getNumIfs(SnmpContextBasisFace con)
                     throws PduException,
                            java.io.IOException
Returns how many interfaces are present.
Returns:
the number of interfaces

SNMP Stack 4_12