aboutsummaryrefslogtreecommitdiffhomepage
path: root/src/Graylog/Types.hs
diff options
context:
space:
mode:
authorAndrewRademacher <andrewrademacher@gmail.com>2016-02-28 14:38:16 -0600
committerAndrewRademacher <andrewrademacher@gmail.com>2016-02-28 14:38:16 -0600
commitd9a5d441ca9b5ae766311702557bf9f1ff0255b1 (patch)
tree3ef695c2ec24e5a53167d726a6af626778a4809a /src/Graylog/Types.hs
parentf82a8dfc7e9b79ca6b88235d7297252adbb6d364 (diff)
downloadhaskell-graylog-d9a5d441ca9b5ae766311702557bf9f1ff0255b1.tar.gz
haskell-graylog-d9a5d441ca9b5ae766311702557bf9f1ff0255b1.tar.zst
haskell-graylog-d9a5d441ca9b5ae766311702557bf9f1ff0255b1.zip
Added readme, license, and light commenting.
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