use sigar_net_interface_flags_to_string
This commit is contained in:
parent
bcbf080fe9
commit
a919d9457f
|
@ -827,6 +827,14 @@ JNIEXPORT jobjectArray SIGAR_JNIx(getNetRouteList)
|
|||
return routearray;
|
||||
}
|
||||
|
||||
JNIEXPORT jstring SIGAR_JNI(NetFlags_getIfFlagsString)
|
||||
(JNIEnv *env, jclass cls, jlong flags)
|
||||
{
|
||||
char buf[1024];
|
||||
sigar_net_interface_flags_to_string(flags, buf);
|
||||
return JENV->NewStringUTF(env, buf);
|
||||
}
|
||||
|
||||
JNIEXPORT jobjectArray SIGAR_JNIx(getNetConnectionList)
|
||||
(JNIEnv *env, jobject sigar_obj, jint flags)
|
||||
{
|
||||
|
|
|
@ -155,38 +155,7 @@ public class NetFlags {
|
|||
* @return String representation of network interface flags.
|
||||
* @see org.hyperic.sigar.NetInterfaceConfig#getFlags
|
||||
*/
|
||||
public static String getIfFlagsString(long flags) {
|
||||
String retval = "";
|
||||
|
||||
if (flags == 0)
|
||||
retval += "[NO FLAGS] ";
|
||||
if ((flags & IFF_UP) > 0)
|
||||
retval += "UP ";
|
||||
if ((flags & IFF_BROADCAST) > 0)
|
||||
retval += "BROADCAST ";
|
||||
if ((flags & IFF_DEBUG) > 0)
|
||||
retval += "DEBUG ";
|
||||
if ((flags & IFF_LOOPBACK) > 0)
|
||||
retval += "LOOPBACK ";
|
||||
if ((flags & IFF_POINTOPOINT) > 0)
|
||||
retval += "POINTOPOINT ";
|
||||
if ((flags & IFF_NOTRAILERS) > 0)
|
||||
retval += "NOTRAILERS ";
|
||||
if ((flags & IFF_RUNNING) > 0)
|
||||
retval += "RUNNING ";
|
||||
if ((flags & IFF_NOARP) > 0)
|
||||
retval += "NOARP ";
|
||||
if ((flags & IFF_PROMISC) > 0)
|
||||
retval += "PROMISC ";
|
||||
if ((flags & IFF_ALLMULTI) > 0)
|
||||
retval += "ALLMULTI ";
|
||||
if ((flags & IFF_SLAVE) > 0)
|
||||
retval += "SLAVE ";
|
||||
if ((flags & IFF_MULTICAST) > 0)
|
||||
retval += "MULTICAST ";
|
||||
|
||||
return retval;
|
||||
}
|
||||
public static native String getIfFlagsString(long flags);
|
||||
|
||||
public static boolean isAnyAddress(String address) {
|
||||
return
|
||||
|
|
|
@ -480,6 +480,8 @@ SIGAR_DECLARE(const char *)sigar_net_connection_state_get(int state)
|
|||
|
||||
SIGAR_DECLARE(char *) sigar_net_interface_flags_to_string(sigar_uint64_t flags, char *buf)
|
||||
{
|
||||
*buf = '\0';
|
||||
|
||||
if (flags == 0) {
|
||||
strcat(buf, "[NO FLAGS] ");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue