|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object | +--com.adventnet.snmp.snmp2.SecurityModelEntry | +--com.adventnet.snmp.snmp2.security.community.SnmpCommunityEntry
The SnmpCommunityEntry holds the information about a particular community string.
Field Summary | |
static int |
V1_COMMUNITY_MODEL
Constant for the V1 Community Model. |
static int |
V2C_COMMUNITY_MODEL
Constant for the V2C Community Model. |
Constructor Summary | |
SnmpCommunityEntry()
Constructs a default SnmpCommunityEntry with default index as "public". |
|
SnmpCommunityEntry(byte[] index)
Constructs a new SnmpCommunityEntry with the specified snmpCommunityIndex. |
|
SnmpCommunityEntry(java.lang.String index)
Constructs a new SnmpCommunityEntry with the specified snmpCommunityIndex. |
|
SnmpCommunityEntry(java.lang.String index,
java.lang.String encoding)
Constructs a new SnmpCommunityEntry with the specified snmpCommunityIndex. |
Method Summary | |
void |
authenticateMessageToSend(Snmp3Message msg,
SnmpSession session)
This method resets the version of the PDU, to the version which was in it, when authenticateReceivedMessage was invoked. |
int |
authenticateReceivedMessage(Snmp3Message msg,
SnmpSession session)
Performs authentication of the received message as per the standard. |
SecurityModelEntry |
copy()
This returns, the copy of this Security Entry object. |
void |
decodeMsgSecurityParams(Snmp3Message msg,
SnmpSession session,
ASN1Parser parser)
This method will decode the security parameters that are dependent on the security model. |
byte[] |
decrypt(byte[] data,
int offset,
byte[] key,
int protocol,
byte[] privParams)
This method is used to decrypt the data. |
boolean |
encodeMsgSecurityParams(Snmp3Message msg,
SnmpAPI API,
ASN1Parser asnParser)
This method will encode the security parameters that are dependent on the security model. |
int |
encrypt(byte[] data,
int spaceLeft,
byte[] key,
int protocol,
byte[] privParams)
This method is used to encrypt the data. |
byte[] |
getCommunityIndex()
This method gets the community index of this entry. |
byte[] |
getCommunityName()
Retrieves the snmpCommunityName value associated with this object. |
byte[] |
getContextEngineID()
Retrieves the snmpCommunityContextEngineID value associated with this object. |
byte[] |
getContextName()
Retrieves the snmpCommunityContextName value associated with this object. |
byte[] |
getEngineID()
Returns, the engineID of this SnmpEngine. |
java.lang.Object |
getKey()
Returns the key associated with this SnmpCommunityEntry. |
java.lang.Object |
getKey(byte[] index)
Returns the key as the String value of this index value. |
int |
getRowStatus()
Retrieves the snmpCommunityStatus value associated with this object. |
byte[] |
getSecurityID(byte[] securityID)
Returns, a security model dependent securityID, using the security model independent security name. |
byte |
getSecurityLevel()
Returns, the security level associated with this securityEntry. |
int |
getSecurityModel()
Returns, the security model. |
byte[] |
getSecurityName()
Retrieves the snmpCommunitySecurityName value associated with this object. |
byte[] |
getSecurityName(byte[] securityID)
Returns, a security model independent security name using the security model dependent securityID. |
int |
getStorageType()
Retrieves the snmpCommunityStorageType value associated with this object. |
byte[] |
getTransportTag()
Retrieves the snmpCommunityTransportTag value associated with this object. |
void |
processEncodedMsg(Snmp3Message msg,
ASN1Parser parser)
This method is called after encoding the message version. |
void |
setCommunityIndex(byte[] index)
This method sets the community index value. |
void |
setCommunityIndex(java.lang.String index)
This methods sets the community index value. |
void |
setCommunityIndex(java.lang.String index,
java.lang.String encoding)
This methods sets the community index value. |
void |
setCommunityName(byte[] name)
Sets the snmpCommunityName value associated with this object. |
void |
setContextEngineID(byte[] contextID)
Sets the snmpCommunityContextEngineID value associated with this object. |
void |
setContextName(byte[] contextName)
Sets the snmpCommunityContextName value associated with this object. |
void |
setRowStatus(int status)
Sets the snmpCommunityStatus value associated with this object. |
void |
setSecurityLevel(byte level)
Sets the security level associated with this securityEntry. |
void |
setSecurityName(byte[] secName)
Sets the snmpCommunitySecurityName value associated with this object. |
void |
setStorageType(int type)
Sets the snmpCommunityStorageType value associated with this object. |
void |
setTransportTag(byte[] tagValue)
Sets the snmpCommunityTransportTag value associated with this object. |
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final int V1_COMMUNITY_MODEL
public static final int V2C_COMMUNITY_MODEL
Constructor Detail |
public SnmpCommunityEntry()
public SnmpCommunityEntry(byte[] index)
index
- The snmpCommunityIndex to be used for creating a new
SnmpCommunityEntry.public SnmpCommunityEntry(java.lang.String index) throws java.io.UnsupportedEncodingException
index
- The String index which is to be used as the
community index.java.lang.NullPointerException
- if the index
is null.java.lang.IllegalArgumentException
- if the length of the index
is zero or greater than 32, since the length of the
community index should be from 1 to 32 as defined in RFC2576.UnsupportedEncodingException
- if the encoding
ISO8859_1 is not supported.public SnmpCommunityEntry(java.lang.String index, java.lang.String encoding) throws java.io.UnsupportedEncodingException
index
- The String index which is to be used as the
community index.encoding
- The name of a supported
character encoding.
java.lang.NullPointerException
- if the index
or
encoding
is null.java.lang.IllegalArgumentException
- if the length of the index
is zero or greater than 32, since the length of the
community index should be from 1 to 32 as defined in RFC2576.UnsupportedEncodingException
- if the encoding string
is not supported.Method Detail |
public void setCommunityIndex(byte[] index)
index
- the community index value.public void setCommunityIndex(java.lang.String index) throws java.io.UnsupportedEncodingException
index
- the string value of the
community index. From this string value,
the bytes will be got using the default
character encoding namely ISO8859_1.java.lang.NullPointerException
- if index
is null.java.lang.IllegalArgumentException
- if the length of the index
is zero or greater than 32. Since the length of the
community index should be from 1 to 32 as defined in RFC2576.UnsupportedEncodingException
- if the encoding string
is not supported.public void setCommunityIndex(java.lang.String index, java.lang.String encoding) throws java.io.UnsupportedEncodingException
index
- the string value of the
community index.encoding
- The name of a supported
character encoding.java.lang.NullPointerException
- if index
or
encoding
is null.java.lang.IllegalArgumentException
- if the length of the index
is zero or greater than 32. Since the length of the
community index should be from 1 to 32 as defined in RFC2576.UnsupportedEncodingException
- if the encoding string
is not supported.public byte[] getCommunityIndex()
public void setCommunityName(byte[] name)
name
- The snmpCommunityName value to be associated with
this object.public byte[] getCommunityName()
public void setSecurityName(byte[] secName)
setSecurityName
in class SecurityModelEntry
secName
- The snmpCommunitySecurityName value to be associated with
this object.public byte[] getSecurityName()
getSecurityName
in class SecurityModelEntry
public void setContextEngineID(byte[] contextID)
contextID
- The snmpCommunityContextEngineID value to be associated with
this object.public byte[] getContextEngineID()
public void setContextName(byte[] contextName)
contextName
- The snmpCommunityContextName value to be associated with
this object.public byte[] getContextName()
public void setTransportTag(byte[] tagValue)
tagValue
- The snmpCommunityTransportTag value to be associated with
this object.public byte[] getTransportTag()
public void setStorageType(int type)
type
- The snmpCommunityStorageType value to be associated with
this object.public int getStorageType()
public void setRowStatus(int status)
status
- The snmpCommunityStatus value to be associated with
this object.public int getRowStatus()
public java.lang.Object getKey()
getKey
in class SecurityModelEntry
String
Object.java.lang.NullPointerException
- if the key value is null.public java.lang.Object getKey(byte[] index)
String
Object.public int authenticateReceivedMessage(Snmp3Message msg, SnmpSession session)
authenticateReceivedMessage
in class SecurityModelEntry
msg
- The Snmp3Message instance.session
- The SnmpSession instance incase this module requirespublic void authenticateMessageToSend(Snmp3Message msg, SnmpSession session)
authenticateMessageToSend
in class SecurityModelEntry
msg
- The Snmp3Message instance.session
- The SnmpSession instance.SnmpException
- If the message could not be authenticated
properly or a particular entry is not available.public int getSecurityModel()
getSecurityModel
in class SecurityModelEntry
public byte[] getEngineID()
getEngineID
in class SecurityModelEntry
public byte[] getSecurityID(byte[] securityID)
getSecurityID
in class SecurityModelEntry
public byte getSecurityLevel()
getSecurityLevel
in class SecurityModelEntry
public void setSecurityLevel(byte level)
setSecurityLevel
in class SecurityModelEntry
public byte[] getSecurityName(byte[] securityID)
getSecurityName
in class SecurityModelEntry
public SecurityModelEntry copy()
copy
in class SecurityModelEntry
public boolean encodeMsgSecurityParams(Snmp3Message msg, SnmpAPI API, ASN1Parser asnParser)
encodeMsgSecurityParams
in class SecurityModelEntry
msg
- The Snmp3Message instance.API
- The SnmpAPI Instance.asnParser
- The reference to ASN1Parser which has the
methods to encode the SnmpPDU.
This method should not be used by API user. This method has default
implementation and returns false.public void decodeMsgSecurityParams(Snmp3Message msg, SnmpSession session, ASN1Parser parser) throws SnmpException, java.lang.ArrayIndexOutOfBoundsException
decodeMsgSecurityParams
in class SecurityModelEntry
msg
- The Snmp3Message instance.asnParser
- The reference to ASN1Parser which has the
data and methods to encode/decode the SnmpPDU.SnmpException
- If the security parameters could not be
decoded properly.java.lang.ArrayIndexOutOfBoundsException
- If an unrecognized
snmp message
This method should not be used by API user.public void processEncodedMsg(Snmp3Message msg, ASN1Parser parser)
processEncodedMsg
in class SecurityModelEntry
msg
- Snmp3Messgage instance.asnParser
- The reference to ASN1Parser which has the
encoded data and methods to encode the SnmpPDU.
This method should not be used by API user.public int encrypt(byte[] data, int spaceLeft, byte[] key, int protocol, byte[] privParams) throws SnmpException
encrypt
in class SecurityModelEntry
data
- The data to be encrypted.spaceleft
- The space left in the buffer while encodingkey
- The key value used in encryptionprotocol
- The protocol used for encryptionprivParams
- The privacy params used in encryption
This method should not be used by API user. This method has default
implementation and returns -1.public byte[] decrypt(byte[] data, int offset, byte[] key, int protocol, byte[] privParams)
decrypt
in class SecurityModelEntry
data
- The data to be decrypted.offset
- The offset value to be used in decryption.key
- The key value to be used in decryption.protocol
- The protocol used for decryption.privParams
- The privacy params used in decryption.
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: INNER | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |