SNMP Stack 4_12

uk.co.westhawk.snmp.stack
Interface SnmpContextv3Face

All Superinterfaces:
SnmpContextBasisFace
All Known Implementing Classes:
SnmpContextv3Pool, SnmpContextv3

public interface SnmpContextv3Face
extends SnmpContextBasisFace

This interface contains the SNMP context interface that is needed by every Pdu to send a SNMP v3 request. See RFC 2574, RFC 2571.

Version:
$Revision: 3.12 $ $Date: 2002/10/10 15:13:57 $
Author:
Birgit Arkesteijn

Field Summary
static java.lang.String Default_ContextName
          The default Context Name.
static java.lang.String Default_UserName
          The default value for the (security) user name.
static int MD5_PROTOCOL
          The MD5 protocol type.
static java.lang.String[] ProtocolNames
          The array with the String represensations of the protocols.
static int SHA1_PROTOCOL
          The SHA-1 protocol type.
static int SNMPv1_Security_Model
          The SNMPv1 security model.
static int SNMPv2c_Security_Model
          The SNMPv2c security model.
static int USM_Security_Model
          The USM security model.
static java.lang.String version_id
           
 
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
DEFAULT_PORT, KVM_SOCKET, MAXPDU, MSS, NETSCAPE_SOCKET, STANDARD_SOCKET
 
Method Summary
 boolean addDiscoveryPdu(DiscoveryPdu pdu)
          Adds an discovery pdu.
 byte[] encodeDiscoveryPacket(byte msg_type, int rId, int errstat, int errind, java.util.Enumeration ve)
          Encodes a discovery pdu.
 int getAuthenticationProtocol()
          Returns the protocol to be used for authentication.
 byte[] getContextEngineId()
          Returns the contextEngineID.
 java.lang.String getContextName()
          Returns the contextName.
 java.lang.String getUserAuthenticationPassword()
          Returns the user authentication password.
 java.lang.String getUserName()
          Returns the username.
 java.lang.String getUserPrivacyPassword()
          Returns the user privacy password.
 boolean isUseAuthentication()
          Return if authentication is used or not.
 boolean isUsePrivacy()
          Return if privacy is used or not.
 void setAuthenticationProtocol(int protocol)
          Sets the protocol to be used for authentication.
 void setContextEngineId(byte[] newContextEngineId)
          Sets the contextEngineID.
 void setContextName(java.lang.String newContextName)
          Sets the contextName.
 void setUseAuthentication(boolean newUseAuthentication)
          Sets whether authentication has to used.
 void setUsePrivacy(boolean newUsePrivacy)
          Sets whether privacy has to used.
 void setUserAuthenticationPassword(java.lang.String newUserAuthPassword)
          Sets the user authentication password.
 void setUserName(java.lang.String newUserName)
          Sets the username.
 void setUserPrivacyPassword(java.lang.String newUserAuthPassword)
          Sets the user privacy password.
 
Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
addPdu, addTrapListener, destroy, encodePacket, getHost, getPort, getTypeSocket, getVersion, processIncomingTrap, removePdu, removeTrapListener, sendPacket
 

Field Detail

version_id

public static final java.lang.String version_id

SNMPv1_Security_Model

public static final int SNMPv1_Security_Model
The SNMPv1 security model. This has value 1. The stack does not implement this security model.

SNMPv2c_Security_Model

public static final int SNMPv2c_Security_Model
The SNMPv2c security model. This has value 2. The stack does not implement this security model.

USM_Security_Model

public static final int USM_Security_Model
The USM security model. This has value 3. This stack only implements this security model!

MD5_PROTOCOL

public static final int MD5_PROTOCOL
The MD5 protocol type.

SHA1_PROTOCOL

public static final int SHA1_PROTOCOL
The SHA-1 protocol type.

Default_UserName

public static final java.lang.String Default_UserName
The default value for the (security) user name. This is "initial".

Default_ContextName

public static final java.lang.String Default_ContextName
The default Context Name. This is the zero length string, i.e. "".

ProtocolNames

public static final java.lang.String[] ProtocolNames
The array with the String represensations of the protocols.
Method Detail

getUserName

public java.lang.String getUserName()
Returns the username.
Returns:
the username

