Class WinPipeConnector
java.lang.Object
org.eclipse.jgit.transport.sshd.agent.AbstractConnector
org.eclipse.jgit.internal.transport.sshd.agent.connector.WinPipeConnector
- All Implemented Interfaces:
Closeable
,AutoCloseable
,Connector
A connector based on JNA using Windows' named pipes to communicate with an
ssh agent. This is used by Microsoft's Win32-OpenSSH port.
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final String
private final AtomicBoolean
static final ConnectorFactory.ConnectorDescriptor
private static final int
private static final int
private com.sun.jna.platform.win32.WinNT.HANDLE
private final String
Fields inherited from class org.eclipse.jgit.transport.sshd.agent.AbstractConnector
DEFAULT_MAX_REPLY_LENGTH
-
Constructor Summary
ConstructorsConstructorDescriptionWinPipeConnector
(String pipeName) Creates aWinPipeConnector
for the given named pipe. -
Method Summary
Modifier and TypeMethodDescriptionvoid
close()
boolean
connect()
Connects to an SSH agent if there is one running.private int
read
(LibraryHolder libs, com.sun.jna.platform.win32.WinNT.HANDLE file, byte[] buffer, int offset, int length) private void
readFully
(LibraryHolder libs, com.sun.jna.platform.win32.WinNT.HANDLE file, byte[] data) byte[]
rpc
(byte command, byte[] message) Performs a remote call to the SSH agent and returns the result.private void
writeFully
(LibraryHolder libs, com.sun.jna.platform.win32.WinNT.HANDLE file, byte[] message) Methods inherited from class org.eclipse.jgit.transport.sshd.agent.AbstractConnector
getMaximumMessageLength, prepareMessage, toLength
-
Field Details
-
CANONICAL_PIPE_NAME
- See Also:
-
DESCRIPTOR
-
FILE_SHARE_NONE
private static final int FILE_SHARE_NONE- See Also:
-
FILE_ATTRIBUTE_NONE
private static final int FILE_ATTRIBUTE_NONE- See Also:
-
pipeName
-
connected
-
fileHandle
private volatile com.sun.jna.platform.win32.WinNT.HANDLE fileHandle
-
-
Constructor Details
-
WinPipeConnector
Creates aWinPipeConnector
for the given named pipe.- Parameters:
pipeName
- to connect to
-
-
Method Details
-
connect
Description copied from interface:Connector
Connects to an SSH agent if there is one running. If called when already connected just returnstrue
.- Returns:
true
if an SSH agent is available and connected, if no SSH agent is available- Throws:
IOException
- if connecting to the SSH agent failed
-
close
- Throws:
IOException
-
rpc
Description copied from interface:Connector
Performs a remote call to the SSH agent and returns the result.- Parameters:
command
- to sendmessage
- to send; must have at least 5 bytes, and must have 5 unused bytes at the front.- Returns:
- the result received
- Throws:
IOException
- if an error occurs
-
writeFully
private void writeFully(LibraryHolder libs, com.sun.jna.platform.win32.WinNT.HANDLE file, byte[] message) throws IOException - Throws:
IOException
-
readFully
private void readFully(LibraryHolder libs, com.sun.jna.platform.win32.WinNT.HANDLE file, byte[] data) throws IOException - Throws:
IOException
-
read
private int read(LibraryHolder libs, com.sun.jna.platform.win32.WinNT.HANDLE file, byte[] buffer, int offset, int length) throws IOException - Throws:
IOException
-