net.percederberg.mibble
Class MibTypeTag

java.lang.Object
  extended bynet.percederberg.mibble.MibTypeTag

public class MibTypeTag
extends java.lang.Object

A MIB type tag. The type tag consists of a category and value. Together these two numbers normally identifies a type uniquely, as all primitive and most (if not all) SNMP types (such as IpAddress and similar) have type tags assigned to them. Type tags may also be chained together in a list, in order to not loose information. Whether to replace or to chain a type tag is determined by the EXPLICIT or IMPLICIT keywords in the MIB file.

Since:
2.2

Field Summary
static int APPLICATION_CATEGORY
          The application type tag category.
static MibTypeTag BIT_STRING
          The universal bit string type tag.
static MibTypeTag BOOLEAN
          The universal boolean type tag.
static int CONTEXT_SPECIFIC_CATEGORY
          The context specific type tag category.
static MibTypeTag INTEGER
          The universal integer type tag.
static MibTypeTag NULL
          The universal null type tag.
static MibTypeTag OBJECT_IDENTIFIER
          The universal object identifier type tag.
static MibTypeTag OCTET_STRING
          The universal octet string type tag.
static int PRIVATE_CATEGORY
          The private type tag category.
static MibTypeTag REAL
          The universal real type tag.
static MibTypeTag SEQUENCE
          The universal sequence and sequence of type tag.
static MibTypeTag SET
          The universal sequence and sequence of type tag.
static int UNIVERSAL_CATEGORY
          The universal type tag category.
 
Constructor Summary
MibTypeTag(int category, int value)
          Creates a new MIB type tag.
 
Method Summary
 boolean equals(int category, int value)
          Checks if this type tag has the specified category and value numbers.
 boolean equals(java.lang.Object obj)
          Checks if this type tag equals another object.
 int getCategory()
          Returns the type tag category.
 MibTypeTag getNext()
          Returns the next type tag in the tag chain.
 int getValue()
          Returns the type tag value.
 void setNext(MibTypeTag next)
          Sets the next type tag in the tag chain.
 java.lang.String toString()
          Returns a string representation of this object.
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

UNIVERSAL_CATEGORY

public static final int UNIVERSAL_CATEGORY
The universal type tag category. This is the type tag category used for the ASN.1 primitive types.

See Also:
Constant Field Values

APPLICATION_CATEGORY

public static final int APPLICATION_CATEGORY
The application type tag category.

See Also:
Constant Field Values

CONTEXT_SPECIFIC_CATEGORY

public static final int CONTEXT_SPECIFIC_CATEGORY
The context specific type tag category. This is the default type tag category if no other category was specified.

See Also:
Constant Field Values

PRIVATE_CATEGORY

public static final int PRIVATE_CATEGORY
The private type tag category.

See Also:
Constant Field Values

BOOLEAN

public static final MibTypeTag BOOLEAN
The universal boolean type tag.


INTEGER

public static final MibTypeTag INTEGER
The universal integer type tag.


BIT_STRING

public static final MibTypeTag BIT_STRING
The universal bit string type tag.


OCTET_STRING

public static final MibTypeTag OCTET_STRING
The universal octet string type tag.


NULL

public static final MibTypeTag NULL
The universal null type tag.


OBJECT_IDENTIFIER

public static final MibTypeTag OBJECT_IDENTIFIER
The universal object identifier type tag.


REAL

public static final MibTypeTag REAL
The universal real type tag.


SEQUENCE

public static final MibTypeTag SEQUENCE
The universal sequence and sequence of type tag.


SET

public static final MibTypeTag SET
The universal sequence and sequence of type tag.

Constructor Detail

MibTypeTag

public MibTypeTag(int category,
                  int value)
Creates a new MIB type tag.

Parameters:
category - the type tag category
value - the type tag value
Method Detail

equals

public boolean equals(java.lang.Object obj)
Checks if this type tag equals another object. This method will only return true if the other object is a type tag with the same category and value numbers.

Parameters:
obj - the object to compare to
Returns:
true if the objects are equal, or false otherwise

equals

public boolean equals(int category,
                      int value)
Checks if this type tag has the specified category and value numbers.

Parameters:
category - the category number
value - the value number
Returns:
true if the category and value numbers match, or false otherwise

getCategory

public int getCategory()
Returns the type tag category. The category value corresponds to one of the defined category constants.

Returns:
the type tag category
See Also:
UNIVERSAL_CATEGORY, APPLICATION_CATEGORY, CONTEXT_SPECIFIC_CATEGORY, PRIVATE_CATEGORY

getValue

public int getValue()
Returns the type tag value. The tag category and value normally identifies a type uniquely.

Returns:
the type tag value

getNext

public MibTypeTag getNext()
Returns the next type tag in the tag chain.

Returns:
the next type tag in the tag chain, or null if there is no next tag

setNext

public void setNext(MibTypeTag next)
Sets the next type tag in the tag chain.

NOTE: This is an internal method that should only be called by the MIB loader.

Parameters:
next - the next type tag

toString

public java.lang.String toString()
Returns a string representation of this object.

Returns:
a string representation of this object