1 //------------------------------------------------------------------------------
2 // <copyright file="Internal.cs" company="Microsoft">
3 // Copyright (c) Microsoft Corporation. All rights reserved.
5 //------------------------------------------------------------------------------
7 namespace System.Net.Sockets {
9 using System.Collections;
10 using System.Configuration;
11 using System.Configuration.Assemblies;
12 using System.Diagnostics;
13 using System.Globalization;
16 using System.Net.Sockets;
17 using System.Reflection;
18 using System.Reflection.Emit;
19 using System.Resources;
20 using System.Runtime.InteropServices;
21 using System.Runtime.Serialization;
22 using System.Runtime.Serialization.Formatters;
23 using System.Security;
24 using System.Security.Cryptography;
25 using System.Security.Cryptography.X509Certificates;
26 using System.Security.Permissions;
28 using System.Text.RegularExpressions;
29 using System.Threading;
32 // IO-Control operations are not directly exposed.
33 // blocking is controlled by "Blocking" property on socket (FIONBIO)
34 // amount of data available is queried by "Available" property (FIONREAD)
35 // The other flags are not exposed currently
37 internal static class IoctlSocketConstants {
39 public const int FIONREAD = 0x4004667F;
40 public const int FIONBIO = unchecked((int)0x8004667E);
41 public const int FIOASYNC = unchecked((int)0x8004667D);
42 public const int SIOGETEXTENSIONFUNCTIONPOINTER = unchecked((int)0xC8000006);
45 // not likely to block ([....] IO ok)
52 // SIO_RCVALL_IGMPMCAST
54 // SIO_ASSOCIATE_HANDLE (opcode setting: I, T==1)
55 // SIO_ENABLE_CIRCULAR_QUEUEING (opcode setting: V, T==1)
56 // SIO_GET_BROADCAST_ADDRESS (opcode setting: O, T==1)
57 // SIO_GET_EXTENSION_FUNCTION_POINTER (opcode setting: O, I, T==1)
58 // SIO_MULTIPOINT_LOOPBACK (opcode setting: I, T==1)
59 // SIO_MULTICAST_SCOPE (opcode setting: I, T==1)
60 // SIO_TRANSLATE_HANDLE (opcode setting: I, O, T==1)
61 // SIO_ROUTING_INTERFACE_QUERY (opcode setting: I, O, T==1)
63 // likely to block (reccommended for async IO)
65 // SIO_FIND_ROUTE (opcode setting: O, T==1)
66 // SIO_FLUSH (opcode setting: V, T==1)
67 // SIO_GET_QOS (opcode setting: O, T==1)
68 // SIO_GET_GROUP_QOS (opcode setting: O, I, T==1)
69 // SIO_SET_QOS (opcode setting: I, T==1)
70 // SIO_SET_GROUP_QOS (opcode setting: I, T==1)
71 // SIO_ROUTING_INTERFACE_CHANGE (opcode setting: I, T==1)
72 // SIO_ADDRESS_LIST_CHANGE (opcode setting: T==1)
76 // WinSock 2 extension -- bit values and indices for FD_XXX network events
79 internal enum AsyncEventBits {
89 FdRoutingInterfaceChange = 1 << 8,
90 FdAddressListChange = 1 << 9,
91 FdAllEvents = (1 << 10) - 1,
94 // Array position in NetworkEvents (WSAEnumNetworkEvents).
95 internal enum AsyncEventBitsPos
105 FdRoutingInterfaceChangeBit = 8,
106 FdAddressListChangeBit = 9,
110 [StructLayout(LayoutKind.Sequential)]
111 internal struct NetworkEvents
114 // Indicates which of the FD_XXX network events have occurred.
116 public AsyncEventBits Events;
119 // An array that contains any associated error codes, with an array index that corresponds to the position of event bits in lNetworkEvents. The identifiers FD_READ_BIT, FD_WRITE_BIT and other can be used to index the iErrorCode array.
121 [MarshalAs(UnmanagedType.ByValArray, SizeConst = (int) AsyncEventBitsPos.FdMaxEvents)]
122 public int[] ErrorCodes;
126 // Structure used in select() call, taken from the BSD file sys/time.h.
128 [StructLayout(LayoutKind.Sequential)]
129 internal struct TimeValue {
130 public int Seconds; // seconds
131 public int Microseconds; // and microseconds
133 } // struct TimeValue
134 } // namespace System.Net.Sockets