NIM PC Cross Platform SDK
|
NIM HTTP提供的http传输相关接口 More...
#include <cstdint>
#include <iostream>
#include "nim_tools_http_def.h"
#include "nim_tools_http_export.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, std::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, std::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) |
NIM_TOOLS_HTTP_EXPORT const char *const | nim_http_get_response_head (HttpRequestID http_request_id) |
NIM HTTP提供的http传输相关接口
void nim_http_add_request_header | ( | HttpRequestHandle | request_handle, |
const char * | key, | ||
const char * | value | ||
) |
NIM HTTP 创建任务
[in] | request_handle | http任务句柄 |
[in] | key | 头的key |
[in] | value | 头的value |
const char *const nim_http_get_response_head | ( | HttpRequestID | http_request_id | ) |
NIM HTTP 读取应答的http头信息
[in] | http_request_id | 任务id |
void nim_http_init | ( | ) |
NIM HTTP 初始化
void nim_http_init_log | ( | const char * | log_file_path | ) |
NIM HTTP 设置日志文件路径
[in] | log_file_path | 日志文件保存路径 |
bool nim_http_is_init_log | ( | ) |
NIM HTTP 是否设置过日志路径
HttpRequestID nim_http_post_request | ( | HttpRequestHandle | request_handle | ) |
NIM HTTP 发起任务
[in] | request_handle | http任务句柄 |
void nim_http_remove_request | ( | HttpRequestID | http_request_id | ) |
NIM HTTP 取消任务
[in] | http_request_id | 任务id |
void nim_http_set_low_speed | ( | HttpRequestHandle | request_handle, |
int | low_speed_limit, | ||
int | low_speed_time | ||
) |
NIM HTTP 设置最低传输速度
[in] | request_handle | http任务句柄 |
[in] | low_speed_limit | 最低传输的字节数(大于0) |
[in] | low_speed_time | 多少秒传输速度不得低于low_speed_limit,不满足条件则会终止传输(大于0) |
void nim_http_set_proxy | ( | HttpRequestHandle | request_handle, |
int | type, | ||
const char * | host, | ||
short | port, | ||
const char * | user, | ||
const char * | pass | ||
) |
NIM HTTP 设置代理
[in] | request_handle | http任务句柄 |
[in] | type | 代理类型 NIMHttpProxyType |
[in] | host | 代理地址 |
[in] | port | 代理端口 |
[in] | user | 代理账号 |
[in] | pass | 代理密码 |
void nim_http_set_request_method_as_post | ( | HttpRequestHandle | request_handle | ) |
NIM HTTP 强制设置http请求方法为post
[in] | request_handle | http任务句柄 |
void nim_http_set_request_progress_cb | ( | HttpRequestHandle | request_handle, |
nim_http_request_progress_cb | progress_callback, | ||
const void * | user_data | ||
) |
NIM HTTP 设置进度回调
[in] | request_handle | http任务句柄 |
[in] | progress_callback | 进度回调函数 |
[in] | user_data | 自定义数据 |
void nim_http_set_request_speed_cb | ( | HttpRequestHandle | request_handle, |
nim_http_request_speed_cb | speed_callback, | ||
const void * | user_data | ||
) |
NIM HTTP 设置实时速度回调
[in] | request_handle | http任务句柄 |
[in] | speed_callback | 速度回调函数 |
[in] | user_data | 自定义数据 |
void nim_http_set_request_transfer_cb | ( | HttpRequestHandle | request_handle, |
nim_http_request_transfer_cb | transfer_callback, | ||
const void * | user_data | ||
) |
NIM HTTP 设置传输信息回调
[in] | request_handle | http任务句柄 |
[in] | transfer_callback | 结束回调,获取实际传输信息 |
[in] | user_data | 自定义数据 |
void nim_http_set_timeout | ( | HttpRequestHandle | request_handle, |
int | timeout_ms | ||
) |
NIM HTTP 设置超时
[in] | request_handle | http任务句柄 |
[in] | timeout_ms | 超时时间,单位是毫秒 |
void nim_http_uninit | ( | ) |
NIM HTTP 反初始化