From 4fe95cc1e7412e309d026e53cd44239bd3ef031d Mon Sep 17 00:00:00 2001 From: Kelly Rauchenberger Date: Sat, 16 Sep 2017 16:11:15 -0400 Subject: 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. --- source/http.h | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 source/http.h (limited to 'source/http.h') 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 @@ +/* + * Copyright (C) 2008 Tantric + * Copyright (C) 2012 Pedro Aguiar + * Copyright (C) 2017 hatkirby + * + * Originally part of the WiiTweet project, which was distributed under the + * GPL. + */ +#ifndef HTTP_H_A46C206E +#define HTTP_H_A46C206E + +#include "cJSON.h" +#include +#include + +typedef enum { + HTTPR_OK, + HTTPR_ERR_CONNECT, + HTTPR_ERR_TIMEOUT, + HTTPR_ERR_WRITE, + HTTPR_ERR_RECEIVE, + HTTPR_ERR_SSL, + HTTPR_ERR_STATUS +} http_res; + +/** + * Submits a JSON request to a web service. Takes ownership of the cJSON object, + * because it needs to embed authentication data in it. + */ +int submitToApi( + const char* endpoint, + WOLFSSL_CTX* sslContext, + cJSON* data, + const char* username, + const char* password); + +#endif /* end of include guard: HTTP_H_A46C206E */ -- cgit 1.4.1