about summary refs log tree commit diff stats
path: root/source/http.h
diff options
context:
space:
mode:
authorKelly Rauchenberger <fefferburbia@gmail.com>2017-09-16 16:11:15 -0400
committerKelly Rauchenberger <fefferburbia@gmail.com>2017-09-16 16:11:15 -0400
commit4fe95cc1e7412e309d026e53cd44239bd3ef031d (patch)
treec1b711ed5a81976d9054da6205f5f9b2c3133248 /source/http.h
parente2a76d1f0fd978f285edf1dbc0f6e87cf89c63ce (diff)
downloadgen3uploader-4fe95cc1e7412e309d026e53cd44239bd3ef031d.tar.gz
gen3uploader-4fe95cc1e7412e309d026e53cd44239bd3ef031d.tar.bz2
gen3uploader-4fe95cc1e7412e309d026e53cd44239bd3ef031d.zip
Wii can now send a POST request to a website
The extractor now uses libfat to read a config file off the root of the
SD card, a model for which is included in the repository. The extractor
is capable of negotiating an HTTPS connection, but it requires a
download of the target site's root CA certificate to be on the SD card
and pointed at by the config file. TLS/SSL functionality is provided by
wolfSSL. I had to make a couple of minor changes to wolfSSL for it to
work properly, and those changes are located in the devkitpro branch of
my fork, hatkirby/wolfssl.

The Wii program now arranges some of the information that the GBA sends
it into a JSON object, which is then sent off (along with some
authentication information from the config file) to the endpoint defined
in the config file. The code used to maintain the network connection is
from the WiiTweet project, which was licensed under the GPL. Some of the
code used to send the HTTP request also comes from said project.
Diffstat (limited to 'source/http.h')
-rw-r--r--source/http.h37
1 files changed, 37 insertions, 0 deletions
diff --git a/source/http.h b/source/http.h new file mode 100644 index 0000000..9597a1d --- /dev/null +++ b/source/http.h
@@ -0,0 +1,37 @@
1/*
2 * Copyright (C) 2008 Tantric
3 * Copyright (C) 2012 Pedro Aguiar
4 * Copyright (C) 2017 hatkirby
5 *
6 * Originally part of the WiiTweet project, which was distributed under the
7 * GPL.
8 */
9#ifndef HTTP_H_A46C206E
10#define HTTP_H_A46C206E
11
12#include "cJSON.h"
13#include <wolfssl/options.h>
14#include <wolfssl/ssl.h>
15
16typedef enum {
17 HTTPR_OK,
18 HTTPR_ERR_CONNECT,
19 HTTPR_ERR_TIMEOUT,
20 HTTPR_ERR_WRITE,
21 HTTPR_ERR_RECEIVE,
22 HTTPR_ERR_SSL,
23 HTTPR_ERR_STATUS
24} http_res;
25
26/**
27 * Submits a JSON request to a web service. Takes ownership of the cJSON object,
28 * because it needs to embed authentication data in it.
29 */
30int submitToApi(
31 const char* endpoint,
32 WOLFSSL_CTX* sslContext,
33 cJSON* data,
34 const char* username,
35 const char* password);
36
37#endif /* end of include guard: HTTP_H_A46C206E */