Package jcifs.smb

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
    Code SampleDescription
     new SmbNamedPipe( "smb://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( "smb://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( "smb://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 Detail

      • PIPE_TYPE_RDONLY

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

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

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

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

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

        public static final int DEFAULT_RESPONSE_TIMEOUT
        See Also:
        Constant Field Values
      • LADDR

        public static final java.net.InetAddress LADDR
      • LPORT

        public static final int LPORT
      • MAX_MPX_COUNT

        public static final int MAX_MPX_COUNT
      • SND_BUF_SIZE

        public static final int SND_BUF_SIZE
      • RCV_BUF_SIZE

        public static final int RCV_BUF_SIZE
      • USE_UNICODE

        public static final boolean USE_UNICODE
      • FORCE_UNICODE

        public static final boolean FORCE_UNICODE
      • USE_NTSTATUS

        public static final boolean USE_NTSTATUS
      • SIGNPREF

        public static final boolean SIGNPREF
      • USE_NTSMBS

        public static final boolean USE_NTSMBS
      • USE_EXTSEC

        public static final boolean USE_EXTSEC
      • NETBIOS_HOSTNAME

        public static final java.lang.String NETBIOS_HOSTNAME
      • LM_COMPATIBILITY

        public static final int LM_COMPATIBILITY
      • FLAGS_LOCK_AND_READ_WRITE_AND_UNLOCK

        public static final int FLAGS_LOCK_AND_READ_WRITE_AND_UNLOCK
        See Also:
        Constant Field Values
      • FLAGS_RECEIVE_BUFFER_POSTED

        public static final int FLAGS_RECEIVE_BUFFER_POSTED
        See Also:
        Constant Field Values
      • FLAGS_PATH_NAMES_CASELESS

        public static final int FLAGS_PATH_NAMES_CASELESS
        See Also:
        Constant Field Values
      • FLAGS_PATH_NAMES_CANONICALIZED

        public static final int FLAGS_PATH_NAMES_CANONICALIZED
        See Also:
        Constant Field Values
      • FLAGS_OPLOCK_REQUESTED_OR_GRANTED

        public static final int FLAGS_OPLOCK_REQUESTED_OR_GRANTED
        See Also:
        Constant Field Values
      • FLAGS_NOTIFY_OF_MODIFY_ACTION

        public static final int FLAGS_NOTIFY_OF_MODIFY_ACTION
        See Also:
        Constant Field Values
      • FLAGS2_EXTENDED_ATTRIBUTES

        public static final int FLAGS2_EXTENDED_ATTRIBUTES
        See Also:
        Constant Field Values
      • FLAGS2_SECURITY_SIGNATURES

        public static final int FLAGS2_SECURITY_SIGNATURES
        See Also:
        Constant Field Values
      • FLAGS2_EXTENDED_SECURITY_NEGOTIATION

        public static final int FLAGS2_EXTENDED_SECURITY_NEGOTIATION
        See Also:
        Constant Field Values
      • FLAGS2_RESOLVE_PATHS_IN_DFS

        public static final int FLAGS2_RESOLVE_PATHS_IN_DFS
        See Also:
        Constant Field Values
      • FLAGS2_PERMIT_READ_IF_EXECUTE_PERM

        public static final int FLAGS2_PERMIT_READ_IF_EXECUTE_PERM
        See Also:
        Constant Field Values
      • FLAGS_TARGET_MUST_BE_FILE

        public static final int FLAGS_TARGET_MUST_BE_FILE
        See Also:
        Constant Field Values
      • FLAGS_TARGET_MUST_BE_DIRECTORY

        public static final int FLAGS_TARGET_MUST_BE_DIRECTORY
        See Also:
        Constant Field Values
      • FLAGS_COPY_TARGET_MODE_ASCII

        public static final int FLAGS_COPY_TARGET_MODE_ASCII
        See Also:
        Constant Field Values
      • FLAGS_COPY_SOURCE_MODE_ASCII

        public static final int FLAGS_COPY_SOURCE_MODE_ASCII
        See Also:
        Constant Field Values
      • FLAGS_VERIFY_ALL_WRITES

        public static final int FLAGS_VERIFY_ALL_WRITES
        See Also:
        Constant Field Values
      • OPEN_FUNCTION_FAIL_IF_EXISTS

        public static final int OPEN_FUNCTION_FAIL_IF_EXISTS
        See Also:
        Constant Field Values
      • OPEN_FUNCTION_OVERWRITE_IF_EXISTS

        public static final int OPEN_FUNCTION_OVERWRITE_IF_EXISTS
        See Also:
        Constant Field Values
      • PID

        public static final int PID
      • MILLISECONDS_BETWEEN_1970_AND_1601

        public static final long MILLISECONDS_BETWEEN_1970_AND_1601
        See Also:
        Constant Field Values
      • TZ

        public static final java.util.TimeZone TZ
      • USE_BATCHING

        public static final boolean USE_BATCHING
      • OEM_ENCODING

        public static final java.lang.String OEM_ENCODING
      • DEFAULT_FLAGS2

        public static final int DEFAULT_FLAGS2
      • DEFAULT_CAPABILITIES

        public static final int DEFAULT_CAPABILITIES
      • FLAGS2

        public static final int FLAGS2
      • CAPABILITIES

        public static final int CAPABILITIES
      • TCP_NODELAY

        public static final boolean TCP_NODELAY
      • RESPONSE_TIMEOUT

        public static final int RESPONSE_TIMEOUT
      • CONNECTIONS

        public static final java.util.LinkedList CONNECTIONS
      • SSN_LIMIT

        public static final int SSN_LIMIT
      • SO_TIMEOUT

        public static final int SO_TIMEOUT
      • CONN_TIMEOUT

        public static final int CONN_TIMEOUT
      • NATIVE_OS

        public static final java.lang.String NATIVE_OS
      • NATIVE_LANMAN

        public static final java.lang.String NATIVE_LANMAN
      • NULL_TRANSPORT

        public static final jcifs.smb.SmbTransport NULL_TRANSPORT
    • Constructor Detail

      • SmbNamedPipe

        public SmbNamedPipe​(java.lang.String url,
                            int pipeType)
                     throws java.net.MalformedURLException,
                            java.net.UnknownHostException
        Open the Named Pipe resource specified by the url parameter. The pipeType parameter should be at least one of the PIPE_TYPE flags combined with the bitwise OR operator |. See the examples listed above.
        Throws:
        java.net.MalformedURLException
        java.net.UnknownHostException
      • SmbNamedPipe

        public SmbNamedPipe​(java.lang.String url,
                            int pipeType,
                            NtlmPasswordAuthentication auth)
                     throws java.net.MalformedURLException,
                            java.net.UnknownHostException
        Throws:
        java.net.MalformedURLException
        java.net.UnknownHostException
      • SmbNamedPipe

        public SmbNamedPipe​(java.net.URL url,
                            int pipeType,
                            NtlmPasswordAuthentication auth)
                     throws java.net.MalformedURLException,
                            java.net.UnknownHostException
        Throws:
        java.net.MalformedURLException
        java.net.UnknownHostException
    • Method Detail

      • getNamedPipeInputStream

        public java.io.InputStream getNamedPipeInputStream()
                                                    throws java.io.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.
        Throws:
        java.io.IOException
      • getNamedPipeOutputStream

        public java.io.OutputStream getNamedPipeOutputStream()
                                                      throws java.io.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).
        Throws:
        java.io.IOException