ntp-client-0.0.1
Safe HaskellNone
LanguageHaskell2010

Network.NTP.Client.Query

Contents

Synopsis

Documentation

data NtpSettings Source #

Settings of the ntp client.

Constructors

NtpSettings 

Fields

  • ntpServers ∷ [String]

    List of server addresses. At least three servers are needed.

  • ntpRequiredNumberOfResultsInt

    Minimum number of results to compute the offset, this should be less or equal to the length of ntpServers (we send a single tnp packet / query to a each server, if the dns name resolves to many addresses we pick the first one).

  • ntpResponseTimeoutMicrosecond

    Timeout for receiving a response from an ntp server.

  • ntpPollDelayMicrosecond

    How long to wait between two rounds of requests. This should be set to something of an order of one hour, ntp servers should not be abused.

data NtpStatus Source #

The Ntp client state: either cached results is availbale, or the ntp client is engaged in ntp-protocol or there was a failure: e.g. connection lost, or dns lookups did not return at least ntpRequiredNumberOfResults addresses.

Constructors

NtpDrift !NtpOffset

The difference between NTP time and local system time

NtpSyncPending

NTP client has send requests to the servers

NtpSyncUnavailable

NTP is not available: the client has not received any respond within ntpResponseTimeout from at least ntpRequiredNumberOfResults servers.

Instances

Instances details
Eq NtpStatus Source # 
Instance details

Defined in Network.NTP.Client.Query

Show NtpStatus Source # 
Instance details

Defined in Network.NTP.Client.Query

ntpQuery ∷ IOManager → Tracer IO NtpTraceNtpSettingsIO NtpStatus Source #

Perform a series of NTP queries: one for each dns name. Resolve each dns name, get local addresses: both IPv4 and IPv6 and engage in ntp protocol towards one ip address per address family per dns name, but only for address families for which we have a local address. This is to avoid trying to send IPv4/6 requests if IPv4/6 gateway is not configured.

It may throw an IOException:

  • if neither IPv4 nor IPv6 address is configured
  • if network I/O errors

Logging

data IPVersion Source #

A tag which describes which version of the ip protocol was used.

Constructors

IPv4 
IPv6 

Instances

Instances details
Eq IPVersion Source # 
Instance details

Defined in Network.NTP.Client.Query

Show IPVersion Source # 
Instance details

Defined in Network.NTP.Client.Query

data ResultOrFailure a Source #

Result of two threads running concurrently.

Constructors

BothSucceeded !a

both threads suceeded

SuccessAndFailure !a !IPVersion !IOException

one of the threads errors. IPVersion indicates which one.

BothFailed !IOException !IOException

both threads failed

Instances

Instances details
Foldable ResultOrFailure Source # 
Instance details

Defined in Network.NTP.Client.Query

Methods

foldMonoid m ⇒ ResultOrFailure m → m Source #

foldMapMonoid m ⇒ (a → m) → ResultOrFailure a → m Source #

foldMap'Monoid m ⇒ (a → m) → ResultOrFailure a → m Source #

foldr ∷ (a → b → b) → b → ResultOrFailure a → b Source #

foldr' ∷ (a → b → b) → b → ResultOrFailure a → b Source #

foldl ∷ (b → a → b) → b → ResultOrFailure a → b Source #

foldl' ∷ (b → a → b) → b → ResultOrFailure a → b Source #

foldr1 ∷ (a → a → a) → ResultOrFailure a → a Source #

foldl1 ∷ (a → a → a) → ResultOrFailure a → a Source #

toListResultOrFailure a → [a] Source #

nullResultOrFailure a → Bool Source #

lengthResultOrFailure a → Int Source #

elemEq a ⇒ a → ResultOrFailure a → Bool Source #

maximumOrd a ⇒ ResultOrFailure a → a Source #

minimumOrd a ⇒ ResultOrFailure a → a Source #

sumNum a ⇒ ResultOrFailure a → a Source #

productNum a ⇒ ResultOrFailure a → a Source #

Eq a ⇒ Eq (ResultOrFailure a) Source # 
Instance details

Defined in Network.NTP.Client.Query

Show a ⇒ Show (ResultOrFailure a) Source # 
Instance details

Defined in Network.NTP.Client.Query