Link Search Menu Expand Document

Thistle SDK

The Thistle SDK provides a set of tools to enhance and simplify the development of applications using C as an underlying language. It’s available for download on our download page.

We provide 4 main components for now:

The SDK is provided as a collection of header files and .a compiled objects, available for multiple platforms (x86_64, aarch64, arm7, arm). Compiling them with your sources is straightforward and allows for simple static builds. See the example below.

Thistle SDK Secure Comms Example

/*
 * Example: tsc.c
 *
 * A quick example of how to use the Thistle Secure Comms library to perform a https call.
 *
 * Build on x86_64 with `cc -o tsc tsc.c lib/x86_64/libtsc.a`
*/

#include <stdio.h>
#include "./include/tsc.h"

int main() {
    struct tsc_http_session *sess = tsc_http_session_new();
    tsc_http_session_set_url(sess, "https://www.howsmyssl.com/a/check");

    struct tsc_http_request *request = tsc_http_session_get(sess);
    struct tsc_http_response *response = NULL;
    tsc_result result = tsc_http_request_send(request, &response);

    if (result != TSC_RESULT_OK) {
        printf("Failed to complete request\n");
    } else {
        size_t length = 0;
        printf("%s\n", tsc_http_response_body(response, &length));
        tsc_http_response_free(response);
    }

    tsc_http_request_free(request);
    tsc_http_session_free(sess);
    return 0;
}