TuyaOS
结构体 | 宏定义 | 类型定义 | 枚举 | 函数
http_manager.h 文件参考

wrapper for HTTP session manager 更多...

#include "tuya_cloud_types.h"
#include "httpc.h"
#include "tal_mutex.h"
http_manager.h 的引用(Include)关系图:

浏览源代码.

结构体

struct  S_HTTP_MANAGER
 The HTTP session manager structure. 更多...
 

宏定义

#define INVALID_HTTP_SESSION_ID   0xFFFFffff
 
#define MAX_HTTP_SESSION_NUM   16
 
#define MAX_HTTP_URL_LEN   256
 

类型定义

typedef SESSION_ID(* FUNC_HTTP_SESSION_CREATE) (IN CONST CHAR_T *url, BOOL_T is_persistent)
 This API is used to create HTTP session 更多...
 
typedef SESSION_ID(* FUNC_HTTP_SESSION_CREATE_TLS) (IN CONST CHAR_T *url, BOOL_T is_persistent, tuya_tls_config_t *config)
 This API is used to create HTTP session 更多...
 
typedef OPERATE_RET(* FUNC_HTTP_SESSION_DESTORY) (SESSION_ID session)
 This API is used to destroy HTTP session 更多...
 
typedef OPERATE_RET(* FUNC_HTTP_SESSION_RECEIVE) (SESSION_ID session, http_resp_t **resp)
 This API is used to recv response header from HTTP session 更多...
 
typedef OPERATE_RET(* FUNC_HTTP_SESSION_RECEIVE_DATA) (SESSION_ID session, http_resp_t *pResp, BYTE_T **pDataOut)
 This API is used to recv response content from HTTP session. 更多...
 
typedef OPERATE_RET(* FUNC_HTTP_SESSION_SEND) (IN CONST SESSION_ID session, IN CONST http_req_t *req, http_hdr_field_sel_t field_flags)
 This API is used to send HTTP session request 更多...
 
typedef S_HTTP_SESSIONSESSION_ID
 

枚举

enum  E_HTTP_SESSION_STATE {
  HTTP_FREE = 0 , HTTP_DISCONNECT , HTTP_CONNECTING , HTTP_CONNECTED ,
  HTTP_UPLOADING
}
 Definition of HTTP session state
 

函数

S_HTTP_MANAGERget_http_manager_instance (VOID_T)
 Retrieve instance of HTTP session manager 更多...
 

详细描述

wrapper for HTTP session manager

版本
0.1
日期
2016-01-11

类型定义说明

◆ FUNC_HTTP_SESSION_CREATE

typedef SESSION_ID(* FUNC_HTTP_SESSION_CREATE) (IN CONST CHAR_T *url, BOOL_T is_persistent)

This API is used to create HTTP session

参数
[in]urlURL of HTTP session, max len of URL is 256
[in]is_persistentSession is persistent or not
返回
SESSION_ID on success, NULL on error

◆ FUNC_HTTP_SESSION_CREATE_TLS

typedef SESSION_ID(* FUNC_HTTP_SESSION_CREATE_TLS) (IN CONST CHAR_T *url, BOOL_T is_persistent, tuya_tls_config_t *config)

This API is used to create HTTP session

参数
[in]urlURL of HTTP session, max len of URL is 256
[in]is_persistentSession is persistent or not
返回
SESSION_ID on success, NULL on error

◆ FUNC_HTTP_SESSION_DESTORY

typedef OPERATE_RET(* FUNC_HTTP_SESSION_DESTORY) (SESSION_ID session)

This API is used to destroy HTTP session

参数
[in]sessionSession returned from the call to FUNC_HTTP_SESSION_CREATE
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ FUNC_HTTP_SESSION_RECEIVE

typedef OPERATE_RET(* FUNC_HTTP_SESSION_RECEIVE) (SESSION_ID session, http_resp_t **resp)

This API is used to recv response header from HTTP session

参数
[in]sessionSession returned from the call to FUNC_HTTP_SESSION_CREATE
[in,out]respPointer to a pointer of type http_resp_t .The structure will be allocated by the callee. Note that the caller does not need to free the structure allocated and returned from this API. The allocation and free is done by the callee automatically
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ FUNC_HTTP_SESSION_RECEIVE_DATA

typedef OPERATE_RET(* FUNC_HTTP_SESSION_RECEIVE_DATA) (SESSION_ID session, http_resp_t *pResp, BYTE_T **pDataOut)

This API is used to recv response content from HTTP session.

参数
[in]sessionSession returned from the call to FUNC_HTTP_SESSION_CREATE
[in]pRespThe http_resp_t structure returned from the call to FUNC_HTTP_SESSION_RECEIVE
[in,out]pDataOutCaller allocated buffer
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

◆ FUNC_HTTP_SESSION_SEND

typedef OPERATE_RET(* FUNC_HTTP_SESSION_SEND) (IN CONST SESSION_ID session, IN CONST http_req_t *req, http_hdr_field_sel_t field_flags)

This API is used to send HTTP session request

参数
[in]sessionSession returned from the call to FUNC_HTTP_SESSION_CREATE
[in]reqThe http_req_t structure filled up with appropriate parameters
[in]field_flagsThe http_hdr_field_sel_t, OR of zero or more flags
返回
OPRT_OK on success. Others on error, please refer to tuya_error_code.h

函数说明

◆ get_http_manager_instance()

S_HTTP_MANAGER * get_http_manager_instance ( VOID_T  )

Retrieve instance of HTTP session manager

注解
HTTP manager is singleton, multiple call to this API will return the same instance
返回
NULL on error. Instance on success, please refer to S_HTTP_MANAGER