Bladeren bron

[System] Add stub for System.Net.WebSockets

Jérémie Laval 13 jaren geleden
bovenliggende
commit
3bc8c42183

+ 0 - 0
mcs/class/System/System.Net.WebSockets/ClientWebSocket.cs


+ 79 - 0
mcs/class/System/System.Net.WebSockets/ClientWebSocketOptions.cs

@@ -0,0 +1,79 @@
+//
+// ClientWebSocketOptions.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Net;
+using System.Security.Principal;
+using System.Security.Cryptography.X509Certificates;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public sealed class ClientWebSocketOptions
+	{
+		public X509CertificateCollection ClientCertificates { get; set; }
+
+		public CookieContainer Cookies { get; set; }
+
+		public ICredentials Credentials { get; set; }
+
+		public TimeSpan KeepAliveInterval { get; set; }
+
+		public IWebProxy Proxy { get; set; }
+
+		public bool UseDefaultCredentials { get; set; }
+
+		[MonoTODO]
+		public void AddSubProtocol (string subProtocol)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public void SetBuffer (int receiveBufferSize, int sendBufferSize)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public void SetBuffer (int receiveBufferSize, int sendBufferSize, ArraySegment<byte> buffer)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public void SetRequestHeader (string headerName, string headerValue)
+		{
+			throw new NotImplementedException ();
+		}
+	}
+}
+
+#endif

+ 45 - 0
mcs/class/System/System.Net.WebSockets/HttpListenerWebSocketContext.cs

@@ -0,0 +1,45 @@
+//
+// HttpListenerWebSocketContext.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Net;
+using System.Security.Principal;
+using System.Security.Cryptography.X509Certificates;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public class HttpListenerWebSocketContext : WebSocketContext
+	{
+		
+	}
+}
+
+#endif

+ 128 - 0
mcs/class/System/System.Net.WebSockets/WebSocket.cs

@@ -0,0 +1,128 @@
+//
+// WebSocket.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public abstract class WebSocket : IDisposable
+	{
+		protected WebSocket ()
+		{
+			
+		}
+
+		public abstract Nullable<WebSocketCloseStatus> CloseStatus { get; }
+		public abstract string CloseStatusDescription { get; }
+		public abstract WebSocketState State { get; }
+		public abstract string SubProtocol { get; }
+
+		[MonoTODO]
+		public static TimeSpan DefaultKeepAliveInterval {
+			get {
+				throw new NotImplementedException ();
+			}
+		}
+
+		public abstract void Abort ();
+		
+		public abstract Task CloseAsync (WebSocketCloseStatus closeStatus,
+		                                 string statusDescription,
+		                                 CancellationToken cancellationToken);
+
+		public abstract Task CloseOutputAsync (WebSocketCloseStatus closeStatus,
+		                                       string statusDescription,
+		                                       CancellationToken cancellationToken);
+
+		public abstract Task<WebSocketReceiveResult> ReceiveAsync (ArraySegment<byte> buffer,
+		                                                           CancellationToken cancellationToken);
+
+		public abstract Task SendAsync (ArraySegment<byte> buffer,
+		                                WebSocketMessageType messageType,
+		                                bool endOfMessage,
+		                                CancellationToken cancellationToken);
+
+		[MonoTODO]
+		public static ArraySegment<byte> CreateClientBuffer (int receiveBufferSize, int sendBufferSize)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static WebSocket CreateClientWebSocket (Stream innerStream,
+		                                               string subProtocol,
+		                                               int receiveBufferSize,
+		                                               int sendBufferSize,
+		                                               TimeSpan keepAliveInterval,
+		                                               bool useZeroMaskingKey,
+		                                               ArraySegment<byte> internalBuffer)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public static ArraySegment<byte> CreateServerBuffer (int receiveBufferSize)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[ObsoleteAttribute, MonoTODO]
+		public static bool IsApplicationTargeting45 ()
+		{
+			return true;
+		}
+
+		[MonoTODO]
+		public static void RegisterPrefixes ()
+		{
+			throw new NotImplementedException ();
+		}
+
+		public abstract void Dispose ();
+
+		protected static bool IsStateTerminal (WebSocketState state)
+		{
+			return state == WebSocketState.Closed || state == WebSocketState.Aborted;
+		}
+
+		[MonoTODO]
+		protected static void ThrowOnInvalidState (WebSocketState state, params WebSocketState[] validStates)
+		{
+			foreach (var validState in validStates)
+				if (validState == state)
+					return;
+
+			throw new NotImplementedException ();
+		}
+	}
+}
+
+#endif

+ 51 - 0
mcs/class/System/System.Net.WebSockets/WebSocketCloseStatus.cs

@@ -0,0 +1,51 @@
+//
+// WebSocketCloseStatus.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public enum WebSocketCloseStatus
+	{
+		NormalClosure = 1000,
+		EndpointUnavailable = 1001,
+		ProtocolError = 1002,
+		InvalidMessageType = 1003,
+		Empty,
+		InvalidPayloadData = 1007,
+		PolicyViolation = 1008,
+		MessageTooBig = 1004,
+		MandatoryExtension = 1010,
+		InternalServerError
+	}
+}
+
+#endif

+ 70 - 0
mcs/class/System/System.Net.WebSockets/WebSocketContext.cs

