diff options
author | AndrewRademacher <andrew.rademacher@smrxt.com> | 2016-02-27 20:23:26 -0600 |
---|---|---|
committer | AndrewRademacher <andrew.rademacher@smrxt.com> | 2016-02-27 20:23:26 -0600 |
commit | 640e69ef77aea530af800741e453b05e2802d188 (patch) | |
tree | 6c682bdeccca3af9dafe40d7642a0823625aaa72 /src/Graylog | |
parent | c91dbdc0f5be0f1ec6a0cafc441eef0aa6da58d7 (diff) | |
download | haskell-graylog-640e69ef77aea530af800741e453b05e2802d188.tar.gz haskell-graylog-640e69ef77aea530af800741e453b05e2802d188.tar.zst haskell-graylog-640e69ef77aea530af800741e453b05e2802d188.zip |
Framed UDP function.
Diffstat (limited to 'src/Graylog')
-rw-r--r-- | src/Graylog/UDP.hs | 17 |
1 files changed, 13 insertions, 4 deletions
diff --git a/src/Graylog/UDP.hs b/src/Graylog/UDP.hs index dc172b9..656cbc8 100644 --- a/src/Graylog/UDP.hs +++ b/src/Graylog/UDP.hs | |||
@@ -6,8 +6,9 @@ module Graylog.UDP | |||
6 | 6 | ||
7 | import Data.Aeson | 7 | import Data.Aeson |
8 | import qualified Data.ByteString.Lazy as LBS | 8 | import qualified Data.ByteString.Lazy as LBS |
9 | import Data.Word | ||
9 | import Network.Socket.ByteString.Lazy | 10 | import Network.Socket.ByteString.Lazy |
10 | import System.Random.MWC | 11 | import System.Random |
11 | 12 | ||
12 | import Graylog.Gelf as Export | 13 | import Graylog.Gelf as Export |
13 | import Graylog.Types as Export | 14 | import Graylog.Types as Export |
@@ -16,7 +17,15 @@ sendLog :: Graylog -> GELF -> IO () | |||
16 | sendLog glog msg = mapM_ (send $ _graylogSocket glog) cks | 17 | sendLog glog msg = mapM_ (send $ _graylogSocket glog) cks |
17 | where | 18 | where |
18 | raw = encode msg | 19 | raw = encode msg |
19 | cks = chunky raw | 20 | cks = chunky glog raw |
20 | 21 | ||
21 | chunky :: LBS.ByteString -> [LBS.ByteString] | 22 | chunky :: Graylog -> LBS.ByteString -> IO [LBS.ByteString] |
22 | chunky = undefined | 23 | chunky glog raw = do |
24 | groupId <- randomIO | ||
25 | splitAt gsize | ||
26 | where | ||
27 | magic = undefined | ||
28 | seq = undefined | ||
29 | total = undefined | ||
30 | hlen = 12 | ||
31 | gsize = (fromIntegral (_graylogChunkSize glog)) - hlen | ||