NTP Analyzer  0.8.2
Analyze the operation of time servers
CalgaryTimeServer.cs
Go to the documentation of this file.
1 //
2 // Copyright (c) 2013-2017 Carsten Sonne Larsen <cs@innolan.net>
3 //
4 // Permission is hereby granted, free of charge, to any person obtaining a copy
5 // of this software and associated documentation files (the "Software"), to deal
6 // in the Software without restriction, including without limitation the rights
7 // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
8 // copies of the Software, and to permit persons to whom the Software is
9 // furnished to do so, subject to the following conditions:
10 //
11 // The above copyright notice and this permission notice shall be included in
12 // all copies or substantial portions of the Software.
13 //
14 // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
15 // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
16 // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
17 // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
18 // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
19 // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
20 // THE SOFTWARE.
21 
22 using System;
23 using System.Net;
24 
25 namespace Ntp.Analyzer.Objects
26 {
27  public sealed class CalgaryTimeServer : TimeServer
28  {
29  public CalgaryTimeServer(string name, IPAddress address, int orgId)
30  {
31  Name = name;
32  Address = address;
33  SetId(orgId);
34  }
35 
37  int id, int stratum, string country,
38  string name, IPAddress address, string v6Address,
39  bool? useDns, bool? poolMember, string location,
40  string displayLocation, string organization, string geo, string server,
41  string serviceArea, string accessDetails, string accessPolicy,
42  bool? notification, string autoKey, string symKey, string symUrl,
43  string contact, string providerPage, string providerUrl, DateTime updated)
44  : base(id)
45  {
46  Stratum = stratum;
47  Country = country;
48  Name = name;
49  Address = address;
50  V6Address = Scrub(v6Address);
51  this.useDns = useDns;
52  this.poolMember = poolMember;
53  Location = location;
54  DisplayLocation = displayLocation;
55  Organization = Scrub(organization);
56  Geo = Scrub(geo);
57  Location = location;
58  Server = server;
59  ServiceArea = serviceArea;
60  AccessDetails = accessDetails;
61  AccessPolicy = Scrub(accessPolicy);
62  this.notification = notification;
63  AutoKey = Scrub(autoKey);
64  SymKey = Scrub(symKey);
65  SymUrl = Scrub(symUrl);
66  Contact = contact;
67  ProviderPage = providerPage;
68  ProviderUrl = providerUrl;
69  Updated = updated;
70  }
71 
72  private readonly bool? notification;
73  private readonly bool? poolMember;
74  private readonly bool? useDns;
75 
76  public override int Stratum { get; }
77 
78  public override string Country { get; }
79 
80  public override string Name { get; }
81 
82  public override IPAddress Address { get; }
83 
84  public override string V6Address { get; }
85 
86  public override bool ShouldUseDns => useDns ?? false;
87 
88  public override bool IsPoolMember => poolMember ?? false;
89 
90  public override string Location { get; }
91 
92  public override string DisplayLocation { get; }
93 
94  public override string Organization { get; }
95 
96  public override string Geo { get; }
97 
98  public override string Server { get; }
99 
100  public override string ServiceArea { get; }
101 
102  public override string AccessPolicy { get; }
103 
104  public override string AccessDetails { get; }
105 
106  public override bool ShouldNotify => notification ?? false;
107 
108  public override string AutoKey { get; }
109 
110  public override string SymKey { get; }
111 
112  public override string SymUrl { get; }
113 
114  public override string Contact { get; }
115 
116  public override string ProviderPage { get; }
117 
118  public override string ProviderUrl { get; }
119 
120  public override DateTime Updated { get; }
121 
122  private static string Scrub(string input)
123  {
124  if (input == null || input.Trim() == string.Empty)
125  return null;
126 
127  return input.Trim();
128  }
129  }
130 }
CalgaryTimeServer(string name, IPAddress address, int orgId)
CalgaryTimeServer(int id, int stratum, string country, string name, IPAddress address, string v6Address, bool?useDns, bool?poolMember, string location, string displayLocation, string organization, string geo, string server, string serviceArea, string accessDetails, string accessPolicy, bool?notification, string autoKey, string symKey, string symUrl, string contact, string providerPage, string providerUrl, DateTime updated)