当前位置: 首页>>代码示例>>C#>>正文


C# Net.Interop类代码示例

本文整理汇总了C#中System.Net.Interop的典型用法代码示例。如果您正苦于以下问题:C# Interop类的具体用法?C# Interop怎么用?C# Interop使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


Interop类属于System.Net命名空间,在下文中一共展示了Interop类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: OperationReturnedSomething

 public void OperationReturnedSomething(string operation, Interop.SECURITY_STATUS errorCode)
 {
     if (IsEnabled())
     {
         WriteEvent(OperationReturnedSomethingId, operation, errorCode);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs

示例2: InitializeSecurityContext

 public void InitializeSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, string targetName, Interop.SspiCli.ContextFlags inFlags)
 {
     if (IsEnabled())
     {
         InitializeSecurityContext(IdOf(credential), IdOf(context), targetName, inFlags);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs

示例3: AcceptSecurityContext

 public void AcceptSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, Interop.SspiCli.ContextFlags inFlags)
 {
     if (IsEnabled())
     {
         AcceptSecurityContext(IdOf(credential), IdOf(context), inFlags);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs

示例4: AcquireCredentialsHandle

 public void AcquireCredentialsHandle(string packageName, Interop.SspiCli.CredentialUse intent, object authdata)
 {
     if (IsEnabled())
     {
         AcquireCredentialsHandle(packageName, intent, IdOf(authdata));
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs

示例5: SetTimespanTimeout

        private void SetTimespanTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type, TimeSpan value)
        {
            Int64 timeoutValue;

            //
            // All timeouts are defined as USHORT in native layer (except MinSendRate, which is ULONG). Make sure that
            // timeout value is within range.
            //
            timeoutValue = Convert.ToInt64(value.TotalSeconds);

            if (timeoutValue < 0 || timeoutValue > ushort.MaxValue)
            {
                throw new ArgumentOutOfRangeException(nameof(value));
            }

            //
            // Use local state to get values for other timeouts. Call into the native layer and if that 
            // call succeeds, update local state.
            //

            int[] currentTimeouts = _timeouts;
            currentTimeouts[(int)type] = (int)timeoutValue;
            _listener.SetServerTimeout(currentTimeouts, _minSendBytesPerSecond);
            _timeouts[(int)type] = (int)timeoutValue;
        }
开发者ID:dotnet,项目名称:corefx,代码行数:25,代码来源:HttpListenerTimeoutManager.Windows.cs

示例6: AcquireDefaultCredential

 public void AcquireDefaultCredential(string packageName, Interop.SspiCli.CredentialUse intent)
 {
     if (IsEnabled())
     {
         WriteEvent(AcquireDefaultCredentialId, packageName, intent);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs

示例7: GetTimeout

 private TimeSpan GetTimeout(Interop.HttpApi.HTTP_TIMEOUT_TYPE type)
 {
     //
     // Since we maintain local state, GET is local.
     //
     return new TimeSpan(0, 0, (int)_timeouts[(int)type]);
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:HttpListenerTimeoutManager.Windows.cs

示例8: MicrosecondsToTimeValue

        private static void MicrosecondsToTimeValue(long microseconds, ref Interop.Winsock.TimeValue socketTime)
        {
            const int microcnv = 1000000;

            socketTime.Seconds = (int)(microseconds / microcnv);
            socketTime.Microseconds = (int)(microseconds % microcnv);
        }
开发者ID:vbouret,项目名称:corefx,代码行数:7,代码来源:SocketPal.Windows.cs

示例9: FillFdSetFromSocketList

        internal static int FillFdSetFromSocketList(ref Interop.Sys.FdSet fdset, IList socketList)
        {
            if (socketList == null || socketList.Count == 0)
            {
                return 0;
            }

            int maxFd = -1;
            for (int i = 0; i < socketList.Count; i++)
            {
                var socket = socketList[i] as Socket;
                if (socket == null)
                {
                    throw new ArgumentException(SR.Format(SR.net_sockets_select, socketList[i].GetType().FullName, typeof(System.Net.Sockets.Socket).FullName), "socketList");
                }

                int fd = socket._handle.FileDescriptor;
                fdset.Set(fd);

                if (fd > maxFd)
                {
                    maxFd = fd;
                }
            }

            return maxFd + 1;
        }
开发者ID:JonHanna,项目名称:corefx,代码行数:27,代码来源:Socket.Unix.cs

示例10: SecurityContextInputBuffers

 public void SecurityContextInputBuffers(string context, int inputBuffersSize, int outputBufferSize, Interop.SECURITY_STATUS errorCode)
 {
     if (IsEnabled())
     {
         WriteEvent(SecurityContextInputBuffersId, context, inputBuffersSize, outputBufferSize, (int)errorCode);
     }
 }
开发者ID:dotnet,项目名称:corefx,代码行数:7,代码来源:NetEventSource.Security.Windows.cs

示例11: CreateIPHostEntry

        private static unsafe IPHostEntry CreateIPHostEntry(Interop.Sys.HostEntry hostEntry)
        {
            string hostName = null;
            if (hostEntry.CanonicalName != null)
            {
                hostName = Marshal.PtrToStringAnsi((IntPtr)hostEntry.CanonicalName);
            }

            int numAddresses = hostEntry.IPAddressCount;

            IPAddress[] ipAddresses;
            if (numAddresses == 0)
            {
                ipAddresses = Array.Empty<IPAddress>();
            }
            else
            {
                ipAddresses = new IPAddress[numAddresses];

                void* addressListHandle = hostEntry.AddressListHandle;
                var nativeIPAddress = default(Interop.Sys.IPAddress);
                for (int i = 0; i < numAddresses; i++)
                {
                    int err = Interop.Sys.GetNextIPAddress(&hostEntry, &addressListHandle, &nativeIPAddress);
                    Debug.Assert(err == 0);

                    ipAddresses[i] = nativeIPAddress.GetIPAddress();
                }
            }

            int numAliases;
            for (numAliases = 0; hostEntry.Aliases[numAliases] != null; numAliases++)
            {
            }

            string[] aliases;
            if (numAliases == 0)
            {
                aliases = Array.Empty<string>();
            }
            else
            {
                aliases = new string[numAliases];
                for (int i = 0; i < numAliases; i++)
                {
                    Debug.Assert(hostEntry.Aliases[i] != null);
                    aliases[i] = Marshal.PtrToStringAnsi((IntPtr)hostEntry.Aliases[i]);
                }
            }

            Interop.Sys.FreeHostEntry(&hostEntry);

            return new IPHostEntry
            {
                HostName = hostName,
                AddressList = ipAddresses,
                Aliases = aliases
            };
        }
开发者ID:noahfalk,项目名称:corefx,代码行数:59,代码来源:NameResolutionPal.Unix.cs

示例12: SslConnectionInfo

 internal SslConnectionInfo(Interop.libssl.SSL_CIPHER cipher)
 {
     Protocol = (int) MapProtocol(cipher.algorithm_ssl);
     DataCipherAlg = (int) MapCipherAlgorithmType(cipher.algorithm_enc);
     KeyExchangeAlg = (int) MapExchangeAlgorithmType(cipher.algorithm_mkey);
     DataHashAlg = (int) MapHashAlgorithmType(cipher.algorithm_mac);
     // TODO: map key sizes
 }
开发者ID:TAdityaAnirudh,项目名称:corefx,代码行数:8,代码来源:SslConnectionInfo.cs

示例13: SslConnectionInfo

 internal SslConnectionInfo(Interop.libssl.SSL_CIPHER cipher, string protocol)
 {
     Protocol = (int) MapProtocolVersion(protocol);
     DataCipherAlg = (int) MapCipherAlgorithmType((Interop.libssl.CipherAlgorithm) cipher.algorithm_enc);
     KeyExchangeAlg = (int) MapExchangeAlgorithmType((Interop.libssl.KeyExchangeAlgorithm) cipher.algorithm_mkey);
     DataHashAlg = (int) MapHashAlgorithmType((Interop.libssl.DataHashAlgorithm) cipher.algorithm_mac);
     DataKeySize = cipher.alg_bits;
     // TODO (Issue #3362) map key sizes
 }
开发者ID:vbouret,项目名称:corefx,代码行数:9,代码来源:SslConnectionInfo.cs

示例14: CreateHostEntry

        private static unsafe IPHostEntry CreateHostEntry(Interop.libc.hostent* hostent)
        {
            string hostName = null;
            if (hostent->h_name != null)
            {
                hostName = Marshal.PtrToStringAnsi((IntPtr)hostent->h_name);
            }

            int numAddresses;
            for (numAddresses = 0; hostent->h_addr_list[numAddresses] != null; numAddresses++)
            {
            }

            IPAddress[] ipAddresses;
            if (numAddresses == 0)
            {
                ipAddresses = Array.Empty<IPAddress>();
            }
            else
            {
                ipAddresses = new IPAddress[numAddresses];
                for (int i = 0; i < numAddresses; i++)
                {
                    Debug.Assert(hostent->h_addr_list[i] != null);
                    ipAddresses[i] = new IPAddress(*(int*)hostent->h_addr_list[i]);
                }
            }

            int numAliases;
            for (numAliases = 0; hostent->h_aliases[numAliases] != null; numAliases++)
            {
            }

            string[] aliases;
            if (numAliases == 0)
            {
                aliases = Array.Empty<string>();
            }
            else
            {
                aliases = new string[numAliases];
                for (int i = 0; i < numAliases; i++)
                {
                    Debug.Assert(hostent->h_aliases[i] != null);
                    aliases[i] = Marshal.PtrToStringAnsi((IntPtr)hostent->h_aliases[i]);
                }
            }

            return new IPHostEntry
            {
                HostName = hostName,
                AddressList = ipAddresses,
                Aliases = aliases
            };
        }
开发者ID:nblumhardt,项目名称:corefx,代码行数:55,代码来源:NameResolutionPal.Unix.cs

示例15: GetSecurityStatusPalFromInterop

        internal static SecurityStatusPal GetSecurityStatusPalFromInterop(Interop.SecurityStatus win32SecurityStatus)
        {
            SecurityStatusPalErrorCode statusCode;

            if (!s_statusDictionary.TryGetForward(win32SecurityStatus, out statusCode))
            {
                Debug.Fail("Unknown Interop.SecurityStatus value: " + win32SecurityStatus);
                throw new InternalException();
            }
            return new SecurityStatusPal(statusCode);
        }
开发者ID:ESgarbi,项目名称:corefx,代码行数:11,代码来源:SecurityStatusAdapterPal.Windows.cs


注:本文中的System.Net.Interop类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。