|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object jcifs.netbios.NbtAddress
This class represents a NetBIOS over TCP/IP address. Under normal conditions, users of jCIFS need not be concerned with this class as name resolution and session services are handled internally by the smb package.
Applications can use the methods getLocalHost
,
getByName
, and
getAllByAddress
to create a new NbtAddress instance. This
class is symmetric with InetAddress
.
About NetBIOS: The NetBIOS name service is a dynamic distributed service that allows hosts to resolve names by broadcasting a query, directing queries to a server such as Samba or WINS. NetBIOS is currently the primary networking layer for providing name service, datagram service, and session service to the Microsoft Windows platform. A NetBIOS name can be 15 characters long and hosts usually registers several names on the network. From a Windows command prompt you can see what names a host registers with the nbtstat command.
C:\>nbtstat -a 192.168.1.15 NetBIOS Remote Machine Name Table Name Type Status --------------------------------------------- JMORRIS2 <00> UNIQUE Registered BILLING-NY <00> GROUP Registered JMORRIS2 <03> UNIQUE Registered JMORRIS2 <20> UNIQUE Registered BILLING-NY <1E> GROUP Registered JMORRIS <03> UNIQUE Registered MAC Address = 00-B0-34-21-FA-3B
The hostname of this machine is JMORRIS2
. It is
a member of the group(a.k.a workgroup and domain) BILLING-NY
. To
obtain an InetAddress
for a host one might do:
InetAddress addr = NbtAddress.getByName( "jmorris2" ).getInetAddress();
From a UNIX platform with Samba installed you can perform similar
diagnostics using the nmblookup
utility.
InetAddress
Field Summary | |
static int |
B_NODE
A B node only broadcasts name queries. |
static int |
H_NODE
A Hybrid node tries to resolve a name using the nameserver first. |
static int |
M_NODE
Try Broadcast queries first, then try to resolve the name using the nameserver. |
static java.lang.String |
MASTER_BROWSER_NAME
This is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood". |
static int |
P_NODE
A Point-to-Point node, or P node, unicasts queries to a nameserver only. |
static java.lang.String |
SMBSERVER_NAME
A special generic name specified when connecting to a host for which a name is not known. |
Method Summary | |
boolean |
equals(java.lang.Object obj)
Determines if this address is equal two another. |
java.lang.String |
firstCalledName()
|
byte[] |
getAddress()
Returns the raw IP address of this NbtAddress. |
static NbtAddress[] |
getAllByAddress(NbtAddress addr)
Retrieve all addresses of a host by it's address. |
static NbtAddress[] |
getAllByAddress(java.lang.String host)
Retrieve all addresses of a host by it's address. |
static NbtAddress[] |
getAllByAddress(java.lang.String host,
int type,
java.lang.String scope)
Retrieve all addresses of a host by it's address. |
static NbtAddress[] |
getAllByName(java.lang.String host,
int type,
java.lang.String scope,
java.net.InetAddress svr)
|
static NbtAddress |
getByName(java.lang.String host)
Determines the address of a host given it's host name. |
static NbtAddress |
getByName(java.lang.String host,
int type,
java.lang.String scope)
Determines the address of a host given it's host name. |
static NbtAddress |
getByName(java.lang.String host,
int type,
java.lang.String scope,
java.net.InetAddress svr)
|
java.lang.String |
getHostAddress()
Returns this IP adress as a String in the form "%d.%d.%d.%d". |
java.lang.String |
getHostName()
The hostname of this address. |
java.net.InetAddress |
getInetAddress()
To convert this address to an InetAddress . |
static NbtAddress |
getLocalHost()
Retrieves the local host address. |
static Name |
getLocalName()
|
byte[] |
getMacAddress()
Retrieves the MAC address of the remote network interface. |
int |
getNameType()
Returned the hex code associated with this name(e.g. |
int |
getNodeType()
Checks the node type of this address. |
static java.net.InetAddress |
getWINSAddress()
|
int |
hashCode()
Returns a hashcode for this IP address. |
boolean |
isActive()
Determines if this address is active. |
boolean |
isBeingDeleted()
Determines if this address in the process of being deleted. |
boolean |
isGroupAddress()
Determines if the address is a group address. |
boolean |
isInConflict()
Determines if this address in conflict with another address. |
boolean |
isPermanent()
Determines if this address is set to be permanent. |
static boolean |
isWINS(java.net.InetAddress svr)
|
java.lang.String |
nextCalledName()
|
java.lang.String |
toString()
Returns the String representaion of this address. |
Methods inherited from class java.lang.Object |
clone, finalize, getClass, notify, notifyAll, wait, wait, wait |
Field Detail |
public static final java.lang.String MASTER_BROWSER_NAME
public static final java.lang.String SMBSERVER_NAME
public static final int B_NODE
public static final int P_NODE
jcifs.netbios.nameserver
property must
be set.
public static final int M_NODE
public static final int H_NODE
Method Detail |
public static NbtAddress getLocalHost() throws java.net.UnknownHostException
java.net.UnknownHostException
- This is not likely as the IP returned
by InetAddress
should be availablepublic static Name getLocalName()
public static NbtAddress getByName(java.lang.String host) throws java.net.UnknownHostException
UniAddress
or InetAddress
getByName
methods can be used for that.
host
- hostname to resolve
java.net.UnknownHostException
- if there is an error resolving the namepublic static NbtAddress getByName(java.lang.String host, int type, java.lang.String scope) throws java.net.UnknownHostException
type
. Types(aka Hex Codes)
are used to distiquish the various services on a host. Here is
a fairly complete list of NetBIOS hex codes. Scope is not used but is
still functional in other NetBIOS products and so for completeness it has been
implemented. A scope
of null
or ""
signifies no scope.
host
- the name to resolvetype
- the hex code of the namescope
- the scope of the name
java.net.UnknownHostException
- if there is an error resolving the namepublic static NbtAddress getByName(java.lang.String host, int type, java.lang.String scope, java.net.InetAddress svr) throws java.net.UnknownHostException
java.net.UnknownHostException
public static NbtAddress[] getAllByName(java.lang.String host, int type, java.lang.String scope, java.net.InetAddress svr) throws java.net.UnknownHostException
java.net.UnknownHostException
public static NbtAddress[] getAllByAddress(java.lang.String host) throws java.net.UnknownHostException
host
- hostname to lookup all addresses for
java.net.UnknownHostException
- if there is an error resolving the namepublic static NbtAddress[] getAllByAddress(java.lang.String host, int type, java.lang.String scope) throws java.net.UnknownHostException
getByName(java.lang.String)
for a description of type
and scope
.
host
- hostname to lookup all addresses fortype
- the hexcode of the namescope
- the scope of the name
java.net.UnknownHostException
- if there is an error resolving the namepublic static NbtAddress[] getAllByAddress(NbtAddress addr) throws java.net.UnknownHostException
addr
- the address to query
java.net.UnknownHostException
- if address cannot be resolvedpublic static java.net.InetAddress getWINSAddress()
public static boolean isWINS(java.net.InetAddress svr)
public java.lang.String firstCalledName()
public java.lang.String nextCalledName()
public boolean isGroupAddress() throws java.net.UnknownHostException
java.net.UnknownHostException
- if the host cannot be resolved to find out.public int getNodeType() throws java.net.UnknownHostException
B_NODE
,
P_NODE
, M_NODE
,
H_NODE
java.net.UnknownHostException
- if the host cannot be resolved to find out.public boolean isBeingDeleted() throws java.net.UnknownHostException
java.net.UnknownHostException
- if the host cannot be resolved to find out.public boolean isInConflict() throws java.net.UnknownHostException
java.net.UnknownHostException
- if the host cannot be resolved to find out.public boolean isActive() throws java.net.UnknownHostException
java.net.UnknownHostException
- if the host cannot be resolved to find out.public boolean isPermanent() throws java.net.UnknownHostException
java.net.UnknownHostException
- if the host cannot be resolved to find out.public byte[] getMacAddress() throws java.net.UnknownHostException
java.net.UnknownHostException
- if the host cannot be resolved to
determine the MAC address.public java.lang.String getHostName()
public byte[] getAddress()
public java.net.InetAddress getInetAddress() throws java.net.UnknownHostException
InetAddress
.
InetAddress
representation of this address.
java.net.UnknownHostException
public java.lang.String getHostAddress()
String
in the form "%d.%d.%d.%d".
public int getNameType()
public int hashCode()
public boolean equals(java.lang.Object obj)
hashCode()
method, the comparison
is based on the integer IP address and not the string representation.
public java.lang.String toString()
String
representaion of this address.
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |