The Labs \ Source Viewer \ SSCLI \ System.Net \ NameInfoFlags

  1. //------------------------------------------------------------------------------
  2. // <copyright file="_OSSOCK.cs" company="Microsoft">
  3. //
  4. // Copyright (c) 2006 Microsoft Corporation. All rights reserved.
  5. //
  6. // The use and distribution terms for this software are contained in the file
  7. // named license.txt, which can be found in the root of this distribution.
  8. // By using this software in any fashion, you are agreeing to be bound by the
  9. // terms of this license.
  10. //
  11. // You must not remove this notice, or any other, from this software.
  12. //
  13. // </copyright>
  14. //------------------------------------------------------------------------------
  15. namespace System.Net
  16. {
  17.     using System.Net.Sockets;
  18.     using System.Runtime.InteropServices;
  19.    
  20.     //
  21.     // Argument structure for IP_ADD_MEMBERSHIP and IP_DROP_MEMBERSHIP.
  22.     //
  23.     [StructLayout(LayoutKind.Sequential)]
  24.     internal struct IPMulticastRequest
  25.     {
  26.         internal int MulticastAddress;
  27.         // IP multicast address of group
  28.         internal int InterfaceAddress;
  29.         // local IP address of interface
  30.         static internal readonly int Size = Marshal.SizeOf(typeof(IPMulticastRequest));
  31.     }
  32.    
  33.     [StructLayout(LayoutKind.Sequential)]
  34.     internal struct Linger
  35.     {
  36.         internal short OnOff;
  37.         // option on/off
  38.         internal short Time;
  39.         // linger time
  40.         static internal readonly int Size = Marshal.SizeOf(typeof(Linger));
  41.     }
  42.    
  43.     [StructLayout(LayoutKind.Sequential)]
  44.     internal struct WSABuffer
  45.     {
  46.         internal int Length;
  47.         // Length of Buffer
  48.         internal IntPtr Pointer;
  49.         // Pointer to Buffer
  50.     }
  51.    
  52.     [StructLayout(LayoutKind.Sequential)]
  53.     internal class TransmitFileBuffers
  54.     {
  55.         internal IntPtr preBuffer;
  56.         // Pointer to Buffer
  57.         internal int preBufferLength;
  58.         // Length of Buffer
  59.         internal IntPtr postBuffer;
  60.         // Pointer to Buffer
  61.         internal int postBufferLength;
  62.         // Length of Buffer
  63.     }
  64.    
  65.     [StructLayout(LayoutKind.Sequential)]
  66.     internal struct WSAData
  67.     {
  68.         internal short wVersion;
  69.         internal short wHighVersion;
  70.         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 257)]
  71.         internal string szDescription;
  72.         [MarshalAs(UnmanagedType.ByValTStr, SizeConst = 129)]
  73.         internal string szSystemStatus;
  74.         internal short iMaxSockets;
  75.         internal short iMaxUdpDg;
  76.         internal IntPtr lpVendorInfo;
  77.     }
  78.    
  79.     // data structures and types needed for getaddrinfo calls.
  80.     [StructLayout(LayoutKind.Sequential, CharSet = CharSet.Ansi)]
  81.     unsafe internal struct AddressInfo
  82.     {
  83.         internal AddressInfoHints ai_flags;
  84.         internal AddressFamily ai_family;
  85.         internal SocketType ai_socktype;
  86.         internal ProtocolFamily ai_protocol;
  87.         internal int ai_addrlen;
  88.         internal sbyte* ai_canonname;
  89.         // Ptr to the cannonical name - check for NULL
  90.         internal byte* ai_addr;
  91.         // Ptr to the sockaddr structure
  92.         internal AddressInfo* ai_next;
  93.         // Ptr to the next AddressInfo structure
  94.     }
  95.    
  96.     [Flags()]
  97.     internal enum AddressInfoHints
  98.     {
  99.         AI_PASSIVE = 1,
  100. /* Socket address will be used in bind() call */        AI_CANONNAME = 2,
  101. /* Return canonical name in first ai_canonname */        AI_NUMERICHOST = 4
  102.         /* Nodename must be a numeric address string */    }
  103.    
  104.     [Flags()]
  105.     internal enum NameInfoFlags
  106.     {
  107.         NI_NOFQDN = 1,
  108. /* Only return nodename portion for local hosts */        NI_NUMERICHOST = 2,
  109. /* Return numeric form of the host's address */        NI_NAMEREQD = 4,
  110. /* Error if the host's name not in DNS */        NI_NUMERICSERV = 8,
  111. /* Return numeric form of the service (port #) */        NI_DGRAM = 16
  112.         /* Service is a datagram service */    }
  113.    
  114.     // Argument structure for IPV6_ADD_MEMBERSHIP and IPV6_DROP_MEMBERSHIP.
  115.     [StructLayout(LayoutKind.Sequential)]
  116.     internal struct IPv6MulticastRequest
  117.     {
  118.         [MarshalAs(UnmanagedType.ByValArray, SizeConst = 16)]
  119.         internal byte[] MulticastAddress;
  120.         // IP address of group
  121.         internal int InterfaceIndex;
  122.         // local interface index
  123.         static internal readonly int Size = Marshal.SizeOf(typeof(IPv6MulticastRequest));
  124.     }
  125.    
  126.     //
  127.     // used as last parameter to WSASocket call
  128.     //
  129.     [Flags()]
  130.     internal enum SocketConstructorFlags
  131.     {
  132.         WSA_FLAG_OVERLAPPED = 1,
  133.         WSA_FLAG_MULTIPOINT_C_ROOT = 2,
  134.         WSA_FLAG_MULTIPOINT_C_LEAF = 4,
  135.         WSA_FLAG_MULTIPOINT_D_ROOT = 8,
  136.         WSA_FLAG_MULTIPOINT_D_LEAF = 16
  137.     }
  138. }
  139. // namespace System.Net

Developer Fusion