Module jcifs

Class SmbNamedPipe


public class SmbNamedPipe extends SmbFile
This class will allow a Java program to read and write data to Named Pipes and Transact NamedPipes.

There are three Win32 function calls provided by the Windows SDK that are important in the context of using jCIFS. They are:

  • CallNamedPipe A message-type pipe call that opens, writes to, reads from, and closes the pipe in a single operation.
  • TransactNamedPipe A message-type pipe call that writes to and reads from an existing pipe descriptor in one operation.
  • CreateFile, ReadFile, WriteFile, and CloseFile A byte-type pipe can be opened, written to, read from and closed using the standard Win32 file operations.

The jCIFS API maps all of these operations into the standard Java XxxputStream interface. A special PIPE_TYPE flags is necessary to distinguish which type of Named Pipe behavior is desired.

SmbNamedPipe Constructor Examples
SmbNamedPipe Constructor Examples
Code SampleDescription
 new SmbNamedPipe( "smb1://server/IPC$/PIPE/foo",
         SmbNamedPipe.PIPE_TYPE_RDWR |
         SmbNamedPipe.PIPE_TYPE_CALL );
 
Open the Named Pipe foo for reading and writing. The pipe will behave like the CallNamedPipe interface.
 new SmbNamedPipe( "smb1://server/IPC$/foo",
         SmbNamedPipe.PIPE_TYPE_RDWR |
         SmbNamedPipe.PIPE_TYPE_TRANSACT );
 
Open the Named Pipe foo for reading and writing. The pipe will behave like the TransactNamedPipe interface.
 new SmbNamedPipe( "smb1://server/IPC$/foo",
         SmbNamedPipe.PIPE_TYPE_RDWR );
 
Open the Named Pipe foo for reading and writing. The pipe will behave as though the CreateFile, ReadFile, WriteFile, and CloseFile interface was being used.

