aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Graylog/Types.hs
diff options
context:
space:
mode:
Diffstat (limited to 'src/Graylog/Types.hs')
-rw-r--r--src/Graylog/Types.hs8
1 files changed, 7 insertions, 1 deletions
diff --git a/src/Graylog/Types.hs b/src/Graylog/Types.hs
index 5c32a8b..5ec779b 100644
--- a/src/Graylog/Types.hs
+++ b/src/Graylog/Types.hs
@@ -22,8 +22,11 @@ import qualified Data.Text as T
22import Network.BSD 22import Network.BSD
23import Network.Socket 23import Network.Socket
24 24
25-- | The maximum size of each datagram when using UDP transit methods.
25type ChunkSize = Word 26type ChunkSize = Word
26 27
28-- | Handle for a socket connected to Graylog. In some cases this socket
29-- is UDP and will not have a maintained session.
27data Graylog 30data Graylog
28 = Graylog 31 = Graylog
29 { _graylogHost :: String 32 { _graylogHost :: String
@@ -38,7 +41,10 @@ defaultChunkSize :: ChunkSize
38defaultChunkSize = 8192 41defaultChunkSize = 8192
39 42
40openGraylog 43openGraylog
41 :: HostName -> ServiceName -> ChunkSize -> IO (Either String Graylog) 44 :: HostName -- ^ The host on which graylog is running.
45 -> ServiceName -- ^ The port on which graylog is running.
46 -> ChunkSize -- ^ The maximum size of each UDP datagram.
47 -> IO (Either String Graylog)
42openGraylog h p cksize 48openGraylog h p cksize
43 | cksize < 1024 = return $ Left "ChunkSize must be at least 1024." 49 | cksize < 1024 = return $ Left "ChunkSize must be at least 1024."
44 | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case 50 | otherwise = getAddrInfo Nothing (Just h) (Just p) >>= \case