]> gitweb.ps.run Git - matrix_esp_thesis/blob - src/matrix.h
add mongoose submodule
[matrix_esp_thesis] / src / matrix.h
1 #ifndef MATRIX__H\r
2 #define MATRIX__H\r
3 \r
4 #include <stdbool.h>\r
5 #include <string.h>\r
6 \r
7 #include <olm/olm.h>\r
8 \r
9 \r
10 \r
11 // TODO: fix\r
12 #define SERVER_SIZE 20\r
13 #define ACCESS_TOKEN_SIZE 40\r
14 #define DEVICE_ID_SIZE 20\r
15 #define EXPIRE_MS_SIZE 20\r
16 #define REFRESH_TOKEN_SIZE 20\r
17 #define MAX_URL_LEN 128\r
18 \r
19 \r
20 typedef struct MatrixClient {\r
21     void * httpUserData;\r
22     OlmAccount * olmAccount;\r
23     OlmSession * olmSession;\r
24     char server[SERVER_SIZE]; int serverLen;\r
25     char accessTokenBuffer[ACCESS_TOKEN_SIZE]; int accessTokenLen;\r
26     char deviceIdBuffer[DEVICE_ID_SIZE]; int deviceIdLen;\r
27     char expireMsBuffer[EXPIRE_MS_SIZE]; int expireMsLen;\r
28     char refreshTokenBuffer[REFRESH_TOKEN_SIZE]; int refreshTokenLen;\r
29 } MatrixClient;\r
30 \r
31 bool\r
32 MatrixClientInit(\r
33     MatrixClient * client,\r
34     char * server, int serverLen\r
35 );\r
36 \r
37 bool\r
38 MatrixClientLoginPassword(\r
39     MatrixClient * client,\r
40     char * username, int usernameLen,\r
41     char * password, int passwordLen,\r
42     char * displayName, int displayNameLen\r
43 );\r
44 \r
45 bool\r
46 MatrixHttpPost(\r
47     MatrixClient * client,\r
48     const char * url,\r
49     char * requestBuffer, int requestLen,\r
50     char * outResponseBuffer, int outResponseCap, int * outResponseLen\r
51 );\r
52 \r
53 #endif\r