NIM PC Cross Platform SDK
nim_tools_http.h
Go to the documentation of this file.
1
8#ifndef NIM_TOOLS_HTTP_H
9#define NIM_TOOLS_HTTP_H
10
11#include <cstdint>
12#include <iostream>
13#include "nim_tools_http_def.h"
15// #include "public_defines.h"
16
17#ifdef __cplusplus
18extern "C" {
19#endif
20
25NIM_TOOLS_HTTP_EXPORT void nim_http_init();
26
31NIM_TOOLS_HTTP_EXPORT void nim_http_uninit();
32
38NIM_TOOLS_HTTP_EXPORT void nim_http_init_log(const char* log_file_path);
39
44NIM_TOOLS_HTTP_EXPORT bool nim_http_is_init_log();
45
51NIM_TOOLS_HTTP_EXPORT HttpRequestID nim_http_post_request(HttpRequestHandle request_handle);
52
58NIM_TOOLS_HTTP_EXPORT void nim_http_remove_request(HttpRequestID http_request_id);
59
68NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_download_file_request(const char* url,
69 const char* download_file_path,
71 const void* user_data);
72
82NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_download_file_range_request(const char* url,
83 const char* download_file_path,
84 int64_t range_start,
86 const void* user_data);
87
97NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_request(const char* url,
98 const char* post_body,
99 std::size_t post_body_size,
101 const void* user_data);
102
112NIM_TOOLS_HTTP_EXPORT HttpRequestHandle nim_http_create_request_ex(const char* url,
113 const char* post_body,
114 std::size_t post_body_size,
116 const void* user_data);
117
125NIM_TOOLS_HTTP_EXPORT void nim_http_add_request_header(HttpRequestHandle request_handle, const char* key, const char* value);
126
134NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_progress_cb(HttpRequestHandle request_handle,
135 nim_http_request_progress_cb progress_callback,
136 const void* user_data);
137
145NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_speed_cb(HttpRequestHandle request_handle,
146 nim_http_request_speed_cb speed_callback,
147 const void* user_data);
148
156NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_transfer_cb(HttpRequestHandle request_handle,
157 nim_http_request_transfer_cb transfer_callback,
158 const void* user_data);
159
165NIM_TOOLS_HTTP_EXPORT void nim_http_set_request_method_as_post(HttpRequestHandle request_handle);
166
173NIM_TOOLS_HTTP_EXPORT void nim_http_set_timeout(HttpRequestHandle request_handle, int timeout_ms);
174
182NIM_TOOLS_HTTP_EXPORT void nim_http_set_low_speed(HttpRequestHandle request_handle, int low_speed_limit, int low_speed_time);
183
194NIM_TOOLS_HTTP_EXPORT void nim_http_set_proxy(HttpRequestHandle request_handle,
195 int type,
196 const char* host,
197 short port,
198 const char* user,
199 const char* pass);
200
206NIM_TOOLS_HTTP_EXPORT const char* const nim_http_get_response_head(HttpRequestID http_request_id);
207
208#ifdef __cplusplus
209};
210#endif //__cplusplus
211
212#endif // NIM_TOOLS_HTTP_H
NIM_TOOLS_HTTP_EXPORT void nim_http_init()
NIM_TOOLS_HTTP_EXPORT void nim_http_set_timeout(HttpRequestHandle request_handle, int timeout_ms)
NIM_TOOLS_HTTP_EXPORT const char *const nim_http_get_response_head(HttpRequestID http_request_id)
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_remove_request(HttpRequestID http_request_id)
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 void nim_http_set_request_method_as_post(HttpRequestHandle request_handle)
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 void nim_http_uninit()
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 HttpRequestID nim_http_post_request(HttpRequestHandle request_handle)
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 HTTP提供的http传输相关接口的定义
void * HttpRequestHandle
Definition: nim_tools_http_def.h:27
void(* nim_http_request_speed_cb)(const void *user_data, double upload_speed, double download_speed)
Definition: nim_tools_http_def.h:105
void(* nim_http_request_completed_cb)(const void *user_data, bool result, int response_code)
Definition: nim_tools_http_def.h:41
unsigned int HttpRequestID
Definition: nim_tools_http_def.h:32
void(* nim_http_request_transfer_cb)(const void *user_data, double actual_upload_size, double upload_speed, double actual_download_size, double download_speed)
Definition: nim_tools_http_def.h:92
void(* nim_http_request_progress_cb)(const void *user_data, double total_upload_size, double uploaded_size, double total_download_size, double downloaded_size)
Definition: nim_tools_http_def.h:77
void(* nim_http_request_response_ex_cb)(const void *user_data, bool result, int response_code, const char *response_content, const char *response_header)
Definition: nim_tools_http_def.h:62
void(* nim_http_request_response_cb)(const void *user_data, bool result, int response_code, const char *response_content)
Definition: nim_tools_http_def.h:51
NIM HTTP TOOLS 导出头文件预定义宏