0N/A/*
2362N/A * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved.
0N/A * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
0N/A *
0N/A * This code is free software; you can redistribute it and/or modify it
0N/A * under the terms of the GNU General Public License version 2 only, as
2362N/A * published by the Free Software Foundation. Oracle designates this
0N/A * particular file as subject to the "Classpath" exception as provided
2362N/A * by Oracle in the LICENSE file that accompanied this code.
0N/A *
0N/A * This code is distributed in the hope that it will be useful, but WITHOUT
0N/A * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
0N/A * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
0N/A * version 2 for more details (a copy is included in the LICENSE file that
0N/A * accompanied this code).
0N/A *
0N/A * You should have received a copy of the GNU General Public License version
0N/A * 2 along with this work; if not, write to the Free Software Foundation,
0N/A * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
0N/A *
2362N/A * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
2362N/A * or visit www.oracle.com if you need additional information or have any
2362N/A * questions.
0N/A */
0N/Apackage com.sun.jmx.snmp.internal;
0N/A
0N/A
0N/Aimport com.sun.jmx.snmp.mpm.SnmpMsgTranslator;
0N/A
0N/Aimport com.sun.jmx.snmp.SnmpTooBigException;
0N/Aimport com.sun.jmx.snmp.SnmpStatusException;
0N/Aimport com.sun.jmx.snmp.SnmpPdu;
0N/Aimport com.sun.jmx.snmp.SnmpPduFactory;
0N/Aimport com.sun.jmx.snmp.SnmpSecurityParameters;
0N/A
0N/Aimport com.sun.jmx.snmp.SnmpParams;
0N/A/**
0N/A * The message processing model interface. Any message processing model must implement this interface in order to be integrated in the engine framework.
0N/A * The model is called by the dispatcher when a call is received or when a call is sent.
0N/A * <p><b>This API is a Sun Microsystems internal API and is subject
0N/A * to change without notice.</b></p>
0N/A * @since 1.5
0N/A */
0N/Apublic interface SnmpMsgProcessingModel extends SnmpModel {
0N/A /**
0N/A * This method is called when a call is to be sent to the network.
0N/A * @param factory The pdu factory to use to encode and decode pdu.
0N/A * @return The object that will handle every steps of the sending (mainly marshalling and security).
0N/A */
0N/A public SnmpOutgoingRequest getOutgoingRequest(SnmpPduFactory factory);
0N/A /**
0N/A * This method is called when a call is received from the network.
0N/A * @param factory The pdu factory to use to encode and decode pdu.
0N/A * @return The object that will handle every steps of the receiving (mainly unmarshalling and security).
0N/A */
0N/A public SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory);
0N/A
0N/A /**
0N/A * This method is called when a response is received from the network.
0N/A * @param factory The pdu factory to use to encode and decode pdu.
0N/A * @return The object that will handle every steps of the receiving (mainly unmarshalling and security).
0N/A */
0N/A public SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory);
0N/A /**
0N/A * This method is called to instantiate a pdu according to the passed pdu type and parameters.
0N/A * @param p The request parameters.
0N/A * @param type The pdu type.
0N/A * @return The pdu.
0N/A */
0N/A public SnmpPdu getRequestPdu(SnmpParams p, int type) throws SnmpStatusException;
0N/A
0N/A /**
0N/A * This method is called to encode a full scoped pdu that has not been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are known.
0N/A * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
0N/A * @param version The SNMP protocol version.
0N/A * @param msgID The SNMP message ID.
0N/A * @param msgMaxSize The max message size.
0N/A * @param msgFlags The message flags.
0N/A * @param msgSecurityModel The message security model.
0N/A * @param params The security parameters.
0N/A * @param contextEngineID The context engine ID.
0N/A * @param contextName The context name.
0N/A * @param data The encoded data.
0N/A * @param dataLength The encoded data length.
0N/A * @param outputBytes The buffer containing the encoded message.
0N/A * @return The encoded bytes number.
0N/A */
0N/A public int encode(int version,
0N/A int msgID,
0N/A int msgMaxSize,
0N/A byte msgFlags,
0N/A int msgSecurityModel,
0N/A SnmpSecurityParameters params,
0N/A byte[] contextEngineID,
0N/A byte[] contextName,
0N/A byte[] data,
0N/A int dataLength,
0N/A byte[] outputBytes) throws SnmpTooBigException;
0N/A /**
0N/A * This method is called to encode a full scoped pdu that as been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are known.
0N/A * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class).
0N/A * @param version The SNMP protocol version.
0N/A * @param msgID The SNMP message ID.
0N/A * @param msgMaxSize The max message size.
0N/A * @param msgFlags The message flags.
0N/A * @param msgSecurityModel The message security model.
0N/A * @param params The security parameters.
0N/A * @param encryptedPdu The encrypted pdu.
0N/A * @param outputBytes The buffer containing the encoded message.
0N/A * @return The encoded bytes number.
0N/A */
0N/A public int encodePriv(int version,
0N/A int msgID,
0N/A int msgMaxSize,
0N/A byte msgFlags,
0N/A int msgSecurityModel,
0N/A SnmpSecurityParameters params,
0N/A byte[] encryptedPdu,
0N/A byte[] outputBytes) throws SnmpTooBigException;
0N/A /**
0N/A * This method returns a decoded scoped pdu. This method decodes only the <CODE>contextEngineID</CODE>, <CODE>contextName</CODE> and data. It is needed by the <CODE>SnmpSecurityModel</CODE> after decryption.
0N/A * @param pdu The encoded pdu.
0N/A * @return The partialy scoped pdu.
0N/A */
0N/A public SnmpDecryptedPdu decode(byte[] pdu) throws SnmpStatusException;
0N/A
0N/A /**
0N/A * This method returns an encoded scoped pdu. This method encode only the <CODE>contextEngineID</CODE>, <CODE>contextName</CODE> and data. It is needed by the <CODE>SnmpSecurityModel</CODE> for decryption.
0N/A * @param pdu The pdu to encode.
0N/A * @param outputBytes The partialy scoped pdu.
0N/A * @return The encoded bytes number.
0N/A */
0N/A public int encode(SnmpDecryptedPdu pdu,
0N/A byte[] outputBytes) throws SnmpTooBigException;
0N/A
0N/A /**
0N/A * In order to change the behavior of the translator, set it.
0N/A * @param translator The translator that will be used.
0N/A */
0N/A public void setMsgTranslator(SnmpMsgTranslator translator);
0N/A
0N/A /**
0N/A * Returns the current translator.
0N/A * @return The current translator.
0N/A */
0N/A public SnmpMsgTranslator getMsgTranslator();
0N/A}