/* */ #ifndef D_DHT_MESSAGE_FACTORY_H #define D_DHT_MESSAGE_FACTORY_H #include "common.h" #include #include #include "SharedHandle.h" #include "A2STR.h" #include "ValueBase.h" namespace aria2 { class DHTMessage; class DHTQueryMessage; class DHTResponseMessage; class DHTNode; class Peer; class DHTMessageFactory { public: virtual ~DHTMessageFactory() {} virtual SharedHandle createQueryMessage(const Dict* dict, const std::string& ipaddr, uint16_t port) = 0; virtual SharedHandle createResponseMessage(const std::string& messageType, const Dict* dict, const std::string& ipaddr, uint16_t port) = 0; virtual SharedHandle createPingMessage(const SharedHandle& remoteNode, const std::string& transactionID = A2STR::NIL) = 0; virtual SharedHandle createPingReplyMessage(const SharedHandle& remoteNode, const unsigned char* id, const std::string& transactionID) = 0; virtual SharedHandle createFindNodeMessage(const SharedHandle& remoteNode, const unsigned char* targetNodeID, const std::string& transactionID = A2STR::NIL) = 0; virtual SharedHandle createFindNodeReplyMessage (const SharedHandle& remoteNode, const std::vector >& closestKNodes, const std::string& transactionID) = 0; virtual SharedHandle createGetPeersMessage(const SharedHandle& remoteNode, const unsigned char* infoHash, const std::string& transactionID = A2STR::NIL) = 0; virtual SharedHandle createGetPeersReplyMessage (const SharedHandle& remoteNode, const std::vector >& closestKNodes, const std::vector >& peers, const std::string& token, const std::string& transactionID) = 0; virtual SharedHandle createAnnouncePeerMessage(const SharedHandle& remoteNode, const unsigned char* infoHash, uint16_t tcpPort, const std::string& token, const std::string& transactionID = A2STR::NIL) = 0; virtual SharedHandle createAnnouncePeerReplyMessage(const SharedHandle& remoteNode, const std::string& transactionID) = 0; virtual SharedHandle createUnknownMessage(const unsigned char* data, size_t length, const std::string& ipaddr, uint16_t port) = 0; }; } // namespace aria2 #endif // D_DHT_MESSAGE_FACTORY_H