TI-RTOS Network Services  2.14.04.31
Data Structures | Macros | Typedefs | Functions
httpcli.h File Reference
#include <stdbool.h>
#include <ti/net/network.h>
#include <ti/net/http/httpstd.h>
#include <ti/net/http/ssock.h>
Include dependency graph for httpcli.h:

Go to the source code of this file.

Data Structures

struct  HTTPCli_Field
 HTTPCli request header field. More...
 
struct  HTTPCli_StatusHandler
 HTTPCli response status code handler type. More...
 
struct  HTTPCli_ContentHandler
 HTTPCli content handler type. More...
 
struct  HTTPCli_Struct
 HTTPCli instance type. More...
 
struct  HTTPCli_Params
 HTTPCli instance paramaters. More...
 

Macros

#define HTTPCli_BUF_LEN   128
 
HTTP Client Error Codes
#define HTTPCli_ESOCKETFAIL   (-101)
 Socket create failed. More...
 
#define HTTPCli_ECONNECTFAIL   (-102)
 Cannot connect to the remote host. More...
 
#define HTTPCli_ESENDFAIL   (-103)
 Cannot send to the remote host. More...
 
#define HTTPCli_ERECVFAIL   (-104)
 Cannot recieve data from the remote host. More...
 
#define HTTPCli_ETLSFAIL   (-105)
 Failed to configure the socket with TLS parameters. More...
 
#define HTTPCli_EHOSTNAME   (-106)
 Failed to resolve host name. More...
 
#define HTTPCli_ESENDBUFSMALL   (-107)
 Internal send buffer is not big enough. More...
 
#define HTTPCli_ERECVBUFSMALL   (-108)
 Recieve buffer is not big enough. More...
 
#define HTTPCli_EASYNCMODE   (-109)
 HTTPCli_getResponseStatus() should not be called in async mode More...
 
#define HTTPCli_ETHREADFAIL   (-110)
 Thread create failed. More...
 
#define HTTPCli_EPROXYTUNNELFAIL   (-111)
 Failed to create an HTTP tunnel through proxy. More...
 
#define HTTPCli_ERESPONSEINVALID   (-112)
 Response recieved from the server is not a valid HTTP/1.1 response. More...
 
#define HTTPCli_ECONTENTLENLARGE   (-114)
 Content length returned is too large. More...
 
#define HTTPCli_EREDIRECTURILONG   (-115)
 Redirection URI returned is too long to be read into the buffer. More...
 
#define HTTPCli_ECONTENTTYPELONG   (-116)
 Content type returned is too long to be read into buffer. More...
 
#define HTTPCli_ENOCONTENTCALLBACK   (-117)
 Recieved content type does not match any registered callback. More...
 
#define HTTPCli_ENOTCHUNKDATA   (-118)
 Data is not of chunked type. More...
 
#define HTTPCli_EINPROGRESS   (-119)
 Operation could not be completed. Try again. More...
 
#define HTTPCli_EINTERNALBUFSMALL   (-120)
 Internal instance buffer to send/recieve data is too small. More...
 
#define HTTPCli_ESETNOTIFYFAIL   (-121)
 Could not setup the notify callbacks. More...
 
#define HTTPCli_EURILENLONG   (-122)
 Input domain name length is too long to be read into buffer. More...
 
#define HTTPCli_EHOSTFIELDNOTFOUND   (-123)
 Request Field 'Host' is not found in the set array. More...
 
HTTP Client Configuration Types
#define HTTPCli_TYPE_TLS   (0x02)
 
#define HTTPCli_TYPE_IPV6   (0x04)
 
HTTP Client Field ID

Special return codes for HTTPCli_getResponseField().

#define HTTPCli_FIELD_ID_DUMMY   (-11)
 
#define HTTPCli_FIELD_ID_END   (-12)
 

Typedefs

typedef struct HTTPCli_Field HTTPCli_Field
 HTTPCli request header field. More...
 
typedef void(* HTTPCli_StatusCallback) (void *cli, int status)
 HTTPCli callback function for status handling. More...
 
typedef struct HTTPCli_StatusHandler HTTPCli_StatusHandler
 HTTPCli response status code handler type. More...
 
typedef int(* HTTPCli_ContentCallback) (void *cli, int status, char *body, int len, bool moreFlag)
 HTTPCli callback function for content handling. More...
 
typedef struct HTTPCli_ContentHandler HTTPCli_ContentHandler
 HTTPCli content handler type. More...
 
typedef void(* HTTPCli_RedirectCallback) (void *cli, int status, char *uri)
 HTTPCli callback function prototype for redirection handling. More...
 
typedef struct HTTPCli_Struct HTTPCli_Struct
 HTTPCli instance type. More...
 
typedef struct HTTPCli_Params HTTPCli_Params
 HTTPCli instance paramaters. More...
 
typedef HTTPCli_StructHTTPCli_Handle
 

Functions

int HTTPCli_initSockAddr (struct sockaddr *addr, const char *uri, int flags)
 Initialize the socket address structure for the given URI. More...
 
void HTTPCli_construct (HTTPCli_Struct *cli)
 Create a new instance object in the provided structure. More...
 
HTTPCli_Handle HTTPCli_create ()
 Allocate and initialize a new instance object and return its handle. More...
 
int HTTPCli_connect (HTTPCli_Handle cli, const struct sockaddr *addr, int flags, const HTTPCli_Params *params)
 Open a connection to an HTTP server. More...
 
void HTTPCli_delete (HTTPCli_Handle *cli)
 Destory the HTTP client instance and free the previously allocated instance object. More...
 
void HTTPCli_destruct (HTTPCli_Struct *cli)
 Destory the HTTP client instance. More...
 
void HTTPCli_disconnect (HTTPCli_Handle cli)
 Disconnect from the HTTP server and destroy the HTTP client instance. More...
 
HTTPCli_FieldHTTPCli_setRequestFields (HTTPCli_Handle cli, const HTTPCli_Field *fields)
 Set an array of header fields to be sent for every HTTP request. More...
 
char ** HTTPCli_setResponseFields (HTTPCli_Handle cli, const char *fields[])
 Set the header fields to filter the response headers. More...
 
int HTTPCli_sendRequest (HTTPCli_Handle cli, const char *method, const char *requestURI, bool moreFlag)
 Make an HTTP 1.1 request to the HTTP server. More...
 
int HTTPCli_sendField (HTTPCli_Handle cli, const char *name, const char *value, bool lastFlag)
 Send an header field to the HTTP server. More...
 
int HTTPCli_sendRequestBody (HTTPCli_Handle cli, const char *body, int len)
 Send the request message body to the HTTP server. More...
 
int HTTPCli_getResponseStatus (HTTPCli_Handle cli)
 Process the response header from the HTTP server and return status. More...
 
int HTTPCli_getResponseField (HTTPCli_Handle cli, char *value, int len, bool *moreFlag)
 Process the response header from the HTTP server and return field. More...
 
int HTTPCli_readResponseBody (HTTPCli_Handle cli, char *body, int len, bool *moreFlag)
 Read the parsed response body data from the HTTP server. More...
 
int HTTPCli_readRawResponseBody (HTTPCli_Handle cli, char *body, int len)
 Read the raw response message body from the HTTP server. More...
 
void HTTPCli_setProxy (const struct sockaddr *addr)
 Set the proxy address. More...
 
int HTTPCli_getSocketError (HTTPCli_Handle cli)
 Get the error code from the socket/TLS layer. More...
 
Copyright 2015, Texas Instruments Incorporated