update20140630
This commit is contained in:
@@ -0,0 +1,85 @@
|
||||
/*
|
||||
* File: DropBoxProvider.h
|
||||
* Author: jgaebler
|
||||
*
|
||||
* Created on April 26, 2012, 3:27 PM
|
||||
*/
|
||||
|
||||
#pragma once
|
||||
|
||||
#ifndef DROPBOXPROVIDER_H
|
||||
#define DROPBOXPROVIDER_H
|
||||
|
||||
#include "mob/sync/cloud/CloudProvider.h"
|
||||
|
||||
#include "mob/sync/cloud/transfer/TransferContainerList.h"
|
||||
#include <common/byte_array.h>
|
||||
|
||||
#include <string>
|
||||
|
||||
struct json_object;
|
||||
|
||||
namespace ubeeme {
|
||||
namespace moversight {
|
||||
|
||||
class StringList;
|
||||
class PeerIDList;
|
||||
class TransferContainer;
|
||||
|
||||
class DropBoxProvider : public CloudProvider {
|
||||
public:
|
||||
|
||||
DropBoxProvider(Dispatcher & dis, Moversight & mov);
|
||||
virtual ~DropBoxProvider();
|
||||
|
||||
void upload(ByteArray & uploadData, PeerID uPID, std::string fileName);
|
||||
|
||||
PeerIDList determineStoringPeers();
|
||||
|
||||
TransferContainerList downloadMessagesFromPeer(PeerID id);
|
||||
|
||||
private:
|
||||
|
||||
std::string buildUploadUrl(PeerID id, std::string fileName);
|
||||
std::string buildDownloadUrl(std::string path);
|
||||
|
||||
std::string buildMetaDataUrl();
|
||||
std::string buildMetaDataUrl(PeerID id);
|
||||
std::string buildMetaDataUrl(std::string path);
|
||||
|
||||
//------------------------------------------------------------------
|
||||
//json and curl related utility methods
|
||||
//------------------------------------------------------------------
|
||||
struct MemoryStruct performCurlDownload(std::string url);
|
||||
|
||||
static size_t writeMemoryCallback(void *contents, size_t size, size_t nmemb, void *userp);
|
||||
|
||||
void jsonParseArray(json_object *jobj, char *key, bool parse, StringList & list, const char * param = "path");
|
||||
void jsonParse(json_object * jobj, bool parse, StringList & list, const char * param = "path");
|
||||
|
||||
//APP und OAUTH
|
||||
static const std::string APP_KEY;
|
||||
static const std::string APP_SECRET;
|
||||
static const std::string OAUTH_TOKEN;
|
||||
static const std::string OAUTH_TOKEN_SECRET;
|
||||
|
||||
static const std::string META_DATA_FILE_NAME_PREFIX;
|
||||
static const std::string FILE_TYPE;
|
||||
|
||||
int counter;
|
||||
|
||||
};
|
||||
|
||||
/**
|
||||
* @brief MemoryStruct used to handle curl based request operation in memory
|
||||
*/
|
||||
typedef struct MemoryStruct {
|
||||
char *memory;
|
||||
size_t size;
|
||||
};
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
#endif /* DROPBOXPROVIDER_H */
|
||||
|
||||
Reference in New Issue
Block a user