NIM PC Cross Platform SDK
载入中...
搜索中...
未找到
nim_client_helper.h
浏览该文件的文档.
1
6#ifndef _NIM_SDK_CPP_CLIENT_HELPER_H_
7#define _NIM_SDK_CPP_CLIENT_HELPER_H_
8
9#include <functional>
10#include <list>
11#include <map>
12#include <string>
14#include "nim_define_include.h"
16
21namespace nim {
22static const uint64_t kDefaultEncryptUnencryptedDBThreshold{512 * 1024};
23class Client;
26 // global_config
29 std::string push_cer_name_;
32 std::string push_token_;
40 bool encrypt_unencrypted_db_{false};
42 uint64_t encrypt_unencrypted_db_threshold_{kDefaultEncryptUnencryptedDBThreshold};
81 bool team_query_tinfo_override_by_local_{true};
83 uint32_t team_sync_tlist_limit_{2000};
87 std::list<NIMMessageType> session_ignore_msg_types_;
90
91 /***********消息“已接收回执”发送配置 begin************/
95 uint32_t caching_markread_time_{0};
97 uint32_t caching_markread_count_{0};
98 /***********消息“已接收回执”发送配置 end************/
99
100 /***********用户数据本地备份与恢复 begin************/
109 /***********用户数据本地备份与恢复 end************/
110
111 /***********IP地址族相关设置 begin************/
114 /***********地址族相关设置 end************/
115
126 // private_server_setting 私有服务器配置(设置方法有两种,一个是配置以下信息,一个是通过配置server_conf_file_path_地址,信息从文件中读取)
130 std::string lbs_address_;
132 std::list<std::string> lbs_backup_address_;
134 std::string nos_lbs_address_;
147
154
160 std::vector<std::string> nos_accelerate_host_list_;
163
164 /***********IP地址族相关设置 begin************/
166 std::string probe_ipv4_url_;
168 std::string probe_ipv6_url_;
169 /***********地址族相关设置 end************/
170
172 std::map<int /*key */, int /*value */> sync_data_type_list_;
174 std::list<std::string> http_dns_server_interface_;
184 std::string sdk_human_version;
185
186 /***********融合存储相关************/
187 std::string mock_refer_;
188 std::string mock_ua_;
193
194 /************** NTP 时间校对 ***************/
196 uint32_t ntp_max_rtt_;
201
203 SDKConfig();
204
205public:
206 void SetCustomClientType(int type);
207 int GetCustomClientType() const;
208
209private:
210 friend class Client;
211};
212
216 std::string app_account_;
220 std::string client_os_;
222 std::string mac_address_;
224 std::string device_id_;
226 int64_t login_time_;
228 std::string custom_data_;
233 : login_time_(0)
234 , custom_client_type_(0) {}
235};
236
246 std::list<OtherClientPres> other_clients_;
251 : relogin_(false)
252 , retrying_(true) {}
253};
254
265};
266
272 std::list<OtherClientPres> other_clients_;
273};
274
280 std::list<std::string> device_ids_;
281};
282
289bool NIM_SDK_CPPWRAPPER_DLL_API ParseOtherClientsPres(const nim_cpp_wrapper_util::Json::Value array_objs, std::list<OtherClientPres>& outs);
290
294 std::string custom_data_;
298 std::string login_ex_;
300 : auth_type_(kNIMAuthTypeDefault) {}
301};
302
303} // namespace nim
304
305#endif //_NIM_SDK_CPP_CLIENT_HELPER_H_
NIMMultiSpotNotifyType
Definition: nim_client_def.h:157
NIMDatabaseCipherVersion
Definition: nim_client_def.h:165
NIMSDKType
Definition: nim_client_def.h:133
NIMLoginStep
Definition: nim_client_def.h:145
NIMClientType
Definition: nim_client_def.h:113
NIMKickReason
Definition: nim_client_def.h:103
NIMAuthType
Definition: nim_client_def.h:81
@ kNIMAuthTypeDefault
默认登录方式
Definition: nim_client_def.h:83
NIM 公共数据类型定义总的包含文件
NIMSDKLogLevel
Definition: nim_global_def.h:52
NIMResCode
Definition: public_defines.h:21
#define true
Definition: stdbool.h:30
#define false
Definition: stdbool.h:33
定义导出宏
#define NIM_SDK_CPPWRAPPER_DLL_API
Definition: nim_sdk_cpp_wrapper.h:38
JSON辅助方法
namespace nim
bool ParseOtherClientsPres(const nim_cpp_wrapper_util::Json::Value array_objs, std::list< OtherClientPres > &outs)
Definition: nim_client_helper.cpp:67
static const uint64_t kDefaultEncryptUnencryptedDBThreshold
Definition: nim_client_helper.h:22
全局管理功能;主要包括SDK初始化/清理、客户端登录/退出等功能
Definition: nim_cpp_client.h:28
SDK初始化参数
Definition: nim_client_helper.h:25
std::string nos_lbs_address_
string nos lbs地址,如果选择使用私有服务器,则必填
Definition: nim_client_helper.h:134
int fcs_auth_type_
融合云存储认证方式 1=refer鉴权,2=基于时间的token鉴权,3=基于url的token鉴权,4=custom鉴权
Definition: nim_client_helper.h:190
std::string rsa_public_key_module_
string RSA public key,如果选择使用私有服务器,则必填 【6.9.0版本后已废弃】
Definition: nim_client_helper.h:144
std::map< int, int > sync_data_type_list_
map 数据同步类型 key(28:置顶会话) value(0:不同步,1:自动同步)
Definition: nim_client_helper.h:172
int login_max_retry_times_
int 登录重试最大次数,默认填0,SDK默认设置次数,如需设置建议设置大于 3 次
Definition: nim_client_helper.h:57
std::string nos_accelerate_address_
string nos 加速地址拼接模板,用于获得加速后的下载地址
Definition: nim_client_helper.h:162
uint32_t ntp_max_rtt_
NTP 最大可信任延迟 ms
Definition: nim_client_helper.h:196
std::string sdk_human_version
sdk可读版本号
Definition: nim_client_helper.h:184
NIMSDKType sdk_type
客户端sdk类型
Definition: nim_client_helper.h:182
std::string default_link_address_ipv6_
string 默认link ipv6服务器地址,如果选择使用私有服务器,ip_protocol_version_ == 1(使用ipv6)则必填
Definition: nim_client_helper.h:138
std::string database_encrypt_key_
string 数据库秘钥
Definition: nim_client_helper.h:34
std::string default_link_address_
string 默认link服务器地址,如果选择使用私有服务器,ip_protocol_version_ != 1(ipv4 or auto)则必填
Definition: nim_client_helper.h:136
bool dedicated_cluste_flag_
bool 是否为专属集群 {true,false} def:false
Definition: nim_client_helper.h:117
bool vchat_miss_unread_count_
bool 语音消息未接通消息是否计入未读数,默认为false
Definition: nim_client_helper.h:65
bool upload_sdk_events_after_login_
bool 在调用 Login 接口后无论成功与否,是否上报历史错误日志到服务器(目前支持 408、415、500),默认为 false
Definition: nim_client_helper.h:69
bool client_antispam_
Definition: nim_client_helper.h:76
std::string mock_ua_
Definition: nim_client_helper.h:188
bool team_msg_ack_
Definition: nim_client_helper.h:79
std::list< NIMMessageType > session_ignore_msg_types_
list<NIMMessageType> 更新会话时忽略某种消息类型,默认为空
Definition: nim_client_helper.h:87
std::string push_token_
Definition: nim_client_helper.h:32
std::string nego_key_neca_key_partb_
string 非对称加密算法key2 RSA:EXP,SM2: SM2Y 自定义时则必填
Definition: nim_client_helper.h:151
bool custom_enable_fcs_
是否开启融合云存储
Definition: nim_client_helper.h:192
bool enable_user_datafile_backup_
bool 是否开启用户数据备份(本地)功能 缺省true
Definition: nim_client_helper.h:102
NIMDatabaseCipherVersion database_cipher_version_
enum 数据库加密版本,默认为 kNIMDatabaseCipherVersion3
Definition: nim_client_helper.h:36
int ip_protocol_version_
int IP地址族设置 0:ipv4 1:ipv6 2:auto,经SDK测试后,自行选择,会有少许性能损耗。缺省 0(ipv4)
Definition: nim_client_helper.h:113
int custom_timeout_
int 自定义通讯超时时间,暂时不开放设置
Definition: nim_client_helper.h:59
NIMSDKLogLevel sdk_log_level_
NIMSDKLogLevel 定义见 NIMSDKLogLevel,SDK 默认的内置级别为 kNIMSDKLogLevelPro
Definition: nim_client_helper.h:53
std::string user_datafile_localbackup_folder_
string 用户数据文件备份(本地)目录,缺省在数据文件所在目录创建一个db_file.back目录
Definition: nim_client_helper.h:108
std::string default_nos_upload_host_
string 默认nos 上传服务器主机地址,仅 kNIMUseHttps设置为true 时有效,用作 https 上传时的域名校验及 http header host 字段填充
Definition: nim_client_helper.h:142
bool disable_app_nap_
string 是否禁用 macOS 下的 App Nap 功能,默认为 true
Definition: nim_client_helper.h:178
uint32_t ntp_max_fetch_times_
最大校对次数
Definition: nim_client_helper.h:200
bool priority_use_cdn_host_
bool 是否优先使用cdn域名
Definition: nim_client_helper.h:176
bool caching_markread_
bool 是否开启缓存式“已接收回执”发送,程序可能收到大量消息以至触发频控时可以考虑开启此开关 缺省 false 关闭
Definition: nim_client_helper.h:93
int custom_client_type_
int, 自定义客户端类型字段,启用该配置时必须 0,否则初始化会报错
Definition: nim_client_helper.h:89
bool enable_user_datafile_defrestoreproc_
bool 是否使用缺省的用户数据恢复(本地)方案 缺省false enable_user_datafile_restore_ == true 生效
Definition: nim_client_helper.h:106
std::string nos_accelerate_host_
string 需要被加速主机名【8.1.0版本以及后不建议使用,推荐nos_accelerate_host_list_】
Definition: nim_client_helper.h:158
std::string preload_image_name_template_
string 预下载图片命名规则,以{filename}为token进行替换
Definition: nim_client_helper.h:51
bool animated_image_thumbnail_enabled_
bool 是否开启对动图缩略图的支持,默认为 false。开启后获取的缩略图为原格式,关闭后获取的缩略图为第一帧静态图
Definition: nim_client_helper.h:71
std::string probe_ipv6_url_
string 探测ipv6地址类型使用的url,ip_protocol_version_ == 2(auto) 时生效
Definition: nim_client_helper.h:168
std::list< std::string > lbs_backup_address_
string list lbs备用地址,没有可不填
Definition: nim_client_helper.h:132
int nego_key_neca_key_version_
int 非对称加密算法的 key version 自定义时则必填
Definition: nim_client_helper.h:153
bool preload_attach_
Definition: nim_client_helper.h:45
uint32_t ntp_ideal_rtt_
IDEAL 时间 ms
Definition: nim_client_helper.h:198
std::string push_cer_name_
Definition: nim_client_helper.h:29
std::vector< std::string > nos_accelerate_host_list_
string array,需要被加速主机名列表
Definition: nim_client_helper.h:160
bool use_private_server_
bool 是否使用私有服务器,如果使用私有服务器,则必须设置为 true
Definition: nim_client_helper.h:128
bool team_notification_unread_count_
bool 群通知是否计入未读数,默认为 false
Definition: nim_client_helper.h:63
int rsa_version_
int RSA version,如果选择使用私有服务器,则必填 【6.9.0版本后已废弃】
Definition: nim_client_helper.h:146
int preload_image_quality_
int 预下载图片的质量,范围 0-100
Definition: nim_client_helper.h:47
bool need_update_lbs_befor_relogin_
bool 在进行重新登录前是否先刷新 LBS,适用于切换网络的场景
Definition: nim_client_helper.h:85
std::string nego_key_neca_key_parta_
string "交换密钥"协议加密算法密钥 part A 自定义时则必填 BigNumHex string 不含0x RSA:module,SM2:X
Definition: nim_client_helper.h:149
bool sync_session_ack_
bool 设置是否在初始化时多端同步已读未读状态,默认true
Definition: nim_client_helper.h:55
std::string probe_ipv4_url_
string 探测ipv4地址类型使用的url,ip_protocol_version_ == 2(auto) 时生效
Definition: nim_client_helper.h:166
std::string preload_image_resize_
string 预下载图片基于长宽做内缩略,比如宽 100 高 50,则赋值为 100x50,中间为小写字母 x
Definition: nim_client_helper.h:49
bool enable_user_datafile_restore_
bool 是否开启用户数据恢复(本地)功能 缺省false
Definition: nim_client_helper.h:104
bool reset_unread_count_when_recall_
bool 撤回消息后是否重新计算未读消息计数,默认为false
Definition: nim_client_helper.h:67
bool cache_session_data_when_delete_
bool 删除会话时是否在数据库缓存会话原数据,默认为 false
Definition: nim_client_helper.h:180
std::string nos_download_address_
string nos 下载地址拼接模板,用于拼接最终得到的下载地址
Definition: nim_client_helper.h:156
int comm_neca_
int 通信加密算法 {1(RC4),2(AES128),4(SM4)} def:1(RC4) 对称加密
Definition: nim_client_helper.h:123
std::string mock_refer_
Definition: nim_client_helper.h:187
std::string default_nos_upload_address_
string 默认nos 上传服务器地址,如果选择使用私有服务器,则必填
Definition: nim_client_helper.h:140
int nego_key_neca_
int "交换密钥"协议加密算法 {1(RSA),2(SM2)}, def:1(RSA) 非对称加密
Definition: nim_client_helper.h:121
std::list< std::string > http_dns_server_interface_
string list httpdns服务请求地址,如果没有特定地址可以不填
Definition: nim_client_helper.h:174
bool use_https_
bool 是否启用 HTTPS 协议,默认为 true
Definition: nim_client_helper.h:61
int hand_shake_type_
int 登录时使用的握手协议类型 0:支持配置多种对称与非对称加密算法,1:只支持RAS + RC4,缺省 0
Definition: nim_client_helper.h:119
std::string lbs_address_
string lbs地址,如果选择使用私有服务器,则必填
Definition: nim_client_helper.h:130
std::string server_conf_file_path_
string 私有云服务器相关地址配置文件本地绝对路径,如果不填默认执行文件目录下的server_conf.txt
Definition: nim_client_helper.h:125
多端登陆客户端信息
Definition: nim_client_helper.h:214
int custom_client_type_
int, 自定义客户端类型字段,大于0
Definition: nim_client_helper.h:230
std::string app_account_
第三方账号
Definition: nim_client_helper.h:216
std::string custom_data_
自定义字段
Definition: nim_client_helper.h:228
std::string mac_address_
登录设备的mac地址
Definition: nim_client_helper.h:222
std::string client_os_
登录系统类型,比如ios 6.0.1
Definition: nim_client_helper.h:220
OtherClientPres()
Definition: nim_client_helper.h:232
std::string device_id_
设备id,uuid
Definition: nim_client_helper.h:224
int64_t login_time_
本次登陆时间, 精度到ms
Definition: nim_client_helper.h:226
NIMClientType client_type_
客户端类型, 见NIMClientType
Definition: nim_client_helper.h:218
登录结果回调信息
Definition: nim_client_helper.h:238
NIMResCode res_code_
返回的错误码NIMResCode
Definition: nim_client_helper.h:240
NIMLoginStep login_step_
登录步骤NIMLoginStep
Definition: nim_client_helper.h:244
bool retrying_
SDK是否在重试,如果为false,开发者需要检查登录步骤和错误码,明确问题后调用手动重连接口进行登录操作
Definition: nim_client_helper.h:248
bool relogin_
是否为重连过程
Definition: nim_client_helper.h:242
LoginRes()
Definition: nim_client_helper.h:250
std::list< OtherClientPres > other_clients_
其他端的在线状态列表,登录成功才会返回这部分内容
Definition: nim_client_helper.h:246
被踢结果回调信息
Definition: nim_client_helper.h:256
NIMKickReason kick_reason_
返回的被踢原因NIMKickReason
Definition: nim_client_helper.h:260
int32_t custom_client_type_
自定义客户端类型,若没有,服务器会填0
Definition: nim_client_helper.h:264
std::string kickout_description_
string 返回的被踢描述
Definition: nim_client_helper.h:262
NIMClientType client_type_
int, 客户端类型NIMClientType
Definition: nim_client_helper.h:258
多端登录回调信息
Definition: nim_client_helper.h:268
NIMMultiSpotNotifyType notify_type_
NIMMultiSpotNotifyType 多点登录通知类型
Definition: nim_client_helper.h:270
std::list< OtherClientPres > other_clients_
其他端的在线状态列表
Definition: nim_client_helper.h:272
踢人结果回调信息
Definition: nim_client_helper.h:276
std::list< std::string > device_ids_
设备id,uuid
Definition: nim_client_helper.h:280
NIMResCode res_code_
返回的错误码NIMResCode
Definition: nim_client_helper.h:278
Definition: nim_client_helper.h:292
NIMAuthType auth_type_
鉴权方式,0表示默认校验方式,1表示基于appSecret计算的token方式,2表示基于第三方回调的token方式,默认0
Definition: nim_client_helper.h:296
LoginParams()
Definition: nim_client_helper.h:299
std::string custom_data_
自定义登录数据,会同步给其他端
Definition: nim_client_helper.h:294
std::string login_ex_
第三方回调方式鉴权要传递给服务器的拓展数据
Definition: nim_client_helper.h:298
Represents a JSON value.
Definition: value.h:196