org.apache.directory.server.kerberos.shared.messages.value
Class HostAddress

java.lang.Object
  extended by org.apache.directory.shared.asn1.AbstractAsn1Object
      extended by org.apache.directory.server.kerberos.shared.messages.value.HostAddress
All Implemented Interfaces:
org.apache.directory.shared.asn1.Asn1Object

public class HostAddress
extends org.apache.directory.shared.asn1.AbstractAsn1Object

Provides host address information. The ASN.1 grammaor for this structure is : HostAddress ::= SEQUENCE { addr-type [0] Int32, address [1] OCTET STRING }

Version:
$Rev: 902575 $, $Date: 2010-01-24 15:38:06 +0100 (Sun, 24 Jan 2010) $
Author:
Apache Directory Project

Field Summary
 
Fields inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
parent
 
Constructor Summary
HostAddress(HostAddrType addrType, byte[] address)
          Creates a new instance of HostAddress.
HostAddress(java.net.InetAddress internetAddress)
          Creates a new instance of HostAddress.
 
Method Summary
 int computeLength()
          Compute the host address length HostAddress : 0x30 L1 hostAddress sequence | +--> 0xA0 L2 addrType tag | | | +--> 0x02 L2-1 addrType (int) | +--> 0xA1 L3 address tag | +--> 0x04 L3-1 address (OCTET STRING) where L1 = L2 + length(0xA0) + length(L2) + L3 + length(0xA1) + length(L3) and L2 = L2-1 + length(0x02) + length( L2-1) L3 = L3-1 + length(0x04) + length( L3-1)
 java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
          Encode the HostAddress message to a PDU.
 boolean equals(java.lang.Object that)
          Returns whether one HostAddress is equal to another.
 byte[] getAddress()
          Get the bytes for this address.
 HostAddrType getAddrType()
          Returns the HostAddrType of this HostAddress.
 void setAddress(byte[] addresse)
          Set the address
 void setAddrType(HostAddrType addrType)
          Set the addr-type field
 void setAddrType(int addrType)
          Set the addr-type field
 java.lang.String toString()
           
 
Methods inherited from class org.apache.directory.shared.asn1.AbstractAsn1Object
addLength, getCurrentLength, getExpectedLength, getParent, getTlvId, setCurrentLength, setExpectedLength, setParent
 
Methods inherited from class java.lang.Object
clone, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

HostAddress

public HostAddress(HostAddrType addrType,
                   byte[] address)
Creates a new instance of HostAddress.

Parameters:
addrType -
address -

HostAddress

public HostAddress(java.net.InetAddress internetAddress)
Creates a new instance of HostAddress.

Parameters:
internetAddress -
Method Detail

equals

public boolean equals(java.lang.Object that)
Returns whether one HostAddress is equal to another.

Overrides:
equals in class java.lang.Object
Parameters:
that - The HostAddress to compare with
Returns:
true if the HostAddress's are equal.

getAddress

public byte[] getAddress()
Get the bytes for this address.

Returns:
The bytes of this address.

setAddress

public void setAddress(byte[] addresse)
Set the address

Parameters:
addresse - The address

computeLength

public int computeLength()
Compute the host address length HostAddress : 0x30 L1 hostAddress sequence | +--> 0xA0 L2 addrType tag | | | +--> 0x02 L2-1 addrType (int) | +--> 0xA1 L3 address tag | +--> 0x04 L3-1 address (OCTET STRING) where L1 = L2 + length(0xA0) + length(L2) + L3 + length(0xA1) + length(L3) and L2 = L2-1 + length(0x02) + length( L2-1) L3 = L3-1 + length(0x04) + length( L3-1)

Specified by:
computeLength in interface org.apache.directory.shared.asn1.Asn1Object
Specified by:
computeLength in class org.apache.directory.shared.asn1.AbstractAsn1Object

encode

public java.nio.ByteBuffer encode(java.nio.ByteBuffer buffer)
                           throws org.apache.directory.shared.asn1.codec.EncoderException
Encode the HostAddress message to a PDU. HostAddress : 0x30 LL 0xA0 LL 0x02 0x01 addr-type 0xA1 LL 0x04 LL address

Specified by:
encode in interface org.apache.directory.shared.asn1.Asn1Object
Overrides:
encode in class org.apache.directory.shared.asn1.AbstractAsn1Object
Parameters:
buffer - The buffer where to put the PDU. It should have been allocated before, with the right size.
Returns:
The constructed PDU.
Throws:
org.apache.directory.shared.asn1.codec.EncoderException

getAddrType

public HostAddrType getAddrType()
Returns the HostAddrType of this HostAddress.

Returns:
The HostAddrType.

setAddrType

public void setAddrType(HostAddrType addrType)
Set the addr-type field

Parameters:
addrType - The address type

setAddrType

public void setAddrType(int addrType)
Set the addr-type field

Parameters:
addrType - The address type

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object
See Also:
Object.toString()


Copyright © 2003-2011 Apache Software Foundation. All Rights Reserved.