NIM 跨平台 C++ SDK
|
NIM提供的HTTP工具 更多...
类 | |
struct | CompletedCallbackUserData |
class | HttpRequest |
NIM HTTP提供的http传输相关接口 更多... | |
struct | ResponseCallbackUserData |
类型定义 | |
typedef void(* | typeof_nim_http_init) () |
typedef void(* | typeof_nim_http_uninit) () |
typedef void(* | typeof_nim_http_init_log) (const char *log_file_path) |
typedef bool(* | typeof_nim_http_is_init_log) () |
typedef HttpRequestHandle(* | typeof_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) |
typedef HttpRequestHandle(* | typeof_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) |
typedef HttpRequestHandle(* | typeof_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) |
typedef HttpRequestHandle(* | typeof_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) |
typedef void(* | typeof_nim_http_add_request_header) (HttpRequestHandle request_handle, const char *key, const char *value) |
typedef void(* | typeof_nim_http_set_request_progress_cb) (HttpRequestHandle request_handle, nim_http_request_progress_cb progress_callback, const void *user_data) |
typedef void(* | typeof_nim_http_set_request_speed_cb) (HttpRequestHandle request_handle, nim_http_request_speed_cb speed_callback, const void *user_data) |
typedef void(* | typeof_nim_http_set_request_transfer_cb) (HttpRequestHandle request_handle, nim_http_request_transfer_cb transfer_callback, const void *user_data) |
typedef void(* | typeof_nim_http_set_request_method_as_post) (HttpRequestHandle request_handle) |
typedef void(* | typeof_nim_http_set_timeout) (HttpRequestHandle request_handle, int timeout_ms) |
typedef void(* | typeof_nim_http_set_low_speed) (HttpRequestHandle request_handle, int low_speed_limit, int low_speed_time) |
typedef void(* | typeof_nim_http_set_proxy) (HttpRequestHandle request_handle, int type, const char *host, short port, const char *user, const char *pass) |
typedef HttpRequestID(* | typeof_nim_http_post_request) (HttpRequestHandle) |
typedef void(* | typeof_nim_http_remove_request) (HttpRequestID http_request_id) |
typedef const char *const(* | typeof_nim_http_get_response_head) (HttpRequestID http_request_id) |
typedef std::function< void(bool, int)> | CompletedCallback |
typedef std::function< void(bool, int, const std::string &)> | ResponseCallback |
typedef std::function< void(bool, int, const std::string &, const std::string &)> | ResponseCallbackEx |
typedef std::function< void(double, double, double, double)> | ProgressCallback |
typedef std::function< void(double, double)> | SpeedCallback |
typedef std::function< void(double, double, double, double)> | TransferCallback |
函数 | |
bool | Init (const std::string &library_path) |
void | Uninit () |
void | InitLog (const std::string &log_file_path) |
bool | IsInitLog () |
void | SetGlobalProxy (nim::NIMProxyType type, const std::string &host, short port, const std::string &user, const std::string &pass) |
HttpRequestID | PostRequest (const HttpRequest &http_request) |
void | RemoveRequest (HttpRequestID http_request_id) |
std::string | GetResponseHead (HttpRequestID http_request_id) |
NIM提供的HTTP工具
typedef std::function<void(bool, int)> nim_http::CompletedCallback |
请求完成回调
[out] | 传输结果,true代表传输成功,false代表传输失败 | |
[out] | http响应码 |
typedef std::function<void(double, double, double, double)> nim_http::ProgressCallback |
请求过程回调
[out] | 总的待上传字节数 | |
[out] | 当前上传字节数 | |
[out] | 总的待下载字节数 | |
[out] | 当前下载字节数 |
typedef std::function<void(bool, int, const std::string&)> nim_http::ResponseCallback |
请求响应回调
[out] | 传输结果,true代表传输成功,false代表传输失败 | |
[out] | http响应码 | |
[out] | http响应实体内容 |
typedef std::function<void(bool, int, const std::string&, const std::string&)> nim_http::ResponseCallbackEx |
请求响应回调
[out] | 传输结果,true代表传输成功,false代表传输失败 | |
[out] | http响应码 | |
[out] | http响应实体内容 | |
[out] | http响应Head内容 |
typedef std::function<void(double, double)> nim_http::SpeedCallback |
请求速度回报回调
[out] | 实时上传速度(字节每秒) | |
[out] | 实时下载速度(字节每秒) |
typedef std::function<void(double, double, double, double)> nim_http::TransferCallback |
请求汇报回调
[out] | 实际上传字节数 | |
[out] | 平均上传速度(字节每秒) | |
[out] | 实际下载字节数 | |
[out] | 平均下载速度(字节每秒) |
typedef void(* nim_http::typeof_nim_http_add_request_header) (HttpRequestHandle request_handle, const char *key, const char *value) |
typedef HttpRequestHandle(* nim_http::typeof_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) |
typedef HttpRequestHandle(* nim_http::typeof_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) |
typedef HttpRequestHandle(* nim_http::typeof_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) |
typedef HttpRequestHandle(* nim_http::typeof_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) |
typedef const char *const (* nim_http::typeof_nim_http_get_response_head) (HttpRequestID http_request_id) |
typedef void(* nim_http::typeof_nim_http_init) () |
typedef void(* nim_http::typeof_nim_http_init_log) (const char *log_file_path) |
typedef bool(* nim_http::typeof_nim_http_is_init_log) () |
typedef HttpRequestID(* nim_http::typeof_nim_http_post_request) (HttpRequestHandle) |
typedef void(* nim_http::typeof_nim_http_remove_request) (HttpRequestID http_request_id) |
typedef void(* nim_http::typeof_nim_http_set_low_speed) (HttpRequestHandle request_handle, int low_speed_limit, int low_speed_time) |
typedef void( * nim_http::typeof_nim_http_set_proxy) (HttpRequestHandle request_handle, int type, const char *host, short port, const char *user, const char *pass) |
typedef void(* nim_http::typeof_nim_http_set_request_method_as_post) (HttpRequestHandle request_handle) |
typedef void(* nim_http::typeof_nim_http_set_request_progress_cb) (HttpRequestHandle request_handle, nim_http_request_progress_cb progress_callback, const void *user_data) |
typedef void( * nim_http::typeof_nim_http_set_request_speed_cb) (HttpRequestHandle request_handle, nim_http_request_speed_cb speed_callback, const void *user_data) |
typedef void(* nim_http::typeof_nim_http_set_request_transfer_cb) (HttpRequestHandle request_handle, nim_http_request_transfer_cb transfer_callback, const void *user_data) |
typedef void(* nim_http::typeof_nim_http_set_timeout) (HttpRequestHandle request_handle, int timeout_ms) |
typedef void(* nim_http::typeof_nim_http_uninit) () |
std::string nim_http::GetResponseHead | ( | HttpRequestID | http_request_id | ) |
NIM HTTP 读取应答的http头信息,在任务完成的回调中调用,当回调完成后应答可能被释放,此时无法读取信息
[in] | http_request_id | 任务id |
bool nim_http::Init | ( | const std::string & | library_path | ) |
void nim_http::InitLog | ( | const std::string & | log_file_path | ) |
NIM HTTP 设置日志文件路径
[in] | log_file_path | 日志文件保存路径 |
bool nim_http::IsInitLog | ( | ) |
NIM HTTP 是否设置过日志路径
HttpRequestID nim_http::PostRequest | ( | const HttpRequest & | http_request | ) |
NIM HTTP 发起任务
[in] | http_request | http任务句柄 |
void nim_http::RemoveRequest | ( | HttpRequestID | http_request_id | ) |
NIM HTTP 取消任务
[in] | http_request_id | 任务id |
void nim_http::SetGlobalProxy | ( | nim::NIMProxyType | type, |
const std::string & | host, | ||
short | port, | ||
const std::string & | user, | ||
const std::string & | pass | ||
) |
void nim_http::Uninit | ( | ) |
NIM HTTP 反初始化
typeof_nim_http_add_request_header nim_http::g_nim_http_add_request_header = nullptr |
typeof_nim_http_create_download_file_range_request nim_http::g_nim_http_create_download_file_range_request = nullptr |
typeof_nim_http_create_download_file_request nim_http::g_nim_http_create_download_file_request = nullptr |
typeof_nim_http_create_request nim_http::g_nim_http_create_request = nullptr |
typeof_nim_http_create_request_ex nim_http::g_nim_http_create_request_ex = nullptr |
typeof_nim_http_get_response_head nim_http::g_nim_http_get_response_head = nullptr |
typeof_nim_http_init nim_http::g_nim_http_init = nullptr |
typeof_nim_http_init_log nim_http::g_nim_http_init_log = nullptr |
typeof_nim_http_is_init_log nim_http::g_nim_http_is_init_log = nullptr |
typeof_nim_http_post_request nim_http::g_nim_http_post_request = nullptr |
typeof_nim_http_remove_request nim_http::g_nim_http_remove_request = nullptr |
typeof_nim_http_set_low_speed nim_http::g_nim_http_set_low_speed = nullptr |
typeof_nim_http_set_proxy nim_http::g_nim_http_set_proxy = nullptr |
typeof_nim_http_set_request_method_as_post nim_http::g_nim_http_set_request_method_as_post = nullptr |
typeof_nim_http_set_request_progress_cb nim_http::g_nim_http_set_request_progress_cb = nullptr |
typeof_nim_http_set_request_speed_cb nim_http::g_nim_http_set_request_speed_cb = nullptr |
typeof_nim_http_set_request_transfer_cb nim_http::g_nim_http_set_request_transfer_cb = nullptr |
typeof_nim_http_set_timeout nim_http::g_nim_http_set_timeout = nullptr |
typeof_nim_http_uninit nim_http::g_nim_http_uninit = nullptr |
std::string nim_http::proxy_host_ |
std::string nim_http::proxy_pass_ |
short nim_http::proxy_port_ = 0 |
nim::NIMProxyType nim_http::proxy_type_ = nim::kNIMProxyNone |
std::string nim_http::proxy_user_ |
nim::SDKInstance* nim_http::sdk_instance_ = nullptr |