1. /*
  2. * @(#)file SnmpMsgTranslator.java
  3. * @(#)author Sun Microsystems, Inc.
  4. * @(#)version 1.16
  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.mpm;
  12. import com.sun.jmx.snmp.SnmpSecurityParameters;
  13. import com.sun.jmx.snmp.SnmpMsg;
  14. /**
  15. * The translator interface is implemented by classes dealing with a specific SNMP protocol version. SnmpMsgTranslator are used in conjonction with SnmpMsgProcessingModel implementations.
  16. * <p><b>This API is a Sun Microsystems internal API and is subject
  17. * to change without notice.</b></p>
  18. * @since 1.5
  19. */
  20. public interface SnmpMsgTranslator {
  21. /**
  22. * Returns the request or message Id contained in the passed message. The message is a generic one that is narrowed in the object implementing this interface.
  23. */
  24. public int getMsgId(SnmpMsg msg);
  25. /**
  26. * Returns the response max message size. The message is a generic one that is narrowed in the object implementing this interface.
  27. */
  28. public int getMsgMaxSize(SnmpMsg msg);
  29. /**
  30. * Returns the message flags. The message is a generic one that is narrowed in the object implementing this interface.
  31. */
  32. public byte getMsgFlags(SnmpMsg msg);
  33. /**
  34. * Returns the message security model. The message is a generic one that is narrowed in the object implementing this interface.
  35. */
  36. public int getMsgSecurityModel(SnmpMsg msg);
  37. /**
  38. * Returns the message security level. The message is a generic one that is narrowed in the object implementing this interface.
  39. */
  40. public int getSecurityLevel(SnmpMsg msg);
  41. /**
  42. * Returns an encoded representation of security parameters contained in the passed msg. The message is a generic one that is narrowed in the object implementing this interface.
  43. */
  44. public byte[] getFlatSecurityParameters(SnmpMsg msg);
  45. /**
  46. * Returns the message security parameters. The message is a generic one that is narrowed in the object implementing this interface.
  47. */
  48. public SnmpSecurityParameters getSecurityParameters(SnmpMsg msg);
  49. /**
  50. * Returns the message context Engine Id. The message is a generic one that is narrowed in the object implementing this interface.
  51. */
  52. public byte[] getContextEngineId(SnmpMsg msg);
  53. /**
  54. * Returns the message context name. The message is a generic one that is narrowed in the object implementing this interface.
  55. */
  56. public byte[] getContextName(SnmpMsg msg);
  57. /**
  58. * Returns the raw message context name. Raw mean as it is received from the network, without translation. It can be useful when some data are piggy backed in the context name.The message is a generic one that is narrowed in the object implementing this interface.
  59. */
  60. public byte[] getRawContextName(SnmpMsg msg);
  61. /**
  62. * Returns the message accesscontext name. This access context name is used when dealing with access rights (eg: community for V1/V2 or context name for V3).The message is a generic one that is narrowed in the object implementing this interface.
  63. */
  64. public byte[] getAccessContext(SnmpMsg msg);
  65. /**
  66. * Returns the message encrypted pdu or null if no encryption. The message is a generic one that is narrowed in the object implementing this interface.
  67. */
  68. public byte[] getEncryptedPdu(SnmpMsg msg);
  69. /**
  70. * Set the context name of the passed message.
  71. */
  72. public void setContextName(SnmpMsg req, byte[] contextName);
  73. /**
  74. * Set the context engine Id of the passed message.
  75. */
  76. public void setContextEngineId(SnmpMsg req, byte[] contextEngineId);
  77. }