summaryrefslogtreecommitdiff
path: root/rtclient.c
blob: 1be0579e7123c6d8131a3b0f937c5c86c064065a (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#ifdef DEBUG
#ifdef ANDROID
#include <android/log.h>
#else
#include <stdio.h>
#endif // ANDROID
#endif // DEBUG
#include <stdbool.h>
#include <curl/curl.h>
#include "rtclient.h"

static CURL *handle = NULL;

bool rtclient_init()
{
	curl_global_init(CURL_GLOBAL_SSL);
	handle = curl_easy_init();
	if (handle) {
		curl_easy_setopt(handle, CURLOPT_FOLLOWLOCATION, 1L);
#ifdef DEBUG
		curl_easy_setopt(handle, CURLOPT_VERBOSE, 1L);
#endif
	}

	return (bool)handle;
}

void rtclient_cleanup()
{
	if (handle)
		curl_easy_cleanup(handle);
	curl_global_cleanup();
}