73 new global::Interop.WebSocket.HttpHeader
76 NameLength = (uint)
"Connection".Length,
78 ValueLength = (uint)
"Upgrade".Length
80 new global::Interop.WebSocket.HttpHeader
83 NameLength = (uint)
"Upgrade".Length,
85 ValueLength = (uint)
"websocket".Length
94 new global::Interop.WebSocket.HttpHeader
97 NameLength = (uint)
"Connection".Length,
99 ValueLength = (uint)
"Upgrade".Length
101 new global::Interop.WebSocket.HttpHeader
104 NameLength = (uint)
"Upgrade".Length,
106 ValueLength = (uint)
"websocket".Length
108 new global::Interop.WebSocket.HttpHeader
111 NameLength = (uint)
"Host".Length,
112 Value =
string.
Empty,
115 new global::Interop.WebSocket.HttpHeader
117 Name =
"Sec-WebSocket-Version",
118 NameLength = (uint)
"Sec-WebSocket-Version".Length,
120 ValueLength = (uint)s_supportedVersion.Length
122 new global::Interop.WebSocket.HttpHeader
124 Name =
"Sec-WebSocket-Key",
125 NameLength = (uint)
"Sec-WebSocket-Key".Length,
127 ValueLength = (uint)s_dummyWebsocketKeyBase64.Length
142 int errorCode = global::Interop.WebSocket.WebSocketCreateClientHandle(
null, 0u, out webSocketHandle);
144 if (webSocketHandle ==
null || webSocketHandle.IsInvalid)
150 global::Interop.WebSocket.HttpHeader[]
array =
MarshalHttpHeaders(additionalHeadersPtr, (
int)additionalHeaderCount);
151 string result =
null;
152 global::Interop.WebSocket.HttpHeader[] array2 =
array;
153 for (
int i = 0; i < array2.Length; i++)
155 global::Interop.WebSocket.HttpHeader httpHeader = array2[i];
158 result = httpHeader.Value;
176 int errorCode = global::Interop.WebSocket.WebSocketCreateServerHandle(properties, (uint)propertyCount, out webSocketHandle);
178 if (webSocketHandle ==
null || webSocketHandle.IsInvalid)
184 errorCode = global::Interop.WebSocket.WebSocketEndServerHandshake(webSocketHandle);
190 global::Interop.WebSocket.WebSocketAbortHandle(webSocketHandle);
197 global::Interop.WebSocket.WebSocketDeleteHandle(webSocketPtr);
254 errorCode = global::Interop.WebSocket.WebSocketGetAction(webSocket.
SessionHandle, actionQueue, dataBuffers, ref dataBufferCount, out
action, out bufferType, out var _, out actionContext);
272 global::Interop.WebSocket.WebSocketCompleteAction(webSocket.
SessionHandle, actionContext, (uint)bytesTransferred);
283 global::Interop.WebSocket.Buffer[] dataBuffers =
new global::Interop.WebSocket.Buffer[1];
284 uint dataBufferCount = 1u;
287 IntPtr applicationContext;
289 int hr = global::Interop.WebSocket.WebSocketGetAction(webSocketHandle, actionQueue, dataBuffers, ref dataBufferCount, out
action, out bufferType, out applicationContext, out actionContext);
294 global::Interop.WebSocket.WebSocketCompleteAction(webSocketHandle, actionContext, 0u);
307 if ((httpHeader.Name ==
null && num != 0) || (httpHeader.Name !=
null && num != httpHeader.Name.Length))
314 ptr =
IntPtr.
Add(httpHeaderPtr, offset2);
317 if ((httpHeader.Value ==
null && num != 0) || (httpHeader.Value !=
null && num != httpHeader.Value.Length))
325 global::Interop.WebSocket.HttpHeader[]
array =
new global::Interop.WebSocket.HttpHeader[nativeHeaderCount];
327 for (
int i = 0; i < nativeHeaderCount; i++)
static string ToBase64String(byte[] inArray)
static void ThrowPlatformNotSupportedException_WSPC()
void ValidateNativeBuffers(WebSocketProtocolComponent.Action action, WebSocketProtocolComponent.BufferType bufferType, global::Interop.WebSocket.Buffer[] dataBuffers, uint dataBufferCount)
override WebSocketState State
static void DrainActionQueue(SafeHandle webSocketHandle, ActionQueue actionQueue)
static readonly global::Interop.WebSocket.HttpHeader[] s_initialClientRequestHeaders
static WebSocketException ConvertObjectDisposedException(WebSocketBase webSocket, ObjectDisposedException innerException)
static bool Succeeded(int hr)
static WebSocketProtocolComponent()
static void WebSocketSend(WebSocketBase webSocket, BufferType bufferType, global::Interop.WebSocket.Buffer buffer)
static void WebSocketGetAction(WebSocketBase webSocket, ActionQueue actionQueue, global::Interop.WebSocket.Buffer[] dataBuffers, ref uint dataBufferCount, out Action action, out BufferType bufferType, out IntPtr actionContext)
static void MarshalAndVerifyHttpHeader(IntPtr httpHeaderPtr, ref global::Interop.WebSocket.HttpHeader httpHeader)
static global::Interop.WebSocket.HttpHeader[] MarshalHttpHeaders(IntPtr nativeHeadersPtr, int nativeHeaderCount)
static string SupportedVersion
static readonly IntPtr s_webSocketDllHandle
static string GetSupportedVersion()
static void WebSocketAbortHandle(SafeHandle webSocketHandle)
static void WebSocketDeleteHandle(IntPtr webSocketPtr)
static readonly string s_supportedVersion
static void ThrowIfSessionHandleClosed(WebSocketBase webSocket)
@ IndicateReceiveComplete
static void WebSocketSendWithoutBody(WebSocketBase webSocket, BufferType bufferType)
static void WebSocketCompleteAction(WebSocketBase webSocket, IntPtr actionContext, int bytesTransferred)
static readonly string s_dummyWebsocketKeyBase64
static readonly global::Interop.WebSocket.HttpHeader[] s_ServerFakeRequestHeaders
@ DisableUtf8Verification
static void ThrowOnError(int errorCode)
static void WebSocketReceive(WebSocketBase webSocket)
static void WebSocketCreateServerHandle(global::Interop.WebSocket.Property[] properties, int propertyCount, out SafeWebSocketHandle webSocketHandle)
static IntPtr ReadIntPtr(object ptr, int ofs)
static int ReadInt32(object ptr, int ofs)
static unsafe? string PtrToStringAnsi(IntPtr ptr)
static string Format(string resourceFormat, object p1)
static string net_WebSockets_InvalidState_ClosedOrAborted
static IntPtr Add(IntPtr pointer, int offset)
static readonly IntPtr Zero