1 //
2 // ServicePointManager.cs
3 //
4 // Author:
5 //       Rolf Bjarne Kvinge <rolf@xamarin.com>
6 //
7 // Copyright (c) 2016 Xamarin, Inc.
8 //
9 // Permission is hereby granted, free of charge, to any person obtaining a copy
10 // of this software and associated documentation files (the "Software"), to deal
11 // in the Software without restriction, including without limitation the rights
12 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
13 // copies of the Software, and to permit persons to whom the Software is
14 // furnished to do so, subject to the following conditions:
15 //
16 // The above copyright notice and this permission notice shall be included in
17 // all copies or substantial portions of the Software.
18 //
19 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
20 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
21 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
22 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
23 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
24 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
25 // THE SOFTWARE.
26 
27 using System.Net.Security;
28 
29 namespace System.Net
30 {
31 	public partial class ServicePointManager {
32 		const string EXCEPTION_MESSAGE = "System.Net.ServicePointManager is not supported on the current platform.";
33 
34 		public const int DefaultNonPersistentConnectionLimit = 4;
35 #if MOBILE
36 		public const int DefaultPersistentConnectionLimit = 10;
37 #else
38 		public const int DefaultPersistentConnectionLimit = 2;
39 #endif
40 
ServicePointManager()41 		private ServicePointManager ()
42 		{
43 		}
44 
45 		public static ICertificatePolicy CertificatePolicy {
46 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
47 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
48 		}
49 
50 		public static bool CheckCertificateRevocationList {
51 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
52 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
53 		}
54 
55 		public static int DefaultConnectionLimit {
56 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
57 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
58 		}
59 
60 		public static int DnsRefreshTimeout {
61 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
62 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
63 		}
64 
65 		public static bool EnableDnsRoundRobin {
66 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
67 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
68 		}
69 
70 		public static int MaxServicePointIdleTime {
71 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
72 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
73 		}
74 
75 		public static int MaxServicePoints {
76 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
77 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
78 		}
79 
80 		public static bool ReusePort {
81 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
82 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
83 		}
84 
85 		public static SecurityProtocolType SecurityProtocol {
86 			get;
87 			set;
88 		} = SecurityProtocolType.Tls | SecurityProtocolType.Tls11 | SecurityProtocolType.Tls12;
89 
90 		public static RemoteCertificateValidationCallback ServerCertificateValidationCallback {
91 			get;
92 			set;
93 		}
94 
95 		public static EncryptionPolicy EncryptionPolicy {
96 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
97 		}
98 
99 		public static bool Expect100Continue {
100 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
101 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
102 		}
103 
104 		public static bool UseNagleAlgorithm {
105 			get { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
106 			set { throw new PlatformNotSupportedException (EXCEPTION_MESSAGE); }
107 		}
108 
SetTcpKeepAlive(bool enabled, int keepAliveTime, int keepAliveInterval)109 		public static void SetTcpKeepAlive (bool enabled, int keepAliveTime, int keepAliveInterval)
110 		{
111 			throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
112 		}
113 
FindServicePoint(Uri address)114 		public static ServicePoint FindServicePoint (Uri address)
115 		{
116 			throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
117 		}
118 
FindServicePoint(string uriString, IWebProxy proxy)119 		public static ServicePoint FindServicePoint (string uriString, IWebProxy proxy)
120 		{
121 			throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
122 		}
123 
FindServicePoint(Uri address, IWebProxy proxy)124 		public static ServicePoint FindServicePoint (Uri address, IWebProxy proxy)
125 		{
126 			throw new PlatformNotSupportedException (EXCEPTION_MESSAGE);
127 		}
128 	}
129 }
130