module Data.Attoparsec.Ping
( PingResult(..)
, PingError(..)
, LineResult(..)
, ReplyResult(..)
) where
import Control.Applicative ((<|>))
import Data.Attoparsec.Text
import Data.IP
import Data.Text (Text)
import qualified Data.Text as T
import Data.Word (Word32)
import Development.Placeholders
data PingResult
= PingSucceed { hostAddress :: IPv4
, hostNameResolved :: Maybe Text
, bytesOfData :: Int
, lineResults :: [LineResult] }
| PingError PingError
deriving (Eq, Show)
data PingError =
HostNotFound Text
deriving (Eq, Show)
data LineResult
= ReplyFrom IPv4
ReplyResult
| RequestTimedOut
| GeneralFailure
deriving (Eq, Show)
data ReplyResult
= ResponseReceived { bytes :: Int
, timeInMs :: Int
, ttl :: Int }
| DestinationHostUnreachable
deriving (Eq, Show)