]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix.h
get Login example working with CURL
[matrix_esp_thesis] / src / matrix.h
index 5f53e0e0a74678553992a8b01f71b5306aa5c5ee..d37474f3017899ce4579e768d5f4cc918939aae8 100644 (file)
@@ -6,34 +6,48 @@
 \r
 #include <olm/olm.h>\r
 \r
-#include "fixedbuffer.h"\r
 \r
 \r
+// TODO: fix\r
+#define SERVER_SIZE 20\r
+#define ACCESS_TOKEN_SIZE 40\r
+#define DEVICE_ID_SIZE 20\r
+#define EXPIRE_MS_SIZE 20\r
+#define REFRESH_TOKEN_SIZE 20\r
+#define MAX_URL_LEN 128\r
 \r
-#define ACCESS_TOKEN_LEN 20 // TODO: fix\r
 \r
 typedef struct MatrixClient {\r
-    OlmAccount * olmAcc;\r
-    char accessToken[ACCESS_TOKEN_LEN];\r
+    void * httpUserData;\r
+    OlmAccount * olmAccount;\r
+    OlmSession * olmSession;\r
+    char server[SERVER_SIZE]; int serverLen;\r
+    char accessTokenBuffer[ACCESS_TOKEN_SIZE]; int accessTokenLen;\r
+    char deviceIdBuffer[DEVICE_ID_SIZE]; int deviceIdLen;\r
+    char expireMsBuffer[EXPIRE_MS_SIZE]; int expireMsLen;\r
+    char refreshTokenBuffer[REFRESH_TOKEN_SIZE]; int refreshTokenLen;\r
 } MatrixClient;\r
 \r
 bool\r
 MatrixClientInit(\r
     MatrixClient * client,\r
-    FixedBuffer server\r
+    char * server, int serverLen\r
 );\r
 \r
 bool\r
 MatrixClientLoginPassword(\r
     MatrixClient * client,\r
-    FixedBuffer username,\r
-    FixedBuffer password\r
+    char * username, int usernameLen,\r
+    char * password, int passwordLen,\r
+    char * displayName, int displayNameLen\r
 );\r
 \r
 bool\r
-MatrixClientGetAccessToken(\r
+MatrixHttpPost(\r
     MatrixClient * client,\r
-    FixedBuffer * outBuffer\r
+    const char * url,\r
+    char * requestBuffer, int requestLen,\r
+    char * outResponseBuffer, int outResponseCap, int * outResponseLen\r
 );\r
 \r
 #endif\r