/** @return The default value for DLT_RAW (platform specific) */ private int getDefaultDltRaw() { switch (Platform.getOSType()) { case Platform.OPENBSD: return DLT_RAW_OPENBSD; default: return DLT_RAW_DEFAULT; } } }
/** @return The default address family for IPv6 addresses (platform specific) */ private int getDefaultAfInet6() { switch (Platform.getOSType()) { case Platform.MAC: return AF_INET6_MAC; case Platform.FREEBSD: case Platform.KFREEBSD: return AF_INET6_FREEBSD; case Platform.LINUX: case Platform.ANDROID: return AF_INET6_LINUX; default: return AF_INET6_DEFAULT; } }
/** Generate a canonical String prefix based on the current OS type/arch/name. */ static String getNativeLibraryResourcePrefix() { String prefix = System.getProperty("jna.prefix"); if(prefix != null) { return prefix; } else { return getNativeLibraryResourcePrefix(getOSType(), System.getProperty("os.arch"), System.getProperty("os.name")); } }
/** @return The default value for DLT_RAW (platform specific) */ private int getDefaultDltRaw() { switch (Platform.getOSType()) { case Platform.OPENBSD: return DLT_RAW_OPENBSD; default: return DLT_RAW_DEFAULT; } } }
/** @return The default address family for IPv6 addresses (platform specific) */ private int getDefaultAfInet6() { switch (Platform.getOSType()) { case Platform.MAC: return AF_INET6_MAC; case Platform.FREEBSD: case Platform.KFREEBSD: return AF_INET6_FREEBSD; case Platform.LINUX: case Platform.ANDROID: return AF_INET6_LINUX; default: return AF_INET6_DEFAULT; } }
/** Generate a canonical String prefix based on the current OS type/arch/name. */ static String getNativeLibraryResourcePrefix() { String prefix = System.getProperty("jna.prefix"); if(prefix != null) { return prefix; } else { return getNativeLibraryResourcePrefix(getOSType(), System.getProperty("os.arch"), System.getProperty("os.name")); } }
@NotNull static String getPlatformFolderName() { String result; if (Platform.isMac()) { result = "macosx"; } else if (Platform.isWindows()) { result = "win"; } else if (Platform.isLinux() || Platform.isAndroid()) { result = "linux"; } else if (Platform.isFreeBSD()) { result = "freebsd"; } else if (Platform.isOpenBSD()) { result = "openbsd"; } else { throw new IllegalStateException("Platform " + Platform.getOSType() + " is not supported"); } return result; }
private static String getNativeLibraryName() { String result; if (Platform.isMac()) { result = "libpty.dylib"; } else if (Platform.isWindows()) { result = "winpty.dll"; } else if (Platform.isLinux() || Platform.isFreeBSD() || Platform.isOpenBSD() || Platform.isAndroid()) { result = "libpty.so"; } else { throw new IllegalStateException("Platform " + Platform.getOSType() + " is not supported"); } return result; }
try { Platform.getOSType();
try { Platform.getOSType();
switch (com.sun.jna.Platform.getOSType()) { case com.sun.jna.Platform.FREEBSD: platform = PlatformEnum.FREEBSD;