summaryrefslogtreecommitdiff
path: root/src/Network/BitTorrent/Tracker/Session.hs
blob: 3cfc4b5294fdc7b17efe8da1582fa7f6ebedf88f (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
module Network.BitTorrent.Tracker.Session
       (
       ) where

import Data.Torrent.Progress
import Data.Torrent.InfoHash
import Network.BitTorrent.Core.PeerAddr
import Network.BitTorrent.Tracker.Message

data PeerInfo = PeerInfo
  { peerId   :: PeerId
  , peerPort :: PortNumber
  , peerIP   :: Maybe HostAddress
  }

data Session  = Session
  { sesInfoHash :: !InfoHash
  , sesPeerInfo :: !PeerInfo
  }

data SAnnounceQuery = SAnnounceQuery
  { sreqProgress :: Progress
  , sreqNumWant  :: Maybe Int
  , sreqEvent    :: Maybe Event
  }

type SAnnounceInfo = [PeerAddr]

f :: Session  ->  SAnnounceQuery  ->    AnnounceQuery
f    Session {..} SAnnounceQuery {..} = AnnounceQuery
  { reqInfoHash = sesInfoHash
  , reqPeerInfo = sesPeerInfo
  , reqProgress = sreqProgress
  , reqNumWant  = undefined
  , reqEvent    = sreqEvent
  }

data Settings = Settings

data Manager  = Manager
  {
  }


g :: Session -> AnnounceInfo -> SAnnounceInfo
g Session {..} SAnnounceInfo {..} = undefined


reannounce :: HTracker -> IO ()
reannounce = undefined

forceReannounce :: HTracker -> IO ()
forceReannounce = undefined

scrape :: HTracker -> IO ()
scrape = undefined