Ejemplo n.º 1
0
		public static Win32IPAddressCollection FromAnycast (IntPtr ptr)
		{
			Win32IPAddressCollection c = new Win32IPAddressCollection ();
			Win32_IP_ADAPTER_ANYCAST_ADDRESS a;
			for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
				a = (Win32_IP_ADAPTER_ANYCAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_ANYCAST_ADDRESS));
				c.InternalAdd (a.Address.GetIPAddress ());
			}
			return c;
		}
        public static Win32IPAddressCollection FromSocketAddress(Win32_SOCKET_ADDRESS addr)
        {
            Win32IPAddressCollection c = new Win32IPAddressCollection();

            if (addr.Sockaddr != IntPtr.Zero)
            {
                c.InternalAdd(addr.GetIPAddress());
            }
            return(c);
        }
Ejemplo n.º 3
0
		public static Win32IPAddressCollection FromAnycast (IntPtr ptr)
		{
			Win32IPAddressCollection c = new Win32IPAddressCollection ();
			Win32_IP_ADAPTER_ANYCAST_ADDRESS a;
			for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
				a = (Win32_IP_ADAPTER_ANYCAST_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_ANYCAST_ADDRESS));
				c.Add (a.Address.GetIPAddress ());
			}
			c.is_readonly = true;
			return c;
		}
        public static Win32IPAddressCollection FromWinsServer(IntPtr ptr)
        {
            Win32IPAddressCollection             c = new Win32IPAddressCollection();
            Win32_IP_ADAPTER_WINS_SERVER_ADDRESS a;

            for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next)
            {
                a = (Win32_IP_ADAPTER_WINS_SERVER_ADDRESS)Marshal.PtrToStructure(p, typeof(Win32_IP_ADAPTER_WINS_SERVER_ADDRESS));
                c.InternalAdd(a.Address.GetIPAddress());
            }
            return(c);
        }
Ejemplo n.º 5
0
		public static Win32IPAddressCollection FromDnsServer (IntPtr ptr)
		{
			Win32IPAddressCollection c = new Win32IPAddressCollection ();
			Win32_IP_ADAPTER_DNS_SERVER_ADDRESS a;
			for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
				a = (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS));
// FIXME: It somehow fails here. Looks like there is something wrong.
//if (a.Address.Sockaddr == IntPtr.Zero) throw new Exception ("pointer " + p + " a.length " + a.Address.SockaddrLength);
				c.InternalAdd (a.Address.GetIPAddress ());
			}
			return c;
		}
Ejemplo n.º 6
0
		public static Win32IPAddressCollection FromDnsServer (IntPtr ptr)
		{
			Win32IPAddressCollection c = new Win32IPAddressCollection ();
			Win32_IP_ADAPTER_DNS_SERVER_ADDRESS a;
			for (IntPtr p = ptr; p != IntPtr.Zero; p = a.Next) {
				a = (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS) Marshal.PtrToStructure (p, typeof (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS));
// FIXME: It somehow fails here. Looks like there is something wrong.
//if (a.Address.Sockaddr == IntPtr.Zero) throw new Exception ("pointer " + p + " a.length " + a.Address.SockaddrLength);
				c.Add (a.Address.GetIPAddress ());
			}
			c.is_readonly = true;
			return c;
		}
        public static Win32IPAddressCollection FromDnsServer(IntPtr ptr)
        {
            Win32IPAddressCollection win32IPAddressCollection = new Win32IPAddressCollection();
            IntPtr intPtr = ptr;

            while (intPtr != IntPtr.Zero)
            {
                Win32_IP_ADAPTER_DNS_SERVER_ADDRESS win32_IP_ADAPTER_DNS_SERVER_ADDRESS = (Win32_IP_ADAPTER_DNS_SERVER_ADDRESS)Marshal.PtrToStructure(intPtr, typeof(Win32_IP_ADAPTER_DNS_SERVER_ADDRESS));
                win32IPAddressCollection.Add(win32_IP_ADAPTER_DNS_SERVER_ADDRESS.Address.GetIPAddress());
                intPtr = win32_IP_ADAPTER_DNS_SERVER_ADDRESS.Next;
            }
            win32IPAddressCollection.is_readonly = true;
            return(win32IPAddressCollection);
        }