thistle-sdk
Thistle SDK documentation
Loading...
Searching...
No Matches
tsc.c File Reference
#include <stdio.h>
#include "../target/tsc.h"

Functions

int main ()
 

Function Documentation

◆ main()

int main ( )
15{
17
18 tsc_http_session_set_url(sess, "https://www.howsmyssl.com/a/check");
19
20 struct tsc_http_request *request = tsc_http_session_get(sess);
21
22 struct tsc_http_response *response = NULL;
23 tsc_result result = tsc_http_request_send(request, &response);
24
25 if (result != TSC_RESULT_OK) {
26 printf("Failed to complete request");
27 } else {
28 size_t length = 0;
29 printf("%s\n", tsc_http_response_body(response, &length));
30 tsc_http_response_free(response);
31 }
32
33 tsc_http_request_free(request);
35 return 0;
36}
struct tsc_http_response tsc_http_response
Definition: tsc.h:81
void tsc_http_request_free(struct tsc_http_request *request)
struct tsc_http_session tsc_http_session
Definition: tsc.h:86
void tsc_http_session_free(struct tsc_http_session *session)
struct tsc_http_request * tsc_http_session_get(struct tsc_http_session *session)
void tsc_http_response_free(struct tsc_http_response *response)
const unsigned char * tsc_http_response_body(const struct tsc_http_response *response, uintptr_t *len)
enum tsc_result tsc_http_session_set_url(struct tsc_http_session *session, const char *url)
struct tsc_http_session * tsc_http_session_new(void)
tsc_result
Definition: tsc.h:6
@ TSC_RESULT_OK
Definition: tsc.h:10
enum tsc_result tsc_http_request_send(struct tsc_http_request *request, struct tsc_http_response **response)
struct tsc_http_request tsc_http_request
Definition: tsc.h:76

References tsc_http_request_free(), tsc_http_request_send(), tsc_http_response_body(), tsc_http_response_free(), tsc_http_session_free(), tsc_http_session_get(), tsc_http_session_new(), tsc_http_session_set_url(), and TSC_RESULT_OK.