diff options
author | Sam T <sta.cs.vsu@gmail.com> | 2013-04-20 23:40:25 +0400 |
---|---|---|
committer | Sam T <sta.cs.vsu@gmail.com> | 2013-04-20 23:40:25 +0400 |
commit | 482f4f28b106d08ed20843a81c93efd3995e1439 (patch) | |
tree | 1ef673928a7f59889c2a0e3d4f35d7647c5e5770 /src/Network/Torrent/PeerWire/Block.hs | |
parent | 3cf6227b5dc007e0ed23f108168f2e6604f10ba3 (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.hs | 17 |
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 @@ | |||
1 | module Network.Torrent.PeerWire.Block | ||
2 | ( BlockIx(..), Block(..) | ||
3 | ) where | ||
4 | |||
5 | import Data.ByteString (ByteString) | ||
6 | |||
7 | data 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 | |||
13 | data 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) | ||