Merge pull request #3142 from henricm/fix-for-win-mono_string_to_utf8
[mono.git] / mcs / class / referencesource / System / net / System / Net / NetworkInformation / PingOptions.cs
1  //determines which options will be used for sending icmp requests, as well as what options
2 //were set in the returned icmp reply.
3
4 namespace System.Net.NetworkInformation
5 {
6     // Represent the possible ip options used for the icmp packet
7     public class PingOptions
8     {
9         const int DontFragmentFlag = 2;
10         int ttl = 128;
11         bool dontFragment;
12 #if !MONO
13         internal PingOptions (IPOptions options) {
14             this.ttl = options.ttl;
15             this.dontFragment = ((options.flags & DontFragmentFlag) > 0 ? true : false);
16         }
17 #endif
18         public PingOptions (int ttl, bool dontFragment) {
19             if (ttl <= 0) {
20                 throw new ArgumentOutOfRangeException("ttl");
21             }
22             
23             this.ttl = ttl;
24             this.dontFragment = dontFragment;
25         }
26
27         public PingOptions () {
28         }
29
30         public int Ttl {
31             get {
32                 return ttl;
33             }
34             set {
35                 if (value <= 0) {
36                     throw new ArgumentOutOfRangeException("value");
37                 }
38                 ttl = value; //useful to discover routes
39             }
40         }
41
42         public bool DontFragment {
43             get {
44                 return dontFragment;
45             }
46             set {
47                 dontFragment = value;  //useful for discovering mtu
48             }
49         }
50     }
51 }