/* This Work is under GPL provided with this work. This work is based on the java implementation of the Kademlia protocol. Kademlia: Peer-to-peer routing based on the XOR metric Copyright (C) 2002 Petar Maymounkov [petar@post.harvard.edu] http://kademlia.scs.cs.nyu.edu and This work is bassed on translation from Barry Dunne to C++ Copyright (C)2003 Barry Dunne (http://www.emule-project.net) */ #ifndef cSearch_h #define cSearch_h #include "cygwin.h" #include "sFile.h" class TagList; class CTag; typedef std::list cWordList; class cSearch { friend class cSearchManager; private: cSearch(); cSearch(class cSearch&) { assert(0); } ~cSearch(); enum { NODE, FILE, KEYWORD }; void go(void); void processResponse (const uint8_t *target, uint32_t fromIP, uint16_t fromPort, cPeerList *results); // void processResult (const uint8_t *target, uint32_t fromIP, uint16_t fromPort, const uint8_t *answer, TagList *info); void jumpStart (void); void sendFindValue (const uint8_t *target, uint32_t ip , uint16_t port); time_t m_created; int m_type; size_t m_searchID; uint8_t m_target[16]; unsigned char *m_searchTerms; size_t m_lenSearchTerms; cWordList m_words; cPeerMap m_possible; // peers that can be tried cPeerMap m_tried; // peers that have already been tried cPeerMap m_responded; // peers that have tried and repond cPeerMap m_best; // nächsten 20 antworter cPeerList m_delete; }; #endif