]> gitweb.ps.run Git - matrix_esp_thesis/blob - src/matrix.h
dont need length variables everywhere (i think)
[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     OlmAccount * olmAccount;\r
22     OlmSession * olmSession;\r
23     \r
24     char server[SERVER_SIZE];\r
25     char accessTokenBuffer[ACCESS_TOKEN_SIZE];\r
26     char deviceIdBuffer[DEVICE_ID_SIZE];\r
27     char expireMsBuffer[EXPIRE_MS_SIZE];\r
28     char refreshTokenBuffer[REFRESH_TOKEN_SIZE];\r
29 \r
30     void * httpUserData;\r
31 } MatrixClient;\r
32 \r
33 bool\r
34 MatrixClientInit(\r
35     MatrixClient * client,\r
36     const char * server);\r
37 \r
38 bool\r
39 MatrixClientLoginPassword(\r
40     MatrixClient * client,\r
41     const char * username,\r
42     const char * password,\r
43     const char * displayName);\r
44 \r
45 bool\r
46 MatrixHttpInit(\r
47     MatrixClient * client);\r
48 \r
49 bool\r
50 MatrixHttpDeinit(\r
51     MatrixClient * client);\r
52 \r
53 bool\r
54 MatrixHttpGet(\r
55     MatrixClient * client,\r
56     const char * url,\r
57     char * outResponseBuffer, int outResponseCap);\r
58 \r
59 bool\r
60 MatrixHttpPost(\r
61     MatrixClient * client,\r
62     const char * url,\r
63     const char * requestBuffer,\r
64     char * outResponseBuffer, int outResponseCap);\r
65 \r
66 #endif\r