NetBurner 3.5.0
PDF Version |
|
Topics | |
Web Client Error Codes | |
Classes | |
class | ParsedURI |
Parsed Uniform Resource Identifier Class (URI) More... | |
Functions | |
void | SetHttpDiag (bool b) |
Enable/disable Web Client HTTP diagnostics to the console port. | |
int | DoMultipartStartPost (ParsedURI &TheUri, const char *separator, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND, uint32_t contentLength=0) |
Start a multipart HTTP post using a pre-parsed URI object. | |
int | DoMultipartStartPost (const char *pUrl, const char *separator, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND, uint32_t contentLength=0) |
Start a multipart HTTP post using a pointer to a URL. | |
void | DoMultipartItem (int tcpfd, const char *Disposition, const char *separator, const unsigned char *data, int len) |
Send a multipart item. | |
void | DoMultipartBoundary (int tcpfd, const char *Disposition, const char *separator) |
Send a multipart boundary. | |
bool | DoMultipartFinished (int tcpfd, const char *separator, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Send a multipart item. | |
bool | DoUrlEncodedFormPost (ParsedURI &TheUri, char *headers, char *form_data, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT) |
Post a JSON file using a HTTP Form Post and a a ParsedURI object. | |
bool | DoUrlEncodedFormPost (const char *pUrl, char *headers, char *form_data, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT) |
Post a JSON file using a HTTP POST and a URL string and pointer to JSON data. | |
bool | DoJsonPost (const char *pUrl, const char *Json_Data_To_Post, buffer_object &result_buffer, const char *AdditionalHeaders=NULL, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Post a JSON file using a HTTP POST and a URL string and pointer to JSON data. | |
bool | DoJsonPost (ParsedURI &TheUri, const char *Json_Data_To_Post, buffer_object &result_buffer, const char *AdditionalHeaders=NULL, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Post a JSON file using a HTTP POST and a ParsedURI object. | |
bool | DoJsonPost (const char *pUrl, ParsedJsonDataSet &jsonout, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Post a JSON file using a HTTP POST and a URL string. | |
bool | DoJsonPost (ParsedURI &TheUri, ParsedJsonDataSet &jsonout, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Post a JSON file using HTTP and a ParsedURI object. | |
bool | DoJsonPostHttpFile (const char *pUrl, const char *FragmentName, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Post a JSON file using HTTP and a URL string. | |
bool | DoJsonPostHttpFile (ParsedURI &TheUri, const char *FragmentName, buffer_object &result_buffer, const char *AdditionalHeaders, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Post a JSON file using HTTP and a ParsedURI object. | |
bool | DoGet (ParsedURI &TheUri, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
bool | DoGetEx (ParsedURI &TheUri, const char *headers, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
bool | DoGet (const char *pUrl, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a HTTP/HTTPS GET request using a pointer to a URL string. | |
bool | DoGetEx (const char *pUrl, const char *headers, buffer_object &result_buffer, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a HTTP/HTTPS GET request using a pointer to a URL string. | |
int | DoGet (ParsedURI &TheUri, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI) | |
int | DoGetEx (ParsedURI &TheUri, const char *headers, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI) | |
int | DoGet (const char *pUrl, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a HTTP/HTTPS GET request using a pointer to a URL string. | |
int | DoGetEx (const char *pUrl, const char *headers, unsigned char *result, int maxl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a HTTP/HTTPS GET request using a pointer to a URL string. | |
int | DoGetUpdate (ParsedURI &TheUri, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a firmware update from the specified URI. | |
int | DoGetUpdate (const char *pUrl, uint16_t TIMEOUT_WAIT=10 *TICKS_PER_SECOND) |
Execute a firmware update from the specified URI. | |
int | PopulateAuthHeader (const char *user, const char *password, char *buffer, int maxlen) |
Fill in a username and password into a buffer for use as an extra header. | |
bool | DoActualClientRequest (ParsedURI &TheUri, uint16_t &next_time_delay) |
Callback to specify for performing and handle a WebClient request. | |
bool | StartWebClient (int prio, const char *url1, const char *url2=NULL, bool bDoNtp=false) |
Start the web client using a URL string. | |
bool | StartWebClient (int prio, const NBString &url1, const NBString &url2, bool bDoNtp=false) |
Start the web client using a NBString. | |
bool | StartWebClient (int prio, const NBString &url1, bool bDoNtp=false) |
Start the web client using a NBString. | |
Variables | |
WebErrorReporterFunc * | pWebErrorReporter |
Set this variable to a callback function to specify a handler for errors. | |
#include< http_funcs.h >
Functions for interacting with the web, like HTTP GET/POST requests.
#include< web_client.h >
Functions for instantiating a periodic web client
bool DoActualClientRequest | ( | ParsedURI & | TheUri, |
uint16_t & | next_time_delay ) |
#include <web_client.h>
Callback to specify for performing and handle a WebClient request.
TheUri | Pointer to a ParsedURI object (representing the URL) |
next_time_delay | Pointer to the number of ticks to wait before the next request |
bool DoGet | ( | const char * | pUrl, |
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a HTTP/HTTPS GET request using a pointer to a URL string.
This function will parse the URL string to connect to the host.
pUrl | Pointer to a URL string. A DNS lookup will be done if necessary. |
&result_buffer | Reference to the memory buffer in which to store the result. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int DoGet | ( | const char * | pUrl, |
unsigned char * | result, | ||
int | maxl, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a HTTP/HTTPS GET request using a pointer to a URL string.
This function will parse the URL string to connect to the host.
pUrl | Pointer to a URL string. A DNS lookup will be done if necessary. |
result | Pointer to the buffer in which to store the result. |
maxl | Maximum length of the result buffer. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoGet | ( | ParsedURI & | TheUri, |
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
&TheUri | Reference to the pre-parsed URI. |
&result_buffer | Reference to the location to store the result. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int DoGet | ( | ParsedURI & | TheUri, |
unsigned char * | result, | ||
int | maxl, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI)
This function uses a reference to a parsed URI, providing faster execution and avoiding parsing a URL, DNS, etc.
TheUri | Reference to the ParsedURI object. |
result | Pointer to the buffer in which to store the result. |
maxl | Maximum length of the result buffer. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoGetEx | ( | const char * | pUrl, |
const char * | headers, | ||
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a HTTP/HTTPS GET request using a pointer to a URL string.
This function will parse the URL string to connect to the host.
pUrl | Pointer to a URL string. A DNS lookup will be done if necessary. |
headers | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
&result_buffer | Reference to the memory buffer in which to store the result. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int DoGetEx | ( | const char * | pUrl, |
const char * | headers, | ||
unsigned char * | result, | ||
int | maxl, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a HTTP/HTTPS GET request using a pointer to a URL string.
This function will parse the URL string to connect to the host.
pUrl | Pointer to a URL string. A DNS lookup will be done if necessary. |
headers | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
result | Pointer to the buffer in which to store the result. |
maxl | Maximum length of the result buffer. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoGetEx | ( | ParsedURI & | TheUri, |
const char * | headers, | ||
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
&TheUri | Reference to the pre-parsed URI. |
headers | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
&result_buffer | Reference to the location to store the result. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int DoGetEx | ( | ParsedURI & | TheUri, |
const char * | headers, | ||
unsigned char * | result, | ||
int | maxl, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a HTTP/HTTPS GET request using a reference to a parsed Uniform Resource Identifier (URI)
This function uses a reference to a parsed URI, providing faster execution and avoiding parsing a URL, DNS, etc.
TheUri | Reference to the ParsedURI object. |
headers | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
result | Pointer to the buffer in which to store the result. |
maxl | Maximum length of the result buffer. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int DoGetUpdate | ( | const char * | pUrl, |
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a firmware update from the specified URI.
pUrl | Pointer to a URL string. A DNS lookup will be done if necessary. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int DoGetUpdate | ( | ParsedURI & | TheUri, |
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Execute a firmware update from the specified URI.
TheUri | Reference to the ParsedURI object. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoJsonPost | ( | const char * | pUrl, |
const char * | Json_Data_To_Post, | ||
buffer_object & | result_buffer, | ||
const char * | AdditionalHeaders = NULL, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Post a JSON file using a HTTP POST and a URL string and pointer to JSON data.
pUrl | Pointer to a URL string. |
Json_Data_To_Post | Pointer to serialized JSON data |
&result_buffer | Reference to the location in which to store the result. |
AdditionalHeaders | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoJsonPost | ( | const char * | pUrl, |
ParsedJsonDataSet & | jsonout, | ||
buffer_object & | result_buffer, | ||
const char * | AdditionalHeaders, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Post a JSON file using a HTTP POST and a URL string.
pUrl | Pointer to a URL string. |
jsonout | Reference to NetBurner data object. Please ref JSON lexer. |
&result_buffer | Reference to the location in which to store the result. |
AdditionalHeaders | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoJsonPost | ( | ParsedURI & | TheUri, |
const char * | Json_Data_To_Post, | ||
buffer_object & | result_buffer, | ||
const char * | AdditionalHeaders = NULL, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Post a JSON file using a HTTP POST and a ParsedURI object.
&TheUri | Reference to the pre-parsed URI. |
Json_Data_To_Post | Serialized JSON data\ |
&result_buffer | Reference to the location in which to store the result. |
AdditionalHeaders | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoJsonPost | ( | ParsedURI & | TheUri, |
ParsedJsonDataSet & | jsonout, | ||
buffer_object & | result_buffer, | ||
const char * | AdditionalHeaders, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Post a JSON file using HTTP and a ParsedURI object.
&TheUri | Reference to the pre-parsed URI. |
jsonout | Reference to NetBurner data object. Please ref JSON lexer. |
&result_buffer | Reference to the location in which to store the result. |
AdditionalHeaders | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoJsonPostHttpFile | ( | const char * | pUrl, |
const char * | FragmentName, | ||
buffer_object & | result_buffer, | ||
const char * | AdditionalHeaders, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Post a JSON file using HTTP and a URL string.
pUrl | Pointer to a URL string. |
FragmentName | |
&result_buffer | Reference to the location in which to store the result. |
AdditionalHeaders | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoJsonPostHttpFile | ( | ParsedURI & | TheUri, |
const char * | FragmentName, | ||
buffer_object & | result_buffer, | ||
const char * | AdditionalHeaders, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Post a JSON file using HTTP and a ParsedURI object.
&TheUri | Reference to the pre-parsed URI. |
FragmentName | |
&result_buffer | Reference to the location in which to store the result. |
AdditionalHeaders | |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
void DoMultipartBoundary | ( | int | tcpfd, |
const char * | Disposition, | ||
const char * | separator ) |
#include <http_funcs.h>
Send a multipart boundary.
tcpfd | TCP file descriptor returned from DoMultipartStartPost() |
Disposition | Content disposition field of multipart body |
separator | Separator string to use as the part delimiter between multipart posts. |
bool DoMultipartFinished | ( | int | tcpfd, |
const char * | separator, | ||
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND ) |
#include <http_funcs.h>
Send a multipart item.
tcpfd | TCP file descriptor returned from DoMultipartStartPost() |
separator | Separator string to use as the part delimiter between multipart posts. |
result_buffer | Reference to buffer to store result of xxxxx |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
void DoMultipartItem | ( | int | tcpfd, |
const char * | Disposition, | ||
const char * | separator, | ||
const unsigned char * | data, | ||
int | len ) |
#include <http_funcs.h>
Send a multipart item.
tcpfd | TCP file descriptor returned from DoMultipartStartPost() |
Disposition | Content disposition field of multipart body |
separator | Separator string to use as the part delimiter between multipart posts. |
data | Item data |
len | Data length |
int DoMultipartStartPost | ( | const char * | pUrl, |
const char * | separator, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND, | ||
uint32_t | contentLength = 0 ) |
#include <http_funcs.h>
Start a multipart HTTP post using a pointer to a URL.
pUrl | Pointer to a URL string. |
separator | Separator string to use as the part delimiter between multipart posts. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
contentLength | If given, content length for the entire multipart post. |
int DoMultipartStartPost | ( | ParsedURI & | TheUri, |
const char * | separator, | ||
uint16_t | TIMEOUT_WAIT = 10 *TICKS_PER_SECOND, | ||
uint32_t | contentLength = 0 ) |
#include <http_funcs.h>
Start a multipart HTTP post using a pre-parsed URI object.
&TheUri | Reference to the pre-parsed URI object. |
separator | Separator string to use as the part delimiter between multipart posts. |
TIMEOUT_WAIT | Timeout in seconds to wait for a response. |
contentLength | If given, content length for the entire multipart post. |
bool DoUrlEncodedFormPost | ( | const char * | pUrl, |
char * | headers, | ||
char * | form_data, | ||
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT ) |
#include <http_funcs.h>
Post a JSON file using a HTTP POST and a URL string and pointer to JSON data.
pUrl | Pointer to a URL string. |
headers | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
form_data | Pointer to the JSON data you are posting. |
&result_buffer | Reference to the location in which to store the result. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
bool DoUrlEncodedFormPost | ( | ParsedURI & | TheUri, |
char * | headers, | ||
char * | form_data, | ||
buffer_object & | result_buffer, | ||
uint16_t | TIMEOUT_WAIT ) |
#include <http_funcs.h>
Post a JSON file using a HTTP Form Post and a a ParsedURI object.
&TheUri | Reference to the pre-parsed URI. |
headers | Additional HTTP header fields. Multiple header fields should be concatenated together and separated by by \r\n Do not put \r\n for last header (no trailing \r\n ) |
form_data | Pointer to the JSON data you are posting. |
&result_buffer | Reference to the location in which to store the result. |
TIMEOUT_WAIT | Timeout in in system time ticks to wait for a response. |
int PopulateAuthHeader | ( | const char * | user, |
const char * | password, | ||
char * | buffer, | ||
int | maxlen ) |
#include <http_funcs.h>
Fill in a username and password into a buffer for use as an extra header.
user | Pointer to username |
password | Pointer to password |
buffer | Destination buffer to put the authenticate header in. |
maxlen | Maximum number of chars to put in buffer |
void SetHttpDiag | ( | bool | b | ) |
#include <http_funcs.h>
Enable/disable Web Client HTTP diagnostics to the console port.
b | Set true to enable, false to disable. |
bool StartWebClient | ( | int | prio, |
const char * | url1, | ||
const char * | url2 = NULL, | ||
bool | bDoNtp = false ) |
#include <web_client.h>
Start the web client using a URL string.
prio | Priority |
url1 | Pointer to a string representing the URL. |
url2 | Pointer to a second URL. Optional parameter, default is NULL. |
bDoNtp | Enable the Network Time Protocol (NTP). Optional parameter, default is false. |
bool StartWebClient | ( | int | prio, |
const NBString & | url1, | ||
bool | bDoNtp = false ) |
#include <web_client.h>
Start the web client using a NBString.
prio | Priority |
url1 | Reference to a NBString representing the URL. |
bDoNtp | Enable the Network Time Protocol (NTP). Optional parameter, default is false. |
#include <web_client.h>
Start the web client using a NBString.
prio | Priority |
url1 | Reference to a string representing the URL. |
url2 | Reference to a second URL. Optional parameter, default is NULL. |
bDoNtp | Enable the Network Time Protocol (NTP). Optional parameter, default is false. |