add NetInterfaceConfig.FlagsString method

This commit is contained in:
Doug MacEachern 2004-09-17 22:32:45 +00:00
parent 2ed6e3d95d
commit 1b50ea38e2
1 changed files with 32 additions and 0 deletions

View File

@ -449,6 +449,38 @@ namespace Hyperic.Sigar {
return inet_ntoa(this.netmask); return inet_ntoa(this.netmask);
} }
} }
public String FlagsString() {
ulong flags = this.Flags;
String retval = "";
if (flags == 0)
retval += "[NO FLAGS] ";
if ((flags & Sigar.IFF_UP) > 0)
retval += "UP ";
if ((flags & Sigar.IFF_BROADCAST) > 0)
retval += "BROADCAST ";
if ((flags & Sigar.IFF_DEBUG) > 0)
retval += "DEBUG ";
if ((flags & Sigar.IFF_LOOPBACK) > 0)
retval += "LOOPBACK ";
if ((flags & Sigar.IFF_POINTOPOINT) > 0)
retval += "POINTOPOINT ";
if ((flags & Sigar.IFF_NOTRAILERS) > 0)
retval += "NOTRAILERS ";
if ((flags & Sigar.IFF_RUNNING) > 0)
retval += "RUNNING ";
if ((flags & Sigar.IFF_NOARP) > 0)
retval += "NOARP ";
if ((flags & Sigar.IFF_PROMISC) > 0)
retval += "PROMISC ";
if ((flags & Sigar.IFF_ALLMULTI) > 0)
retval += "ALLMULTI ";
if ((flags & Sigar.IFF_MULTICAST) > 0)
retval += "MULTICAST ";
return retval;
}
} }
[StructLayout(LayoutKind.Sequential)] [StructLayout(LayoutKind.Sequential)]