NIST SIP Parser and Stack (v1.2) API

gov.nist.core
Class Host

java.lang.Object
  |
  +--gov.nist.core.GenericObject
        |
        +--gov.nist.core.Host

public class Host
extends GenericObject

Stores hostname.

Version:
JAIN-SIP-1.1
Author:
M. Ranganathan , Emil Ivov IPV6 Support.
This code is in the public domain. IPv6 Support added by Emil Ivov (emil_ivov@yahoo.com)
Network Research Team (http://www-r2.u-strasbg.fr))
Louis Pasteur University - Strasbourg - France
Marc Bednarek (Bugfixes).

Constructor Summary
Host()
          default constructor
Host(String hostName)
          Constructor given host name or IP address.
Host(String name, int addrType)
          constructor
 
Method Summary
 Object clone()
          Make a clone of this object.
 String encode()
          Return the host name in encoded form.
 boolean equals(Object obj)
          Compare for equality of hosts.
 String getAddress()
          get the Address field
 String getHostname()
          get the HostName field
 InetAddress getInetAddress()
          Get the inet address from this host.
 String getIpAddress()
          Convenience function to get the raw IP destination address of a SIP message as a String.
 boolean isHostname()
          Return true if the address is a DNS host name (and not an IPV4 address)
 boolean isIPAddress()
          Return true if the address is a DNS host name (and not an IPV4 address)
 void setAddress(String address)
          Set the address member
 void setHostAddress(String address)
          Set the IP Address.
 void setHostname(String h)
          Set the hostname member.
 
Methods inherited from class gov.nist.core.GenericObject
debugDump, debugDump, getClassFromName, getMatcher, isMySubclass, match, merge, replace, replace, replace, replace, setMatcher
 
Methods inherited from class java.lang.Object
getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Host

public Host()
default constructor


Host

public Host(String hostName)
     throws IllegalArgumentException
Constructor given host name or IP address.


Host

public Host(String name,
            int addrType)
constructor

Parameters:
name - String to set
addrType - int to set
Method Detail

encode

public String encode()
Return the host name in encoded form.

Specified by:
encode in class GenericObject
Returns:
String

equals

public boolean equals(Object obj)
Compare for equality of hosts. Host names are compared by textual equality. No dns lookup is performed.

Overrides:
equals in class GenericObject
Parameters:
obj - Object to set
Returns:
boolean

getHostname

public String getHostname()
get the HostName field

Returns:
String

getAddress

public String getAddress()
get the Address field

Returns:
String

getIpAddress

public String getIpAddress()
Convenience function to get the raw IP destination address of a SIP message as a String.

Returns:
String

setHostname

public void setHostname(String h)
Set the hostname member.

Parameters:
h - String to set

setHostAddress

public void setHostAddress(String address)
Set the IP Address.

Parameters:
address - is the address string to set.

setAddress

public void setAddress(String address)
Set the address member

Parameters:
address - address String to set

isHostname

public boolean isHostname()
Return true if the address is a DNS host name (and not an IPV4 address)

Returns:
true if the hostname is a DNS name

isIPAddress

public boolean isIPAddress()
Return true if the address is a DNS host name (and not an IPV4 address)

Returns:
true if the hostname is host address.

getInetAddress

public InetAddress getInetAddress()
                           throws UnknownHostException
Get the inet address from this host. Caches the inet address returned from dns lookup to avoid lookup delays.

Throws:
UnkownHostexception - when the host name cannot be resolved.
UnknownHostException

clone

public Object clone()
Description copied from class: GenericObject
Make a clone of this object.

Overrides:
clone in class GenericObject

NIST SIP Parser and Stack (v1.2) API

A product of the NIST/ITL Advanced Networking Technologies Division.
See conditions of use.
Get the latest distribution.
Submit a bug report or feature request.