diff options
Diffstat (limited to 'source/http.h')
-rw-r--r-- | source/http.h | 37 |
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 | |||
16 | typedef 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 | */ | ||
30 | int 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 */ | ||