クラス NbtAddress
- java.lang.Object
-
- jcifs.netbios.NbtAddress
-
- すべての実装されたインタフェース:
Address,NetbiosAddress
public final class NbtAddress extends Object implements NetbiosAddress
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, andgetAllByAddressto create a new NbtAddress instance. This class is symmetric withInetAddress.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-3BThe hostname of this machine is
JMORRIS2. It is a member of the group(a.k.a workgroup and domain)BILLING-NY. To obtain anInetAddressfor 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
nmblookuputility.- 導入されたバージョン:
- jcifs-0.1
- 作成者:
- Michael B. Allen
- 関連項目:
InetAddress
-
-
フィールドの概要
フィールド 修飾子とタイプ フィールド 説明 static StringANY_HOSTS_NAMEThis is a special name that means all hosts.static intB_NODEA B node only broadcasts name queries.static intH_NODEA Hybrid node tries to resolve a name using the nameserver first.static intM_NODETry Broadcast queries first, then try to resolve the name using the nameserver.static StringMASTER_BROWSER_NAMEThis is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood".static intP_NODEA Point-to-Point node, or P node, unicasts queries to a nameserver only.static StringSMBSERVER_NAMEA special generic name specified when connecting to a host for which a name is not known.static byte[]UNKNOWN_MAC_ADDRESSUnknown MAC Address
-
メソッドの概要
すべてのメソッド インスタンス・メソッド concreteメソッド 修飾子とタイプ メソッド 説明 booleanequals(Object obj)Determines if this address is equal two another.StringfirstCalledName()Guess next called name to try for session establishment.byte[]getAddress()Returns the raw IP address of this NbtAddress.StringgetHostAddress()Returns this IP adress as aStringin the form "%d.StringgetHostName()The hostname of this address.InetAddressgetInetAddress()To convert this address to anInetAddress.byte[]getMacAddress(CIFSContext tc)Retrieves the MAC address of the remote network interface.NetbiosNamegetName()intgetNameType()Returned the hex code associated with this name(e.g. 0x20 is for the file service)intgetNodeType(CIFSContext tc)Checks the node type of this address.inthashCode()Returns a hashcode for this IP address.booleanisActive(CIFSContext tc)Determines if this address is active.booleanisBeingDeleted(CIFSContext tc)Determines if this address in the process of being deleted.booleanisGroupAddress(CIFSContext tc)Determines if the address is a group address.booleanisInConflict(CIFSContext tc)Determines if this address in conflict with another address.booleanisPermanent(CIFSContext tc)Determines if this address is set to be permanent.StringnextCalledName(CIFSContext tc)Guess next called name to try for session establishment.InetAddresstoInetAddress()StringtoString()Returns theStringrepresentaion of this address.<T extends Address>
Tunwrap(Class<T> type)
-
-
-
フィールドの詳細
-
ANY_HOSTS_NAME
public static final String ANY_HOSTS_NAME
This is a special name that means all hosts. If you wish to find all hosts on a network querying a workgroup group name is the preferred method.- 関連項目:
- 定数フィールド値
-
MASTER_BROWSER_NAME
public static final String MASTER_BROWSER_NAME
This is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood".- 関連項目:
- 定数フィールド値
-
SMBSERVER_NAME
public static final String SMBSERVER_NAME
A special generic name specified when connecting to a host for which a name is not known. Not all servers respond to this name.- 関連項目:
- 定数フィールド値
-
B_NODE
public static final int B_NODE
A B node only broadcasts name queries. This is the default if a nameserver such as WINS or Samba is not specified.- 関連項目:
- 定数フィールド値
-
P_NODE
public static final int P_NODE
A Point-to-Point node, or P node, unicasts queries to a nameserver only. Natrually thejcifs.netbios.nameserverproperty must be set.- 関連項目:
- 定数フィールド値
-
M_NODE
public static final int M_NODE
Try Broadcast queries first, then try to resolve the name using the nameserver.- 関連項目:
- 定数フィールド値
-
H_NODE
public static final int H_NODE
A Hybrid node tries to resolve a name using the nameserver first. If that fails use the broadcast address. This is the default if a nameserver is provided. This is the behavior of Microsoft Windows machines.- 関連項目:
- 定数フィールド値
-
UNKNOWN_MAC_ADDRESS
public static final byte[] UNKNOWN_MAC_ADDRESS
Unknown MAC Address
-
-
メソッドの詳細
-
unwrap
public <T extends Address> T unwrap(Class<T> type)
- 定義:
unwrapインタフェース内Address- 戻り値:
- instance for type, null if the type cannot be unwrapped
- 関連項目:
Address.unwrap(java.lang.Class)
-
firstCalledName
public String firstCalledName()
Guess next called name to try for session establishment. These methods are used by the smb package.- 定義:
firstCalledNameインタフェース内Address- 戻り値:
- guessed name
-
nextCalledName
public String nextCalledName(CIFSContext tc)
インタフェースからコピーされた説明:AddressGuess next called name to try for session establishment. These methods are used by the smb package.- 定義:
nextCalledNameインタフェース内Address- パラメータ:
tc- context to use- 戻り値:
- net name to try
-
isGroupAddress
public boolean isGroupAddress(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressDetermines if the address is a group address. This is also known as a workgroup name or group name.- 定義:
isGroupAddressインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
- whether the given address is a group address
- 例外:
UnknownHostException- if the host cannot be resolved to find out.
-
getNodeType
public int getNodeType(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressChecks the node type of this address.- 定義:
getNodeTypeインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
B_NODE,P_NODE,M_NODE,H_NODE- 例外:
UnknownHostException- if the host cannot be resolved to find out.
-
isBeingDeleted
public boolean isBeingDeleted(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressDetermines if this address in the process of being deleted.- 定義:
isBeingDeletedインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
- whether this address is in the process of being deleted
- 例外:
UnknownHostException- if the host cannot be resolved to find out.
-
isInConflict
public boolean isInConflict(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressDetermines if this address in conflict with another address.- 定義:
isInConflictインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
- whether this address is in conflict with another address
- 例外:
UnknownHostException- if the host cannot be resolved to find out.
-
isActive
public boolean isActive(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressDetermines if this address is active.- 定義:
isActiveインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
- whether this address is active
- 例外:
UnknownHostException- if the host cannot be resolved to find out.
-
isPermanent
public boolean isPermanent(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressDetermines if this address is set to be permanent.- 定義:
isPermanentインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
- whether this address is permanent
- 例外:
UnknownHostException- if the host cannot be resolved to find out.
-
getMacAddress
public byte[] getMacAddress(CIFSContext tc) throws UnknownHostException
インタフェースからコピーされた説明:NetbiosAddressRetrieves the MAC address of the remote network interface. Samba returns all zeros.- 定義:
getMacAddressインタフェース内NetbiosAddress- パラメータ:
tc- context to use- 戻り値:
- the MAC address as an array of six bytes
- 例外:
UnknownHostException- if the host cannot be resolved to determine the MAC address.
-
getHostName
public String getHostName()
The hostname of this address. If the hostname is null the local machines IP address is returned.- 定義:
getHostNameインタフェース内Address- 戻り値:
- the text representation of the hostname associated with this address
-
getName
public NetbiosName getName()
- 定義:
getNameインタフェース内NetbiosAddress- 戻り値:
- the name for this address
-
getAddress
public byte[] getAddress()
Returns the raw IP address of this NbtAddress. The result is in network byte order: the highest order byte of the address is in getAddress()[0].- 戻り値:
- a four byte array
-
getInetAddress
public InetAddress getInetAddress() throws UnknownHostException
To convert this address to anInetAddress.- 戻り値:
- the
InetAddressrepresentation of this address. - 例外:
UnknownHostException
-
toInetAddress
public InetAddress toInetAddress() throws UnknownHostException
- 定義:
toInetAddressインタフェース内Address- 戻り値:
- this address as an InetAddress
- 例外:
UnknownHostException
-
getHostAddress
public String getHostAddress()
Returns this IP adress as aStringin the form "%d.%d.%d.%d".- 定義:
getHostAddressインタフェース内Address- 戻り値:
- string representation of the IP address
-
getNameType
public int getNameType()
インタフェースからコピーされた説明:NetbiosAddressReturned the hex code associated with this name(e.g. 0x20 is for the file service)- 定義:
getNameTypeインタフェース内NetbiosAddress- 戻り値:
- the name type
-
hashCode
public int hashCode()
Returns a hashcode for this IP address. The hashcode comes from the IP address and is not generated from the string representation. So because NetBIOS nodes can have many names, all names associated with an IP will have the same hashcode.
-
equals
public boolean equals(Object obj)
Determines if this address is equal two another. Only the IP Addresses are compared. Similar to thehashCode()method, the comparison is based on the integer IP address and not the string representation.
-
-