]> gitweb.ps.run Git - matrix_esp_thesis/blobdiff - src/matrix.h
send example, http PUT
[matrix_esp_thesis] / src / matrix.h
index 5f53e0e0a74678553992a8b01f71b5306aa5c5ee..2e7f6e0e9a6861fa70839a18b2c8dd8ca27b19b4 100644 (file)
@@ -6,34 +6,83 @@
 \r
 #include <olm/olm.h>\r
 \r
 \r
 #include <olm/olm.h>\r
 \r
-#include "fixedbuffer.h"\r
 \r
 \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
 \r
-#define ACCESS_TOKEN_LEN 20 // TODO: fix\r
 \r
 typedef struct MatrixClient {\r
 \r
 typedef struct MatrixClient {\r
-    OlmAccount * olmAcc;\r
-    char accessToken[ACCESS_TOKEN_LEN];\r
+    OlmAccount * olmAccount;\r
+    OlmSession * olmSession;\r
+    \r
+    char server[SERVER_SIZE+1];\r
+    char accessTokenBuffer[ACCESS_TOKEN_SIZE];\r
+    char deviceIdBuffer[DEVICE_ID_SIZE];\r
+    char expireMsBuffer[EXPIRE_MS_SIZE];\r
+    char refreshTokenBuffer[REFRESH_TOKEN_SIZE];\r
+\r
+    void * httpUserData;\r
 } MatrixClient;\r
 \r
 bool\r
 MatrixClientInit(\r
     MatrixClient * client,\r
 } MatrixClient;\r
 \r
 bool\r
 MatrixClientInit(\r
     MatrixClient * client,\r
-    FixedBuffer server\r
-);\r
+    const char * server);\r
+\r
+bool\r
+MatrixClientSetAccessToken(\r
+    MatrixClient * client,\r
+    const char * accessToken);\r
 \r
 bool\r
 MatrixClientLoginPassword(\r
     MatrixClient * client,\r
 \r
 bool\r
 MatrixClientLoginPassword(\r
     MatrixClient * client,\r
-    FixedBuffer username,\r
-    FixedBuffer password\r
-);\r
+    const char * username,\r
+    const char * password,\r
+    const char * displayName);\r
+    \r
+bool\r
+MatrixClientSendEvent(\r
+    MatrixClient * client,\r
+    const char * roomId,\r
+    const char * msgType,\r
+    const char * msgBody);\r
+\r
+bool\r
+MatrixHttpInit(\r
+    MatrixClient * client);\r
+\r
+bool\r
+MatrixHttpDeinit(\r
+    MatrixClient * client);\r
+\r
+bool\r
+MatrixHttpGet(\r
+    MatrixClient * client,\r
+    const char * url,\r
+    char * outResponseBuffer, int outResponseCap,\r
+    bool authenticated);\r
+\r
+bool\r
+MatrixHttpPost(\r
+    MatrixClient * client,\r
+    const char * url,\r
+    const char * requestBuffer,\r
+    char * outResponseBuffer, int outResponseCap,\r
+    bool authenticated);\r
 \r
 bool\r
 \r
 bool\r
-MatrixClientGetAccessToken(\r
+MatrixHttpPut(\r
     MatrixClient * client,\r
     MatrixClient * client,\r
-    FixedBuffer * outBuffer\r
-);\r
+    const char * url,\r
+    const char * requestBuffer,\r
+    char * outResponseBuffer, int outResponseCap,\r
+    bool authenticated);\r
 \r
 #endif\r
 \r
 #endif\r