See Using jCIFS to Connect to Win32 Named Pipes for a detailed description of how to use jCIFS with Win32 Named Pipe server processes.

  • Field Details

    • PIPE_TYPE_RDONLY

      public static final int PIPE_TYPE_RDONLY
      The pipe should be opened read-only.
      See Also:
    • PIPE_TYPE_WRONLY

      public static final int PIPE_TYPE_WRONLY
      The pipe should be opened only for writing.
      See Also:
    • PIPE_TYPE_RDWR

      public static final int PIPE_TYPE_RDWR
      The pipe should be opened for both reading and writing.
      See Also:
    • PIPE_TYPE_CALL

      public static final int PIPE_TYPE_CALL
      Pipe operations should behave like the CallNamedPipe Win32 Named Pipe function.
      See Also:
    • PIPE_TYPE_TRANSACT

      public static final int PIPE_TYPE_TRANSACT
      Pipe operations should behave like the TransactNamedPipe Win32 Named Pipe function.
      See Also:
    • PIPE_TYPE_DCE_TRANSACT

      public static final int PIPE_TYPE_DCE_TRANSACT
      Named pipe type flag for DCE RPC transact operations.
      See Also:
    • DEFAULT_PORT

      static final int DEFAULT_PORT
      Default SMB port number
      See Also:
    • DEFAULT_MAX_MPX_COUNT

      static final int DEFAULT_MAX_MPX_COUNT
      Default maximum multiplex count
      See Also:
    • DEFAULT_RESPONSE_TIMEOUT

      static final int DEFAULT_RESPONSE_TIMEOUT
      Default response timeout in milliseconds
      See Also:
    • DEFAULT_SO_TIMEOUT

      static final int DEFAULT_SO_TIMEOUT
      Default socket timeout in milliseconds
      See Also:
    • DEFAULT_RCV_BUF_SIZE

      static final int DEFAULT_RCV_BUF_SIZE
      Default receive buffer size in bytes
      See Also:
    • DEFAULT_SND_BUF_SIZE

      static final int DEFAULT_SND_BUF_SIZE
      Default send buffer size in bytes
      See Also:
    • DEFAULT_SSN_LIMIT

      static final int DEFAULT_SSN_LIMIT
      Default session limit
      See Also:
    • DEFAULT_CONN_TIMEOUT

      static final int DEFAULT_CONN_TIMEOUT
      Default connection timeout in milliseconds
      See Also:
    • LADDR

      static final InetAddress LADDR
      Local address to bind to
    • LPORT

      static final int LPORT
      Local port to bind to
    • MAX_MPX_COUNT

      static final int MAX_MPX_COUNT
      Maximum multiplex count
    • SND_BUF_SIZE

      static final int SND_BUF_SIZE
      Send buffer size in bytes
    • RCV_BUF_SIZE

      static final int RCV_BUF_SIZE
      Receive buffer size in bytes
    • USE_UNICODE

      static final boolean USE_UNICODE
      Whether to use Unicode strings
    • FORCE_UNICODE

      static final boolean FORCE_UNICODE
      Whether to force Unicode usage
    • USE_NTSTATUS

      static final boolean USE_NTSTATUS
      Whether to use NT status codes
    • SIGNPREF

      static final boolean SIGNPREF
      Whether signing is preferred
    • USE_NTSMBS

      static final boolean USE_NTSMBS
      Whether to use NT SMBs
    • USE_EXTSEC

      static final boolean USE_EXTSEC
      Whether to use extended security
    • NETBIOS_HOSTNAME

      static final String NETBIOS_HOSTNAME
      NetBIOS hostname
    • LM_COMPATIBILITY

      static final int LM_COMPATIBILITY
      LM compatibility level
    • FLAGS_NONE

      static final int FLAGS_NONE
      No flags set
      See Also:
    • FLAGS_LOCK_AND_READ_WRITE_AND_UNLOCK

      static final int FLAGS_LOCK_AND_READ_WRITE_AND_UNLOCK
      Lock and read write and unlock flag
      See Also:
    • FLAGS_RECEIVE_BUFFER_POSTED

      static final int FLAGS_RECEIVE_BUFFER_POSTED
      Receive buffer posted flag
      See Also:
    • FLAGS_PATH_NAMES_CASELESS

      static final int FLAGS_PATH_NAMES_CASELESS
      Path names are caseless flag
      See Also:
    • FLAGS_PATH_NAMES_CANONICALIZED

      static final int FLAGS_PATH_NAMES_CANONICALIZED
      Path names canonicalized flag
      See Also:
    • FLAGS_OPLOCK_REQUESTED_OR_GRANTED

      static final int FLAGS_OPLOCK_REQUESTED_OR_GRANTED
      Oplock requested or granted flag
      See Also:
    • FLAGS_NOTIFY_OF_MODIFY_ACTION

      static final int FLAGS_NOTIFY_OF_MODIFY_ACTION
      Notify of modify action flag
      See Also:
    • FLAGS_RESPONSE

      static final int FLAGS_RESPONSE
      Response flag
      See Also:
    • FLAGS2_NONE

      static final int FLAGS2_NONE
      No flags2 set
      See Also:
    • FLAGS2_LONG_FILENAMES

      static final int FLAGS2_LONG_FILENAMES
      Long filenames supported flag
      See Also:
    • FLAGS2_EXTENDED_ATTRIBUTES

      static final int FLAGS2_EXTENDED_ATTRIBUTES
      Extended attributes supported flag
      See Also:
    • FLAGS2_SECURITY_SIGNATURES

      static final int FLAGS2_SECURITY_SIGNATURES
      Security signatures supported flag
      See Also:
    • FLAGS2_EXTENDED_SECURITY_NEGOTIATION

      static final int FLAGS2_EXTENDED_SECURITY_NEGOTIATION
      Extended security negotiation flag
      See Also:
    • FLAGS2_RESOLVE_PATHS_IN_DFS

      static final int FLAGS2_RESOLVE_PATHS_IN_DFS
      Resolve paths in DFS flag
      See Also:
    • FLAGS2_PERMIT_READ_IF_EXECUTE_PERM

      static final int FLAGS2_PERMIT_READ_IF_EXECUTE_PERM
      Permit read if execute permission flag
      See Also:
    • FLAGS2_STATUS32

      static final int FLAGS2_STATUS32
      32-bit status codes flag
      See Also:
    • FLAGS2_UNICODE

      static final int FLAGS2_UNICODE
      Unicode strings flag
      See Also:
    • CAP_NONE

      static final int CAP_NONE
      No capabilities
      See Also:
    • CAP_RAW_MODE

      static final int CAP_RAW_MODE
      Raw mode capability
      See Also:
    • CAP_MPX_MODE

      static final int CAP_MPX_MODE
      MPX mode capability
      See Also:
    • CAP_UNICODE

      static final int CAP_UNICODE
      Unicode capability
      See Also:
    • CAP_LARGE_FILES

      static final int CAP_LARGE_FILES
      Large files capability
      See Also:
    • CAP_NT_SMBS

      static final int CAP_NT_SMBS
      NT SMBs capability
      See Also:
    • CAP_RPC_REMOTE_APIS

      static final int CAP_RPC_REMOTE_APIS
      RPC remote APIs capability
      See Also:
    • CAP_STATUS32

      static final int CAP_STATUS32
      32-bit status codes capability
      See Also:
    • CAP_LEVEL_II_OPLOCKS

      static final int CAP_LEVEL_II_OPLOCKS
      Level II oplocks capability
      See Also:
    • CAP_LOCK_AND_READ

      static final int CAP_LOCK_AND_READ
      Lock and read capability
      See Also:
    • CAP_NT_FIND

      static final int CAP_NT_FIND
      NT find capability
      See Also:
    • CAP_DFS

      static final int CAP_DFS
      DFS capability
      See Also:
    • CAP_EXTENDED_SECURITY

      static final int CAP_EXTENDED_SECURITY
      Extended security capability
      See Also:
    • FILE_READ_DATA

      static final int FILE_READ_DATA
      File read data access right
      See Also:
    • FILE_WRITE_DATA

      static final int FILE_WRITE_DATA
      File write data access right
      See Also:
    • FILE_APPEND_DATA

      static final int FILE_APPEND_DATA
      File append data access right
      See Also:
    • FILE_READ_EA

      static final int FILE_READ_EA
      File read extended attributes access right
      See Also:
    • FILE_WRITE_EA

      static final int FILE_WRITE_EA
      File write extended attributes access right
      See Also:
    • FILE_EXECUTE

      static final int FILE_EXECUTE
      File execute access right
      See Also:
    • FILE_DELETE

      static final int FILE_DELETE
      File delete child access right
      See Also:
    • FILE_READ_ATTRIBUTES

      static final int FILE_READ_ATTRIBUTES
      File read attributes access right
      See Also:
    • FILE_WRITE_ATTRIBUTES

      static final int FILE_WRITE_ATTRIBUTES
      File write attributes access right
      See Also:
    • DELETE

      static final int DELETE
      Delete access right
      See Also:
    • READ_CONTROL

      static final int READ_CONTROL
      Read control access right
      See Also:
    • WRITE_DAC

      static final int WRITE_DAC
      Write DAC access right
      See Also:
    • WRITE_OWNER

      static final int WRITE_OWNER
      Write owner access right
      See Also:
    • SYNCHRONIZE

      static final int SYNCHRONIZE
      Synchronize access right
      See Also:
    • GENERIC_ALL

      static final int GENERIC_ALL
      Generic all access right
      See Also:
    • GENERIC_EXECUTE

      static final int GENERIC_EXECUTE
      Generic execute access right
      See Also:
    • GENERIC_WRITE

      static final int GENERIC_WRITE
      Generic write access right
      See Also:
    • GENERIC_READ

      static final int GENERIC_READ
      Generic read access right
      See Also:
    • FLAGS_TARGET_MUST_BE_FILE

      static final int FLAGS_TARGET_MUST_BE_FILE
      Target must be file flag
      See Also:
    • FLAGS_TARGET_MUST_BE_DIRECTORY

      static final int FLAGS_TARGET_MUST_BE_DIRECTORY
      Target must be directory flag
      See Also:
    • FLAGS_COPY_TARGET_MODE_ASCII

      static final int FLAGS_COPY_TARGET_MODE_ASCII
      Copy target mode ASCII flag
      See Also:
    • FLAGS_COPY_SOURCE_MODE_ASCII

      static final int FLAGS_COPY_SOURCE_MODE_ASCII
      Copy source mode ASCII flag
      See Also:
    • FLAGS_VERIFY_ALL_WRITES

      static final int FLAGS_VERIFY_ALL_WRITES
      Verify all writes flag
      See Also:
    • FLAGS_TREE_COPY

      static final int FLAGS_TREE_COPY
      Tree copy flag
      See Also:
    • OPEN_FUNCTION_FAIL_IF_EXISTS

      static final int OPEN_FUNCTION_FAIL_IF_EXISTS
      Open function fail if exists
      See Also:
    • OPEN_FUNCTION_OVERWRITE_IF_EXISTS

      static final int OPEN_FUNCTION_OVERWRITE_IF_EXISTS
      Open function overwrite if exists
      See Also:
    • PID

      static final int PID
      Process ID
    • SECURITY_SHARE

      static final int SECURITY_SHARE
      Share level security
      See Also:
    • SECURITY_USER

      static final int SECURITY_USER
      User level security
      See Also:
    • CMD_OFFSET

      static final int CMD_OFFSET
      Command offset in SMB header
      See Also:
    • ERROR_CODE_OFFSET

      static final int ERROR_CODE_OFFSET
      Error code offset in SMB header
      See Also:
    • FLAGS_OFFSET

      static final int FLAGS_OFFSET
      Flags offset in SMB header
      See Also:
    • SIGNATURE_OFFSET

      static final int SIGNATURE_OFFSET
      Signature offset in SMB header
      See Also:
    • TID_OFFSET

      static final int TID_OFFSET
      TID offset in SMB header
      See Also:
    • HEADER_LENGTH

      static final int HEADER_LENGTH
      SMB header length
      See Also:
    • MILLISECONDS_BETWEEN_1970_AND_1601

      static final long MILLISECONDS_BETWEEN_1970_AND_1601
      Milliseconds between 1970 and 1601
      See Also:
    • TZ

      static final TimeZone TZ
      Default timezone
    • USE_BATCHING

      static final boolean USE_BATCHING
      Whether to use batching
    • OEM_ENCODING

      static final String OEM_ENCODING
      OEM encoding
    • UNI_ENCODING

      static final String UNI_ENCODING
      Unicode encoding
      See Also:
    • DEFAULT_FLAGS2

      static final int DEFAULT_FLAGS2
      Default FLAGS2 value
    • DEFAULT_CAPABILITIES

      static final int DEFAULT_CAPABILITIES
      Default capabilities
    • FLAGS2

      static final int FLAGS2
      FLAGS2 value
    • CAPABILITIES

      static final int CAPABILITIES
      Capabilities value
    • TCP_NODELAY

      static final boolean TCP_NODELAY
      Whether to use TCP_NODELAY
    • RESPONSE_TIMEOUT

      static final int RESPONSE_TIMEOUT
      Response timeout in milliseconds
    • CONNECTIONS

      static final LinkedList CONNECTIONS
      List of active connections
    • SSN_LIMIT

      static final int SSN_LIMIT
      Session limit
    • SO_TIMEOUT

      static final int SO_TIMEOUT
      Socket timeout in milliseconds
    • CONN_TIMEOUT

      static final int CONN_TIMEOUT
      Connection timeout in milliseconds
    • NATIVE_OS

      static final String NATIVE_OS
      Native operating system name
    • NATIVE_LANMAN

      static final String NATIVE_LANMAN
      Native LAN manager name
    • VC_NUMBER

      static final int VC_NUMBER
      Virtual circuit number
      See Also:
    • NULL_TRANSPORT

      static final SmbTransport NULL_TRANSPORT
      Null transport instance
  • Constructor Details

  • Method Details

    • getNamedPipeInputStream

      public InputStream getNamedPipeInputStream() throws IOException
      Return the InputStream used to read information from this pipe instance. Presumably data would first be written to the OutputStream associated with this Named Pipe instance although this is not a requirement (e.g. a read-only named pipe would write data to this stream on connection). Reading from this stream may block. Therefore it may be necessary that an addition thread be used to read and write to a Named Pipe.
      Returns:
      the input stream for reading from this pipe
      Throws:
      IOException - if an I/O error occurs
    • getNamedPipeOutputStream

      public OutputStream getNamedPipeOutputStream() throws IOException
      Return the OutputStream used to write information to this pipe instance. The act of writing data to this stream will result in response data recieved in the InputStream associated with this Named Pipe instance (unless of course it does not elicite a response or the pipe is write-only).
      Returns:
      the output stream for writing to this pipe
      Throws:
      IOException - if an I/O error occurs