Package jnr.unixsocket
Class SockAddrUnix
java.lang.Object
jnr.ffi.Struct
jnr.unixsocket.SockAddrUnix
- Direct Known Subclasses:
SockAddrUnix.BSDSockAddrUnix,SockAddrUnix.DefaultSockAddrUnix
abstract class SockAddrUnix
extends jnr.ffi.Struct
Native unix domain socket address structure.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescription(package private) static final classAn implementation ofSockAddrUnixfor BSD systems(package private) static final classAn implementation ofSockAddrUnixfor Linux, Solaris, et, alNested classes/interfaces inherited from class jnr.ffi.Struct
jnr.ffi.Struct.AbstractBoolean, jnr.ffi.Struct.AbstractMember, jnr.ffi.Struct.Address, jnr.ffi.Struct.Alignment, jnr.ffi.Struct.AsciiString, jnr.ffi.Struct.AsciiStringRef, jnr.ffi.Struct.blkcnt_t, jnr.ffi.Struct.blksize_t, jnr.ffi.Struct.BOOL16, jnr.ffi.Struct.Boolean, jnr.ffi.Struct.BYTE, jnr.ffi.Struct.caddr_t, jnr.ffi.Struct.cc_t, jnr.ffi.Struct.clock_t, jnr.ffi.Struct.dev_t, jnr.ffi.Struct.Double, jnr.ffi.Struct.DWORD, jnr.ffi.Struct.Enum<T extends Enum<T>>, jnr.ffi.Struct.Enum16<E extends Enum<E>>, jnr.ffi.Struct.Enum32<E extends Enum<E>>, jnr.ffi.Struct.Enum64<E extends Enum<E>>, jnr.ffi.Struct.Enum8<E extends Enum<E>>, jnr.ffi.Struct.EnumField<E>, jnr.ffi.Struct.EnumLong<E extends Enum<E>>, jnr.ffi.Struct.Float, jnr.ffi.Struct.fsblkcnt_t, jnr.ffi.Struct.fsfilcnt_t, jnr.ffi.Struct.Function<T>, jnr.ffi.Struct.gid_t, jnr.ffi.Struct.id_t, jnr.ffi.Struct.in_addr_t, jnr.ffi.Struct.in_port_t, jnr.ffi.Struct.ino_t, jnr.ffi.Struct.ino64_t, jnr.ffi.Struct.int16_t, jnr.ffi.Struct.int32_t, jnr.ffi.Struct.int64_t, jnr.ffi.Struct.int8_t, jnr.ffi.Struct.IntegerAlias, jnr.ffi.Struct.intptr_t, jnr.ffi.Struct.key_t, jnr.ffi.Struct.LONG, jnr.ffi.Struct.Member, jnr.ffi.Struct.mode_t, jnr.ffi.Struct.nlink_t, jnr.ffi.Struct.NumberField, jnr.ffi.Struct.off_t, jnr.ffi.Struct.Offset, jnr.ffi.Struct.Padding, jnr.ffi.Struct.pid_t, jnr.ffi.Struct.Pointer, jnr.ffi.Struct.PointerField, jnr.ffi.Struct.rlim_t, jnr.ffi.Struct.sa_family_t, jnr.ffi.Struct.Signed16, jnr.ffi.Struct.Signed32, jnr.ffi.Struct.Signed64, jnr.ffi.Struct.Signed8, jnr.ffi.Struct.SignedLong, jnr.ffi.Struct.size_t, jnr.ffi.Struct.socklen_t, jnr.ffi.Struct.speed_t, jnr.ffi.Struct.ssize_t, jnr.ffi.Struct.String, jnr.ffi.Struct.StructRef<T extends jnr.ffi.Struct>, jnr.ffi.Struct.swblk_t, jnr.ffi.Struct.tcflag_t, jnr.ffi.Struct.time_t, jnr.ffi.Struct.u_int16_t, jnr.ffi.Struct.u_int32_t, jnr.ffi.Struct.u_int64_t, jnr.ffi.Struct.u_int8_t, jnr.ffi.Struct.uid_t, jnr.ffi.Struct.uintptr_t, jnr.ffi.Struct.Unsigned16, jnr.ffi.Struct.Unsigned32, jnr.ffi.Struct.Unsigned64, jnr.ffi.Struct.Unsigned8, jnr.ffi.Struct.UnsignedLong, jnr.ffi.Struct.UTF8String, jnr.ffi.Struct.UTF8StringRef, jnr.ffi.Struct.UTFString, jnr.ffi.Struct.UTFStringRef, jnr.ffi.Struct.WBOOL, jnr.ffi.Struct.WORD -
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intprivate Stringprivate static jnr.ffi.Platform.OSstatic final int -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescription(package private) static SockAddrUnixcreate()Creates a new instance of SockAddrUnix(package private) final jnr.constants.platform.ProtocolFamilyGets the protocol family of this unix socket address.protected abstract jnr.ffi.Struct.NumberField(package private) intGets len/family header length(package private) intGets the maximum length of this address (including len/family header)(package private) final StringgetPath()Gets the file system path of this socket address(package private) final StringgetPath(int len) Gets the path of this socket address, supporting abstract namespace on Linux.protected abstract jnr.ffi.Struct.UTF8String(package private) intlength()Gets the actual length of this address (including len/family header)(package private) final voidsetFamily(jnr.constants.platform.ProtocolFamily family) Sets the protocol family of this unix socket address.(package private) voidSets the file system path of this socket addressprivate static final intstrlen(jnr.ffi.Struct.UTF8String str) (package private) voidupdatePath(int len) Updates the file system path of this socket address.Methods inherited from class jnr.ffi.Struct
alignment, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, array, arrayBegin, arrayEnd, arrayOf, function, getMemory, getMemory, getRuntime, inner, inner, isDirect, size, size, size, toString, useMemory
-
Field Details
-
currentOS
private static transient jnr.ffi.Platform.OS currentOS -
ADDR_LENGTH
public static final int ADDR_LENGTH- See Also:
-
HEADER_LENGTH
public static final int HEADER_LENGTH- See Also:
-
cachedPath
-
-
Constructor Details
-
SockAddrUnix
SockAddrUnix()
-
-
Method Details
-
getPathField
protected abstract jnr.ffi.Struct.UTF8String getPathField() -
getFamilyField
protected abstract jnr.ffi.Struct.NumberField getFamilyField() -
setFamily
final void setFamily(jnr.constants.platform.ProtocolFamily family) Sets the protocol family of this unix socket address.- Parameters:
family- The protocol family, usuallyProtocolFamily.PF_UNIX
-
getFamily
final jnr.constants.platform.ProtocolFamily getFamily()Gets the protocol family of this unix socket address.- Returns:
- The protocol family
-
setPath
Sets the file system path of this socket address- Parameters:
path- The unix socket address
-
updatePath
void updatePath(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- the value of the addrlen var, set by the above syscalls.
-
getPath
Gets the file system path of this socket address- Returns:
- A String
-
getPath
Gets the path of this socket address, supporting abstract namespace on Linux.- Parameters:
len- 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.
-
getMaximumLength
int getMaximumLength()Gets the maximum length of this address (including len/family header)- Returns:
- The maximum size of the address in bytes
-
length
int length()Gets the actual length of this address (including len/family header)- Returns:
- The actual size of this address, in bytes
-
getHeaderLength
int getHeaderLength()Gets len/family header length- Returns:
- The size of header, in bytes
-
create
Creates a new instance of SockAddrUnix- Returns:
- An instance of SockAddrUnix
-
strlen
private static final int strlen(jnr.ffi.Struct.UTF8String str)
-