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

public Class UnixDomainSocketConnector

extends AbstractConnector
Class Inheritance
Static Imports
org.eclipse.jgit.internal.transport.sshd.agent.connector.Sockets.AF_UNIX, .Sockets.DEFAULT_PROTOCOL, .Sockets.SOCK_STREAM, .UnixSockets.FD_CLOEXEC, .UnixSockets.F_SETFD, org.eclipse.jgit.transport.SshConstants.ENV_SSH_AUTH_SOCKET

JNA-based implementation of communication through a Unix domain socket.

Field Summary

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

Constructor Summary

AccessConstructor and Description
public
UnixDomainSocketConnector(String
to use; if null or empty, use environment variable SSH_AUTH_SOCK
socketFile
)

Creates a new instance.

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 static synchronized UnixSockets
private int
read(int fd, byte[] buffer, int offset, int length)

private void
readFully(int fd, 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(int fd, byte[] message)

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

Field Detail

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

ConnectorDescriptor for the UnixDomainSocketConnector.

libraryback to summary
private static UnixSockets library
libraryLoadedback to summary
private static boolean libraryLoaded
LOGback to summary
private static final Logger LOG
socketFdback to summary
private volatile int socketFd
socketFileback to summary
private final String socketFile

Constructor Detail

UnixDomainSocketConnectorback to summary
public UnixDomainSocketConnector(String socketFile)

Creates a new instance.

Parameters
socketFile:String

to use; if null or empty, use environment variable SSH_AUTH_SOCK

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
getLibraryback to summary
private static synchronized UnixSockets getLibrary()
readback to summary
private int read(int fd, byte[] buffer, int offset, int length) throws IOException
readFullyback to summary
private void readFully(int fd, 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(int fd, byte[] message) throws IOException