/* * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. * ORACLE PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. * * * * * * * * * * * * * * * * * * * * */ package com.sun.jmx.snmp.internal; import com.sun.jmx.snmp.mpm.SnmpMsgTranslator; import com.sun.jmx.snmp.SnmpTooBigException; import com.sun.jmx.snmp.SnmpStatusException; import com.sun.jmx.snmp.SnmpPdu; import com.sun.jmx.snmp.SnmpPduFactory; import com.sun.jmx.snmp.SnmpSecurityParameters; import com.sun.jmx.snmp.SnmpParams; /** * The message processing model interface. Any message processing model must implement this interface in order to be integrated in the engine framework. * The model is called by the dispatcher when a call is received or when a call is sent. *
This API is a Sun Microsystems internal API and is subject * to change without notice.
* @since 1.5 */ public interface SnmpMsgProcessingModel extends SnmpModel { /** * This method is called when a call is to be sent to the network. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the sending (mainly marshalling and security). */ public SnmpOutgoingRequest getOutgoingRequest(SnmpPduFactory factory); /** * This method is called when a call is received from the network. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). */ public SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory); /** * This method is called when a response is received from the network. * @param factory The pdu factory to use to encode and decode pdu. * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). */ public SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory); /** * This method is called to instantiate a pdu according to the passed pdu type and parameters. * @param p The request parameters. * @param type The pdu type. * @return The pdu. */ public SnmpPdu getRequestPdu(SnmpParams p, int type) throws SnmpStatusException; /** * This method is called to encode a full scoped pdu that has not been encrypted.contextName
, contextEngineID
and data are known.
* contextName
, contextEngineID
and data are known.
* contextEngineID
, contextName
and data. It is needed by the SnmpSecurityModel
after decryption.
* @param pdu The encoded pdu.
* @return The partialy scoped pdu.
*/
public SnmpDecryptedPdu decode(byte[] pdu) throws SnmpStatusException;
/**
* This method returns an encoded scoped pdu. This method encode only the contextEngineID
, contextName
and data. It is needed by the SnmpSecurityModel
for decryption.
* @param pdu The pdu to encode.
* @param outputBytes The partialy scoped pdu.
* @return The encoded bytes number.
*/
public int encode(SnmpDecryptedPdu pdu,
byte[] outputBytes) throws SnmpTooBigException;
/**
* In order to change the behavior of the translator, set it.
* @param translator The translator that will be used.
*/
public void setMsgTranslator(SnmpMsgTranslator translator);
/**
* Returns the current translator.
* @return The current translator.
*/
public SnmpMsgTranslator getMsgTranslator();
}