/** * Checks the passed msg flags according to the rules specified in RFC 2572. * @param msgFlags The msg flags. */ public static void checkSecurityLevel(byte msgFlags) throws SnmpBadSecurityLevelException { int secLevel = msgFlags & SnmpDefinitions.authPriv; if((secLevel & SnmpDefinitions.privMask) != 0) if((secLevel & SnmpDefinitions.authMask) == 0) { throw new SnmpBadSecurityLevelException("Security level:"+ " noAuthPriv!!!"); } }
/** * Decodes the specified bytes and initializes the request with the incoming message. * * @param inputBytes The bytes to be decoded. * * @exception SnmpStatusException If the specified bytes are not a valid encoding or if the security applied to this request failed and no report is to be sent (typically trap PDU). */ public void decodeMessage(byte[] inputBytes, int byteCount, InetAddress address, int port) throws SnmpStatusException, SnmpUnknownSecModelException, SnmpBadSecurityLevelException;
/** * Encodes the message to send and puts the result in the specified byte array. * * @param outputBytes An array to receive the resulting encoding. * * @exception ArrayIndexOutOfBoundsException If the result does not fit * into the specified array. */ public int encodeMessage(byte[] outputBytes) throws SnmpStatusException, SnmpTooBigException, SnmpSecurityException, SnmpUnknownSecModelException, SnmpBadSecurityLevelException;