SDK4.0
This document shows Ameba SDK 4.0 APIs
Data Structures | Macros | Functions
httpc.h File Reference

This file provides user interface for HTTP/HTTPS client. More...

#include "platform_stdlib.h"
#include "platform_opts.h"

Data Structures

struct  http_response
 The structure is the context used for HTTP response header parsing. More...
 
struct  httpc_conn
 The structure is the context used for connection. More...
 

Macros

#define HTTPC_SECURE_NONE   0
 
#define HTTPC_SECURE_TLS   1
 
#define HTTPC_DEBUG_OFF   0
 
#define HTTPC_DEBUG_ON   1
 
#define HTTPC_DEBUG_VERBOSE   2
 
#define HTTPC_TLS_POLARSSL   0
 
#define HTTPC_TLS_MBEDTLS   1
 

Functions

struct httpc_connhttpc_conn_new (uint8_t secure, char *client_cert, char *client_key, char *ca_certs)
 This function is used to generate connection context for an HTTP/HTTPS client. More...
 
void httpc_conn_free (struct httpc_conn *conn)
 This function is used to deallocate a connection context. More...
 
int httpc_conn_connect (struct httpc_conn *conn, char *host, uint16_t port, uint32_t timeout)
 This function is used to connect to a server. More...
 
void httpc_conn_close (struct httpc_conn *conn)
 This function is used to close connection from a server. More...
 
int httpc_conn_setup_user_password (struct httpc_conn *conn, char *user, char *password)
 This function is used to setup authorization for connection. More...
 
void httpc_setup_debug (uint8_t debug)
 This function is used to setup httpc debug. More...
 
void httpc_free (void *ptr)
 This function is used to free memory allocated by httpc API, such as httpc_response_get_header_field(). More...
 
void httpc_conn_dump_header (struct httpc_conn *conn)
 This function is used to dump the parsed HTTP header of response in connection context. More...
 
int httpc_request_write_header_start (struct httpc_conn *conn, char *method, char *resource, char *content_type, size_t content_len)
 This function is used to start a HTTP request in connection. More...
 
int httpc_request_write_header (struct httpc_conn *conn, char *name, char *value)
 This function is used to add an HTTP header field to HTTP request. More...
 
int httpc_request_write_header_finish (struct httpc_conn *conn)
 This function is used to write HTTP request header data to connection. More...
 
int httpc_request_write_data (struct httpc_conn *conn, uint8_t *data, size_t data_len)
 This function is used to write HTTP request body data to connection. More...
 
int httpc_response_is_status (struct httpc_conn *conn, char *status)
 This function is used to check HTTP status of response in connection context. More...
 
int httpc_response_read_header (struct httpc_conn *conn)
 This function is used to read HTTP header from client socket descriptor and parse content to connection context. More...
 
int httpc_response_read_data (struct httpc_conn *conn, uint8_t *data, size_t data_len)
 This function is used to read data from HTTP/HTTPS connection. More...
 
int httpc_response_get_header_field (struct httpc_conn *conn, char *field, char **value)
 This function is used to get a header field from HTTP header of connection context. More...
 

Detailed Description

This file provides user interface for HTTP/HTTPS client.

Author
Version
Attention

This module is a confidential and proprietary property of RealTek and possession or use of this module requires written permission of RealTek.

Copyright(c) 2016, Realtek Semiconductor Corporation. All rights reserved.