com.sun.management.snmp.mpm
Class SnmpMsgProcessingModelV1V2

java.lang.Object
  extended by com.sun.management.internal.snmp.SnmpModelImpl
      extended by com.sun.management.snmp.mpm.SnmpMsgProcessingModelV1V2
All Implemented Interfaces:
com.sun.management.internal.snmp.SnmpModel, com.sun.management.internal.snmp.SnmpMsgProcessingModel

public class SnmpMsgProcessingModelV1V2
extends com.sun.management.internal.snmp.SnmpModelImpl
implements com.sun.management.internal.snmp.SnmpMsgProcessingModel

Defines an implementation of the SnmpMsgProcessingModel interface.

This message processing model allows previous supported SNMP protocols to be integrated in the SNMP V3 engine / model framework. It uses a dedicated translator object that infers some V3 parameters and make use of the data types that were used in Jdmk 4.2 (SnmpPduPacket, SnmpMessage...).

Since:
Java DMK 5.1

Constructor Summary
SnmpMsgProcessingModelV1V2(com.sun.management.internal.snmp.SnmpMsgProcessingSubSystem sys, SnmpMsgTranslator translat)
          Constructor.
 
Method Summary
 com.sun.management.internal.snmp.SnmpDecryptedPdu decode(byte[] pdu)
          Look for SnmpMsgProcessingModel interface specification.
 int encode(int version, int msgId, int msgMaxSize, byte msgFlags, int msgSecurityModel, SnmpSecurityParameters params, byte[] contextEngineId, byte[] contextName, byte[] data, int dataLength, byte[] outputBytes)
          Look for SnmpMsgProcessingModel interface specification.
 int encode(com.sun.management.internal.snmp.SnmpDecryptedPdu pdu, byte[] outputBytes)
          Look for SnmpMsgProcessingModel interface specification
 int encodePriv(int version, int msgId, int msgMaxSize, byte msgFlags, int msgSecurityModel, SnmpSecurityParameters params, byte[] encryptedPdu, byte[] outputBytes)
          Look for SnmpMsgProcessingModel interface specification.
 com.sun.management.internal.snmp.SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory)
          Look for SnmpMsgProcessingModel interface specification.
 com.sun.management.internal.snmp.SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory)
          Look for SnmpMsgProcessingModel interface specification.
 SnmpMsgTranslator getMsgTranslator()
          Returns the current translator.
 com.sun.management.internal.snmp.SnmpOutgoingRequest getOutgoingRequest(SnmpPduFactory factory)
          Look for SnmpMsgProcessingModel interface specification.
 SnmpPdu getRequestPdu(SnmpParams p, int command)
          Look for SnmpMsgProcessingModel interface specification.
 void setMsgTranslator(SnmpMsgTranslator translator)
          In order to change the behavior of the translator, set it.
 
Methods inherited from class com.sun.management.internal.snmp.SnmpModelImpl
getName, getSubSystem
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 
Methods inherited from interface com.sun.management.internal.snmp.SnmpModel
getName, getSubSystem
 

Constructor Detail

SnmpMsgProcessingModelV1V2

public SnmpMsgProcessingModelV1V2(com.sun.management.internal.snmp.SnmpMsgProcessingSubSystem sys,
                                  SnmpMsgTranslator translat)
Constructor. The translator make the translation between SNMP protocol parameters. If the passed translator is null, SnmpMsgTranslatorV1V2 is the default one used.

Parameters:
sys - The Msg processing subSystem.
translat - The SNMP protocol translator.
Method Detail

setMsgTranslator

public void setMsgTranslator(SnmpMsgTranslator translator)
In order to change the behavior of the translator, set it.

Specified by:
setMsgTranslator in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
translator - The translator that will be used.

getMsgTranslator

public SnmpMsgTranslator getMsgTranslator()
Description copied from interface: com.sun.management.internal.snmp.SnmpMsgProcessingModel
Returns the current translator.

Specified by:
getMsgTranslator in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Returns:
The current translator.

