OBJECTS := $(CPP_SOURCES:%.cc=$(OBJ_DIR)/%.o) $(C_SOURCES:%.c=$(OBJ_DIR)/%.o)
-CFLAGS := -Wall -O0 -g
+CFLAGS := -Wall -O3 -g
CFLAGS += -I.
LDFLAGS := -ldl -lrt -rdynamic -g
SHARED := -shared
MARKDOWN := ../docs/Markdown/Markdown.pl
-all: directories ${OBJ_DIR}/$(LIB_SO)
+all: directories ${OBJ_DIR}/$(LIB_SO) test
directories: ${OBJ_DIR}
+test: bin/lib_iotcloud.so
+ g++ Test.C -L./bin/ -l_iotcloud -o bin/Test
+
${OBJ_DIR}:
${MKDIR_P} ${OBJ_DIR}
debug: CFLAGS += -DCONFIG_DEBUG
debug: all
-test: all
- make -C Test
PHONY += docs
docs: $(C_SOURCES) $(HEADERS)
+++ /dev/null
-#ifndef RANDOM_H
-#define RANDOM_H
-#include <stdlib.h>
-class Random {
-public:
- Random();
- int32_t nextInt() {
- return random();
- }
- int32_t nextInt(int32_t val) {
- return random() % val;
- }
-};
-#endif
--- /dev/null
+#include "SecureRandom.h"
+#include <stdlib.h>
+
+SecureRandom::SecureRandom() {
+}
+
+void SecureRandom::nextBytes(Array<char> *array) {
+ arc4random_buf(array->internalArray(), array->length());
+}
+
+int32_t SecureRandom::nextInt(int32_t val) {
+ return arc4random_uniform(val);
+}
#ifndef SECURERANDOM_H
#define SECURERANDOM_H
+#include "common.h"
+
class SecureRandom {
-public:
+ public:
SecureRandom();
void nextBytes(Array<char> *array);
+ int32_t nextInt(int32_t val);
+ private:
};
#endif
#include "TransactionStatus.h"
#include "Transaction.h"
#include "LastMessage.h"
-#include "Random.h"
+#include "SecureRandom.h"
#include "ByteBuffer.h"
#include "Abort.h"
#include "CommitPart.h"
*/
void Table::init() {
// Init helper objects
- random = new Random();
+ random = new SecureRandom();
buffer = new SlotBuffer();
// init data structs
/* Helper Objects */
SlotBuffer *buffer;
CloudComm *cloud;
- Random *random;
+ SecureRandom *random;
TableStatus *liveTableStatus;
PendingTransaction *pendingTransactionBuilder; // Pending Transaction used in building a Pending Transaction
Transaction *lastPendingTransactionSpeculatedOn; // Last transaction that was speculated on from the pending transaction
--- /dev/null
+#include "Table.h"
+
+int main(int numargs, char ** args) {
+ Table * t = new Table(NULL, NULL, 0, 0);
+ delete t;
+}
class Mac;
class SecureRandom;
class Thread;
-class Random;
class Key;
#endif
UNAME := $(shell uname)
-LIB_NAME := cons_comp
+LIB_NAME := iotcloud
LIB_SO := lib_$(LIB_NAME).so
CPPFLAGS += -Wall -g -O0