Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
matteo
committed
Mar 26, 2014
1 parent
f73e8e6
commit a19e65d
Showing
19 changed files
with
12,914 additions
and
9 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CXX=g++ | ||
CFLAGS=-g -Wall -isystem /usr/include/cryptopp | ||
LIB=-lcryptopp -lfreeimage -lreadline -ltermcap -lcurl -ldb_cxx | ||
LDFLAGS= | ||
SOURCES=megaposix.cpp megacli.cpp megaclient.cpp megacrypto.cpp megabdb.cpp | ||
OBJECTS=$(SOURCES:.cpp=.o) | ||
PROGS=megaclient | ||
|
||
all: $(PROGS) | ||
|
||
megaclient: $(OBJECTS) | ||
$(CXX) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIB) | ||
|
||
.cpp.o: | ||
$(CXX) -c $(CFLAGS) $< -o $@ | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(PROGS) $(PROGS:=.o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
CXX=g++ | ||
CFLAGS=-g -Wall -isystem ../cryptopp -isystem ../FreeImage/Dist -isystem ../db -isystem .. | ||
LIB=-lwinhttp -lws2_32 -L../cryptopp -lcryptopp -L../FreeImage/Dist -lfreeimage -L../readline -lreadline -L../termcap -ltermcap -L../db -ldb_cxx | ||
LDFLAGS= | ||
SOURCES=megawin32.cpp megacli.cpp megacrypto.cpp megaclient.cpp megabdb.cpp | ||
OBJECTS=$(SOURCES:.cpp=.o) | ||
PROGS=megaclient | ||
|
||
all: $(PROGS) | ||
|
||
megaclient: $(OBJECTS) | ||
$(CXX) $(CFLAGS) $(LDFLAGS) $^ -o $@ $(LIB) | ||
|
||
.cpp.o: | ||
$(CXX) -c $(CFLAGS) $< -o $@ | ||
|
||
clean: | ||
rm -f $(OBJECTS) $(PROGS) $(PROGS:=.o) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,41 @@ | ||
#include <stdio.h> | ||
#include <stdlib.h> | ||
#include <stdint.h> | ||
#include <errno.h> | ||
#include <assert.h> | ||
#include <memory.h> | ||
|
||
#ifndef _WIN32 | ||
#include <unistd.h> | ||
#include <arpa/inet.h> | ||
|
||
#ifndef __MACH__ | ||
#include <endian.h> | ||
#endif | ||
#endif | ||
|
||
#ifdef _WIN32 | ||
#define atoll _atoi64 | ||
#define snprintf _snprintf | ||
#define mkdir _mkdir | ||
#include <windows.h> | ||
#define _CRT_SECURE_NO_WARNINGS | ||
#endif | ||
|
||
typedef int64_t m_off_t; | ||
|
||
#ifndef htobe64 | ||
#define htobe64(x) (((uint64_t) htonl((uint32_t) ((x) >> 32))) | (((uint64_t) htonl((uint32_t) x)) << 32)) | ||
#endif | ||
|
||
#include <iostream> | ||
#include <algorithm> | ||
#include <string> | ||
#include <sstream> | ||
#include <map> | ||
#include <set> | ||
#include <iterator> | ||
#include <queue> | ||
#include <list> | ||
|
||
using namespace std; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,57 @@ | ||
/* | ||
MEGA SDK 2013-10-03 - sample application, Berkeley DB access | ||
(c) 2013 by Mega Limited, Wellsford, New Zealand | ||
Applications using the MEGA API must present a valid application key | ||
and comply with the the rules set forth in the Terms of Service. | ||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, | ||
INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR | ||
PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE | ||
FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR | ||
OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER | ||
DEALINGS IN THE SOFTWARE. | ||
*/ | ||
|
||
#ifndef MEGABDB_H | ||
#define MEGABDB_H 1 | ||
|
||
class BdbAccess : public DbAccess | ||
{ | ||
DbEnv* env; | ||
|
||
public: | ||
DbTable* open(string*); | ||
|
||
BdbAccess(); | ||
~BdbAccess(); | ||
}; | ||
|
||
class BdbTable : public DbTable | ||
{ | ||
Db* db; | ||
DbTxn* dbtxn; | ||
DbEnv* dbenv; | ||
Dbc* dbcursor; | ||
|
||
public: | ||
void rewind(); | ||
int next(uint32_t*, string*); | ||
int get(uint32_t, string*); | ||
int put(uint32_t, char*, unsigned); | ||
int del(uint32_t); | ||
void truncate(); | ||
void begin(); | ||
void commit(); | ||
void abort(); | ||
|
||
uint32_t nextid; | ||
|
||
BdbTable(DbEnv*); | ||
~BdbTable(); | ||
}; | ||
|
||
#endif |
Oops, something went wrong.