1. /*
  2. * @(#)file SnmpScopedPduRequest.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.14
  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;
  12. /**
  13. * Is used to represent <CODE>get</CODE>, <CODE>get-next</CODE>, <CODE>set</CODE>, <CODE>response</CODE> SNMP V3 scoped PDUs.
  14. *
  15. * <p><b>This API is a Sun Microsystems internal API and is subject
  16. * to change without notice.</b></p>
  17. * @since 1.5
  18. */
  19. public class SnmpScopedPduRequest extends SnmpScopedPduPacket
  20. implements SnmpPduRequestType {
  21. int errorStatus=0 ;
  22. int errorIndex=0 ;
  23. /**
  24. * Error index setter. Remember that SNMP indices start from 1.
  25. * Thus the corresponding <CODE>SnmpVarBind</CODE> is
  26. * <CODE>varBindList[errorIndex-1]</CODE>.
  27. * @param i Error index.
  28. */
  29. public void setErrorIndex(int i) {
  30. errorIndex = i;
  31. }
  32. /**
  33. * Error status setter. Statuses are defined in
  34. * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
  35. * @param s Error status.
  36. */
  37. public void setErrorStatus(int s) {
  38. errorStatus = s;
  39. }
  40. /**
  41. * Error index getter. Remember that SNMP indices start from 1.
  42. * Thus the corresponding <CODE>SnmpVarBind</CODE> is
  43. * <CODE>varBindList[errorIndex-1]</CODE>.
  44. * @return Error index.
  45. */
  46. public int getErrorIndex() { return errorIndex; }
  47. /**
  48. * Error status getter. Statuses are defined in
  49. * {@link com.sun.jmx.snmp.SnmpDefinitions SnmpDefinitions}.
  50. * @return Error status.
  51. */
  52. public int getErrorStatus() { return errorStatus; }
  53. /**
  54. * Generates the pdu to use for response.
  55. * @return Response pdu.
  56. */
  57. public SnmpPdu getResponsePdu() {
  58. SnmpScopedPduRequest result = new SnmpScopedPduRequest();
  59. result.address = address ;
  60. result.port = port ;
  61. result.version = version ;
  62. result.requestId = requestId;
  63. result.msgId = msgId;
  64. result.msgMaxSize = msgMaxSize;
  65. result.msgFlags = msgFlags;
  66. result.msgSecurityModel = msgSecurityModel;
  67. result.contextEngineId = contextEngineId;
  68. result.contextName = contextName;
  69. result.securityParameters = securityParameters;
  70. result.type = pduGetResponsePdu ;
  71. result.errorStatus = SnmpDefinitions.snmpRspNoError ;
  72. result.errorIndex = 0 ;
  73. return result;
  74. }
  75. }