getIncomingRequest

public com.sun.management.internal.snmp.SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory)
Look for SnmpMsgProcessingModel interface specification.

Specified by:
getIncomingRequest in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
factory - The pdu factory to use to encode and decode pdu.
Returns:
The object that will handle every steps of the receiving (mainly unmarshalling and security).

getOutgoingRequest

public com.sun.management.internal.snmp.SnmpOutgoingRequest getOutgoingRequest(SnmpPduFactory factory)
Look for SnmpMsgProcessingModel interface specification.

Specified by:
getOutgoingRequest in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
factory - The pdu factory to use to encode and decode pdu.
Returns:
The object that will handle every steps of the sending (mainly marshalling and security).

getIncomingResponse

public com.sun.management.internal.snmp.SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory)
Look for SnmpMsgProcessingModel interface specification.

Specified by:
getIncomingResponse in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
factory - The pdu factory to use to encode and decode pdu.
Returns:
The object that will handle every steps of the receiving (mainly unmarshalling and security).

getRequestPdu

public SnmpPdu getRequestPdu(SnmpParams p,
                             int command)
                      throws SnmpStatusException
Look for SnmpMsgProcessingModel interface specification.

Specified by:
getRequestPdu in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
p - The request parameters.
command - The pdu type.
Returns:
The pdu.
Throws:
SnmpStatusException

encodePriv

public int encodePriv(int version,
                      int msgId,
                      int msgMaxSize,
                      byte msgFlags,
                      int msgSecurityModel,
                      SnmpSecurityParameters params,
                      byte[] encryptedPdu,
                      byte[] outputBytes)
               throws SnmpTooBigException
Look for SnmpMsgProcessingModel interface specification.

Specified by:
encodePriv in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
version - The SNMP protocol version.
msgId - The SNMP message ID.
msgMaxSize - The max message size.
msgFlags - The message flags.
msgSecurityModel - The message security model.
params - The security parameters.
encryptedPdu - The encrypted pdu.
outputBytes - The buffer containing the encoded message.
Returns:
The encoded bytes number.
Throws:
SnmpTooBigException

encode

public int encode(int version,
                  int msgId,
                  int msgMaxSize,
                  byte msgFlags,
                  int msgSecurityModel,
                  SnmpSecurityParameters params,
                  byte[] contextEngineId,
                  byte[] contextName,
                  byte[] data,
                  int dataLength,
                  byte[] outputBytes)
           throws SnmpTooBigException
Look for SnmpMsgProcessingModel interface specification.

Specified by:
encode in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
version - The SNMP protocol version.
msgId - The SNMP message ID.
msgMaxSize - The max message size.
msgFlags - The message flags.
msgSecurityModel - The message security model.
params - The security parameters.
contextEngineId - The context engine ID.
contextName - The context name.
data - The encoded data.
dataLength - The encoded data length.
outputBytes - The buffer containing the encoded message.
Returns:
The encoded bytes number.
Throws:
SnmpTooBigException

decode

public com.sun.management.internal.snmp.SnmpDecryptedPdu decode(byte[] pdu)
                                                         throws SnmpStatusException
Look for SnmpMsgProcessingModel interface specification.

Specified by:
decode in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
pdu - The encoded pdu.
Returns:
The partially scoped pdu.
Throws:
SnmpStatusException

encode

public int encode(com.sun.management.internal.snmp.SnmpDecryptedPdu pdu,
                  byte[] outputBytes)
           throws SnmpTooBigException
Look for SnmpMsgProcessingModel interface specification

Specified by:
encode in interface com.sun.management.internal.snmp.SnmpMsgProcessingModel
Parameters:
pdu - The pdu to encode.
outputBytes - The partially scoped pdu.
Returns:
The encoded bytes number.
Throws:
SnmpTooBigException

Open Source build 02
opendmk-1.0-b02 2007.10.01_19:17:46_MEST

Copyright 1998-2007 Sun Microsystems, Inc. All rights reserved. Use is subject to license terms.