56 #ifndef ti_net_http_HTTPClient__include 57 #define ti_net_http_HTTPClient__include 81 #define HTTPClient_DOMAIN_BUFLEN (100) 84 #define HTTPClient_RES_HFIELD_BUFFER_SIZE (300) 87 #define HTTPClient_MIN_USER_WORKSPACE_SIZE (500) 88 #define HTTPClient_MAX_REDIRECTION_ATTEMPTS (3) 89 #define HTTPClient_MAX_REQUEST_ATTEMPTS (2) 90 #define HTTPClient_MAX_RESPONSE_HEADER_FILEDS (25) 92 #define HTTPClient_PORT (80) 93 #define HTTPClient_SECURE_PORT (443) 96 #define HTTPClient_HFIELD_RES_AGE (0) 97 #define HTTPClient_HFIELD_RES_ALLOW (1) 98 #define HTTPClient_HFIELD_RES_CACHE_CONTROL (2) 99 #define HTTPClient_HFIELD_RES_CONNECTION (3) 100 #define HTTPClient_HFIELD_RES_CONTENT_ENCODING (4) 101 #define HTTPClient_HFIELD_RES_CONTENT_LANGUAGE (5) 102 #define HTTPClient_HFIELD_RES_CONTENT_LENGTH (6) 103 #define HTTPClient_HFIELD_RES_CONTENT_LOCATION (7) 104 #define HTTPClient_HFIELD_RES_CONTENT_RANGE (8) 105 #define HTTPClient_HFIELD_RES_CONTENT_TYPE (9) 106 #define HTTPClient_HFIELD_RES_DATE (10) 107 #define HTTPClient_HFIELD_RES_ETAG (11) 108 #define HTTPClient_HFIELD_RES_EXPIRES (12) 109 #define HTTPClient_HFIELD_RES_LAST_MODIFIED (13) 110 #define HTTPClient_HFIELD_RES_LOCATION (14) 111 #define HTTPClient_HFIELD_RES_PROXY_AUTHENTICATE (15) 112 #define HTTPClient_HFIELD_RES_RETRY_AFTER (16) 113 #define HTTPClient_HFIELD_RES_SERVER (17) 114 #define HTTPClient_HFIELD_RES_SET_COOKIE (18) 115 #define HTTPClient_HFIELD_RES_TRAILER (19) 116 #define HTTPClient_HFIELD_RES_TRANSFER_ENCODING (20) 117 #define HTTPClient_HFIELD_RES_UPGRADE (21) 118 #define HTTPClient_HFIELD_RES_VARY (22) 119 #define HTTPClient_HFIELD_RES_VIA (23) 120 #define HTTPClient_HFIELD_RES_WWW_AUTHENTICATE (24) 121 #define HTTPClient_HFIELD_RES_WARNING (25) 123 #define HTTPClient_REQUEST_HEADER_MASK (0x80000000) 127 #define HTTPClient_HFIELD_REQ_ACCEPT (26 | HTTPClient_REQUEST_HEADER_MASK) 129 #define HTTPClient_HFIELD_REQ_ACCEPT_CHARSET (27 | HTTPClient_REQUEST_HEADER_MASK) 131 #define HTTPClient_HFIELD_REQ_ACCEPT_ENCODING (28 | HTTPClient_REQUEST_HEADER_MASK) 133 #define HTTPClient_HFIELD_REQ_ACCEPT_LANGUAGE (29 | HTTPClient_REQUEST_HEADER_MASK) 135 #define HTTPClient_HFIELD_REQ_ALLOW (HTTPClient_HFIELD_RES_ALLOW | HTTPClient_REQUEST_HEADER_MASK) 137 #define HTTPClient_HFIELD_REQ_AUTHORIZATION (30 | HTTPClient_REQUEST_HEADER_MASK) 139 #define HTTPClient_HFIELD_REQ_CACHE_CONTROL (HTTPClient_HFIELD_RES_CACHE_CONTROL | HTTPClient_REQUEST_HEADER_MASK) 141 #define HTTPClient_HFIELD_REQ_CONNECTION (HTTPClient_HFIELD_RES_CONNECTION | HTTPClient_REQUEST_HEADER_MASK) 143 #define HTTPClient_HFIELD_REQ_CONTENT_ENCODING (HTTPClient_HFIELD_RES_CONTENT_ENCODING | HTTPClient_REQUEST_HEADER_MASK) 145 #define HTTPClient_HFIELD_REQ_CONTENT_LANGUAGE (HTTPClient_HFIELD_RES_CONTENT_LANGUAGE | HTTPClient_REQUEST_HEADER_MASK) 147 #define HTTPClient_HFIELD_REQ_CONTENT_LOCATION (HTTPClient_HFIELD_RES_CONTENT_LOCATION | HTTPClient_REQUEST_HEADER_MASK) 149 #define HTTPClient_HFIELD_REQ_CONTENT_TYPE (HTTPClient_HFIELD_RES_CONTENT_TYPE | HTTPClient_REQUEST_HEADER_MASK) 151 #define HTTPClient_HFIELD_REQ_COOKIE (31 | HTTPClient_REQUEST_HEADER_MASK) 153 #define HTTPClient_HFIELD_REQ_DATE (HTTPClient_HFIELD_RES_DATE | HTTPClient_REQUEST_HEADER_MASK) 155 #define HTTPClient_HFIELD_REQ_EXPECT (32 | HTTPClient_REQUEST_HEADER_MASK) 157 #define HTTPClient_HFIELD_REQ_FORWARDED (33 | HTTPClient_REQUEST_HEADER_MASK) 159 #define HTTPClient_HFIELD_REQ_FROM (34 | HTTPClient_REQUEST_HEADER_MASK) 161 #define HTTPClient_HFIELD_REQ_HOST (35 | HTTPClient_REQUEST_HEADER_MASK) 163 #define HTTPClient_HFIELD_REQ_IF_MATCH (36 | HTTPClient_REQUEST_HEADER_MASK) 165 #define HTTPClient_HFIELD_REQ_IF_MODIFIED_SINCE (37 | HTTPClient_REQUEST_HEADER_MASK) 167 #define HTTPClient_HFIELD_REQ_IF_NONE_MATCH (38 | HTTPClient_REQUEST_HEADER_MASK) 169 #define HTTPClient_HFIELD_REQ_IF_RANGE (39 | HTTPClient_REQUEST_HEADER_MASK) 171 #define HTTPClient_HFIELD_REQ_IF_UNMODIFIED_SINCE (40 | HTTPClient_REQUEST_HEADER_MASK) 173 #define HTTPClient_HFIELD_REQ_ORIGIN (41 | HTTPClient_REQUEST_HEADER_MASK) 175 #define HTTPClient_HFIELD_REQ_PROXY_AUTHORIZATION (42 | HTTPClient_REQUEST_HEADER_MASK) 177 #define HTTPClient_HFIELD_REQ_RANGE (43 | HTTPClient_REQUEST_HEADER_MASK) 179 #define HTTPClient_HFIELD_REQ_TE (44 | HTTPClient_REQUEST_HEADER_MASK) 181 #define HTTPClient_HFIELD_REQ_TRANSFER_ENCODING (HTTPClient_HFIELD_RES_TRANSFER_ENCODING | HTTPClient_REQUEST_HEADER_MASK) 183 #define HTTPClient_HFIELD_REQ_UPGRADE (HTTPClient_HFIELD_RES_UPGRADE | HTTPClient_REQUEST_HEADER_MASK) 185 #define HTTPClient_HFIELD_REQ_USER_AGENT (45 | HTTPClient_REQUEST_HEADER_MASK) 187 #define HTTPClient_HFIELD_REQ_VIA (HTTPClient_HFIELD_RES_VIA | HTTPClient_REQUEST_HEADER_MASK) 189 #define HTTPClient_HFIELD_REQ_WARNING (HTTPClient_HFIELD_RES_WARNING | HTTPClient_REQUEST_HEADER_MASK) 191 #define HTTPClient_MAX_NUMBER_OF_HEADER_FIELDS (46) 195 #define HTTPClient_REDIRECT_FEATURE (48) 198 #define HTTPClient_RESPONSE_FILTER_CLEAR (49) 201 #define HTTPClient_REDIRECT_TLS_DOWNGRADE (50) 207 #define HTTPClient_AUTHENTICATE_SERVER_CALLBACK (51) 216 #define HTTPClient_ESENDBUFSMALL (-3001) 221 #define HTTPClient_EGETOPTBUFSMALL (-3002) 226 #define HTTPClient_ERESPONSEINVALID (-3003) 231 #define HTTPClient_EINPROGRESS (-3004) 240 #define HTTPClient_EDOMAINBUFSMALL (-3005) 247 #define HTTPClient_ECBALLOCATIONFAILED (-3006) 256 #define HTTPClient_EBODYBUFSMALL (-3008) 263 #define HTTPClient_ENULLPOINTER (-3009) 268 #define HTTPClient_EREQUESTHEADERALLOCFAILED (-3010) 273 #define HTTPClient_EREQHEADERNOTFOUND (-3011) 280 #define HTTPClient_EHOSTNOTFOUND (-3012) 285 #define HTTPClient_ECLIENTALREADYCONNECTED (-3013) 290 #define HTTPClient_ERESPONSEISNOTREDIRECTABLE (-3014) 295 #define HTTPClient_ESENDERROR (-3015) 306 #define HTTPClient_EREDIRECTLOCATIONFAIL (-3016) 315 #define HTTPClient_ETLSDOWNGRADEISFORBIDDEN (-3017) 322 #define HTTPClient_EWRONGAPIPARAMETER (-3018) 331 #define HTTPClient_EHOSTHEADERALREADYEXIST (-3019) 338 #define HTTPClient_ENOCONNECTION (-3020) 346 #define HTTPClient_ENOTABSOLUTEURI (-3021) 353 #define HTTPClient_ECANTCREATESECATTRIB (-3022) 360 #define HTTPClient_EINTERNAL (-3023) 365 #define HTTPClient_EGETCUSOMHEADERBUFSMALL (-3024) 370 #define HTTPClient_ENOHEADERNAMEDASINSERTED (-3025) 374 #define HTTPClient_IGNORE_PROXY (0x01) 377 #define HTTPClient_HOST_EXIST (0x02) 381 #define HTTPClient_HFIELD_NOT_PERSISTENT (0x01) 384 #define HTTPClient_HFIELD_PERSISTENT (0x02) 388 #define HTTPClient_CUSTOM_RESPONSE_HEADER (0x01) 395 #define HTTPClient_CHUNK_START (0x01) 398 #define HTTPClient_CHUNK_END (0x02) 401 #define HTTPClient_DROP_BODY (0x04) 562 int16_t
HTTPClient_sendRequest(HTTPClient_Handle client,
const char *method,
const char *requestURI,
const char *body, uint32_t bodyLen, uint32_t flags);
611 int16_t
HTTPClient_setHeader(HTTPClient_Handle client, uint32_t option,
void *value, uint32_t len, uint32_t flags);
651 int16_t
HTTPClient_setHeaderByName(HTTPClient_Handle client, uint32_t option,
const char *name,
void *value, uint32_t len, uint32_t flags);
672 int16_t
HTTPClient_getHeader(HTTPClient_Handle client, uint32_t option,
void *value, uint32_t *len, uint32_t flags);
698 int16_t
HTTPClient_getHeaderByName(HTTPClient_Handle client, uint32_t option,
const char* name,
void *value, uint32_t *len ,uint32_t flags);
720 int16_t
HTTPClient_setOpt(HTTPClient_Handle client, uint32_t option,
void *value, uint32_t len, uint32_t flags);
741 int16_t
HTTPClient_getOpt(HTTPClient_Handle client, uint32_t option,
void *value, uint32_t *len ,uint32_t flags);
int16_t HTTPClient_connect2(HTTPClient_Handle client, const char *hostName, SlNetSockSecAttrib_t *secAttribs, uint32_t flags, int16_t *secureRetVal)
Open a connection to an HTTP server. A user can connect to a HTTP server using TLS, proxy or both. HTTPClient_connect2 allows the user more control over security by accepting a secure attribute object and returning the value of the attempted secure connection.
const char * HTTP_METHOD_HEAD
const char * HTTP_METHOD_GET
int16_t HTTPClient_connect(HTTPClient_Handle client, const char *hostName, HTTPClient_extSecParams *exSecParams, uint32_t flags)
Open a connection to an HTTP server. A user can connect to a HTTP server using TLS, proxy or both.
int16_t HTTPClient_destroy(HTTPClient_Handle client)
Destroy the HTTP client instance and free the previously allocated instance object.
struct HTTPClient_extSecParams HTTPClient_extSecParams
int16_t HTTPClient_getOpt(HTTPClient_Handle client, uint32_t option, void *value, uint32_t *len, uint32_t flags)
Getting HTTP Client configurations.
int16_t HTTPClient_disconnect(HTTPClient_Handle client)
Disconnect from the HTTP server.
const char * HTTP_METHOD_OPTIONS
IpV4 socket address.
Definition: slnetsock.h:652
int16_t HTTPClient_sendRequest(HTTPClient_Handle client, const char *method, const char *requestURI, const char *body, uint32_t bodyLen, uint32_t flags)
Make an HTTP request to the HTTP server.
int16_t HTTPClient_setOpt(HTTPClient_Handle client, uint32_t option, void *value, uint32_t len, uint32_t flags)
Setting HTTP Client configurations.
const char * clientCert
Definition: httpclient.h:417
const char * HTTP_METHOD_CONNECT
const char * HTTP_METHOD_DELETE
int16_t HTTPClient_getHeader(HTTPClient_Handle client, uint32_t option, void *value, uint32_t *len, uint32_t flags)
Getting HTTP Client Header-field configurations.
int16_t HTTPClient_getHeaderByName(HTTPClient_Handle client, uint32_t option, const char *name, void *value, uint32_t *len, uint32_t flags)
Getting HTTP Client Header-field configurations. This API doesn't support removing existing custom he...
void HTTPClient_setProxy(const SlNetSock_Addr_t *addr)
Uses the http CONNECT method to create a tunnel through a remote proxy server to the host designated ...
int16_t HTTPClient_setHeaderByName(HTTPClient_Handle client, uint32_t option, const char *name, void *value, uint32_t len, uint32_t flags)
Setting HTTP Client Header-field configurations by header name. Both standard (as defined by the HTTP...
void * HTTPClient_Handle
Definition: httpclient.h:441
int16_t HTTPClient_setHeader(HTTPClient_Handle client, uint32_t option, void *value, uint32_t len, uint32_t flags)
Setting HTTP Client Header-field configurations.
HTTPClient_Handle HTTPClient_create(int16_t *status, void *params)
Allocate and initialize a new HTTPClient instance object and return its handle.
int16_t HTTPClient_readResponseBody(HTTPClient_Handle client, char *body, uint32_t bodyLen, bool *moreDataFlag)
Read the response body data from the HTTP server The function handles both oneshot and chunked body r...
Secure socket attribute context.
Definition: slnetsock.h:569
const char * privateKey
Definition: httpclient.h:416
const char * rootCa
Definition: httpclient.h:418
const char * HTTP_METHOD_PUT
const char * HTTP_METHOD_POST
Definition: httpclient.h:414
int16_t(* HTTPClient_authenticationCallback)(const char *serverAuthBuff, uint32_t serverAuthLen, char *clientAuthBuff, uint32_t *clientAuthLen)
HTTPClient callback for server authentication handling This function is responsible for generating th...
Definition: httpclient.h:439