Authentication
API v8.1 SP2

com.rsa.ace.techservice.udpserver
Class AcePacketTrailer

java.lang.Object
  extended by com.rsa.ace.techservice.udpserver.AcePacketTrailer

public class AcePacketTrailer
extends java.lang.Object

This is a packet trailer parsing/building helper class. This is used by both requests and responses for trailer processing. It implements methods associated with processing nonce and packet CRC calculations.


Constructor Summary
AcePacketTrailer()
          Constructs an AcePacketTrailer which nonce will be initialized
AcePacketTrailer(byte[] nonce)
          Constructs a default AcePacketTrailer.
AcePacketTrailer(java.nio.ByteBuffer buf)
          Constructs an AcePacketTrailer reading bytes from the stream passed.
 
Method Summary
 boolean addNonce(java.nio.ByteBuffer respBuf)
          Adds the nonce portion of the AcePacketTrailer to the buffer passed.
 int calculateCRC(byte[] crcData, int crcDataOffset, int crcDataLength)
          Calculates the Cyclic Redundacy Check value for the trailer.
 int getCRC()
          This returns the Cyclic Redundacy Check value from the trailer.
 byte[] getNonce()
          This returns the nonce.
 int getSize()
           
 java.lang.String toString()
          Converts the AcePacketTrailer to a string.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

AcePacketTrailer

public AcePacketTrailer(byte[] nonce)
                 throws AcePacketException
Constructs a default AcePacketTrailer.

Parameters:
nonce - A request from which the nonce is taken. This may be null.
cyclicRedundancyCheck - The CRC for the trailer.
Throws:
AcePacketException - If the nonce is not the correct length.

AcePacketTrailer

public AcePacketTrailer(java.nio.ByteBuffer buf)
                 throws AcePacketException
Constructs an AcePacketTrailer reading bytes from the stream passed.

Parameters:
buf - The byte-buffer from which the header is initialized.
Throws:
AcePacketException - If the nonce is not the correct length or this is unable to get the nonce and CRC values.

AcePacketTrailer

public AcePacketTrailer()
                 throws AcePacketException
Constructs an AcePacketTrailer which nonce will be initialized

Throws:
AcePacketException
Method Detail

getNonce

public byte[] getNonce()
This returns the nonce.

Returns:
The nonce bytes.

getCRC

public int getCRC()
This returns the Cyclic Redundacy Check value from the trailer.

Returns:
The CRC.

addNonce

public boolean addNonce(java.nio.ByteBuffer respBuf)
                 throws AcePacketException
Adds the nonce portion of the AcePacketTrailer to the buffer passed. This does nothing if the original request did not have a trailer w/ nonce.

Parameters:
respBuf - The byte-buffer to which the nonce is written.
Returns:
true if a nonce was added, false if a nonce was not added.
Throws:
AcePacketException - If an error occurs adding the nonce.

calculateCRC

public int calculateCRC(byte[] crcData,
                        int crcDataOffset,
                        int crcDataLength)
Calculates the Cyclic Redundacy Check value for the trailer. Taken from a5_crc_algor.c in the 'ct_ace_base' VOB.

Parameters:
crcData - The data to be CRC'd. This should include the nonce.
crcDataOffset - The offset at which CRC calculation will start.
cdcDataLength - The number of bytes to be CRC'ed.
Returns:
The CRC for the data.

getSize

public int getSize()

toString

public java.lang.String toString()
Converts the AcePacketTrailer to a string.

Overrides:
toString in class java.lang.Object
Returns:
A String representation of the trailer.

Authentication
API v8.1 SP2

Copyright © 1999 - 2011 EMC Corporation. All Rights Reserved.