OpenNMS API 1.2.9

## org.opennms.netmgt.capsd
Class IfSmbCollector

    java.lang.Object
      org.opennms.netmgt.capsd.IfSmbCollector

All Implemented Interfaces:
  java.lang.Runnable

final class IfSmbCollector
extends java.lang.Object
implements java.lang.Runnable

This class is designed to collect the necessary SMB information from the target address and store the collected information. When the class is initially constructed no information is collected.

Author:
  Weave , Mike , OpenNMS

Field Summary
`private jcifs.netbios.NbtAddress` `m_addr` The primary NetBIOS address.
`private jcifs.netbios.NbtAddress[]` `m_allAddrs` The list of all the NetBIOS addresses for the target IP.
`private java.lang.String` `m_domain` The domain name.
`private boolean` `m_hasExchange` True if the box has MS Exchange running.
`private boolean` `m_isSamba` This value is set of the node supports SMB.
`private java.lang.String` `m_mac` The collected media access control address.
`private java.lang.String` `m_osName` The operating system name of the remote box, if it can be recovered.
`private java.lang.String[]` `m_shares` The list of available shares on the SMB box, if any
`private java.net.InetAddress` `m_target` The target internet address to test for SMB support
`private static java.lang.String` `SAMBA_MAC` The MAC address that is returned from a Samba server

Constructor Summary
`private` `IfSmbCollector()` The default constructor.
`(package private)` `IfSmbCollector(java.net.InetAddress target)` Constructs a new SMB collector targeted at the passed address.
`(package private)` `IfSmbCollector(java.net.InetAddress target, boolean hasExchange)` Constructs a new SMB collector targeted at the passed address.

Method Summary
`(package private) boolean` `containsCtrlChars(java.lang.String nbName)` This method inspects the provided netBIOS name for control characters (chars w/ decimal value less than 20/ <SPACE>
`(package private) jcifs.netbios.NbtAddress[]` `getAllNbtAddresses()` Returns the list of all NetBIOS names recovered from the target node.
`(package private) java.lang.String` `getDomainName()` Returns the domain name associated with this NetBIOS address
`(package private) java.lang.String` `getMAC()` Returns the MAC address, if present.
`(package private) jcifs.netbios.NbtAddress` `getNbtAddress()` Returns the primary NetBIOS address for the target if it was recovered.
`(package private) java.lang.String` `getNbtName()` Retrns the NetBIOS name associated with the primary NetBIOS address.
`(package private) java.lang.String` `getOS()` Returns the naem of the Operating System if it was recovered.
`(package private) java.lang.String[]` `getShares()` Returns the list of all available shares on the target if the call succeeded.
`(package private) java.net.InetAddress` `getTarget()` Returns the current target of this collection.
`(package private) boolean` `hasExchange()` Returns the presence of an exchange server.
`(package private) boolean` `isSamba()` Returns true if the target is a SAMBA server.
`void` `run()` The main execution method used to collect the SMB information for the collector.
`private java.lang.String` `toMacString(byte[] mac)` This method is used to convert a 6 byte MAC address into a colon separated string.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Field Detail

### SAMBA_MAC

    private static final java.lang.String SAMBA_MAC

  The MAC address that is returned from a Samba server

  See Also:
    Constant Field Values

### m_target

    private final java.net.InetAddress m_target

  The target internet address to test for SMB support

### m_isSamba

    private boolean m_isSamba

  This value is set of the node supports SMB.

### m_mac

    private java.lang.String m_mac

  The collected media access control address.

### m_domain

    private java.lang.String m_domain

  The domain name.

### m_addr

    private jcifs.netbios.NbtAddress m_addr

  The primary NetBIOS address.

### m_allAddrs

    private jcifs.netbios.NbtAddress[] m_allAddrs

  The list of all the NetBIOS addresses for the target IP.

### m_shares

    private java.lang.String[] m_shares

  The list of available shares on the SMB box, if any

### m_osName

    private java.lang.String m_osName

  The operating system name of the remote box, if it can be recovered.

### m_hasExchange

    private final boolean m_hasExchange

  True if the box has MS Exchange running. This is set in the constructor.

Constructor Detail

### IfSmbCollector

    private IfSmbCollector()

  The default constructor. This constructor is marked as private to disallows creation without an IP address. In addtion this constructo will alwasy throw an exception.

Throws:
  `java.lang.UnsupportedOperationException` - Always thrown.

### IfSmbCollector

    IfSmbCollector(java.net.InetAddress target)

  Constructs a new SMB collector targeted at the passed address. The presence of an Exchange server is set to false.

Parameters:
  `target` - The target IP address.

### IfSmbCollector

    IfSmbCollector(java.net.InetAddress target,
                   boolean hasExchange)

  Constructs a new SMB collector targeted at the passed address. The presence of an Exchange server is set to passed value.

Parameters:
  `target` - The target IP address.
  `hasExchange` - Sets the presence or absence of an exchange server.

Method Detail

### toMacString

    private java.lang.String toMacString(byte[] mac)

  This method is used to convert a 6 byte MAC address into a colon separated string.

  Parameters:
    `mac` - The 6 byte MAC address
  Returns:
    The formatted MAC address.

### getTarget

    java.net.InetAddress getTarget()

  Returns the current target of this collection.

### isSamba

    boolean isSamba()

  Returns true if the target is a SAMBA server.

### getMAC

    java.lang.String getMAC()

  Returns the MAC address, if present.

### getNbtAddress

    jcifs.netbios.NbtAddress getNbtAddress()

  Returns the primary NetBIOS address for the target if it was recovered.

### getNbtName

    java.lang.String getNbtName()

  Retrns the NetBIOS name associated with the primary NetBIOS address.

### getDomainName

    java.lang.String getDomainName()

  Returns the domain name associated with this NetBIOS address

### getAllNbtAddresses

    jcifs.netbios.NbtAddress[] getAllNbtAddresses()

  Returns the list of all NetBIOS names recovered from the target node.

### getShares

    java.lang.String[] getShares()

  Returns the list of all available shares on the target if the call succeeded. If the call failed then a null or empty list is return.

### getOS

    java.lang.String getOS()

  Returns the naem of the Operating System if it was recovered.

### hasExchange

    boolean hasExchange()

  Returns the presence of an exchange server. This is the same value as set in the class' constructor.

### containsCtrlChars

    boolean containsCtrlChars(java.lang.String nbName)

  This method inspects the provided netBIOS name for control characters (chars w/ decimal value less than 20/ <SPACE>

  Parameters:
    `nbName` - NetBIOS name to check
  Returns:
    true if string contains control chars, false otherwise.

### run

    public void run()

  The main execution method used to collect the SMB information for the collector.

  Specified by:
    `run` in interface `java.lang.Runnable`

OpenNMS API 1.2.9

Generated by ranger on May 19 2007 2335.