Java Doc for NbtAddress.java in  » Groupware » hipergate » com » knowgate » jcifs » netbios » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Groupware » hipergate » com.knowgate.jcifs.netbios 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   com.knowgate.jcifs.netbios.NbtAddress

NbtAddress
final public class NbtAddress (Code)
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 java.net.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 java.net.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.
author:
   Michael B. Allen
See Also:   java.net.InetAddress
since:
   jcifs-0.1


Inner Class :final static class CacheEntry

Field Summary
final static  StringANY_HOSTS_NAME
    
final public static  intB_NODE
     A B node only broadcasts name queries.
final public static  intH_NODE
     A Hybrid node tries to resolve a name using the nameserver first.
final public static  StringMASTER_BROWSER_NAME
     This is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood".
final public static  intM_NODE
     Try Broadcast queries first, then try to resolve the name using the nameserver.
final static  InetAddress[]NBNS
    
final public static  intP_NODE
     A Point-to-Point node, or P node, unicasts queries to a nameserver only.
final public static  StringSMBSERVER_NAME
     A special generic name specified when connecting to a host for which a name is not known.
final static  NbtAddressUNKNOWN_ADDRESS
    
final static  byte[]UNKNOWN_MAC_ADDRESS
    
final static  NameUNKNOWN_NAME
    
 intaddressnodeType
    
 StringcalledName
    
 booleangroupNameisBeingDeletedisInConflictisActiveisPermanentisDataFromNodeStatus
    
 NamehostName
    
static  NbtAddresslocalhost
    
 byte[]macAddress
    

Constructor Summary
 NbtAddress(Name hostName, int address, boolean groupName, int nodeType)
    
 NbtAddress(Name hostName, int address, boolean groupName, int nodeType, boolean isBeingDeleted, boolean isInConflict, boolean isActive, boolean isPermanent, byte[] macAddress)
    

Method Summary
static  voidcacheAddress(Name hostName, NbtAddress addr)
    
static  voidcacheAddress(Name hostName, NbtAddress addr, long expiration)
    
static  voidcacheAddressArray(NbtAddress[] addrs)
    
 voidcheckData()
    
 voidcheckNodeStatusData()
    
static  NbtAddressdoNameQuery(Name name, InetAddress svr)
    
public  booleanequals(Object obj)
     Determines if this address is equal two another.
public  StringfirstCalledName()
    
public  byte[]getAddress()
     Returns the raw IP address of this NbtAddress.
public static  NbtAddress[]getAllByAddress(String host)
     Retrieve all addresses of a host by it's address.
public static  NbtAddress[]getAllByAddress(String host, int type, String scope)
     Retrieve all addresses of a host by it's address.
public static  NbtAddress[]getAllByAddress(NbtAddress addr)
     Retrieve all addresses of a host by it's address.
public static  NbtAddressgetByName(String host)
     Determines the address of a host given it's host name.
public static  NbtAddressgetByName(String host, int type, String scope)
     Determines the address of a host given it's host name.
public static  NbtAddressgetByName(String host, int type, String scope, InetAddress svr)
    
static  NbtAddressgetCachedAddress(Name hostName)
    
public  StringgetHostAddress()
     Returns this IP adress as a java.lang.String in the form "%d.%d.%d.%d".
public  StringgetHostName()
     The hostname of this address.
public  InetAddressgetInetAddress()
     To convert this address to an InetAddress.
public static  NbtAddressgetLocalHost()
     Retrieves the local host address.
public  byte[]getMacAddress()
     Retrieves the MAC address of the remote network interface.
