Bug fixes + tabbing
[iotcloud.git] / version2 / src / C / CloudComm.h
index 2f825083214a26608087b08b656d575c59004119..ce7cfa07023a3832252f2633cd1973b4b35e1541 100644 (file)
 #define CloudComm_HMAC_SIZE 32
 #define HttpURLConnection_HTTP_OK 200
 
+typedef struct {
+       int fd;
+       int numBytes;
+} WebConnection;
+
 
 class CloudComm {
 private:
@@ -32,6 +37,8 @@ private:
        pthread_t localServerThread;
        bool doEnd;
        TimingSingleton *timer;
+       Array<char> *getslot;
+       Array<char> *putslot;
 
        /**
         * Generates Key from password.
@@ -52,7 +59,7 @@ private:
        Array<char> *createIV(int64_t machineId, int64_t localSequenceNumber);
        Array<char> *encryptSlotAndPrependIV(Array<char> *rawData, Array<char> *ivBytes);
        Array<char> *stripIVAndDecryptSlot(Array<char> *rawData);
-       Array<Slot *> *processSlots(int fd);
+       Array<Slot *> *processSlots(WebConnection *wc);
 
 
 public:
@@ -65,6 +72,7 @@ public:
         * Constructor for actual use. Takes in the url and password.
         */
        CloudComm(Table *_table,  IoTString *_baseurl, IoTString *_password, int _listeningPort);
+       ~CloudComm();
 
        /**
         * Inits all the security stuff
@@ -91,7 +99,7 @@ public:
         */
 
        Array<char> *sendLocalData(Array<char> *sendData, int64_t localSequenceNumber, IoTString *host, int port);
-       void close();
+       void closeCloud();
        void localServerWorkerFunction();
 };
 #endif