Showing the changes to java/pkg/com/sun/jmx/snmp/internal/SnmpMsgProcessingModel.java (1 of 18352 files). Show all
Unified · Split
| @@ -0,0 +1,147 @@ | |||
| 1 | /* | ||
| 2 | * Copyright (c) 2001, 2003, Oracle and/or its affiliates. All rights reserved. | ||
| 3 | * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. | ||
| 4 | * | ||
| 5 | * This code is free software; you can redistribute it and/or modify it | ||
| 6 | * under the terms of the GNU General Public License version 2 only, as | ||
| 7 | * published by the Free Software Foundation. Oracle designates this | ||
| 8 | * particular file as subject to the "Classpath" exception as provided | ||
| 9 | * by Oracle in the LICENSE file that accompanied this code. | ||
| 10 | * | ||
| 11 | * This code is distributed in the hope that it will be useful, but WITHOUT | ||
| 12 | * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or | ||
| 13 | * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License | ||
| 14 | * version 2 for more details (a copy is included in the LICENSE file that | ||
| 15 | * accompanied this code). | ||
| 16 | * | ||
| 17 | * You should have received a copy of the GNU General Public License version | ||
| 18 | * 2 along with this work; if not, write to the Free Software Foundation, | ||
| 19 | * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. | ||
| 20 | * | ||
| 21 | * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA | ||
| 22 | * or visit www.oracle.com if you need additional information or have any | ||
| 23 | * questions. | ||
| 24 | */ | ||
| 25 | package com.sun.jmx.snmp.internal; | ||
| 26 | |||
| 27 | |||
| 28 | import com.sun.jmx.snmp.mpm.SnmpMsgTranslator; | ||
| 29 | |||
| 30 | import com.sun.jmx.snmp.SnmpTooBigException; | ||
| 31 | import com.sun.jmx.snmp.SnmpStatusException; | ||
| 32 | import com.sun.jmx.snmp.SnmpPdu; | ||
| 33 | import com.sun.jmx.snmp.SnmpPduFactory; | ||
| 34 | import com.sun.jmx.snmp.SnmpSecurityParameters; | ||
| 35 | |||
| 36 | import com.sun.jmx.snmp.SnmpParams; | ||
| 37 | /** | ||
| 38 | * The message processing model interface. Any message processing model must implement this interface in order to be integrated in the engine framework. | ||
| 39 | * The model is called by the dispatcher when a call is received or when a call is sent. | ||
| 40 | * <p><b>This API is a Sun Microsystems internal API and is subject | ||
| 41 | * to change without notice.</b></p> | ||
| 42 | * @since 1.5 | ||
| 43 | */ | ||
| 44 | public interface SnmpMsgProcessingModel extends SnmpModel { | ||
| 45 | /** | ||
| 46 | * This method is called when a call is to be sent to the network. | ||
| 47 | * @param factory The pdu factory to use to encode and decode pdu. | ||
| 48 | * @return The object that will handle every steps of the sending (mainly marshalling and security). | ||
| 49 | */ | ||
| 50 | public SnmpOutgoingRequest getOutgoingRequest(SnmpPduFactory factory); | ||
| 51 | /** | ||
| 52 | * This method is called when a call is received from the network. | ||
| 53 | * @param factory The pdu factory to use to encode and decode pdu. | ||
| 54 | * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). | ||
| 55 | */ | ||
| 56 | public SnmpIncomingRequest getIncomingRequest(SnmpPduFactory factory); | ||
| 57 | |||
| 58 | /** | ||
| 59 | * This method is called when a response is received from the network. | ||
| 60 | * @param factory The pdu factory to use to encode and decode pdu. | ||
| 61 | * @return The object that will handle every steps of the receiving (mainly unmarshalling and security). | ||
| 62 | */ | ||
| 63 | public SnmpIncomingResponse getIncomingResponse(SnmpPduFactory factory); | ||
| 64 | /** | ||
| 65 | * This method is called to instantiate a pdu according to the passed pdu type and parameters. | ||
| 66 | * @param p The request parameters. | ||
| 67 | * @param type The pdu type. | ||
| 68 | * @return The pdu. | ||
| 69 | */ | ||
| 70 | public SnmpPdu getRequestPdu(SnmpParams p, int type) throws SnmpStatusException; | ||
| 71 | |||
| 72 | /** | ||
| 73 | * 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. | ||
| 74 | * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class). | ||
| 75 | * @param version The SNMP protocol version. | ||
| 76 | * @param msgID The SNMP message ID. | ||
| 77 | * @param msgMaxSize The max message size. | ||
| 78 | * @param msgFlags The message flags. | ||
| 79 | * @param msgSecurityModel The message security model. | ||
| 80 | * @param params The security parameters. | ||
| 81 | * @param contextEngineID The context engine ID. | ||
| 82 | * @param contextName The context name. | ||
| 83 | * @param data The encoded data. | ||
| 84 | * @param dataLength The encoded data length. | ||
| 85 | * @param outputBytes The buffer containing the encoded message. | ||
| 86 | * @return The encoded bytes number. | ||
| 87 | */ | ||
| 88 | public int encode(int version, | ||
| 89 | int msgID, | ||
| 90 | int msgMaxSize, | ||
| 91 | byte msgFlags, | ||
| 92 | int msgSecurityModel, | ||
| 93 | SnmpSecurityParameters params, | ||
| 94 | byte[] contextEngineID, | ||
| 95 | byte[] contextName, | ||
| 96 | byte[] data, | ||
| 97 | int dataLength, | ||
| 98 | byte[] outputBytes) throws SnmpTooBigException; | ||
| 99 | /** | ||
| 100 | * This method is called to encode a full scoped pdu that as been encrypted. <CODE>contextName</CODE>, <CODE>contextEngineID</CODE> and data are known. | ||
| 101 | * <BR>The specified parameters are defined in RFC 2572 (see also the {@link com.sun.jmx.snmp.SnmpV3Message} class). | ||
| 102 | * @param version The SNMP protocol version. | ||
| 103 | * @param msgID The SNMP message ID. | ||
| 104 | * @param msgMaxSize The max message size. | ||
| 105 | * @param msgFlags The message flags. | ||
| 106 | * @param msgSecurityModel The message security model. | ||
| 107 | * @param params The security parameters. | ||
| 108 | * @param encryptedPdu The encrypted pdu. | ||
| 109 | * @param outputBytes The buffer containing the encoded message. | ||
| 110 | * @return The encoded bytes number. | ||
| 111 | */ | ||
| 112 | public int encodePriv(int version, | ||
| 113 | int msgID, | ||
| 114 | int msgMaxSize, | ||
| 115 | byte msgFlags, | ||
| 116 | int msgSecurityModel, | ||
| 117 | SnmpSecurityParameters params, | ||
| 118 | byte[] encryptedPdu, | ||
| 119 | byte[] outputBytes) throws SnmpTooBigException; | ||
| 120 | /** | ||
| 121 | * 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. | ||
| 122 | * @param pdu The encoded pdu. | ||
| 123 | * @return The partialy scoped pdu. | ||
| 124 | */ | ||
| 125 | public SnmpDecryptedPdu decode(byte[] pdu) throws SnmpStatusException; | ||
| 126 | |||
| 127 | /** | ||
| 128 | * 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. | ||
| 129 | * @param pdu The pdu to encode. | ||
| 130 | * @param outputBytes The partialy scoped pdu. | ||
| 131 | * @return The encoded bytes number. | ||
| 132 | */ | ||
| 133 | public int encode(SnmpDecryptedPdu pdu, | ||
| 134 | byte[] outputBytes) throws SnmpTooBigException; | ||
| 135 | |||
| 136 | /** | ||
| 137 | * In order to change the behavior of the translator, set it. | ||
| 138 | * @param translator The translator that will be used. | ||
| 139 | */ | ||
| 140 | public void setMsgTranslator(SnmpMsgTranslator translator); | ||
| 141 | |||
| 142 | /** | ||
| 143 | * Returns the current translator. | ||
| 144 | * @return The current translator. | ||
| 145 | */ | ||
| 146 | public SnmpMsgTranslator getMsgTranslator(); | ||
| 147 | } | ||