Package uk.co.westhawk.snmp.stack
Interface SnmpContextv3Face
- All Superinterfaces:
SnmpContextBasisFace
- All Known Implementing Classes:
SnmpContextv3
,SnmpContextv3Basis
,SnmpContextv3Discovery
,SnmpContextv3Pool
This interface contains the SNMP context interface that is needed by every
PDU to send a SNMP v3 request.
See SNMP-USER-BASED-SM-MIB,
RFC 3411,
RFC 3826 (AES)
- Version:
- $Revision: 3.20 $ $Date: 2009/03/05 12:56:17 $
- Author:
- Birgit Arkesteijn
-
Field Summary
Modifier and TypeFieldDescriptionstatic final int
The AES 128 encryption type.static final String
The default Context Name.static final String
The default value for the (security) user name.static final int
The DES encryption type.static final int
The MD5 protocol type.static final String[]
The array with the String represensations of the protocols.static final int
The SHA-1 protocol type.static final int
The SNMPv1 security model.static final int
The SNMPv2c security model.static final int
The USM security model.static final String
Fields inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
DEFAULT_PORT, MAXPDU, MSS, STANDARD_SOCKET, TCP_SOCKET
-
Method Summary
Modifier and TypeMethodDescriptionboolean
Adds a discovery PDU.byte[]
encodeDiscoveryPacket
(byte msg_type, int rId, int errstat, int errind, Enumeration ve, Object obj) Encodes a discovery PDU.int
Returns the protocol to be used for authentication.byte[]
Returns the contextEngineID.Returns the contextName.int
Returns the protocol to be used for privacy.Returns the user authentication password.Returns the username.Returns the user privacy password.Returns the UsmAgent.boolean
Returns if authentication is used or not.boolean
Returns 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
(String newContextName) Sets the contextName.void
setPrivacyProtocol
(int protocol) Sets the protocol to be used for privacy.void
setUseAuthentication
(boolean newUseAuthentication) Sets whether authentication has to be used.void
setUsePrivacy
(boolean newUsePrivacy) Sets whether privacy has to be used.void
setUserAuthenticationPassword
(String newUserAuthPassword) Sets the user authentication password.void
setUserName
(String newUserName) Sets the username.void
setUserPrivacyPassword
(String newUserAuthPassword) Sets the user privacy password.void
setUsmAgent
(UsmAgent agent) Sets the UsmAgent, needed when this stack is used as authoritative SNMP engine.Methods inherited from interface uk.co.westhawk.snmp.stack.SnmpContextBasisFace
addPdu, addRequestPduListener, addRequestPduListener, addRequestPduListener, addTrapListener, addTrapListener, addTrapListener, clone, destroy, encodePacket, getBindAddress, getHashKey, getHost, getPort, getReceivedFromHostAddress, getSendToHostAddress, getTypeSocket, getVersion, isDestroyed, processIncomingPdu, removePdu, removeRequestPduListener, removeRequestPduListener, removeRequestPduListener, removeTrapListener, removeTrapListener, removeTrapListener, sendPacket
-
Field Details
-
version_id
- See Also:
-
SNMPv1_Security_Model
static final int SNMPv1_Security_ModelThe SNMPv1 security model. This has value 1. The stack does not implement this security model.- See Also:
-
SNMPv2c_Security_Model
static final int SNMPv2c_Security_ModelThe SNMPv2c security model. This has value 2. The stack does not implement this security model.- See Also:
-
USM_Security_Model
static final int USM_Security_ModelThe USM security model. This has value 3. This stack only implements this security model!- See Also:
-
MD5_PROTOCOL
static final int MD5_PROTOCOLThe MD5 protocol type.- See Also:
-
SHA1_PROTOCOL
static final int SHA1_PROTOCOLThe SHA-1 protocol type.- See Also:
-
DES_ENCRYPT
static final int DES_ENCRYPTThe DES encryption type.- See Also:
-
AES_ENCRYPT
static final int AES_ENCRYPTThe AES 128 encryption type.- See Also:
-
Default_UserName
The default value for the (security) user name. This is "initial".- See Also:
-
Default_ContextName
The default Context Name. This is the zero length string, i.e. "".- See Also:
-
ProtocolNames
The array with the String represensations of the protocols.
-
-
Method Details
-
getUserName
String getUserName()Returns the username.- Returns:
- the username
-
setUserName
Sets the username. This username will be used for all PDUs sent with this context. The username corresponds to the 'msgUserName' in SNMP-USER-BASED-SM-MIB. The default value is "initial".- Parameters:
newUserName
- The new username
-
isUseAuthentication
boolean isUseAuthentication()Returns if authentication is used or not. By default no authentication will be used.- Returns:
- true if authentication is used, false if not
-
setUseAuthentication
void setUseAuthentication(boolean newUseAuthentication) Sets whether authentication has to be used. By default no authentication will be used.- Parameters:
newUseAuthentication
- The use of authentication
-
getUserAuthenticationPassword
String getUserAuthenticationPassword()Returns the user authentication password. This password will be transformed into the user authentication secret key.- Returns:
- The user authentication password
-
setUserAuthenticationPassword
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- Throws:
IllegalArgumentException
-
setAuthenticationProtocol
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- Throws:
IllegalArgumentException
- See Also:
-
getAuthenticationProtocol
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:
-
setPrivacyProtocol
Sets the protocol to be used for privacy. This can either be DES or AES. By default DES will be used.- Parameters:
protocol
- The privacy protocol to be used- Throws:
IllegalArgumentException
- See Also:
-
getPrivacyProtocol
int getPrivacyProtocol()Returns the protocol to be used for privacy. This can either be DES or AES. By default DES will be used.- Returns:
- The privacy protocol to be used
- See Also:
-
isUsePrivacy
boolean isUsePrivacy()Returns if privacy is used or not. By default no privacy will be used.- Returns:
- true if privacy is used, false if not
-
setUsePrivacy
void setUsePrivacy(boolean newUsePrivacy) Sets whether privacy has to be used. By default no privacy will be used.- Parameters:
newUsePrivacy
- The use of privacy
-
getUserPrivacyPassword
String getUserPrivacyPassword()Returns the user privacy password. This password will be transformed into the user privacy secret key.- Returns:
- The user privacy password
-
setUserPrivacyPassword
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- Throws:
IllegalArgumentException
-
setContextEngineId
Sets the contextEngineID. See RFC 3411. A contextEngineID uniquely identifies an SNMP entity that may realize an instance of a context with a particular contextName.Note, when the stack is an authoritative engine, this parameter should equal the UsmAgent.getSnmpEngineId(). See the StackUsage documentation for an explanation.
If the contextEngineID is of length zero, the encoder will use the (discovered) snmpEngineId.
- Parameters:
newContextEngineId
- The contextEngineID- Throws:
IllegalArgumentException
- See Also:
-
getContextEngineId
byte[] getContextEngineId()Returns the contextEngineID.- Returns:
- The contextEngineID
-
setContextName
Sets the contextName. See RFC 3411. 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:
-
getContextName
String getContextName()Returns the contextName.- Returns:
- The contextName
-
addDiscoveryPdu
Adds a discovery PDU. This is for internal use only and should NOT be called by the developer. 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
- Throws:
IOException
PduException
-
encodeDiscoveryPacket
byte[] encodeDiscoveryPacket(byte msg_type, int rId, int errstat, int errind, Enumeration ve, Object obj) throws IOException, EncodingException Encodes a discovery PDU. This is for internal use only and should NOT be called by the developer. 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
- Throws:
IOException
EncodingException
-
setUsmAgent
Sets the UsmAgent, needed when this stack is used as authoritative SNMP engine. This interface provides authentiation details, like its clock and its Engine ID.- Parameters:
agent
- The USM authoritative interface- Since:
- 4_14
-
getUsmAgent
UsmAgent getUsmAgent()Returns the UsmAgent.- Since:
- 4_14
- See Also:
-