setUserName

public void setUserName(java.lang.String newUserName)
Sets the username. This username will be used for all PDU send with this context. The username corresponds to the 'msgUserName' in RFC 2574. The default value is "initial".
Parameters:
newUserName - The new username

isUseAuthentication

public boolean isUseAuthentication()
Return if authentication is used or not. By default no authentication will be used.
Returns:
true if authentication is used, false if not

setUseAuthentication

public void setUseAuthentication(boolean newUseAuthentication)
Sets whether authentication has to used. By default no authentication will be used.
Parameters:
newUseAuthentication - The use of authentication

getUserAuthenticationPassword

public java.lang.String getUserAuthenticationPassword()
Returns the user authentication password. This password will be transformed into the user authentication secret key.
Returns:
The user authentication password

setUserAuthenticationPassword

public void setUserAuthenticationPassword(java.lang.String newUserAuthPassword)
Sets the user authentication password. This password will be transformed into the user authentication secret key. A user MUST set this password.
Parameters:
newUserAuthPassword - The user authentication password

setAuthenticationProtocol

public void setAuthenticationProtocol(int protocol)
                               throws java.lang.IllegalArgumentException
Sets the protocol to be used for authentication. This can either be MD5 or SHA-1. By default MD5 will be used.
Parameters:
protocol - The authentication protocol to be used
See Also:
MD5_PROTOCOL, SHA1_PROTOCOL

getAuthenticationProtocol

public int getAuthenticationProtocol()
Returns the protocol to be used for authentication. This can either be MD5 or SHA-1. By default MD5 will be used.
Returns:
The authentication protocol to be used
See Also:
MD5_PROTOCOL, SHA1_PROTOCOL

isUsePrivacy

public boolean isUsePrivacy()
Return if privacy is used or not. By default no privacy will be used.
Returns:
true if privacy is used, false if not

setUsePrivacy

public void setUsePrivacy(boolean newUsePrivacy)
Sets whether privacy has to used. By default no privacy will be used.
Parameters:
newUsePrivacy - The use of privacy

getUserPrivacyPassword

public java.lang.String getUserPrivacyPassword()
Returns the user privacy password. This password will be transformed into the user privacy secret key.
Returns:
The user privacy password

setUserPrivacyPassword

public void setUserPrivacyPassword(java.lang.String newUserAuthPassword)
Sets the user privacy password. This password will be transformed into the user privacy secret key. A user MUST set this password.
Parameters:
newUserAuthPassword - The user privacy password

setContextEngineId

public void setContextEngineId(byte[] newContextEngineId)
                        throws java.lang.IllegalArgumentException
Sets the contextEngineID. See RFC 2571. A contextEngineID uniquely identifies an SNMP entity that may realize an instance of a context with a particular contextName.
Parameters:
newContextEngineId - The contextEngineID

getContextEngineId

public byte[] getContextEngineId()
Returns the contextEngineID.
Returns:
The contextEngineID

setContextName

public void setContextName(java.lang.String newContextName)
Sets the contextName. See RFC 2571. A contextName is used to name a context. Each contextName MUST be unique within an SNMP entity. By default this is "".
Parameters:
newContextName - The contextName
See Also:
Default_ContextName

getContextName

public java.lang.String getContextName()
Returns the contextName.
Returns:
The contextName

addDiscoveryPdu

public boolean addDiscoveryPdu(DiscoveryPdu pdu)
                        throws java.io.IOException,
                               PduException
Adds an discovery pdu. This is for internal use only and should NOT be called by the developper. This is called by the the Pdu itself and is added to the interface to cover the different kind of Contexts.
Parameters:
pdu - the discovery pdu
Returns:
pdu is succesful added

encodeDiscoveryPacket

public byte[] encodeDiscoveryPacket(byte msg_type,
                                    int rId,
                                    int errstat,
                                    int errind,
                                    java.util.Enumeration ve)
                             throws java.io.IOException,
                                    EncodingException
Encodes a discovery pdu. This is for internal use only and should NOT be called by the developper. This is called by the the Pdu itself and is added to the interface to cover the different kind of Contexts.
Returns:
The encoded packet

SNMP Stack 4_12