SNMP Stack 4_12

uk.co.westhawk.snmp.stack
Class AsnObject

java.lang.Object
  |
  +--uk.co.westhawk.snmp.stack.AsnObject
All Implemented Interfaces:
SnmpConstants
Direct Known Subclasses:
AsnInteger, AsnNull, AsnObjectId, AsnOctets, AsnPrimitive, AsnUnsInteger, AsnUnsInteger64

public abstract class AsnObject
extends java.lang.Object
implements SnmpConstants

This class represents the ASN.1 base class. SMIv1 RFC 1155. SMIv2 RFC 2578.

 <ASN Object> = <type> <length> <ASN Object>
 or
 <ASN Object> = <type> <length> <value>
 

Version:
$Revision: 3.24 $ $Date: 2002/10/10 15:13:57 $
Author:
Tim Panton

Field Summary
protected  int contentsLength
          The length of the actual contents.
static int debug
           
protected  int headerLength
          The length of the header.
protected  boolean isCorrect
          Flag to signal the object is of a correct type.
protected  int startPos
          The starting position of the AsnObject in the SNMP sequence.
protected  byte type
          The type of object.
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpConstants
ASN_APPLICATION, ASN_BIT_STR, ASN_BIT8, ASN_BOOLEAN, ASN_CONSTRUCTOR, ASN_CONTEXT, ASN_EXTENSION_ID, ASN_INTEGER, ASN_LONG_LEN, ASN_NULL, ASN_OBJECT_ID, ASN_OCTET_STR, ASN_PRIMITIVE, ASN_PRIVATE, ASN_SEQUENCE, ASN_SET, ASN_UNIVERSAL, CONS_SEQ, COUNTER, COUNTER64, GAUGE, GET_REQ_MSG, GET_RPRT_MSG, GET_RSP_MSG, GETBULK_REQ_MSG, GETNEXT_REQ_MSG, INFORM_REQ_MSG, INTEGER, IPADDRESS, NSAP_ADDRESS, NULLOBJ, OBJID, OPAQUE, SET_REQ_MSG, SNMP_ERR_AUTHORIZATIONERR, SNMP_ERR_BADVALUE, SNMP_ERR_COMMITFAILED, SNMP_ERR_DECODING_EXC, SNMP_ERR_DECODINGASN_EXC, SNMP_ERR_DECODINGPKTLNGTH_EXC, SNMP_ERR_GENERR, SNMP_ERR_INCONSISTENTNAME, SNMP_ERR_INCONSISTENTVALUE, SNMP_ERR_NOACCESS, SNMP_ERR_NOCREATION, SNMP_ERR_NOERROR, SNMP_ERR_NOSUCHNAME, SNMP_ERR_NOTWRITABLE, SNMP_ERR_READONLY, SNMP_ERR_RESOURCEUNAVAILABLE, SNMP_ERR_TOOBIG, SNMP_ERR_UNDOFAILED, SNMP_ERR_WRONGENCODING, SNMP_ERR_WRONGLENGTH, SNMP_ERR_WRONGTYPE, SNMP_ERR_WRONGVALUE, SNMP_TRAP_AUTHFAIL, SNMP_TRAP_COLDSTART, SNMP_TRAP_EGPNEIGHBORLOSS, SNMP_TRAP_ENTERPRISESPECIFIC, SNMP_TRAP_LINKDOWN, SNMP_TRAP_LINKUP, SNMP_TRAP_WARMSTART, SNMP_VAR_ENDOFMIBVIEW, SNMP_VAR_NOSUCHINSTANCE, SNMP_VAR_NOSUCHOBJECT, SNMP_VERSION_1, SNMP_VERSION_2c, SNMP_VERSION_3, STRING, TIMETICKS, TRP_REQ_MSG, TRPV2_REQ_MSG, UINTEGER32, version_id
 
Constructor Summary
AsnObject()
           
 
Method Summary
 byte getRespType()
          Returns the response type.
 java.lang.String getRespTypeString()
          Returns the response type as string.
static void setDebug(int newDebug)
          Sets the new, global level of debug information for the stack package.
abstract  java.lang.String toString()
          Returns a string representation of the object.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

debug

public static int debug

type

protected byte type
The type of object.

startPos

protected int startPos
The starting position of the AsnObject in the SNMP sequence. That is the position of the 'type' byte.

headerLength

protected int headerLength
The length of the header. That is the number of bytes of the 'type' and 'length' fields. Since there are multiple valid encodings for a given AsnObject, this length is not fixed!

contentsLength

protected int contentsLength
The length of the actual contents. That is the same as the value of the 'length' field.

isCorrect

protected boolean isCorrect
Flag to signal the object is of a correct type.
Constructor Detail

AsnObject

public AsnObject()
Method Detail

toString

public abstract java.lang.String toString()
Returns a string representation of the object.
Overrides:
toString in class java.lang.Object
Returns:
The string

setDebug

public static void setDebug(int newDebug)
Sets the new, global level of debug information for the stack package. The default value is zero, i.e. no debug info at all. All debug messages are printed to System.out.

The following messages will appear when debug is > (greater than)

Parameters:
newDebug - the new debug value

getRespType

public byte getRespType()
Returns the response type.
Returns:
The response type.
See Also:
getRespTypeString()

getRespTypeString

public java.lang.String getRespTypeString()
Returns the response type as string.
Returns:
The response type.
See Also:
getRespType()

SNMP Stack 4_12