/* $Id$ */ /* * Copyright (c) 2005 Dimitri Sokolyuk * * Permission to use, copy, modify, and distribute this software for any * purpose with or without fee is hereby granted, provided that the above * copyright notice and this permission notice appear in all copies. * * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. */ #ifndef _TRACKER_H_ #define _TRACKER_H_ #if 0 #include #endif enum compact { COMP_NO, COMP_YES }; enum event { EV_NONE, EV_STARTED, EV_COMPLETED, EV_STOPPED }; struct bttracker { struct sockaddr_in sin; /* tracker */ int listener; /* sockd */ /* request part */ struct btannounce *announce; u_char *infohash; /* meta->infohash */ u_char localid[SHA1LEN]; u_char trackerid[SHA1LEN]; char *key; /* ??? */ int localport; /* my port, should be set by btstartserver() */ off_t uploaded; /* statistics */ off_t downloaded; off_t left; enum event event; enum compact compact; int numwait; /* answer part */ struct btplist plist; /* LIST_HEAD */ long lastrqst; int interval; int minterval; int complete; int incomplete; int npeers; }; __BEGIN_DECLS struct bttracker *btinittracker(struct btmeta *, int); int btcalltracker(struct bttracker *); void btupdatetracker(struct bttracker *, int, int, enum event); void btfreetracker(struct bttracker *); __END_DECLS #endif /* not _TRACKER_H_ */