#include <string.h>
#include <stdio.h>
#include "contiki-net.h"
#include "ip64-addr.h"
#include "mdns.h"
#include "websocket-http-client.h"
Macros | |
#define | HTTPFLAG_ERROR 3 |
#define | HTTPFLAG_MOVED 2 |
#define | HTTPFLAG_NONE 0 |
#define | HTTPFLAG_OK 1 |
#define | ISO_cr 0x0d |
#define | ISO_nl 0x0a |
#define | ISO_space 0x20 |
#define | MIN(a, b) ((a) < (b) ? (a) : (b)) |
#define | WEBSOCKET_HTTP_CLIENT_STATE_CLOSE 3 |
#define | WEBSOCKET_HTTP_CLIENT_STATE_DATA 2 |
#define | WEBSOCKET_HTTP_CLIENT_STATE_HEADERS 1 |
#define | WEBSOCKET_HTTP_CLIENT_STATE_STATUSLINE 0 |
#define | WEBSOCKET_HTTP_CLIENT_TIMEOUT 100 |
Variables | |
static int | windowend |
static unsigned char * | windowptr |
static int | windowstart |
#define HTTPFLAG_ERROR 3 |
#define HTTPFLAG_MOVED 2 |
Referenced by newdata(), parse_statusline(), and websocket_http_client_appcall().
#define HTTPFLAG_NONE 0 |
Referenced by parse_statusline().
#define HTTPFLAG_OK 1 |
Referenced by parse_statusline().
#define ISO_cr 0x0d |
Referenced by parse_headers().
#define ISO_nl 0x0a |
Referenced by parse_headers(), and parse_statusline().
#define ISO_space 0x20 |
#define MIN | ( | a, | |
b | |||
) | ((a) < (b) ? (a) : (b)) |
Referenced by senddata(), and websocket_http_client_send().
#define WEBSOCKET_HTTP_CLIENT_STATE_CLOSE 3 |
Referenced by websocket_http_client_appcall(), and websocket_http_client_close().
#define WEBSOCKET_HTTP_CLIENT_STATE_DATA 2 |
Referenced by newdata(), and parse_headers().
#define WEBSOCKET_HTTP_CLIENT_STATE_HEADERS 1 |
Referenced by newdata(), and parse_statusline().
#define WEBSOCKET_HTTP_CLIENT_STATE_STATUSLINE 0 |
Referenced by init_connection(), newdata(), and websocket_http_client_appcall().
#define WEBSOCKET_HTTP_CLIENT_TIMEOUT 100 |
Referenced by websocket_http_client_appcall().
|
static |
References websocket_http_client_state::getrequestleft, websocket_http_client_state::getrequestptr, len, websocket_http_client_state::outputbuf, websocket_http_client_state::outputbuf_sendnext, websocket_http_client_state::outputbufptr, uip_mss, and websocket_http_client_connected().
Referenced by websocket_http_client_appcall().
|
static |
Referenced by parse_headers().
|
static |
References websocket_http_client_state::file, websocket_http_client_state::getrequestleft, websocket_http_client_state::getrequestptr, websocket_http_client_state::host, http_10, http_crnl, http_get, http_host, http_request_fields, websocket_http_client_state::inputbufptr, websocket_http_client_state::port, websocket_http_client_state::state, websocket_http_client_state::subprotocol, and WEBSOCKET_HTTP_CLIENT_STATE_STATUSLINE.
Referenced by websocket_http_client_get().
|
static |
References websocket_http_client_state::httpflag, HTTPFLAG_MOVED, len, parse_headers(), parse_statusline(), websocket_http_client_state::state, uip_appdata, uip_datalen, websocket_http_client_datahandler(), WEBSOCKET_HTTP_CLIENT_STATE_DATA, WEBSOCKET_HTTP_CLIENT_STATE_HEADERS, and WEBSOCKET_HTTP_CLIENT_STATE_STATUSLINE.
Referenced by websocket_http_client_appcall().
|
static |
References casecmp(), websocket_http_client_state::file, websocket_http_client_state::host, http_content_type, http_http, http_location, i, websocket_http_client_state::inputbuf, websocket_http_client_state::inputbufptr, ISO_cr, ISO_nl, len, websocket_http_client_state::mimetype, NULL, websocket_http_client_state::state, strncpy(), uip_appdata, and WEBSOCKET_HTTP_CLIENT_STATE_DATA.
Referenced by newdata().
|
static |
References http_10, http_11, http_200, http_301, http_302, websocket_http_client_state::httpflag, HTTPFLAG_MOVED, HTTPFLAG_NONE, HTTPFLAG_OK, websocket_http_client_state::inputbuf, websocket_http_client_state::inputbufptr, ISO_nl, len, websocket_http_client_state::state, uip_abort, uip_appdata, websocket_http_client_aborted(), and WEBSOCKET_HTTP_CLIENT_STATE_HEADERS.
Referenced by newdata().
|
static |
References websocket_http_client_state::file, websocket_http_client_state::getrequestleft, websocket_http_client_state::getrequestptr, websocket_http_client_state::host, http_10, http_crnl, http_get, http_host, http_request_fields, len, MIN, websocket_http_client_state::outputbuf, websocket_http_client_state::outputbuf_sendnext, websocket_http_client_state::outputbufptr, websocket_http_client_state::port, websocket_http_client_state::subprotocol, uip_appdata, uip_mss, uip_send(), window_copy(), windowend, windowptr, and windowstart.
Referenced by websocket_http_client_appcall().
void websocket_http_client_appcall | ( | void * | state | ) |
References acked(), websocket_http_client_state::file, websocket_http_client_state::host, websocket_http_client_state::httpflag, HTTPFLAG_MOVED, mdns_lookup(), mdns_query(), newdata(), NULL, websocket_http_client_state::outputbuf_sendnext, websocket_http_client_state::outputbufptr, websocket_http_client_state::port, s, senddata(), websocket_http_client_state::state, state, websocket_http_client_state::subprotocol, tcp_markconn, websocket_http_client_state::timer, uip_abort, uip_aborted, uip_acked, uip_appdata, uip_closed, uip_connected, uip_newdata, uip_poll, uip_rexmit, uip_timedout, websocket_http_client_aborted(), websocket_http_client_closed(), websocket_http_client_datahandler(), websocket_http_client_get(), WEBSOCKET_HTTP_CLIENT_STATE_CLOSE, WEBSOCKET_HTTP_CLIENT_STATE_STATUSLINE, websocket_http_client_timedout(), and WEBSOCKET_HTTP_CLIENT_TIMEOUT.
Referenced by PROCESS_THREAD().
void websocket_http_client_close | ( | struct websocket_http_client_state * | s | ) |
References websocket_http_client_state::state, and WEBSOCKET_HTTP_CLIENT_STATE_CLOSE.
Referenced by websocket_close(), and websocket_http_client_datahandler().
char* websocket_http_client_filename | ( | struct websocket_http_client_state * | s | ) |
References websocket_http_client_state::file.
unsigned char websocket_http_client_get | ( | struct websocket_http_client_state * | s, |
const char * | host, | ||
uint16_t | port, | ||
const char * | file, | ||
const char * | subprotocol | ||
) |
References conn, websocket_http_client_state::conn, websocket_http_client_state::file, websocket_http_client_state::host, init_connection(), ip64_addr_4to6(), ipaddr, mdns_lookup(), NULL, websocket_http_client_state::port, port, strncpy(), websocket_http_client_state::subprotocol, tcp_connect(), tcp_markconn, uip_htons(), uiplib_ip4addrconv(), and uiplib_ip6addrconv().
Referenced by start_get(), and websocket_http_client_appcall().
char* websocket_http_client_hostname | ( | struct websocket_http_client_state * | s | ) |
References websocket_http_client_state::host.
void websocket_http_client_init | ( | void | ) |
char* websocket_http_client_mimetype | ( | struct websocket_http_client_state * | s | ) |
References websocket_http_client_state::mimetype.
unsigned short websocket_http_client_port | ( | struct websocket_http_client_state * | s | ) |
References websocket_http_client_state::port.
uint16_t websocket_http_client_send | ( | struct websocket_http_client_state * | s, |
const uint8_t * | data, | ||
uint16_t | datalen | ||
) |
References websocket_http_client_state::conn, len, MIN, websocket_http_client_state::outputbuf, websocket_http_client_state::outputbufptr, printf, and tcpip_poll_tcp().
Referenced by send_data(), websocket_http_client_datahandler(), and websocket_ping().
uint16_t websocket_http_client_sendbuflen | ( | struct websocket_http_client_state * | s | ) |
References websocket_http_client_state::outputbuf, and websocket_http_client_state::outputbufptr.
Referenced by send_data(), and websocket_ping().
|
static |
References len, strncpy(), windowend, windowptr, and windowstart.
Referenced by senddata().
|
static |
Referenced by senddata(), and window_copy().
|
static |
Referenced by senddata(), and window_copy().
|
static |
Referenced by senddata(), and window_copy().