Microchip® Advanced Software Framework

websocket-http-client.c File Reference
#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
 

Functions

static void acked (struct websocket_http_client_state *s)
 
static char casecmp (char *str1, const char *str2, char len)
 
static void init_connection (struct websocket_http_client_state *s)
 
static void newdata (struct websocket_http_client_state *s)
 
static uint16_t parse_headers (struct websocket_http_client_state *s, uint16_t len)
 
static uint16_t parse_statusline (struct websocket_http_client_state *s, uint16_t len)
 
static void senddata (struct websocket_http_client_state *s)
 
void websocket_http_client_appcall (void *state)
 
void websocket_http_client_close (struct websocket_http_client_state *s)
 
char * websocket_http_client_filename (struct websocket_http_client_state *s)
 
unsigned char websocket_http_client_get (struct websocket_http_client_state *s, const char *host, uint16_t port, const char *file, const char *subprotocol)
 
char * websocket_http_client_hostname (struct websocket_http_client_state *s)
 
void websocket_http_client_init (void)
 
char * websocket_http_client_mimetype (struct websocket_http_client_state *s)
 
unsigned short websocket_http_client_port (struct websocket_http_client_state *s)
 
uint16_t websocket_http_client_send (struct websocket_http_client_state *s, const uint8_t *data, uint16_t datalen)
 
uint16_t websocket_http_client_sendbuflen (struct websocket_http_client_state *s)
 
static int window_copy (int curptr, const char *data, unsigned char datalen)
 

Variables

static int windowend
 
static unsigned char * windowptr
 
static int windowstart
 

#define HTTPFLAG_ERROR   3
#define HTTPFLAG_MOVED   2
#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,
 
)    ((a) < (b) ? (a) : (b))
#define WEBSOCKET_HTTP_CLIENT_STATE_CLOSE   3
#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
#define WEBSOCKET_HTTP_CLIENT_TIMEOUT   100

static char casecmp ( char *  str1,
const char *  str2,
char  len 
)
static

References c, and len.

Referenced by parse_headers().

char* websocket_http_client_filename ( struct websocket_http_client_state s)
char* websocket_http_client_hostname ( struct websocket_http_client_state s)
void websocket_http_client_init ( void  )
char* websocket_http_client_mimetype ( struct websocket_http_client_state s)
unsigned short websocket_http_client_port ( struct websocket_http_client_state s)
uint16_t websocket_http_client_send ( struct websocket_http_client_state s,
const uint8_t *  data,
uint16_t  datalen 
)
uint16_t websocket_http_client_sendbuflen ( struct websocket_http_client_state s)
static int window_copy ( int  curptr,
const char *  data,
unsigned char  datalen 
)
static

References len, strncpy(), windowend, windowptr, and windowstart.

Referenced by senddata().

int windowend
static

Referenced by senddata(), and window_copy().

unsigned char* windowptr
static

Referenced by senddata(), and window_copy().

int windowstart
static

Referenced by senddata(), and window_copy().