NTP Analyzer  0.8.2
Analyze the operation of time servers
AssociationEntry.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 namespace Ntp.Analyzer.Objects
23 {
24  public sealed class AssociationEntry : PersistentObject
25  {
27  int id, int hostId, char tallyChar,
28  string remote, string refid, int stratus, char peerType,
29  int lastPoll, int poll, int reach,
30  double delay, double offset, double jitter)
31  : base(id)
32  {
33  HostId = hostId;
34  TallyChar = tallyChar;
35  Remote = remote;
36  this.refid = refid;
37  Stratus = stratus;
38  PeerType = peerType;
39  LastPoll = lastPoll;
40  Poll = poll;
41  Reach = reach;
42  Delay = delay;
43  Offset = offset;
44  Jitter = jitter;
45  }
46 
48  int hostId, char tallyChar,
49  string remote, string refid, int stratus, char peerType,
50  int lastPoll, int poll, int reach,
51  double delay, double offset, double jitter)
52  {
53  HostId = hostId;
54  TallyChar = tallyChar;
55  Remote = remote;
56  this.refid = refid;
57  Stratus = stratus;
58  PeerType = peerType;
59  LastPoll = lastPoll;
60  Poll = poll;
61  Reach = reach;
62  Delay = delay;
63  Offset = offset;
64  Jitter = jitter;
65  }
66 
67  private readonly string refid;
68 
73  public TallyCode TallyCode
74  {
75  get
76  {
77  switch (TallyChar)
78  {
79  case ' ':
80  return TallyCode.Reject;
81  case 'x':
82  return TallyCode.FalseTick;
83  case '.':
84  return TallyCode.Excess;
85  case '-':
86  return TallyCode.Outlyer;
87  case '+':
88  return TallyCode.Candidat;
89  case '#':
90  return TallyCode.Selected;
91  case '*':
92  return TallyCode.SysPeer;
93  case 'o':
94  return TallyCode.PpsPeer;
95  default:
96  return TallyCode.Undefined;
97  }
98  }
99  }
100 
105  public char TallyChar { get; }
106 
111  public int HostId { get; }
112 
117  public string Remote { get; }
118 
123  public string Refid => refid ?? "0.0.0.0";
124 
129  public int Stratus { get; }
130 
135  public char PeerType { get; }
136 
141  public int LastPoll { get; }
142 
147  public int Poll { get; }
148 
153  public int Reach { get; }
154 
159  public double Delay { get; }
160 
165  public double Offset { get; }
166 
171  public double Jitter { get; }
172  }
173 }
AssociationEntry(int id, int hostId, char tallyChar, string remote, string refid, int stratus, char peerType, int lastPoll, int poll, int reach, double delay, double offset, double jitter)
AssociationEntry(int hostId, char tallyChar, string remote, string refid, int stratus, char peerType, int lastPoll, int poll, int reach, double delay, double offset, double jitter)