Top Description Fields Constructors Methods
org.eclipse.jgit.internal.transport.sshd.agent.connector

public Class WinPipeConnector

extends AbstractConnector
Class Inheritance
Imports
java.io.IOException, java.text.MessageFormat, java.util.Arrays, java.util.concurrent.atomic.AtomicBoolean, org.apache.sshd.common.SshException, org.eclipse.jgit.transport.sshd.agent.AbstractConnector, .ConnectorFactory.ConnectorDescriptor, org.eclipse.jgit.util.StringUtils, com.sun.jna.LastErrorException, com.sun.jna.platform.win32.WinBase, .WinError, .WinNT, .WinNT.HANDLE, com.sun.jna.ptr.IntByReference

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

Modifier and TypeField and Description
private static final String
private final AtomicBoolean
public static final ConnectorFactory.ConnectorDescriptor
private static final int
private static final int
private volatile WinNT.HANDLE
private final String
Inherited from org.eclipse.jgit.transport.sshd.agent.AbstractConnector:
DEFAULT_MAX_REPLY_LENGTH

Constructor Summary

AccessConstructor and Description
public
WinPipeConnector(String
to connect to
pipeName
)

Creates a WinPipeConnector for the given named pipe.

Method Summary

Modifier and TypeMethod and Description
public synchronized void
close()

Implements java.io.Closeable.close.

Closes this stream and releases any system resources associated with it.

public boolean
connect()

Implements org.eclipse.jgit.transport.sshd.agent.Connector.connect.

Connects to an SSH agent if there is one running.

private int
read(LibraryHolder libs, WinNT.HANDLE file, byte[] buffer, int offset, int length)

private void
readFully(LibraryHolder libs, WinNT.HANDLE file, byte[] data)

public byte[]
rpc(byte
to send
command
,
byte[]
to send; must have at least 5 bytes, and must have 5 unused bytes at the front.
message
)

Implements org.eclipse.jgit.transport.sshd.agent.Connector.rpc.

Performs a remote call to the SSH agent and returns the result.

private void
writeFully(LibraryHolder libs, WinNT.HANDLE file, byte[] message)

Inherited from org.eclipse.jgit.transport.sshd.agent.AbstractConnector:
getMaximumMessageLengthprepareMessagetoLength

Field Detail

CANONICAL_PIPE_NAMEback to summary
private static final String CANONICAL_PIPE_NAME
connectedback to summary
private final AtomicBoolean connected
DESCRIPTORback to summary
public static final ConnectorFactory.ConnectorDescriptor DESCRIPTOR

ConnectorDescriptor for the PageantConnector.

FILE_ATTRIBUTE_NONEback to summary
private static final int FILE_ATTRIBUTE_NONE
FILE_SHARE_NONEback to summary
private static final int FILE_SHARE_NONE
fileHandleback to summary
private volatile WinNT.HANDLE fileHandle
pipeNameback to summary
private final String pipeName

Constructor Detail

WinPipeConnectorback to summary
public WinPipeConnector(String pipeName)

Creates a WinPipeConnector for the given named pipe.

Parameters
pipeName:String

to connect to

Method Detail

closeback to summary
public synchronized void close() throws IOException

Implements java.io.Closeable.close.

Doc from java.io.Closeable.close.

Closes this stream and releases any system resources associated with it. If the stream is already closed then invoking this method has no effect.

As noted in AutoCloseable#close(), cases where the close may fail require careful attention. It is strongly advised to relinquish the underlying resources and to internally mark the Closeable as closed, prior to throwing the IOException.

Annotations
@Override
Exceptions
IOException:
if an I/O error occurs
connectback to summary
public boolean connect() throws IOException

Implements org.eclipse.jgit.transport.sshd.agent.Connector.connect.

Doc from org.eclipse.jgit.transport.sshd.agent.Connector.connect.

Connects to an SSH agent if there is one running. If called when already connected just returns true.

Returns:boolean

true if an SSH agent is available and connected, false if no SSH agent is available

Annotations
@Override
Exceptions
IOException:
if connecting to the SSH agent failed
readback to summary
private int read(LibraryHolder libs, WinNT.HANDLE file, byte[] buffer, int offset, int length) throws IOException
readFullyback to summary
private void readFully(LibraryHolder libs, WinNT.HANDLE file, byte[] data) throws IOException
rpcback to summary
public byte[] rpc(byte command, byte[] message) throws IOException

Implements org.eclipse.jgit.transport.sshd.agent.Connector.rpc.

Doc from org.eclipse.jgit.transport.sshd.agent.Connector.rpc.

Performs a remote call to the SSH agent and returns the result.

Parameters
command:byte

to send

message:byte[]

to send; must have at least 5 bytes, and must have 5 unused bytes at the front.

Returns:byte[]

the result received

Annotations
@Override
Exceptions
IOException:
if an error occurs
writeFullyback to summary
private void writeFully(LibraryHolder libs, WinNT.HANDLE file, byte[] message) throws IOException