1 /* 2 * @(#)file SnmpOutgoingRequest.java 3 * @(#)author Sun Microsystems, Inc. 4 * @(#)version 1.18 5 * @(#)date 08/02/09 6 * 7 * Copyright 2004 Sun Microsystems, Inc. All rights reserved. 8 * SUN PROPRIETARY/CONFIDENTIAL. Use is subject to license terms. 9 * 10 */ 11 12 package com.sun.jmx.snmp.internal; 13 14 import java.net.InetAddress; 15 16 import com.sun.jmx.snmp.SnmpSecurityException; 17 import com.sun.jmx.snmp.SnmpTooBigException; 18 import com.sun.jmx.snmp.SnmpStatusException; 19 import com.sun.jmx.snmp.SnmpPdu; 20 import com.sun.jmx.snmp.SnmpMsg; 21 22 import com.sun.jmx.snmp.internal.SnmpSecurityCache; 23 import com.sun.jmx.snmp.SnmpUnknownSecModelException; 24 import com.sun.jmx.snmp.SnmpBadSecurityLevelException; 25 /** 26 * <P> An <CODE>SnmpOutgoingRequest</CODE> handles the marshalling of the message to send.</P> 27 * <p><b>This API is a Sun Microsystems internal API and is subject 28 * to change without notice.</b></p> 29 * @since 1.5 30 */ 31 32 public interface SnmpOutgoingRequest { 33 /** 34 * Returns the cached security data used when marshalling the call as a secure one. 35 * @return The cached data. 36 */ 37 public SnmpSecurityCache getSecurityCache(); 38 /** 39 * Encodes the message to send and puts the result in the specified byte array. 40 * 41 * @param outputBytes An array to receive the resulting encoding. 42 * 43 * @exception ArrayIndexOutOfBoundsException If the result does not fit 44 * into the specified array. 45 */ 46 public int encodeMessage(byte[] outputBytes) 47 throws SnmpStatusException, 48 SnmpTooBigException, SnmpSecurityException, 49 SnmpUnknownSecModelException, SnmpBadSecurityLevelException; 50 /** 51 * Initializes the message to send with the passed Pdu. 52 * <P> 53 * If the encoding length exceeds <CODE>maxDataLength</CODE>, 54 * the method throws an exception.</P> 55 * 56 * @param p The PDU to be encoded. 57 * @param maxDataLength The maximum length permitted for the data field. 58 * 59 * @exception SnmpStatusException If the specified PDU <CODE>p/CODE> is 60 * not valid. 61 * @exception SnmpTooBigException If the resulting encoding does not fit 62 * into <CODE>maxDataLength</CODE> bytes. 63 * @exception ArrayIndexOutOfBoundsException If the encoding exceeds 64 * <CODE>maxDataLength</CODE>. 65 */ 66 public SnmpMsg encodeSnmpPdu(SnmpPdu p, 67 int maxDataLength) 68 throws SnmpStatusException, SnmpTooBigException; 69 /** 70 * Returns a stringified form of the message to send. 71 * @return The message state string. 72 */ 73 public String printMessage(); 74 } 75