From 0c48c436d2d6fd67e4dab40c02b9bde3842706d6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bendeg=C3=BAz=20Gy=C3=B6nki?= Date: Sun, 29 Nov 2020 22:18:33 +0100 Subject: [PATCH] Updated Developer documentation (markdown) --- Developer-documentation.md | 26 +++++++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/Developer-documentation.md b/Developer-documentation.md index ca5ca68..e62914a 100644 --- a/Developer-documentation.md +++ b/Developer-documentation.md @@ -83,16 +83,15 @@ This file contains our own MagicMemory library that provides memory allocation f `main` is the entrypoint of the previewer module. -`perform_extraction` takes care of the preview extraction process: it calls parser and validator functions and other helper functions. +`perform_extraction` takes care of the preview extraction process: it calls parser and validator functions and other helper functions. In theory, the size of a CAFF file can be really huge. In the case of our previewer, only files smaller than 512 megabytes are processed. ### utils.c `read_file_to_mem` is used to read CAFF files into memory. - ### libtarga.c -This files contains the [LibTarga](https://research.cs.wisc.edu/graphics/Gallery/LibTarga/) library by Alex Mohr. +This file contains the [LibTarga](https://research.cs.wisc.edu/graphics/Gallery/LibTarga/) library by Alex Mohr. # CAFF previewer wrapper This module makes communication between the previewer and the web client possible. @@ -107,6 +106,27 @@ The module provides only one endpoint: **Response:** If the preview extraction is successful, the response contains a single PNG image. The content type is set to `image/png`. +## Integrity checking + +CAFF previewer wrapper provides two headers in the response that can be used to check the integrity of transferred files. These are the following: + +- `X-request-checksum` contains the md5 checksum of the received file. +- `X-response-checksum` contains the md5 checksum of the converted file. + +These checksums can be used to detect errors during file transfer. + +## Preview process + +This section gives an overview of the preview creation process. + +### Converting CAFF to TGA + +After the wrapper receives a CAFF file, it uses the CAFF previewer written in C to extract a preview. The output of the previewer is a TGA file. + +### Converting TGA to PNG + +The wrapper uses ImageMagick to convert the TGA file (output of the previewer) to PNG. This step is done because PNG is a more suitable image format for the web application than TGA. + # Web application This module provides the web UI for the users.