summaryrefslogtreecommitdiff
path: root/src/Network/Torrent/PeerWire/Block.hs
diff options
context:
space:
mode:
authorSam T <sta.cs.vsu@gmail.com>2013-04-20 23:40:25 +0400
committerSam T <sta.cs.vsu@gmail.com>2013-04-20 23:40:25 +0400
commit482f4f28b106d08ed20843a81c93efd3995e1439 (patch)
tree1ef673928a7f59889c2a0e3d4f35d7647c5e5770 /src/Network/Torrent/PeerWire/Block.hs
parent3cf6227b5dc007e0ed23f108168f2e6604f10ba3 (diff)
+ Move message and block to separated files.
Diffstat (limited to 'src/Network/Torrent/PeerWire/Block.hs')
-rw-r--r--src/Network/Torrent/PeerWire/Block.hs17
1 files changed, 17 insertions, 0 deletions
diff --git a/src/Network/Torrent/PeerWire/Block.hs b/src/Network/Torrent/PeerWire/Block.hs
new file mode 100644
index 00000000..b2fe8c31
--- /dev/null
+++ b/src/Network/Torrent/PeerWire/Block.hs
@@ -0,0 +1,17 @@
1module Network.Torrent.PeerWire.Block
2 ( BlockIx(..), Block(..)
3 ) where
4
5import Data.ByteString (ByteString)
6
7data BlockIx = BlockIx {
8 ixPiece :: {-# UNPACK #-} !Int -- ^ Zero-based piece index.
9 , ixOffset :: {-# UNPACK #-} !Int -- ^ Zero-based byte offset within the piece.
10 , ixLength :: {-# UNPACK #-} !Int -- ^ Block size starting from offset.
11 } deriving (Show, Eq)
12
13data Block = Block {
14 blkPiece :: Int -- ^ Zero-based piece index.
15 , blkOffset :: Int -- ^ Zero-based byte offset within the piece.
16 , blkData :: ByteString -- ^ Payload.
17 } deriving (Show, Eq)