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.StructNative unix domain socket address structure.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description (package private) static classSockAddrUnix.BSDSockAddrUnixAn implementation ofSockAddrUnixfor BSD systems(package private) static classSockAddrUnix.DefaultSockAddrUnixAn implementation ofSockAddrUnixfor Linux, Solaris, et, al-
Nested 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 java.lang.Enum<T>>, jnr.ffi.Struct.Enum16<E extends java.lang.Enum<E>>, jnr.ffi.Struct.Enum32<E extends java.lang.Enum<E>>, jnr.ffi.Struct.Enum64<E extends java.lang.Enum<E>>, jnr.ffi.Struct.Enum8<E extends java.lang.Enum<E>>, jnr.ffi.Struct.EnumField<E extends java.lang.Object>, jnr.ffi.Struct.EnumLong<E extends java.lang.Enum<E>>, jnr.ffi.Struct.Float, jnr.ffi.Struct.fsblkcnt_t, jnr.ffi.Struct.fsfilcnt_t, jnr.ffi.Struct.Function<T extends java.lang.Object>, 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
Fields Modifier and Type Field Description static intADDR_LENGTHprivate java.lang.StringcachedPathprivate static jnr.ffi.Platform.OScurrentOSstatic intHEADER_LENGTH
-
Constructor Summary
Constructors Constructor Description SockAddrUnix()
-
Method Summary
All Methods Static Methods Instance Methods Abstract Methods Concrete Methods Modifier and Type Method Description (package private) static SockAddrUnixcreate()Creates a new instance of SockAddrUnix(package private) jnr.constants.platform.ProtocolFamilygetFamily()Gets the protocol family of this unix socket address.protected abstract jnr.ffi.Struct.NumberFieldgetFamilyField()(package private) intgetHeaderLength()Gets len/family header length(package private) intgetMaximumLength()Gets the maximum length of this address (including len/family header)(package private) java.lang.StringgetPath()Gets the file system path of this socket address(package private) java.lang.StringgetPath(int len)Gets the path of this socket address, supporting abstract namespace on Linux.protected abstract jnr.ffi.Struct.UTF8StringgetPathField()(package private) intlength()Gets the actual length of this address (including len/family header)(package private) voidsetFamily(jnr.constants.platform.ProtocolFamily family)Sets the protocol family of this unix socket address.(package private) voidsetPath(java.lang.String path)Sets the file system path of this socket addressprivate static 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 Detail
-
currentOS
private static transient jnr.ffi.Platform.OS currentOS
-
ADDR_LENGTH
public static final int ADDR_LENGTH
- See Also:
- Constant Field Values
-
HEADER_LENGTH
public static final int HEADER_LENGTH
- See Also:
- Constant Field Values
-
cachedPath
private java.lang.String cachedPath
-
-
Method Detail
-
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
void setPath(java.lang.String path)
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
final java.lang.String getPath()
Gets the file system path of this socket address- Returns:
- A String
-
getPath
final java.lang.String getPath(int len)
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
static SockAddrUnix create()
Creates a new instance of SockAddrUnix- Returns:
- An instance of SockAddrUnix
-
strlen
private static final int strlen(jnr.ffi.Struct.UTF8String str)
-
-