本文整理汇总了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);
}
}
示例2: InitializeSecurityContext
public void InitializeSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, string targetName, Interop.SspiCli.ContextFlags inFlags)
{
if (IsEnabled())
{
InitializeSecurityContext(IdOf(credential), IdOf(context), targetName, inFlags);
}
}
示例3: AcceptSecurityContext
public void AcceptSecurityContext(SafeFreeCredentials credential, SafeDeleteContext context, Interop.SspiCli.ContextFlags inFlags)
{
if (IsEnabled())
{
AcceptSecurityContext(IdOf(credential), IdOf(context), inFlags);
}
}
示例4: AcquireCredentialsHandle
public void AcquireCredentialsHandle(string packageName, Interop.SspiCli.CredentialUse intent, object authdata)
{
if (IsEnabled())
{
AcquireCredentialsHandle(packageName, intent, IdOf(authdata));
}
}
示例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;
}
示例6: AcquireDefaultCredential
public void AcquireDefaultCredential(string packageName, Interop.SspiCli.CredentialUse intent)
{
if (IsEnabled())
{
WriteEvent(AcquireDefaultCredentialId, packageName, intent);
}
}
示例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]);
}
示例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);
}
示例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;
}
示例10: SecurityContextInputBuffers
public void SecurityContextInputBuffers(string context, int inputBuffersSize, int outputBufferSize, Interop.SECURITY_STATUS errorCode)
{
if (IsEnabled())
{
WriteEvent(SecurityContextInputBuffersId, context, inputBuffersSize, outputBufferSize, (int)errorCode);
}
}
示例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
};
}
示例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
}
示例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
}
示例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
};
}
示例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);
}