com.h3c.util.snmp

## Class SnmpResponse

- java.lang.Object
- - com.h3c.util.snmp.SnmpField
  - - com.h3c.util.snmp.SnmpResponse

-     public class SnmpResponse
      extends SnmpField

  SNMP response message.

- - ### Nested Class Summary

    Nested Classes
    Modifier and Type | Class and Description
    --- | ---
    `static class` | `SnmpResponse.ErrorType`

  - ### Field Summary

    - ### Fields inherited from class com.h3c.util.snmp.SnmpField

      `NULL_FIELD`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `SnmpResponse()`

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `boolean` | `decrypt(SnmpTarget target)` Decrypts the response based on the passed in target.
    `SnmpResponse.ErrorType` | `getError()` Returns the current response error.
    `String` | `getLocalizedErrorDescription()` Returns the localized error description for the response.
    `String` | `getParsedCommunity()` Returns the parsed community name of the response.
    `SnmpVersionType` | `getParsedVersion()` Returns the parsed version of the response.
    `SnmpPdu` | `getPdu()`
    `SnmpPduTrapV1` | `getPduTrapV1()`
    `InetAddress` | `getRemoteAddress()` Returns the remote address this response came from.
    `SnmpFieldType` | `getVarBindError()` If the error state is `PDU_VARBIND_ERROR` this will return the specific VarBind error.
    `boolean` | `isOk()` Query the state of the response.
    `String` | `toString()`

    - ### Methods inherited from class com.h3c.util.snmp.SnmpField

      `asBoolean, asBytes, asInt, asIpAddress, asLong, asMacAddress, asOid, asString, asStringValue, asTimeTicksString, getType, read, set, set, set, set, set, set, set, set, setNull, setType, setU32, toDebugString, write`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait`

- - ### Constructor Detail

    - #### SnmpResponse

          public SnmpResponse()

  - ### Method Detail

    - #### getError

          public SnmpResponse.ErrorType getError()

      Returns the current response error.
      Returns:
        response error state (could be OK)

    - #### isOk

          public boolean isOk()

      Query the state of the response.
      Returns:
        true if the response is not in the error state

    - #### getVarBindError

          public SnmpFieldType getVarBindError()

      If the error state is `PDU_VARBIND_ERROR` this will return the specific VarBind error.
      Returns:
        SNMP VarBind error (field type)

    - #### getRemoteAddress

          public InetAddress getRemoteAddress()

      Returns the remote address this response came from.
      Returns:
        remote address

    - #### getLocalizedErrorDescription

          public String getLocalizedErrorDescription()

      Returns the localized error description for the response.
      Returns:
        localized error description

    - #### toString

          public String toString()

      Overrides:
        `toString` in class `SnmpField`

    - #### getParsedVersion

          public SnmpVersionType getParsedVersion()

      Returns the parsed version of the response.
      Returns:
        SNMP version

    - #### getParsedCommunity

          public String getParsedCommunity()

      Returns the parsed community name of the response.
      Returns:
        SNMP community name

    - #### decrypt

          public boolean decrypt(SnmpTarget target)

      Decrypts the response based on the passed in target. As a side effect the `datagramBytes` field will be cleared out because it is no longer needed.
      Parameters:
        `target` - SNMP target
      Returns:
        true if the decryption was successful

    - #### getPdu

          public SnmpPdu getPdu()

    - #### getPduTrapV1

          public SnmpPduTrapV1 getPduTrapV1()

Copyright © 2014. All Rights Reserved.