01: /*
02: * Copyright 2001-2006 Sun Microsystems, Inc. All Rights Reserved.
03: * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
04: *
05: * This code is free software; you can redistribute it and/or modify it
06: * under the terms of the GNU General Public License version 2 only, as
07: * published by the Free Software Foundation. Sun designates this
08: * particular file as subject to the "Classpath" exception as provided
09: * by Sun 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 Sun Microsystems, Inc., 4150 Network Circle, Santa Clara,
22: * CA 95054 USA or visit www.sun.com if you need additional information or
23: * have any questions.
24: */
25:
26: package com.sun.jmx.snmp.internal;
27:
28: import java.net.InetAddress;
29:
30: import com.sun.jmx.snmp.SnmpSecurityException;
31: import com.sun.jmx.snmp.SnmpTooBigException;
32: import com.sun.jmx.snmp.SnmpStatusException;
33: import com.sun.jmx.snmp.SnmpPdu;
34: import com.sun.jmx.snmp.SnmpMsg;
35:
36: import com.sun.jmx.snmp.internal.SnmpSecurityCache;
37: import com.sun.jmx.snmp.SnmpUnknownSecModelException;
38: import com.sun.jmx.snmp.SnmpBadSecurityLevelException;
39:
40: /**
41: * <P> An <CODE>SnmpOutgoingRequest</CODE> handles the marshalling of the message to send.</P>
42: * <p><b>This API is a Sun Microsystems internal API and is subject
43: * to change without notice.</b></p>
44: * @since 1.5
45: */
46:
47: public interface SnmpOutgoingRequest {
48: /**
49: * Returns the cached security data used when marshalling the call as a secure one.
50: * @return The cached data.
51: */
52: public SnmpSecurityCache getSecurityCache();
53:
54: /**
55: * Encodes the message to send and puts the result in the specified byte array.
56: *
57: * @param outputBytes An array to receive the resulting encoding.
58: *
59: * @exception ArrayIndexOutOfBoundsException If the result does not fit
60: * into the specified array.
61: */
62: public int encodeMessage(byte[] outputBytes)
63: throws SnmpStatusException, SnmpTooBigException,
64: SnmpSecurityException, SnmpUnknownSecModelException,
65: SnmpBadSecurityLevelException;
66:
67: /**
68: * Initializes the message to send with the passed Pdu.
69: * <P>
70: * If the encoding length exceeds <CODE>maxDataLength</CODE>,
71: * the method throws an exception.</P>
72: *
73: * @param p The PDU to be encoded.
74: * @param maxDataLength The maximum length permitted for the data field.
75: *
76: * @exception SnmpStatusException If the specified PDU <CODE>p</CODE> is
77: * not valid.
78: * @exception SnmpTooBigException If the resulting encoding does not fit
79: * into <CODE>maxDataLength</CODE> bytes.
80: * @exception ArrayIndexOutOfBoundsException If the encoding exceeds
81: * <CODE>maxDataLength</CODE>.
82: */
83: public SnmpMsg encodeSnmpPdu(SnmpPdu p, int maxDataLength)
84: throws SnmpStatusException, SnmpTooBigException;
85:
86: /**
87: * Returns a stringified form of the message to send.
88: * @return The message state string.
89: */
90: public String printMessage();
91: }
|