mirror of
https://github.com/RetroShare/RetroShare.git
synced 2025-05-12 02:55:18 -04:00

Added Date check to DHT Server File, so we don't download each restart. git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@378 b45a01b8-16f6-495d-af2f-9b41ad6348cc
74 lines
2.1 KiB
C++
74 lines
2.1 KiB
C++
/*
|
|
* libretroshare/src/dht: dhtclient.h
|
|
*
|
|
* Interface with DHT Client for RetroShare.
|
|
*
|
|
* Copyright 2007-2008 by Robert Fernie.
|
|
*
|
|
* This library is free software; you can redistribute it and/or
|
|
* modify it under the terms of the GNU Library General Public
|
|
* License Version 2 as published by the Free Software Foundation.
|
|
*
|
|
* This library is distributed in the hope that it will be useful,
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
* Library General Public License for more details.
|
|
*
|
|
* You should have received a copy of the GNU Library General Public
|
|
* License along with this library; if not, write to the Free Software
|
|
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307
|
|
* USA.
|
|
*
|
|
* Please report all bugs and problems to "retroshare@lunamutt.com".
|
|
*
|
|
*/
|
|
|
|
#ifndef RS_GENERIC_DHT_CLIENT_H
|
|
#define RS_GENERIC_DHT_CLIENT_H
|
|
|
|
#include <inttypes.h>
|
|
#include <string>
|
|
#include <list>
|
|
|
|
class DHTClient
|
|
{
|
|
public:
|
|
|
|
/* initialise from file */
|
|
virtual bool checkServerFile(std::string filename) = 0;
|
|
virtual bool loadServers(std::string filename) = 0;
|
|
virtual bool loadServersFromWeb(std::string storename) = 0;
|
|
virtual bool loadServers(std::istream&) = 0;
|
|
|
|
/* check that its working */
|
|
virtual bool dhtActive() = 0;
|
|
|
|
/* publish / search */
|
|
virtual bool publishKey(std::string key, std::string value, uint32_t ttl) = 0;
|
|
virtual bool searchKey(std::string key, std::list<std::string> &values) = 0;
|
|
|
|
};
|
|
|
|
|
|
class DHTClientDummy: public DHTClient
|
|
{
|
|
public:
|
|
|
|
/* initialise from file */
|
|
virtual bool checkServerFile(std::string filename) { return false; }
|
|
virtual bool loadServers(std::string filename) { return true; }
|
|
virtual bool loadServersFromWeb(std::string storename) { return true; }
|
|
virtual bool loadServers(std::istream&) { return true; }
|
|
|
|
/* check that its working */
|
|
virtual bool dhtActive() { return true; }
|
|
|
|
/* publish / search */
|
|
virtual bool publishKey(std::string key, std::string value, uint32_t ttl) { return true; }
|
|
virtual bool searchKey(std::string key, std::list<std::string> &values) { return true; }
|
|
|
|
};
|
|
|
|
|
|
#endif
|
|
|