X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/7cba6b3cdbd3b82ec9092ce9bda8ec20739096cb..5cb22046a33f24c1a696990f95e13d534efef497:/src/matrix.h diff --git a/src/matrix.h b/src/matrix.h index 5f53e0e..b7f3a5b 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -6,34 +6,61 @@ #include -#include "fixedbuffer.h" +// TODO: fix +#define SERVER_SIZE 20 +#define ACCESS_TOKEN_SIZE 40 +#define DEVICE_ID_SIZE 20 +#define EXPIRE_MS_SIZE 20 +#define REFRESH_TOKEN_SIZE 20 +#define MAX_URL_LEN 128 -#define ACCESS_TOKEN_LEN 20 // TODO: fix typedef struct MatrixClient { - OlmAccount * olmAcc; - char accessToken[ACCESS_TOKEN_LEN]; + OlmAccount * olmAccount; + OlmSession * olmSession; + + char server[SERVER_SIZE]; int serverLen; + char accessTokenBuffer[ACCESS_TOKEN_SIZE]; int accessTokenLen; + char deviceIdBuffer[DEVICE_ID_SIZE]; int deviceIdLen; + char expireMsBuffer[EXPIRE_MS_SIZE]; int expireMsLen; + char refreshTokenBuffer[REFRESH_TOKEN_SIZE]; int refreshTokenLen; + + void * httpUserData; } MatrixClient; bool MatrixClientInit( MatrixClient * client, - FixedBuffer server -); + char * server, int serverLen); bool MatrixClientLoginPassword( MatrixClient * client, - FixedBuffer username, - FixedBuffer password -); + char * username, int usernameLen, + char * password, int passwordLen, + char * displayName, int displayNameLen); + +bool +MatrixHttpInit( + MatrixClient * client); + +bool +MatrixHttpDeinit( + MatrixClient * client); + +bool +MatrixHttpGet( + MatrixClient * client, + const char * url, + char * outResponseBuffer, int outResponseCap, int * outResponseLen); bool -MatrixClientGetAccessToken( +MatrixHttpPost( MatrixClient * client, - FixedBuffer * outBuffer -); + const char * url, + char * requestBuffer, int requestLen, + char * outResponseBuffer, int outResponseCap, int * outResponseLen); #endif