Top Description Inners Fields Constructors Methods
jnr.unixsocket

pack-priv abstract Class SockAddrUnix

extends Struct
Class Inheritance
Known Direct Subclasses
jnr.unixsocket.SockAddrUnix.BSDSockAddrUnix, jnr.unixsocket.SockAddrUnix.DefaultSockAddrUnix
Static Imports
java.nio.charset.StandardCharsets.UTF_8

Native unix domain socket address structure.

Nested and Inner Type Summary

Modifier and TypeClass and Description
pack-priv static class
SockAddrUnix.BSDSockAddrUnix

An implementation of SockAddrUnix for BSD systems

pack-priv static class
SockAddrUnix.DefaultSockAddrUnix

An implementation of SockAddrUnix for Linux, Solaris, et, al

Field Summary

Modifier and TypeField and Description
public static final int
private String
private static transient Platform.OS
public static final int

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
pack-priv static SockAddrUnix

Returns:

An instance of SockAddrUnix
create
()

Creates a new instance of SockAddrUnix

pack-priv final ProtocolFamily

Returns:

The protocol family
getFamily
()

Gets the protocol family of this unix socket address.

protected abstract Struct.NumberField
pack-priv int

Returns:

The size of header, in bytes
getHeaderLength
()

Gets len/family header length

pack-priv int

Returns:

The maximum size of the address in bytes
getMaximumLength
()

Gets the maximum length of this address (including len/family header)

pack-priv final String

Returns:

A String
getPath
()

Gets the file system path of this socket address

pack-priv final String
getPath(int
The desired length of the string. If the first character of the path is NUL, then this value ist considered exact, otherwise it includes a trailing NUL charater and therefore the actual string length is len - 1.
len
)

Gets the path of this socket address, supporting abstract namespace on Linux.

protected abstract Struct.UTF8String
pack-priv int

Returns:

The actual size of this address, in bytes
length
()

Gets the actual length of this address (including len/family header)

pack-priv final void
setFamily(ProtocolFamily
The protocol family, usually ProtocolFamily#PF_UNIX
family
)

Sets the protocol family of this unix socket address.

pack-priv void
setPath(String
The unix socket address
path
)

Sets the file system path of this socket address

private static final int
pack-priv void
updatePath(final int
the value of the addrlen var, set by the above syscalls.
len
)

Updates the file system path of this socket address.

Inherited from jnr.ffi.Struct:
alignmentarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayarrayBeginarrayEndarrayOffunctiongetMemorygetMemorygetRuntimeinnerinnerisDirectsizesizesizetoStringuseMemory

Field Detail

ADDR_LENGTHback to summary
public static final int ADDR_LENGTH
cachedPathback to summary
private String cachedPath
currentOSback to summary
private static transient Platform.OS currentOS
HEADER_LENGTHback to summary
public static final int HEADER_LENGTH

Constructor Detail

SockAddrUnixback to summary
pack-priv SockAddrUnix()

Method Detail

createback to summary
pack-priv static SockAddrUnix create()

Creates a new instance of SockAddrUnix

Returns:SockAddrUnix

An instance of SockAddrUnix

getFamilyback to summary
pack-priv final ProtocolFamily getFamily()

Gets the protocol family of this unix socket address.

Returns:ProtocolFamily

The protocol family

getFamilyFieldback to summary
protected abstract Struct.NumberField getFamilyField()
getHeaderLengthback to summary
pack-priv int getHeaderLength()

Gets len/family header length

Returns:int

The size of header, in bytes

getMaximumLengthback to summary
pack-priv int getMaximumLength()

Gets the maximum length of this address (including len/family header)

Returns:int

The maximum size of the address in bytes

getPathback to summary
pack-priv final String getPath()

Gets the file system path of this socket address

Returns:String

A String

getPathback to summary
pack-priv final String getPath(int len)

Gets the path of this socket address, supporting abstract namespace on Linux.

Parameters
len:int

The desired length of the string. If the first character of the path is NUL, then this value ist considered exact, otherwise it includes a trailing NUL charater and therefore the actual string length is len - 1.

