X-Git-Url: https://gitweb.ps.run/matrix_esp_thesis/blobdiff_plain/80dc4ce95cbe915a3aaa7e2e18f545916d6ec769..9eaa420b7bf51cc81c50e7f4ca0f256498a07c86:/src/matrix.h diff --git a/src/matrix.h b/src/matrix.h index 4037f09..d31a7f6 100644 --- a/src/matrix.h +++ b/src/matrix.h @@ -49,7 +49,54 @@ #define NUM_MEGOLM_SESSIONS 10 #define NUM_OLM_SESSIONS 10 -#define NUM_DEVICES 100 +#define NUM_DEVICES 10 + +// HTTP + +typedef struct MatrixHttpConnection MatrixHttpConnection; + +bool +MatrixHttpInit( + MatrixHttpConnection ** hc, + const char * host); + +// bool +// MatrixHttpConnect( +// MatrixHttpConnection * hc); + +bool +MatrixHttpDeinit( + MatrixHttpConnection ** hc); + +bool +MatrixHttpSetAccessToken( + MatrixHttpConnection * hc, + const char * accessToken); + +bool +MatrixHttpGet( + MatrixHttpConnection * hc, + const char * url, + char * outResponseBuffer, int outResponseCap, + bool authenticated); + +bool +MatrixHttpPost( + MatrixHttpConnection * hc, + const char * url, + const char * requestBuffer, + char * outResponseBuffer, int outResponseCap, + bool authenticated); + +bool +MatrixHttpPut( + MatrixHttpConnection * hc, + const char * url, + const char * requestBuffer, + char * outResponseBuffer, int outResponseCap, + bool authenticated); + + // Matrix Device @@ -212,19 +259,17 @@ typedef struct MatrixClient { // char signingKey[DEVICE_KEY_SIZE]; char userId[USER_ID_SIZE]; - char server[SERVER_SIZE]; char accessToken[ACCESS_TOKEN_SIZE]; char deviceId[DEVICE_ID_SIZE]; char expireMs[EXPIRE_MS_SIZE]; char refreshToken[REFRESH_TOKEN_SIZE]; - void * httpUserData; + MatrixHttpConnection * hc; } MatrixClient; bool MatrixClientInit( - MatrixClient * client, - const char * server); + MatrixClient * client); bool MatrixClientSave( @@ -357,6 +402,13 @@ MatrixClientRequestMegolmInSession( bool MatrixClientGetOlmSessionIn( + MatrixClient * client, + const char * userId, + const char * deviceId, + MatrixOlmSession ** outSession); + +bool +MatrixClientNewOlmSessionIn( MatrixClient * client, const char * userId, const char * deviceId, @@ -369,6 +421,13 @@ MatrixClientGetOlmSessionOut( const char * userId, const char * deviceId, MatrixOlmSession ** outSession); + +bool +MatrixClientNewOlmSessionOut( + MatrixClient * client, + const char * userId, + const char * deviceId, + MatrixOlmSession ** outSession); bool MatrixClientSendToDevice( @@ -413,43 +472,6 @@ MatrixClientDeleteDevice( MatrixClient * client); - - -bool -MatrixHttpInit( - MatrixClient * client); - -bool -MatrixHttpConnect( - MatrixClient * client); - -bool -MatrixHttpDeinit( - MatrixClient * client); - -bool -MatrixHttpGet( - MatrixClient * client, - const char * url, - char * outResponseBuffer, int outResponseCap, - bool authenticated); - -bool -MatrixHttpPost( - MatrixClient * client, - const char * url, - const char * requestBuffer, - char * outResponseBuffer, int outResponseCap, - bool authenticated); - -bool -MatrixHttpPut( - MatrixClient * client, - const char * url, - const char * requestBuffer, - char * outResponseBuffer, int outResponseCap, - bool authenticated); - // util void