public  intgetNameType()
     Returned the hex code associated with this name(e.g.
public  intgetNodeType()
     Checks the node type of this address.
public static  InetAddressgetWINSAddress()
    
public  inthashCode()
     Returns a hashcode for this IP address.
public  booleanisActive()
     Determines if this address is active.
public  booleanisBeingDeleted()
     Determines if this address in the process of being deleted.
public  booleanisGroupAddress()
     Determines if the address is a group address.
public  booleanisInConflict()
     Determines if this address in conflict with another address.
public  booleanisPermanent()
     Determines if this address is set to be permanent.
public static  booleanisWINS(InetAddress svr)
    
public  StringnextCalledName()
    
static  InetAddressswitchWINS()
    
public  StringtoString()
     Returns the java.lang.String representaion of this address.

Field Detail
ANY_HOSTS_NAME
final static String ANY_HOSTS_NAME(Code)



B_NODE
final public static int B_NODE(Code)
A B node only broadcasts name queries. This is the default if a nameserver such as WINS or Samba is not specified.



H_NODE
final public static int H_NODE(Code)
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.



MASTER_BROWSER_NAME
final public static String MASTER_BROWSER_NAME(Code)
This is a special name for querying the master browser that serves the list of hosts found in "Network Neighborhood".



M_NODE
final public static int M_NODE(Code)
Try Broadcast queries first, then try to resolve the name using the nameserver.



NBNS
final static InetAddress[] NBNS(Code)



P_NODE
final public static int P_NODE(Code)
A Point-to-Point node, or P node, unicasts queries to a nameserver only. Natrually the jcifs.netbios.nameserver property must be set.



SMBSERVER_NAME
final public static String SMBSERVER_NAME(Code)
A special generic name specified when connecting to a host for which a name is not known. Not all servers respond to this name.



UNKNOWN_ADDRESS
final static NbtAddress UNKNOWN_ADDRESS(Code)



UNKNOWN_MAC_ADDRESS
final static byte[] UNKNOWN_MAC_ADDRESS(Code)



UNKNOWN_NAME
final static Name UNKNOWN_NAME(Code)



addressnodeType
int addressnodeType(Code)



calledName
String calledName(Code)



groupNameisBeingDeletedisInConflictisActiveisPermanentisDataFromNodeStatus
boolean groupNameisBeingDeletedisInConflictisActiveisPermanentisDataFromNodeStatus(Code)



hostName
Name hostName(Code)



localhost
static NbtAddress localhost(Code)



macAddress
byte[] macAddress(Code)




Constructor Detail
NbtAddress
NbtAddress(Name hostName, int address, boolean groupName, int nodeType)(Code)



NbtAddress
NbtAddress(Name hostName, int address, boolean groupName, int nodeType, boolean isBeingDeleted, boolean isInConflict, boolean isActive, boolean isPermanent, byte[] macAddress)(Code)




Method Detail
cacheAddress
static void cacheAddress(Name hostName, NbtAddress addr)(Code)



cacheAddress
static void cacheAddress(Name hostName, NbtAddress addr, long expiration)(Code)



cacheAddressArray
static void cacheAddressArray(NbtAddress[] addrs)(Code)



checkData
void checkData() throws UnknownHostException(Code)



checkNodeStatusData
void checkNodeStatusData() throws UnknownHostException(Code)



doNameQuery
static NbtAddress doNameQuery(Name name, InetAddress svr) throws UnknownHostException(Code)



equals
public boolean equals(Object obj)(Code)
Determines if this address is equal two another. Only the IP Addresses are compared. Similar to the NbtAddress.hashCode method, the comparison is based on the integer IP address and not the string representation.



firstCalledName
public String firstCalledName()(Code)



getAddress
public byte[] getAddress()(Code)
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



getAllByAddress
public static NbtAddress[] getAllByAddress(String host) throws UnknownHostException(Code)
Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address.
Parameters:
  host - hostname to lookup all addresses for
throws:
  java.net.UnknownHostException - if there is an error resolving the name



getAllByAddress
public static NbtAddress[] getAllByAddress(String host, int type, String scope) throws UnknownHostException(Code)
Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address. See NbtAddress.getByName for a description of type and scope.
Parameters:
  host - hostname to lookup all addresses for
Parameters:
  type - the hexcode of the name
Parameters:
  scope - the scope of the name
throws:
  java.net.UnknownHostException - if there is an error resolving the name



getAllByAddress
public static NbtAddress[] getAllByAddress(NbtAddress addr) throws UnknownHostException(Code)
Retrieve all addresses of a host by it's address. NetBIOS hosts can have many names for a given IP address. The name and IP address make the NetBIOS address. This provides a way to retrieve the other names for a host with the same IP address.
Parameters:
  addr - the address to query
throws:
  UnknownHostException - if address cannot be resolved



getByName
public static NbtAddress getByName(String host) throws UnknownHostException(Code)
Determines the address of a host given it's host name. The name can be a NetBIOS name like "freto" or an IP address like "192.168.1.15". It cannot be a DNS name; the analygous jcifs.UniAddress or java.net.InetAddress getByName methods can be used for that.
Parameters:
  host - hostname to resolve
throws:
  java.net.UnknownHostException - if there is an error resolving the name



getByName
public static NbtAddress getByName(String host, int type, String scope) throws UnknownHostException(Code)
Determines the address of a host given it's host name. NetBIOS names also have a 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.
Parameters:
  host - the name to resolve
Parameters:
  type - the hex code of the name
Parameters:
  scope - the scope of the name
throws:
  java.net.UnknownHostException - if there is an error resolving the name



getByName
public static NbtAddress getByName(String host, int type, String scope, InetAddress svr) throws UnknownHostException(Code)



getCachedAddress
static NbtAddress getCachedAddress(Name hostName)(Code)



getHostAddress
public String getHostAddress()(Code)
Returns this IP adress as a java.lang.String in the form "%d.%d.%d.%d".



getHostName
public String getHostName()(Code)
The hostname of this address. If the hostname is null the local machines IP address is returned. the text representation of the hostname associated with this address



getInetAddress
public InetAddress getInetAddress() throws UnknownHostException(Code)
To convert this address to an InetAddress. the java.net.InetAddress representation of this address.



getLocalHost
public static NbtAddress getLocalHost() throws UnknownHostException(Code)
Retrieves the local host address.
throws:
  UnknownHostException - This is not likely as the IP returnedby InetAddress should be available



getMacAddress
public byte[] getMacAddress() throws UnknownHostException(Code)
Retrieves the MAC address of the remote network interface. Samba returns all zeros. the MAC address as an array of six bytes
throws:
  UnknownHostException - if the host cannot be resolved todetermine the MAC address.



getNameType
public int getNameType()(Code)
Returned the hex code associated with this name(e.g. 0x20 is for the file service)



getNodeType
public int getNodeType() throws UnknownHostException(Code)
Checks the node type of this address. jcifs.netbios.NbtAddress.B_NODE,jcifs.netbios.NbtAddress.P_NODE, jcifs.netbios.NbtAddress.M_NODE,jcifs.netbios.NbtAddress.H_NODE
throws:
  UnknownHostException - if the host cannot be resolved to find out.



getWINSAddress
public static InetAddress getWINSAddress()(Code)



hashCode
public int hashCode()(Code)
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.



isActive
public boolean isActive() throws UnknownHostException(Code)
Determines if this address is active.
throws:
  UnknownHostException - if the host cannot be resolved to find out.



isBeingDeleted
public boolean isBeingDeleted() throws UnknownHostException(Code)
Determines if this address in the process of being deleted.
throws:
  UnknownHostException - if the host cannot be resolved to find out.



isGroupAddress
public boolean isGroupAddress() throws UnknownHostException(Code)
Determines if the address is a group address. This is also known as a workgroup name or group name.
throws:
  UnknownHostException - if the host cannot be resolved to find out.



isInConflict
public boolean isInConflict() throws UnknownHostException(Code)
Determines if this address in conflict with another address.
throws:
  UnknownHostException - if the host cannot be resolved to find out.



isPermanent
public boolean isPermanent() throws UnknownHostException(Code)
Determines if this address is set to be permanent.
throws:
  UnknownHostException - if the host cannot be resolved to find out.



isWINS
public static boolean isWINS(InetAddress svr)(Code)



nextCalledName
public String nextCalledName()(Code)



switchWINS
static InetAddress switchWINS()(Code)



toString
public String toString()(Code)
Returns the java.lang.String representaion of this address.



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.