2017-05-22 17:54:55 -04:00
|
|
|
#pragma once
|
|
|
|
|
2017-05-21 09:57:10 -04:00
|
|
|
#include "retroshare/rstokenservice.h"
|
|
|
|
#include "retroshare/rsgxsifacehelper.h"
|
|
|
|
#include "retroshare/rsgxscommon.h"
|
|
|
|
|
2017-05-22 17:54:55 -04:00
|
|
|
/// Subservices identifiers (like port for TCP)
|
|
|
|
enum class GxsTransSubServices : uint16_t
|
|
|
|
{
|
|
|
|
UNKNOWN = 0x00,
|
|
|
|
TEST_SERVICE = 0x01,
|
|
|
|
P3_MSG_SERVICE = 0x02,
|
|
|
|
P3_CHAT_SERVICE = 0x03
|
|
|
|
};
|
|
|
|
|
|
|
|
/// Values must fit into uint8_t
|
|
|
|
enum class GxsTransItemsSubtypes : uint8_t
|
|
|
|
{
|
|
|
|
GXS_TRANS_SUBTYPE_MAIL = 0x01,
|
|
|
|
GXS_TRANS_SUBTYPE_RECEIPT = 0x02,
|
|
|
|
GXS_TRANS_SUBTYPE_GROUP = 0x03,
|
|
|
|
OUTGOING_RECORD_ITEM = 0x04
|
|
|
|
};
|
|
|
|
|
|
|
|
enum class GxsTransSendStatus : uint8_t
|
|
|
|
{
|
|
|
|
UNKNOWN = 0x00,
|
|
|
|
PENDING_PROCESSING = 0x01,
|
|
|
|
PENDING_PREFERRED_GROUP = 0x02,
|
|
|
|
PENDING_RECEIPT_CREATE = 0x03,
|
|
|
|
PENDING_RECEIPT_SIGNATURE = 0x04,
|
|
|
|
PENDING_SERIALIZATION = 0x05,
|
|
|
|
PENDING_PAYLOAD_CREATE = 0x06,
|
|
|
|
PENDING_PAYLOAD_ENCRYPT = 0x07,
|
|
|
|
PENDING_PUBLISH = 0x08,
|
|
|
|
/** This will be useful so the user can know if the mail reached at least
|
|
|
|
* some friend node, in case of internet connection interruption */
|
|
|
|
//PENDING_TRANSFER,
|
|
|
|
PENDING_RECEIPT_RECEIVE = 0x09,
|
|
|
|
/// Records with status >= RECEIPT_RECEIVED get deleted
|
|
|
|
RECEIPT_RECEIVED = 0x0a,
|
|
|
|
FAILED_RECEIPT_SIGNATURE = 0xf0,
|
|
|
|
FAILED_ENCRYPTION = 0xf1
|
|
|
|
};
|
|
|
|
|
|
|
|
typedef uint64_t RsGxsTransId;
|
|
|
|
|
2017-05-21 09:57:10 -04:00
|
|
|
class RsGxsTransGroup
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGroupMetaData mMeta;
|
|
|
|
};
|
|
|
|
|
|
|
|
class RsGxsTransMsg
|
|
|
|
{
|
|
|
|
public:
|
|
|
|
RsGxsTransMsg() : size(0),data(NULL) {}
|
|
|
|
virtual ~RsGxsTransMsg() { free(data) ; }
|
|
|
|
|
|
|
|
public:
|
|
|
|
RsMsgMetaData mMeta;
|
|
|
|
|
|
|
|
uint32_t size ;
|
|
|
|
uint8_t *data ;
|
|
|
|
};
|
|
|
|
|
2017-05-22 17:54:55 -04:00
|
|
|
struct RsGxsTransOutgoingRecord
|
|
|
|
{
|
|
|
|
GxsTransSendStatus status;
|
|
|
|
RsGxsId recipient;
|
2017-05-25 10:56:29 -04:00
|
|
|
RsGxsTransId trans_id;
|
2017-05-22 17:54:55 -04:00
|
|
|
uint32_t data_size ;
|
|
|
|
GxsTransSubServices client_service;
|
|
|
|
};
|
|
|
|
|
2017-05-21 09:57:10 -04:00
|
|
|
class RsGxsTrans: public RsGxsIfaceHelper
|
|
|
|
{
|
|
|
|
public:
|
2017-05-26 12:42:52 -04:00
|
|
|
class GxsTransStatistics
|
2017-05-21 09:57:10 -04:00
|
|
|
{
|
2017-05-26 12:42:52 -04:00
|
|
|
public:
|
|
|
|
GxsTransStatistics() {}
|
2017-05-22 17:54:55 -04:00
|
|
|
|
2017-05-26 12:42:52 -04:00
|
|
|
RsGxsGroupId prefered_group_id ;
|
2017-05-22 17:54:55 -04:00
|
|
|
std::vector<RsGxsTransOutgoingRecord> outgoing_records;
|
2017-05-21 09:57:10 -04:00
|
|
|
};
|
|
|
|
|
|
|
|
RsGxsTrans(RsGxsIface *gxs) : RsGxsIfaceHelper(gxs) {}
|
|
|
|
|
|
|
|
virtual ~RsGxsTrans() {}
|
|
|
|
|
|
|
|
virtual bool getStatistics(GxsTransStatistics& stats)=0;
|
|
|
|
|
|
|
|
// virtual bool getGroupData(const uint32_t &token, std::vector<RsGxsTransGroup> &groups) = 0;
|
|
|
|
// virtual bool getPostData(const uint32_t &token, std::vector<RsGxsTransMsg> &posts) = 0;
|
|
|
|
};
|
|
|
|
|
2017-05-22 17:54:55 -04:00
|
|
|
extern RsGxsTrans *rsGxsTrans ;
|