getPathFieldback to summary
protected abstract Struct.UTF8String getPathField()
lengthback to summary
pack-priv int length()

Gets the actual length of this address (including len/family header)

Returns:int

The actual size of this address, in bytes

setFamilyback to summary
pack-priv final void setFamily(ProtocolFamily family)

Sets the protocol family of this unix socket address.

Parameters
family:ProtocolFamily

The protocol family, usually ProtocolFamily#PF_UNIX

setPathback to summary
pack-priv void setPath(String path)

Sets the file system path of this socket address

Parameters
path:String

The unix socket address

strlenback to summary
private static final int strlen(Struct.UTF8String str)
updatePathback to summary
pack-priv void updatePath(final int len)

Updates the file system path of this socket address. In order to support abstract namespaces, this MUST be called after any native syscall that sets this path struct like getsockname(), getpeername(), accept().

Parameters
len:int

the value of the addrlen var, set by the above syscalls.

jnr.unixsocket back to summary

pack-priv final Class SockAddrUnix.BSDSockAddrUnix

extends SockAddrUnix
Class Inheritance

An implementation of SockAddrUnix for BSD systems

Field Summary

Modifier and TypeField and Description
public final Struct.UTF8String
public final Struct.Unsigned8
public final Struct.Unsigned8
Inherited from jnr.unixsocket.SockAddrUnix:
ADDR_LENGTHHEADER_LENGTH

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Struct.NumberField
protected Struct.UTF8String
public void
setPath(String
The unix socket address
path
)

Overrides jnr.unixsocket.SockAddrUnix.setPath.

Sets the file system path of this socket address
Inherited from jnr.unixsocket.SockAddrUnix:
creategetFamilygetHeaderLengthgetMaximumLengthgetPathgetPathlengthsetFamilyupdatePath

Field Detail

sun_addrback to summary
public final Struct.UTF8String sun_addr
sun_familyback to summary
public final Struct.Unsigned8 sun_family
sun_lenback to summary
public final Struct.Unsigned8 sun_len

Constructor Detail

BSDSockAddrUnixback to summary
pack-priv BSDSockAddrUnix()

Method Detail

getFamilyFieldback to summary
protected Struct.NumberField getFamilyField()

Implements abstract jnr.unixsocket.SockAddrUnix.getFamilyField.

getPathFieldback to summary
protected Struct.UTF8String getPathField()

Implements abstract jnr.unixsocket.SockAddrUnix.getPathField.

setPathback to summary
public void setPath(String path)

Overrides jnr.unixsocket.SockAddrUnix.setPath.

Doc from jnr.unixsocket.SockAddrUnix.setPath.

Sets the file system path of this socket address

Parameters
path:String

The unix socket address

Annotations
@Override
jnr.unixsocket back to summary

pack-priv final Class SockAddrUnix.DefaultSockAddrUnix

extends SockAddrUnix
Class Inheritance

An implementation of SockAddrUnix for Linux, Solaris, et, al

Field Summary

Modifier and TypeField and Description
public final Struct.UTF8String
public final Struct.Unsigned16
Inherited from jnr.unixsocket.SockAddrUnix:
ADDR_LENGTHHEADER_LENGTH

Constructor Summary

AccessConstructor and Description
pack-priv

Method Summary

Modifier and TypeMethod and Description
protected Struct.NumberField
protected Struct.UTF8String
Inherited from jnr.unixsocket.SockAddrUnix:
creategetFamilygetHeaderLengthgetMaximumLengthgetPathgetPathlengthsetFamilysetPathupdatePath

Field Detail

sun_addrback to summary
public final Struct.UTF8String sun_addr
sun_familyback to summary
public final Struct.Unsigned16 sun_family

Constructor Detail

DefaultSockAddrUnixback to summary
pack-priv DefaultSockAddrUnix()

Method Detail

getFamilyFieldback to summary
protected Struct.NumberField getFamilyField()

Implements abstract jnr.unixsocket.SockAddrUnix.getFamilyField.

getPathFieldback to summary
protected Struct.UTF8String getPathField()

Implements abstract jnr.unixsocket.SockAddrUnix.getPathField.