|
MySnmpCrawler API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--snmp.message.SnmpMessageHeader
This class provides SNMP message header information. It contains the protocol version number and the community string.
Field Summary | |
private MySnmpCrawlerOctetString |
community
|
private java.lang.String |
strCommunity
|
private MySnmpCrawlerInt32 |
version
|
Constructor Summary | |
SnmpMessageHeader()
The default Constructor |
|
SnmpMessageHeader(MySnmpCrawlerInt32 version,
MySnmpCrawlerOctetString community)
Constructs the SnmpMessageHeader object with the version number and the community string. |
Method Summary | |
int |
decode(byte[] buf,
int offset,
org.opennms.protocols.snmp.asn1.BerEncoder encoder)
Decodes the SNMP header information from the passed buffer. |
int |
encode(byte[] buf,
int offset,
org.opennms.protocols.snmp.asn1.BerEncoder encoder)
Encodes the header information including the version number and the community string. |
java.lang.String |
getCommunity()
Gets the SNMP community string. |
int |
getVersion()
Gets the SNMP version number. |
void |
setCommunity(java.lang.String strCommunity)
Sets the SNMP community string. |
void |
setVersion(int iversion)
Sets the SNMP version number. |
java.lang.String |
toString()
Gets the string representation of the SnmpMessageHeader object. |
int |
validateSnmpPacket(java.net.DatagramPacket packet,
byte[] buf,
int offset,
org.opennms.protocols.snmp.asn1.BerEncoder encoder)
Validates the SNMP packet to see if it complies with ASN.1 standard. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Field Detail |
private MySnmpCrawlerInt32 version
private MySnmpCrawlerOctetString community
private java.lang.String strCommunity
Constructor Detail |
public SnmpMessageHeader()
public SnmpMessageHeader(MySnmpCrawlerInt32 version, MySnmpCrawlerOctetString community)
version
- The version numberMethod Detail |
public int validateSnmpPacket(java.net.DatagramPacket packet, byte[] buf, int offset, org.opennms.protocols.snmp.asn1.BerEncoder encoder) throws org.opennms.protocols.snmp.SnmpPduEncodingException, org.opennms.protocols.snmp.asn1.AsnDecodingException
org.opennms.protocols.snmp.SnmpPduEncodingException
- thrown when ASN.1 Type is
not compatible.
org.opennms.protocols.snmp.asn1.AsnDecodingException
- thrown when insufficient data in packet.public int decode(byte[] buf, int offset, org.opennms.protocols.snmp.asn1.BerEncoder encoder) throws org.opennms.protocols.snmp.SnmpPduEncodingException, org.opennms.protocols.snmp.asn1.AsnDecodingException
buf
- The data to decodeoffset
- The position to start decodingencoder
- The encoder used for "encode" and "decode"
org.opennms.protocols.snmp.asn1.AsnEncodingException
- Thrown if the encoder finds an
error in the passed buffer.
org.opennms.protocols.snmp.SnmpPduEncodingException
org.opennms.protocols.snmp.asn1.AsnDecodingException
public int encode(byte[] buf, int offset, org.opennms.protocols.snmp.asn1.BerEncoder encoder) throws org.opennms.protocols.snmp.SnmpPduEncodingException, org.opennms.protocols.snmp.asn1.AsnEncodingException
buf
- The data to decodeoffset
- The position to start decodingencoder
- The encoder used for "encode" and "decode"
org.opennms.protocols.snmp.SnmpPduEncodingException
org.opennms.protocols.snmp.asn1.AsnEncodingException
public int getVersion()
public void setVersion(int iversion)
iversion
- The version number.public java.lang.String getCommunity()
public void setCommunity(java.lang.String strCommunity)
strCommunity
- The community string.public java.lang.String toString()
toString
in class java.lang.Object
|
MySnmpCrawler API | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |