NIM SDK API  8.5.1
Functions
nim_tools_http.h File Reference

NIM HTTP提供的http传输相关接口 More...

#include "nim_tools_http_def.h"
#include "nim_tools_http_export.h"
#include "public_defines.h"

Go to the source code of this file.

Functions

NIM_TOOLS_HTTP_EXPORT void nim_http_init ()
 
NIM_TOOLS_HTTP_EXPORT void nim_http_uninit ()
 
NIM_TOOLS_HTTP_EXPORT void nim_http_init_log (const char *log_file_path)
 
NIM_TOOLS_HTTP_EXPORT bool nim_http_is_init_log ()
 
NIM_TOOLS_HTTP_EXPORT HttpRequestID nim_http_post_request (HttpRequestHandle request_handle)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_remove_request (HttpRequestID http_request_id)
 
NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_download_file_request (const char *url, const char *download_file_path, nim_http_request_completed_cb complete_cb, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_download_file_range_request (const char *url, const char *download_file_path, int64_t range_start, nim_http_request_completed_cb complete_cb, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_request (const char *url, const char *post_body, size_t post_body_size, nim_http_request_response_cb response_cb, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_request_ex (const char *url, const char *post_body, size_t post_body_size, nim_http_request_response_ex_cb response_cb, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_add_request_header (HttpRequestHandle request_handle, const char *key, const char *value)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_progress_cb (HttpRequestHandle request_handle, nim_http_request_progress_cb progress_callback, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_speed_cb (HttpRequestHandle request_handle, nim_http_request_speed_cb speed_callback, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_transfer_cb (HttpRequestHandle request_handle, nim_http_request_transfer_cb transfer_callback, const void *user_data)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_method_as_post (HttpRequestHandle request_handle)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_timeout (HttpRequestHandle request_handle, int timeout_ms)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_low_speed (HttpRequestHandle request_handle, int low_speed_limit, int low_speed_time)
 
NIM_TOOLS_HTTP_EXPORT void nim_http_set_proxy (HttpRequestHandle request_handle, int type, const char *host, short port, const char *user, const char *pass)
 
const NIM_TOOLS_HTTP_EXPORT char *const nim_http_get_response_head (HttpRequestID http_request_id)
 

Detailed Description

NIM HTTP提供的http传输相关接口

Author
towik
Date
2015/4/30

Function Documentation

◆ nim_http_add_request_header()

void nim_http_add_request_header ( HttpRequestHandle  request_handle,
const char *  key,
const char *  value 
)

NIM HTTP 创建任务

Parameters
[in]request_handlehttp任务句柄
[in]key头的key
[in]value头的value
Returns
void 无返回值

◆ nim_http_get_response_head()

const char *const nim_http_get_response_head ( HttpRequestID  http_request_id)

NIM HTTP 读取应答的http头信息

Parameters
[in]http_request_id任务id
Returns
char* 头信息

◆ nim_http_init()

void nim_http_init ( )

NIM HTTP 初始化

Returns
void 无返回值

◆ nim_http_init_log()

void nim_http_init_log ( const char *  log_file_path)

NIM HTTP 设置日志文件路径

Parameters
[in]log_file_path日志文件保存路径
Returns
void 无返回值

◆ nim_http_is_init_log()

bool nim_http_is_init_log ( )

NIM HTTP 是否设置过日志路径

Returns
bool 是否设置过日志路径

◆ nim_http_post_request()

HttpRequestID nim_http_post_request ( HttpRequestHandle  request_handle)

NIM HTTP 发起任务

Parameters
[in]request_handlehttp任务句柄
Returns
HttpRequestID 任务id

◆ nim_http_remove_request()

void nim_http_remove_request ( HttpRequestID  http_request_id)

NIM HTTP 取消任务

Parameters
[in]http_request_id任务id
Returns
void 无返回值

◆ nim_http_set_low_speed()

void nim_http_set_low_speed ( HttpRequestHandle  request_handle,
int  low_speed_limit,
int  low_speed_time 
)

NIM HTTP 设置最低传输速度

Parameters
[in]request_handlehttp任务句柄
[in]low_speed_limit最低传输的字节数(大于0)
[in]low_speed_time多少秒传输速度不得低于low_speed_limit,不满足条件则会终止传输(大于0)
Returns
void 无返回值

◆ nim_http_set_proxy()

void nim_http_set_proxy ( HttpRequestHandle  request_handle,
int  type,
const char *  host,
short  port,
const char *  user,
const char *  pass 
)

NIM HTTP 设置代理

Parameters
[in]request_handlehttp任务句柄
[in]type代理类型 NIMHttpProxyType
[in]host代理地址
[in]port代理端口
[in]user代理账号
[in]pass代理密码
Returns
void 无返回值

◆ nim_http_set_request_method_as_post()

void nim_http_set_request_method_as_post ( HttpRequestHandle  request_handle)

NIM HTTP 强制设置http请求方法为post

Parameters
[in]request_handlehttp任务句柄
Returns
void 无返回值

◆ nim_http_set_request_progress_cb()

void nim_http_set_request_progress_cb ( HttpRequestHandle  request_handle,
nim_http_request_progress_cb  progress_callback,
const void *  user_data 
)

NIM HTTP 设置进度回调

Parameters
[in]request_handlehttp任务句柄
[in]progress_callback进度回调函数
[in]user_data自定义数据
Returns
void 无返回值

◆ nim_http_set_request_speed_cb()

void nim_http_set_request_speed_cb ( HttpRequestHandle  request_handle,
nim_http_request_speed_cb  speed_callback,
const void *  user_data 
)

NIM HTTP 设置实时速度回调

Parameters
[in]request_handlehttp任务句柄
[in]speed_callback速度回调函数
[in]user_data自定义数据
Returns
void 无返回值

◆ nim_http_set_request_transfer_cb()

void nim_http_set_request_transfer_cb ( HttpRequestHandle  request_handle,
nim_http_request_transfer_cb  transfer_callback,
const void *  user_data 
)

NIM HTTP 设置传输信息回调

Parameters
[in]request_handlehttp任务句柄
[in]transfer_callback结束回调,获取实际传输信息
[in]user_data自定义数据
Returns
void 无返回值

◆ nim_http_set_timeout()

void nim_http_set_timeout ( HttpRequestHandle  request_handle,
int  timeout_ms 
)

NIM HTTP 设置超时

Parameters
[in]request_handlehttp任务句柄
[in]timeout_ms超时时间,单位是毫秒
Returns
void 无返回值

◆ nim_http_uninit()

void nim_http_uninit ( )

NIM HTTP 反初始化

Returns
void 无返回值