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