@@ -0,0 +1,70 @@
+//
+// WebSocketContext.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Security.Principal;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public abstract class WebSocketContext
+	{
+		protected WebSocketContext ()
+		{
+			
+		}
+
+		public abstract CookieCollection CookieCollection { get; }
+
+		public abstract NameValueCollection Headers { get; }
+
+		public abstract bool IsAuthenticated { get; }
+
+		public abstract bool IsLocal { get; }
+
+		public abstract bool IsSecureConnection { get; }
+
+		public abstract string Origin { get; }
+
+		public abstract Uri RequestUri { get; }
+
+		public abstract string SecWebSocketKey { get; }
+
+		public abstract IEnumerable<string> SecWebSocketProtocols { get; }
+
+		public abstract string SecWebSocketVersion { get; }
+
+		public abstract IPrincipal User { get; }
+
+		public abstract WebSocket WebSocket { get; }
+	}
+}
+
+#endif

+ 51 - 0
mcs/class/System/System.Net.WebSockets/WebSocketError.cs

@@ -0,0 +1,51 @@
+//
+// WebSocketError.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public enum WebSocketError
+	{
+		Success,
+		InvalidMessageType,
+		Faulted,
+		NativeError,
+		NotAWebSocket,
+		UnsupportedVersion,
+		UnsupportedProtocol,
+		HeaderError,
+		ConnectionClosedPrematurely,
+		InvalidState
+	}
+}
+
+#endif

+ 116 - 0
mcs/class/System/System.Net.WebSockets/WebSocketException.cs

@@ -0,0 +1,116 @@
+//
+// WebSocketException.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Security.Principal;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public sealed class WebSocketException : Win32Exception
+	{
+		public WebSocketException ()
+		{
+			
+		}
+
+		public WebSocketException (int nativeError) : base (nativeError)
+		{
+			
+		}
+
+		public WebSocketException (string message) : base (message)
+		{
+			
+		}
+
+		public WebSocketException (WebSocketError error)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (int nativeError, Exception innerException)
+		{
+			
+		}
+
+		public WebSocketException (int nativeError, string message) : base (nativeError, message)
+		{
+			
+		}
+
+		public WebSocketException (string message, Exception innerException) : base (message, innerException)
+		{
+			
+		}
+
+		public WebSocketException (WebSocketError error, Exception innerException) : base (innerException)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (WebSocketError error, int nativeError) : base (nativeError)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (WebSocketError error, string message) : base (message)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (WebSocketError error, int nativeError, Exception innerException) : base (nativeError)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (WebSocketError error, int nativeError, string message) : base (nativeError, message)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (WebSocketError error, string message, Exception innerException)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketException (WebSocketError error, int nativeError, string message, Exception innerException) : base (nativeError, message)
+		{
+			WebSocketErrorCode = error;
+		}
+
+		public WebSocketError WebSocketErrorCode {
+			get;
+			private set;
+		}
+	}
+}
+
+#endif

+ 44 - 0
mcs/class/System/System.Net.WebSockets/WebSocketMessageType.cs

@@ -0,0 +1,44 @@
+//
+// WebSocketMessageType.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public enum WebSocketMessageType
+	{
+		Text,
+		Binary,
+		Close
+	}
+}
+
+#endif

+ 82 - 0
mcs/class/System/System.Net.WebSockets/WebSocketReceiveResult.cs

@@ -0,0 +1,82 @@
+//
+// WebSocketReceiveResult.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Security.Principal;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public class WebSocketReceiveResult
+	{
+		[MonoTODO]
+		public WebSocketReceiveResult (int count, WebSocketMessageType messageType, bool endOfMessage)
+		{
+			throw new NotImplementedException ();
+		}
+
+		[MonoTODO]
+		public WebSocketReceiveResult (int count,
+		                               WebSocketMessageType messageType,
+		                               bool endOfMessage,
+		                               WebSocketCloseStatus? closeStatus,
+		                               string closeStatusDescription)
+		{
+			throw new NotImplementedException ();
+		}
+
+		public WebSocketCloseStatus? CloseStatus {
+			get;
+			private set;
+		}
+
+		public string CloseStatusDescription {
+			get;
+			private set;
+		}
+
+		public int Count {
+			get;
+			private set;
+		}
+
+		public bool EndOfMessage {
+			get;
+			private set;
+		}
+
+		public WebSocketMessageType MessageType {
+			get;
+			private set;
+		}
+	}
+}
+
+#endif

+ 48 - 0
mcs/class/System/System.Net.WebSockets/WebSocketState.cs

@@ -0,0 +1,48 @@
+//
+// WebSocketState.cs
+//
+// Authors:
+//    Jérémie Laval <jeremie dot laval at xamarin dot com>
+//
+// Copyright 2013 Xamarin Inc (http://www.xamarin.com).
+//
+// Permission is hereby granted, free of charge, to any person obtaining a copy
+// of this software and associated documentation files (the "Software"), to deal
+// in the Software without restriction, including without limitation the rights
+// to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
+// copies of the Software, and to permit persons to whom the Software is
+// furnished to do so, subject to the following conditions:
+//
+// The above copyright notice and this permission notice shall be included in
+// all copies or substantial portions of the Software.
+//
+// THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
+// IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
+// FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
+// AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
+// LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
+// OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
+// THE SOFTWARE.
+//
+//
+
+#if NET_4_5
+
+using System;
+using System.Runtime.CompilerServices;
+
+namespace System.Net.WebSockets
+{
+	public enum WebSocketState
+	{
+		None,
+		Connecting,
+		Open,
+		CloseSent,
+		CloseReceived,
+		Closed,
+		Aborted
+	}
+}
+
+#endif