RetroShare/libretroshare/src/serialiser/rsrankitems.h
drbob 5e41b21cef Lots of bugfixes and tweaks:
* Switched p3Ranking to share Friends Links as well as own.
 * Modified rankmsgs to contain source id.
 * Fixed up rsNotify, added pqiNotify and global function call to get it.
 * Added notify for Bad Incoming Directory
 * Added Emergency Incoming directory so RS can keep running.
 * Added notify for Bad Packet (connecting to V0.3.X)
 * Added notify for Incomplete Packet Read (not been triggered yet!)
 * added close() to BinInterface, close on pqissl calls reset() 
 * removed exit(1) calls from pqistreamer, replaced with bio->close().
 * Increased Maximum Packet Size for HTML messages.
 * Fixed Online/Offline Message Forwarding. (TEST).
 * Increased DHT bootstrap buckets to 4.
 * Cleaned up much of serialiser debug (was slowing down Mac)
 * Added directory path to File Listings.
 * added ConvertSharedFilePath() so correct local dir can be found.
 * Added ForceDirectoryCheck() and InDirectoryCheck() for file hashing.
 * removed old TMP cache loading.
 * switched off Cache debug.



git-svn-id: http://svn.code.sf.net/p/retroshare/code/trunk@448 b45a01b8-16f6-495d-af2f-9b41ad6348cc
2008-03-31 14:06:59 +00:00

112 lines
3.1 KiB
C++

#ifndef RS_RANK_ITEMS_H
#define RS_RANK_ITEMS_H
/*
* libretroshare/src/serialiser: rsrankitems.h
*
* RetroShare Serialiser.
*
* 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".
*
*/
#include <map>
#include "serialiser/rsserviceids.h"
#include "serialiser/rsserial.h"
#include "serialiser/rstlvtypes.h"
const uint8_t RS_PKT_SUBTYPE_RANK_OLD_LINK = 0x02; /* defunct - don't use! */
const uint8_t RS_PKT_SUBTYPE_RANK_LINK2 = 0x03;
const uint8_t RS_PKT_SUBTYPE_RANK_PHOTO = 0x04;
/**************************************************************************/
class RsRankMsg: public RsItem
{
public:
RsRankMsg(uint8_t subtype)
:RsItem(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_RANK,
subtype) { return; }
virtual ~RsRankMsg() { return; }
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
std::string rid; /* Random Id */
std::string pid; /* Peer Id (cannot use RsItem::PeerId - as FoF transport!) */
uint32_t timestamp;
std::wstring title;
std::wstring comment;
};
/* Flags */
const uint32_t RS_LINK_TYPE_WEB = 0x0001;
const uint32_t RS_LINK_TYPE_OFF = 0x0002;
class RsRankLinkMsg: public RsRankMsg
{
public:
RsRankLinkMsg()
:RsRankMsg(RS_PKT_SUBTYPE_RANK_LINK2) { return; }
virtual ~RsRankLinkMsg() { return; }
virtual void clear();
virtual std::ostream& print(std::ostream &out, uint16_t indent = 0);
/**** SAME as RsRankMsg ****
std::string rid;
uint32_t timestamp;
std::wstring title;
std::wstring comment;
***************************/
/* Link specific Fields */
uint32_t linktype; /* to be used later! */
std::wstring link;
};
class RsRankSerialiser: public RsSerialType
{
public:
RsRankSerialiser()
:RsSerialType(RS_PKT_VERSION_SERVICE, RS_SERVICE_TYPE_RANK)
{ return; }
virtual ~RsRankSerialiser()
{ return; }
virtual uint32_t size(RsItem *);
virtual bool serialise (RsItem *item, void *data, uint32_t *size);
virtual RsItem * deserialise(void *data, uint32_t *size);
private:
/* For RS_PKT_SUBTYPE_RANK_LINK */
virtual uint32_t sizeLink(RsRankLinkMsg *);
virtual bool serialiseLink (RsRankLinkMsg *item, void *data, uint32_t *size);
virtual RsRankLinkMsg *deserialiseLink(void *data, uint32_t *size);
};
/**************************************************************************/
#endif /* RS_RANK_ITEMS_H */