diff --git a/1_2.mind_map/openwrt命令记录.xmind b/1_2.mind_map/openwrt命令记录.xmind new file mode 100644 index 0000000..5c82a3d Binary files /dev/null and b/1_2.mind_map/openwrt命令记录.xmind differ diff --git a/1_5.sed_test/sedTest b/1_5.sed_test/sedTest new file mode 100644 index 0000000..4f32568 --- /dev/null +++ b/1_5.sed_test/sedTest @@ -0,0 +1,15 @@ + + + +#* * * * * echo "hello" >> /cron.txt +#* * * * * echo "face" >> /cron.txt +#* * * * * echo "null" >> /cron.txt +#* * * * * echo "teee" >> /cron.txt + + +#* * * * * echo "test" >> /cron.txt + + + + + diff --git a/1_6.lua_test/1_1.test_convert_repeat_var.lua b/1_6.lua_test/1_1.test_convert_repeat_var.lua new file mode 100644 index 0000000..3e0fd38 --- /dev/null +++ b/1_6.lua_test/1_1.test_convert_repeat_var.lua @@ -0,0 +1,14 @@ +local val = "1,2,3,4,5,6,0" +--local val = "1,2,3,4,5,6,0" +--local val = "1,2,3,4,5,6,0" +--local val = "1,3,5" +local repeat_var = "0000000" +for i = 1, #val, 2 do + idx = string.sub(val, i, i) + if idx ~= tostring(0) then + repeat_var = string.sub(repeat_var, 0, idx - 1) .. tostring(1) .. string.sub(repeat_var, idx + 1, #repeat_var) + else + repeat_var = string.sub(repeat_var, 1, #repeat_var - 1) .. tostring(1) + end + print(repeat_var) +end diff --git a/1_6.lua_test/test.lua b/1_6.lua_test/test.lua new file mode 100644 index 0000000..4a004ec --- /dev/null +++ b/1_6.lua_test/test.lua @@ -0,0 +1,22 @@ +--[[print("lua") +tmp2 = os.date("!*t") +print(tmp2) +tmp = os.date("*t") +print(os.date()) +print(tmp) +local x = os.time() +print(x) +]]-- +print(os.date(now)) +print(os.date("%x")) +print(os.date("%M")) +print(os.date("*t", now)) --table +print(os.date("!*t", now)) --UTC + +--字符串形式 +local tmp = os.date(now) +print(tmp) +--转table +local tmp2 = os.date("!*t", tmp) + +print( os.time(tmp2)) diff --git a/1_6.lua_test/test_str_foreach.lua b/1_6.lua_test/test_str_foreach.lua new file mode 100644 index 0000000..fbb7fb4 --- /dev/null +++ b/1_6.lua_test/test_str_foreach.lua @@ -0,0 +1,38 @@ + +---------------------Lua遍历字符串的每个字符----------------------- +local s = "hello hi, again" +print(string.len(s)) + + +--[[----failed,expected table, not a string +for i, v in ipairs(s) do + print(v) +end +]]-- + + +--[[success! +for i = 0, #s do + print(string.sub(s, i, i)) +end +]]-- + + +--------------------------wifi repeat代码-------------------------- +local repeat_var_from_http = "1111111" +if string.len(repeat_var_from_http) ~= 7 then + print("len error") + return +end +local week_repeat = "" +for i = 1, #repeat_var_from_http do + tmp = string.sub(repeat_var_from_http, i, i) + if tmp == "1" then + if(i == #repeat_var_from_http) then + week_repeat = week_repeat..0 + break + end + week_repeat = week_repeat..tostring(i).."," + end +end +print(week_repeat) diff --git a/1_6.lua_test/test_three_eye_char.lua b/1_6.lua_test/test_three_eye_char.lua new file mode 100644 index 0000000..823067c --- /dev/null +++ b/1_6.lua_test/test_three_eye_char.lua @@ -0,0 +1,2 @@ +local var = 10 > 9 and 10 or 9 +print(var) diff --git a/1_7.http_proxy_server/c/1_7_1.c_http_download_prototype/!.http-download b/1_7.http_proxy_server/c/1_7_1.c_http_download_prototype/!.http-download new file mode 160000 index 0000000..49a47dd --- /dev/null +++ b/1_7.http_proxy_server/c/1_7_1.c_http_download_prototype/!.http-download @@ -0,0 +1 @@ +Subproject commit 49a47dd6ff3c6e828a805efd7f797be676a63110 diff --git a/1_7.http_proxy_server/c/1_7_1.c_http_download_prototype/downloader b/1_7.http_proxy_server/c/1_7_1.c_http_download_prototype/downloader new file mode 160000 index 0000000..c5a9ef7 --- /dev/null +++ b/1_7.http_proxy_server/c/1_7_1.c_http_download_prototype/downloader @@ -0,0 +1 @@ +Subproject commit c5a9ef73aebbc4e040a84f69ae62b4ebffbb0bac diff --git a/1_7.http_proxy_server/c/1_7_2.http_proxy_prototype/HTTP-Proxy-cache b/1_7.http_proxy_server/c/1_7_2.http_proxy_prototype/HTTP-Proxy-cache new file mode 160000 index 0000000..b37419e --- /dev/null +++ b/1_7.http_proxy_server/c/1_7_2.http_proxy_prototype/HTTP-Proxy-cache @@ -0,0 +1 @@ +Subproject commit b37419ec75268e31058a6fc0e901201f7677ecf0 diff --git a/1_7.http_proxy_server/c/1_7_2.http_proxy_prototype/HTTPProxy b/1_7.http_proxy_server/c/1_7_2.http_proxy_prototype/HTTPProxy new file mode 160000 index 0000000..a6a5dc8 --- /dev/null +++ b/1_7.http_proxy_server/c/1_7_2.http_proxy_prototype/HTTPProxy @@ -0,0 +1 @@ +Subproject commit a6a5dc8f23406ec8a9440b384058976fa2a27333 diff --git a/1_7.http_proxy_server/c/mongoose b/1_7.http_proxy_server/c/mongoose new file mode 160000 index 0000000..564683d --- /dev/null +++ b/1_7.http_proxy_server/c/mongoose @@ -0,0 +1 @@ +Subproject commit 564683d25a6601087e8e936acfef240996425441 diff --git a/1_7.http_proxy_server/c/test/testCallSh b/1_7.http_proxy_server/c/test/testCallSh new file mode 100755 index 0000000..82a45ec Binary files /dev/null and b/1_7.http_proxy_server/c/test/testCallSh differ diff --git a/1_7.http_proxy_server/c/test/testCallSh.c b/1_7.http_proxy_server/c/test/testCallSh.c new file mode 100644 index 0000000..f2d9d78 --- /dev/null +++ b/1_7.http_proxy_server/c/test/testCallSh.c @@ -0,0 +1,15 @@ +/************************************************************************* + > File Name: testCallSh.c + > Description: + > Conclusion: + > Author: rh_Jameson + > Created Time: 2015年06月12日 星期五 16时21分10秒 + ************************************************************************/ + +#include +#include + +int main(){ + system("ls -al"); + return 0; +} diff --git a/1_7.http_proxy_server/python/twisted-connect-proxy b/1_7.http_proxy_server/python/twisted-connect-proxy new file mode 160000 index 0000000..3f65863 --- /dev/null +++ b/1_7.http_proxy_server/python/twisted-connect-proxy @@ -0,0 +1 @@ +Subproject commit 3f658636170b67083cf73cf9709a00ea759e71d1 diff --git a/1_8.sip_push/nebula_sdk/a.out b/1_8.sip_push/nebula_sdk/a.out new file mode 100755 index 0000000..d5c0047 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/a.out differ diff --git a/1_8.sip_push/nebula_sdk/c_lib.txt b/1_8.sip_push/nebula_sdk/c_lib.txt new file mode 100644 index 0000000..f372b02 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/c_lib.txt @@ -0,0 +1,5 @@ +libprotobuf-c0-dev +libsnappy-dev +protobuf-c-compiler +libtcmalloc-minimal4 +libtcmalloc-minimal4-dbg diff --git a/1_8.sip_push/nebula_sdk/libnebula_sdk.so b/1_8.sip_push/nebula_sdk/libnebula_sdk.so new file mode 100644 index 0000000..6b0f3cb Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libnebula_sdk.so differ diff --git a/1_8.sip_push/nebula_sdk/libprotobuf.so.7 b/1_8.sip_push/nebula_sdk/libprotobuf.so.7 new file mode 100644 index 0000000..dd23d77 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libprotobuf.so.7 differ diff --git a/1_8.sip_push/nebula_sdk/libs/libcrypto_framwork.a b/1_8.sip_push/nebula_sdk/libs/libcrypto_framwork.a new file mode 100644 index 0000000..7557f41 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libs/libcrypto_framwork.a differ diff --git a/1_8.sip_push/nebula_sdk/libs/libjson-c.so b/1_8.sip_push/nebula_sdk/libs/libjson-c.so new file mode 100755 index 0000000..2a5ccfe Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libs/libjson-c.so differ diff --git a/1_8.sip_push/nebula_sdk/libs/libnebula_sdk.so b/1_8.sip_push/nebula_sdk/libs/libnebula_sdk.so new file mode 100755 index 0000000..15d51ad Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libs/libnebula_sdk.so differ diff --git a/1_8.sip_push/nebula_sdk/libs/libprotobuf-c.so b/1_8.sip_push/nebula_sdk/libs/libprotobuf-c.so new file mode 100755 index 0000000..99a558b Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libs/libprotobuf-c.so differ diff --git a/1_8.sip_push/nebula_sdk/libs/libsnappy.so b/1_8.sip_push/nebula_sdk/libs/libsnappy.so new file mode 100755 index 0000000..40fbb24 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libs/libsnappy.so differ diff --git a/1_8.sip_push/nebula_sdk/libs/libuuid.so b/1_8.sip_push/nebula_sdk/libs/libuuid.so new file mode 100755 index 0000000..1763c2f Binary files /dev/null and b/1_8.sip_push/nebula_sdk/libs/libuuid.so differ diff --git a/1_8.sip_push/nebula_sdk/main.c b/1_8.sip_push/nebula_sdk/main.c new file mode 100644 index 0000000..66f2ced --- /dev/null +++ b/1_8.sip_push/nebula_sdk/main.c @@ -0,0 +1,28 @@ +#include +#include "nebula_sdk.h" + +void msg_cb(const char* data, int len) +{ + printf("karldbg %s %s\n", __func__, data); +} + +int main(int argc, const char *argv[]) +{ + + const char* app_name[] = {"com.meizu.router",}; + NebulaMsgCallback cb = msg_cb; + + NebulaInit("R10WZOANC5400EE", "https://p.meizu.com", "/tmp"); + + NebulaSubScribe(1, app_name); + + NebulaRegister(eNebulaMsg_Push, cb); + + NebulaStart(); + + while(1) { + sleep(1); + } + + return 0; +} diff --git a/1_8.sip_push/nebula_sdk/nebula.log b/1_8.sip_push/nebula_sdk/nebula.log new file mode 100644 index 0000000..72f434c --- /dev/null +++ b/1_8.sip_push/nebula_sdk/nebula.log @@ -0,0 +1,25 @@ +[2015-05-07 15:02:59.365817]|WARN|nebula_sdk.c:55:(NebulaInit):load archive file failed... +[2015-05-07 15:02:59.365960]|INFO|nebula_sdk.c:95:(__NebulaStart):set status to eStatus_Redirect +[2015-05-07 15:02:59.387127]|INFO|redirect.c:119:(NebulaRedirect):HTTPS POST. url=https://p.meizu.com/push/redirect, params=uid=R10WZOANC5400EE&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1430982179&sign=915a7e6c46cb4894f43e0626835ca183 +[2015-05-07 15:03:00.110994]|INFO|redirect.c:126:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"121.14.58.42","port":8080},{"ip":"122.13.148.217","port":8080}],"md5_daa":{"rule":"hhs","salt":"fdsafdsafewqfewq"}} + +[2015-05-07 15:03:00.111336]|INFO|nebula_sdk.c:100:(__NebulaStart):set status to eStatus_LoopTest +[2015-05-07 15:03:00.131505]|INFO|nebula_sdk.c:108:(__NebulaStart):set status to eStatus_Connect +[2015-05-07 15:03:00.151805]|INFO|connect.c:159:(NebulaConnect):connect to server:121.14.58.42:8080 +[2015-05-07 15:03:00.151889]|INFO|nebula_sdk.c:113:(__NebulaStart):set status to eStatus_Connecting +[2015-05-07 15:03:00.157523]|INFO|connect.c:31:(__on_connect):connect success, server_addr:121.14.58.42:8080 +[2015-05-07 15:03:00.157623]|INFO|connect.c:34:(__on_connect):set status to eStatus_Auth1 +[2015-05-07 15:03:00.157811]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ AUTH|62 +[2015-05-07 15:03:00.157851]|INFO|nebula_sdk.c:125:(__NebulaStart):set status to eStatus_Auth1_Waiting +[2015-05-07 15:03:00.168268]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP AUTH|112 +[2015-05-07 15:03:00.180330]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ AUTH|140 +[2015-05-07 15:03:00.180446]|INFO|auth.c:107:(NebulaOnAuth):set status to eStatus_Auth2 +[2015-05-07 15:03:00.187501]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP AUTH|47 +[2015-05-07 15:03:00.187558]|INFO|auth.c:44:(NebulaOnAuth):set status to eStatus_Sub +[2015-05-07 15:03:00.187600]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ SUB|46 +[2015-05-07 15:03:00.196984]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP SUB|96 +[2015-05-07 15:03:00.197133]|INFO|subscribe.c:45:(NebulaOnSubSuccess):sub com.meizu.router success. +[2015-05-07 15:03:00.197194]|INFO|nebula_sdk.c:139:(__NebulaStart):set status to eStatus_Estab +[2015-05-07 15:03:00.337788]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ PING|0 +[2015-05-07 15:03:00.352052]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP PING|0 +[2015-05-07 15:03:00.352100]|DEBUG|connect.c:49:(__handle_message):pong. diff --git a/1_8.sip_push/nebula_sdk/nebula_sdk.h b/1_8.sip_push/nebula_sdk/nebula_sdk.h new file mode 100644 index 0000000..41f86e8 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/nebula_sdk.h @@ -0,0 +1,56 @@ +#ifndef NEBULA_SDK_H +#define NEBULA_SDK_H + +typedef enum { + eNebulaMsg_Push, /// 推送 (路由器只需关心这一类消息) + eNebulaMsg_Presence, /// Presence + eNebulaMsg_Sms, /// 网络短信 + eNebulaMsg_Mms, /// 网络彩信 + eNebulaMsg_Max, +} NebulaMsgType; + +#ifdef __cplusplus +extern "C" { +#endif + + /** 初始化网络连接 + * @device_tag: 硬件信息 (手机端为IMEI) + * @verify_pwd: 鉴权密码 (手机端为SN) + * @host: 服务端域名, 例如: https://p.meizu.com (结尾不要带"/", 前面要加上https) + * @file: 用于读取/存储持久化数据的文件名, 要求目录存在, 且有创建文件权限。 + * @return: 如果文件打开成功, 返回0; 否则返回-1, 文件打开失败原因记录在错误码errno中. + * @只能调用一次, 重复调用无效并返回-1. + */ + int NebulaInit(const char* device_tag, const char* host, const char* file); + + /** 设置订阅列表 + * + * + */ + void NebulaSubScribe(int count, const char** app_name); + + /** 消息处理回调函数 + * @app: App名 + * @msg: 消息内容 + */ + typedef void (*NebulaMsgCallback)(const char* app, const char* msg); + + /** 注册消息处理回调函数 + * @type: 消息类型 + * @cb: 回调函数 + * @return: 旧的回调函数 + * @一次只能注册一个回调函数, 重复注册会覆盖. + */ + NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb); + + /** 启动 + * + */ + int NebulaStart(); + +#ifdef __cplusplus +} +#endif + +#endif //NEBULA_SDK_H + diff --git a/1_8.sip_push/nebula_sdk/sdk.tar.gz b/1_8.sip_push/nebula_sdk/sdk.tar.gz new file mode 100644 index 0000000..84a9339 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk.tar.gz differ diff --git a/1_8.sip_push/nebula_sdk/sdk/Makefile b/1_8.sip_push/nebula_sdk/sdk/Makefile new file mode 100644 index 0000000..9e4c4e4 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/Makefile @@ -0,0 +1,31 @@ +CC=gcc +CFLAGS=-g -fPIC -Wall -Werror +INCLUDES=-Iproto -Icrypto +LINK=-lpthread -lcurl -lssl -lcrypto +LINK+=-Lproto -lnebula_proto +LINK+=-Lcrypto +LINK+=-Llibs -ljson-c -lsnappy -lprotobuf-c -luuid -lcrypto_framwork -L/usr/lib +LINK+=-ltcmalloc_minimal +TARGET=libnebula_sdk.so +OBJS=$(patsubst %.c,%.o,$(wildcard *.c)) + +all:$(TARGET) + +$(TARGET):$(OBJS) + cd proto && make + @echo LD $(TARGET) + @$(CC) $(CFLAGS) $(OBJS) -o $(TARGET) -shared $(LINK) + +.c.o: + $(CC) $(CFLAGS) -c $< -o $@ $(INCLUDES) + +.PHONY: clean + +clean: + rm $(TARGET) $(OBJS) -rf + cd proto && make clean + +install: + install $(TARGET) /usr/lib + mkdir -p /usr/include/nebula_sdk + install nebula_sdk.h /usr/include/nebula_sdk diff --git a/1_8.sip_push/nebula_sdk/sdk/README b/1_8.sip_push/nebula_sdk/sdk/README new file mode 100644 index 0000000..dfa7440 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/README @@ -0,0 +1,15 @@ +Interface: + +Sample: + +Depend dynamic libraries: + libcurl.so + libprotobuf-c.so + libssl.so + libcrypto.so + libtcmalloc_minimal.so + +Build: + Run `make` command in this directory. + + diff --git a/1_8.sip_push/nebula_sdk/sdk/archive.c b/1_8.sip_push/nebula_sdk/sdk/archive.c new file mode 100644 index 0000000..c31d0d5 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/archive.c @@ -0,0 +1,198 @@ +#include "archive.h" +#include "config.h" +#include +#include +#include +#include +#include +#include +#include "timer.h" + +extern dict* g_seq_dict; +extern char* g_storage_file; +Archive g_archive = {0, NULL, &g_seq_dict}; + +int NebulaIsSubscribed(const char* appname) +{ + int i; + for (i = 0; i < g_archive.n_sub_apps; ++i) { + if (strcmp(appname, g_archive.sub_apps[i]) == 0) + return 1; + } + + return 0; +} + +int NebulaAddSubApp(const char* appname) +{ + if (!g_archive.sub_apps) { + g_archive.sub_apps = (char**)malloc(sizeof(char*)); + if (!g_archive.sub_apps) { + log_error("malloc error."); + return -1; + } + + g_archive.sub_apps[0] = strdup(appname); + if (!g_archive.sub_apps[0]) { + log_error("malloc error."); + return -1; + } + g_archive.n_sub_apps = 1; + return 0; + } + + g_archive.sub_apps = + (char**)realloc(g_archive.sub_apps, sizeof(char*) * (g_archive.n_sub_apps + 1)); + if (!g_archive.sub_apps) { + log_error("malloc error."); + return -1; + } + g_archive.sub_apps[g_archive.n_sub_apps] = strdup(appname); + if (!g_archive.sub_apps[g_archive.n_sub_apps]) { + log_error("malloc error."); + return -1; + } + g_archive.n_sub_apps++; + return 0; +} + +void ReleaseArchive() +{ + int i; + for (i = 0; i < g_archive.n_sub_apps; ++i) { + free(g_archive.sub_apps[i]); + } + free(g_archive.sub_apps); + g_archive.n_sub_apps = 0; + g_archive.sub_apps = NULL; +} + +int NebulaLoadFromFile(const char* file) +{ + char *key = NULL; + FILE *f = fopen(file, "r"); + if (!f) { + log_warn("not found archive file:%s, please confirm SDK is first startup.", file); + return 0; + } + + ReleaseArchive(); + + char *line = NULL; + size_t len = 0; + ssize_t n = getline(&line, &len, f); + if (n <= 0) { + fclose(f); + return -1; + } + key = strndup(line, strlen(line) - 1); + g_archive.n_sub_apps = atoi(key); + free(key); + int i; + for (i = 0; i < g_archive.n_sub_apps; ++i) { + n = getline(&line, &len, f); + if (n <= 0) { + ReleaseArchive(); + fclose(f); + return -1; + } + key = strndup(line, strlen(line) - 1); + NebulaAddSubApp(key); + free(key); + } + + n = getline(&line, &len, f); + if (n <= 0) { + ReleaseArchive(); + fclose(f); + return -1; + } + key = strndup(line, strlen(line) - 1); + int dict_size = atoi(key); + free(key); + for (i = 0; i < dict_size; ++i) { + n = getline(&line, &len, f); + if (n <= 0) { + ReleaseArchive(); + fclose(f); + return -1; + } + + key = strndup(line, strlen(line) - 1); + char* pSpace = strchr(key, ' '); + if (!pSpace) { + ReleaseArchive(); + fclose(f); + free(key); + return -1; + } + + *pSpace = '\0'; + char* value = pSpace + 1; + int v = atoi(value); + dict *seqs = *g_archive.seqs; + dictEntry *entry = dictFind(seqs, key); + if (entry) { + entry->v.u64 = v; + } else { + dictAdd(seqs, key, (void*)(uint64_t)v); + } + free(key); + } + + if (line) + free(line); + fclose(f); + return 0; +} + +int NebulaSaveToFile(const char* file) +{ + FILE *f = fopen(file, "w"); + if (!f) { + return -1; + } + + char buf[32]; + snprintf(buf, sizeof(buf), "%d", g_archive.n_sub_apps); + fwrite(buf, 1, strlen(buf), f); + fwrite("\n", 1, 1, f); + int i; + for (i = 0; i < g_archive.n_sub_apps; ++i) { + fwrite(g_archive.sub_apps[i], 1, strlen(g_archive.sub_apps[i]), f); + fwrite("\n", 1, 1, f); + } + + dict *seqs = *g_archive.seqs; + snprintf(buf, sizeof(buf), "%d", (int)dictSize(seqs)); + fwrite(buf, 1, strlen(buf), f); + fwrite("\n", 1, 1, f); + dictIterator *it = dictGetIterator(seqs); + dictEntry *entry = dictNext(it); + while (entry) { + fwrite((const char*)entry->key, 1, strlen((const char*)entry->key), f); + fwrite(" ", 1, 1, f); + snprintf(buf, sizeof(buf), "%lu", entry->v.u64); + fwrite(buf, 1, strlen(buf), f); + fwrite("\n", 1, 1, f); + entry = dictNext(it); + } + int ret = fflush(f); + fclose(f); + return ret; +} + +struct timer_entry g_save_entry; +void save_timer(timer_heap_t* ht, timer_entry* entry) +{ + timer_update(ht, entry, 10000); + NebulaSaveToFile(g_storage_file); +} + +void NebulaInitAutoSave() +{ + timer_entry_init(&g_save_entry, 0, NULL, &save_timer); + timer_add(g_timer, &g_save_entry, 1000); +} + + diff --git a/1_8.sip_push/nebula_sdk/sdk/archive.h b/1_8.sip_push/nebula_sdk/sdk/archive.h new file mode 100644 index 0000000..2f590c3 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/archive.h @@ -0,0 +1,25 @@ +#ifndef ARCHIVE_H +#define ARCHIVE_H + +#include "dict.h" + +struct _Archive +{ + int n_sub_apps; + char **sub_apps; + dict **seqs; +}; +typedef struct _Archive Archive; +extern Archive g_archive; + +void NebulaInitAutoSave(); + +int NebulaIsSubscribed(const char* appname); + +int NebulaAddSubApp(const char* appname); + +int NebulaLoadFromFile(const char* file); + +int NebulaSaveToFile(const char* file); + +#endif //ARCHIVE_H diff --git a/1_8.sip_push/nebula_sdk/sdk/archive.o b/1_8.sip_push/nebula_sdk/sdk/archive.o new file mode 100644 index 0000000..43dd92d Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/archive.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/auth.c b/1_8.sip_push/nebula_sdk/sdk/auth.c new file mode 100644 index 0000000..473c3af --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/auth.c @@ -0,0 +1,112 @@ +#include "auth.h" +#include "connect.h" +#include "config.h" +#include +#include "str.h" +#include "string.h" +#include "connect.h" +#include + +char* g_token = ""; + +int NebulaAuth1() +{ + Nebula__AuthRequest request; + nebula__auth_request__init(&request); + request.uid = g_device_tag; + request.username = g_device_tag; + return NebulaSend(MSG_SET_REQUEST(NEBULA_MSG_AUTH), (ProtobufCMessage*)&request); +} + +int NebulaAuth2(char* token, char* nonce) +{ + Nebula__AuthRequest request; + nebula__auth_request__init(&request); + request.uid = g_device_tag; + request.username = g_device_tag; + request.token = token; + request.nonce = nonce; + request.has_algorithm = 1; + request.algorithm = NEBULA__AUTH_REQUEST__ALGORITHM__MD5_DAA; + return NebulaSend(MSG_SET_REQUEST(NEBULA_MSG_AUTH), (ProtobufCMessage*)&request); +} + +void NebulaOnAuth(NebulaHeader *head, const char* data, int len) +{ + Nebula__AuthResponse *response = nebula__auth_response__unpack(NULL, len, (const uint8_t*)data); + if (!response) { + log_error("parse auth response error. data_len=%d", len); + return ; + } + + if (response->status == 200) { + // auth success. + next_status(); + } else { + if (Nebulaget_status() == eStatus_Auth2) { + // auth failed, retry redirect. + log_error("auth failed, rsp.status() == %d. sleep 1 and retry redirect.", response->status); + nebula__auth_response__free_unpacked(response, NULL); + sleep(1); + PopFront(g_server_list); + jump_status(eStatus_Connect); + return ; + } + + static const char hex[] = "0123456789abcdef"; + int i; + unsigned char ha1_b[16], ha1[32], token_b[16], token[33]; + struct str buf; + string_init(&buf); + string_append_fast(&buf, g_salt, strlen(g_salt)); + string_append_fast(&buf, ":", 1); + string_append_fast(&buf, g_device_tag, strlen(g_device_tag)); + string_append_fast(&buf, ":", 1); + string_append_fast(&buf, response->nonce, strlen(response->nonce)); + MD5((unsigned char*)buf.ptr, buf.len, ha1_b); + for (i = 0; i < MD5_DIGEST_LENGTH; i++) + { + ha1[i * 2] = hex[ha1_b[i] >> 4]; + ha1[i * 2 + 1] = hex[ha1_b[i] & 0xf]; + } + + string_reset(&buf); + char *rule = g_rule; + while (*rule) { + if (!string_empty(&buf)) { + string_append_fast(&buf, ":", 1); + } + + if (*rule == 'h') { + string_append_fast(&buf, (char*)ha1, 32); + } else if (*rule == 's') { + string_append_fast(&buf, g_salt, strlen(g_salt)); + } else { + log_error("unkown rule: %s", g_rule); + } + + rule++; + } + MD5((unsigned char*)buf.ptr, buf.len, token_b); + + for (i = 0; i < MD5_DIGEST_LENGTH; i++) + { + token[i * 2] = hex[token_b[i] >> 4]; + token[i * 2 + 1] = hex[token_b[i] & 0xf]; + } + token[32] = '\0'; + + //log_debug("auth. md5buf:%s, token:%s", buf.ptr, token); + + string_deinit(&buf); + if (-1 == NebulaAuth2((char*)token, response->nonce)) { + jump_status(eStatus_Redirect); + } else { + if (strlen(g_token)) free(g_token); + g_token = strdup((char*)token); + next_status(); + } + } + + nebula__auth_response__free_unpacked(response, NULL); +} diff --git a/1_8.sip_push/nebula_sdk/sdk/auth.h b/1_8.sip_push/nebula_sdk/sdk/auth.h new file mode 100644 index 0000000..61c7db4 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/auth.h @@ -0,0 +1,12 @@ +#ifndef AUTH_H +#define AUTH_H + +#include "nebula_proto.h" + +// auth 分为2步. + +int NebulaAuth1(); + +void NebulaOnAuth(NebulaHeader *head, const char* data, int len); + +#endif //AUTH_H diff --git a/1_8.sip_push/nebula_sdk/sdk/auth.o b/1_8.sip_push/nebula_sdk/sdk/auth.o new file mode 100644 index 0000000..c5d8c01 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/auth.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/config.c b/1_8.sip_push/nebula_sdk/sdk/config.c new file mode 100644 index 0000000..c72d923 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/config.c @@ -0,0 +1,63 @@ +#include "config.h" + +eStatus g_status = eStatus_Init; + +const char* Nebularand_string() +{ + static char buf[32] = {}; + int len = rand() % (sizeof(buf) - 1 - 16) + 16; + int i; + for (i = 0; i < len; ++i) + { + int v = rand() % 36; + if (v < 10) + buf[i] = '0' + v; + else + buf[i] = 'a' + v - 10; + } + buf[i] = '\0'; + return buf; +} + +const char* Nebulamsgtype_name(int type) +{ + switch (type) { + case eNebulaMsg_Push: /// 推送 (路由器只需关心这一类消息) + return "eNebulaMsg_Push"; + break; + case eNebulaMsg_Presence: /// Presence + return "eNebulaMsg_Presence"; + break; + case eNebulaMsg_Sms: /// 网络短信 + return "eNebulaMsg_Sms"; + break; + case eNebulaMsg_Mms: /// 网络彩信 + return "eNebulaMsg_Mms"; + break; + } + + return ""; +} + +const char* Nebulastatus_name(eStatus ss) +{ + static const char* names[] = { + "eStatus_Init", + "eStatus_Redirect", + "eStatus_LoopTest", + "eStatus_Connect", + "eStatus_Connecting", + "eStatus_Auth1", + "eStatus_Auth1_Waiting", + "eStatus_Auth2", + "eStatus_Sub", + "eStatus_Estab", + }; + + return names[ss]; +} + +eStatus Nebulaget_status() +{ + return g_status; +} diff --git a/1_8.sip_push/nebula_sdk/sdk/config.h b/1_8.sip_push/nebula_sdk/sdk/config.h new file mode 100644 index 0000000..a40cd45 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/config.h @@ -0,0 +1,65 @@ +#ifndef CONFIG_H +#define CONFIG_H + +#include "nebula_sdk.h" +#include "timer.h" +#include "logger.h" +#include "list.h" +#include "message.pb-c.h" +#include "nebula.pb-c.h" + +enum _eStatus { + eStatus_Init, + eStatus_Redirect, + eStatus_LoopTest, + eStatus_Connect, + eStatus_Connecting, + eStatus_Auth1, + eStatus_Auth1_Waiting, + eStatus_Auth2, + eStatus_Sub, + eStatus_Estab, +}; + +typedef enum _eStatus eStatus; + +extern char* g_device_tag; +extern char* g_nebula_host; +extern NebulaMsgCallback g_nebula_cb[eNebulaMsg_Max]; +extern int g_storage_fd; +extern timer_heap_t *g_timer; +extern List *g_server_list; +extern char* g_salt; +extern char* g_rule; +extern char* g_token; +extern int g_sub_app_count; +extern char** g_sub_apps; +extern eStatus g_status; + +const char* Nebularand_string(); +const char* Nebulamsgtype_name(int type); + +const char* Nebulastatus_name(eStatus ss); +eStatus Nebulaget_status(); + +#define next_status() \ + do \ + {\ + if (g_status < eStatus_Estab) {\ + g_status ++;\ + log_info("set status to %s", Nebulastatus_name(g_status));\ + } else {\ + g_status = eStatus_Init;\ + log_info("set status to %s", Nebulastatus_name(g_status));\ + }\ + } while(0) + + +#define jump_status(ss) \ + do \ + {\ + g_status = ss;\ + log_info("set status to %s", Nebulastatus_name(g_status));\ + } while(0) + +#endif //CONFIG_H diff --git a/1_8.sip_push/nebula_sdk/sdk/config.o b/1_8.sip_push/nebula_sdk/sdk/config.o new file mode 100644 index 0000000..ebd693f Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/config.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/connect.c b/1_8.sip_push/nebula_sdk/sdk/connect.c new file mode 100644 index 0000000..9415a56 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/connect.c @@ -0,0 +1,208 @@ +#include "connect.h" +#include +#include +#include +#include "config.h" +#include "net.h" +#include "auth.h" +#include "subscribe.h" +#include "nebula.pb-c.h" +#include "nebula_proto.h" +#include "nebula_compress_uncompress_wrapper.h" +#include "nebula_encrypt_decrypt_wrapper.h" +#include "push.h" +#include "timer.h" + +static Conn* g_conn = NULL; +timer_entry g_ping_entry; + +void Ping(timer_heap_t* ht, timer_entry *entry); + +static void __on_connect(Conn* conn, int err) +{ + if (err) { + // connect failed. + log_error("connect server_addr:%s:%d error:%s", conn->host, conn->port, strerror(err)); + PopFront(g_server_list); + jump_status(eStatus_Connect); + return ; + } + + log_info("connect success, server_addr:%s:%d", conn->host, conn->port); + timer_entry_init(&g_ping_entry, 0, NULL, &Ping); + timer_add(g_timer, &g_ping_entry, 180); + next_status(); +} + +static void __handle_message(NebulaHeader* head) +{ + static char *buf1 = NULL; + if (!buf1) + buf1 = (char*)malloc(MAX_BUF_SIZE); + static char *buf2 = NULL; + if (!buf2) + buf2 = (char*)malloc(MAX_BUF_SIZE); + + log_debug("NEBULA RX %s|%d", MsgType2Str(head->type), (int)htons(head->len)); + + if ((head->type & 0x7f) == NEBULA_MSG_PING) { + log_debug("pong."); + return ; + } + + Nebula__NebulaMsg *msg = nebula__nebula_msg__unpack(NULL, htons(head->len), (uint8_t*)(head + 1)); + if (!msg) { + log_debug("NebulaMsg parser error."); + return ; + } + + char *data = (char*)msg->body.data; + uint32_t len = msg->body.len; + + int compress_type = head->flag >> 4; + int encrypt_type = head->flag & 0x0f; + if (compress_type) { + // uncompress + uint32_t dst_len = MAX_BUF_SIZE; + if (-1 == NebulaUnCompress(compress_type, data, len, buf1, &dst_len)) { + log_debug("uncompress error. head->type=%d", head->type); + return ; + } + + data = buf1; + len = dst_len; + } + + if (encrypt_type) { + // unencrypt + uint32_t dst_len = MAX_BUF_SIZE; + if (-1 == NebulaDecrypt(encrypt_type, g_token, + strlen(g_token), data, len, buf2, &dst_len)) { + log_debug("unencrypt error. head->type=%d", head->type); + return ; + } + + data = buf2; + len = dst_len; + } + + // dispatch + if (MSG_IS_REQUEST(head)) { + // request + switch (head->type & 0x7f) { + case NEBULA_MSG_PSH: + NebulaOnPush(head, data, len); + break; + + case NEBULA_MSG_MSG: + NebulaOnMsg(head, data, len); + break; + } + } else { + // response + switch (head->type & 0x7f) { + case NEBULA_MSG_AUTH: + NebulaOnAuth(head, data, len); + break; + + case NEBULA_MSG_SUB: + NebulaOnSub(head, data, len); + break; + } + } +} + +static void __on_read(Conn* conn, NebulaHeader* head) +{ + (void)conn; + __handle_message(head); +} + +static void __on_disconnect(Conn* conn) +{ + (void)conn; + log_warn("tcp net disconnected, retry connect..."); + timer_del(g_timer, &g_ping_entry); + if (Nebulaget_status() > eStatus_Connect) + jump_status(eStatus_Connect); +} + +int NebulaConnect() +{ + if (!g_conn) { + g_conn = NebulaConnCreate(); + NebulaConnInit(g_conn, __on_connect, __on_read, __on_disconnect); + if (!g_conn) return -1; + } + + if (g_conn->state == eConnState_Estab) { + NebulaDisconnect(); + } + + if (!g_server_list->size) { + // 没有ip列表, 重新redirect. + jump_status(eStatus_Redirect); + return -1; + } + + struct sockaddr_in *addr = (struct sockaddr_in *)Front(g_server_list); + uint16_t port = htons(addr->sin_port); + char ip[32] = {}; + inet_ntop(AF_INET, &addr->sin_addr.s_addr, ip, sizeof(ip)); + + if (-1 == NebulaConnConnect(g_conn, ip, port)) { + log_error("connect error, server_addr:%s:%d", ip, port); + PopFront(g_server_list); + return -1; + } + + log_info("connect to server:%s:%d", ip, port); + return 0; +} + +int NebulaSend(uint8_t type, ProtobufCMessage *msg) +{ + NebulaHeader head; + HEAD_INIT(&head, type); + + Nebula__NebulaMsg nebula_msg; + nebula__nebula_msg__init(&nebula_msg); + char msgid_buf[24]; + CreateMsgid(msgid_buf); + nebula_msg.msgid = msgid_buf; + if (msg) { + nebula_msg.has_body = 1; + nebula_msg.body.len = protobuf_c_message_get_packed_size(msg); + nebula_msg.body.data = (uint8_t*)malloc(nebula_msg.body.len); + if (!nebula_msg.body.data) { + log_error("malloc error."); + return -1; + } + + protobuf_c_message_pack(msg, nebula_msg.body.data); + } + + int ret = NebulaConnSend(g_conn, &head, (ProtobufCMessage *)&nebula_msg); + if (nebula_msg.has_body) { + free(nebula_msg.body.data); + } + return ret; +} + +void Ping(timer_heap_t* ht, timer_entry *entry) +{ + NebulaHeader head; + HEAD_INIT(&head, MSG_SET_REQUEST(NEBULA_MSG_PING)); + head.flag = 180; + //TODO: dynamic ping's time interval. + timer_update(ht, entry, head.flag * 1000); + if (-1 == NebulaConnSend(g_conn, &head, NULL)) { + log_error("Ping send error."); + } +} + +void NebulaDisconnect() +{ + NebulaConnNebulaDisconnect(g_conn); +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/connect.h b/1_8.sip_push/nebula_sdk/sdk/connect.h new file mode 100644 index 0000000..7490751 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/connect.h @@ -0,0 +1,14 @@ +#ifndef CONNECT_H +#define CONNECT_H + +#include + +#define MAX_BUF_SIZE 4096 + +int NebulaConnect(); + +int NebulaSend(uint8_t type, ProtobufCMessage *msg); + +void NebulaDisconnect(); + +#endif //CONNECT_H diff --git a/1_8.sip_push/nebula_sdk/sdk/connect.o b/1_8.sip_push/nebula_sdk/sdk/connect.o new file mode 100644 index 0000000..1459116 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/connect.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/crypto/crypto_framwork.h b/1_8.sip_push/nebula_sdk/sdk/crypto/crypto_framwork.h new file mode 100644 index 0000000..8bb5978 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/crypto/crypto_framwork.h @@ -0,0 +1,60 @@ +#ifndef CRYPTO_FRAMWROK_H +#define CRYPTO_FRAMWROK_H + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define CRYPTO_OK 0 +#define CRYPTO_UNDEF_MEMORY -1 +#define CRYPTO_TOOSHORT_DST_LEN -2 +#define CRYPTO_TOOSHORT_KEY_LEN -3 +#define CRYPTO_SET_KEY_ERROR -4 +#define CRYPTO_SRC_LEN_ZERO -5 + +#define CRYPTO1_BLOCK_SIZE 16 +#define CRYPTO2_BLOCK_SIZE 16 +#define CRYPTO3_BLOCK_SIZE 8 +/* + * CRYPTO_UNDEF_MEMORY means key,src,dst is NULL + * CRYPTO_TOOSHORT_DST_LEN means dst_len too short + * if(*len < src_len) + return CRYPTO_TOOSHORT_DST_LEN; + if(*len < src_len + BLOCK_SIZE - src_len % BLOCK_SIZE) + if(src_len % BLOCK_SIZE != 0) + return CRYPTO_TOOSHORT_DST_LEN; + typically src_len = *len = BLOCK_SIZE * n (n = 1,2,3....) is recommend + * CRYPTO_TOOSHORT_KEY_LEN means key_len < 16 + * CRYPTO_SET_KEY_ERROR means set key error(hardly occurs) + */ + +/* + * fast : CRYPTO3 > CRYPTO2 > CRYPTO1 + * secure : CRYPTO2 > CRYPTO1 > CRYPTO3 + * 128 bits key is less secure than 256 bits,but run faster + */ +/* CRYPTO1 is fast */ +int CRYPTO1_encrypt(const unsigned char *key,const uint32_t key_len,const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); + +int CRYPTO1_decrypt(const unsigned char *key,const uint32_t key_len,const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); + +/* CRYPTO2 is slightly slower but safer*/ +int CRYPTO2_encrypt(const unsigned char *key,const uint32_t key_len,const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); + +int CRYPTO2_decrypt(const unsigned char *key,const uint32_t key_len,const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); + +/* CRYPTO3 is less secure but faster*/ +int CRYPTO3_encrypt(const unsigned char *key,const uint32_t key_len,const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); + +int CRYPTO3_decrypt(const unsigned char *key,const uint32_t key_len,const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); + +/* implement of CRYPTO2 */ +int CRYPTO_encrypt_without_key(const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); +int CRYPTO_decrypt_without_key(const unsigned char *src,const uint32_t src_len,unsigned char *dst,uint32_t *len); +#ifdef __cplusplus +} +#endif + +#endif diff --git a/1_8.sip_push/nebula_sdk/sdk/data b/1_8.sip_push/nebula_sdk/sdk/data new file mode 100644 index 0000000..2820066 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/data @@ -0,0 +1,3 @@ +1 +com.meizu.cloud +0 diff --git a/1_8.sip_push/nebula_sdk/sdk/dict.c b/1_8.sip_push/nebula_sdk/sdk/dict.c new file mode 100644 index 0000000..8119059 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/dict.c @@ -0,0 +1,811 @@ +/* Hash Tables Implementation. + * + * This file implements in memory hash tables with insert/del/replace/find/ + * get-random-element operations. Hash tables will auto resize if needed + * tables of power of two in size are used, collisions are handled by + * chaining. See the source code for more information... :) + * + * Copyright (c) 2006-2012, Salvatore Sanfilippo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Redis nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include +#include +#include +#include +#include +#include +#include +#include + +#include "dict.h" + +/* Using dictEnableResize() / dictDisableResize() we make possible to + * enable/disable resizing of the hash table as needed. This is very important + * for Redis, as we use copy-on-write and don't want to move too much memory + * around when there is a child performing saving operations. + * + * Note that even when dict_can_resize is set to 0, not all resizes are + * prevented: an hash table is still allowed to grow if the ratio between + * the number of elements and the buckets > dict_force_resize_ratio. */ +static int dict_can_resize = 1; +static unsigned int dict_force_resize_ratio = 5; + +/* -------------------------- private prototypes ---------------------------- */ + +static int _dictExpandIfNeeded(dict *ht); +static unsigned long _dictNextPower(unsigned long size); +static int _dictKeyIndex(dict *ht, const void *key); +static int _dictInit(dict *ht, dictType *type, void *privDataPtr); + +/* -------------------------- hash functions -------------------------------- */ + +/* Thomas Wang's 32 bit Mix Function */ +unsigned int dictIntHashFunction(unsigned int key) +{ + key += ~(key << 15); + key ^= (key >> 10); + key += (key << 3); + key ^= (key >> 6); + key += ~(key << 11); + key ^= (key >> 16); + return key; +} + +/* Identity hash function for integer keys */ +unsigned int dictIdentityHashFunction(unsigned int key) +{ + return key; +} + +static uint32_t dict_hash_function_seed = 5381; + +void dictSetHashFunctionSeed(uint32_t seed) { + dict_hash_function_seed = seed; +} + +uint32_t dictGetHashFunctionSeed(void) { + return dict_hash_function_seed; +} + +/* MurmurHash2, by Austin Appleby + * Note - This code makes a few assumptions about how your machine behaves - + * 1. We can read a 4-byte value from any address without crashing + * 2. sizeof(int) == 4 + * + * And it has a few limitations - + * + * 1. It will not work incrementally. + * 2. It will not produce the same results on little-endian and big-endian + * machines. + */ +unsigned int dictGenHashFunction(const void *key, int len) { + /* 'm' and 'r' are mixing constants generated offline. + They're not really 'magic', they just happen to work well. */ + uint32_t seed = dict_hash_function_seed; + const uint32_t m = 0x5bd1e995; + const int r = 24; + + /* Initialize the hash to a 'random' value */ + uint32_t h = seed ^ len; + + /* Mix 4 bytes at a time into the hash */ + const unsigned char *data = (const unsigned char *)key; + + while(len >= 4) { + uint32_t k = *(uint32_t*)data; + + k *= m; + k ^= k >> r; + k *= m; + + h *= m; + h ^= k; + + data += 4; + len -= 4; + } + + /* Handle the last few bytes of the input array */ + switch(len) { + case 3: h ^= data[2] << 16; + case 2: h ^= data[1] << 8; + case 1: h ^= data[0]; h *= m; + }; + + /* Do a few final mixes of the hash to ensure the last few + * bytes are well-incorporated. */ + h ^= h >> 13; + h *= m; + h ^= h >> 15; + + return (unsigned int)h; +} + +/* And a case insensitive hash function (based on djb hash) */ +unsigned int dictGenCaseHashFunction(const unsigned char *buf, int len) { + unsigned int hash = (unsigned int)dict_hash_function_seed; + + while (len--) + hash = ((hash << 5) + hash) + (tolower(*buf++)); /* hash * 33 + c */ + return hash; +} + +/* ----------------------------- API implementation ------------------------- */ + +/* Reset a hash table already initialized with ht_init(). + * NOTE: This function should only be called by ht_destroy(). */ +static void _dictReset(dictht *ht) +{ + ht->table = NULL; + ht->size = 0; + ht->sizemask = 0; + ht->used = 0; +} + +/* Create a new hash table */ +dict *dictCreate(dictType *type, + void *privDataPtr) +{ + dict *d = (dict*)malloc(sizeof(*d)); + if(d == NULL) { + return NULL; + } + + _dictInit(d,type,privDataPtr); + return d; +} + +/* Initialize the hash table */ +int _dictInit(dict *d, dictType *type, + void *privDataPtr) +{ + _dictReset(&d->ht[0]); + _dictReset(&d->ht[1]); + d->type = type; + d->privdata = privDataPtr; + d->rehashidx = -1; + d->iterators = 0; + return DICT_OK; +} + +/* Resize the table to the minimal size that contains all the elements, + * but with the invariant of a USED/BUCKETS ratio near to <= 1 */ +int dictResize(dict *d) +{ + int minimal; + + if (!dict_can_resize || dictIsRehashing(d)) return DICT_ERR; + minimal = d->ht[0].used; + if (minimal < DICT_HT_INITIAL_SIZE) + minimal = DICT_HT_INITIAL_SIZE; + return dictExpand(d, minimal); +} + +/* Expand or create the hash table */ +int dictExpand(dict *d, unsigned long size) +{ + dictht n; /* the new hash table */ + unsigned long realsize = _dictNextPower(size); + + /* the size is invalid if it is smaller than the number of + * elements already inside the hash table */ + if (dictIsRehashing(d) || d->ht[0].used > size) + return DICT_ERR; + + /* Allocate the new hash table and initialize all pointers to NULL */ + n.size = realsize; + n.sizemask = realsize-1; + n.table = (dictEntry**)calloc(1, realsize*sizeof(dictEntry*)); + n.used = 0; + + /* Is this the first initialization? If so it's not really a rehashing + * we just set the first hash table so that it can accept keys. */ + if (d->ht[0].table == NULL) { + d->ht[0] = n; + return DICT_OK; + } + + /* Prepare a second hash table for incremental rehashing */ + d->ht[1] = n; + d->rehashidx = 0; + return DICT_OK; +} + +/* Performs N steps of incremental rehashing. Returns 1 if there are still + * keys to move from the old to the new hash table, otherwise 0 is returned. + * Note that a rehashing step consists in moving a bucket (that may have more + * thank one key as we use chaining) from the old to the new hash table. */ +int dictRehash(dict *d, int n) { + if (!dictIsRehashing(d)) return 0; + + while(n--) { + dictEntry *de, *nextde; + + /* Check if we already rehashed the whole table... */ + if (d->ht[0].used == 0) { + free(d->ht[0].table); + d->ht[0] = d->ht[1]; + _dictReset(&d->ht[1]); + d->rehashidx = -1; + return 0; + } + + /* Note that rehashidx can't overflow as we are sure there are more + * elements because ht[0].used != 0 */ + assert(d->ht[0].size > (unsigned)d->rehashidx); + while(d->ht[0].table[d->rehashidx] == NULL) d->rehashidx++; + de = d->ht[0].table[d->rehashidx]; + /* Move all the keys in this bucket from the old to the new hash HT */ + while(de) { + unsigned int h; + + nextde = de->next; + /* Get the index in the new hash table */ + h = dictHashKey(d, de->key) & d->ht[1].sizemask; + de->next = d->ht[1].table[h]; + d->ht[1].table[h] = de; + d->ht[0].used--; + d->ht[1].used++; + de = nextde; + } + d->ht[0].table[d->rehashidx] = NULL; + d->rehashidx++; + } + return 1; +} + +long long timeInMilliseconds(void) { + struct timeval tv; + + gettimeofday(&tv,NULL); + return (((long long)tv.tv_sec)*1000)+(tv.tv_usec/1000); +} + +/* Rehash for an amount of time between ms milliseconds and ms+1 milliseconds */ +int dictRehashMilliseconds(dict *d, int ms) { + long long start = timeInMilliseconds(); + int rehashes = 0; + + while(dictRehash(d,100)) { + rehashes += 100; + if (timeInMilliseconds()-start > ms) break; + } + return rehashes; +} + +/* This function performs just a step of rehashing, and only if there are + * no safe iterators bound to our hash table. When we have iterators in the + * middle of a rehashing we can't mess with the two hash tables otherwise + * some element can be missed or duplicated. + * + * This function is called by common lookup or update operations in the + * dictionary so that the hash table automatically migrates from H1 to H2 + * while it is actively used. */ +static void _dictRehashStep(dict *d) { + if (d->iterators == 0) dictRehash(d,1); +} + +/* Add an element to the target hash table */ +int dictAdd(dict *d, void *key, void *val) +{ + dictEntry *entry = dictAddRaw(d,key); + + if (!entry) return DICT_ERR; + dictSetVal(d, entry, val); + return DICT_OK; +} + +/* Low level add. This function adds the entry but instead of setting + * a value returns the dictEntry structure to the user, that will make + * sure to fill the value field as he wishes. + * + * This function is also directly exposed to user API to be called + * mainly in order to store non-pointers inside the hash value, example: + * + * entry = dictAddRaw(dict,mykey); + * if (entry != NULL) dictSetSignedIntegerVal(entry,1000); + * + * Return values: + * + * If key already exists NULL is returned. + * If key was added, the hash entry is returned to be manipulated by the caller. + */ +dictEntry *dictAddRaw(dict *d, void *key) +{ + int index; + dictEntry *entry; + dictht *ht; + + if (dictIsRehashing(d)) _dictRehashStep(d); + + /* Get the index of the new element, or -1 if + * the element already exists. */ + if ((index = _dictKeyIndex(d, key)) == -1) + return NULL; + + /* Allocate the memory and store the new entry */ + ht = dictIsRehashing(d) ? &d->ht[1] : &d->ht[0]; + entry = (dictEntry*)malloc(sizeof(*entry)); + entry->next = ht->table[index]; + ht->table[index] = entry; + ht->used++; + + /* Set the hash entry fields. */ + dictSetKey(d, entry, key); + return entry; +} + +/* Add an element, discarding the old if the key already exists. + * Return 1 if the key was added from scratch, 0 if there was already an + * element with such key and dictReplace() just performed a value update + * operation. */ +int dictReplace(dict *d, void *key, void *val) +{ + dictEntry *entry, auxentry; + + /* Try to add the element. If the key + * does not exists dictAdd will suceed. */ + if (dictAdd(d, key, val) == DICT_OK) + return 1; + /* It already exists, get the entry */ + entry = dictFind(d, key); + /* Set the new value and free the old one. Note that it is important + * to do that in this order, as the value may just be exactly the same + * as the previous one. In this context, think to reference counting, + * you want to increment (set), and then decrement (free), and not the + * reverse. */ + auxentry = *entry; + dictSetVal(d, entry, val); + dictFreeVal(d, &auxentry); + return 0; +} + +/* dictReplaceRaw() is simply a version of dictAddRaw() that always + * returns the hash entry of the specified key, even if the key already + * exists and can't be added (in that case the entry of the already + * existing key is returned.) + * + * See dictAddRaw() for more information. */ +dictEntry *dictReplaceRaw(dict *d, void *key) { + dictEntry *entry = dictFind(d,key); + + return entry ? entry : dictAddRaw(d,key); +} + +/* Search and remove an element */ +static int dictGenericDelete(dict *d, const void *key, int nofree) +{ + unsigned int h, idx; + dictEntry *he, *prevHe; + int table; + + if (d->ht[0].size == 0) return DICT_ERR; /* d->ht[0].table is NULL */ + if (dictIsRehashing(d)) _dictRehashStep(d); + h = dictHashKey(d, key); + + for (table = 0; table <= 1; table++) { + idx = h & d->ht[table].sizemask; + he = d->ht[table].table[idx]; + prevHe = NULL; + while(he) { + if (dictCompareKeys(d, key, he->key)) { + /* Unlink the element from the list */ + if (prevHe) + prevHe->next = he->next; + else + d->ht[table].table[idx] = he->next; + if (!nofree) { + dictFreeKey(d, he); + dictFreeVal(d, he); + } + free(he); + d->ht[table].used--; + return DICT_OK; + } + prevHe = he; + he = he->next; + } + if (!dictIsRehashing(d)) break; + } + return DICT_ERR; /* not found */ +} + +int dictDelete(dict *ht, const void *key) { + return dictGenericDelete(ht,key,0); +} + +int dictDeleteNoFree(dict *ht, const void *key) { + return dictGenericDelete(ht,key,1); +} + +/* Destroy an entire dictionary */ +int _dictClear(dict *d, dictht *ht) +{ + unsigned long i; + + /* Free all the elements */ + for (i = 0; i < ht->size && ht->used > 0; i++) { + dictEntry *he, *nextHe; + + if ((he = ht->table[i]) == NULL) continue; + while(he) { + nextHe = he->next; + dictFreeKey(d, he); + dictFreeVal(d, he); + free(he); + ht->used--; + he = nextHe; + } + } + /* Free the table and the allocated cache structure */ + free(ht->table); + /* Re-initialize the table */ + _dictReset(ht); + return DICT_OK; /* never fails */ +} + +/* Clear & Release the hash table */ +void dictRelease(dict *d) +{ + _dictClear(d,&d->ht[0]); + _dictClear(d,&d->ht[1]); + free(d); +} + +dictEntry *dictFind(dict *d, const void *key) +{ + dictEntry *he; + unsigned int h, idx, table; + + if (d->ht[0].size == 0) return NULL; /* We don't have a table at all */ + if (dictIsRehashing(d)) _dictRehashStep(d); + h = dictHashKey(d, key); + for (table = 0; table <= 1; table++) { + idx = h & d->ht[table].sizemask; + he = d->ht[table].table[idx]; + while(he) { + if (dictCompareKeys(d, key, he->key)) + return he; + he = he->next; + } + if (!dictIsRehashing(d)) return NULL; + } + return NULL; +} + +void *dictFetchValue(dict *d, const void *key) { + dictEntry *he; + + he = dictFind(d,key); + return he ? dictGetVal(he) : NULL; +} + +dictIterator *dictGetIterator(dict *d) +{ + dictIterator *iter = (dictIterator*)malloc(sizeof(*iter)); + + iter->d = d; + iter->table = 0; + iter->index = -1; + iter->safe = 0; + iter->entry = NULL; + iter->nextEntry = NULL; + return iter; +} + +dictIterator *dictGetSafeIterator(dict *d) { + dictIterator *i = dictGetIterator(d); + + i->safe = 1; + return i; +} + +dictEntry *dictNext(dictIterator *iter) +{ + while (1) { + if (iter->entry == NULL) { + dictht *ht = &iter->d->ht[iter->table]; + if (iter->safe && iter->index == -1 && iter->table == 0) + iter->d->iterators++; + iter->index++; + if (iter->index >= (signed) ht->size) { + if (dictIsRehashing(iter->d) && iter->table == 0) { + iter->table++; + iter->index = 0; + ht = &iter->d->ht[1]; + } else { + break; + } + } + iter->entry = ht->table[iter->index]; + } else { + iter->entry = iter->nextEntry; + } + if (iter->entry) { + /* We need to save the 'next' here, the iterator user + * may delete the entry we are returning. */ + iter->nextEntry = iter->entry->next; + return iter->entry; + } + } + return NULL; +} + +void dictReleaseIterator(dictIterator *iter) +{ + if (iter->safe && !(iter->index == -1 && iter->table == 0)) + iter->d->iterators--; + free(iter); +} + +/* Return a random entry from the hash table. Useful to + * implement randomized algorithms */ +dictEntry *dictGetRandomKey(dict *d) +{ + dictEntry *he, *orighe; + unsigned int h; + int listlen, listele; + + if (dictSize(d) == 0) return NULL; + if (dictIsRehashing(d)) _dictRehashStep(d); + if (dictIsRehashing(d)) { + do { + h = random() % (d->ht[0].size+d->ht[1].size); + he = (h >= d->ht[0].size) ? d->ht[1].table[h - d->ht[0].size] : + d->ht[0].table[h]; + } while(he == NULL); + } else { + do { + h = random() & d->ht[0].sizemask; + he = d->ht[0].table[h]; + } while(he == NULL); + } + + /* Now we found a non empty bucket, but it is a linked + * list and we need to get a random element from the list. + * The only sane way to do so is counting the elements and + * select a random index. */ + listlen = 0; + orighe = he; + while(he) { + he = he->next; + listlen++; + } + listele = random() % listlen; + he = orighe; + while(listele--) he = he->next; + return he; +} + +/* ------------------------- private functions ------------------------------ */ + +/* Expand the hash table if needed */ +static int _dictExpandIfNeeded(dict *d) +{ + /* Incremental rehashing already in progress. Return. */ + if (dictIsRehashing(d)) return DICT_OK; + + /* If the hash table is empty expand it to the initial size. */ + if (d->ht[0].size == 0) return dictExpand(d, DICT_HT_INITIAL_SIZE); + + /* If we reached the 1:1 ratio, and we are allowed to resize the hash + * table (global setting) or we should avoid it but the ratio between + * elements/buckets is over the "safe" threshold, we resize doubling + * the number of buckets. */ + if (d->ht[0].used >= d->ht[0].size && + (dict_can_resize || + d->ht[0].used/d->ht[0].size > dict_force_resize_ratio)) + { + return dictExpand(d, ((d->ht[0].size > d->ht[0].used) ? + d->ht[0].size : d->ht[0].used)*2); + } + return DICT_OK; +} + +/* Our hash table capability is a power of two */ +static unsigned long _dictNextPower(unsigned long size) +{ + unsigned long i = DICT_HT_INITIAL_SIZE; + + if (size >= LONG_MAX) return LONG_MAX; + while(1) { + if (i >= size) + return i; + i *= 2; + } +} + +/* Returns the index of a free slot that can be populated with + * an hash entry for the given 'key'. + * If the key already exists, -1 is returned. + * + * Note that if we are in the process of rehashing the hash table, the + * index is always returned in the context of the second (new) hash table. */ +static int _dictKeyIndex(dict *d, const void *key) +{ + unsigned int h, idx, table; + dictEntry *he; + + /* Expand the hash table if needed */ + if (_dictExpandIfNeeded(d) == DICT_ERR) + return -1; + /* Compute the key hash value */ + h = dictHashKey(d, key); + for (table = 0; table <= 1; table++) { + idx = h & d->ht[table].sizemask; + /* Search if this slot does not already contain the given key */ + he = d->ht[table].table[idx]; + while(he) { + if (dictCompareKeys(d, key, he->key)) + return -1; + he = he->next; + } + if (!dictIsRehashing(d)) break; + } + return idx; +} + +void dictEmpty(dict *d) { + _dictClear(d,&d->ht[0]); + _dictClear(d,&d->ht[1]); + d->rehashidx = -1; + d->iterators = 0; +} + +void dictEnableResize(void) { + dict_can_resize = 1; +} + +void dictDisableResize(void) { + dict_can_resize = 0; +} + +#if 0 + +/* The following is code that we don't use for Redis currently, but that is part +of the library. */ + +/* ----------------------- Debugging ------------------------*/ + +#define DICT_STATS_VECTLEN 50 +static void _dictPrintStatsHt(dictht *ht) { + unsigned long i, slots = 0, chainlen, maxchainlen = 0; + unsigned long totchainlen = 0; + unsigned long clvector[DICT_STATS_VECTLEN]; + + if (ht->used == 0) { + printf("No stats available for empty dictionaries\n"); + return; + } + + for (i = 0; i < DICT_STATS_VECTLEN; i++) clvector[i] = 0; + for (i = 0; i < ht->size; i++) { + dictEntry *he; + + if (ht->table[i] == NULL) { + clvector[0]++; + continue; + } + slots++; + /* For each hash entry on this slot... */ + chainlen = 0; + he = ht->table[i]; + while(he) { + chainlen++; + he = he->next; + } + clvector[(chainlen < DICT_STATS_VECTLEN) ? chainlen : (DICT_STATS_VECTLEN-1)]++; + if (chainlen > maxchainlen) maxchainlen = chainlen; + totchainlen += chainlen; + } + printf("Hash table stats:\n"); + printf(" table size: %ld\n", ht->size); + printf(" number of elements: %ld\n", ht->used); + printf(" different slots: %ld\n", slots); + printf(" max chain length: %ld\n", maxchainlen); + printf(" avg chain length (counted): %.02f\n", (float)totchainlen/slots); + printf(" avg chain length (computed): %.02f\n", (float)ht->used/slots); + printf(" Chain length distribution:\n"); + for (i = 0; i < DICT_STATS_VECTLEN-1; i++) { + if (clvector[i] == 0) continue; + printf(" %s%ld: %ld (%.02f%%)\n",(i == DICT_STATS_VECTLEN-1)?">= ":"", i, clvector[i], ((float)clvector[i]/ht->size)*100); + } +} + +void dictPrintStats(dict *d) { + _dictPrintStatsHt(&d->ht[0]); + if (dictIsRehashing(d)) { + printf("-- Rehashing into ht[1]:\n"); + _dictPrintStatsHt(&d->ht[1]); + } +} + +/* ----------------------- StringCopy Hash Table Type ------------------------*/ +#endif + +static unsigned int _dictStringCopyHTHashFunction(const void *key) +{ + return dictGenHashFunction(key, strlen((const char*)key)); +} + +static void *_dictStringDup(void *privdata, const void *key) +{ + int len = strlen((const char*)key); + char *copy = (char*)malloc(len+1); + DICT_NOTUSED(privdata); + + memcpy(copy, key, len); + copy[len] = '\0'; + return copy; +} + +static int _dictStringCopyHTKeyCompare(void *privdata, const void *key1, + const void *key2) +{ + DICT_NOTUSED(privdata); + + return strcmp((const char*)key1, (const char*)key2) == 0; +} + +static void _dictStringDestructor(void *privdata, void *key) +{ + DICT_NOTUSED(privdata); + + free(key); +} + +dictType dictTypeHeapStringCopyKey = { + _dictStringCopyHTHashFunction, /* hash function */ + _dictStringDup, /* key dup */ + NULL, /* val dup */ + _dictStringCopyHTKeyCompare, /* key compare */ + _dictStringDestructor, /* key destructor */ + NULL /* val destructor */ +}; + +/* This is like StringCopy but does not auto-duplicate the key. + * It's used for intepreter's shared strings. */ +dictType dictTypeHeapStrings = { + _dictStringCopyHTHashFunction, /* hash function */ + NULL, /* key dup */ + NULL, /* val dup */ + _dictStringCopyHTKeyCompare, /* key compare */ + _dictStringDestructor, /* key destructor */ + NULL /* val destructor */ +}; + +/* This is like StringCopy but also automatically handle dynamic + * allocated C strings as values. */ +dictType dictTypeHeapStringCopyKeyValue = { + _dictStringCopyHTHashFunction, /* hash function */ + _dictStringDup, /* key dup */ + _dictStringDup, /* val dup */ + _dictStringCopyHTKeyCompare, /* key compare */ + _dictStringDestructor, /* key destructor */ + _dictStringDestructor, /* val destructor */ +}; diff --git a/1_8.sip_push/nebula_sdk/sdk/dict.h b/1_8.sip_push/nebula_sdk/sdk/dict.h new file mode 100644 index 0000000..3b6393b --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/dict.h @@ -0,0 +1,181 @@ +/* Hash Tables Implementation. + * + * This file implements in-memory hash tables with insert/del/replace/find/ + * get-random-element operations. Hash tables will auto-resize if needed + * tables of power of two in size are used, collisions are handled by + * chaining. See the source code for more information... :) + * + * Copyright (c) 2006-2012, Salvatore Sanfilippo + * All rights reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * * Redistributions of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * * Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. + * * Neither the name of Redis nor the names of its contributors may be used + * to endorse or promote products derived from this software without + * specific prior written permission. + * + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + * AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + * POSSIBILITY OF SUCH DAMAGE. + */ + +#include + +#ifndef __DICT_H +#define __DICT_H + +#ifdef __cplusplus +extern "C" { +#endif + +#define DICT_OK 0 +#define DICT_ERR 1 + +/* Unused arguments generate annoying warnings... */ +#define DICT_NOTUSED(V) ((void) V) + +typedef struct dictEntry { + void *key; + union { + void *val; + uint64_t u64; + int64_t s64; + } v; + struct dictEntry *next; +} dictEntry; + +typedef struct dictType { + unsigned int (*hashFunction)(const void *key); + void *(*keyDup)(void *privdata, const void *key); + void *(*valDup)(void *privdata, const void *obj); + int (*keyCompare)(void *privdata, const void *key1, const void *key2); + void (*keyDestructor)(void *privdata, void *key); + void (*valDestructor)(void *privdata, void *obj); +} dictType; + +/* This is our hash table structure. Every dictionary has two of this as we + * implement incremental rehashing, for the old to the new table. */ +typedef struct dictht { + dictEntry **table; + unsigned long size; + unsigned long sizemask; + unsigned long used; +} dictht; + +typedef struct dict { + dictType *type; + void *privdata; + dictht ht[2]; + int rehashidx; /* rehashing not in progress if rehashidx == -1 */ + int iterators; /* number of iterators currently running */ +} dict; + +/* If safe is set to 1 this is a safe iterator, that means, you can call + * dictAdd, dictFind, and other functions against the dictionary even while + * iterating. Otherwise it is a non safe iterator, and only dictNext() + * should be called while iterating. */ +typedef struct dictIterator { + dict *d; + int table, index, safe; + dictEntry *entry, *nextEntry; +} dictIterator; + +/* This is the initial size of every hash table */ +#define DICT_HT_INITIAL_SIZE 4 + +/* ------------------------------- Macros ------------------------------------*/ +#define dictFreeVal(d, entry) \ + if ((d)->type->valDestructor) \ + (d)->type->valDestructor((d)->privdata, (entry)->v.val) + +#define dictSetVal(d, entry, _val_) do { \ + if ((d)->type->valDup) \ + entry->v.val = (d)->type->valDup((d)->privdata, _val_); \ + else \ + entry->v.val = (_val_); \ +} while(0) + +#define dictSetSignedIntegerVal(entry, _val_) \ + do { entry->v.s64 = _val_; } while(0) + +#define dictSetUnsignedIntegerVal(entry, _val_) \ + do { entry->v.u64 = _val_; } while(0) + +#define dictFreeKey(d, entry) \ + if ((d)->type->keyDestructor) \ + (d)->type->keyDestructor((d)->privdata, (entry)->key) + +#define dictSetKey(d, entry, _key_) do { \ + if ((d)->type->keyDup) \ + entry->key = (d)->type->keyDup((d)->privdata, _key_); \ + else \ + entry->key = (_key_); \ +} while(0) + +#define dictCompareKeys(d, key1, key2) \ + (((d)->type->keyCompare) ? \ + (d)->type->keyCompare((d)->privdata, key1, key2) : \ + (key1) == (key2)) + +#define dictHashKey(d, key) (d)->type->hashFunction(key) +#define dictGetKey(he) ((he)->key) +#define dictGetVal(he) ((he)->v.val) +#define dictGetSignedIntegerVal(he) ((he)->v.s64) +#define dictGetUnsignedIntegerVal(he) ((he)->v.u64) +#define dictSlots(d) ((d)->ht[0].size+(d)->ht[1].size) +#define dictSize(d) ((d)->ht[0].used+(d)->ht[1].used) +#define dictIsRehashing(ht) ((ht)->rehashidx != -1) + +/* API */ +dict *dictCreate(dictType *type, void *privDataPtr); +int dictExpand(dict *d, unsigned long size); +int dictAdd(dict *d, void *key, void *val); +dictEntry *dictAddRaw(dict *d, void *key); +int dictReplace(dict *d, void *key, void *val); +dictEntry *dictReplaceRaw(dict *d, void *key); +int dictDelete(dict *d, const void *key); +int dictDeleteNoFree(dict *d, const void *key); +void dictRelease(dict *d); +dictEntry * dictFind(dict *d, const void *key); +void *dictFetchValue(dict *d, const void *key); +int dictResize(dict *d); +dictIterator *dictGetIterator(dict *d); +dictIterator *dictGetSafeIterator(dict *d); +dictEntry *dictNext(dictIterator *iter); +void dictReleaseIterator(dictIterator *iter); +dictEntry *dictGetRandomKey(dict *d); +void dictPrintStats(dict *d); +unsigned int dictGenHashFunction(const void *key, int len); +unsigned int dictGenCaseHashFunction(const unsigned char *buf, int len); +void dictEmpty(dict *d); +void dictEnableResize(void); +void dictDisableResize(void); +int dictRehash(dict *d, int n); +int dictRehashMilliseconds(dict *d, int ms); +void dictSetHashFunctionSeed(unsigned int initval); +unsigned int dictGetHashFunctionSeed(void); + +/* Hash table types */ +extern dictType dictTypeHeapStringCopyKey; +extern dictType dictTypeHeapStrings; +extern dictType dictTypeHeapStringCopyKeyValue; + +#ifdef __cplusplus +} +#endif + +#endif /* __DICT_H */ diff --git a/1_8.sip_push/nebula_sdk/sdk/dict.o b/1_8.sip_push/nebula_sdk/sdk/dict.o new file mode 100644 index 0000000..55d874a Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/dict.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/libnebula_sdk.so b/1_8.sip_push/nebula_sdk/sdk/libnebula_sdk.so new file mode 100755 index 0000000..15d51ad Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/libnebula_sdk.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/libs/libcrypto_framwork.a b/1_8.sip_push/nebula_sdk/sdk/libs/libcrypto_framwork.a new file mode 100644 index 0000000..7557f41 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/libs/libcrypto_framwork.a differ diff --git a/1_8.sip_push/nebula_sdk/sdk/libs/libjson-c.so b/1_8.sip_push/nebula_sdk/sdk/libs/libjson-c.so new file mode 100755 index 0000000..2a5ccfe Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/libs/libjson-c.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/libs/libprotobuf-c.so b/1_8.sip_push/nebula_sdk/sdk/libs/libprotobuf-c.so new file mode 100755 index 0000000..99a558b Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/libs/libprotobuf-c.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/libs/libsnappy.so b/1_8.sip_push/nebula_sdk/sdk/libs/libsnappy.so new file mode 100755 index 0000000..40fbb24 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/libs/libsnappy.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/libs/libuuid.so b/1_8.sip_push/nebula_sdk/sdk/libs/libuuid.so new file mode 100755 index 0000000..1763c2f Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/libs/libuuid.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/list.c b/1_8.sip_push/nebula_sdk/sdk/list.c new file mode 100644 index 0000000..30c4528 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/list.c @@ -0,0 +1,156 @@ +#include "list.h" +#include +#include + +List* CreateList() +{ + List *list = (List*)malloc(sizeof(List)); + if (NULL == list) return NULL; + + list->head = list->tail = NULL; + list->size = 0; + return list; +} + +void DestroyList(List* list) +{ + ClearList(list); + free(list); +} + +void ClearList(List* list) +{ + Node *pos = list->head; + while (NULL != pos) + { + Node *old = pos; + pos = pos->next; + free(old->data); + free(old); + } + list->head = list->tail = NULL; + list->size = 0; +} + +int PushBack(List* list, void* data) +{ + if (NULL == list->tail) { + list->head = list->tail = (Node*)malloc(sizeof(Node)); + if (!list->tail) + return -1; + + list->tail->next = list->tail->prev = NULL; + list->tail->data = data; + ++list->size; + return 0; + } + + Node *newNode = (Node*)malloc(sizeof(Node)); + if (!newNode) + return -1; + + newNode->data = data; + newNode->next = NULL; + newNode->prev = list->tail; + list->tail->next = newNode; + list->tail = newNode; + ++list->size; + return 0; +} + +int PushFront(List* list, void* data) +{ + if (NULL == list->head) { + list->head = list->tail = (Node*)malloc(sizeof(Node)); + if (!list->tail) + return -1; + + list->tail->next = list->tail->prev = NULL; + list->tail->data = data; + ++list->size; + return 0; + } + + Node *newNode = (Node*)malloc(sizeof(Node)); + if (!newNode) + return -1; + + newNode->data = data; + newNode->next = list->head; + newNode->prev = NULL; + list->head->prev = newNode; + list->head = newNode; + ++list->size; + return 0; +} + +void PopBack(List* list) +{ + if (0 == list->size) return ; + --list->size; + + if (list->head == list->tail) { + ClearList(list); + return ; + } + + free(list->tail->data); + list->tail = list->tail->prev; + free(list->tail->next); + list->tail->next = NULL; +} + +void PopFront(List* list) +{ + if (0 == list->size) return ; + --list->size; + + if (list->head == list->tail) { + ClearList(list); + return ; + } + + free(list->head->data); + list->head = list->head->next; + free(list->head->prev); + list->head->prev = NULL; +} + + +void* Back(List* list) +{ + if (0 == list->size) return NULL; + return list->tail->data; +} + +void* Front(List* list) +{ + if (0 == list->size) return NULL; + return list->head->data; +} + +ListIterator ListBegin(List* list) +{ + if (!list->head) return NULL; + return &list->head->data; +} + +ListIterator ListNext(ListIterator itr) +{ + if (!itr) return NULL; + Node *node = (Node*)itr; + if (!node->next) return NULL; + return &node->next->data; +} + +int Accumulate(List* list, int(*pred)(void* data)) +{ + int result = 0; + Node *pos = list->head; + while (pos) { + result += pred(pos->data); + pos = pos->next; + } + return result; +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/list.h b/1_8.sip_push/nebula_sdk/sdk/list.h new file mode 100644 index 0000000..56dfef4 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/list.h @@ -0,0 +1,34 @@ +#ifndef __ASYNC_FCGI_LIST__ +#define __ASYNC_FCGI_LIST__ + +typedef struct Node { + void *data; + struct Node *prev; + struct Node *next; +} Node; + +typedef struct List { + Node *head; + Node *tail; + unsigned long size; +} List; + +List* CreateList(); +void DestroyList(List* list); +void ClearList(List* list); +int PushBack(List* list, void* data); +int PushFront(List* list, void* data); +void PopBack(List* list); +void PopFront(List* list); +void* Back(List* list); +void* Front(List* list); + +// iterator +typedef void** ListIterator; +ListIterator ListBegin(List* list); +ListIterator ListNext(ListIterator itr); + +// algorithm +int Accumulate(List* list, int(*pred)(void* data)); + +#endif //__ASYNC_FCGI_LIST__ diff --git a/1_8.sip_push/nebula_sdk/sdk/list.o b/1_8.sip_push/nebula_sdk/sdk/list.o new file mode 100644 index 0000000..c04082e Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/list.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/logger.c b/1_8.sip_push/nebula_sdk/sdk/logger.c new file mode 100644 index 0000000..f88d829 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/logger.c @@ -0,0 +1,132 @@ +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "logger.h" + +#define MIN(a, b) ((a) < (b) ? (a) : (b)) +#define MAX(a, b) ((a) > (b) ? (a) : (b)) + +#ifndef LOG_MAX_LEN +#define LOG_MAX_LEN 8192 +#endif + +typedef struct logger_t { + int fd; + int level; + char* name; +}logger_t; + +logger_t logger = {STDERR_FILENO, LOG_LEVEL_VERB, NULL}; + +static const char* strlevel[] = { + "ERROR", + "WARN", + "NOTICE", + "INFO", + "DEBUG", + "VERB" +}; + +void log_init(logger_t *log, const char* name, int level) +{ + log->level = MAX(LOG_LEVEL_ERR, MIN(level, LOG_LEVEL_VERB)); + if(name == NULL || *name == '\0'){ + log->fd = STDERR_FILENO; + }else{ + log->name = strdup(name); + if(log->name == NULL) { + log->fd = STDERR_FILENO; + return; + } + log->fd = open(name, O_WRONLY | O_APPEND | O_CREAT, 0644); + if(log->fd < 0 ) { + log->fd = STDERR_FILENO; + } + } +} + +void log_deinit(logger_t *log) +{ + if(log->fd > 0 && log->fd != STDERR_FILENO) + close(log->fd); + if(log->name) + free(log->name); +} + +void log_write(logger_t *log, int level, const char *file, int line, const char* func, const char *fmt, ...) +{ + struct tm local; + struct timeval tv; + va_list args; + int len; + char buffer[LOG_MAX_LEN]; + + gettimeofday(&tv, NULL); + localtime_r(&tv.tv_sec, &local); + + level = MAX(LOG_LEVEL_ERR, MIN(level, LOG_LEVEL_VERB)); + + len = snprintf(buffer, sizeof(buffer), "[%04d-%02d-%02d %02d:%02d:%02d.%06lu]|" + "%s|%s:%d:(%s):", local.tm_year+1900, local.tm_mon+1, local.tm_mday, + local.tm_hour, local.tm_min, local.tm_sec, tv.tv_usec, + strlevel[level], file, line, func); + + if(len < LOG_MAX_LEN - 1){ + va_start(args, fmt); + len += vsnprintf(buffer + len, LOG_MAX_LEN-len, fmt, args); + va_end(args); + len = (len >= LOG_MAX_LEN ? LOG_MAX_LEN - 1 : len); + }else{ + len = LOG_MAX_LEN - 1; + } + buffer[len++] = '\n'; + len = write(log->fd, buffer, len); + (void)len; +} + +int log_loggable(logger_t *log, int level) +{ + if(level > log->level || level < 0) + return 0; + return 1; +} + +void log_level_set(logger_t *log, int level) +{ + log->level = MAX(LOG_LEVEL_ERR, MIN(level, LOG_LEVEL_VERB)); +} + +void log_reopen(logger_t *log) +{ + if(log->fd > 0 && log->fd != STDERR_FILENO){ + close(log->fd); + log->fd = open(log->name, O_WRONLY | O_APPEND | O_CREAT, 0644); + if(log->fd < 0) { + log->fd = STDERR_FILENO; + } + } + + return; +} + +void log_level_up(logger_t *log) +{ + if(log->level < LOG_LEVEL_VERB) + log->level++; +} + +void log_level_down(logger_t *log) +{ + if(log->level > LOG_LEVEL_ERR) + log->level--; +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/logger.h b/1_8.sip_push/nebula_sdk/sdk/logger.h new file mode 100644 index 0000000..bb792af --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/logger.h @@ -0,0 +1,111 @@ +/* + * ===================================================================================== + * + * Filename: logger.h + * + * Description: 日志接口 + * + * Version: 1.0 + * Created: 2013年08月20日 20时09分00秒 + * Revision: none + * Compiler: gcc + * + * Author: xiaoboyu, + * Organization: + * + * ===================================================================================== + */ +#ifndef __LOGGER_H__ +#define __LOGGER_H__ + +#ifdef __cplusplus +extern "C" { +#endif + +enum LogLevelTypes //日志分级 +{ + LOG_LEVEL_ERR, /* error conditions */ + LOG_LEVEL_WARN, /* warning conditions */ + LOG_LEVEL_NOTICE, + LOG_LEVEL_INFO, + LOG_LEVEL_DEBUG, + LOG_LEVEL_VERB +}; + +typedef struct logger_t logger_t; + +extern logger_t logger; + +#define log_error(fmt, ...) \ + do{ \ + if(log_loggable(&logger, LOG_LEVEL_ERR)){ \ + log_write(&logger, LOG_LEVEL_ERR, __FILE__, __LINE__, __FUNCTION__, \ + fmt, ## __VA_ARGS__); \ + } \ + } while(0) +#define log_warn(fmt, ...) \ + do{ \ + if(log_loggable(&logger, LOG_LEVEL_WARN)){ \ + log_write(&logger, LOG_LEVEL_WARN, __FILE__, __LINE__, __FUNCTION__, \ + fmt, ## __VA_ARGS__); \ + } \ + } while(0) + +#define log_notice(fmt, ...) \ + do{ \ + if(log_loggable(&logger, LOG_LEVEL_NOTICE)){ \ + log_write(&logger, LOG_LEVEL_NOTICE, __FILE__, __LINE__, __FUNCTION__, \ + fmt, ## __VA_ARGS__); \ + } \ + } while(0) + +#define log_info(fmt, ...) \ + do{ \ + if(log_loggable(&logger, LOG_LEVEL_INFO)){ \ + log_write(&logger, LOG_LEVEL_INFO, __FILE__, __LINE__, __FUNCTION__, \ + fmt, ## __VA_ARGS__); \ + } \ + } while(0) + +#define log_debug(fmt, ...) \ + do{ \ + if(log_loggable(&logger, LOG_LEVEL_DEBUG)){ \ + log_write(&logger, LOG_LEVEL_DEBUG, __FILE__, __LINE__, __FUNCTION__, \ + fmt, ## __VA_ARGS__); \ + } \ + } while(0) + +#define log_verb(fmt, ...) \ + do{ \ + if(log_loggable(&logger, LOG_LEVEL_VERB)){ \ + log_write(&logger, LOG_LEVEL_VERB, __FILE__, __LINE__, __FUNCTION__, \ + fmt, ## __VA_ARGS__); \ + } \ + } while(0) + +void log_init(logger_t *log, const char *name, int level); + +void log_deinit(logger_t *log); +/* + * @brief 设置log的级别 + */ +void log_level_set(logger_t *log, int level); + +void log_reopen(logger_t *log); + +void log_level_up(logger_t *log); + +void log_level_down(logger_t *log); + +int log_loggable(logger_t *log, int level); + +void log_write(logger_t *log, int level, + const char *file, int line, + const char* func, const char *fmt, ...) + __attribute__((format(printf, 6, 7))); + +#ifdef __cplusplus +} +#endif +#endif // ~LOGGER_H_201106241335 + diff --git a/1_8.sip_push/nebula_sdk/sdk/logger.o b/1_8.sip_push/nebula_sdk/sdk/logger.o new file mode 100644 index 0000000..5836a3c Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/logger.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula.log b/1_8.sip_push/nebula_sdk/sdk/nebula.log new file mode 100644 index 0000000..da84375 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula.log @@ -0,0 +1,84 @@ +[2015-04-25 16:56:36.580062]|WARN|archive.c:61:(LoadFromFile):not found archive file:data, please confirm SDK is first startup. +[2015-04-25 16:56:36.581785]|INFO|config.c:68:(next_status):set status to eStatus_Redirect +[2015-04-25 16:56:36.612831]|INFO|redirect.c:72:(NebulaRedirect):HTTPS POST. url=https://172.16.82.71/push/redirect, params=uid=1000000010000001&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1429952196&sign=ee056e8ea53f7f34133acd13e9996db9 +[2015-04-25 16:56:36.627771]|INFO|redirect.c:79:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"172.16.82.71","port":8080}],"md5_daa":{"rule":"ssh","salt":"helloworld123"}} + +[2015-04-25 16:56:36.627834]|INFO|config.c:68:(next_status):set status to eStatus_LoopTest +[2015-04-25 16:56:36.658189]|INFO|config.c:68:(next_status):set status to eStatus_Connect +[2015-04-25 16:56:36.689965]|INFO|connect.c:147:(NebulaConnect):connect to server:172.16.82.71:8080 +[2015-04-25 16:56:36.690038]|INFO|config.c:68:(next_status):set status to eStatus_Connecting +[2015-04-25 16:56:36.690781]|INFO|connect.c:27:(__on_connect):connect success, server_addr:172.16.82.71:8080 +[2015-04-25 16:56:36.690820]|INFO|config.c:68:(next_status):set status to eStatus_Auth1 +[2015-04-25 16:56:36.691082]|DEBUG|connect.c:173:(NebulaSend):NEBULA TX REQ AUTH|0 +[2015-04-25 16:56:36.691119]|INFO|config.c:68:(next_status):set status to eStatus_Auth2 +[2015-04-25 16:56:51.803531]|WARN|archive.c:61:(LoadFromFile):not found archive file:data, please confirm SDK is first startup. +[2015-04-25 16:56:51.805066]|INFO|config.c:68:(next_status):set status to eStatus_Redirect +[2015-04-25 16:56:51.846343]|INFO|redirect.c:72:(NebulaRedirect):HTTPS POST. url=https://172.16.82.71/push/redirect, params=uid=1000000010000001&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1429952211&sign=9c3a7e4b592185d7caca49bf5edde4ed +[2015-04-25 16:56:51.883981]|INFO|redirect.c:79:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"172.16.82.71","port":8080}],"md5_daa":{"rule":"ssh","salt":"helloworld123"}} + +[2015-04-25 16:56:51.884123]|INFO|config.c:68:(next_status):set status to eStatus_LoopTest +[2015-04-25 16:56:51.918477]|INFO|config.c:68:(next_status):set status to eStatus_Connect +[2015-04-25 16:56:51.950683]|INFO|connect.c:147:(NebulaConnect):connect to server:172.16.82.71:8080 +[2015-04-25 16:56:51.950752]|INFO|config.c:68:(next_status):set status to eStatus_Connecting +[2015-04-25 16:57:26.466943]|INFO|connect.c:27:(__on_connect):connect success, server_addr:172.16.82.71:8080 +[2015-04-25 16:57:26.467027]|INFO|config.c:68:(next_status):set status to eStatus_Auth1 +[2015-04-25 16:57:26.467247]|DEBUG|connect.c:173:(NebulaSend):NEBULA TX REQ AUTH|0 +[2015-04-25 16:57:26.467282]|INFO|config.c:68:(next_status):set status to eStatus_Auth2 +[2015-04-25 16:58:47.906217]|WARN|archive.c:61:(LoadFromFile):not found archive file:data, please confirm SDK is first startup. +[2015-04-25 16:58:47.910534]|INFO|config.c:68:(next_status):set status to eStatus_Redirect +[2015-04-25 16:58:47.946543]|INFO|redirect.c:72:(NebulaRedirect):HTTPS POST. url=https://172.16.82.71/push/redirect, params=uid=1000000010000001&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1429952327&sign=169862755b312f589844a5a00068758e +[2015-04-25 16:58:47.981548]|INFO|redirect.c:79:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"172.16.82.71","port":8080}],"md5_daa":{"rule":"ssh","salt":"helloworld123"}} + +[2015-04-25 16:58:47.981695]|INFO|config.c:68:(next_status):set status to eStatus_LoopTest +[2015-04-25 16:58:48.002549]|INFO|config.c:68:(next_status):set status to eStatus_Connect +[2015-04-25 16:58:48.034797]|INFO|connect.c:147:(NebulaConnect):connect to server:172.16.82.71:8080 +[2015-04-25 16:58:48.034868]|INFO|config.c:68:(next_status):set status to eStatus_Connecting +[2015-04-25 16:58:50.241148]|INFO|connect.c:27:(__on_connect):connect success, server_addr:172.16.82.71:8080 +[2015-04-25 16:58:50.241215]|INFO|config.c:68:(next_status):set status to eStatus_Auth1 +[2015-04-25 16:58:50.241412]|DEBUG|connect.c:173:(NebulaSend):NEBULA TX REQ AUTH|0 +[2015-04-25 16:58:50.241477]|INFO|config.c:68:(next_status):set status to eStatus_Auth2 +[2015-04-25 17:13:02.157390]|WARN|archive.c:61:(LoadFromFile):not found archive file:data, please confirm SDK is first startup. +[2015-04-25 17:13:02.159225]|INFO|config.c:68:(next_status):set status to eStatus_Redirect +[2015-04-25 17:13:02.200990]|INFO|redirect.c:72:(NebulaRedirect):HTTPS POST. url=https://172.16.82.71/push/redirect, params=uid=1000000010000001&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1429953182&sign=229164191ed48bd6addc3c08a5c2b830 +[2015-04-25 17:13:02.237796]|INFO|redirect.c:79:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"172.16.82.71","port":8080}],"md5_daa":{"rule":"ssh","salt":"helloworld123"}} + +[2015-04-25 17:13:02.237916]|INFO|config.c:68:(next_status):set status to eStatus_LoopTest +[2015-04-25 17:13:02.272535]|INFO|config.c:68:(next_status):set status to eStatus_Connect +[2015-04-25 17:13:02.304833]|INFO|connect.c:148:(NebulaConnect):connect to server:172.16.82.71:8080 +[2015-04-25 17:13:02.304906]|INFO|config.c:68:(next_status):set status to eStatus_Connecting +[2015-04-25 17:13:02.305742]|INFO|connect.c:27:(__on_connect):connect success, server_addr:172.16.82.71:8080 +[2015-04-25 17:13:02.305792]|INFO|config.c:68:(next_status):set status to eStatus_Auth1 +[2015-04-25 17:13:02.305981]|DEBUG|connect.c:174:(NebulaSend):NEBULA TX REQ AUTH|0 +[2015-04-25 17:13:02.306013]|INFO|config.c:68:(next_status):set status to eStatus_Auth2 +[2015-04-25 17:13:44.769793]|WARN|archive.c:61:(LoadFromFile):not found archive file:data, please confirm SDK is first startup. +[2015-04-25 17:13:44.771566]|INFO|config.c:68:(next_status):set status to eStatus_Redirect +[2015-04-25 17:13:44.798173]|INFO|redirect.c:72:(NebulaRedirect):HTTPS POST. url=https://172.16.82.71/push/redirect, params=uid=1000000010000001&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1429953224&sign=12a08c8573a1b13cad7ee51a56bacc01 +[2015-04-25 17:13:44.812564]|INFO|redirect.c:79:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"172.16.82.71","port":8080}],"md5_daa":{"rule":"ssh","salt":"helloworld123"}} + +[2015-04-25 17:13:44.812632]|INFO|config.c:68:(next_status):set status to eStatus_LoopTest +[2015-04-25 17:13:44.832927]|INFO|config.c:68:(next_status):set status to eStatus_Connect +[2015-04-30 11:53:58.699321]|WARN|archive.c:74:(LoadFromFile):not found archive file:data, please confirm SDK is first startup. +[2015-04-30 11:53:58.701844]|INFO|nebula_sdk.c:94:(__NebulaStart):set status to eStatus_Redirect +[2015-04-30 11:53:58.724325]|INFO|redirect.c:119:(NebulaRedirect):HTTPS POST. url=https://172.16.82.71/push/redirect, params=uid=1000000010000001&nonce=y9757acx1eve7nmoigsz8fxqqqvjj&ts=1430366038&sign=fd29cab41606e0ebd8a8abd8cf494d47 +[2015-04-30 11:53:58.747141]|INFO|redirect.c:126:(NebulaRedirect):curl_easy_perform success. response={"code":200,"hostlist":[{"ip":"172.16.82.71","port":8080}],"md5_daa":{"rule":"ssh","salt":"helloworld123"}} + +[2015-04-30 11:53:58.747230]|INFO|nebula_sdk.c:99:(__NebulaStart):set status to eStatus_LoopTest +[2015-04-30 11:53:58.767990]|INFO|nebula_sdk.c:107:(__NebulaStart):set status to eStatus_Connect +[2015-04-30 11:53:58.789117]|INFO|connect.c:159:(NebulaConnect):connect to server:172.16.82.71:8080 +[2015-04-30 11:53:58.789144]|INFO|nebula_sdk.c:112:(__NebulaStart):set status to eStatus_Connecting +[2015-04-30 11:53:58.789429]|INFO|connect.c:31:(__on_connect):connect success, server_addr:172.16.82.71:8080 +[2015-04-30 11:53:58.789442]|INFO|connect.c:34:(__on_connect):set status to eStatus_Auth1 +[2015-04-30 11:53:58.789509]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ AUTH|64 +[2015-04-30 11:53:58.789517]|INFO|nebula_sdk.c:124:(__NebulaStart):set status to eStatus_Auth1_Waiting +[2015-04-30 11:53:58.790345]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP AUTH|107 +[2015-04-30 11:53:58.790382]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ AUTH|142 +[2015-04-30 11:53:58.790389]|INFO|auth.c:107:(OnAuth):set status to eStatus_Auth2 +[2015-04-30 11:53:58.791374]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP AUTH|31 +[2015-04-30 11:53:58.791443]|INFO|auth.c:44:(OnAuth):set status to eStatus_Sub +[2015-04-30 11:53:58.791486]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ SUB|45 +[2015-04-30 11:53:58.795115]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP SUB|77 +[2015-04-30 11:53:58.795171]|INFO|subscribe.c:43:(OnSubSuccess):sub com.meizu.cloud success. +[2015-04-30 11:53:58.795188]|INFO|nebula_sdk.c:138:(__NebulaStart):set status to eStatus_Estab +[2015-04-30 11:53:58.983986]|DEBUG|net.c:143:(NebulaConnSend):NEBULA TX REQ PING|0 +[2015-04-30 11:53:58.985083]|DEBUG|connect.c:46:(__handle_message):NEBULA RX RSP PING|0 +[2015-04-30 11:53:58.985108]|DEBUG|connect.c:49:(__handle_message):pong. diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.c b/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.c new file mode 100644 index 0000000..a63f640 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.c @@ -0,0 +1,67 @@ +#include "nebula_compress_uncompress_wrapper.h" +#include +#include + +int NebulaCompress(uint8_t type, const char* src, uint32_t src_len, + char *dst, uint32_t *dst_len) +{ + int res; + size_t _src_len = (size_t)src_len; + size_t _dst_len = (size_t)*dst_len; + + switch(type) { + case 1: + if (Z_OK != compress((uint8_t*)dst, &_dst_len, (uint8_t*)src, _src_len)) { + res = -1; + }else{ + res = 0; + *dst_len = (uint32_t)_dst_len; + } + break; + case 2: + if (0 != snappy_compress(src, _src_len, dst, &_dst_len)) { + res = -1; + }else{ + res = 0; + *dst_len = (uint32_t)_dst_len; + } + break; + default: + res = -1; + break; + } + + return res; +} + +int NebulaUnCompress(uint8_t type, const char* src, uint32_t src_len, + char *dst, uint32_t *dst_len) +{ + int res; + size_t _src_len = (size_t)src_len; + size_t _dst_len = (size_t)*dst_len; + + switch(type) { + case 1: + if (Z_OK != uncompress((uint8_t*)dst, &_dst_len, (uint8_t*)src, _src_len)) { + res = -1; + }else{ + res = 0; + *dst_len = (uint32_t)_dst_len; + } + break; + case 2: + if (0 != snappy_uncompress(src, _src_len, dst, &_dst_len)) { + res = -1; + }else{ + res = 0; + *dst_len = (uint32_t)_dst_len; + } + break; + default: + res = -1; + break; + } + return res; +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.h b/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.h new file mode 100644 index 0000000..8a1f13a --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.h @@ -0,0 +1,20 @@ +/****************************************************************************** + * FileName: nebula_compress_uncompress_wrapper.h + * Description: 压缩和解压缩 + * Version: 1.0 + * History: + * yuxiaobo 2015-01-20 1.0 created + * + *****************************************************************************/ +#ifndef __NEBULA_COMPRESS_UNCOMPRESS_H__ +#define __NEBULA_COMPRESS_UNCOMPRESS_H__ +#include + +int NebulaCompress(uint8_t type, const char* src, uint32_t src_len, + char *dst, uint32_t *dst_len); + +int NebulaUnCompress(uint8_t type, const char* src, uint32_t src_len, + char *dst, uint32_t *dst_len); + +#endif + diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.o b/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.o new file mode 100644 index 0000000..00d862d Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/nebula_compress_uncompress_wrapper.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.c b/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.c new file mode 100644 index 0000000..9445b14 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.c @@ -0,0 +1,58 @@ +#include "nebula_encrypt_decrypt_wrapper.h" +#include "crypto_framwork.h" + +int NebulaEncrypt(uint8_t type, const char *key, uint32_t key_len, + const char *src, uint32_t src_len, + char *dst, uint32_t* len) +{ + int res; + switch (type) { + case 1: + res = CRYPTO_encrypt_without_key((const uint8_t*)src, src_len, (uint8_t*)dst, len); + break; + case 2: + res = CRYPTO1_encrypt((uint8_t*)key, key_len, (const uint8_t*)src, + src_len, (uint8_t*)dst, len); + break; + case 3: + res = CRYPTO2_encrypt((uint8_t*)key, key_len, (const uint8_t*)src, + src_len, (uint8_t*)dst, len); + break; + case 4: + res = CRYPTO3_encrypt((uint8_t*)key, key_len, (const uint8_t*)src, + src_len, (uint8_t*)dst, len); + break; + default: + res = -1; + break; + } + return res; +} + +int NebulaDecrypt(uint8_t type, const char *key, uint32_t key_len, + const char *src, uint32_t src_len, + char *dst, uint32_t* len) +{ + int res; + switch (type) { + case 1: + res = CRYPTO_decrypt_without_key((const uint8_t*)src, src_len, (uint8_t*)dst, len); + break; + case 2: + res = CRYPTO1_decrypt((uint8_t*)key, key_len, (const uint8_t*)src, + src_len, (uint8_t*)dst, len); + break; + case 3: + res = CRYPTO2_decrypt((uint8_t*)key, key_len, (const uint8_t*)src, + src_len, (uint8_t*)dst, len); + break; + case 4: + res = CRYPTO3_decrypt((uint8_t*)key, key_len, (const uint8_t*)src, + src_len, (uint8_t*)dst, len); + break; + default: + res = -1; + break; + } + return res; +} diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.h b/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.h new file mode 100644 index 0000000..52d68be --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.h @@ -0,0 +1,30 @@ +/****************************************************************************** + * FileName: + * Description: + * Version: + * History: + * yuxiaobo 2014-12-25 1.0 created + * + *****************************************************************************/ +#ifndef __NEBULA_ENCRYPT_DECRYPT_WRAPPER_H__ +#define __NEBULA_ENCRYPT_DECRYPT_WRAPPER_H__ +#include + +/* + * 消息加密接口 + * @param type 加密类型 + * @param key 加密需要的key + * @param src 加密的原始数据 + * @param dst 加密的结果数据 + * @param len 加密后的数据长度 + * @return 0 成功 其他 失败 + */ +int NebulaEncrypt(uint8_t type, const char *key, uint32_t key_len, + const char *src, uint32_t src_len, + char *dst, uint32_t* len); + +int NebulaDecrypt(uint8_t type, const char *key, uint32_t key_len, + const char *src, uint32_t src_len, + char *dst, uint32_t* len); + +#endif diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.o b/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.o new file mode 100644 index 0000000..b8af840 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/nebula_encrypt_decrypt_wrapper.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.c b/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.c new file mode 100644 index 0000000..7ebac3f --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.c @@ -0,0 +1,168 @@ +#include "nebula_sdk.h" +#include +#include +#include +#include "string.h" +#include +#include +#include +#include +#include "timer.h" +#include "str.h" +#include "logger.h" +#include "list.h" +#include "config.h" +#include "redirect.h" +#include "auth.h" +#include "subscribe.h" +#include "push.h" +#include "archive.h" +#include +#include "connect.h" +#include "net.h" + +char* g_device_tag = NULL; +char* g_nebula_host = NULL; +NebulaMsgCallback g_nebula_cb[eNebulaMsg_Max] = {}; +char* g_storage_file = NULL; +int g_started = 0; +timer_heap_t *g_timer; +List *g_server_list; +int g_sub_app_count = 0; +char** g_sub_apps = NULL; + +int NebulaInit(const char* device_tag, const char* host, const char* file) +{ + if (!g_timer) + g_timer = timer_heap_create(1024); + + if (!g_server_list) + g_server_list = CreateList(); + + if (!device_tag || !host || !file) return -1; + if (!*device_tag || !*host || !*file) return -1; + g_device_tag = strdup(device_tag); + g_nebula_host = strdup(host); + g_storage_file = strdup(file); + + log_init(&logger, "nebula.log", 4); + + if (-1 == NebulaInitPush()) { + return -1; + } + + if (-1 == NebulaLoadFromFile(g_storage_file)) { + log_warn("load archive file failed..."); + return 0; + } + + return 0; +} + +void NebulaSubScribe(int count, const char** app_name) +{ + int i; + if (g_sub_app_count) { + for (i = 0; i < g_sub_app_count; ++i) { + free(g_sub_apps[i]); + } + free(g_sub_apps); + } + + g_sub_app_count = count; + g_sub_apps = (char**)malloc(sizeof(char*) * g_sub_app_count); + for (i = 0; i < g_sub_app_count; ++i) { + g_sub_apps[i] = strdup(app_name[i]); + } +} + +NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb) +{ + NebulaMsgCallback old = g_nebula_cb[type]; + g_nebula_cb[type] = cb; + return old; +} + +void* __NebulaStart(void* ptr) +{ + (void)ptr; + + NebulaInitAutoSave(); + + for (;;) { + switch (Nebulaget_status()) { + case eStatus_Init: + next_status(); + break; + + case eStatus_Redirect: + if (0 == NebulaRedirect()) { + next_status(); + } else { + log_info("sleep 10 seconds, delay retry redirect."); + sleep(10); + } + break; + + case eStatus_LoopTest: + next_status(); + break; + + case eStatus_Connect: + if (0 == NebulaConnect()) { + next_status(); + } + break; + + case eStatus_Connecting: + // nothing to do. + break; + + case eStatus_Auth1: + if (-1 == NebulaAuth1()) { + jump_status(eStatus_Redirect); + } else { + next_status(); + } + break; + + case eStatus_Auth1_Waiting: + // nothing to do. + break; + + case eStatus_Auth2: + // nothing to do. + break; + + case eStatus_Sub: + if (0 == subscribe_loop()) { + next_status(); + } + break; + + case eStatus_Estab: + // nothing to do. Looping... + break; + } + + timer_run(g_timer); + NebulaConnLoop(); + } + + return NULL; +} + +int NebulaStart() +{ + if (g_started) return -1; + + pthread_t pt; + int ret = pthread_create(&pt, NULL, __NebulaStart, NULL); + if (ret == 0) { + g_started = 1; + return 0; + } + + return ret; +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.h b/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.h new file mode 100644 index 0000000..480d40b --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.h @@ -0,0 +1,56 @@ +#ifndef NEBULA_SDK_H +#define NEBULA_SDK_H + +typedef enum { + eNebulaMsg_Push, /// 推送 (路由器只需关心这一类消息) + eNebulaMsg_Presence, /// Presence + eNebulaMsg_Sms, /// 网络短信 + eNebulaMsg_Mms, /// 网络彩信 + eNebulaMsg_Max, +} NebulaMsgType; + +#ifdef __cplusplus +extern "C" { +#endif + + /** 初始化网络连接 + * @device_tag: 硬件信息 (手机端为IMEI) + * @verify_pwd: 鉴权密码 (手机端为SN) + * @host: 服务端域名, 例如: https://p.meizu.com (结尾不要带"/", 前面要加上https) + * @file: 用于读取/存储持久化数据的文件名, 要求目录存在, 且有创建文件权限。 + * @return: 如果文件打开成功, 返回0; 否则返回-1, 文件打开失败原因记录在错误码errno中. + * @只能调用一次, 重复调用无效并返回-1. + */ + int NebulaInit(const char* device_tag, const char* host, const char* file); + + /** 设置订阅列表 + * + * + */ + void NebulaSubScribe(int count, const char** app_name); + + /** 消息处理回调函数 + * @data: 数据块起始指针 + * @len: 数据块长度 + */ + typedef void (*NebulaMsgCallback)(const char* data, int len); + + /** 注册消息处理回调函数 + * @type: 消息类型 + * @cb: 回调函数 + * @return: 旧的回调函数 + * @一次只能注册一个回调函数, 重复注册会覆盖. + */ + NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb); + + /** 启动 + * + */ + int NebulaStart(); + +#ifdef __cplusplus +} +#endif + +#endif //NEBULA_SDK_H + diff --git a/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.o b/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.o new file mode 100644 index 0000000..f6eca6a Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/nebula_sdk.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/net.c b/1_8.sip_push/nebula_sdk/sdk/net.c new file mode 100644 index 0000000..cfe30fd --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/net.c @@ -0,0 +1,333 @@ +#include "net.h" +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include +#include "logger.h" + +#define EPOLL_SIZE 32 +int g_epollfd = -1; + +struct _NebulaBuf +{ + int len; + int pos; + char buf[0]; +}; +typedef struct _NebulaBuf NebulaBuf; + +static int __read(Conn* conn); +static int __write(Conn* conn); +static void __err(Conn* conn); + +Conn* NebulaConnCreate() +{ + if (g_epollfd == -1) { + g_epollfd = epoll_create(EPOLL_SIZE); + if (g_epollfd == -1) return NULL; + } + + Conn* conn = (Conn*)malloc(sizeof(Conn)); + memset(conn, 0, sizeof(Conn)); + conn->read = __read; + conn->write = __write; + conn->err = __err; + conn->send_list = CreateList(); + if (-1 == pthread_mutex_init(&conn->mtx, NULL)) { + free(conn); + return NULL; + } + + if (!conn->send_list) { + free(conn); + return NULL; + } + + return conn; +} + +void NebulaConnInit(Conn* conn, void(*on_connect)(Conn*, int), + void(*on_read)(Conn*, NebulaHeader*), void(*on_disconnect)(Conn*)) +{ + conn->on_connect = on_connect; + conn->on_read = on_read; + conn->on_disconnect = on_disconnect; +} + +int NebulaConnConnect(Conn* conn, const char* host, uint16_t port) +{ + if (!conn || !host || !port || !*host) return -1; + + if (conn->state == eConnState_Estab || conn->state == eConnState_Connecting) + return -1; + + if (conn->host) free(conn->host); + conn->host = strdup(host); + conn->port = port; + + if (conn->socketfd >= 0) { + epoll_ctl(g_epollfd, EPOLL_CTL_DEL, conn->socketfd, NULL); + close(conn->socketfd); + conn->socketfd = -1; + } + conn->state = eConnState_Init; + + conn->socketfd = socket(AF_INET, SOCK_STREAM, 0); + if (conn->socketfd == -1) return -1; + + int flag = fcntl(conn->socketfd, F_GETFL); + if (fcntl(conn->socketfd, F_SETFL, flag | O_NONBLOCK) == -1) + return -1; + + struct sockaddr_in addr; + addr.sin_family = AF_INET; + addr.sin_port = htons(port); + addr.sin_addr.s_addr = inet_addr(host); + + int ret; +retry_connect: + ret = connect(conn->socketfd, (struct sockaddr*)&addr, sizeof(addr)); + if (ret == 0) { + // connect completed immediately. + conn->state = eConnState_Estab; + if (conn->on_connect) + conn->on_connect(conn, 0); + + struct epoll_event ev = {EPOLLIN, {conn}}; + epoll_ctl(g_epollfd, EPOLL_CTL_ADD, conn->socketfd, &ev); + return 0; + } else { + if (errno == EINTR) + goto retry_connect; + + if (errno != EINPROGRESS) { + // connect error. + conn->state = eConnState_Error; + close(conn->socketfd); + conn->socketfd = -1; + return -1; + } + + // connect not completed immediately, wait from epoll_wait. + struct epoll_event ev = {EPOLLOUT, {conn}}; + epoll_ctl(g_epollfd, EPOLL_CTL_ADD, conn->socketfd, &ev); + conn->state = eConnState_Connecting; + } + + return 0; +} + +int NebulaConnSend(Conn* conn, NebulaHeader *head, ProtobufCMessage *msg) +{ + if (!conn || conn->state != eConnState_Estab) return -1; + + int len = sizeof(NebulaHeader); + if (msg) { + int msg_len = protobuf_c_message_get_packed_size(msg); + head->len = htons(msg_len); + len += msg_len; + } + NebulaBuf *buf = (NebulaBuf*)malloc(sizeof(NebulaBuf) + len); + buf->len = len; + buf->pos = 0; + memcpy(buf->buf, head, sizeof(NebulaHeader)); + if (msg) + protobuf_c_message_pack(msg, (uint8_t*)buf->buf + sizeof(NebulaHeader)); + + log_debug("NEBULA TX %s|%d", MsgType2Str(head->type), (int)htons(head->len)); + + pthread_mutex_lock(&conn->mtx); + if (-1 == PushBack(conn->send_list, buf)) { + free(buf); + return -1; + } + pthread_mutex_unlock(&conn->mtx); + + struct epoll_event ev = {EPOLLOUT | EPOLLIN, {conn}}; + epoll_ctl(g_epollfd, EPOLL_CTL_MOD, conn->socketfd, &ev); + return 0; +} + +void NebulaConnLoop() +{ + if (g_epollfd == -1) { + g_epollfd = epoll_create(EPOLL_SIZE); + if (g_epollfd == -1) return; + } + + int n, i; + struct epoll_event ev[EPOLL_SIZE]; + n = epoll_wait(g_epollfd, ev, EPOLL_SIZE, 20); + if (n == -1) return ; + + for (i = 0; i < n; i++) { + Conn *c = (Conn*)ev[i].data.ptr; + + if (ev[i].events & EPOLLHUP || ev[i].events & EPOLLERR) { + c->err(c); + continue; + } + + if (ev[i].events & EPOLLIN) { + if (c->read(c) < 0) { + c->err(c); + continue; + } + } + + if (ev[i].events & EPOLLOUT) { + if (c->write(c) < 0) { + c->err(c); + continue; + } + } + } +} + +static int __read(Conn* conn) +{ + ssize_t n; +retry_read: + n = read(conn->socketfd, conn->recv_buf + conn->recv_pos, + sizeof(conn->recv_buf) - conn->recv_pos); + if (n == -1) { + if (errno == EINTR) + goto retry_read; + + if (errno == EAGAIN) + return 0; + + return -1; + } + + if (n == 0) + return -1; + + conn->recv_pos += n; + int pos = 0; + for (;;) + { + if (conn->recv_pos - pos < sizeof(NebulaHeader)) + break; + + NebulaHeader *head = (NebulaHeader*)(conn->recv_buf + pos); + int pack_len = sizeof(NebulaHeader) + htons(head->len); + if (pack_len > sizeof(conn->recv_buf)) + return -1; + + if (conn->recv_pos - pos < pack_len) + break; + + if (conn->on_read) + conn->on_read(conn, head); + pos += pack_len; + } + + if (pos > 0) { + conn->recv_pos -= pos; + memmove(conn->recv_buf + pos, conn->recv_buf, conn->recv_pos); + } + + return 0; +} + +static int __write(Conn* conn) +{ + if (conn->state == eConnState_Connecting) { + // check connect result. + int err = 0; + socklen_t sl = sizeof(int); + int ret = getsockopt(conn->socketfd, SOL_SOCKET, SO_ERROR, &err, &sl); + if (ret == -1 || err != 0) { + // connect failed. + conn->state = eConnState_Error; + epoll_ctl(g_epollfd, EPOLL_CTL_DEL, conn->socketfd, NULL); + close(conn->socketfd); + conn->socketfd = -1; + if (conn->on_connect) + conn->on_connect(conn, (ret == -1 ? errno : err)); + return -1; + } + + struct epoll_event ev = {EPOLLIN, {conn}}; + epoll_ctl(g_epollfd, EPOLL_CTL_MOD, conn->socketfd, &ev); + conn->state = eConnState_Estab; + if (conn->on_connect) + conn->on_connect(conn, 0); + return 0; + } + + pthread_mutex_lock(&conn->mtx); + struct iovec iov[UIO_MAXIOV]; + ListIterator it = ListBegin(conn->send_list); + int iov_cnt = 0; + for (; it && iov_cnt < UIO_MAXIOV; it = ListNext(it), iov_cnt++) + { + NebulaBuf *buf = *(NebulaBuf **)it; + iov[iov_cnt].iov_len = buf->len - buf->pos; + iov[iov_cnt].iov_base = buf->buf + buf->pos; + } + + ssize_t n; +retry_write: + n = writev(conn->socketfd, iov, iov_cnt); + if (n == -1) { + if (errno == EINTR) + goto retry_write; + + if (errno == EAGAIN) + return 0; + + return -1; + } + + if (n == 0) + return -1; + + for (;;) + { + NebulaBuf *buf = (NebulaBuf *)Front(conn->send_list); + int len = buf->len - buf->pos; + if (len < n) { + n -= len; + PopFront(conn->send_list); + continue; + } else if (len == n) { + n -= len; + PopFront(conn->send_list); + break; + } else if (len > n) { + buf->pos += n; + n = 0; + break; + } + } + pthread_mutex_unlock(&conn->mtx); + + if (conn->send_list->size == 0) { + struct epoll_event ev = {EPOLLIN, {conn}}; + epoll_ctl(g_epollfd, EPOLL_CTL_MOD, conn->socketfd, &ev); + } + + return 0; +} + +static void __err(Conn* conn) +{ + conn->state = eConnState_Error; + epoll_ctl(g_epollfd, EPOLL_CTL_DEL, conn->socketfd, NULL); + close(conn->socketfd); + conn->socketfd = -1; + conn->on_disconnect(conn); +} + +void NebulaConnNebulaDisconnect(Conn* conn) +{ + conn->err(conn); +} diff --git a/1_8.sip_push/nebula_sdk/sdk/net.h b/1_8.sip_push/nebula_sdk/sdk/net.h new file mode 100644 index 0000000..8c07234 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/net.h @@ -0,0 +1,52 @@ +#ifndef NEBULA_NET_H +#define NEBULA_NET_H + +// Async TCP connection. +#include +#include "list.h" +#include +#include "nebula_proto.h" + +enum _ConnState { + eConnState_Init, + eConnState_Connecting, + eConnState_Estab, + eConnState_Error, +}; +typedef enum _ConnState ConnState; + +typedef struct _Conn Conn; +struct _Conn +{ + int socketfd; + char* host; + uint16_t port; + void (*on_connect)(Conn*, int); + void (*on_read)(Conn*, NebulaHeader*); + void (*on_disconnect)(Conn*); + int (*read)(Conn*); + int (*write)(Conn*); + void (*err)(Conn*); + char recv_buf[8192]; + int recv_pos; + List* send_list; + pthread_mutex_t mtx; + ConnState state; +}; + +Conn* NebulaConnCreate(); + +void NebulaConnInit(Conn* conn, void(*on_connect)(Conn*, int), + void(*on_read)(Conn*, NebulaHeader*), + void(*on_disconnect)(Conn*)); + +int NebulaConnConnect(Conn* conn, const char* host, uint16_t port); + +int NebulaConnSend(Conn* conn, NebulaHeader *head, ProtobufCMessage *msg); + +void NebulaConnNebulaDisconnect(Conn* conn); + +void NebulaConnLoop(); + +#endif //NEBULA_NET_H + diff --git a/1_8.sip_push/nebula_sdk/sdk/net.o b/1_8.sip_push/nebula_sdk/sdk/net.o new file mode 100644 index 0000000..d1e684a Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/net.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/Makefile b/1_8.sip_push/nebula_sdk/sdk/proto/Makefile new file mode 100644 index 0000000..46b0560 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/Makefile @@ -0,0 +1,29 @@ +CC=gcc +CFLAGS=-g -fPIC +OBJS=$(patsubst %.proto,%.o,$(wildcard *.proto)) +OBJS+=nebula_proto.o +TARGET=libnebula_proto.a + +all: $(TARGET) + +$(TARGET):$(OBJS) + @echo "LD $(TARGET)" + @ar -cr $@ $^ + +%.o:%.proto + @echo "make $@" + @protoc-c $< --c_out=. + @$(CC) $(CFLAGS) -g $(patsubst %.o,%.pb-c.c,$@) -c -o $@ + +%.o:%.c + @echo "make $@" + @$(CC) $(CFLAGS) -g $< -c -o $@ + +.PHONY: clean echo + +clean: + rm *.o *.a -f + +echo: + @echo "TARGET=$(TARGET)" + @echo "OBJS=$(OBJS)" diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/libnebula_proto.a b/1_8.sip_push/nebula_sdk/sdk/proto/libnebula_proto.a new file mode 100644 index 0000000..550764e Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/proto/libnebula_proto.a differ diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/message.o b/1_8.sip_push/nebula_sdk/sdk/proto/message.o new file mode 100644 index 0000000..8223b59 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/proto/message.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/message.pb-c.c b/1_8.sip_push/nebula_sdk/sdk/proto/message.pb-c.c new file mode 100644 index 0000000..8ed513f --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/message.pb-c.c @@ -0,0 +1,2929 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C_NO_DEPRECATED +#define PROTOBUF_C_NO_DEPRECATED +#endif + +#include "message.pb-c.h" +void nebula__param__init + (Nebula__Param *message) +{ + static Nebula__Param init_value = NEBULA__PARAM__INIT; + *message = init_value; +} +size_t nebula__param__get_packed_size + (const Nebula__Param *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__param__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__param__pack + (const Nebula__Param *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__param__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__param__pack_to_buffer + (const Nebula__Param *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__param__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__Param * + nebula__param__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__Param *) + protobuf_c_message_unpack (&nebula__param__descriptor, + allocator, len, data); +} +void nebula__param__free_unpacked + (Nebula__Param *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__param__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__account_update_request__init + (Nebula__AccountUpdateRequest *message) +{ + static Nebula__AccountUpdateRequest init_value = NEBULA__ACCOUNT_UPDATE_REQUEST__INIT; + *message = init_value; +} +size_t nebula__account_update_request__get_packed_size + (const Nebula__AccountUpdateRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__account_update_request__pack + (const Nebula__AccountUpdateRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__account_update_request__pack_to_buffer + (const Nebula__AccountUpdateRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__AccountUpdateRequest * + nebula__account_update_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__AccountUpdateRequest *) + protobuf_c_message_unpack (&nebula__account_update_request__descriptor, + allocator, len, data); +} +void nebula__account_update_request__free_unpacked + (Nebula__AccountUpdateRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__account_update_response__init + (Nebula__AccountUpdateResponse *message) +{ + static Nebula__AccountUpdateResponse init_value = NEBULA__ACCOUNT_UPDATE_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__account_update_response__get_packed_size + (const Nebula__AccountUpdateResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__account_update_response__pack + (const Nebula__AccountUpdateResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__account_update_response__pack_to_buffer + (const Nebula__AccountUpdateResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__AccountUpdateResponse * + nebula__account_update_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__AccountUpdateResponse *) + protobuf_c_message_unpack (&nebula__account_update_response__descriptor, + allocator, len, data); +} +void nebula__account_update_response__free_unpacked + (Nebula__AccountUpdateResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_update_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__auth_request__init + (Nebula__AuthRequest *message) +{ + static Nebula__AuthRequest init_value = NEBULA__AUTH_REQUEST__INIT; + *message = init_value; +} +size_t nebula__auth_request__get_packed_size + (const Nebula__AuthRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__auth_request__pack + (const Nebula__AuthRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__auth_request__pack_to_buffer + (const Nebula__AuthRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__AuthRequest * + nebula__auth_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__AuthRequest *) + protobuf_c_message_unpack (&nebula__auth_request__descriptor, + allocator, len, data); +} +void nebula__auth_request__free_unpacked + (Nebula__AuthRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__auth_response__init + (Nebula__AuthResponse *message) +{ + static Nebula__AuthResponse init_value = NEBULA__AUTH_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__auth_response__get_packed_size + (const Nebula__AuthResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__auth_response__pack + (const Nebula__AuthResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__auth_response__pack_to_buffer + (const Nebula__AuthResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__AuthResponse * + nebula__auth_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__AuthResponse *) + protobuf_c_message_unpack (&nebula__auth_response__descriptor, + allocator, len, data); +} +void nebula__auth_response__free_unpacked + (Nebula__AuthResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__auth_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__message__content__init + (Nebula__Message__Content *message) +{ + static Nebula__Message__Content init_value = NEBULA__MESSAGE__CONTENT__INIT; + *message = init_value; +} +void nebula__message__init + (Nebula__Message *message) +{ + static Nebula__Message init_value = NEBULA__MESSAGE__INIT; + *message = init_value; +} +size_t nebula__message__get_packed_size + (const Nebula__Message *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__message__pack + (const Nebula__Message *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__message__pack_to_buffer + (const Nebula__Message *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__Message * + nebula__message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__Message *) + protobuf_c_message_unpack (&nebula__message__descriptor, + allocator, len, data); +} +void nebula__message__free_unpacked + (Nebula__Message *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__message_seq__content__init + (Nebula__MessageSeq__Content *message) +{ + static Nebula__MessageSeq__Content init_value = NEBULA__MESSAGE_SEQ__CONTENT__INIT; + *message = init_value; +} +void nebula__message_seq__init + (Nebula__MessageSeq *message) +{ + static Nebula__MessageSeq init_value = NEBULA__MESSAGE_SEQ__INIT; + *message = init_value; +} +size_t nebula__message_seq__get_packed_size + (const Nebula__MessageSeq *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_seq__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__message_seq__pack + (const Nebula__MessageSeq *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_seq__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__message_seq__pack_to_buffer + (const Nebula__MessageSeq *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_seq__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__MessageSeq * + nebula__message_seq__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__MessageSeq *) + protobuf_c_message_unpack (&nebula__message_seq__descriptor, + allocator, len, data); +} +void nebula__message_seq__free_unpacked + (Nebula__MessageSeq *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_seq__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__message_kiev_ack__init + (Nebula__MessageKievAck *message) +{ + static Nebula__MessageKievAck init_value = NEBULA__MESSAGE_KIEV_ACK__INIT; + *message = init_value; +} +size_t nebula__message_kiev_ack__get_packed_size + (const Nebula__MessageKievAck *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_kiev_ack__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__message_kiev_ack__pack + (const Nebula__MessageKievAck *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_kiev_ack__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__message_kiev_ack__pack_to_buffer + (const Nebula__MessageKievAck *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_kiev_ack__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__MessageKievAck * + nebula__message_kiev_ack__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__MessageKievAck *) + protobuf_c_message_unpack (&nebula__message_kiev_ack__descriptor, + allocator, len, data); +} +void nebula__message_kiev_ack__free_unpacked + (Nebula__MessageKievAck *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__message_kiev_ack__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__subscribe_request__init + (Nebula__SubscribeRequest *message) +{ + static Nebula__SubscribeRequest init_value = NEBULA__SUBSCRIBE_REQUEST__INIT; + *message = init_value; +} +size_t nebula__subscribe_request__get_packed_size + (const Nebula__SubscribeRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__subscribe_request__pack + (const Nebula__SubscribeRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__subscribe_request__pack_to_buffer + (const Nebula__SubscribeRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__SubscribeRequest * + nebula__subscribe_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__SubscribeRequest *) + protobuf_c_message_unpack (&nebula__subscribe_request__descriptor, + allocator, len, data); +} +void nebula__subscribe_request__free_unpacked + (Nebula__SubscribeRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__subscribe_response__content__init + (Nebula__SubscribeResponse__Content *message) +{ + static Nebula__SubscribeResponse__Content init_value = NEBULA__SUBSCRIBE_RESPONSE__CONTENT__INIT; + *message = init_value; +} +void nebula__subscribe_response__init + (Nebula__SubscribeResponse *message) +{ + static Nebula__SubscribeResponse init_value = NEBULA__SUBSCRIBE_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__subscribe_response__get_packed_size + (const Nebula__SubscribeResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__subscribe_response__pack + (const Nebula__SubscribeResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__subscribe_response__pack_to_buffer + (const Nebula__SubscribeResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__SubscribeResponse * + nebula__subscribe_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__SubscribeResponse *) + protobuf_c_message_unpack (&nebula__subscribe_response__descriptor, + allocator, len, data); +} +void nebula__subscribe_response__free_unpacked + (Nebula__SubscribeResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__subscribe_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__notify_body__init + (Nebula__NotifyBody *message) +{ + static Nebula__NotifyBody init_value = NEBULA__NOTIFY_BODY__INIT; + *message = init_value; +} +size_t nebula__notify_body__get_packed_size + (const Nebula__NotifyBody *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__notify_body__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__notify_body__pack + (const Nebula__NotifyBody *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__notify_body__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__notify_body__pack_to_buffer + (const Nebula__NotifyBody *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__notify_body__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__NotifyBody * + nebula__notify_body__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__NotifyBody *) + protobuf_c_message_unpack (&nebula__notify_body__descriptor, + allocator, len, data); +} +void nebula__notify_body__free_unpacked + (Nebula__NotifyBody *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__notify_body__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__sms_request__file_info__init + (Nebula__SmsRequest__FileInfo *message) +{ + static Nebula__SmsRequest__FileInfo init_value = NEBULA__SMS_REQUEST__FILE_INFO__INIT; + *message = init_value; +} +void nebula__sms_request__init + (Nebula__SmsRequest *message) +{ + static Nebula__SmsRequest init_value = NEBULA__SMS_REQUEST__INIT; + *message = init_value; +} +size_t nebula__sms_request__get_packed_size + (const Nebula__SmsRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__sms_request__pack + (const Nebula__SmsRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__sms_request__pack_to_buffer + (const Nebula__SmsRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__SmsRequest * + nebula__sms_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__SmsRequest *) + protobuf_c_message_unpack (&nebula__sms_request__descriptor, + allocator, len, data); +} +void nebula__sms_request__free_unpacked + (Nebula__SmsRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__sms_response__init + (Nebula__SmsResponse *message) +{ + static Nebula__SmsResponse init_value = NEBULA__SMS_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__sms_response__get_packed_size + (const Nebula__SmsResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__sms_response__pack + (const Nebula__SmsResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__sms_response__pack_to_buffer + (const Nebula__SmsResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__SmsResponse * + nebula__sms_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__SmsResponse *) + protobuf_c_message_unpack (&nebula__sms_response__descriptor, + allocator, len, data); +} +void nebula__sms_response__free_unpacked + (Nebula__SmsResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__sms_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__presence_notify__content__init + (Nebula__PresenceNotify__Content *message) +{ + static Nebula__PresenceNotify__Content init_value = NEBULA__PRESENCE_NOTIFY__CONTENT__INIT; + *message = init_value; +} +void nebula__presence_notify__init + (Nebula__PresenceNotify *message) +{ + static Nebula__PresenceNotify init_value = NEBULA__PRESENCE_NOTIFY__INIT; + *message = init_value; +} +size_t nebula__presence_notify__get_packed_size + (const Nebula__PresenceNotify *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_notify__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__presence_notify__pack + (const Nebula__PresenceNotify *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_notify__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__presence_notify__pack_to_buffer + (const Nebula__PresenceNotify *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_notify__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__PresenceNotify * + nebula__presence_notify__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__PresenceNotify *) + protobuf_c_message_unpack (&nebula__presence_notify__descriptor, + allocator, len, data); +} +void nebula__presence_notify__free_unpacked + (Nebula__PresenceNotify *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_notify__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__presence_request__init + (Nebula__PresenceRequest *message) +{ + static Nebula__PresenceRequest init_value = NEBULA__PRESENCE_REQUEST__INIT; + *message = init_value; +} +size_t nebula__presence_request__get_packed_size + (const Nebula__PresenceRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__presence_request__pack + (const Nebula__PresenceRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__presence_request__pack_to_buffer + (const Nebula__PresenceRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__PresenceRequest * + nebula__presence_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__PresenceRequest *) + protobuf_c_message_unpack (&nebula__presence_request__descriptor, + allocator, len, data); +} +void nebula__presence_request__free_unpacked + (Nebula__PresenceRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__presence_response__init + (Nebula__PresenceResponse *message) +{ + static Nebula__PresenceResponse init_value = NEBULA__PRESENCE_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__presence_response__get_packed_size + (const Nebula__PresenceResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__presence_response__pack + (const Nebula__PresenceResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__presence_response__pack_to_buffer + (const Nebula__PresenceResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__PresenceResponse * + nebula__presence_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__PresenceResponse *) + protobuf_c_message_unpack (&nebula__presence_response__descriptor, + allocator, len, data); +} +void nebula__presence_response__free_unpacked + (Nebula__PresenceResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__presence_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__account_status_request__init + (Nebula__AccountStatusRequest *message) +{ + static Nebula__AccountStatusRequest init_value = NEBULA__ACCOUNT_STATUS_REQUEST__INIT; + *message = init_value; +} +size_t nebula__account_status_request__get_packed_size + (const Nebula__AccountStatusRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__account_status_request__pack + (const Nebula__AccountStatusRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__account_status_request__pack_to_buffer + (const Nebula__AccountStatusRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__AccountStatusRequest * + nebula__account_status_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__AccountStatusRequest *) + protobuf_c_message_unpack (&nebula__account_status_request__descriptor, + allocator, len, data); +} +void nebula__account_status_request__free_unpacked + (Nebula__AccountStatusRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__account_status_response__account_status__init + (Nebula__AccountStatusResponse__AccountStatus *message) +{ + static Nebula__AccountStatusResponse__AccountStatus init_value = NEBULA__ACCOUNT_STATUS_RESPONSE__ACCOUNT_STATUS__INIT; + *message = init_value; +} +void nebula__account_status_response__init + (Nebula__AccountStatusResponse *message) +{ + static Nebula__AccountStatusResponse init_value = NEBULA__ACCOUNT_STATUS_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__account_status_response__get_packed_size + (const Nebula__AccountStatusResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__account_status_response__pack + (const Nebula__AccountStatusResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__account_status_response__pack_to_buffer + (const Nebula__AccountStatusResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__AccountStatusResponse * + nebula__account_status_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__AccountStatusResponse *) + protobuf_c_message_unpack (&nebula__account_status_response__descriptor, + allocator, len, data); +} +void nebula__account_status_response__free_unpacked + (Nebula__AccountStatusResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__account_status_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__address__init + (Nebula__Address *message) +{ + static Nebula__Address init_value = NEBULA__ADDRESS__INIT; + *message = init_value; +} +size_t nebula__address__get_packed_size + (const Nebula__Address *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__address__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__address__pack + (const Nebula__Address *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__address__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__address__pack_to_buffer + (const Nebula__Address *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__address__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__Address * + nebula__address__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__Address *) + protobuf_c_message_unpack (&nebula__address__descriptor, + allocator, len, data); +} +void nebula__address__free_unpacked + (Nebula__Address *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__address__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__dialog_request__init + (Nebula__DialogRequest *message) +{ + static Nebula__DialogRequest init_value = NEBULA__DIALOG_REQUEST__INIT; + *message = init_value; +} +size_t nebula__dialog_request__get_packed_size + (const Nebula__DialogRequest *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_request__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__dialog_request__pack + (const Nebula__DialogRequest *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_request__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__dialog_request__pack_to_buffer + (const Nebula__DialogRequest *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_request__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__DialogRequest * + nebula__dialog_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__DialogRequest *) + protobuf_c_message_unpack (&nebula__dialog_request__descriptor, + allocator, len, data); +} +void nebula__dialog_request__free_unpacked + (Nebula__DialogRequest *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_request__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +void nebula__dialog_response__init + (Nebula__DialogResponse *message) +{ + static Nebula__DialogResponse init_value = NEBULA__DIALOG_RESPONSE__INIT; + *message = init_value; +} +size_t nebula__dialog_response__get_packed_size + (const Nebula__DialogResponse *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_response__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__dialog_response__pack + (const Nebula__DialogResponse *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_response__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__dialog_response__pack_to_buffer + (const Nebula__DialogResponse *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_response__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__DialogResponse * + nebula__dialog_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__DialogResponse *) + protobuf_c_message_unpack (&nebula__dialog_response__descriptor, + allocator, len, data); +} +void nebula__dialog_response__free_unpacked + (Nebula__DialogResponse *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__dialog_response__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor nebula__param__field_descriptors[2] = +{ + { + "name", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Param, name), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "value", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Param, value), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__param__field_indices_by_name[] = { + 0, /* field[0] = name */ + 1, /* field[1] = value */ +}; +static const ProtobufCIntRange nebula__param__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__param__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.Param", + "Param", + "Nebula__Param", + "Nebula", + sizeof(Nebula__Param), + 2, + nebula__param__field_descriptors, + nebula__param__field_indices_by_name, + 1, nebula__param__number_ranges, + (ProtobufCMessageInit) nebula__param__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__account_update_request__field_descriptors[3] = +{ + { + "flyme_uid", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateRequest, flyme_uid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "phone", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateRequest, phone), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "capability", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateRequest, has_capability), + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateRequest, capability), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__account_update_request__field_indices_by_name[] = { + 2, /* field[2] = capability */ + 0, /* field[0] = flyme_uid */ + 1, /* field[1] = phone */ +}; +static const ProtobufCIntRange nebula__account_update_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor nebula__account_update_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AccountUpdateRequest", + "AccountUpdateRequest", + "Nebula__AccountUpdateRequest", + "Nebula", + sizeof(Nebula__AccountUpdateRequest), + 3, + nebula__account_update_request__field_descriptors, + nebula__account_update_request__field_indices_by_name, + 1, nebula__account_update_request__number_ranges, + (ProtobufCMessageInit) nebula__account_update_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__account_update_response__field_descriptors[5] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flyme_uid", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateResponse, flyme_uid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "imsi", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateResponse, imsi), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "phone", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateResponse, phone), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "capability", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateResponse, has_capability), + PROTOBUF_C_OFFSETOF(Nebula__AccountUpdateResponse, capability), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__account_update_response__field_indices_by_name[] = { + 4, /* field[4] = capability */ + 1, /* field[1] = flyme_uid */ + 2, /* field[2] = imsi */ + 3, /* field[3] = phone */ + 0, /* field[0] = status */ +}; +static const ProtobufCIntRange nebula__account_update_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor nebula__account_update_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AccountUpdateResponse", + "AccountUpdateResponse", + "Nebula__AccountUpdateResponse", + "Nebula", + sizeof(Nebula__AccountUpdateResponse), + 5, + nebula__account_update_response__field_descriptors, + nebula__account_update_response__field_indices_by_name, + 1, nebula__account_update_response__number_ranges, + (ProtobufCMessageInit) nebula__account_update_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue nebula__auth_request__algorithm__enum_values_by_number[3] = +{ + { "MD5_MEIZU", "NEBULA__AUTH_REQUEST__ALGORITHM__MD5_MEIZU", 0 }, + { "MD5_DAA", "NEBULA__AUTH_REQUEST__ALGORITHM__MD5_DAA", 1 }, + { "MD5_FLYME", "NEBULA__AUTH_REQUEST__ALGORITHM__MD5_FLYME", 2 }, +}; +static const ProtobufCIntRange nebula__auth_request__algorithm__value_ranges[] = { +{0, 0},{0, 3} +}; +const ProtobufCEnumValueIndex nebula__auth_request__algorithm__enum_values_by_name[3] = +{ + { "MD5_DAA", 1 }, + { "MD5_FLYME", 2 }, + { "MD5_MEIZU", 0 }, +}; +const ProtobufCEnumDescriptor nebula__auth_request__algorithm__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "Nebula.AuthRequest.Algorithm", + "Algorithm", + "Nebula__AuthRequest__Algorithm", + "Nebula", + 3, + nebula__auth_request__algorithm__enum_values_by_number, + 3, + nebula__auth_request__algorithm__enum_values_by_name, + 1, + nebula__auth_request__algorithm__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nebula__auth_request__field_descriptors[7] = +{ + { + "uid", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, uid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "username", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, username), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "nonce", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, nonce), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "realm", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, realm), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "token", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, token), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "algorithm", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_ENUM, + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, has_algorithm), + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, algorithm), + &nebula__auth_request__algorithm__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "other_info", + 7, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, n_other_info), + PROTOBUF_C_OFFSETOF(Nebula__AuthRequest, other_info), + &nebula__param__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__auth_request__field_indices_by_name[] = { + 5, /* field[5] = algorithm */ + 2, /* field[2] = nonce */ + 6, /* field[6] = other_info */ + 3, /* field[3] = realm */ + 4, /* field[4] = token */ + 0, /* field[0] = uid */ + 1, /* field[1] = username */ +}; +static const ProtobufCIntRange nebula__auth_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 7 } +}; +const ProtobufCMessageDescriptor nebula__auth_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AuthRequest", + "AuthRequest", + "Nebula__AuthRequest", + "Nebula", + sizeof(Nebula__AuthRequest), + 7, + nebula__auth_request__field_descriptors, + nebula__auth_request__field_indices_by_name, + 1, nebula__auth_request__number_ranges, + (ProtobufCMessageInit) nebula__auth_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__auth_response__field_descriptors[3] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__AuthResponse, has_status), + PROTOBUF_C_OFFSETOF(Nebula__AuthResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "nonce", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthResponse, nonce), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "realm", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AuthResponse, realm), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__auth_response__field_indices_by_name[] = { + 1, /* field[1] = nonce */ + 2, /* field[2] = realm */ + 0, /* field[0] = status */ +}; +static const ProtobufCIntRange nebula__auth_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor nebula__auth_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AuthResponse", + "AuthResponse", + "Nebula__AuthResponse", + "Nebula", + sizeof(Nebula__AuthResponse), + 3, + nebula__auth_response__field_descriptors, + nebula__auth_response__field_indices_by_name, + 1, nebula__auth_response__number_ranges, + (ProtobufCMessageInit) nebula__auth_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue nebula__message__content__msg_type__enum_values_by_number[3] = +{ + { "ePushMessage", "NEBULA__MESSAGE__CONTENT__MSG_TYPE__EPUSHMESSAGE", 0 }, + { "ePresenceMessage", "NEBULA__MESSAGE__CONTENT__MSG_TYPE__EPRESENCEMESSAGE", 1 }, + { "eSmsMessage", "NEBULA__MESSAGE__CONTENT__MSG_TYPE__ESMSMESSAGE", 2 }, +}; +static const ProtobufCIntRange nebula__message__content__msg_type__value_ranges[] = { +{0, 0},{0, 3} +}; +const ProtobufCEnumValueIndex nebula__message__content__msg_type__enum_values_by_name[3] = +{ + { "ePresenceMessage", 1 }, + { "ePushMessage", 0 }, + { "eSmsMessage", 2 }, +}; +const ProtobufCEnumDescriptor nebula__message__content__msg_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "Nebula.Message.Content.MsgType", + "MsgType", + "Nebula__Message__Content__MsgType", + "Nebula", + 3, + nebula__message__content__msg_type__enum_values_by_number, + 3, + nebula__message__content__msg_type__enum_values_by_name, + 1, + nebula__message__content__msg_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nebula__message__content__field_descriptors[4] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Message__Content, type), + &nebula__message__content__msg_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "account", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Message__Content, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "seq", + 3, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Message__Content, seq), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(Nebula__Message__Content, has_body), + PROTOBUF_C_OFFSETOF(Nebula__Message__Content, body), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__message__content__field_indices_by_name[] = { + 1, /* field[1] = account */ + 3, /* field[3] = body */ + 2, /* field[2] = seq */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange nebula__message__content__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor nebula__message__content__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.Message.Content", + "Content", + "Nebula__Message__Content", + "Nebula", + sizeof(Nebula__Message__Content), + 4, + nebula__message__content__field_descriptors, + nebula__message__content__field_indices_by_name, + 1, nebula__message__content__number_ranges, + (ProtobufCMessageInit) nebula__message__content__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue nebula__message__flag__enum_values_by_number[2] = +{ + { "MESSAGE_ACK", "NEBULA__MESSAGE__FLAG__MESSAGE_ACK", 1 }, + { "MESSAGE_END", "NEBULA__MESSAGE__FLAG__MESSAGE_END", 2 }, +}; +static const ProtobufCIntRange nebula__message__flag__value_ranges[] = { +{1, 0},{0, 2} +}; +const ProtobufCEnumValueIndex nebula__message__flag__enum_values_by_name[2] = +{ + { "MESSAGE_ACK", 0 }, + { "MESSAGE_END", 1 }, +}; +const ProtobufCEnumDescriptor nebula__message__flag__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "Nebula.Message.Flag", + "Flag", + "Nebula__Message__Flag", + "Nebula", + 2, + nebula__message__flag__enum_values_by_number, + 2, + nebula__message__flag__enum_values_by_name, + 1, + nebula__message__flag__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nebula__message__field_descriptors[2] = +{ + { + "content", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__Message, n_content), + PROTOBUF_C_OFFSETOF(Nebula__Message, content), + &nebula__message__content__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "flag", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_ENUM, + PROTOBUF_C_OFFSETOF(Nebula__Message, has_flag), + PROTOBUF_C_OFFSETOF(Nebula__Message, flag), + &nebula__message__flag__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__message__field_indices_by_name[] = { + 0, /* field[0] = content */ + 1, /* field[1] = flag */ +}; +static const ProtobufCIntRange nebula__message__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__message__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.Message", + "Message", + "Nebula__Message", + "Nebula", + sizeof(Nebula__Message), + 2, + nebula__message__field_descriptors, + nebula__message__field_indices_by_name, + 1, nebula__message__number_ranges, + (ProtobufCMessageInit) nebula__message__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__message_seq__content__field_descriptors[2] = +{ + { + "account", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__MessageSeq__Content, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "seq", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__MessageSeq__Content, seq), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__message_seq__content__field_indices_by_name[] = { + 0, /* field[0] = account */ + 1, /* field[1] = seq */ +}; +static const ProtobufCIntRange nebula__message_seq__content__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__message_seq__content__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.MessageSeq.Content", + "Content", + "Nebula__MessageSeq__Content", + "Nebula", + sizeof(Nebula__MessageSeq__Content), + 2, + nebula__message_seq__content__field_descriptors, + nebula__message_seq__content__field_indices_by_name, + 1, nebula__message_seq__content__number_ranges, + (ProtobufCMessageInit) nebula__message_seq__content__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__message_seq__field_descriptors[1] = +{ + { + "content", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__MessageSeq, n_content), + PROTOBUF_C_OFFSETOF(Nebula__MessageSeq, content), + &nebula__message_seq__content__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__message_seq__field_indices_by_name[] = { + 0, /* field[0] = content */ +}; +static const ProtobufCIntRange nebula__message_seq__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor nebula__message_seq__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.MessageSeq", + "MessageSeq", + "Nebula__MessageSeq", + "Nebula", + sizeof(Nebula__MessageSeq), + 1, + nebula__message_seq__field_descriptors, + nebula__message_seq__field_indices_by_name, + 1, nebula__message_seq__number_ranges, + (ProtobufCMessageInit) nebula__message_seq__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__message_kiev_ack__field_descriptors[2] = +{ + { + "seqs", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__MessageKievAck, seqs), + &nebula__message_seq__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "index", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_UINT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__MessageKievAck, index), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__message_kiev_ack__field_indices_by_name[] = { + 1, /* field[1] = index */ + 0, /* field[0] = seqs */ +}; +static const ProtobufCIntRange nebula__message_kiev_ack__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__message_kiev_ack__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.MessageKievAck", + "MessageKievAck", + "Nebula__MessageKievAck", + "Nebula", + sizeof(Nebula__MessageKievAck), + 2, + nebula__message_kiev_ack__field_descriptors, + nebula__message_kiev_ack__field_indices_by_name, + 1, nebula__message_kiev_ack__number_ranges, + (ProtobufCMessageInit) nebula__message_kiev_ack__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__subscribe_request__field_descriptors[1] = +{ + { + "app", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + PROTOBUF_C_OFFSETOF(Nebula__SubscribeRequest, n_app), + PROTOBUF_C_OFFSETOF(Nebula__SubscribeRequest, app), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__subscribe_request__field_indices_by_name[] = { + 0, /* field[0] = app */ +}; +static const ProtobufCIntRange nebula__subscribe_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor nebula__subscribe_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.SubscribeRequest", + "SubscribeRequest", + "Nebula__SubscribeRequest", + "Nebula", + sizeof(Nebula__SubscribeRequest), + 1, + nebula__subscribe_request__field_descriptors, + nebula__subscribe_request__field_indices_by_name, + 1, nebula__subscribe_request__number_ranges, + (ProtobufCMessageInit) nebula__subscribe_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__subscribe_response__content__field_descriptors[3] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse__Content, has_status), + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse__Content, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "app", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse__Content, app), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "pushid", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse__Content, pushid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__subscribe_response__content__field_indices_by_name[] = { + 1, /* field[1] = app */ + 2, /* field[2] = pushid */ + 0, /* field[0] = status */ +}; +static const ProtobufCIntRange nebula__subscribe_response__content__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor nebula__subscribe_response__content__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.SubscribeResponse.Content", + "Content", + "Nebula__SubscribeResponse__Content", + "Nebula", + sizeof(Nebula__SubscribeResponse__Content), + 3, + nebula__subscribe_response__content__field_descriptors, + nebula__subscribe_response__content__field_indices_by_name, + 1, nebula__subscribe_response__content__number_ranges, + (ProtobufCMessageInit) nebula__subscribe_response__content__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__subscribe_response__field_descriptors[2] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "content", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse, n_content), + PROTOBUF_C_OFFSETOF(Nebula__SubscribeResponse, content), + &nebula__subscribe_response__content__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__subscribe_response__field_indices_by_name[] = { + 1, /* field[1] = content */ + 0, /* field[0] = status */ +}; +static const ProtobufCIntRange nebula__subscribe_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__subscribe_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.SubscribeResponse", + "SubscribeResponse", + "Nebula__SubscribeResponse", + "Nebula", + sizeof(Nebula__SubscribeResponse), + 2, + nebula__subscribe_response__field_descriptors, + nebula__subscribe_response__field_indices_by_name, + 1, nebula__subscribe_response__number_ranges, + (ProtobufCMessageInit) nebula__subscribe_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__notify_body__field_descriptors[2] = +{ + { + "app", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__NotifyBody, app), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__NotifyBody, body), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__notify_body__field_indices_by_name[] = { + 0, /* field[0] = app */ + 1, /* field[1] = body */ +}; +static const ProtobufCIntRange nebula__notify_body__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__notify_body__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.NotifyBody", + "NotifyBody", + "Nebula__NotifyBody", + "Nebula", + sizeof(Nebula__NotifyBody), + 2, + nebula__notify_body__field_descriptors, + nebula__notify_body__field_indices_by_name, + 1, nebula__notify_body__number_ranges, + (ProtobufCMessageInit) nebula__notify_body__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__sms_request__file_info__field_descriptors[4] = +{ + { + "mimetype", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest__FileInfo, mimetype), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "size", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest__FileInfo, size), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "filename", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest__FileInfo, filename), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "url", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest__FileInfo, url), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__sms_request__file_info__field_indices_by_name[] = { + 2, /* field[2] = filename */ + 0, /* field[0] = mimetype */ + 1, /* field[1] = size */ + 3, /* field[3] = url */ +}; +static const ProtobufCIntRange nebula__sms_request__file_info__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor nebula__sms_request__file_info__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.SmsRequest.FileInfo", + "FileInfo", + "Nebula__SmsRequest__FileInfo", + "Nebula", + sizeof(Nebula__SmsRequest__FileInfo), + 4, + nebula__sms_request__file_info__field_descriptors, + nebula__sms_request__file_info__field_indices_by_name, + 1, nebula__sms_request__file_info__number_ranges, + (ProtobufCMessageInit) nebula__sms_request__file_info__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue nebula__sms_request__sms_type__enum_values_by_number[3] = +{ + { "eShortMessage", "NEBULA__SMS_REQUEST__SMS_TYPE__ESHORTMESSAGE", 0 }, + { "eMultimediaMessage", "NEBULA__SMS_REQUEST__SMS_TYPE__EMULTIMEDIAMESSAGE", 1 }, + { "eReportMessage", "NEBULA__SMS_REQUEST__SMS_TYPE__EREPORTMESSAGE", 2 }, +}; +static const ProtobufCIntRange nebula__sms_request__sms_type__value_ranges[] = { +{0, 0},{0, 3} +}; +const ProtobufCEnumValueIndex nebula__sms_request__sms_type__enum_values_by_name[3] = +{ + { "eMultimediaMessage", 1 }, + { "eReportMessage", 2 }, + { "eShortMessage", 0 }, +}; +const ProtobufCEnumDescriptor nebula__sms_request__sms_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "Nebula.SmsRequest.SmsType", + "SmsType", + "Nebula__SmsRequest__SmsType", + "Nebula", + 3, + nebula__sms_request__sms_type__enum_values_by_number, + 3, + nebula__sms_request__sms_type__enum_values_by_name, + 1, + nebula__sms_request__sms_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +const ProtobufCEnumValue nebula__sms_request__report_type__enum_values_by_number[2] = +{ + { "eSMSReport", "NEBULA__SMS_REQUEST__REPORT_TYPE__ESMSREPORT", 0 }, + { "eMMSReport", "NEBULA__SMS_REQUEST__REPORT_TYPE__EMMSREPORT", 1 }, +}; +static const ProtobufCIntRange nebula__sms_request__report_type__value_ranges[] = { +{0, 0},{0, 2} +}; +const ProtobufCEnumValueIndex nebula__sms_request__report_type__enum_values_by_name[2] = +{ + { "eMMSReport", 1 }, + { "eSMSReport", 0 }, +}; +const ProtobufCEnumDescriptor nebula__sms_request__report_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "Nebula.SmsRequest.ReportType", + "ReportType", + "Nebula__SmsRequest__ReportType", + "Nebula", + 2, + nebula__sms_request__report_type__enum_values_by_number, + 2, + nebula__sms_request__report_type__enum_values_by_name, + 1, + nebula__sms_request__report_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; +static const ProtobufCFieldDescriptor nebula__sms_request__field_descriptors[14] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_ENUM, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, type), + &nebula__sms_request__sms_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "msgid", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, msgid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "src", + 3, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, src), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dst", + 4, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, n_dst), + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, dst), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, has_body), + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, body), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "report_flag", + 6, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BOOL, + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, has_report_flag), + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, report_flag), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "report_type", + 7, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_ENUM, + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, has_report_type), + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, report_type), + &nebula__sms_request__report_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "report_status", + 8, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, report_status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "time", + 9, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, time), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "expires", + 10, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, expires), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "pdu", + 11, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, pdu), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "size", + 12, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, has_size), + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, size), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "ver", + 13, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, ver), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "fileinfos", + 14, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, n_fileinfos), + PROTOBUF_C_OFFSETOF(Nebula__SmsRequest, fileinfos), + &nebula__sms_request__file_info__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__sms_request__field_indices_by_name[] = { + 4, /* field[4] = body */ + 3, /* field[3] = dst */ + 9, /* field[9] = expires */ + 13, /* field[13] = fileinfos */ + 1, /* field[1] = msgid */ + 10, /* field[10] = pdu */ + 5, /* field[5] = report_flag */ + 7, /* field[7] = report_status */ + 6, /* field[6] = report_type */ + 11, /* field[11] = size */ + 2, /* field[2] = src */ + 8, /* field[8] = time */ + 0, /* field[0] = type */ + 12, /* field[12] = ver */ +}; +static const ProtobufCIntRange nebula__sms_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 14 } +}; +const ProtobufCMessageDescriptor nebula__sms_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.SmsRequest", + "SmsRequest", + "Nebula__SmsRequest", + "Nebula", + sizeof(Nebula__SmsRequest), + 14, + nebula__sms_request__field_descriptors, + nebula__sms_request__field_indices_by_name, + 1, nebula__sms_request__number_ranges, + (ProtobufCMessageInit) nebula__sms_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__sms_response__field_descriptors[2] = +{ + { + "msgid", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsResponse, msgid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "status", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__SmsResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__sms_response__field_indices_by_name[] = { + 0, /* field[0] = msgid */ + 1, /* field[1] = status */ +}; +static const ProtobufCIntRange nebula__sms_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__sms_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.SmsResponse", + "SmsResponse", + "Nebula__SmsResponse", + "Nebula", + sizeof(Nebula__SmsResponse), + 2, + nebula__sms_response__field_descriptors, + nebula__sms_response__field_indices_by_name, + 1, nebula__sms_response__number_ranges, + (ProtobufCMessageInit) nebula__sms_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__presence_notify__content__field_descriptors[3] = +{ + { + "account", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify__Content, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "capability", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify__Content, has_capability), + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify__Content, capability), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "status", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify__Content, has_status), + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify__Content, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__presence_notify__content__field_indices_by_name[] = { + 0, /* field[0] = account */ + 1, /* field[1] = capability */ + 2, /* field[2] = status */ +}; +static const ProtobufCIntRange nebula__presence_notify__content__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor nebula__presence_notify__content__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.PresenceNotify.Content", + "Content", + "Nebula__PresenceNotify__Content", + "Nebula", + sizeof(Nebula__PresenceNotify__Content), + 3, + nebula__presence_notify__content__field_descriptors, + nebula__presence_notify__content__field_indices_by_name, + 1, nebula__presence_notify__content__number_ranges, + (ProtobufCMessageInit) nebula__presence_notify__content__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__presence_notify__field_descriptors[1] = +{ + { + "content", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify, n_content), + PROTOBUF_C_OFFSETOF(Nebula__PresenceNotify, content), + &nebula__presence_notify__content__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__presence_notify__field_indices_by_name[] = { + 0, /* field[0] = content */ +}; +static const ProtobufCIntRange nebula__presence_notify__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor nebula__presence_notify__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.PresenceNotify", + "PresenceNotify", + "Nebula__PresenceNotify", + "Nebula", + sizeof(Nebula__PresenceNotify), + 1, + nebula__presence_notify__field_descriptors, + nebula__presence_notify__field_indices_by_name, + 1, nebula__presence_notify__number_ranges, + (ProtobufCMessageInit) nebula__presence_notify__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__presence_request__field_descriptors[3] = +{ + { + "type", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_ENUM, + PROTOBUF_C_OFFSETOF(Nebula__PresenceRequest, has_type), + PROTOBUF_C_OFFSETOF(Nebula__PresenceRequest, type), + &nebula__presence_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "sequence", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_OFFSETOF(Nebula__PresenceRequest, has_sequence), + PROTOBUF_C_OFFSETOF(Nebula__PresenceRequest, sequence), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "account", + 3, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + PROTOBUF_C_OFFSETOF(Nebula__PresenceRequest, n_account), + PROTOBUF_C_OFFSETOF(Nebula__PresenceRequest, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__presence_request__field_indices_by_name[] = { + 2, /* field[2] = account */ + 1, /* field[1] = sequence */ + 0, /* field[0] = type */ +}; +static const ProtobufCIntRange nebula__presence_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor nebula__presence_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.PresenceRequest", + "PresenceRequest", + "Nebula__PresenceRequest", + "Nebula", + sizeof(Nebula__PresenceRequest), + 3, + nebula__presence_request__field_descriptors, + nebula__presence_request__field_indices_by_name, + 1, nebula__presence_request__number_ranges, + (ProtobufCMessageInit) nebula__presence_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__presence_response__field_descriptors[4] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "type", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_ENUM, + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, has_type), + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, type), + &nebula__presence_type__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "sequence", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_UINT32, + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, has_sequence), + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, sequence), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "account", + 4, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, n_account), + PROTOBUF_C_OFFSETOF(Nebula__PresenceResponse, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__presence_response__field_indices_by_name[] = { + 3, /* field[3] = account */ + 2, /* field[2] = sequence */ + 0, /* field[0] = status */ + 1, /* field[1] = type */ +}; +static const ProtobufCIntRange nebula__presence_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor nebula__presence_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.PresenceResponse", + "PresenceResponse", + "Nebula__PresenceResponse", + "Nebula", + sizeof(Nebula__PresenceResponse), + 4, + nebula__presence_response__field_descriptors, + nebula__presence_response__field_indices_by_name, + 1, nebula__presence_response__number_ranges, + (ProtobufCMessageInit) nebula__presence_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__account_status_request__field_descriptors[1] = +{ + { + "account", + 1, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_STRING, + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusRequest, n_account), + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusRequest, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__account_status_request__field_indices_by_name[] = { + 0, /* field[0] = account */ +}; +static const ProtobufCIntRange nebula__account_status_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 1 } +}; +const ProtobufCMessageDescriptor nebula__account_status_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AccountStatusRequest", + "AccountStatusRequest", + "Nebula__AccountStatusRequest", + "Nebula", + sizeof(Nebula__AccountStatusRequest), + 1, + nebula__account_status_request__field_descriptors, + nebula__account_status_request__field_indices_by_name, + 1, nebula__account_status_request__number_ranges, + (ProtobufCMessageInit) nebula__account_status_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__account_status_response__account_status__field_descriptors[3] = +{ + { + "account", + 1, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse__AccountStatus, account), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "status", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse__AccountStatus, has_status), + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse__AccountStatus, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "capability", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_INT32, + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse__AccountStatus, has_capability), + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse__AccountStatus, capability), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__account_status_response__account_status__field_indices_by_name[] = { + 0, /* field[0] = account */ + 2, /* field[2] = capability */ + 1, /* field[1] = status */ +}; +static const ProtobufCIntRange nebula__account_status_response__account_status__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 3 } +}; +const ProtobufCMessageDescriptor nebula__account_status_response__account_status__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AccountStatusResponse.AccountStatus", + "AccountStatus", + "Nebula__AccountStatusResponse__AccountStatus", + "Nebula", + sizeof(Nebula__AccountStatusResponse__AccountStatus), + 3, + nebula__account_status_response__account_status__field_descriptors, + nebula__account_status_response__account_status__field_indices_by_name, + 1, nebula__account_status_response__account_status__number_ranges, + (ProtobufCMessageInit) nebula__account_status_response__account_status__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__account_status_response__field_descriptors[2] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "result", + 2, + PROTOBUF_C_LABEL_REPEATED, + PROTOBUF_C_TYPE_MESSAGE, + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse, n_result), + PROTOBUF_C_OFFSETOF(Nebula__AccountStatusResponse, result), + &nebula__account_status_response__account_status__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__account_status_response__field_indices_by_name[] = { + 1, /* field[1] = result */ + 0, /* field[0] = status */ +}; +static const ProtobufCIntRange nebula__account_status_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__account_status_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.AccountStatusResponse", + "AccountStatusResponse", + "Nebula__AccountStatusResponse", + "Nebula", + sizeof(Nebula__AccountStatusResponse), + 2, + nebula__account_status_response__field_descriptors, + nebula__account_status_response__field_indices_by_name, + 1, nebula__account_status_response__number_ranges, + (ProtobufCMessageInit) nebula__account_status_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__address__field_descriptors[2] = +{ + { + "host", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Address, host), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "port", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__Address, port), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__address__field_indices_by_name[] = { + 0, /* field[0] = host */ + 1, /* field[1] = port */ +}; +static const ProtobufCIntRange nebula__address__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__address__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.Address", + "Address", + "Nebula__Address", + "Nebula", + sizeof(Nebula__Address), + 2, + nebula__address__field_descriptors, + nebula__address__field_indices_by_name, + 1, nebula__address__number_ranges, + (ProtobufCMessageInit) nebula__address__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__dialog_request__field_descriptors[4] = +{ + { + "src", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogRequest, src), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dst", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogRequest, dst), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dialog", + 3, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogRequest, dialog), + &nebula__address__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(Nebula__DialogRequest, has_body), + PROTOBUF_C_OFFSETOF(Nebula__DialogRequest, body), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__dialog_request__field_indices_by_name[] = { + 3, /* field[3] = body */ + 2, /* field[2] = dialog */ + 1, /* field[1] = dst */ + 0, /* field[0] = src */ +}; +static const ProtobufCIntRange nebula__dialog_request__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 4 } +}; +const ProtobufCMessageDescriptor nebula__dialog_request__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.DialogRequest", + "DialogRequest", + "Nebula__DialogRequest", + "Nebula", + sizeof(Nebula__DialogRequest), + 4, + nebula__dialog_request__field_descriptors, + nebula__dialog_request__field_indices_by_name, + 1, nebula__dialog_request__number_ranges, + (ProtobufCMessageInit) nebula__dialog_request__init, + NULL,NULL,NULL /* reserved[123] */ +}; +static const ProtobufCFieldDescriptor nebula__dialog_response__field_descriptors[5] = +{ + { + "status", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_INT32, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogResponse, status), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "src", + 2, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogResponse, src), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dst", + 3, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogResponse, dst), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "dialog", + 4, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_MESSAGE, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__DialogResponse, dialog), + &nebula__address__descriptor, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 5, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(Nebula__DialogResponse, has_body), + PROTOBUF_C_OFFSETOF(Nebula__DialogResponse, body), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__dialog_response__field_indices_by_name[] = { + 4, /* field[4] = body */ + 3, /* field[3] = dialog */ + 2, /* field[2] = dst */ + 1, /* field[1] = src */ + 0, /* field[0] = status */ +}; +static const ProtobufCIntRange nebula__dialog_response__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 5 } +}; +const ProtobufCMessageDescriptor nebula__dialog_response__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.DialogResponse", + "DialogResponse", + "Nebula__DialogResponse", + "Nebula", + sizeof(Nebula__DialogResponse), + 5, + nebula__dialog_response__field_descriptors, + nebula__dialog_response__field_indices_by_name, + 1, nebula__dialog_response__number_ranges, + (ProtobufCMessageInit) nebula__dialog_response__init, + NULL,NULL,NULL /* reserved[123] */ +}; +const ProtobufCEnumValue nebula__presence_type__enum_values_by_number[3] = +{ + { "eIncrementSubscribe", "NEBULA__PRESENCE_TYPE__EINCREMENTSUBSCRIBE", 0 }, + { "eFullSubscribe", "NEBULA__PRESENCE_TYPE__EFULLSUBSCRIBE", 1 }, + { "eUnSubscribe", "NEBULA__PRESENCE_TYPE__EUNSUBSCRIBE", 2 }, +}; +static const ProtobufCIntRange nebula__presence_type__value_ranges[] = { +{0, 0},{0, 3} +}; +const ProtobufCEnumValueIndex nebula__presence_type__enum_values_by_name[3] = +{ + { "eFullSubscribe", 1 }, + { "eIncrementSubscribe", 0 }, + { "eUnSubscribe", 2 }, +}; +const ProtobufCEnumDescriptor nebula__presence_type__descriptor = +{ + PROTOBUF_C_ENUM_DESCRIPTOR_MAGIC, + "Nebula.PresenceType", + "PresenceType", + "Nebula__PresenceType", + "Nebula", + 3, + nebula__presence_type__enum_values_by_number, + 3, + nebula__presence_type__enum_values_by_name, + 1, + nebula__presence_type__value_ranges, + NULL,NULL,NULL,NULL /* reserved[1234] */ +}; diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/message.pb-c.h b/1_8.sip_push/nebula_sdk/sdk/proto/message.pb-c.h new file mode 100644 index 0000000..e647a63 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/message.pb-c.h @@ -0,0 +1,979 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ + +#ifndef PROTOBUF_C_message_2eproto__INCLUDED +#define PROTOBUF_C_message_2eproto__INCLUDED + +#include + +PROTOBUF_C_BEGIN_DECLS + + +typedef struct _Nebula__Param Nebula__Param; +typedef struct _Nebula__AccountUpdateRequest Nebula__AccountUpdateRequest; +typedef struct _Nebula__AccountUpdateResponse Nebula__AccountUpdateResponse; +typedef struct _Nebula__AuthRequest Nebula__AuthRequest; +typedef struct _Nebula__AuthResponse Nebula__AuthResponse; +typedef struct _Nebula__Message Nebula__Message; +typedef struct _Nebula__Message__Content Nebula__Message__Content; +typedef struct _Nebula__MessageSeq Nebula__MessageSeq; +typedef struct _Nebula__MessageSeq__Content Nebula__MessageSeq__Content; +typedef struct _Nebula__MessageKievAck Nebula__MessageKievAck; +typedef struct _Nebula__SubscribeRequest Nebula__SubscribeRequest; +typedef struct _Nebula__SubscribeResponse Nebula__SubscribeResponse; +typedef struct _Nebula__SubscribeResponse__Content Nebula__SubscribeResponse__Content; +typedef struct _Nebula__NotifyBody Nebula__NotifyBody; +typedef struct _Nebula__SmsRequest Nebula__SmsRequest; +typedef struct _Nebula__SmsRequest__FileInfo Nebula__SmsRequest__FileInfo; +typedef struct _Nebula__SmsResponse Nebula__SmsResponse; +typedef struct _Nebula__PresenceNotify Nebula__PresenceNotify; +typedef struct _Nebula__PresenceNotify__Content Nebula__PresenceNotify__Content; +typedef struct _Nebula__PresenceRequest Nebula__PresenceRequest; +typedef struct _Nebula__PresenceResponse Nebula__PresenceResponse; +typedef struct _Nebula__AccountStatusRequest Nebula__AccountStatusRequest; +typedef struct _Nebula__AccountStatusResponse Nebula__AccountStatusResponse; +typedef struct _Nebula__AccountStatusResponse__AccountStatus Nebula__AccountStatusResponse__AccountStatus; +typedef struct _Nebula__Address Nebula__Address; +typedef struct _Nebula__DialogRequest Nebula__DialogRequest; +typedef struct _Nebula__DialogResponse Nebula__DialogResponse; + + +/* --- enums --- */ + +typedef enum _Nebula__AuthRequest__Algorithm { + NEBULA__AUTH_REQUEST__ALGORITHM__MD5_MEIZU = 0, + NEBULA__AUTH_REQUEST__ALGORITHM__MD5_DAA = 1, + NEBULA__AUTH_REQUEST__ALGORITHM__MD5_FLYME = 2 +} Nebula__AuthRequest__Algorithm; +typedef enum _Nebula__Message__Content__MsgType { + NEBULA__MESSAGE__CONTENT__MSG_TYPE__ePushMessage = 0, + NEBULA__MESSAGE__CONTENT__MSG_TYPE__ePresenceMessage = 1, + NEBULA__MESSAGE__CONTENT__MSG_TYPE__eSmsMessage = 2 +} Nebula__Message__Content__MsgType; +typedef enum _Nebula__Message__Flag { + NEBULA__MESSAGE__FLAG__MESSAGE_ACK = 1, + NEBULA__MESSAGE__FLAG__MESSAGE_END = 2 +} Nebula__Message__Flag; +typedef enum _Nebula__SmsRequest__SmsType { + NEBULA__SMS_REQUEST__SMS_TYPE__eShortMessage = 0, + NEBULA__SMS_REQUEST__SMS_TYPE__eMultimediaMessage = 1, + NEBULA__SMS_REQUEST__SMS_TYPE__eReportMessage = 2 +} Nebula__SmsRequest__SmsType; +typedef enum _Nebula__SmsRequest__ReportType { + NEBULA__SMS_REQUEST__REPORT_TYPE__eSMSReport = 0, + NEBULA__SMS_REQUEST__REPORT_TYPE__eMMSReport = 1 +} Nebula__SmsRequest__ReportType; +typedef enum _Nebula__PresenceType { + NEBULA__PRESENCE_TYPE__eIncrementSubscribe = 0, + NEBULA__PRESENCE_TYPE__eFullSubscribe = 1, + NEBULA__PRESENCE_TYPE__eUnSubscribe = 2 +} Nebula__PresenceType; + +/* --- messages --- */ + +struct _Nebula__Param +{ + ProtobufCMessage base; + char *name; + char *value; +}; +#define NEBULA__PARAM__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__param__descriptor) \ + , NULL, NULL } + + +struct _Nebula__AccountUpdateRequest +{ + ProtobufCMessage base; + char *flyme_uid; + char *phone; + protobuf_c_boolean has_capability; + int32_t capability; +}; +#define NEBULA__ACCOUNT_UPDATE_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__account_update_request__descriptor) \ + , NULL, NULL, 0,0 } + + +struct _Nebula__AccountUpdateResponse +{ + ProtobufCMessage base; + int32_t status; + char *flyme_uid; + char *imsi; + char *phone; + protobuf_c_boolean has_capability; + int32_t capability; +}; +#define NEBULA__ACCOUNT_UPDATE_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__account_update_response__descriptor) \ + , 0, NULL, NULL, NULL, 0,0 } + + +struct _Nebula__AuthRequest +{ + ProtobufCMessage base; + char *uid; + char *username; + char *nonce; + char *realm; + char *token; + protobuf_c_boolean has_algorithm; + Nebula__AuthRequest__Algorithm algorithm; + size_t n_other_info; + Nebula__Param **other_info; +}; +#define NEBULA__AUTH_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__auth_request__descriptor) \ + , NULL, NULL, NULL, NULL, NULL, 0,0, 0,NULL } + + +struct _Nebula__AuthResponse +{ + ProtobufCMessage base; + protobuf_c_boolean has_status; + int32_t status; + char *nonce; + char *realm; +}; +#define NEBULA__AUTH_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__auth_response__descriptor) \ + , 0,0, NULL, NULL } + + +struct _Nebula__Message__Content +{ + ProtobufCMessage base; + Nebula__Message__Content__MsgType type; + char *account; + uint32_t seq; + protobuf_c_boolean has_body; + ProtobufCBinaryData body; +}; +#define NEBULA__MESSAGE__CONTENT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__message__content__descriptor) \ + , 0, NULL, 0, 0,{0,NULL} } + + +struct _Nebula__Message +{ + ProtobufCMessage base; + size_t n_content; + Nebula__Message__Content **content; + protobuf_c_boolean has_flag; + Nebula__Message__Flag flag; +}; +#define NEBULA__MESSAGE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__message__descriptor) \ + , 0,NULL, 0,0 } + + +struct _Nebula__MessageSeq__Content +{ + ProtobufCMessage base; + char *account; + uint32_t seq; +}; +#define NEBULA__MESSAGE_SEQ__CONTENT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__message_seq__content__descriptor) \ + , NULL, 0 } + + +struct _Nebula__MessageSeq +{ + ProtobufCMessage base; + size_t n_content; + Nebula__MessageSeq__Content **content; +}; +#define NEBULA__MESSAGE_SEQ__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__message_seq__descriptor) \ + , 0,NULL } + + +struct _Nebula__MessageKievAck +{ + ProtobufCMessage base; + Nebula__MessageSeq *seqs; + uint32_t index; +}; +#define NEBULA__MESSAGE_KIEV_ACK__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__message_kiev_ack__descriptor) \ + , NULL, 0 } + + +struct _Nebula__SubscribeRequest +{ + ProtobufCMessage base; + size_t n_app; + char **app; +}; +#define NEBULA__SUBSCRIBE_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__subscribe_request__descriptor) \ + , 0,NULL } + + +struct _Nebula__SubscribeResponse__Content +{ + ProtobufCMessage base; + protobuf_c_boolean has_status; + int32_t status; + char *app; + char *pushid; +}; +#define NEBULA__SUBSCRIBE_RESPONSE__CONTENT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__subscribe_response__content__descriptor) \ + , 0,0, NULL, NULL } + + +struct _Nebula__SubscribeResponse +{ + ProtobufCMessage base; + int32_t status; + size_t n_content; + Nebula__SubscribeResponse__Content **content; +}; +#define NEBULA__SUBSCRIBE_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__subscribe_response__descriptor) \ + , 0, 0,NULL } + + +struct _Nebula__NotifyBody +{ + ProtobufCMessage base; + char *app; + char *body; +}; +#define NEBULA__NOTIFY_BODY__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__notify_body__descriptor) \ + , NULL, NULL } + + +struct _Nebula__SmsRequest__FileInfo +{ + ProtobufCMessage base; + char *mimetype; + int32_t size; + char *filename; + char *url; +}; +#define NEBULA__SMS_REQUEST__FILE_INFO__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__sms_request__file_info__descriptor) \ + , NULL, 0, NULL, NULL } + + +struct _Nebula__SmsRequest +{ + ProtobufCMessage base; + Nebula__SmsRequest__SmsType type; + char *msgid; + char *src; + size_t n_dst; + char **dst; + protobuf_c_boolean has_body; + ProtobufCBinaryData body; + protobuf_c_boolean has_report_flag; + protobuf_c_boolean report_flag; + protobuf_c_boolean has_report_type; + Nebula__SmsRequest__ReportType report_type; + char *report_status; + char *time; + char *expires; + char *pdu; + protobuf_c_boolean has_size; + int32_t size; + char *ver; + size_t n_fileinfos; + Nebula__SmsRequest__FileInfo **fileinfos; +}; +#define NEBULA__SMS_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__sms_request__descriptor) \ + , 0, NULL, NULL, 0,NULL, 0,{0,NULL}, 0,0, 0,0, NULL, NULL, NULL, NULL, 0,0, NULL, 0,NULL } + + +struct _Nebula__SmsResponse +{ + ProtobufCMessage base; + char *msgid; + int32_t status; +}; +#define NEBULA__SMS_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__sms_response__descriptor) \ + , NULL, 0 } + + +struct _Nebula__PresenceNotify__Content +{ + ProtobufCMessage base; + char *account; + protobuf_c_boolean has_capability; + int32_t capability; + protobuf_c_boolean has_status; + int32_t status; +}; +#define NEBULA__PRESENCE_NOTIFY__CONTENT__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__presence_notify__content__descriptor) \ + , NULL, 0,0, 0,0 } + + +struct _Nebula__PresenceNotify +{ + ProtobufCMessage base; + size_t n_content; + Nebula__PresenceNotify__Content **content; +}; +#define NEBULA__PRESENCE_NOTIFY__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__presence_notify__descriptor) \ + , 0,NULL } + + +struct _Nebula__PresenceRequest +{ + ProtobufCMessage base; + protobuf_c_boolean has_type; + Nebula__PresenceType type; + protobuf_c_boolean has_sequence; + uint32_t sequence; + size_t n_account; + char **account; +}; +#define NEBULA__PRESENCE_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__presence_request__descriptor) \ + , 0,0, 0,0, 0,NULL } + + +struct _Nebula__PresenceResponse +{ + ProtobufCMessage base; + int32_t status; + protobuf_c_boolean has_type; + Nebula__PresenceType type; + protobuf_c_boolean has_sequence; + uint32_t sequence; + size_t n_account; + char **account; +}; +#define NEBULA__PRESENCE_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__presence_response__descriptor) \ + , 0, 0,0, 0,0, 0,NULL } + + +struct _Nebula__AccountStatusRequest +{ + ProtobufCMessage base; + size_t n_account; + char **account; +}; +#define NEBULA__ACCOUNT_STATUS_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__account_status_request__descriptor) \ + , 0,NULL } + + +struct _Nebula__AccountStatusResponse__AccountStatus +{ + ProtobufCMessage base; + char *account; + protobuf_c_boolean has_status; + int32_t status; + protobuf_c_boolean has_capability; + int32_t capability; +}; +#define NEBULA__ACCOUNT_STATUS_RESPONSE__ACCOUNT_STATUS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__account_status_response__account_status__descriptor) \ + , NULL, 0,0, 0,0 } + + +struct _Nebula__AccountStatusResponse +{ + ProtobufCMessage base; + int32_t status; + size_t n_result; + Nebula__AccountStatusResponse__AccountStatus **result; +}; +#define NEBULA__ACCOUNT_STATUS_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__account_status_response__descriptor) \ + , 0, 0,NULL } + + +struct _Nebula__Address +{ + ProtobufCMessage base; + char *host; + int32_t port; +}; +#define NEBULA__ADDRESS__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__address__descriptor) \ + , NULL, 0 } + + +struct _Nebula__DialogRequest +{ + ProtobufCMessage base; + char *src; + char *dst; + Nebula__Address *dialog; + protobuf_c_boolean has_body; + ProtobufCBinaryData body; +}; +#define NEBULA__DIALOG_REQUEST__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__dialog_request__descriptor) \ + , NULL, NULL, NULL, 0,{0,NULL} } + + +struct _Nebula__DialogResponse +{ + ProtobufCMessage base; + int32_t status; + char *src; + char *dst; + Nebula__Address *dialog; + protobuf_c_boolean has_body; + ProtobufCBinaryData body; +}; +#define NEBULA__DIALOG_RESPONSE__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__dialog_response__descriptor) \ + , 0, NULL, NULL, NULL, 0,{0,NULL} } + + +/* Nebula__Param methods */ +void nebula__param__init + (Nebula__Param *message); +size_t nebula__param__get_packed_size + (const Nebula__Param *message); +size_t nebula__param__pack + (const Nebula__Param *message, + uint8_t *out); +size_t nebula__param__pack_to_buffer + (const Nebula__Param *message, + ProtobufCBuffer *buffer); +Nebula__Param * + nebula__param__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__param__free_unpacked + (Nebula__Param *message, + ProtobufCAllocator *allocator); +/* Nebula__AccountUpdateRequest methods */ +void nebula__account_update_request__init + (Nebula__AccountUpdateRequest *message); +size_t nebula__account_update_request__get_packed_size + (const Nebula__AccountUpdateRequest *message); +size_t nebula__account_update_request__pack + (const Nebula__AccountUpdateRequest *message, + uint8_t *out); +size_t nebula__account_update_request__pack_to_buffer + (const Nebula__AccountUpdateRequest *message, + ProtobufCBuffer *buffer); +Nebula__AccountUpdateRequest * + nebula__account_update_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__account_update_request__free_unpacked + (Nebula__AccountUpdateRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__AccountUpdateResponse methods */ +void nebula__account_update_response__init + (Nebula__AccountUpdateResponse *message); +size_t nebula__account_update_response__get_packed_size + (const Nebula__AccountUpdateResponse *message); +size_t nebula__account_update_response__pack + (const Nebula__AccountUpdateResponse *message, + uint8_t *out); +size_t nebula__account_update_response__pack_to_buffer + (const Nebula__AccountUpdateResponse *message, + ProtobufCBuffer *buffer); +Nebula__AccountUpdateResponse * + nebula__account_update_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__account_update_response__free_unpacked + (Nebula__AccountUpdateResponse *message, + ProtobufCAllocator *allocator); +/* Nebula__AuthRequest methods */ +void nebula__auth_request__init + (Nebula__AuthRequest *message); +size_t nebula__auth_request__get_packed_size + (const Nebula__AuthRequest *message); +size_t nebula__auth_request__pack + (const Nebula__AuthRequest *message, + uint8_t *out); +size_t nebula__auth_request__pack_to_buffer + (const Nebula__AuthRequest *message, + ProtobufCBuffer *buffer); +Nebula__AuthRequest * + nebula__auth_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__auth_request__free_unpacked + (Nebula__AuthRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__AuthResponse methods */ +void nebula__auth_response__init + (Nebula__AuthResponse *message); +size_t nebula__auth_response__get_packed_size + (const Nebula__AuthResponse *message); +size_t nebula__auth_response__pack + (const Nebula__AuthResponse *message, + uint8_t *out); +size_t nebula__auth_response__pack_to_buffer + (const Nebula__AuthResponse *message, + ProtobufCBuffer *buffer); +Nebula__AuthResponse * + nebula__auth_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__auth_response__free_unpacked + (Nebula__AuthResponse *message, + ProtobufCAllocator *allocator); +/* Nebula__Message__Content methods */ +void nebula__message__content__init + (Nebula__Message__Content *message); +/* Nebula__Message methods */ +void nebula__message__init + (Nebula__Message *message); +size_t nebula__message__get_packed_size + (const Nebula__Message *message); +size_t nebula__message__pack + (const Nebula__Message *message, + uint8_t *out); +size_t nebula__message__pack_to_buffer + (const Nebula__Message *message, + ProtobufCBuffer *buffer); +Nebula__Message * + nebula__message__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__message__free_unpacked + (Nebula__Message *message, + ProtobufCAllocator *allocator); +/* Nebula__MessageSeq__Content methods */ +void nebula__message_seq__content__init + (Nebula__MessageSeq__Content *message); +/* Nebula__MessageSeq methods */ +void nebula__message_seq__init + (Nebula__MessageSeq *message); +size_t nebula__message_seq__get_packed_size + (const Nebula__MessageSeq *message); +size_t nebula__message_seq__pack + (const Nebula__MessageSeq *message, + uint8_t *out); +size_t nebula__message_seq__pack_to_buffer + (const Nebula__MessageSeq *message, + ProtobufCBuffer *buffer); +Nebula__MessageSeq * + nebula__message_seq__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__message_seq__free_unpacked + (Nebula__MessageSeq *message, + ProtobufCAllocator *allocator); +/* Nebula__MessageKievAck methods */ +void nebula__message_kiev_ack__init + (Nebula__MessageKievAck *message); +size_t nebula__message_kiev_ack__get_packed_size + (const Nebula__MessageKievAck *message); +size_t nebula__message_kiev_ack__pack + (const Nebula__MessageKievAck *message, + uint8_t *out); +size_t nebula__message_kiev_ack__pack_to_buffer + (const Nebula__MessageKievAck *message, + ProtobufCBuffer *buffer); +Nebula__MessageKievAck * + nebula__message_kiev_ack__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__message_kiev_ack__free_unpacked + (Nebula__MessageKievAck *message, + ProtobufCAllocator *allocator); +/* Nebula__SubscribeRequest methods */ +void nebula__subscribe_request__init + (Nebula__SubscribeRequest *message); +size_t nebula__subscribe_request__get_packed_size + (const Nebula__SubscribeRequest *message); +size_t nebula__subscribe_request__pack + (const Nebula__SubscribeRequest *message, + uint8_t *out); +size_t nebula__subscribe_request__pack_to_buffer + (const Nebula__SubscribeRequest *message, + ProtobufCBuffer *buffer); +Nebula__SubscribeRequest * + nebula__subscribe_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__subscribe_request__free_unpacked + (Nebula__SubscribeRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__SubscribeResponse__Content methods */ +void nebula__subscribe_response__content__init + (Nebula__SubscribeResponse__Content *message); +/* Nebula__SubscribeResponse methods */ +void nebula__subscribe_response__init + (Nebula__SubscribeResponse *message); +size_t nebula__subscribe_response__get_packed_size + (const Nebula__SubscribeResponse *message); +size_t nebula__subscribe_response__pack + (const Nebula__SubscribeResponse *message, + uint8_t *out); +size_t nebula__subscribe_response__pack_to_buffer + (const Nebula__SubscribeResponse *message, + ProtobufCBuffer *buffer); +Nebula__SubscribeResponse * + nebula__subscribe_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__subscribe_response__free_unpacked + (Nebula__SubscribeResponse *message, + ProtobufCAllocator *allocator); +/* Nebula__NotifyBody methods */ +void nebula__notify_body__init + (Nebula__NotifyBody *message); +size_t nebula__notify_body__get_packed_size + (const Nebula__NotifyBody *message); +size_t nebula__notify_body__pack + (const Nebula__NotifyBody *message, + uint8_t *out); +size_t nebula__notify_body__pack_to_buffer + (const Nebula__NotifyBody *message, + ProtobufCBuffer *buffer); +Nebula__NotifyBody * + nebula__notify_body__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__notify_body__free_unpacked + (Nebula__NotifyBody *message, + ProtobufCAllocator *allocator); +/* Nebula__SmsRequest__FileInfo methods */ +void nebula__sms_request__file_info__init + (Nebula__SmsRequest__FileInfo *message); +/* Nebula__SmsRequest methods */ +void nebula__sms_request__init + (Nebula__SmsRequest *message); +size_t nebula__sms_request__get_packed_size + (const Nebula__SmsRequest *message); +size_t nebula__sms_request__pack + (const Nebula__SmsRequest *message, + uint8_t *out); +size_t nebula__sms_request__pack_to_buffer + (const Nebula__SmsRequest *message, + ProtobufCBuffer *buffer); +Nebula__SmsRequest * + nebula__sms_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__sms_request__free_unpacked + (Nebula__SmsRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__SmsResponse methods */ +void nebula__sms_response__init + (Nebula__SmsResponse *message); +size_t nebula__sms_response__get_packed_size + (const Nebula__SmsResponse *message); +size_t nebula__sms_response__pack + (const Nebula__SmsResponse *message, + uint8_t *out); +size_t nebula__sms_response__pack_to_buffer + (const Nebula__SmsResponse *message, + ProtobufCBuffer *buffer); +Nebula__SmsResponse * + nebula__sms_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__sms_response__free_unpacked + (Nebula__SmsResponse *message, + ProtobufCAllocator *allocator); +/* Nebula__PresenceNotify__Content methods */ +void nebula__presence_notify__content__init + (Nebula__PresenceNotify__Content *message); +/* Nebula__PresenceNotify methods */ +void nebula__presence_notify__init + (Nebula__PresenceNotify *message); +size_t nebula__presence_notify__get_packed_size + (const Nebula__PresenceNotify *message); +size_t nebula__presence_notify__pack + (const Nebula__PresenceNotify *message, + uint8_t *out); +size_t nebula__presence_notify__pack_to_buffer + (const Nebula__PresenceNotify *message, + ProtobufCBuffer *buffer); +Nebula__PresenceNotify * + nebula__presence_notify__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__presence_notify__free_unpacked + (Nebula__PresenceNotify *message, + ProtobufCAllocator *allocator); +/* Nebula__PresenceRequest methods */ +void nebula__presence_request__init + (Nebula__PresenceRequest *message); +size_t nebula__presence_request__get_packed_size + (const Nebula__PresenceRequest *message); +size_t nebula__presence_request__pack + (const Nebula__PresenceRequest *message, + uint8_t *out); +size_t nebula__presence_request__pack_to_buffer + (const Nebula__PresenceRequest *message, + ProtobufCBuffer *buffer); +Nebula__PresenceRequest * + nebula__presence_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__presence_request__free_unpacked + (Nebula__PresenceRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__PresenceResponse methods */ +void nebula__presence_response__init + (Nebula__PresenceResponse *message); +size_t nebula__presence_response__get_packed_size + (const Nebula__PresenceResponse *message); +size_t nebula__presence_response__pack + (const Nebula__PresenceResponse *message, + uint8_t *out); +size_t nebula__presence_response__pack_to_buffer + (const Nebula__PresenceResponse *message, + ProtobufCBuffer *buffer); +Nebula__PresenceResponse * + nebula__presence_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__presence_response__free_unpacked + (Nebula__PresenceResponse *message, + ProtobufCAllocator *allocator); +/* Nebula__AccountStatusRequest methods */ +void nebula__account_status_request__init + (Nebula__AccountStatusRequest *message); +size_t nebula__account_status_request__get_packed_size + (const Nebula__AccountStatusRequest *message); +size_t nebula__account_status_request__pack + (const Nebula__AccountStatusRequest *message, + uint8_t *out); +size_t nebula__account_status_request__pack_to_buffer + (const Nebula__AccountStatusRequest *message, + ProtobufCBuffer *buffer); +Nebula__AccountStatusRequest * + nebula__account_status_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__account_status_request__free_unpacked + (Nebula__AccountStatusRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__AccountStatusResponse__AccountStatus methods */ +void nebula__account_status_response__account_status__init + (Nebula__AccountStatusResponse__AccountStatus *message); +/* Nebula__AccountStatusResponse methods */ +void nebula__account_status_response__init + (Nebula__AccountStatusResponse *message); +size_t nebula__account_status_response__get_packed_size + (const Nebula__AccountStatusResponse *message); +size_t nebula__account_status_response__pack + (const Nebula__AccountStatusResponse *message, + uint8_t *out); +size_t nebula__account_status_response__pack_to_buffer + (const Nebula__AccountStatusResponse *message, + ProtobufCBuffer *buffer); +Nebula__AccountStatusResponse * + nebula__account_status_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__account_status_response__free_unpacked + (Nebula__AccountStatusResponse *message, + ProtobufCAllocator *allocator); +/* Nebula__Address methods */ +void nebula__address__init + (Nebula__Address *message); +size_t nebula__address__get_packed_size + (const Nebula__Address *message); +size_t nebula__address__pack + (const Nebula__Address *message, + uint8_t *out); +size_t nebula__address__pack_to_buffer + (const Nebula__Address *message, + ProtobufCBuffer *buffer); +Nebula__Address * + nebula__address__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__address__free_unpacked + (Nebula__Address *message, + ProtobufCAllocator *allocator); +/* Nebula__DialogRequest methods */ +void nebula__dialog_request__init + (Nebula__DialogRequest *message); +size_t nebula__dialog_request__get_packed_size + (const Nebula__DialogRequest *message); +size_t nebula__dialog_request__pack + (const Nebula__DialogRequest *message, + uint8_t *out); +size_t nebula__dialog_request__pack_to_buffer + (const Nebula__DialogRequest *message, + ProtobufCBuffer *buffer); +Nebula__DialogRequest * + nebula__dialog_request__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__dialog_request__free_unpacked + (Nebula__DialogRequest *message, + ProtobufCAllocator *allocator); +/* Nebula__DialogResponse methods */ +void nebula__dialog_response__init + (Nebula__DialogResponse *message); +size_t nebula__dialog_response__get_packed_size + (const Nebula__DialogResponse *message); +size_t nebula__dialog_response__pack + (const Nebula__DialogResponse *message, + uint8_t *out); +size_t nebula__dialog_response__pack_to_buffer + (const Nebula__DialogResponse *message, + ProtobufCBuffer *buffer); +Nebula__DialogResponse * + nebula__dialog_response__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__dialog_response__free_unpacked + (Nebula__DialogResponse *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Nebula__Param_Closure) + (const Nebula__Param *message, + void *closure_data); +typedef void (*Nebula__AccountUpdateRequest_Closure) + (const Nebula__AccountUpdateRequest *message, + void *closure_data); +typedef void (*Nebula__AccountUpdateResponse_Closure) + (const Nebula__AccountUpdateResponse *message, + void *closure_data); +typedef void (*Nebula__AuthRequest_Closure) + (const Nebula__AuthRequest *message, + void *closure_data); +typedef void (*Nebula__AuthResponse_Closure) + (const Nebula__AuthResponse *message, + void *closure_data); +typedef void (*Nebula__Message__Content_Closure) + (const Nebula__Message__Content *message, + void *closure_data); +typedef void (*Nebula__Message_Closure) + (const Nebula__Message *message, + void *closure_data); +typedef void (*Nebula__MessageSeq__Content_Closure) + (const Nebula__MessageSeq__Content *message, + void *closure_data); +typedef void (*Nebula__MessageSeq_Closure) + (const Nebula__MessageSeq *message, + void *closure_data); +typedef void (*Nebula__MessageKievAck_Closure) + (const Nebula__MessageKievAck *message, + void *closure_data); +typedef void (*Nebula__SubscribeRequest_Closure) + (const Nebula__SubscribeRequest *message, + void *closure_data); +typedef void (*Nebula__SubscribeResponse__Content_Closure) + (const Nebula__SubscribeResponse__Content *message, + void *closure_data); +typedef void (*Nebula__SubscribeResponse_Closure) + (const Nebula__SubscribeResponse *message, + void *closure_data); +typedef void (*Nebula__NotifyBody_Closure) + (const Nebula__NotifyBody *message, + void *closure_data); +typedef void (*Nebula__SmsRequest__FileInfo_Closure) + (const Nebula__SmsRequest__FileInfo *message, + void *closure_data); +typedef void (*Nebula__SmsRequest_Closure) + (const Nebula__SmsRequest *message, + void *closure_data); +typedef void (*Nebula__SmsResponse_Closure) + (const Nebula__SmsResponse *message, + void *closure_data); +typedef void (*Nebula__PresenceNotify__Content_Closure) + (const Nebula__PresenceNotify__Content *message, + void *closure_data); +typedef void (*Nebula__PresenceNotify_Closure) + (const Nebula__PresenceNotify *message, + void *closure_data); +typedef void (*Nebula__PresenceRequest_Closure) + (const Nebula__PresenceRequest *message, + void *closure_data); +typedef void (*Nebula__PresenceResponse_Closure) + (const Nebula__PresenceResponse *message, + void *closure_data); +typedef void (*Nebula__AccountStatusRequest_Closure) + (const Nebula__AccountStatusRequest *message, + void *closure_data); +typedef void (*Nebula__AccountStatusResponse__AccountStatus_Closure) + (const Nebula__AccountStatusResponse__AccountStatus *message, + void *closure_data); +typedef void (*Nebula__AccountStatusResponse_Closure) + (const Nebula__AccountStatusResponse *message, + void *closure_data); +typedef void (*Nebula__Address_Closure) + (const Nebula__Address *message, + void *closure_data); +typedef void (*Nebula__DialogRequest_Closure) + (const Nebula__DialogRequest *message, + void *closure_data); +typedef void (*Nebula__DialogResponse_Closure) + (const Nebula__DialogResponse *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCEnumDescriptor nebula__presence_type__descriptor; +extern const ProtobufCMessageDescriptor nebula__param__descriptor; +extern const ProtobufCMessageDescriptor nebula__account_update_request__descriptor; +extern const ProtobufCMessageDescriptor nebula__account_update_response__descriptor; +extern const ProtobufCMessageDescriptor nebula__auth_request__descriptor; +extern const ProtobufCEnumDescriptor nebula__auth_request__algorithm__descriptor; +extern const ProtobufCMessageDescriptor nebula__auth_response__descriptor; +extern const ProtobufCMessageDescriptor nebula__message__descriptor; +extern const ProtobufCMessageDescriptor nebula__message__content__descriptor; +extern const ProtobufCEnumDescriptor nebula__message__content__msg_type__descriptor; +extern const ProtobufCEnumDescriptor nebula__message__flag__descriptor; +extern const ProtobufCMessageDescriptor nebula__message_seq__descriptor; +extern const ProtobufCMessageDescriptor nebula__message_seq__content__descriptor; +extern const ProtobufCMessageDescriptor nebula__message_kiev_ack__descriptor; +extern const ProtobufCMessageDescriptor nebula__subscribe_request__descriptor; +extern const ProtobufCMessageDescriptor nebula__subscribe_response__descriptor; +extern const ProtobufCMessageDescriptor nebula__subscribe_response__content__descriptor; +extern const ProtobufCMessageDescriptor nebula__notify_body__descriptor; +extern const ProtobufCMessageDescriptor nebula__sms_request__descriptor; +extern const ProtobufCMessageDescriptor nebula__sms_request__file_info__descriptor; +extern const ProtobufCEnumDescriptor nebula__sms_request__sms_type__descriptor; +extern const ProtobufCEnumDescriptor nebula__sms_request__report_type__descriptor; +extern const ProtobufCMessageDescriptor nebula__sms_response__descriptor; +extern const ProtobufCMessageDescriptor nebula__presence_notify__descriptor; +extern const ProtobufCMessageDescriptor nebula__presence_notify__content__descriptor; +extern const ProtobufCMessageDescriptor nebula__presence_request__descriptor; +extern const ProtobufCMessageDescriptor nebula__presence_response__descriptor; +extern const ProtobufCMessageDescriptor nebula__account_status_request__descriptor; +extern const ProtobufCMessageDescriptor nebula__account_status_response__descriptor; +extern const ProtobufCMessageDescriptor nebula__account_status_response__account_status__descriptor; +extern const ProtobufCMessageDescriptor nebula__address__descriptor; +extern const ProtobufCMessageDescriptor nebula__dialog_request__descriptor; +extern const ProtobufCMessageDescriptor nebula__dialog_response__descriptor; + +PROTOBUF_C_END_DECLS + + +#endif /* PROTOBUF_message_2eproto__INCLUDED */ diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/message.proto b/1_8.sip_push/nebula_sdk/sdk/proto/message.proto new file mode 100644 index 0000000..5f6d910 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/message.proto @@ -0,0 +1,248 @@ +package Nebula; +option java_package = "com.meizu.push.proto"; +option java_outer_classname = "ProtoMessages"; + +message Param +{ + optional string name = 1; + optional string value = 2; +}; + +message AccountUpdateRequest +{ + optional string flyme_uid = 1; + optional string phone = 2; + optional int32 capability = 3; //能力值 +}; + +message AccountUpdateResponse +{ + //200 OK + //4XX 检验错误 携带相应的正确值 + //5XX 其他错误 + required int32 status = 1; //账号绑定的结果 200 OK + optional string flyme_uid = 2; //正确的flyme_uid + optional string imsi = 3; //正确的imsi + optional string phone = 4; //正确的电话号码 + optional int32 capability = 5; //能力值 +}; + +//鉴权请求 +message AuthRequest +{ + enum Algorithm + { + MD5_MEIZU = 0; + MD5_DAA = 1; + MD5_FLYME = 2; + }; + required string uid = 1; //用户的唯一标识 + optional string username = 2; //鉴权使用 + optional string nonce = 3; //鉴权使用 + optional string realm = 4; //鉴权使用 + optional string token = 5; //鉴权使用 + optional Algorithm algorithm = 6; //鉴权使用 + repeated Param other_info = 7; //用户的其他信息 比如 手机型号 OS版本等 +}; + +//鉴权应答 +message AuthResponse +{ + optional int32 status = 1; + optional string nonce = 2; + optional string realm = 3; +}; + + +//服务端向下推送的消息 +message Message +{ + message Content + { + enum MsgType + { + ePushMessage = 0; //push消息 + ePresenceMessage = 1; //presence消息 + eSmsMessage = 2; //短信消息 + }; + required MsgType type = 1; //消息类型 + required string account = 2; + required uint32 seq = 3; //消息序列号 + optional bytes body = 4; //消息内容 使用protobuf编码 + }; + enum Flag + { + MESSAGE_ACK = 1; + MESSAGE_END = 2; + }; + repeated Content content = 1; + optional Flag flag = 2; +} + +//ACK SYNC FIN 3种消息 +message MessageSeq +{ + message Content + { + required string account = 1; + required uint32 seq = 2; + }; + repeated Content content = 1; //需要同步的消息编号 +}; + +message MessageKievAck +{ + required MessageSeq seqs = 1; + required uint32 index = 2; +}; + +//订阅请求消息 +message SubscribeRequest +{ + repeated string app = 1; //订阅的app +}; + +//订阅应答消息 +message SubscribeResponse +{ + message Content { + optional int32 status = 1; //订阅状态 200 ok + optional string app = 2; //订阅的app + optional string pushid = 3; //返回的pushid + }; + required int32 status = 1; //应答消息的状态 + repeated Content content = 2; //订阅结果 +}; + +////////////////MessageSend的body定义///////////////////// +message NotifyBody +{ + optional string app = 1; + optional string body = 2; +}; + + +//短信消息 +message SmsRequest +{ + enum SmsType + { + eShortMessage = 0; + eMultimediaMessage = 1; + eReportMessage = 2; + }; + message FileInfo + { + required string mimetype = 1; + required int32 size = 2; + optional string filename = 3; + optional string url = 4; + }; + enum ReportType + { + eSMSReport = 0; + eMMSReport = 1; + }; + required SmsType type = 1; //消息类型 + required string msgid = 2; //消息ID + required string src = 3; + repeated string dst = 4; //接收者 + optional bytes body = 5; + optional bool report_flag = 6; //sms或者mms消息使用 report标志 + optional ReportType report_type = 7; + optional string report_status = 8; //report消息使用 + optional string time = 9; + optional string expires = 10; + optional string pdu = 11; + optional int32 size = 12; + optional string ver = 13; + repeated FileInfo fileinfos = 14; +}; + +//Message应答消息的内容 +message SmsResponse +{ + required string msgid = 1; + required int32 status = 2; +}; + +//presence推送内容格式 +message PresenceNotify +{ + message Content + { + optional string account = 1; + optional int32 capability = 2; + optional int32 status = 3; //在线状态 + }; + + repeated Content content = 1; +}; +/////////////////////////MessageSend body end/////////////////////////// + + +enum PresenceType +{ + eIncrementSubscribe = 0; //增量订阅 + eFullSubscribe = 1; //全量订阅 + eUnSubscribe = 2; //取消订阅 +}; + +//presence订阅或取消订阅格式 +message PresenceRequest +{ + optional PresenceType type = 1; + optional uint32 sequence = 2; + repeated string account = 3; +}; + +message PresenceResponse +{ + required int32 status = 1; + optional PresenceType type = 2; + optional uint32 sequence = 3; + repeated string account = 4; // Return the legal account +}; + +//查询账号在线状态格式 +message AccountStatusRequest +{ + repeated string account = 1; +}; + +message AccountStatusResponse +{ + message AccountStatus + { + optional string account = 1; + optional int32 status = 2; //查询在线状态 + optional int32 capability = 3; //能力值 + }; + + required int32 status = 1; + repeated AccountStatus result = 2; +}; + +/////////////////对话协议定义//////////////////////////// +message Address +{ + required string host = 1; + required int32 port = 2; +}; + +message DialogRequest +{ + required string src = 1; + required string dst = 2; + optional Address dialog = 3; //dialog服务器地址 + optional bytes body = 4; +}; + +message DialogResponse +{ + required int32 status = 1; + required string src = 2; + required string dst = 3; + optional Address dialog = 4; //dialog服务器地址 + optional bytes body = 5; +}; diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula.o b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.o new file mode 100644 index 0000000..ff31368 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula.pb-c.c b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.pb-c.c new file mode 100644 index 0000000..f0794ea --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.pb-c.c @@ -0,0 +1,102 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ + +/* Do not generate deprecated warnings for self */ +#ifndef PROTOBUF_C_NO_DEPRECATED +#define PROTOBUF_C_NO_DEPRECATED +#endif + +#include "nebula.pb-c.h" +void nebula__nebula_msg__init + (Nebula__NebulaMsg *message) +{ + static Nebula__NebulaMsg init_value = NEBULA__NEBULA_MSG__INIT; + *message = init_value; +} +size_t nebula__nebula_msg__get_packed_size + (const Nebula__NebulaMsg *message) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__nebula_msg__descriptor); + return protobuf_c_message_get_packed_size ((const ProtobufCMessage*)(message)); +} +size_t nebula__nebula_msg__pack + (const Nebula__NebulaMsg *message, + uint8_t *out) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__nebula_msg__descriptor); + return protobuf_c_message_pack ((const ProtobufCMessage*)message, out); +} +size_t nebula__nebula_msg__pack_to_buffer + (const Nebula__NebulaMsg *message, + ProtobufCBuffer *buffer) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__nebula_msg__descriptor); + return protobuf_c_message_pack_to_buffer ((const ProtobufCMessage*)message, buffer); +} +Nebula__NebulaMsg * + nebula__nebula_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data) +{ + return (Nebula__NebulaMsg *) + protobuf_c_message_unpack (&nebula__nebula_msg__descriptor, + allocator, len, data); +} +void nebula__nebula_msg__free_unpacked + (Nebula__NebulaMsg *message, + ProtobufCAllocator *allocator) +{ + PROTOBUF_C_ASSERT (message->base.descriptor == &nebula__nebula_msg__descriptor); + protobuf_c_message_free_unpacked ((ProtobufCMessage*)message, allocator); +} +static const ProtobufCFieldDescriptor nebula__nebula_msg__field_descriptors[2] = +{ + { + "msgid", + 1, + PROTOBUF_C_LABEL_REQUIRED, + PROTOBUF_C_TYPE_STRING, + 0, /* quantifier_offset */ + PROTOBUF_C_OFFSETOF(Nebula__NebulaMsg, msgid), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, + { + "body", + 2, + PROTOBUF_C_LABEL_OPTIONAL, + PROTOBUF_C_TYPE_BYTES, + PROTOBUF_C_OFFSETOF(Nebula__NebulaMsg, has_body), + PROTOBUF_C_OFFSETOF(Nebula__NebulaMsg, body), + NULL, + NULL, + 0, /* packed */ + 0,NULL,NULL /* reserved1,reserved2, etc */ + }, +}; +static const unsigned nebula__nebula_msg__field_indices_by_name[] = { + 1, /* field[1] = body */ + 0, /* field[0] = msgid */ +}; +static const ProtobufCIntRange nebula__nebula_msg__number_ranges[1 + 1] = +{ + { 1, 0 }, + { 0, 2 } +}; +const ProtobufCMessageDescriptor nebula__nebula_msg__descriptor = +{ + PROTOBUF_C_MESSAGE_DESCRIPTOR_MAGIC, + "Nebula.NebulaMsg", + "NebulaMsg", + "Nebula__NebulaMsg", + "Nebula", + sizeof(Nebula__NebulaMsg), + 2, + nebula__nebula_msg__field_descriptors, + nebula__nebula_msg__field_indices_by_name, + 1, nebula__nebula_msg__number_ranges, + (ProtobufCMessageInit) nebula__nebula_msg__init, + NULL,NULL,NULL /* reserved[123] */ +}; diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula.pb-c.h b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.pb-c.h new file mode 100644 index 0000000..7fbcb12 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.pb-c.h @@ -0,0 +1,66 @@ +/* Generated by the protocol buffer compiler. DO NOT EDIT! */ + +#ifndef PROTOBUF_C_nebula_2eproto__INCLUDED +#define PROTOBUF_C_nebula_2eproto__INCLUDED + +#include + +PROTOBUF_C_BEGIN_DECLS + + +typedef struct _Nebula__NebulaMsg Nebula__NebulaMsg; + + +/* --- enums --- */ + + +/* --- messages --- */ + +struct _Nebula__NebulaMsg +{ + ProtobufCMessage base; + char *msgid; + protobuf_c_boolean has_body; + ProtobufCBinaryData body; +}; +#define NEBULA__NEBULA_MSG__INIT \ + { PROTOBUF_C_MESSAGE_INIT (&nebula__nebula_msg__descriptor) \ + , NULL, 0,{0,NULL} } + + +/* Nebula__NebulaMsg methods */ +void nebula__nebula_msg__init + (Nebula__NebulaMsg *message); +size_t nebula__nebula_msg__get_packed_size + (const Nebula__NebulaMsg *message); +size_t nebula__nebula_msg__pack + (const Nebula__NebulaMsg *message, + uint8_t *out); +size_t nebula__nebula_msg__pack_to_buffer + (const Nebula__NebulaMsg *message, + ProtobufCBuffer *buffer); +Nebula__NebulaMsg * + nebula__nebula_msg__unpack + (ProtobufCAllocator *allocator, + size_t len, + const uint8_t *data); +void nebula__nebula_msg__free_unpacked + (Nebula__NebulaMsg *message, + ProtobufCAllocator *allocator); +/* --- per-message closures --- */ + +typedef void (*Nebula__NebulaMsg_Closure) + (const Nebula__NebulaMsg *message, + void *closure_data); + +/* --- services --- */ + + +/* --- descriptors --- */ + +extern const ProtobufCMessageDescriptor nebula__nebula_msg__descriptor; + +PROTOBUF_C_END_DECLS + + +#endif /* PROTOBUF_nebula_2eproto__INCLUDED */ diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula.proto b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.proto new file mode 100644 index 0000000..324b37e --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/nebula.proto @@ -0,0 +1,9 @@ +package Nebula; + +option java_package = "com.meizu.push.proto"; +message NebulaMsg +{ + required string msgid = 1; //消息id不加密不压缩 + optional bytes body = 2; //消息内容(可能加密和压缩) +}; + diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.c b/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.c new file mode 100644 index 0000000..bd9409a --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.c @@ -0,0 +1,112 @@ +#include "nebula_proto.h" +#include +#include +#include +#include +#include + +static const char* StrRequestType[] = { + "REQ PING", + "REQ AUTH", + "REQ MSGSYNC", + "REQ MSGPSH", + "REQ MSG", + "REQ MSGACK", + "REQ MSGFIN", + "REQ SUB", + "REQ SMS", + "REQ PRES", + "REQ ACCSTATUS", + "REQ INVITE", + "REQ ACK", + "REQ BYE", + "REQ UPDATE", + "REQ ACCUPDATE" +}; + +static const char* StrResponseType[] = { + "RSP PING", + "RSP AUTH", + "RSP MSGSYNC", + "RSP MSGPSH", + "RSP MSG", + "RSP MSGACK", + "RSP MSGFIN", + "RSP SUB", + "RSP SMS", + "RSP PRES", + "RSP ACCSTATUS", + "RSP INVITE", + "RSP ACK", + "RSP BYE", + "RSP UPDATE", + "RSP ACCUPDATE" +}; + +const char* MsgType2Str(uint8_t type) +{ + uint8_t request_flag = (type >> 7 & 0x01); + uint8_t msg_type = type & 0x7F; + switch (msg_type) { //内部服务使用的协议 + case NEBULA_KIEV_ACCOFFLINE: + return (request_flag ? "REQ ACCOFFLINE" : "RSP ACCOFFLINE"); + case NEBULA_KIEV_ACCONLINE: + return (request_flag ? "REQ ACCONLINE" : "RSP ACCONLINE"); + case NEBULA_KIEV_MSGACK: + return (request_flag ? "REQ KIEVACK" : "RSP KIEVACK"); + default: + break; + } + + if (!IS_VALID_TYPE(type)) { + return (request_flag ? "REQ UnKnown": "RSP UnKnown"); + } + + if (request_flag) { + return StrRequestType[msg_type - 1]; + } + + return StrResponseType[msg_type-1]; +} + +uint32_t CreateMachineId() +{ + uuid_t uuid = {0}; + char str[37]; + uint32_t hash = 5381; + + memset(str, 0, sizeof(str)); + uuid_generate(uuid); + uuid_unparse(uuid, str); + + int i; + for(i=0; i<36; i++) { + hash = ((hash << 5) + hash) + str[i]; + } + return hash; +} + + +void CreateMsgid(char *msgid) +{ + static uint32_t machine_id; + static uint32_t ref_cnt = 0; + if (ref_cnt == 0) { + machine_id = CreateMachineId(); + } + + struct MsgId { + uint32_t timestamp; + uint32_t hash:24; + uint16_t pid; + uint32_t cnt:24; + }__attribute__((packed)); + + struct MsgId id; + id.timestamp = time(0); + id.hash = machine_id; + id.pid = getpid(); + id.cnt = ref_cnt++; + sprintf(msgid, "%08x%06x%04x%06x", id.timestamp, id.hash, id.pid, id.cnt); + msgid[24] = '\0'; +} diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.h b/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.h new file mode 100644 index 0000000..cd715aa --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.h @@ -0,0 +1,69 @@ +/****************************************************************************** + * FileName: + * Description: + * Version: + * History: + * yuxiaobo 2014-12-23 1.0 created + * + *****************************************************************************/ +#ifndef __NEBULA_PROTO_H__ +#define __NEBULA_PROTO_H__ +#include + +struct _NebulaHeader +{ + uint8_t magic; + uint8_t ver; + uint8_t flag; + uint8_t type; + uint16_t len; +}__attribute__((packed)); + +typedef struct _NebulaHeader NebulaHeader; + +#define NEBULA_MSG_PING 0x01 +#define NEBULA_MSG_AUTH 0x02 +#define NEBULA_MSG_SYNC 0x03 +#define NEBULA_MSG_PSH 0x04 +#define NEBULA_MSG_MSG 0x05 +#define NEBULA_MSG_ACK 0x06 +#define NEBULA_MSG_FIN 0x07 +#define NEBULA_MSG_SUB 0x08 +#define NEBULA_MSG_SMS 0x09 +#define NEBULA_MSG_PRES 0x0A +#define NEBULA_MSG_ACCSTATUS 0x0B +#define NEBULA_MSG_INVITE 0x0C +#define NEBULA_MSG_DIALOGACK 0x0D +#define NEBULA_MSG_BYE 0x0E +#define NEBULA_MSG_UPDATE 0x0F +#define NEBULA_MSG_ACCUPDATE 0x10 + +#define NEBULA_KIEV_ACCOFFLINE 0x7D +#define NEBULA_KIEV_ACCONLINE 0x7E +#define NEBULA_KIEV_MSGACK 0x7F + +#define MSG_IS_REQUEST(head) (((head)->type >> 7) & 0x01) +#define MSG_SET_REQUEST(type) (0x80 | type) + +const char* MsgType2Str(uint8_t type); + +#define IS_VALID_TYPE(type) (((type) & 0x7F) > 0 && ((type) & 0x7F) <= 0x10) + +#define HEAD_INIT(h,t) \ + do { \ + (h)->magic = 0xF8; \ + (h)->ver = 0x01; \ + (h)->flag = 0x00; \ + (h)->type = (t); \ + (h)->len = 0; \ + }while(0) + + +#define MSG_ID_LEN 24 +/* + * 生成msgid + * @param msgid 长度必须是MSG_ID_LEN+1 + */ +void CreateMsgid(char *msgid); + +#endif diff --git a/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.o b/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.o new file mode 100644 index 0000000..e53bba9 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/proto/nebula_proto.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/push.c b/1_8.sip_push/nebula_sdk/sdk/push.c new file mode 100644 index 0000000..8799623 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/push.c @@ -0,0 +1,143 @@ +#include "push.h" +#include "config.h" +#include "connect.h" +#include "dict.h" +#include "message.pb-c.h" +#include "nebula_proto.h" +#include + +dict *g_seq_dict = NULL; + +static unsigned int __hashFunction(const void *key) +{ + return dictGenHashFunction((const char*)key, strlen((const char*)key)); +} + +void* __keyDup(void *privdata, const void *key) +{ + (void)privdata; + return strdup((const char*)key); +} + +int __keyCompare(void *privdata, const void *key1, const void *key2) +{ + (void)privdata; + return strcmp((const char*)key1, (const char*)key2) == 0; +} + +void __keyDestructor(void *privdata, void *key) +{ + (void)privdata; + free(key); +} + +int NebulaInitPush() +{ + if (g_seq_dict) return 0; + + static dictType type = { + __hashFunction, + __keyDup, + NULL, + __keyCompare, + __keyDestructor, + NULL + }; + g_seq_dict = dictCreate(&type, NULL); + if (!g_seq_dict) + return -1; + + return 0; +} + +int SendSync(int type) +{ + Nebula__MessageSeq request; + nebula__message_seq__init(&request); + size_t seq_size = dictSize(g_seq_dict); + request.n_content = seq_size; + request.content = (Nebula__MessageSeq__Content**)malloc(sizeof(void*) * seq_size); + + dictIterator *it = dictGetIterator(g_seq_dict); + dictEntry *entry = dictNext(it); + size_t i = 0; + while (entry) { + request.content[i] = (Nebula__MessageSeq__Content*)malloc(sizeof(Nebula__MessageSeq__Content)); + nebula__message_seq__content__init(request.content[i]); + request.content[i]->account = (char*)entry->key; + request.content[i]->seq = entry->v.u64; + i++; + entry = dictNext(it); + } + dictReleaseIterator(it); + + // send + int ret = NebulaSend(type, (ProtobufCMessage*)&request); + + for (i = 0; i < seq_size; ++i) + { + free(request.content[i]); + } + free(request.content); + return ret; +} + +void NebulaOnPush(NebulaHeader *head, const char* data, int len) +{ + (void)head, (void)data, (void)len; + if (-1 == SendSync(MSG_SET_REQUEST(NEBULA_MSG_SYNC))) { + log_error("SendSync failed."); + } +} + +void NebulaOnMsg(NebulaHeader *head, const char* data, int len) +{ + (void)head; + Nebula__Message *message = nebula__message__unpack(NULL, len, (const uint8_t*)data); + if (!message) { + log_error("parse NebulaMessage failed."); + return ; + } + + size_t i; + for (i = 0; i < message->n_content; ++i) + { + Nebula__Message__Content *ctn = message->content[i]; + if ((int)ctn->type >= eNebulaMsg_Max) { + log_warn("discard unkown type message. type=%d", ctn->type); + continue; + } + + dictEntry * entry = dictFind(g_seq_dict, ctn->account); + if (!entry || ctn->seq > entry->v.u64) { + log_debug("recv message. type=%s, account=%s, seq=%u, hasbody=%d, bodylength=%lu", + Nebulamsgtype_name(ctn->type), ctn->account, ctn->seq, ctn->has_body, ctn->body.len); + if (!ctn->has_body) { + log_warn("message has not body, discard it!"); + } else if (g_nebula_cb[ctn->type]) + g_nebula_cb[ctn->type]((const char*)ctn->body.data, ctn->body.len); + + // refresh sequence + if (entry) { + entry->v.u64 = ctn->seq; + } else { + if (DICT_OK != dictAdd(g_seq_dict, ctn->account, (void*)(uint64_t)ctn->seq)) { + log_error("refresh sequence number error, maybe memory was deplete."); + } + } + } else { + log_warn("discard message. type=%s, account=%s, seq=%u, hasbody=%d, bodylength=%lu", + Nebulamsgtype_name(ctn->type), ctn->account, ctn->seq, ctn->has_body, ctn->body.len); + } + } + + if (message->has_flag) { + if (message->flag == NEBULA__MESSAGE__FLAG__MESSAGE_ACK) + SendSync(MSG_SET_REQUEST(NEBULA_MSG_ACK)); + else if (message->flag == NEBULA__MESSAGE__FLAG__MESSAGE_END) + SendSync(MSG_SET_REQUEST(NEBULA_MSG_FIN)); + } + + nebula__message__free_unpacked(message, NULL); +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/push.h b/1_8.sip_push/nebula_sdk/sdk/push.h new file mode 100644 index 0000000..7fa0630 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/push.h @@ -0,0 +1,16 @@ +#ifndef PUSH_H +#define PUSH_H + +#include "nebula_proto.h" + +// push +// Send sync request to server when received MSGPUSH. +// Remember push sequences in memory. + +int NebulaInitPush(); + +void NebulaOnPush(NebulaHeader *head, const char* data, int len); + +void NebulaOnMsg(NebulaHeader *head, const char* data, int len); + +#endif //PUSH_H diff --git a/1_8.sip_push/nebula_sdk/sdk/push.o b/1_8.sip_push/nebula_sdk/sdk/push.o new file mode 100644 index 0000000..ec0281b Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/push.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/redirect.c b/1_8.sip_push/nebula_sdk/sdk/redirect.c new file mode 100644 index 0000000..b05e5a7 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/redirect.c @@ -0,0 +1,261 @@ +#include "redirect.h" +#include +#include +#include +#include +#include +#include +#include "config.h" +#include "str.h" + +List *g_redirect_result = NULL; +time_t g_last_redirect = 0; +char* g_salt = NULL; +char* g_rule = NULL; + +ssize_t NebulaRedirectOnRead(const void *ptr, size_t size, size_t nmemb, FILE *stream) +{ + (void)size, (void)stream; + struct str *result = (struct str *)stream; + string_append_fast(result, (const char*)ptr, nmemb); + return nmemb; +} + +int NebulaCloneRedirectResult() +{ + if (!g_redirect_result) return -1; + if (g_redirect_result->size == 0) return -1; + + if (g_server_list) + ClearList(g_server_list); + else + g_server_list = CreateList(); + + if (!g_server_list) goto on_error; + + ListIterator it; + for (it = ListBegin(g_redirect_result); it; it = ListNext(it)) { + struct sockaddr_in *r_addr = (struct sockaddr_in *)(*it); + struct sockaddr_in *addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in)); + if (!addr) { + goto on_error; + } + addr->sin_port = r_addr->sin_port; + addr->sin_addr.s_addr = r_addr->sin_addr.s_addr; + if (-1 == PushBack(g_server_list, addr)) { + free(addr); + goto on_error; + } + } + + return 0; + +on_error: + if (g_server_list) + ClearList(g_server_list); + return -1; +} + +int NebulaRedirect() +{ + time_t now = time(0); + if (now - g_last_redirect < 300) { + if (0 == NebulaCloneRedirectResult()) { + log_info("not timeout, use last redirect result always."); + return 0; + } + } + + g_last_redirect = now; + + static const char* key = "key=89d15f8b716d4b16fae9feaa09bc4fc5&"; + struct str result; + string_init(&result); + struct json_object* response = NULL; + List *server_list = NULL; + + // post parameters. + struct str params; + string_init(¶ms); + string_append_fast(¶ms, "uid=", 4); + string_append_fast(¶ms, g_device_tag, strlen(g_device_tag)); + string_append_fast(¶ms, "&nonce=", 7); + const char* nonce = Nebularand_string(); + string_append_fast(¶ms, nonce, strlen(nonce)); + string_append_fast(¶ms, "&ts=", 4); + time_t t = time(0); + char ts[32]; + snprintf(ts, sizeof(ts), "%ld", t); + string_append_fast(¶ms, ts, strlen(ts)); + + // sign + unsigned char sign_str[MD5_DIGEST_LENGTH], sign[MD5_DIGEST_LENGTH * 2]; + char md5buf[512]; + snprintf(md5buf, sizeof(md5buf), "%s%s", key, params.ptr); + MD5((const unsigned char*)md5buf, strlen(md5buf), sign_str); + static const char hex[] = "0123456789abcdef"; + int i; + for (i = 0; i < MD5_DIGEST_LENGTH; i++) + { + sign[i * 2] = hex[sign_str[i] >> 4]; + sign[i * 2 + 1] = hex[sign_str[i] & 0xf]; + } + string_append_fast(¶ms, "&sign=", 6); + string_append_fast(¶ms, (const char*)sign, sizeof(sign)); + + CURL *curl = curl_easy_init(); + char url[128] = {}; + snprintf(url, sizeof(url), "%s/push/redirect", g_nebula_host); + //const char* url = "https://p.meizu.com/push/redirect"; + curl_easy_setopt(curl, CURLOPT_URL, url); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYPEER, 0L); + curl_easy_setopt(curl, CURLOPT_SSL_VERIFYHOST, 0L); + curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, &NebulaRedirectOnRead); + curl_easy_setopt(curl, CURLOPT_WRITEDATA, &result); + curl_easy_setopt(curl, CURLOPT_POSTFIELDS, params.ptr); + curl_easy_setopt(curl, CURLOPT_POSTFIELDSIZE, params.len); + curl_easy_setopt(curl, CURLOPT_TIMEOUT, 10); + curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1L); + log_info("HTTPS POST. url=%s, params=%s", url, params.ptr); + CURLcode res = curl_easy_perform(curl); + if (res != CURLE_OK) { + log_error("curl_easy_perform(redirect) error. code=%d, info=%s", + (int)res, curl_easy_strerror(res)); + goto on_error; + } else { + log_info("curl_easy_perform success. response=%s", result.ptr); + } + + // parse response json. + response = json_tokener_parse(result.ptr); + string_deinit(&result); + if (!response) { + log_error("json parse error."); + goto on_error; + } + + struct json_object* code_node = json_object_object_get(response, "code"); + if (!code_node) { + log_error("json parse error, hasnot \"code\" node."); + goto on_error; + } + + int code = json_object_get_int(code_node); + if (code != 200) { + // redirect failed. + log_error("json response code error. code=%d", code); + goto on_error; + } + + struct json_object *md5_daa = json_object_object_get(response, "md5_daa"); + if (!md5_daa) { + log_error("json response has no md5_daa field."); + goto on_error; + } + struct json_object *salt_node = json_object_object_get(md5_daa, "salt"); + if (!salt_node) { + log_error("json response has no md5_daa.salt field."); + goto on_error; + } + const char* salt = json_object_get_string(salt_node); + if (!salt) { + log_error("json response has no md5_daa.salt field."); + goto on_error; + } + if (g_salt) free(g_salt); + g_salt = strdup(salt); + + struct json_object *rule_node = json_object_object_get(md5_daa, "rule"); + if (!rule_node) { + log_error("json response has no md5_daa.rule field."); + goto on_error; + } + const char* rule = json_object_get_string(rule_node); + if (!rule) { + log_error("json response has no md5_daa.rule field."); + goto on_error; + } + if (g_rule) free(g_rule); + g_rule = strdup(rule); + + struct json_object* host_list_node = json_object_object_get(response, "hostlist"); + if (!host_list_node) { + log_error("json parse error, hasnot \"hostlist\" node."); + goto on_error; + } + + struct array_list* host_list = json_object_get_array(host_list_node); + if (!host_list) { + log_error("json_object_get_array error."); + goto on_error; + } + + int host_count = array_list_length(host_list); + if (!host_count) { + log_error("host list is empty."); + goto on_error; + } + + server_list = CreateList(); + if (!server_list) { + log_error("create server list error, maybe memory was deplete."); + goto on_error; + } + + for (i = 0; i < host_count; ++i) + { + struct json_object* elem = (struct json_object*)array_list_get_idx(host_list, i); + if (!elem) { + log_error("host list get idx error, i=%d.", i); + goto on_error; + } + + struct json_object* ip_node = json_object_object_get(elem, "ip"); + if (!ip_node) { + log_error("host list get ip error, i=%d.", i); + goto on_error; + } + const char* ip = json_object_get_string(ip_node); + int ip_len = json_object_get_string_len(ip_node); + if (!ip || !ip_len) { + log_error("host list get ip error, i=%d.", i); + goto on_error; + } + + struct json_object* port_node = json_object_object_get(elem, "port"); + int port = json_object_get_int(port_node); + if (!port) { + log_error("host list get port error, i=%d.", i); + goto on_error; + } + + struct sockaddr_in *addr = (struct sockaddr_in *)malloc(sizeof(struct sockaddr_in)); + if (!addr) { + log_error("malloc sockaddr_in failed."); + goto on_error; + } + + addr->sin_port = htons(port); + addr->sin_addr.s_addr = inet_addr(ip); + if (-1 == PushBack(server_list, addr)) { + log_error("PushBack to server_list error, maybe memory was deplete."); + goto on_error; + } + } + + if (g_redirect_result) + DestroyList(g_redirect_result); + + g_redirect_result = server_list; + server_list = NULL; + return NebulaCloneRedirectResult(); + +on_error: + string_deinit(&result); + if (response) + json_object_put(response); + if (server_list) + DestroyList(server_list); + return -1; +} + diff --git a/1_8.sip_push/nebula_sdk/sdk/redirect.h b/1_8.sip_push/nebula_sdk/sdk/redirect.h new file mode 100644 index 0000000..28356e5 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/redirect.h @@ -0,0 +1,10 @@ +#ifndef REDIRECT_H +#define REDIRECT_H + +/** redirect + * @Launch http request to p.meizu.com, get server ip list. + * @Block function. + */ +int NebulaRedirect(); + +#endif //REDIRECT_H diff --git a/1_8.sip_push/nebula_sdk/sdk/redirect.o b/1_8.sip_push/nebula_sdk/sdk/redirect.o new file mode 100644 index 0000000..2d8ca55 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/redirect.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/str.c b/1_8.sip_push/nebula_sdk/sdk/str.c new file mode 100644 index 0000000..5f0bc86 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/str.c @@ -0,0 +1,131 @@ +#include +#include +#include +#include +#include "str.h" + +#define DEFAULT_STRING_SIZE 32 +#define SMAX(a, b) ((a) > (b) ? (a) : (b)) + +void string_init(struct str *str) +{ + str->size = 0; + str->len = 0; + str->ptr = NULL; +} + +void string_deinit(struct str *str) +{ + if(str->ptr){ + free(str->ptr); + string_init(str); + } +} + +bool string_empty(const struct str *str) +{ + return str->len == 0 ? true : false; +} + +int string_duplicate(struct str *dst, const struct str *src) +{ + string_reset(dst); + return string_append(dst, src->ptr, src->len); +} + +int string_copy(struct str *dst, const char *src, size_t srclen) +{ + string_reset(dst); + return string_append(dst, src, srclen); +} + +#ifndef _GNU_SOURCE +static int vasprintf(char **buf, const char *fmt, va_list ap) +{ + static char _T_emptybuffer = '\0'; + int chars; + char *b; + + if(!buf) { return -1; } + + chars = vsnprintf(&_T_emptybuffer, 0, fmt, ap)+1; + if(chars < 0) { + chars *= -1; + } + + b = (char*)malloc(sizeof(char)*chars); + if(!b) { return -1; } + if((chars = vsprintf(b, fmt, ap)) < 0) + { + free(b); + } else { + *buf = b; + } + + return chars; +} +#endif + +int string_sprintf(struct str *str, const char* fmt, ...) +{ + va_list ap; + char *t = NULL; + int size; + char buf[128]; + +// string_reset(str); + + va_start(ap, fmt); + size = vsnprintf(buf, 128, fmt, ap); + va_end(ap); + + if(size == -1 || size > 127) { + va_start(ap, fmt); + if((size = vasprintf(&t, fmt, ap)) == -1) { + va_end(ap); + return -1; + } + va_end(ap); + + size = string_append(str, t, size); + free(t); + return size; + } + + return string_append(str, buf, size); +} + +int string_compare(const struct str *s1, const struct str *s2) +{ + if (s1->len != s2->len) { + return s1->len - s2->len > 0 ? 1 : -1; + } + return strncmp(s1->ptr, s2->ptr, s1->len); +} + +void string_reset(struct str *str) +{ + if(str->ptr) { + str->len = 0; + str->ptr[0] = '\0'; + } +} + +int string_append(struct str *str, const char *buf, size_t buflen) +{ + if( str->size - str->len <= buflen ) { + size_t new_size = SMAX(DEFAULT_STRING_SIZE, + SMAX(str->size * 2, str->len + buflen + 8)); + char *t = (char*)realloc(str->ptr, new_size); + if( t == NULL ) + return -1; + + str->size = new_size; + str->ptr = t; + } + + memcpy(str->ptr + str->len, buf, buflen); + str->len += buflen; + str->ptr[str->len] = '\0'; + return buflen; +} diff --git a/1_8.sip_push/nebula_sdk/sdk/str.h b/1_8.sip_push/nebula_sdk/sdk/str.h new file mode 100644 index 0000000..07e2c2f --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/str.h @@ -0,0 +1,53 @@ +#ifndef __STUN_STRING_H__ +#define __STUN_STRING_H__ + +#ifdef __cplusplus +extern "C" { +#endif +#include +#include +#include + +struct str{ + size_t size; /*buf所占内存长度*/ + size_t len; /*buf字符长度*/ + char* ptr; +}; + +void string_init(struct str *str); + +void string_deinit(struct str *str); + +bool string_empty(const struct str *str); + +int string_duplicate(struct str *dst, const struct str *src); + +int string_copy(struct str *dst, const char *src, size_t srclen); + +int string_sprintf(struct str *str, const char* fmt, ...); + +int string_compare(const struct str *s1, const struct str *s2); + +void string_reset(struct str *str); + +int string_append(struct str *str, const char *buf, size_t buflen); + +#define string_length(s) ((s)->len) + +#define string_append_fast(s, bufptr, bufsize) \ + do { \ + if (((s)->size - (s)->len) > bufsize) { \ + memcpy((s)->ptr + (s)->len, (bufptr), bufsize); \ + (s)->len += bufsize; \ + (s)->ptr[(s)->len] = '\0'; \ + } else { \ + string_append((s), (bufptr), bufsize); \ + } \ + }while(0) + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/1_8.sip_push/nebula_sdk/sdk/str.o b/1_8.sip_push/nebula_sdk/sdk/str.o new file mode 100644 index 0000000..3bdfd45 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/str.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/subscribe.c b/1_8.sip_push/nebula_sdk/sdk/subscribe.c new file mode 100644 index 0000000..f22ee07 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/subscribe.c @@ -0,0 +1,108 @@ +#include "subscribe.h" +#include "config.h" +#include "timer.h" +#include "message.pb-c.h" +#include "nebula_proto.h" +#include "connect.h" +#include +#include "archive.h" + +typedef enum { + eSubStatus_Init, + eSubStatus_WaitResponse, + eSubStatus_Done, +} eSubStatus; + +static eSubStatus g_sub_status = eSubStatus_Init; +static time_t g_sub_tick = 0; + +int subscribe() +{ + int count = 0, i; + char** sub_apps = (char**)malloc(g_sub_app_count * sizeof(char*)); + if (!sub_apps) return -1; + + for (i = 0; i < g_sub_app_count; ++i) + { + if (NebulaIsSubscribed(g_sub_apps[i])) continue; + sub_apps[count++] = g_sub_apps[i]; + } + + if (!count) return 1; + + Nebula__SubscribeRequest request; + nebula__subscribe_request__init(&request); + request.n_app = count; + request.app = sub_apps; + int ret = NebulaSend(MSG_SET_REQUEST(NEBULA_MSG_SUB), (ProtobufCMessage*)&request); + free(sub_apps); + return ret; +} + +void NebulaOnSubSuccess(const char* appname) +{ + // TODO: save subscribe app and sub time. + log_info("sub %s success.", appname); + NebulaAddSubApp(appname); +} + +void NebulaOnSub(NebulaHeader *head, const char* data, int len) +{ + Nebula__SubscribeResponse *response = nebula__subscribe_response__unpack(NULL, len, (const uint8_t*)data); + if (!response) { + log_error("subcribe response parse error."); + return ; + } + + if (response->status != 200) { + log_error("subcribe failed. status=%d", response->status); + nebula__subscribe_response__free_unpacked(response, NULL); + return ; + } + + size_t i; + for (i = 0; i < response->n_content; ++i) + { + Nebula__SubscribeResponse__Content *ctn = response->content[i]; + if (ctn->status == 200) { + NebulaOnSubSuccess(ctn->app); + } + } + + g_sub_status = eSubStatus_Done; + nebula__subscribe_response__free_unpacked(response, NULL); +} + +int subscribe_loop() +{ + if (!g_sub_app_count) { + return 0; + } + + int ret; + switch (g_sub_status) { + case eStatus_Init: + ret = subscribe(); + if (ret == 0) { + g_sub_status = eSubStatus_WaitResponse; + g_sub_tick = clock(); + } else if (ret == 1) { + return 0; + } else { + return -1; + } + break; + + case eSubStatus_WaitResponse: + if (clock() - g_sub_tick > 10000) { + // timeout + g_sub_status = eSubStatus_Init; + } + break; + + case eSubStatus_Done: + return 0; + } + + return -1; +} diff --git a/1_8.sip_push/nebula_sdk/sdk/subscribe.h b/1_8.sip_push/nebula_sdk/sdk/subscribe.h new file mode 100644 index 0000000..860098f --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/subscribe.h @@ -0,0 +1,10 @@ +#ifndef SUBSCRIBE_H +#define SUBSCRIBE_H + +#include "nebula_proto.h" + +int subscribe_loop(); + +void NebulaOnSub(NebulaHeader *head, const char* data, int len); + +#endif //SUBSCRIBE_H diff --git a/1_8.sip_push/nebula_sdk/sdk/subscribe.o b/1_8.sip_push/nebula_sdk/sdk/subscribe.o new file mode 100644 index 0000000..affaf3e Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/subscribe.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/test/Makefile b/1_8.sip_push/nebula_sdk/sdk/test/Makefile new file mode 100644 index 0000000..6adb32c --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/test/Makefile @@ -0,0 +1,12 @@ +CC=gcc +CFALGS=-g +INCLUDES=-I.. +LINK=-L.. -lnebula_sdk + +test:test.c + $(CC) $(CFALGS) $^ -o $@ $(INCLUDES) $(LINK) + +.PHONY: clean + +clean: + rm test -f diff --git a/1_8.sip_push/nebula_sdk/sdk/test/data b/1_8.sip_push/nebula_sdk/sdk/test/data new file mode 100644 index 0000000..878ae3c --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/test/data @@ -0,0 +1,5 @@ +2 +com.meizu.cloud +com.meizu.router +1 +R10WZOANC5400EE&0 21 diff --git a/1_8.sip_push/nebula_sdk/sdk/test/libnebula_sdk.so b/1_8.sip_push/nebula_sdk/sdk/test/libnebula_sdk.so new file mode 100644 index 0000000..6b0f3cb Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/test/libnebula_sdk.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h b/1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h new file mode 100644 index 0000000..41f86e8 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h @@ -0,0 +1,56 @@ +#ifndef NEBULA_SDK_H +#define NEBULA_SDK_H + +typedef enum { + eNebulaMsg_Push, /// 推送 (路由器只需关心这一类消息) + eNebulaMsg_Presence, /// Presence + eNebulaMsg_Sms, /// 网络短信 + eNebulaMsg_Mms, /// 网络彩信 + eNebulaMsg_Max, +} NebulaMsgType; + +#ifdef __cplusplus +extern "C" { +#endif + + /** 初始化网络连接 + * @device_tag: 硬件信息 (手机端为IMEI) + * @verify_pwd: 鉴权密码 (手机端为SN) + * @host: 服务端域名, 例如: https://p.meizu.com (结尾不要带"/", 前面要加上https) + * @file: 用于读取/存储持久化数据的文件名, 要求目录存在, 且有创建文件权限。 + * @return: 如果文件打开成功, 返回0; 否则返回-1, 文件打开失败原因记录在错误码errno中. + * @只能调用一次, 重复调用无效并返回-1. + */ + int NebulaInit(const char* device_tag, const char* host, const char* file); + + /** 设置订阅列表 + * + * + */ + void NebulaSubScribe(int count, const char** app_name); + + /** 消息处理回调函数 + * @app: App名 + * @msg: 消息内容 + */ + typedef void (*NebulaMsgCallback)(const char* app, const char* msg); + + /** 注册消息处理回调函数 + * @type: 消息类型 + * @cb: 回调函数 + * @return: 旧的回调函数 + * @一次只能注册一个回调函数, 重复注册会覆盖. + */ + NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb); + + /** 启动 + * + */ + int NebulaStart(); + +#ifdef __cplusplus +} +#endif + +#endif //NEBULA_SDK_H + diff --git a/1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h.old b/1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h.old new file mode 100644 index 0000000..480d40b --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/test/nebula_sdk/nebula_sdk.h.old @@ -0,0 +1,56 @@ +#ifndef NEBULA_SDK_H +#define NEBULA_SDK_H + +typedef enum { + eNebulaMsg_Push, /// 推送 (路由器只需关心这一类消息) + eNebulaMsg_Presence, /// Presence + eNebulaMsg_Sms, /// 网络短信 + eNebulaMsg_Mms, /// 网络彩信 + eNebulaMsg_Max, +} NebulaMsgType; + +#ifdef __cplusplus +extern "C" { +#endif + + /** 初始化网络连接 + * @device_tag: 硬件信息 (手机端为IMEI) + * @verify_pwd: 鉴权密码 (手机端为SN) + * @host: 服务端域名, 例如: https://p.meizu.com (结尾不要带"/", 前面要加上https) + * @file: 用于读取/存储持久化数据的文件名, 要求目录存在, 且有创建文件权限。 + * @return: 如果文件打开成功, 返回0; 否则返回-1, 文件打开失败原因记录在错误码errno中. + * @只能调用一次, 重复调用无效并返回-1. + */ + int NebulaInit(const char* device_tag, const char* host, const char* file); + + /** 设置订阅列表 + * + * + */ + void NebulaSubScribe(int count, const char** app_name); + + /** 消息处理回调函数 + * @data: 数据块起始指针 + * @len: 数据块长度 + */ + typedef void (*NebulaMsgCallback)(const char* data, int len); + + /** 注册消息处理回调函数 + * @type: 消息类型 + * @cb: 回调函数 + * @return: 旧的回调函数 + * @一次只能注册一个回调函数, 重复注册会覆盖. + */ + NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb); + + /** 启动 + * + */ + int NebulaStart(); + +#ifdef __cplusplus +} +#endif + +#endif //NEBULA_SDK_H + diff --git a/1_8.sip_push/nebula_sdk/sdk/test/old.libnebula_sdk.so b/1_8.sip_push/nebula_sdk/sdk/test/old.libnebula_sdk.so new file mode 100755 index 0000000..6faf7d6 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/test/old.libnebula_sdk.so differ diff --git a/1_8.sip_push/nebula_sdk/sdk/test/org.test b/1_8.sip_push/nebula_sdk/sdk/test/org.test new file mode 100755 index 0000000..5e7fcf0 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/test/org.test differ diff --git a/1_8.sip_push/nebula_sdk/sdk/test/tags b/1_8.sip_push/nebula_sdk/sdk/test/tags new file mode 100644 index 0000000..c6bf98d --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/test/tags @@ -0,0 +1,20 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.9~svn20110310 // +CC Makefile /^CC=gcc$/;" m +CFALGS Makefile /^CFALGS=-g$/;" m +INCLUDES Makefile /^INCLUDES=-I..$/;" m +LINK Makefile /^LINK=-L.. -lnebula_sdk$/;" m +NEBULA_SDK_H nebula_sdk/nebula_sdk.h 2;" d +NebulaMsgCallback nebula_sdk/nebula_sdk.h /^ typedef void (*NebulaMsgCallback)(const char* app, const char* msg);$/;" t +NebulaMsgType nebula_sdk/nebula_sdk.h /^} NebulaMsgType;$/;" t typeref:enum:__anon1 +OnPush test.c /^void OnPush(const char* app, const char *msg)$/;" f +eNebulaMsg_Max nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Max,$/;" e enum:__anon1 +eNebulaMsg_Mms nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Mms, \/\/\/ 网络彩信$/;" e enum:__anon1 +eNebulaMsg_Presence nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Presence, \/\/\/ Presence$/;" e enum:__anon1 +eNebulaMsg_Push nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Push, \/\/\/ 推送 (路由器只需关心这一类消息)$/;" e enum:__anon1 +eNebulaMsg_Sms nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Sms, \/\/\/ 网络短信$/;" e enum:__anon1 +main test.c /^int main()$/;" f diff --git a/1_8.sip_push/nebula_sdk/sdk/test/test.c b/1_8.sip_push/nebula_sdk/sdk/test/test.c new file mode 100644 index 0000000..c840a45 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/test/test.c @@ -0,0 +1,74 @@ +#include "nebula_sdk/nebula_sdk.h" +#include +#include +#include +#include +#include +#include +#include + +/* + *void OnPush(const char* data, int len) + *{ + * char *body = strndup(data, len); + * printf("karldbg %s %d\n", __func__, len); + * do { + * int cnt = 0; + * for(cnt=0; cnt +#include +#include +#include "timer.h" + +#define DEFAULT_TIMER_LIMIT_SIZE 256 + +struct timer_heap_t +{ + int32_t limit_size; //一次超时的元素个数 + util_rbtree_t rbtree; +}; + +/*{{{ timer_heap_create*/ +timer_heap_t* timer_heap_create(int32_t limit_size) +{ + timer_heap_t* ht; + + ht = (timer_heap_t*)malloc(sizeof(timer_heap_t)); + if(ht == NULL){ + return NULL; + } + + ht->limit_size = (limit_size <=0 ? DEFAULT_TIMER_LIMIT_SIZE : limit_size); + util_rbtree_init(&ht->rbtree); + + return ht; +} + +void set_timer_limit(timer_heap_t *ht, int32_t limit) +{ + if(ht == NULL) + return; + if (limit > 0) { + ht->limit_size = limit; + } +} + +/*}}}*/ + +/*{{{ timer_add*/ +int32_t timer_add( timer_heap_t* ht, timer_entry* entry, uint32_t expires) +{ + struct timeval now; + long msec; + if(!ht || !entry) + { + return -1; /*参数错误*/ + } + + /*获取当前时间*/ + gettimeofday(&now, NULL); + msec = now.tv_sec*1000 + now.tv_usec/1000 + expires; + if (entry->in_rbtree) { + //已经在红黑树中 先删除再插入 + util_rbtree_delete(&ht->rbtree, &entry->rbnode); + entry->in_rbtree = 0; + rbt_clear_node(&entry->rbnode); + } + + entry->rbnode.key = msec; + util_rbtree_insert(&ht->rbtree, &entry->rbnode); + entry->in_rbtree = 1; + + return 0; +} +/*}}}*/ + +/*{{{ timer_del*/ +void timer_del( timer_heap_t* ht, timer_entry* entry) +{ + if(!ht || !entry) + return; + if (!entry->in_rbtree) + return; + + util_rbtree_delete(&ht->rbtree, &entry->rbnode); + entry->in_rbtree = 0; + rbt_clear_node(&entry->rbnode); +} +/*}}}*/ + +int32_t timer_update(timer_heap_t* ht, timer_entry *entry, uint32_t expires) +{ + return timer_add(ht, entry, expires); +} + +int32_t timer_earliest_time(timer_heap_t* ht) +{ + struct timeval now; + long msec; + util_rbtree_node_t *rbnode; + + if(!ht) + return -1; + if(ht->rbtree.size == 0) + return -1; + gettimeofday(&now, NULL); + + rbnode = util_rbtree_min(&ht->rbtree); + if (rbnode == NULL) + return -1; + msec = rbnode->key - (now.tv_sec*1000 + now.tv_usec/1000); + if(msec < 0) + msec = 0; + return (int32_t)msec; +} + +int32_t timer_size(timer_heap_t* ht) +{ + if(!ht) + return 0; + return (int32_t)ht->rbtree.size; +} + +int32_t timer_run(timer_heap_t* ht) +{ + struct timeval now; + long msec; + int i; + int count = 0; + if(!ht || util_rbtree_isempty(&ht->rbtree)){ + return 0; + } + + gettimeofday(&now, NULL); + msec = now.tv_sec*1000 + now.tv_usec/1000; + for (i=0; ilimit_size; ++i) { + timer_entry *entry; + util_rbtree_node_t *node = util_rbtree_min(&ht->rbtree); + if (node == NULL) break; + entry = (timer_entry*)node->data; + if (node->key <= msec) { + ++count; + util_rbtree_delete(&ht->rbtree, node); + rbt_clear_node(node); + entry->in_rbtree = 0; + if (entry->timeout_cb) { + entry->timeout_cb(ht, entry); + } + } else { + break; + } + } + + return count; +} + +void timer_entry_init(timer_entry* entry, int32_t id, void* user_data, \ + void (*timeout_cb)(timer_heap_t* ht, struct timer_entry *entry)) +{ + entry->user_data = user_data; + entry->timeout_cb = timeout_cb; + entry->id = id; + entry->in_rbtree = 0; + rbt_clear_node(&entry->rbnode); + entry->rbnode.data = entry; +} + +void timer_destroy( timer_heap_t* ht) +{ + if(!ht) + return; + while(!util_rbtree_isempty(&ht->rbtree)) { + timer_entry *entry; + util_rbtree_node_t *node = util_rbtree_min(&ht->rbtree); + entry = (timer_entry*)node->data; + util_rbtree_delete(&ht->rbtree, node); + rbt_clear_node(node); + entry->in_rbtree = 0; + if (entry->timeout_cb) { + entry->timeout_cb(ht, entry); + } + } + free(ht); +} diff --git a/1_8.sip_push/nebula_sdk/sdk/timer.h b/1_8.sip_push/nebula_sdk/sdk/timer.h new file mode 100644 index 0000000..923d007 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/timer.h @@ -0,0 +1,93 @@ +/* + * ===================================================================================== + * + * Filename: timer.h + * + * Description: 小根堆定时器实现(非多线程安全) + * + * Version: 1.0 + * Created: 2013-08-20 + * Revision: none + * Compiler: gcc + * + * Author: xiaoboyu + * Organization: + * + * ===================================================================================== + */ +#ifndef __TIMER_HEAP_H__ +#define __TIMER_HEAP_H__ + +#include +#include "util_rbtree.h" +#ifdef __cplusplus +extern "C" { +#endif + +typedef struct timer_heap_t timer_heap_t; + +typedef struct timer_entry +{ + int32_t id; + uint8_t in_rbtree; /*是否在红黑树中*/ + util_rbtree_node_t rbnode; + void *user_data; + void (*timeout_cb)(timer_heap_t* ht, struct timer_entry *entry); +}timer_entry; + +void timer_entry_init(timer_entry* entry, int32_t id, void* user_data, \ + void (*timeout_cb)(timer_heap_t* ht, struct timer_entry *entry)); +/* + * 创建定时器 + * @param limit_size 一次超时的元素个数 + */ +timer_heap_t* timer_heap_create(int32_t limit_size); + +/* + * @brief 设置定时器每次最大超时元素的个数 默认是256个 + */ +void set_timer_limit(timer_heap_t *ht, int32_t limit); + +/* + * @ref 添加元素到定时器 + * @param expires 超时时间ms + * @return 成功返回0 失败返回-1 + */ +int32_t timer_add( timer_heap_t* ht, timer_entry *entry, uint32_t expires ); + +/* + * @ref 从定时器中删除一个元素 + */ +void timer_del( timer_heap_t* ht, timer_entry* entry ); + + +/* + * @brief 更新超时时间(前提是这个entry必须在定时器内, 否则可能导致不可预知的错误) + */ +int32_t timer_update(timer_heap_t* ht, timer_entry *entry, uint32_t expires); + +/* + * @brief 获取最近超时时间 + * @return -1 没有超时 + */ +int32_t timer_earliest_time(timer_heap_t* ht); + +/* + * @ref 获取定时器元素的个数 + */ +int32_t timer_size ( timer_heap_t* ht ); + +/* + * @ref 扫描定时器,执行那些超时的定时器元素 + * @return 返回已经处理的超时定时器元素的个数 + */ +int32_t timer_run(timer_heap_t* ht); + +void timer_destroy( timer_heap_t* ht); + +#ifdef __cplusplus +} +#endif + +#endif + diff --git a/1_8.sip_push/nebula_sdk/sdk/timer.o b/1_8.sip_push/nebula_sdk/sdk/timer.o new file mode 100644 index 0000000..e58498f Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/timer.o differ diff --git a/1_8.sip_push/nebula_sdk/sdk/util_rbtree.c b/1_8.sip_push/nebula_sdk/sdk/util_rbtree.c new file mode 100644 index 0000000..5c7c7cc --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/util_rbtree.c @@ -0,0 +1,486 @@ + +/* Copyright (C) 2010. sparkling.liang@hotmail.com. All rights reserved. */ + +#include "util_rbtree.h" + +/* the NULL node of tree */ +#define _NULL(rbtree) (&((rbtree)->null)) + +/* structues uesed to check a rb tree */ +struct rbtree_check_s +{ + short rbh; /* rb height of the tree */ + short maxd; /* max depth of the tree */ + int fini; /* check failed ? */ + const util_rbtree_node_t *null; /* sentinel of the tree */ +}; + +typedef struct rbtree_check_s rbtree_check_t; + +static void rbtree_left_rotate(util_rbtree_node_t **root, + util_rbtree_node_t* sentinel, + util_rbtree_node_t *node); +static void rbtree_right_rotate(util_rbtree_node_t **root, + util_rbtree_node_t* sentinel, + util_rbtree_node_t *node); + +void util_rbtree_init(util_rbtree_t *rbtree) +{ + if(rbtree != NULL) + { + util_rbt_black(_NULL(rbtree)); /* null MUST be black */ + rbtree->root = _NULL(rbtree); + rbtree->size = 0; + } +} + +util_rbtree_node_t* util_rbsubtree_min(util_rbtree_node_t *node, util_rbtree_node_t *sentinel) +{ + if(node == sentinel) return NULL; + while(node->left != sentinel) node = node->left; + return node; +} + +util_rbtree_node_t* util_rbsubtree_max(util_rbtree_node_t *node, util_rbtree_node_t *sentinel) +{ + if(node == sentinel) return NULL; + while(node->right != sentinel) node = node->right; + return node; +} + +void util_rbtree_insert(util_rbtree_t *rbtree, util_rbtree_node_t *node) +{ + util_rbtree_node_t **root = &rbtree->root; + util_rbtree_node_t *sentinel = _NULL(rbtree); + util_rbtree_node_t *temp, **p; + + /* empty tree */ + + if (*root == sentinel) { + node->parent = NULL; + node->left = sentinel; + node->right = sentinel; + util_rbt_black(node); + *root = node; + ++rbtree->size; + return; + } + /* a binary tree insert */ + temp = *root; + for (;;) { + p = (node->key < temp->key) ? &temp->left : &temp->right; + if (*p == sentinel) { + break; + } + temp = *p; + } + + *p = node; + node->parent = temp; + node->left = sentinel; + node->right = sentinel; + util_rbt_red(node); + + /* re-balance tree */ + while (node != *root && util_rbt_isred(node->parent)) { + + if (node->parent == node->parent->parent->left) { + temp = node->parent->parent->right; + + if (util_rbt_isred(temp)) { + util_rbt_black(node->parent); + util_rbt_black(temp); + util_rbt_red(node->parent->parent); + node = node->parent->parent; + } else { + if (node == node->parent->right) { + node = node->parent; + rbtree_left_rotate(root, sentinel, node); + } + + util_rbt_black(node->parent); + util_rbt_red(node->parent->parent); + rbtree_right_rotate(root, sentinel, node->parent->parent); + } + } else { + temp = node->parent->parent->left; + + if (util_rbt_isred(temp)) { + util_rbt_black(node->parent); + util_rbt_black(temp); + util_rbt_red(node->parent->parent); + node = node->parent->parent; + } else { + if (node == node->parent->left) { + node = node->parent; + rbtree_right_rotate(root, sentinel, node); + } + + util_rbt_black(node->parent); + util_rbt_red(node->parent->parent); + rbtree_left_rotate(root, sentinel, node->parent->parent); + } + } + } + + util_rbt_black(*root); + ++rbtree->size; +} + +void util_rbtree_delete(util_rbtree_t *rbtree, util_rbtree_node_t *node) +{ + util_rbtree_node_t **root = &rbtree->root; + util_rbtree_node_t *sentinel = _NULL(rbtree); + util_rbtree_node_t *subst, *temp, *w; + uint8_t red; + + /* a binary tree delete */ + --rbtree->size; + if (node->left == sentinel) { + temp = node->right; + subst = node; + } else if (node->right == sentinel) { + temp = node->left; + subst = node; + } else { + subst = util_rbsubtree_min(node->right, sentinel); + if (subst->left != sentinel) { + temp = subst->left; + } else { + temp = subst->right; + } + } + + if (subst == *root) { + *root = temp; + util_rbt_black(temp); + + rbt_clear_node(node); + return; + } + + red = util_rbt_isred(subst); + + if (subst == subst->parent->left) { + subst->parent->left = temp; + } else { + subst->parent->right = temp; + } + + if (subst == node) { + temp->parent = subst->parent; + } else { + + if (subst->parent == node) { + temp->parent = subst; + } else { + temp->parent = subst->parent; + } + + subst->left = node->left; + subst->right = node->right; + subst->parent = node->parent; + subst->color = node->color; + + if (node == *root) { + *root = subst; + } else { + if (node == node->parent->left) { + node->parent->left = subst; + } else { + node->parent->right = subst; + } + } + + if (subst->left != sentinel) { + subst->left->parent = subst; + } + + if (subst->right != sentinel) { + subst->right->parent = subst; + } + } + + rbt_clear_node(node); + + if (red) { + return; + } + + /* a delete fixup */ + while (temp != *root && util_rbt_isblack(temp)) { + + if (temp == temp->parent->left) { + w = temp->parent->right; + + if (util_rbt_isred(w)) { + util_rbt_black(w); + util_rbt_red(temp->parent); + rbtree_left_rotate(root, sentinel, temp->parent); + w = temp->parent->right; + } + + if (util_rbt_isblack(w->left) && util_rbt_isblack(w->right)) { + util_rbt_red(w); + temp = temp->parent; + } else { + if (util_rbt_isblack(w->right)) { + util_rbt_black(w->left); + util_rbt_red(w); + rbtree_right_rotate(root, sentinel, w); + w = temp->parent->right; + } + + w->color = temp->parent->color; + util_rbt_black(temp->parent); + util_rbt_black(w->right); + rbtree_left_rotate(root, sentinel, temp->parent); + temp = *root; + } + + } else { + w = temp->parent->left; + + if (util_rbt_isred(w)) { + util_rbt_black(w); + util_rbt_red(temp->parent); + rbtree_right_rotate(root, sentinel, temp->parent); + w = temp->parent->left; + } + + if (util_rbt_isblack(w->left) && util_rbt_isblack(w->right)) { + util_rbt_red(w); + temp = temp->parent; + } else { + if (util_rbt_isblack(w->left)) { + util_rbt_black(w->right); + util_rbt_red(w); + rbtree_left_rotate(root, sentinel, w); + w = temp->parent->left; + } + + w->color = temp->parent->color; + util_rbt_black(temp->parent); + util_rbt_black(w->left); + rbtree_right_rotate(root, sentinel, temp->parent); + temp = *root; + } + } + } + + util_rbt_black(temp); +} + +static void rbtree_left_rotate(util_rbtree_node_t **root, + util_rbtree_node_t* sentinel, + util_rbtree_node_t *node) +{ + util_rbtree_node_t *temp; + + temp = node->right; + node->right = temp->left; + + if (temp->left != sentinel) { + temp->left->parent = node; + } + + temp->parent = node->parent; + + if (node == *root) { + *root = temp; + } else if (node == node->parent->left) { + node->parent->left = temp; + } else { + node->parent->right = temp; + } + + temp->left = node; + node->parent = temp; +} +static void rbtree_right_rotate(util_rbtree_node_t **root, + util_rbtree_node_t* sentinel, + util_rbtree_node_t *node) +{ + util_rbtree_node_t *temp; + + temp = node->left; + node->left = temp->right; + + if (temp->right != sentinel) { + temp->right->parent = node; + } + + temp->parent = node->parent; + + if (node == *root) { + *root = temp; + } else if (node == node->parent->right) { + node->parent->right = temp; + } else { + node->parent->left = temp; + } + + temp->right = node; + node->parent = temp; +} + + +util_rbtree_node_t* util_rbtree_search(util_rbtree_t *rbtree, long key) +{ + if(rbtree != NULL) + { + util_rbtree_node_t *node = rbtree->root; + util_rbtree_node_t *null = _NULL(rbtree); + while(node != null) + { + if(key < node->key) node = node->left; + else if(key > node->key) node = node->right; + else if(node->key == key) return node; + } + } + return NULL; +} + +util_rbtree_node_t* util_rbtree_lookup(util_rbtree_t *rbtree, long key) +{ + if((rbtree != NULL) && !util_rbtree_isempty(rbtree)) + { + util_rbtree_node_t *node = NULL; + util_rbtree_node_t *temp = rbtree->root; + util_rbtree_node_t *null = _NULL(rbtree); + while(temp != null) + { + if(key <= temp->key) + { + node = temp; /* update node */ + temp = temp->left; + } + else if(key > temp->key) + { + temp = temp->right; + } + } + /* if node==NULL return the minimum node */ + return ((node != NULL) ? node : util_rbtree_min(rbtree)); + } + return NULL; +} + +static void rbtree_check_subtree(const util_rbtree_node_t *node, rbtree_check_t *check, + int level, int curheight) +{ + if(check->fini) /* already failed */ + { + return; + } + /* check node color */ + if(util_rbt_isblack(node)) + { + curheight++; + } + else if(!util_rbt_isred(node)) + { + check->fini = 2; + return; + } + /* check left */ + if(node->left != check->null) + { + if(util_rbt_isred(node) && util_rbt_isred(node->left)) + { + check->fini = 4; + return; + } + if(node->key < node->left->key) + { + check->fini = 5; + return; + } + rbtree_check_subtree(node->left, check, level+1, curheight); + } + else + { + goto __check_rb_height; + } + /* check right */ + if(node->right != check->null) + { + if(util_rbt_isred(node) && util_rbt_isred(node->right)) + { + check->fini = 4; + return; + } + if(node->key > node->right->key) + { + check->fini = 5; + return; + } + rbtree_check_subtree(node->right, check, level+1, curheight); + } + else + { + goto __check_rb_height; + } + return; +__check_rb_height: + if(check->rbh == 0) + { + check->rbh = curheight; + } + if(check->maxd < level) + { + check->maxd = level; + } + if(check->rbh != curheight) + { + check->fini = 3; + } +} + +int util_rbtree_check(const util_rbtree_t *rbtree, int *blackheight, int *maxdepth) +{ + rbtree_check_t check; + if(rbtree->root == _NULL(rbtree)) + { + return 0; + } + if(!util_rbt_isblack(rbtree->root)) + { + return 1; + } + check.fini = check.maxd = check.rbh = 0; + check.null = _NULL(rbtree); + rbtree_check_subtree(rbtree->root, &check, 1, 0); + if(blackheight) + { + *blackheight = check.rbh; + } + if(maxdepth) + { + *maxdepth = check.maxd; + } + return check.fini; +} + +static void rbtree_mid_travel(util_rbtree_node_t *node, util_rbtree_node_t *sentinel, + void(*opera)(util_rbtree_node_t *, void *), void *data) +{ + if(node->left != sentinel) + { + rbtree_mid_travel(node->left, sentinel, opera, data); + } + opera(node, data); + if(node->right != sentinel) + { + rbtree_mid_travel(node->right, sentinel, opera, data); + } +} + +void util_rbtree_mid_travel(util_rbtree_t *rbtree, + void(*opera)(util_rbtree_node_t *, void *), void *data) +{ + if((rbtree!=NULL) && !util_rbtree_isempty(rbtree)) + { + rbtree_mid_travel(rbtree->root, _NULL(rbtree), opera, data); + } +} diff --git a/1_8.sip_push/nebula_sdk/sdk/util_rbtree.h b/1_8.sip_push/nebula_sdk/sdk/util_rbtree.h new file mode 100644 index 0000000..79820cd --- /dev/null +++ b/1_8.sip_push/nebula_sdk/sdk/util_rbtree.h @@ -0,0 +1,114 @@ + +/* Copyright (C) 2010. sparkling.liang@hotmail.com. All rights reserved. */ + +#ifndef __UTIL_RLTREE_H_ +#define __UTIL_RLTREE_H_ + +#include +#include + +typedef struct util_rbtree_s util_rbtree_t; +typedef struct util_rbtree_node_s util_rbtree_node_t; + +struct util_rbtree_node_s +{ + long key; + util_rbtree_node_t *parent; + util_rbtree_node_t *right; + util_rbtree_node_t *left; + int color; + void *data; +}; + +struct util_rbtree_s +{ + util_rbtree_node_t *root; + util_rbtree_node_t null; + uint32_t size; +}; + + +#define util_rbt_black(rbnode) ((rbnode)->color = 1) +#define util_rbt_red(rbnode) ((rbnode)->color = 0) +#define util_rbt_isblack(rbnode) ((rbnode)->color == 1) +#define util_rbt_isred(rbnode) ((rbnode)->color == 0) + +/* clear a node's link */ +#define rbt_clear_node(node) do{ \ + (node)->left = NULL; \ + (node)->right = NULL; \ + (node)->parent = NULL; \ + }while(0) + +/* is the tree empty */ +#define util_rbtree_isempty(rbtree) ((rbtree)->root == &(rbtree)->null) + +/* + * find the min node of tree + * return NULL is tree is empty + */ +#define util_rbtree_min(rbtree) util_rbsubtree_min((rbtree)->root, &(rbtree)->null) + +/* + * find the max node of tree + * return NULL is tree is empty + */ +#define util_rbtree_max(rbtree) util_rbsubtree_max((rbtree)->root, &(rbtree)->null) + +void util_rbtree_init(util_rbtree_t *rbtree); +void util_rbtree_insert(util_rbtree_t *rbtree, util_rbtree_node_t *node); +void util_rbtree_delete(util_rbtree_t *rbtree, util_rbtree_node_t *node); + +/* + * search node with key = @key in the tree + * if no such node exist, return NULL + */ +util_rbtree_node_t* util_rbtree_search(util_rbtree_t *rbtree, long key); + +/* + * look node in the tree + * return the first node with key >= @key; + * if @key > all the key values in the tree, return the node with minimum key + * return NULL if tree is empty + */ +util_rbtree_node_t* util_rbtree_lookup(util_rbtree_t *rbtree, long key); + +/* + * find the min node of subtree + * @rbnode: root of the subtree + * @sentinel : the sentinel node + * return NULL if subtree is empty + */ +util_rbtree_node_t* util_rbsubtree_min(util_rbtree_node_t *node, util_rbtree_node_t *sentinel); + +/* + * find the max node of subtree + * @rbnode: root of the subtree + * @sentinel : the sentinel node + * return NULL if subtree is empty + */ +util_rbtree_node_t* util_rbsubtree_max(util_rbtree_node_t *node, util_rbtree_node_t *sentinel); + +/* + * check whether a tree is a rb tree, the null node is n't checked + * return 0: yes + * return 1: root isn't black + * return 2: node is in other color than black and red + * return 3: tree's black height isn't unique + * return 4: a red node with parent in red exists + * return 5: volatile binary search properties + * + * when return !0, @blackheight & @maxdepth is uselsess + * when return 0, @blackheight contains the tree's black height + * + * @maxdepth contains the max length of all simple roads from root to it's leaf nodes + */ +int util_rbtree_check(const util_rbtree_t *rbtree, int *blackheight, int *maxdepth); + +/* + * travel through a rb tree in sequence: left-root-right + * you CAN NOT do any operations that will break the RB properties + */ +void util_rbtree_mid_travel(util_rbtree_t *rbtree, void(*opera)(util_rbtree_node_t *, void *), void *data); + +#endif /* end __UTIL_RLTREE_H_ */ diff --git a/1_8.sip_push/nebula_sdk/sdk/util_rbtree.o b/1_8.sip_push/nebula_sdk/sdk/util_rbtree.o new file mode 100644 index 0000000..1652836 Binary files /dev/null and b/1_8.sip_push/nebula_sdk/sdk/util_rbtree.o differ diff --git a/1_8.sip_push/nebula_sdk/tags b/1_8.sip_push/nebula_sdk/tags new file mode 100644 index 0000000..47ae901 --- /dev/null +++ b/1_8.sip_push/nebula_sdk/tags @@ -0,0 +1,1049 @@ +!_TAG_FILE_FORMAT 2 /extended format; --format=1 will not append ;" to lines/ +!_TAG_FILE_SORTED 1 /0=unsorted, 1=sorted, 2=foldcase/ +!_TAG_PROGRAM_AUTHOR Darren Hiebert /dhiebert@users.sourceforge.net/ +!_TAG_PROGRAM_NAME Exuberant Ctags // +!_TAG_PROGRAM_URL http://ctags.sourceforge.net /official site/ +!_TAG_PROGRAM_VERSION 5.9~svn20110310 // +ARCHIVE_H ./sdk/archive.h 2;" d +AUTH_H ./sdk/auth.h 2;" d +Accumulate ./sdk/list.c /^int Accumulate(List* list, int(*pred)(void* data))$/;" f +Archive ./sdk/archive.h /^typedef struct _Archive Archive;$/;" t typeref:struct:_Archive +Back ./sdk/list.c /^void* Back(List* list)$/;" f +CC ./sdk/Makefile /^CC=gcc$/;" m +CC ./sdk/proto/Makefile /^CC=gcc$/;" m +CC ./sdk/test/Makefile /^CC=gcc$/;" m +CFALGS ./sdk/test/Makefile /^CFALGS=-g$/;" m +CFLAGS ./sdk/Makefile /^CFLAGS=-g -fPIC -Wall -Werror$/;" m +CFLAGS ./sdk/proto/Makefile /^CFLAGS=-g -fPIC$/;" m +CONFIG_H ./sdk/config.h 2;" d +CONNECT_H ./sdk/connect.h 2;" d +CRYPTO1_BLOCK_SIZE ./sdk/crypto/crypto_framwork.h 17;" d +CRYPTO2_BLOCK_SIZE ./sdk/crypto/crypto_framwork.h 18;" d +CRYPTO3_BLOCK_SIZE ./sdk/crypto/crypto_framwork.h 19;" d +CRYPTO_FRAMWROK_H ./sdk/crypto/crypto_framwork.h 2;" d +CRYPTO_OK ./sdk/crypto/crypto_framwork.h 10;" d +CRYPTO_SET_KEY_ERROR ./sdk/crypto/crypto_framwork.h 14;" d +CRYPTO_SRC_LEN_ZERO ./sdk/crypto/crypto_framwork.h 15;" d +CRYPTO_TOOSHORT_DST_LEN ./sdk/crypto/crypto_framwork.h 12;" d +CRYPTO_TOOSHORT_KEY_LEN ./sdk/crypto/crypto_framwork.h 13;" d +CRYPTO_UNDEF_MEMORY ./sdk/crypto/crypto_framwork.h 11;" d +ClearList ./sdk/list.c /^void ClearList(List* list)$/;" f +Conn ./sdk/net.h /^typedef struct _Conn Conn;$/;" t typeref:struct:_Conn +ConnState ./sdk/net.h /^typedef enum _ConnState ConnState;$/;" t typeref:enum:_ConnState +CreateList ./sdk/list.c /^List* CreateList()$/;" f +CreateMachineId ./sdk/proto/nebula_proto.c /^uint32_t CreateMachineId()$/;" f +CreateMsgid ./sdk/proto/nebula_proto.c /^void CreateMsgid(char *msgid)$/;" f +DEFAULT_STRING_SIZE ./sdk/str.c 7;" d file: +DEFAULT_TIMER_LIMIT_SIZE ./sdk/timer.c 6;" d file: +DICT_ERR ./sdk/dict.h 46;" d +DICT_HT_INITIAL_SIZE ./sdk/dict.h 98;" d +DICT_NOTUSED ./sdk/dict.h 49;" d +DICT_OK ./sdk/dict.h 45;" d +DestroyList ./sdk/list.c /^void DestroyList(List* list)$/;" f +EPOLL_SIZE ./sdk/net.c 14;" d file: +Front ./sdk/list.c /^void* Front(List* list)$/;" f +HEAD_INIT ./sdk/proto/nebula_proto.h 52;" d +INCLUDES ./sdk/Makefile /^INCLUDES=-Iproto -Icrypto$/;" m +INCLUDES ./sdk/test/Makefile /^INCLUDES=-I..$/;" m +IS_VALID_TYPE ./sdk/proto/nebula_proto.h 50;" d +LINK ./sdk/Makefile /^LINK=-lpthread -lcurl -lssl -lcrypto$/;" m +LINK ./sdk/test/Makefile /^LINK=-L.. -lnebula_sdk$/;" m +LOG_LEVEL_DEBUG ./sdk/logger.h /^ LOG_LEVEL_DEBUG,$/;" e enum:LogLevelTypes +LOG_LEVEL_ERR ./sdk/logger.h /^ LOG_LEVEL_ERR, \/* error conditions *\/$/;" e enum:LogLevelTypes +LOG_LEVEL_INFO ./sdk/logger.h /^ LOG_LEVEL_INFO,$/;" e enum:LogLevelTypes +LOG_LEVEL_NOTICE ./sdk/logger.h /^ LOG_LEVEL_NOTICE,$/;" e enum:LogLevelTypes +LOG_LEVEL_VERB ./sdk/logger.h /^ LOG_LEVEL_VERB$/;" e enum:LogLevelTypes +LOG_LEVEL_WARN ./sdk/logger.h /^ LOG_LEVEL_WARN, \/* warning conditions *\/$/;" e enum:LogLevelTypes +LOG_MAX_LEN ./sdk/logger.c 19;" d file: +List ./sdk/list.h /^typedef struct List {$/;" s +List ./sdk/list.h /^} List;$/;" t typeref:struct:List +ListBegin ./sdk/list.c /^ListIterator ListBegin(List* list)$/;" f +ListIterator ./sdk/list.h /^typedef void** ListIterator;$/;" t +ListNext ./sdk/list.c /^ListIterator ListNext(ListIterator itr)$/;" f +LogLevelTypes ./sdk/logger.h /^enum LogLevelTypes \/\/日志分级$/;" g +MAX ./sdk/logger.c 16;" d file: +MAX_BUF_SIZE ./sdk/connect.h 6;" d +MIN ./sdk/logger.c 15;" d file: +MSG_ID_LEN ./sdk/proto/nebula_proto.h 62;" d +MSG_IS_REQUEST ./sdk/proto/nebula_proto.h 45;" d +MSG_SET_REQUEST ./sdk/proto/nebula_proto.h 46;" d +MsgType2Str ./sdk/proto/nebula_proto.c /^const char* MsgType2Str(uint8_t type)$/;" f +NEBULA_KIEV_ACCOFFLINE ./sdk/proto/nebula_proto.h 41;" d +NEBULA_KIEV_ACCONLINE ./sdk/proto/nebula_proto.h 42;" d +NEBULA_KIEV_MSGACK ./sdk/proto/nebula_proto.h 43;" d +NEBULA_MSG_ACCSTATUS ./sdk/proto/nebula_proto.h 34;" d +NEBULA_MSG_ACCUPDATE ./sdk/proto/nebula_proto.h 39;" d +NEBULA_MSG_ACK ./sdk/proto/nebula_proto.h 29;" d +NEBULA_MSG_AUTH ./sdk/proto/nebula_proto.h 25;" d +NEBULA_MSG_BYE ./sdk/proto/nebula_proto.h 37;" d +NEBULA_MSG_DIALOGACK ./sdk/proto/nebula_proto.h 36;" d +NEBULA_MSG_FIN ./sdk/proto/nebula_proto.h 30;" d +NEBULA_MSG_INVITE ./sdk/proto/nebula_proto.h 35;" d +NEBULA_MSG_MSG ./sdk/proto/nebula_proto.h 28;" d +NEBULA_MSG_PING ./sdk/proto/nebula_proto.h 24;" d +NEBULA_MSG_PRES ./sdk/proto/nebula_proto.h 33;" d +NEBULA_MSG_PSH ./sdk/proto/nebula_proto.h 27;" d +NEBULA_MSG_SMS ./sdk/proto/nebula_proto.h 32;" d +NEBULA_MSG_SUB ./sdk/proto/nebula_proto.h 31;" d +NEBULA_MSG_SYNC ./sdk/proto/nebula_proto.h 26;" d +NEBULA_MSG_UPDATE ./sdk/proto/nebula_proto.h 38;" d +NEBULA_NET_H ./sdk/net.h 2;" d +NEBULA_SDK_H ./nebula_sdk.h 2;" d +NEBULA_SDK_H ./sdk/nebula_sdk.h 2;" d +NEBULA_SDK_H ./sdk/test/nebula_sdk/nebula_sdk.h 2;" d +NEBULA__ACCOUNT_STATUS_REQUEST__INIT ./sdk/proto/message.pb-c.h 365;" d +NEBULA__ACCOUNT_STATUS_RESPONSE__ACCOUNT_STATUS__INIT ./sdk/proto/message.pb-c.h 379;" d +NEBULA__ACCOUNT_STATUS_RESPONSE__INIT ./sdk/proto/message.pb-c.h 391;" d +NEBULA__ACCOUNT_UPDATE_REQUEST__INIT ./sdk/proto/message.pb-c.h 92;" d +NEBULA__ACCOUNT_UPDATE_RESPONSE__INIT ./sdk/proto/message.pb-c.h 107;" d +NEBULA__ADDRESS__INIT ./sdk/proto/message.pb-c.h 402;" d +NEBULA__AUTH_REQUEST__ALGORITHM__MD5_DAA ./sdk/proto/message.pb-c.h /^ NEBULA__AUTH_REQUEST__ALGORITHM__MD5_DAA = 1,$/;" e enum:_Nebula__AuthRequest__Algorithm +NEBULA__AUTH_REQUEST__ALGORITHM__MD5_FLYME ./sdk/proto/message.pb-c.h /^ NEBULA__AUTH_REQUEST__ALGORITHM__MD5_FLYME = 2$/;" e enum:_Nebula__AuthRequest__Algorithm +NEBULA__AUTH_REQUEST__ALGORITHM__MD5_MEIZU ./sdk/proto/message.pb-c.h /^ NEBULA__AUTH_REQUEST__ALGORITHM__MD5_MEIZU = 0,$/;" e enum:_Nebula__AuthRequest__Algorithm +NEBULA__AUTH_REQUEST__INIT ./sdk/proto/message.pb-c.h 125;" d +NEBULA__AUTH_RESPONSE__INIT ./sdk/proto/message.pb-c.h 138;" d +NEBULA__DIALOG_REQUEST__INIT ./sdk/proto/message.pb-c.h 416;" d +NEBULA__DIALOG_RESPONSE__INIT ./sdk/proto/message.pb-c.h 431;" d +NEBULA__MESSAGE_KIEV_ACK__INIT ./sdk/proto/message.pb-c.h 198;" d +NEBULA__MESSAGE_SEQ__CONTENT__INIT ./sdk/proto/message.pb-c.h 176;" d +NEBULA__MESSAGE_SEQ__INIT ./sdk/proto/message.pb-c.h 187;" d +NEBULA__MESSAGE__CONTENT__INIT ./sdk/proto/message.pb-c.h 152;" d +NEBULA__MESSAGE__CONTENT__MSG_TYPE__ePresenceMessage ./sdk/proto/message.pb-c.h /^ NEBULA__MESSAGE__CONTENT__MSG_TYPE__ePresenceMessage = 1,$/;" e enum:_Nebula__Message__Content__MsgType +NEBULA__MESSAGE__CONTENT__MSG_TYPE__ePushMessage ./sdk/proto/message.pb-c.h /^ NEBULA__MESSAGE__CONTENT__MSG_TYPE__ePushMessage = 0,$/;" e enum:_Nebula__Message__Content__MsgType +NEBULA__MESSAGE__CONTENT__MSG_TYPE__eSmsMessage ./sdk/proto/message.pb-c.h /^ NEBULA__MESSAGE__CONTENT__MSG_TYPE__eSmsMessage = 2$/;" e enum:_Nebula__Message__Content__MsgType +NEBULA__MESSAGE__FLAG__MESSAGE_ACK ./sdk/proto/message.pb-c.h /^ NEBULA__MESSAGE__FLAG__MESSAGE_ACK = 1,$/;" e enum:_Nebula__Message__Flag +NEBULA__MESSAGE__FLAG__MESSAGE_END ./sdk/proto/message.pb-c.h /^ NEBULA__MESSAGE__FLAG__MESSAGE_END = 2$/;" e enum:_Nebula__Message__Flag +NEBULA__MESSAGE__INIT ./sdk/proto/message.pb-c.h 165;" d +NEBULA__NEBULA_MSG__INIT ./sdk/proto/nebula.pb-c.h 26;" d +NEBULA__NOTIFY_BODY__INIT ./sdk/proto/message.pb-c.h 245;" d +NEBULA__PARAM__INIT ./sdk/proto/message.pb-c.h 79;" d +NEBULA__PRESENCE_NOTIFY__CONTENT__INIT ./sdk/proto/message.pb-c.h 312;" d +NEBULA__PRESENCE_NOTIFY__INIT ./sdk/proto/message.pb-c.h 323;" d +NEBULA__PRESENCE_REQUEST__INIT ./sdk/proto/message.pb-c.h 338;" d +NEBULA__PRESENCE_RESPONSE__INIT ./sdk/proto/message.pb-c.h 354;" d +NEBULA__PRESENCE_TYPE__eFullSubscribe ./sdk/proto/message.pb-c.h /^ NEBULA__PRESENCE_TYPE__eFullSubscribe = 1,$/;" e enum:_Nebula__PresenceType +NEBULA__PRESENCE_TYPE__eIncrementSubscribe ./sdk/proto/message.pb-c.h /^ NEBULA__PRESENCE_TYPE__eIncrementSubscribe = 0,$/;" e enum:_Nebula__PresenceType +NEBULA__PRESENCE_TYPE__eUnSubscribe ./sdk/proto/message.pb-c.h /^ NEBULA__PRESENCE_TYPE__eUnSubscribe = 2$/;" e enum:_Nebula__PresenceType +NEBULA__SMS_REQUEST__FILE_INFO__INIT ./sdk/proto/message.pb-c.h 258;" d +NEBULA__SMS_REQUEST__INIT ./sdk/proto/message.pb-c.h 287;" d +NEBULA__SMS_REQUEST__REPORT_TYPE__eMMSReport ./sdk/proto/message.pb-c.h /^ NEBULA__SMS_REQUEST__REPORT_TYPE__eMMSReport = 1$/;" e enum:_Nebula__SmsRequest__ReportType +NEBULA__SMS_REQUEST__REPORT_TYPE__eSMSReport ./sdk/proto/message.pb-c.h /^ NEBULA__SMS_REQUEST__REPORT_TYPE__eSMSReport = 0,$/;" e enum:_Nebula__SmsRequest__ReportType +NEBULA__SMS_REQUEST__SMS_TYPE__eMultimediaMessage ./sdk/proto/message.pb-c.h /^ NEBULA__SMS_REQUEST__SMS_TYPE__eMultimediaMessage = 1,$/;" e enum:_Nebula__SmsRequest__SmsType +NEBULA__SMS_REQUEST__SMS_TYPE__eReportMessage ./sdk/proto/message.pb-c.h /^ NEBULA__SMS_REQUEST__SMS_TYPE__eReportMessage = 2$/;" e enum:_Nebula__SmsRequest__SmsType +NEBULA__SMS_REQUEST__SMS_TYPE__eShortMessage ./sdk/proto/message.pb-c.h /^ NEBULA__SMS_REQUEST__SMS_TYPE__eShortMessage = 0,$/;" e enum:_Nebula__SmsRequest__SmsType +NEBULA__SMS_RESPONSE__INIT ./sdk/proto/message.pb-c.h 298;" d +NEBULA__SUBSCRIBE_REQUEST__INIT ./sdk/proto/message.pb-c.h 209;" d +NEBULA__SUBSCRIBE_RESPONSE__CONTENT__INIT ./sdk/proto/message.pb-c.h 222;" d +NEBULA__SUBSCRIBE_RESPONSE__INIT ./sdk/proto/message.pb-c.h 234;" d +NebulaAddSubApp ./sdk/archive.c /^int NebulaAddSubApp(const char* appname)$/;" f +NebulaAuth1 ./sdk/auth.c /^int NebulaAuth1()$/;" f +NebulaAuth2 ./sdk/auth.c /^int NebulaAuth2(char* token, char* nonce)$/;" f +NebulaBuf ./sdk/net.c /^typedef struct _NebulaBuf NebulaBuf;$/;" t typeref:struct:_NebulaBuf file: +NebulaCloneRedirectResult ./sdk/redirect.c /^int NebulaCloneRedirectResult()$/;" f +NebulaCompress ./sdk/nebula_compress_uncompress_wrapper.c /^int NebulaCompress(uint8_t type, const char* src, uint32_t src_len,$/;" f +NebulaConnConnect ./sdk/net.c /^int NebulaConnConnect(Conn* conn, const char* host, uint16_t port)$/;" f +NebulaConnCreate ./sdk/net.c /^Conn* NebulaConnCreate()$/;" f +NebulaConnInit ./sdk/net.c /^void NebulaConnInit(Conn* conn, void(*on_connect)(Conn*, int),$/;" f +NebulaConnLoop ./sdk/net.c /^void NebulaConnLoop()$/;" f +NebulaConnNebulaDisconnect ./sdk/net.c /^void NebulaConnNebulaDisconnect(Conn* conn)$/;" f +NebulaConnSend ./sdk/net.c /^int NebulaConnSend(Conn* conn, NebulaHeader *head, ProtobufCMessage *msg)$/;" f +NebulaConnect ./sdk/connect.c /^int NebulaConnect()$/;" f +NebulaDecrypt ./sdk/nebula_encrypt_decrypt_wrapper.c /^int NebulaDecrypt(uint8_t type, const char *key, uint32_t key_len,$/;" f +NebulaDisconnect ./sdk/connect.c /^void NebulaDisconnect()$/;" f +NebulaEncrypt ./sdk/nebula_encrypt_decrypt_wrapper.c /^int NebulaEncrypt(uint8_t type, const char *key, uint32_t key_len,$/;" f +NebulaHeader ./sdk/proto/nebula_proto.h /^typedef struct _NebulaHeader NebulaHeader;$/;" t typeref:struct:_NebulaHeader +NebulaInit ./sdk/nebula_sdk.c /^int NebulaInit(const char* device_tag, const char* host, const char* file)$/;" f +NebulaInitAutoSave ./sdk/archive.c /^void NebulaInitAutoSave()$/;" f +NebulaInitPush ./sdk/push.c /^int NebulaInitPush()$/;" f +NebulaIsSubscribed ./sdk/archive.c /^int NebulaIsSubscribed(const char* appname)$/;" f +NebulaLoadFromFile ./sdk/archive.c /^int NebulaLoadFromFile(const char* file)$/;" f +NebulaMsgCallback ./nebula_sdk.h /^ typedef void (*NebulaMsgCallback)(const char* app, const char* msg);$/;" t +NebulaMsgCallback ./sdk/nebula_sdk.h /^ typedef void (*NebulaMsgCallback)(const char* data, int len);$/;" t +NebulaMsgCallback ./sdk/test/nebula_sdk/nebula_sdk.h /^ typedef void (*NebulaMsgCallback)(const char* app, const char* msg);$/;" t +NebulaMsgType ./nebula_sdk.h /^} NebulaMsgType;$/;" t typeref:enum:__anon1 +NebulaMsgType ./sdk/nebula_sdk.h /^} NebulaMsgType;$/;" t typeref:enum:__anon2 +NebulaMsgType ./sdk/test/nebula_sdk/nebula_sdk.h /^} NebulaMsgType;$/;" t typeref:enum:__anon5 +NebulaOnAuth ./sdk/auth.c /^void NebulaOnAuth(NebulaHeader *head, const char* data, int len)$/;" f +NebulaOnMsg ./sdk/push.c /^void NebulaOnMsg(NebulaHeader *head, const char* data, int len)$/;" f +NebulaOnPush ./sdk/push.c /^void NebulaOnPush(NebulaHeader *head, const char* data, int len)$/;" f +NebulaOnSub ./sdk/subscribe.c /^void NebulaOnSub(NebulaHeader *head, const char* data, int len)$/;" f +NebulaOnSubSuccess ./sdk/subscribe.c /^void NebulaOnSubSuccess(const char* appname)$/;" f +NebulaRedirect ./sdk/redirect.c /^int NebulaRedirect()$/;" f +NebulaRedirectOnRead ./sdk/redirect.c /^ssize_t NebulaRedirectOnRead(const void *ptr, size_t size, size_t nmemb, FILE *stream)$/;" f +NebulaRegister ./sdk/nebula_sdk.c /^NebulaMsgCallback NebulaRegister(NebulaMsgType type, NebulaMsgCallback cb)$/;" f +NebulaSaveToFile ./sdk/archive.c /^int NebulaSaveToFile(const char* file)$/;" f +NebulaSend ./sdk/connect.c /^int NebulaSend(uint8_t type, ProtobufCMessage *msg)$/;" f +NebulaStart ./sdk/nebula_sdk.c /^int NebulaStart()$/;" f +NebulaSubScribe ./sdk/nebula_sdk.c /^void NebulaSubScribe(int count, const char** app_name)$/;" f +NebulaUnCompress ./sdk/nebula_compress_uncompress_wrapper.c /^int NebulaUnCompress(uint8_t type, const char* src, uint32_t src_len,$/;" f +Nebula__AccountStatusRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AccountStatusRequest Nebula__AccountStatusRequest;$/;" t typeref:struct:_Nebula__AccountStatusRequest +Nebula__AccountStatusRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AccountStatusRequest_Closure)$/;" t +Nebula__AccountStatusResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AccountStatusResponse Nebula__AccountStatusResponse;$/;" t typeref:struct:_Nebula__AccountStatusResponse +Nebula__AccountStatusResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AccountStatusResponse_Closure)$/;" t +Nebula__AccountStatusResponse__AccountStatus ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AccountStatusResponse__AccountStatus Nebula__AccountStatusResponse__AccountStatus;$/;" t typeref:struct:_Nebula__AccountStatusResponse__AccountStatus +Nebula__AccountStatusResponse__AccountStatus_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AccountStatusResponse__AccountStatus_Closure)$/;" t +Nebula__AccountUpdateRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AccountUpdateRequest Nebula__AccountUpdateRequest;$/;" t typeref:struct:_Nebula__AccountUpdateRequest +Nebula__AccountUpdateRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AccountUpdateRequest_Closure)$/;" t +Nebula__AccountUpdateResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AccountUpdateResponse Nebula__AccountUpdateResponse;$/;" t typeref:struct:_Nebula__AccountUpdateResponse +Nebula__AccountUpdateResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AccountUpdateResponse_Closure)$/;" t +Nebula__Address ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__Address Nebula__Address;$/;" t typeref:struct:_Nebula__Address +Nebula__Address_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__Address_Closure)$/;" t +Nebula__AuthRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AuthRequest Nebula__AuthRequest;$/;" t typeref:struct:_Nebula__AuthRequest +Nebula__AuthRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AuthRequest_Closure)$/;" t +Nebula__AuthRequest__Algorithm ./sdk/proto/message.pb-c.h /^} Nebula__AuthRequest__Algorithm;$/;" t typeref:enum:_Nebula__AuthRequest__Algorithm +Nebula__AuthResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__AuthResponse Nebula__AuthResponse;$/;" t typeref:struct:_Nebula__AuthResponse +Nebula__AuthResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__AuthResponse_Closure)$/;" t +Nebula__DialogRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__DialogRequest Nebula__DialogRequest;$/;" t typeref:struct:_Nebula__DialogRequest +Nebula__DialogRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__DialogRequest_Closure)$/;" t +Nebula__DialogResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__DialogResponse Nebula__DialogResponse;$/;" t typeref:struct:_Nebula__DialogResponse +Nebula__DialogResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__DialogResponse_Closure)$/;" t +Nebula__Message ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__Message Nebula__Message;$/;" t typeref:struct:_Nebula__Message +Nebula__MessageKievAck ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__MessageKievAck Nebula__MessageKievAck;$/;" t typeref:struct:_Nebula__MessageKievAck +Nebula__MessageKievAck_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__MessageKievAck_Closure)$/;" t +Nebula__MessageSeq ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__MessageSeq Nebula__MessageSeq;$/;" t typeref:struct:_Nebula__MessageSeq +Nebula__MessageSeq_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__MessageSeq_Closure)$/;" t +Nebula__MessageSeq__Content ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__MessageSeq__Content Nebula__MessageSeq__Content;$/;" t typeref:struct:_Nebula__MessageSeq__Content +Nebula__MessageSeq__Content_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__MessageSeq__Content_Closure)$/;" t +Nebula__Message_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__Message_Closure)$/;" t +Nebula__Message__Content ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__Message__Content Nebula__Message__Content;$/;" t typeref:struct:_Nebula__Message__Content +Nebula__Message__Content_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__Message__Content_Closure)$/;" t +Nebula__Message__Content__MsgType ./sdk/proto/message.pb-c.h /^} Nebula__Message__Content__MsgType;$/;" t typeref:enum:_Nebula__Message__Content__MsgType +Nebula__Message__Flag ./sdk/proto/message.pb-c.h /^} Nebula__Message__Flag;$/;" t typeref:enum:_Nebula__Message__Flag +Nebula__NebulaMsg ./sdk/proto/nebula.pb-c.h /^typedef struct _Nebula__NebulaMsg Nebula__NebulaMsg;$/;" t typeref:struct:_Nebula__NebulaMsg +Nebula__NebulaMsg_Closure ./sdk/proto/nebula.pb-c.h /^typedef void (*Nebula__NebulaMsg_Closure)$/;" t +Nebula__NotifyBody ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__NotifyBody Nebula__NotifyBody;$/;" t typeref:struct:_Nebula__NotifyBody +Nebula__NotifyBody_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__NotifyBody_Closure)$/;" t +Nebula__Param ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__Param Nebula__Param;$/;" t typeref:struct:_Nebula__Param +Nebula__Param_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__Param_Closure)$/;" t +Nebula__PresenceNotify ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__PresenceNotify Nebula__PresenceNotify;$/;" t typeref:struct:_Nebula__PresenceNotify +Nebula__PresenceNotify_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__PresenceNotify_Closure)$/;" t +Nebula__PresenceNotify__Content ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__PresenceNotify__Content Nebula__PresenceNotify__Content;$/;" t typeref:struct:_Nebula__PresenceNotify__Content +Nebula__PresenceNotify__Content_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__PresenceNotify__Content_Closure)$/;" t +Nebula__PresenceRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__PresenceRequest Nebula__PresenceRequest;$/;" t typeref:struct:_Nebula__PresenceRequest +Nebula__PresenceRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__PresenceRequest_Closure)$/;" t +Nebula__PresenceResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__PresenceResponse Nebula__PresenceResponse;$/;" t typeref:struct:_Nebula__PresenceResponse +Nebula__PresenceResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__PresenceResponse_Closure)$/;" t +Nebula__PresenceType ./sdk/proto/message.pb-c.h /^} Nebula__PresenceType;$/;" t typeref:enum:_Nebula__PresenceType +Nebula__SmsRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__SmsRequest Nebula__SmsRequest;$/;" t typeref:struct:_Nebula__SmsRequest +Nebula__SmsRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__SmsRequest_Closure)$/;" t +Nebula__SmsRequest__FileInfo ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__SmsRequest__FileInfo Nebula__SmsRequest__FileInfo;$/;" t typeref:struct:_Nebula__SmsRequest__FileInfo +Nebula__SmsRequest__FileInfo_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__SmsRequest__FileInfo_Closure)$/;" t +Nebula__SmsRequest__ReportType ./sdk/proto/message.pb-c.h /^} Nebula__SmsRequest__ReportType;$/;" t typeref:enum:_Nebula__SmsRequest__ReportType +Nebula__SmsRequest__SmsType ./sdk/proto/message.pb-c.h /^} Nebula__SmsRequest__SmsType;$/;" t typeref:enum:_Nebula__SmsRequest__SmsType +Nebula__SmsResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__SmsResponse Nebula__SmsResponse;$/;" t typeref:struct:_Nebula__SmsResponse +Nebula__SmsResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__SmsResponse_Closure)$/;" t +Nebula__SubscribeRequest ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__SubscribeRequest Nebula__SubscribeRequest;$/;" t typeref:struct:_Nebula__SubscribeRequest +Nebula__SubscribeRequest_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__SubscribeRequest_Closure)$/;" t +Nebula__SubscribeResponse ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__SubscribeResponse Nebula__SubscribeResponse;$/;" t typeref:struct:_Nebula__SubscribeResponse +Nebula__SubscribeResponse_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__SubscribeResponse_Closure)$/;" t +Nebula__SubscribeResponse__Content ./sdk/proto/message.pb-c.h /^typedef struct _Nebula__SubscribeResponse__Content Nebula__SubscribeResponse__Content;$/;" t typeref:struct:_Nebula__SubscribeResponse__Content +Nebula__SubscribeResponse__Content_Closure ./sdk/proto/message.pb-c.h /^typedef void (*Nebula__SubscribeResponse__Content_Closure)$/;" t +Nebulaget_status ./sdk/config.c /^eStatus Nebulaget_status()$/;" f +Nebulamsgtype_name ./sdk/config.c /^const char* Nebulamsgtype_name(int type)$/;" f +Nebularand_string ./sdk/config.c /^const char* Nebularand_string()$/;" f +Nebulastatus_name ./sdk/config.c /^const char* Nebulastatus_name(eStatus ss)$/;" f +Node ./sdk/list.h /^typedef struct Node {$/;" s +Node ./sdk/list.h /^} Node;$/;" t typeref:struct:Node +OBJS ./sdk/Makefile /^OBJS=$(patsubst %.c,%.o,$(wildcard *.c))$/;" m +OBJS ./sdk/proto/Makefile /^OBJS=$(patsubst %.proto,%.o,$(wildcard *.proto))$/;" m +OnPush ./sdk/test/test.c /^void OnPush(const char* app, const char *msg)$/;" f +PROTOBUF_C_NO_DEPRECATED ./sdk/proto/message.pb-c.c 5;" d file: +PROTOBUF_C_NO_DEPRECATED ./sdk/proto/nebula.pb-c.c 5;" d file: +PROTOBUF_C_message_2eproto__INCLUDED ./sdk/proto/message.pb-c.h 4;" d +PROTOBUF_C_nebula_2eproto__INCLUDED ./sdk/proto/nebula.pb-c.h 4;" d +PUSH_H ./sdk/push.h 2;" d +Ping ./sdk/connect.c /^void Ping(timer_heap_t* ht, timer_entry *entry)$/;" f +PopBack ./sdk/list.c /^void PopBack(List* list)$/;" f +PopFront ./sdk/list.c /^void PopFront(List* list)$/;" f +PushBack ./sdk/list.c /^int PushBack(List* list, void* data)$/;" f +PushFront ./sdk/list.c /^int PushFront(List* list, void* data)$/;" f +REDIRECT_H ./sdk/redirect.h 2;" d +ReleaseArchive ./sdk/archive.c /^void ReleaseArchive()$/;" f +SMAX ./sdk/str.c 8;" d file: +SUBSCRIBE_H ./sdk/subscribe.h 2;" d +SendSync ./sdk/push.c /^int SendSync(int type)$/;" f +StrRequestType ./sdk/proto/nebula_proto.c /^static const char* StrRequestType[] = {$/;" v file: +StrResponseType ./sdk/proto/nebula_proto.c /^static const char* StrResponseType[] = {$/;" v file: +TARGET ./sdk/Makefile /^TARGET=libnebula_sdk.so$/;" m +TARGET ./sdk/proto/Makefile /^TARGET=libnebula_proto.a$/;" m +_Archive ./sdk/archive.h /^struct _Archive$/;" s +_Conn ./sdk/net.h /^struct _Conn$/;" s +_ConnState ./sdk/net.h /^enum _ConnState {$/;" g +_NULL ./sdk/util_rbtree.c 7;" d file: +_NebulaBuf ./sdk/net.c /^struct _NebulaBuf$/;" s file: +_NebulaHeader ./sdk/proto/nebula_proto.h /^struct _NebulaHeader$/;" s +_Nebula__AccountStatusRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__AccountStatusRequest$/;" s +_Nebula__AccountStatusResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__AccountStatusResponse$/;" s +_Nebula__AccountStatusResponse__AccountStatus ./sdk/proto/message.pb-c.h /^struct _Nebula__AccountStatusResponse__AccountStatus$/;" s +_Nebula__AccountUpdateRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__AccountUpdateRequest$/;" s +_Nebula__AccountUpdateResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__AccountUpdateResponse$/;" s +_Nebula__Address ./sdk/proto/message.pb-c.h /^struct _Nebula__Address$/;" s +_Nebula__AuthRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__AuthRequest$/;" s +_Nebula__AuthRequest__Algorithm ./sdk/proto/message.pb-c.h /^typedef enum _Nebula__AuthRequest__Algorithm {$/;" g +_Nebula__AuthResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__AuthResponse$/;" s +_Nebula__DialogRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__DialogRequest$/;" s +_Nebula__DialogResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__DialogResponse$/;" s +_Nebula__Message ./sdk/proto/message.pb-c.h /^struct _Nebula__Message$/;" s +_Nebula__MessageKievAck ./sdk/proto/message.pb-c.h /^struct _Nebula__MessageKievAck$/;" s +_Nebula__MessageSeq ./sdk/proto/message.pb-c.h /^struct _Nebula__MessageSeq$/;" s +_Nebula__MessageSeq__Content ./sdk/proto/message.pb-c.h /^struct _Nebula__MessageSeq__Content$/;" s +_Nebula__Message__Content ./sdk/proto/message.pb-c.h /^struct _Nebula__Message__Content$/;" s +_Nebula__Message__Content__MsgType ./sdk/proto/message.pb-c.h /^typedef enum _Nebula__Message__Content__MsgType {$/;" g +_Nebula__Message__Flag ./sdk/proto/message.pb-c.h /^typedef enum _Nebula__Message__Flag {$/;" g +_Nebula__NebulaMsg ./sdk/proto/nebula.pb-c.h /^struct _Nebula__NebulaMsg$/;" s +_Nebula__NotifyBody ./sdk/proto/message.pb-c.h /^struct _Nebula__NotifyBody$/;" s +_Nebula__Param ./sdk/proto/message.pb-c.h /^struct _Nebula__Param$/;" s +_Nebula__PresenceNotify ./sdk/proto/message.pb-c.h /^struct _Nebula__PresenceNotify$/;" s +_Nebula__PresenceNotify__Content ./sdk/proto/message.pb-c.h /^struct _Nebula__PresenceNotify__Content$/;" s +_Nebula__PresenceRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__PresenceRequest$/;" s +_Nebula__PresenceResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__PresenceResponse$/;" s +_Nebula__PresenceType ./sdk/proto/message.pb-c.h /^typedef enum _Nebula__PresenceType {$/;" g +_Nebula__SmsRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__SmsRequest$/;" s +_Nebula__SmsRequest__FileInfo ./sdk/proto/message.pb-c.h /^struct _Nebula__SmsRequest__FileInfo$/;" s +_Nebula__SmsRequest__ReportType ./sdk/proto/message.pb-c.h /^typedef enum _Nebula__SmsRequest__ReportType {$/;" g +_Nebula__SmsRequest__SmsType ./sdk/proto/message.pb-c.h /^typedef enum _Nebula__SmsRequest__SmsType {$/;" g +_Nebula__SmsResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__SmsResponse$/;" s +_Nebula__SubscribeRequest ./sdk/proto/message.pb-c.h /^struct _Nebula__SubscribeRequest$/;" s +_Nebula__SubscribeResponse ./sdk/proto/message.pb-c.h /^struct _Nebula__SubscribeResponse$/;" s +_Nebula__SubscribeResponse__Content ./sdk/proto/message.pb-c.h /^struct _Nebula__SubscribeResponse__Content$/;" s +__ASYNC_FCGI_LIST__ ./sdk/list.h 2;" d +__DICT_H ./sdk/dict.h 39;" d +__LOGGER_H__ ./sdk/logger.h 19;" d +__NEBULA_COMPRESS_UNCOMPRESS_H__ ./sdk/nebula_compress_uncompress_wrapper.h 10;" d +__NEBULA_ENCRYPT_DECRYPT_WRAPPER_H__ ./sdk/nebula_encrypt_decrypt_wrapper.h 10;" d +__NEBULA_PROTO_H__ ./sdk/proto/nebula_proto.h 10;" d +__NebulaStart ./sdk/nebula_sdk.c /^void* __NebulaStart(void* ptr)$/;" f +__STUN_STRING_H__ ./sdk/str.h 2;" d +__TIMER_HEAP_H__ ./sdk/timer.h 19;" d +__UTIL_RLTREE_H_ ./sdk/util_rbtree.h 5;" d +__err ./sdk/net.c /^static void __err(Conn* conn)$/;" f file: +__handle_message ./sdk/connect.c /^static void __handle_message(NebulaHeader* head)$/;" f file: +__hashFunction ./sdk/push.c /^static unsigned int __hashFunction(const void *key)$/;" f file: +__keyCompare ./sdk/push.c /^int __keyCompare(void *privdata, const void *key1, const void *key2)$/;" f +__keyDestructor ./sdk/push.c /^void __keyDestructor(void *privdata, void *key)$/;" f +__keyDup ./sdk/push.c /^void* __keyDup(void *privdata, const void *key)$/;" f +__on_connect ./sdk/connect.c /^static void __on_connect(Conn* conn, int err)$/;" f file: +__on_disconnect ./sdk/connect.c /^static void __on_disconnect(Conn* conn)$/;" f file: +__on_read ./sdk/connect.c /^static void __on_read(Conn* conn, NebulaHeader* head)$/;" f file: +__read ./sdk/net.c /^static int __read(Conn* conn)$/;" f file: +__write ./sdk/net.c /^static int __write(Conn* conn)$/;" f file: +_dictClear ./sdk/dict.c /^int _dictClear(dict *d, dictht *ht)$/;" f +_dictExpandIfNeeded ./sdk/dict.c /^static int _dictExpandIfNeeded(dict *d)$/;" f file: +_dictInit ./sdk/dict.c /^int _dictInit(dict *d, dictType *type,$/;" f +_dictKeyIndex ./sdk/dict.c /^static int _dictKeyIndex(dict *d, const void *key)$/;" f file: +_dictNextPower ./sdk/dict.c /^static unsigned long _dictNextPower(unsigned long size)$/;" f file: +_dictRehashStep ./sdk/dict.c /^static void _dictRehashStep(dict *d) {$/;" f file: +_dictReset ./sdk/dict.c /^static void _dictReset(dictht *ht)$/;" f file: +_dictStringCopyHTHashFunction ./sdk/dict.c /^static unsigned int _dictStringCopyHTHashFunction(const void *key)$/;" f file: +_dictStringCopyHTKeyCompare ./sdk/dict.c /^static int _dictStringCopyHTKeyCompare(void *privdata, const void *key1,$/;" f file: +_dictStringDestructor ./sdk/dict.c /^static void _dictStringDestructor(void *privdata, void *key)$/;" f file: +_dictStringDup ./sdk/dict.c /^static void *_dictStringDup(void *privdata, const void *key)$/;" f file: +_eStatus ./sdk/config.h /^enum _eStatus {$/;" g +account ./sdk/proto/message.pb-c.h /^ char **account;$/;" m struct:_Nebula__AccountStatusRequest +account ./sdk/proto/message.pb-c.h /^ char **account;$/;" m struct:_Nebula__PresenceRequest +account ./sdk/proto/message.pb-c.h /^ char **account;$/;" m struct:_Nebula__PresenceResponse +account ./sdk/proto/message.pb-c.h /^ char *account;$/;" m struct:_Nebula__AccountStatusResponse__AccountStatus +account ./sdk/proto/message.pb-c.h /^ char *account;$/;" m struct:_Nebula__MessageSeq__Content +account ./sdk/proto/message.pb-c.h /^ char *account;$/;" m struct:_Nebula__Message__Content +account ./sdk/proto/message.pb-c.h /^ char *account;$/;" m struct:_Nebula__PresenceNotify__Content +algorithm ./sdk/proto/message.pb-c.h /^ Nebula__AuthRequest__Algorithm algorithm;$/;" m struct:_Nebula__AuthRequest +app ./sdk/proto/message.pb-c.h /^ char **app;$/;" m struct:_Nebula__SubscribeRequest +app ./sdk/proto/message.pb-c.h /^ char *app;$/;" m struct:_Nebula__NotifyBody +app ./sdk/proto/message.pb-c.h /^ char *app;$/;" m struct:_Nebula__SubscribeResponse__Content +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AccountStatusRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AccountStatusResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AccountStatusResponse__AccountStatus +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AccountUpdateRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AccountUpdateResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__Address +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AuthRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__AuthResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__DialogRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__DialogResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__Message +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__MessageKievAck +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__MessageSeq +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__MessageSeq__Content +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__Message__Content +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__NotifyBody +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__Param +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__PresenceNotify +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__PresenceNotify__Content +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__PresenceRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__PresenceResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__SmsRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__SmsRequest__FileInfo +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__SmsResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__SubscribeRequest +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__SubscribeResponse +base ./sdk/proto/message.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__SubscribeResponse__Content +base ./sdk/proto/nebula.pb-c.h /^ ProtobufCMessage base;$/;" m struct:_Nebula__NebulaMsg +body ./sdk/proto/message.pb-c.h /^ ProtobufCBinaryData body;$/;" m struct:_Nebula__DialogRequest +body ./sdk/proto/message.pb-c.h /^ ProtobufCBinaryData body;$/;" m struct:_Nebula__DialogResponse +body ./sdk/proto/message.pb-c.h /^ ProtobufCBinaryData body;$/;" m struct:_Nebula__Message__Content +body ./sdk/proto/message.pb-c.h /^ ProtobufCBinaryData body;$/;" m struct:_Nebula__SmsRequest +body ./sdk/proto/message.pb-c.h /^ char *body;$/;" m struct:_Nebula__NotifyBody +body ./sdk/proto/nebula.pb-c.h /^ ProtobufCBinaryData body;$/;" m struct:_Nebula__NebulaMsg +buf ./sdk/net.c /^ char buf[0];$/;" m struct:_NebulaBuf file: +capability ./sdk/proto/message.pb-c.h /^ int32_t capability;$/;" m struct:_Nebula__AccountStatusResponse__AccountStatus +capability ./sdk/proto/message.pb-c.h /^ int32_t capability;$/;" m struct:_Nebula__AccountUpdateRequest +capability ./sdk/proto/message.pb-c.h /^ int32_t capability;$/;" m struct:_Nebula__AccountUpdateResponse +capability ./sdk/proto/message.pb-c.h /^ int32_t capability;$/;" m struct:_Nebula__PresenceNotify__Content +color ./sdk/util_rbtree.h /^ int color;$/;" m struct:util_rbtree_node_s +content ./sdk/proto/message.pb-c.h /^ Nebula__MessageSeq__Content **content;$/;" m struct:_Nebula__MessageSeq +content ./sdk/proto/message.pb-c.h /^ Nebula__Message__Content **content;$/;" m struct:_Nebula__Message +content ./sdk/proto/message.pb-c.h /^ Nebula__PresenceNotify__Content **content;$/;" m struct:_Nebula__PresenceNotify +content ./sdk/proto/message.pb-c.h /^ Nebula__SubscribeResponse__Content **content;$/;" m struct:_Nebula__SubscribeResponse +d ./sdk/dict.h /^ dict *d;$/;" m struct:dictIterator +data ./sdk/list.h /^ void *data;$/;" m struct:Node +data ./sdk/util_rbtree.h /^ void *data;$/;" m struct:util_rbtree_node_s +dialog ./sdk/proto/message.pb-c.h /^ Nebula__Address *dialog;$/;" m struct:_Nebula__DialogRequest +dialog ./sdk/proto/message.pb-c.h /^ Nebula__Address *dialog;$/;" m struct:_Nebula__DialogResponse +dict ./sdk/dict.h /^typedef struct dict {$/;" s +dict ./sdk/dict.h /^} dict;$/;" t typeref:struct:dict +dictAdd ./sdk/dict.c /^int dictAdd(dict *d, void *key, void *val)$/;" f +dictAddRaw ./sdk/dict.c /^dictEntry *dictAddRaw(dict *d, void *key)$/;" f +dictCompareKeys ./sdk/dict.h 129;" d +dictCreate ./sdk/dict.c /^dict *dictCreate(dictType *type,$/;" f +dictDelete ./sdk/dict.c /^int dictDelete(dict *ht, const void *key) {$/;" f +dictDeleteNoFree ./sdk/dict.c /^int dictDeleteNoFree(dict *ht, const void *key) {$/;" f +dictDisableResize ./sdk/dict.c /^void dictDisableResize(void) {$/;" f +dictEmpty ./sdk/dict.c /^void dictEmpty(dict *d) {$/;" f +dictEnableResize ./sdk/dict.c /^void dictEnableResize(void) {$/;" f +dictEntry ./sdk/dict.h /^typedef struct dictEntry {$/;" s +dictEntry ./sdk/dict.h /^} dictEntry;$/;" t typeref:struct:dictEntry +dictExpand ./sdk/dict.c /^int dictExpand(dict *d, unsigned long size)$/;" f +dictFetchValue ./sdk/dict.c /^void *dictFetchValue(dict *d, const void *key) {$/;" f +dictFind ./sdk/dict.c /^dictEntry *dictFind(dict *d, const void *key)$/;" f +dictFreeKey ./sdk/dict.h 118;" d +dictFreeVal ./sdk/dict.h 101;" d +dictGenCaseHashFunction ./sdk/dict.c /^unsigned int dictGenCaseHashFunction(const unsigned char *buf, int len) {$/;" f +dictGenHashFunction ./sdk/dict.c /^unsigned int dictGenHashFunction(const void *key, int len) {$/;" f +dictGenericDelete ./sdk/dict.c /^static int dictGenericDelete(dict *d, const void *key, int nofree)$/;" f file: +dictGetHashFunctionSeed ./sdk/dict.c /^uint32_t dictGetHashFunctionSeed(void) {$/;" f +dictGetIterator ./sdk/dict.c /^dictIterator *dictGetIterator(dict *d)$/;" f +dictGetKey ./sdk/dict.h 135;" d +dictGetRandomKey ./sdk/dict.c /^dictEntry *dictGetRandomKey(dict *d)$/;" f +dictGetSafeIterator ./sdk/dict.c /^dictIterator *dictGetSafeIterator(dict *d) {$/;" f +dictGetSignedIntegerVal ./sdk/dict.h 137;" d +dictGetUnsignedIntegerVal ./sdk/dict.h 138;" d +dictGetVal ./sdk/dict.h 136;" d +dictHashKey ./sdk/dict.h 134;" d +dictIdentityHashFunction ./sdk/dict.c /^unsigned int dictIdentityHashFunction(unsigned int key)$/;" f +dictIntHashFunction ./sdk/dict.c /^unsigned int dictIntHashFunction(unsigned int key)$/;" f +dictIsRehashing ./sdk/dict.h 141;" d +dictIterator ./sdk/dict.h /^typedef struct dictIterator {$/;" s +dictIterator ./sdk/dict.h /^} dictIterator;$/;" t typeref:struct:dictIterator +dictNext ./sdk/dict.c /^dictEntry *dictNext(dictIterator *iter)$/;" f +dictRehash ./sdk/dict.c /^int dictRehash(dict *d, int n) {$/;" f +dictRehashMilliseconds ./sdk/dict.c /^int dictRehashMilliseconds(dict *d, int ms) {$/;" f +dictRelease ./sdk/dict.c /^void dictRelease(dict *d)$/;" f +dictReleaseIterator ./sdk/dict.c /^void dictReleaseIterator(dictIterator *iter)$/;" f +dictReplace ./sdk/dict.c /^int dictReplace(dict *d, void *key, void *val)$/;" f +dictReplaceRaw ./sdk/dict.c /^dictEntry *dictReplaceRaw(dict *d, void *key) {$/;" f +dictResize ./sdk/dict.c /^int dictResize(dict *d)$/;" f +dictSetHashFunctionSeed ./sdk/dict.c /^void dictSetHashFunctionSeed(uint32_t seed) {$/;" f +dictSetKey ./sdk/dict.h 122;" d +dictSetSignedIntegerVal ./sdk/dict.h 112;" d +dictSetUnsignedIntegerVal ./sdk/dict.h 115;" d +dictSetVal ./sdk/dict.h 105;" d +dictSize ./sdk/dict.h 140;" d +dictSlots ./sdk/dict.h 139;" d +dictType ./sdk/dict.h /^typedef struct dictType {$/;" s +dictType ./sdk/dict.h /^} dictType;$/;" t typeref:struct:dictType +dictTypeHeapStringCopyKey ./sdk/dict.c /^dictType dictTypeHeapStringCopyKey = {$/;" v +dictTypeHeapStringCopyKeyValue ./sdk/dict.c /^dictType dictTypeHeapStringCopyKeyValue = {$/;" v +dictTypeHeapStrings ./sdk/dict.c /^dictType dictTypeHeapStrings = {$/;" v +dict_can_resize ./sdk/dict.c /^static int dict_can_resize = 1;$/;" v file: +dict_force_resize_ratio ./sdk/dict.c /^static unsigned int dict_force_resize_ratio = 5;$/;" v file: +dict_hash_function_seed ./sdk/dict.c /^static uint32_t dict_hash_function_seed = 5381;$/;" v file: +dictht ./sdk/dict.h /^typedef struct dictht {$/;" s +dictht ./sdk/dict.h /^} dictht;$/;" t typeref:struct:dictht +dst ./sdk/proto/message.pb-c.h /^ char **dst;$/;" m struct:_Nebula__SmsRequest +dst ./sdk/proto/message.pb-c.h /^ char *dst;$/;" m struct:_Nebula__DialogRequest +dst ./sdk/proto/message.pb-c.h /^ char *dst;$/;" m struct:_Nebula__DialogResponse +eConnState_Connecting ./sdk/net.h /^ eConnState_Connecting,$/;" e enum:_ConnState +eConnState_Error ./sdk/net.h /^ eConnState_Error,$/;" e enum:_ConnState +eConnState_Estab ./sdk/net.h /^ eConnState_Estab,$/;" e enum:_ConnState +eConnState_Init ./sdk/net.h /^ eConnState_Init,$/;" e enum:_ConnState +eNebulaMsg_Max ./nebula_sdk.h /^ eNebulaMsg_Max,$/;" e enum:__anon1 +eNebulaMsg_Max ./sdk/nebula_sdk.h /^ eNebulaMsg_Max,$/;" e enum:__anon2 +eNebulaMsg_Max ./sdk/test/nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Max,$/;" e enum:__anon5 +eNebulaMsg_Mms ./nebula_sdk.h /^ eNebulaMsg_Mms, \/\/\/ 网络彩信$/;" e enum:__anon1 +eNebulaMsg_Mms ./sdk/nebula_sdk.h /^ eNebulaMsg_Mms, \/\/\/ 网络彩信$/;" e enum:__anon2 +eNebulaMsg_Mms ./sdk/test/nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Mms, \/\/\/ 网络彩信$/;" e enum:__anon5 +eNebulaMsg_Presence ./nebula_sdk.h /^ eNebulaMsg_Presence, \/\/\/ Presence$/;" e enum:__anon1 +eNebulaMsg_Presence ./sdk/nebula_sdk.h /^ eNebulaMsg_Presence, \/\/\/ Presence$/;" e enum:__anon2 +eNebulaMsg_Presence ./sdk/test/nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Presence, \/\/\/ Presence$/;" e enum:__anon5 +eNebulaMsg_Push ./nebula_sdk.h /^ eNebulaMsg_Push, \/\/\/ 推送 (路由器只需关心这一类消息)$/;" e enum:__anon1 +eNebulaMsg_Push ./sdk/nebula_sdk.h /^ eNebulaMsg_Push, \/\/\/ 推送 (路由器只需关心这一类消息)$/;" e enum:__anon2 +eNebulaMsg_Push ./sdk/test/nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Push, \/\/\/ 推送 (路由器只需关心这一类消息)$/;" e enum:__anon5 +eNebulaMsg_Sms ./nebula_sdk.h /^ eNebulaMsg_Sms, \/\/\/ 网络短信$/;" e enum:__anon1 +eNebulaMsg_Sms ./sdk/nebula_sdk.h /^ eNebulaMsg_Sms, \/\/\/ 网络短信$/;" e enum:__anon2 +eNebulaMsg_Sms ./sdk/test/nebula_sdk/nebula_sdk.h /^ eNebulaMsg_Sms, \/\/\/ 网络短信$/;" e enum:__anon5 +eStatus ./sdk/config.h /^typedef enum _eStatus eStatus;$/;" t typeref:enum:_eStatus +eStatus_Auth1 ./sdk/config.h /^ eStatus_Auth1,$/;" e enum:_eStatus +eStatus_Auth1_Waiting ./sdk/config.h /^ eStatus_Auth1_Waiting,$/;" e enum:_eStatus +eStatus_Auth2 ./sdk/config.h /^ eStatus_Auth2,$/;" e enum:_eStatus +eStatus_Connect ./sdk/config.h /^ eStatus_Connect,$/;" e enum:_eStatus +eStatus_Connecting ./sdk/config.h /^ eStatus_Connecting,$/;" e enum:_eStatus +eStatus_Estab ./sdk/config.h /^ eStatus_Estab,$/;" e enum:_eStatus +eStatus_Init ./sdk/config.h /^ eStatus_Init,$/;" e enum:_eStatus +eStatus_LoopTest ./sdk/config.h /^ eStatus_LoopTest,$/;" e enum:_eStatus +eStatus_Redirect ./sdk/config.h /^ eStatus_Redirect,$/;" e enum:_eStatus +eStatus_Sub ./sdk/config.h /^ eStatus_Sub,$/;" e enum:_eStatus +eSubStatus ./sdk/subscribe.c /^} eSubStatus;$/;" t typeref:enum:__anon3 file: +eSubStatus_Done ./sdk/subscribe.c /^ eSubStatus_Done,$/;" e enum:__anon3 file: +eSubStatus_Init ./sdk/subscribe.c /^ eSubStatus_Init,$/;" e enum:__anon3 file: +eSubStatus_WaitResponse ./sdk/subscribe.c /^ eSubStatus_WaitResponse,$/;" e enum:__anon3 file: +entry ./sdk/dict.h /^ dictEntry *entry, *nextEntry;$/;" m struct:dictIterator +err ./sdk/net.h /^ void (*err)(Conn*);$/;" m struct:_Conn +expires ./sdk/proto/message.pb-c.h /^ char *expires;$/;" m struct:_Nebula__SmsRequest +fd ./sdk/logger.c /^ int fd;$/;" m struct:logger_t file: +fileinfos ./sdk/proto/message.pb-c.h /^ Nebula__SmsRequest__FileInfo **fileinfos;$/;" m struct:_Nebula__SmsRequest +filename ./sdk/proto/message.pb-c.h /^ char *filename;$/;" m struct:_Nebula__SmsRequest__FileInfo +fini ./sdk/util_rbtree.c /^ int fini; \/* check failed ? *\/$/;" m struct:rbtree_check_s file: +flag ./sdk/proto/message.pb-c.h /^ Nebula__Message__Flag flag;$/;" m struct:_Nebula__Message +flag ./sdk/proto/nebula_proto.h /^ uint8_t flag;$/;" m struct:_NebulaHeader +flyme_uid ./sdk/proto/message.pb-c.h /^ char *flyme_uid;$/;" m struct:_Nebula__AccountUpdateRequest +flyme_uid ./sdk/proto/message.pb-c.h /^ char *flyme_uid;$/;" m struct:_Nebula__AccountUpdateResponse +g_archive ./sdk/archive.c /^Archive g_archive = {0, NULL, &g_seq_dict};$/;" v +g_conn ./sdk/connect.c /^static Conn* g_conn = NULL;$/;" v file: +g_device_tag ./sdk/nebula_sdk.c /^char* g_device_tag = NULL;$/;" v +g_epollfd ./sdk/net.c /^int g_epollfd = -1;$/;" v +g_last_redirect ./sdk/redirect.c /^time_t g_last_redirect = 0;$/;" v +g_nebula_cb ./sdk/nebula_sdk.c /^NebulaMsgCallback g_nebula_cb[eNebulaMsg_Max] = {};$/;" v +g_nebula_host ./sdk/nebula_sdk.c /^char* g_nebula_host = NULL;$/;" v +g_ping_entry ./sdk/connect.c /^timer_entry g_ping_entry;$/;" v +g_redirect_result ./sdk/redirect.c /^List *g_redirect_result = NULL;$/;" v +g_rule ./sdk/redirect.c /^char* g_rule = NULL;$/;" v +g_salt ./sdk/redirect.c /^char* g_salt = NULL;$/;" v +g_save_entry ./sdk/archive.c /^struct timer_entry g_save_entry;$/;" v typeref:struct:timer_entry +g_seq_dict ./sdk/push.c /^dict *g_seq_dict = NULL;$/;" v +g_server_list ./sdk/nebula_sdk.c /^List *g_server_list;$/;" v +g_started ./sdk/nebula_sdk.c /^int g_started = 0;$/;" v +g_status ./sdk/config.c /^eStatus g_status = eStatus_Init;$/;" v +g_storage_file ./sdk/nebula_sdk.c /^char* g_storage_file = NULL;$/;" v +g_sub_app_count ./sdk/nebula_sdk.c /^int g_sub_app_count = 0;$/;" v +g_sub_apps ./sdk/nebula_sdk.c /^char** g_sub_apps = NULL;$/;" v +g_sub_status ./sdk/subscribe.c /^static eSubStatus g_sub_status = eSubStatus_Init;$/;" v file: +g_sub_tick ./sdk/subscribe.c /^static time_t g_sub_tick = 0;$/;" v file: +g_timer ./sdk/nebula_sdk.c /^timer_heap_t *g_timer;$/;" v +g_token ./sdk/auth.c /^char* g_token = "";$/;" v +has_algorithm ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_algorithm;$/;" m struct:_Nebula__AuthRequest +has_body ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_body;$/;" m struct:_Nebula__DialogRequest +has_body ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_body;$/;" m struct:_Nebula__DialogResponse +has_body ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_body;$/;" m struct:_Nebula__Message__Content +has_body ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_body;$/;" m struct:_Nebula__SmsRequest +has_body ./sdk/proto/nebula.pb-c.h /^ protobuf_c_boolean has_body;$/;" m struct:_Nebula__NebulaMsg +has_capability ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_capability;$/;" m struct:_Nebula__AccountStatusResponse__AccountStatus +has_capability ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_capability;$/;" m struct:_Nebula__AccountUpdateRequest +has_capability ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_capability;$/;" m struct:_Nebula__AccountUpdateResponse +has_capability ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_capability;$/;" m struct:_Nebula__PresenceNotify__Content +has_flag ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_flag;$/;" m struct:_Nebula__Message +has_report_flag ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_report_flag;$/;" m struct:_Nebula__SmsRequest +has_report_type ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_report_type;$/;" m struct:_Nebula__SmsRequest +has_sequence ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_sequence;$/;" m struct:_Nebula__PresenceRequest +has_sequence ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_sequence;$/;" m struct:_Nebula__PresenceResponse +has_size ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_size;$/;" m struct:_Nebula__SmsRequest +has_status ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_status;$/;" m struct:_Nebula__AccountStatusResponse__AccountStatus +has_status ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_status;$/;" m struct:_Nebula__AuthResponse +has_status ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_status;$/;" m struct:_Nebula__PresenceNotify__Content +has_status ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_status;$/;" m struct:_Nebula__SubscribeResponse__Content +has_type ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_type;$/;" m struct:_Nebula__PresenceRequest +has_type ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean has_type;$/;" m struct:_Nebula__PresenceResponse +hashFunction ./sdk/dict.h /^ unsigned int (*hashFunction)(const void *key);$/;" m struct:dictType +head ./sdk/list.h /^ Node *head;$/;" m struct:List +host ./sdk/net.h /^ char* host;$/;" m struct:_Conn +host ./sdk/proto/message.pb-c.h /^ char *host;$/;" m struct:_Nebula__Address +ht ./sdk/dict.h /^ dictht ht[2];$/;" m struct:dict +id ./sdk/timer.h /^ int32_t id;$/;" m struct:timer_entry +imsi ./sdk/proto/message.pb-c.h /^ char *imsi;$/;" m struct:_Nebula__AccountUpdateResponse +in_rbtree ./sdk/timer.h /^ uint8_t in_rbtree; \/*是否在红黑树中*\/$/;" m struct:timer_entry +index ./sdk/dict.h /^ int table, index, safe;$/;" m struct:dictIterator +index ./sdk/proto/message.pb-c.h /^ uint32_t index;$/;" m struct:_Nebula__MessageKievAck +iterators ./sdk/dict.h /^ int iterators; \/* number of iterators currently running *\/$/;" m struct:dict +jump_status ./sdk/config.h 58;" d +key ./sdk/dict.h /^ void *key;$/;" m struct:dictEntry +key ./sdk/util_rbtree.h /^ long key;$/;" m struct:util_rbtree_node_s +keyCompare ./sdk/dict.h /^ int (*keyCompare)(void *privdata, const void *key1, const void *key2);$/;" m struct:dictType +keyDestructor ./sdk/dict.h /^ void (*keyDestructor)(void *privdata, void *key);$/;" m struct:dictType +keyDup ./sdk/dict.h /^ void *(*keyDup)(void *privdata, const void *key);$/;" m struct:dictType +left ./sdk/util_rbtree.h /^ util_rbtree_node_t *left;$/;" m struct:util_rbtree_node_s +len ./sdk/net.c /^ int len;$/;" m struct:_NebulaBuf file: +len ./sdk/proto/nebula_proto.h /^ uint16_t len;$/;" m struct:_NebulaHeader +len ./sdk/str.h /^ size_t len; \/*buf字符长度*\/$/;" m struct:str +level ./sdk/logger.c /^ int level;$/;" m struct:logger_t file: +limit_size ./sdk/timer.c /^ int32_t limit_size; \/\/一次超时的元素个数$/;" m struct:timer_heap_t file: +log_debug ./sdk/logger.h 70;" d +log_deinit ./sdk/logger.c /^void log_deinit(logger_t *log)$/;" f +log_error ./sdk/logger.h 39;" d +log_info ./sdk/logger.h 62;" d +log_init ./sdk/logger.c /^void log_init(logger_t *log, const char* name, int level)$/;" f +log_level_down ./sdk/logger.c /^void log_level_down(logger_t *log)$/;" f +log_level_set ./sdk/logger.c /^void log_level_set(logger_t *log, int level)$/;" f +log_level_up ./sdk/logger.c /^void log_level_up(logger_t *log)$/;" f +log_loggable ./sdk/logger.c /^int log_loggable(logger_t *log, int level)$/;" f +log_notice ./sdk/logger.h 54;" d +log_reopen ./sdk/logger.c /^void log_reopen(logger_t *log)$/;" f +log_verb ./sdk/logger.h 78;" d +log_warn ./sdk/logger.h 46;" d +log_write ./sdk/logger.c /^void log_write(logger_t *log, int level, const char *file, int line, const char* func, const char *fmt, ...)$/;" f +logger ./sdk/logger.c /^logger_t logger = {STDERR_FILENO, LOG_LEVEL_VERB, NULL};$/;" v +logger_t ./sdk/logger.c /^typedef struct logger_t {$/;" s file: +logger_t ./sdk/logger.c /^}logger_t;$/;" t typeref:struct:logger_t file: +logger_t ./sdk/logger.h /^typedef struct logger_t logger_t;$/;" t typeref:struct:logger_t +magic ./sdk/proto/nebula_proto.h /^ uint8_t magic;$/;" m struct:_NebulaHeader +main ./main.c /^int main(int argc, const char *argv[])$/;" f +main ./sdk/test/test.c /^int main()$/;" f +maxd ./sdk/util_rbtree.c /^ short maxd; \/* max depth of the tree *\/$/;" m struct:rbtree_check_s file: +mimetype ./sdk/proto/message.pb-c.h /^ char *mimetype;$/;" m struct:_Nebula__SmsRequest__FileInfo +msg_cb ./main.c /^void msg_cb(const char* data, int len)$/;" f +msgid ./sdk/proto/message.pb-c.h /^ char *msgid;$/;" m struct:_Nebula__SmsRequest +msgid ./sdk/proto/message.pb-c.h /^ char *msgid;$/;" m struct:_Nebula__SmsResponse +msgid ./sdk/proto/nebula.pb-c.h /^ char *msgid;$/;" m struct:_Nebula__NebulaMsg +mtx ./sdk/net.h /^ pthread_mutex_t mtx;$/;" m struct:_Conn +n_account ./sdk/proto/message.pb-c.h /^ size_t n_account;$/;" m struct:_Nebula__AccountStatusRequest +n_account ./sdk/proto/message.pb-c.h /^ size_t n_account;$/;" m struct:_Nebula__PresenceRequest +n_account ./sdk/proto/message.pb-c.h /^ size_t n_account;$/;" m struct:_Nebula__PresenceResponse +n_app ./sdk/proto/message.pb-c.h /^ size_t n_app;$/;" m struct:_Nebula__SubscribeRequest +n_content ./sdk/proto/message.pb-c.h /^ size_t n_content;$/;" m struct:_Nebula__Message +n_content ./sdk/proto/message.pb-c.h /^ size_t n_content;$/;" m struct:_Nebula__MessageSeq +n_content ./sdk/proto/message.pb-c.h /^ size_t n_content;$/;" m struct:_Nebula__PresenceNotify +n_content ./sdk/proto/message.pb-c.h /^ size_t n_content;$/;" m struct:_Nebula__SubscribeResponse +n_dst ./sdk/proto/message.pb-c.h /^ size_t n_dst;$/;" m struct:_Nebula__SmsRequest +n_fileinfos ./sdk/proto/message.pb-c.h /^ size_t n_fileinfos;$/;" m struct:_Nebula__SmsRequest +n_other_info ./sdk/proto/message.pb-c.h /^ size_t n_other_info;$/;" m struct:_Nebula__AuthRequest +n_result ./sdk/proto/message.pb-c.h /^ size_t n_result;$/;" m struct:_Nebula__AccountStatusResponse +n_sub_apps ./sdk/archive.h /^ int n_sub_apps;$/;" m struct:_Archive +name ./sdk/logger.c /^ char* name;$/;" m struct:logger_t file: +name ./sdk/proto/message.pb-c.h /^ char *name;$/;" m struct:_Nebula__Param +nebula__account_status_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__account_status_request__descriptor =$/;" v +nebula__account_status_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__account_status_request__field_descriptors[1] =$/;" v file: +nebula__account_status_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__account_status_request__field_indices_by_name[] = {$/;" v file: +nebula__account_status_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__account_status_request__free_unpacked$/;" f +nebula__account_status_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__account_status_request__get_packed_size$/;" f +nebula__account_status_request__init ./sdk/proto/message.pb-c.c /^void nebula__account_status_request__init$/;" f +nebula__account_status_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__account_status_request__number_ranges[1 + 1] =$/;" v file: +nebula__account_status_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__account_status_request__pack$/;" f +nebula__account_status_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__account_status_request__pack_to_buffer$/;" f +nebula__account_status_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__account_status_request__unpack$/;" f +nebula__account_status_response__account_status__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__account_status_response__account_status__descriptor =$/;" v +nebula__account_status_response__account_status__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__account_status_response__account_status__field_descriptors[3] =$/;" v file: +nebula__account_status_response__account_status__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__account_status_response__account_status__field_indices_by_name[] = {$/;" v file: +nebula__account_status_response__account_status__init ./sdk/proto/message.pb-c.c /^void nebula__account_status_response__account_status__init$/;" f +nebula__account_status_response__account_status__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__account_status_response__account_status__number_ranges[1 + 1] =$/;" v file: +nebula__account_status_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__account_status_response__descriptor =$/;" v +nebula__account_status_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__account_status_response__field_descriptors[2] =$/;" v file: +nebula__account_status_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__account_status_response__field_indices_by_name[] = {$/;" v file: +nebula__account_status_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__account_status_response__free_unpacked$/;" f +nebula__account_status_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__account_status_response__get_packed_size$/;" f +nebula__account_status_response__init ./sdk/proto/message.pb-c.c /^void nebula__account_status_response__init$/;" f +nebula__account_status_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__account_status_response__number_ranges[1 + 1] =$/;" v file: +nebula__account_status_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__account_status_response__pack$/;" f +nebula__account_status_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__account_status_response__pack_to_buffer$/;" f +nebula__account_status_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__account_status_response__unpack$/;" f +nebula__account_update_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__account_update_request__descriptor =$/;" v +nebula__account_update_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__account_update_request__field_descriptors[3] =$/;" v file: +nebula__account_update_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__account_update_request__field_indices_by_name[] = {$/;" v file: +nebula__account_update_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__account_update_request__free_unpacked$/;" f +nebula__account_update_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__account_update_request__get_packed_size$/;" f +nebula__account_update_request__init ./sdk/proto/message.pb-c.c /^void nebula__account_update_request__init$/;" f +nebula__account_update_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__account_update_request__number_ranges[1 + 1] =$/;" v file: +nebula__account_update_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__account_update_request__pack$/;" f +nebula__account_update_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__account_update_request__pack_to_buffer$/;" f +nebula__account_update_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__account_update_request__unpack$/;" f +nebula__account_update_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__account_update_response__descriptor =$/;" v +nebula__account_update_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__account_update_response__field_descriptors[5] =$/;" v file: +nebula__account_update_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__account_update_response__field_indices_by_name[] = {$/;" v file: +nebula__account_update_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__account_update_response__free_unpacked$/;" f +nebula__account_update_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__account_update_response__get_packed_size$/;" f +nebula__account_update_response__init ./sdk/proto/message.pb-c.c /^void nebula__account_update_response__init$/;" f +nebula__account_update_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__account_update_response__number_ranges[1 + 1] =$/;" v file: +nebula__account_update_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__account_update_response__pack$/;" f +nebula__account_update_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__account_update_response__pack_to_buffer$/;" f +nebula__account_update_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__account_update_response__unpack$/;" f +nebula__address__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__address__descriptor =$/;" v +nebula__address__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__address__field_descriptors[2] =$/;" v file: +nebula__address__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__address__field_indices_by_name[] = {$/;" v file: +nebula__address__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__address__free_unpacked$/;" f +nebula__address__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__address__get_packed_size$/;" f +nebula__address__init ./sdk/proto/message.pb-c.c /^void nebula__address__init$/;" f +nebula__address__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__address__number_ranges[1 + 1] =$/;" v file: +nebula__address__pack ./sdk/proto/message.pb-c.c /^size_t nebula__address__pack$/;" f +nebula__address__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__address__pack_to_buffer$/;" f +nebula__address__unpack ./sdk/proto/message.pb-c.c /^ nebula__address__unpack$/;" f +nebula__auth_request__algorithm__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCEnumDescriptor nebula__auth_request__algorithm__descriptor =$/;" v +nebula__auth_request__algorithm__enum_values_by_name ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValueIndex nebula__auth_request__algorithm__enum_values_by_name[3] =$/;" v +nebula__auth_request__algorithm__enum_values_by_number ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValue nebula__auth_request__algorithm__enum_values_by_number[3] =$/;" v +nebula__auth_request__algorithm__value_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__auth_request__algorithm__value_ranges[] = {$/;" v file: +nebula__auth_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__auth_request__descriptor =$/;" v +nebula__auth_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__auth_request__field_descriptors[7] =$/;" v file: +nebula__auth_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__auth_request__field_indices_by_name[] = {$/;" v file: +nebula__auth_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__auth_request__free_unpacked$/;" f +nebula__auth_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__auth_request__get_packed_size$/;" f +nebula__auth_request__init ./sdk/proto/message.pb-c.c /^void nebula__auth_request__init$/;" f +nebula__auth_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__auth_request__number_ranges[1 + 1] =$/;" v file: +nebula__auth_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__auth_request__pack$/;" f +nebula__auth_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__auth_request__pack_to_buffer$/;" f +nebula__auth_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__auth_request__unpack$/;" f +nebula__auth_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__auth_response__descriptor =$/;" v +nebula__auth_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__auth_response__field_descriptors[3] =$/;" v file: +nebula__auth_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__auth_response__field_indices_by_name[] = {$/;" v file: +nebula__auth_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__auth_response__free_unpacked$/;" f +nebula__auth_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__auth_response__get_packed_size$/;" f +nebula__auth_response__init ./sdk/proto/message.pb-c.c /^void nebula__auth_response__init$/;" f +nebula__auth_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__auth_response__number_ranges[1 + 1] =$/;" v file: +nebula__auth_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__auth_response__pack$/;" f +nebula__auth_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__auth_response__pack_to_buffer$/;" f +nebula__auth_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__auth_response__unpack$/;" f +nebula__dialog_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__dialog_request__descriptor =$/;" v +nebula__dialog_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__dialog_request__field_descriptors[4] =$/;" v file: +nebula__dialog_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__dialog_request__field_indices_by_name[] = {$/;" v file: +nebula__dialog_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__dialog_request__free_unpacked$/;" f +nebula__dialog_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__dialog_request__get_packed_size$/;" f +nebula__dialog_request__init ./sdk/proto/message.pb-c.c /^void nebula__dialog_request__init$/;" f +nebula__dialog_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__dialog_request__number_ranges[1 + 1] =$/;" v file: +nebula__dialog_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__dialog_request__pack$/;" f +nebula__dialog_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__dialog_request__pack_to_buffer$/;" f +nebula__dialog_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__dialog_request__unpack$/;" f +nebula__dialog_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__dialog_response__descriptor =$/;" v +nebula__dialog_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__dialog_response__field_descriptors[5] =$/;" v file: +nebula__dialog_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__dialog_response__field_indices_by_name[] = {$/;" v file: +nebula__dialog_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__dialog_response__free_unpacked$/;" f +nebula__dialog_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__dialog_response__get_packed_size$/;" f +nebula__dialog_response__init ./sdk/proto/message.pb-c.c /^void nebula__dialog_response__init$/;" f +nebula__dialog_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__dialog_response__number_ranges[1 + 1] =$/;" v file: +nebula__dialog_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__dialog_response__pack$/;" f +nebula__dialog_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__dialog_response__pack_to_buffer$/;" f +nebula__dialog_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__dialog_response__unpack$/;" f +nebula__message__content__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__message__content__descriptor =$/;" v +nebula__message__content__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__message__content__field_descriptors[4] =$/;" v file: +nebula__message__content__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__message__content__field_indices_by_name[] = {$/;" v file: +nebula__message__content__init ./sdk/proto/message.pb-c.c /^void nebula__message__content__init$/;" f +nebula__message__content__msg_type__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCEnumDescriptor nebula__message__content__msg_type__descriptor =$/;" v +nebula__message__content__msg_type__enum_values_by_name ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValueIndex nebula__message__content__msg_type__enum_values_by_name[3] =$/;" v +nebula__message__content__msg_type__enum_values_by_number ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValue nebula__message__content__msg_type__enum_values_by_number[3] =$/;" v +nebula__message__content__msg_type__value_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message__content__msg_type__value_ranges[] = {$/;" v file: +nebula__message__content__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message__content__number_ranges[1 + 1] =$/;" v file: +nebula__message__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__message__descriptor =$/;" v +nebula__message__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__message__field_descriptors[2] =$/;" v file: +nebula__message__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__message__field_indices_by_name[] = {$/;" v file: +nebula__message__flag__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCEnumDescriptor nebula__message__flag__descriptor =$/;" v +nebula__message__flag__enum_values_by_name ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValueIndex nebula__message__flag__enum_values_by_name[2] =$/;" v +nebula__message__flag__enum_values_by_number ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValue nebula__message__flag__enum_values_by_number[2] =$/;" v +nebula__message__flag__value_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message__flag__value_ranges[] = {$/;" v file: +nebula__message__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__message__free_unpacked$/;" f +nebula__message__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__message__get_packed_size$/;" f +nebula__message__init ./sdk/proto/message.pb-c.c /^void nebula__message__init$/;" f +nebula__message__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message__number_ranges[1 + 1] =$/;" v file: +nebula__message__pack ./sdk/proto/message.pb-c.c /^size_t nebula__message__pack$/;" f +nebula__message__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__message__pack_to_buffer$/;" f +nebula__message__unpack ./sdk/proto/message.pb-c.c /^ nebula__message__unpack$/;" f +nebula__message_kiev_ack__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__message_kiev_ack__descriptor =$/;" v +nebula__message_kiev_ack__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__message_kiev_ack__field_descriptors[2] =$/;" v file: +nebula__message_kiev_ack__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__message_kiev_ack__field_indices_by_name[] = {$/;" v file: +nebula__message_kiev_ack__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__message_kiev_ack__free_unpacked$/;" f +nebula__message_kiev_ack__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__message_kiev_ack__get_packed_size$/;" f +nebula__message_kiev_ack__init ./sdk/proto/message.pb-c.c /^void nebula__message_kiev_ack__init$/;" f +nebula__message_kiev_ack__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message_kiev_ack__number_ranges[1 + 1] =$/;" v file: +nebula__message_kiev_ack__pack ./sdk/proto/message.pb-c.c /^size_t nebula__message_kiev_ack__pack$/;" f +nebula__message_kiev_ack__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__message_kiev_ack__pack_to_buffer$/;" f +nebula__message_kiev_ack__unpack ./sdk/proto/message.pb-c.c /^ nebula__message_kiev_ack__unpack$/;" f +nebula__message_seq__content__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__message_seq__content__descriptor =$/;" v +nebula__message_seq__content__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__message_seq__content__field_descriptors[2] =$/;" v file: +nebula__message_seq__content__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__message_seq__content__field_indices_by_name[] = {$/;" v file: +nebula__message_seq__content__init ./sdk/proto/message.pb-c.c /^void nebula__message_seq__content__init$/;" f +nebula__message_seq__content__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message_seq__content__number_ranges[1 + 1] =$/;" v file: +nebula__message_seq__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__message_seq__descriptor =$/;" v +nebula__message_seq__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__message_seq__field_descriptors[1] =$/;" v file: +nebula__message_seq__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__message_seq__field_indices_by_name[] = {$/;" v file: +nebula__message_seq__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__message_seq__free_unpacked$/;" f +nebula__message_seq__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__message_seq__get_packed_size$/;" f +nebula__message_seq__init ./sdk/proto/message.pb-c.c /^void nebula__message_seq__init$/;" f +nebula__message_seq__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__message_seq__number_ranges[1 + 1] =$/;" v file: +nebula__message_seq__pack ./sdk/proto/message.pb-c.c /^size_t nebula__message_seq__pack$/;" f +nebula__message_seq__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__message_seq__pack_to_buffer$/;" f +nebula__message_seq__unpack ./sdk/proto/message.pb-c.c /^ nebula__message_seq__unpack$/;" f +nebula__nebula_msg__descriptor ./sdk/proto/nebula.pb-c.c /^const ProtobufCMessageDescriptor nebula__nebula_msg__descriptor =$/;" v +nebula__nebula_msg__field_descriptors ./sdk/proto/nebula.pb-c.c /^static const ProtobufCFieldDescriptor nebula__nebula_msg__field_descriptors[2] =$/;" v file: +nebula__nebula_msg__field_indices_by_name ./sdk/proto/nebula.pb-c.c /^static const unsigned nebula__nebula_msg__field_indices_by_name[] = {$/;" v file: +nebula__nebula_msg__free_unpacked ./sdk/proto/nebula.pb-c.c /^void nebula__nebula_msg__free_unpacked$/;" f +nebula__nebula_msg__get_packed_size ./sdk/proto/nebula.pb-c.c /^size_t nebula__nebula_msg__get_packed_size$/;" f +nebula__nebula_msg__init ./sdk/proto/nebula.pb-c.c /^void nebula__nebula_msg__init$/;" f +nebula__nebula_msg__number_ranges ./sdk/proto/nebula.pb-c.c /^static const ProtobufCIntRange nebula__nebula_msg__number_ranges[1 + 1] =$/;" v file: +nebula__nebula_msg__pack ./sdk/proto/nebula.pb-c.c /^size_t nebula__nebula_msg__pack$/;" f +nebula__nebula_msg__pack_to_buffer ./sdk/proto/nebula.pb-c.c /^size_t nebula__nebula_msg__pack_to_buffer$/;" f +nebula__nebula_msg__unpack ./sdk/proto/nebula.pb-c.c /^ nebula__nebula_msg__unpack$/;" f +nebula__notify_body__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__notify_body__descriptor =$/;" v +nebula__notify_body__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__notify_body__field_descriptors[2] =$/;" v file: +nebula__notify_body__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__notify_body__field_indices_by_name[] = {$/;" v file: +nebula__notify_body__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__notify_body__free_unpacked$/;" f +nebula__notify_body__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__notify_body__get_packed_size$/;" f +nebula__notify_body__init ./sdk/proto/message.pb-c.c /^void nebula__notify_body__init$/;" f +nebula__notify_body__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__notify_body__number_ranges[1 + 1] =$/;" v file: +nebula__notify_body__pack ./sdk/proto/message.pb-c.c /^size_t nebula__notify_body__pack$/;" f +nebula__notify_body__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__notify_body__pack_to_buffer$/;" f +nebula__notify_body__unpack ./sdk/proto/message.pb-c.c /^ nebula__notify_body__unpack$/;" f +nebula__param__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__param__descriptor =$/;" v +nebula__param__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__param__field_descriptors[2] =$/;" v file: +nebula__param__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__param__field_indices_by_name[] = {$/;" v file: +nebula__param__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__param__free_unpacked$/;" f +nebula__param__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__param__get_packed_size$/;" f +nebula__param__init ./sdk/proto/message.pb-c.c /^void nebula__param__init$/;" f +nebula__param__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__param__number_ranges[1 + 1] =$/;" v file: +nebula__param__pack ./sdk/proto/message.pb-c.c /^size_t nebula__param__pack$/;" f +nebula__param__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__param__pack_to_buffer$/;" f +nebula__param__unpack ./sdk/proto/message.pb-c.c /^ nebula__param__unpack$/;" f +nebula__presence_notify__content__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__presence_notify__content__descriptor =$/;" v +nebula__presence_notify__content__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__presence_notify__content__field_descriptors[3] =$/;" v file: +nebula__presence_notify__content__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__presence_notify__content__field_indices_by_name[] = {$/;" v file: +nebula__presence_notify__content__init ./sdk/proto/message.pb-c.c /^void nebula__presence_notify__content__init$/;" f +nebula__presence_notify__content__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__presence_notify__content__number_ranges[1 + 1] =$/;" v file: +nebula__presence_notify__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__presence_notify__descriptor =$/;" v +nebula__presence_notify__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__presence_notify__field_descriptors[1] =$/;" v file: +nebula__presence_notify__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__presence_notify__field_indices_by_name[] = {$/;" v file: +nebula__presence_notify__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__presence_notify__free_unpacked$/;" f +nebula__presence_notify__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__presence_notify__get_packed_size$/;" f +nebula__presence_notify__init ./sdk/proto/message.pb-c.c /^void nebula__presence_notify__init$/;" f +nebula__presence_notify__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__presence_notify__number_ranges[1 + 1] =$/;" v file: +nebula__presence_notify__pack ./sdk/proto/message.pb-c.c /^size_t nebula__presence_notify__pack$/;" f +nebula__presence_notify__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__presence_notify__pack_to_buffer$/;" f +nebula__presence_notify__unpack ./sdk/proto/message.pb-c.c /^ nebula__presence_notify__unpack$/;" f +nebula__presence_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__presence_request__descriptor =$/;" v +nebula__presence_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__presence_request__field_descriptors[3] =$/;" v file: +nebula__presence_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__presence_request__field_indices_by_name[] = {$/;" v file: +nebula__presence_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__presence_request__free_unpacked$/;" f +nebula__presence_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__presence_request__get_packed_size$/;" f +nebula__presence_request__init ./sdk/proto/message.pb-c.c /^void nebula__presence_request__init$/;" f +nebula__presence_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__presence_request__number_ranges[1 + 1] =$/;" v file: +nebula__presence_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__presence_request__pack$/;" f +nebula__presence_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__presence_request__pack_to_buffer$/;" f +nebula__presence_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__presence_request__unpack$/;" f +nebula__presence_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__presence_response__descriptor =$/;" v +nebula__presence_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__presence_response__field_descriptors[4] =$/;" v file: +nebula__presence_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__presence_response__field_indices_by_name[] = {$/;" v file: +nebula__presence_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__presence_response__free_unpacked$/;" f +nebula__presence_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__presence_response__get_packed_size$/;" f +nebula__presence_response__init ./sdk/proto/message.pb-c.c /^void nebula__presence_response__init$/;" f +nebula__presence_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__presence_response__number_ranges[1 + 1] =$/;" v file: +nebula__presence_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__presence_response__pack$/;" f +nebula__presence_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__presence_response__pack_to_buffer$/;" f +nebula__presence_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__presence_response__unpack$/;" f +nebula__presence_type__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCEnumDescriptor nebula__presence_type__descriptor =$/;" v +nebula__presence_type__enum_values_by_name ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValueIndex nebula__presence_type__enum_values_by_name[3] =$/;" v +nebula__presence_type__enum_values_by_number ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValue nebula__presence_type__enum_values_by_number[3] =$/;" v +nebula__presence_type__value_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__presence_type__value_ranges[] = {$/;" v file: +nebula__sms_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__sms_request__descriptor =$/;" v +nebula__sms_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__sms_request__field_descriptors[14] =$/;" v file: +nebula__sms_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__sms_request__field_indices_by_name[] = {$/;" v file: +nebula__sms_request__file_info__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__sms_request__file_info__descriptor =$/;" v +nebula__sms_request__file_info__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__sms_request__file_info__field_descriptors[4] =$/;" v file: +nebula__sms_request__file_info__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__sms_request__file_info__field_indices_by_name[] = {$/;" v file: +nebula__sms_request__file_info__init ./sdk/proto/message.pb-c.c /^void nebula__sms_request__file_info__init$/;" f +nebula__sms_request__file_info__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__sms_request__file_info__number_ranges[1 + 1] =$/;" v file: +nebula__sms_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__sms_request__free_unpacked$/;" f +nebula__sms_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__sms_request__get_packed_size$/;" f +nebula__sms_request__init ./sdk/proto/message.pb-c.c /^void nebula__sms_request__init$/;" f +nebula__sms_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__sms_request__number_ranges[1 + 1] =$/;" v file: +nebula__sms_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__sms_request__pack$/;" f +nebula__sms_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__sms_request__pack_to_buffer$/;" f +nebula__sms_request__report_type__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCEnumDescriptor nebula__sms_request__report_type__descriptor =$/;" v +nebula__sms_request__report_type__enum_values_by_name ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValueIndex nebula__sms_request__report_type__enum_values_by_name[2] =$/;" v +nebula__sms_request__report_type__enum_values_by_number ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValue nebula__sms_request__report_type__enum_values_by_number[2] =$/;" v +nebula__sms_request__report_type__value_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__sms_request__report_type__value_ranges[] = {$/;" v file: +nebula__sms_request__sms_type__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCEnumDescriptor nebula__sms_request__sms_type__descriptor =$/;" v +nebula__sms_request__sms_type__enum_values_by_name ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValueIndex nebula__sms_request__sms_type__enum_values_by_name[3] =$/;" v +nebula__sms_request__sms_type__enum_values_by_number ./sdk/proto/message.pb-c.c /^const ProtobufCEnumValue nebula__sms_request__sms_type__enum_values_by_number[3] =$/;" v +nebula__sms_request__sms_type__value_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__sms_request__sms_type__value_ranges[] = {$/;" v file: +nebula__sms_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__sms_request__unpack$/;" f +nebula__sms_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__sms_response__descriptor =$/;" v +nebula__sms_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__sms_response__field_descriptors[2] =$/;" v file: +nebula__sms_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__sms_response__field_indices_by_name[] = {$/;" v file: +nebula__sms_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__sms_response__free_unpacked$/;" f +nebula__sms_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__sms_response__get_packed_size$/;" f +nebula__sms_response__init ./sdk/proto/message.pb-c.c /^void nebula__sms_response__init$/;" f +nebula__sms_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__sms_response__number_ranges[1 + 1] =$/;" v file: +nebula__sms_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__sms_response__pack$/;" f +nebula__sms_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__sms_response__pack_to_buffer$/;" f +nebula__sms_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__sms_response__unpack$/;" f +nebula__subscribe_request__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__subscribe_request__descriptor =$/;" v +nebula__subscribe_request__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__subscribe_request__field_descriptors[1] =$/;" v file: +nebula__subscribe_request__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__subscribe_request__field_indices_by_name[] = {$/;" v file: +nebula__subscribe_request__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__subscribe_request__free_unpacked$/;" f +nebula__subscribe_request__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__subscribe_request__get_packed_size$/;" f +nebula__subscribe_request__init ./sdk/proto/message.pb-c.c /^void nebula__subscribe_request__init$/;" f +nebula__subscribe_request__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__subscribe_request__number_ranges[1 + 1] =$/;" v file: +nebula__subscribe_request__pack ./sdk/proto/message.pb-c.c /^size_t nebula__subscribe_request__pack$/;" f +nebula__subscribe_request__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__subscribe_request__pack_to_buffer$/;" f +nebula__subscribe_request__unpack ./sdk/proto/message.pb-c.c /^ nebula__subscribe_request__unpack$/;" f +nebula__subscribe_response__content__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__subscribe_response__content__descriptor =$/;" v +nebula__subscribe_response__content__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__subscribe_response__content__field_descriptors[3] =$/;" v file: +nebula__subscribe_response__content__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__subscribe_response__content__field_indices_by_name[] = {$/;" v file: +nebula__subscribe_response__content__init ./sdk/proto/message.pb-c.c /^void nebula__subscribe_response__content__init$/;" f +nebula__subscribe_response__content__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__subscribe_response__content__number_ranges[1 + 1] =$/;" v file: +nebula__subscribe_response__descriptor ./sdk/proto/message.pb-c.c /^const ProtobufCMessageDescriptor nebula__subscribe_response__descriptor =$/;" v +nebula__subscribe_response__field_descriptors ./sdk/proto/message.pb-c.c /^static const ProtobufCFieldDescriptor nebula__subscribe_response__field_descriptors[2] =$/;" v file: +nebula__subscribe_response__field_indices_by_name ./sdk/proto/message.pb-c.c /^static const unsigned nebula__subscribe_response__field_indices_by_name[] = {$/;" v file: +nebula__subscribe_response__free_unpacked ./sdk/proto/message.pb-c.c /^void nebula__subscribe_response__free_unpacked$/;" f +nebula__subscribe_response__get_packed_size ./sdk/proto/message.pb-c.c /^size_t nebula__subscribe_response__get_packed_size$/;" f +nebula__subscribe_response__init ./sdk/proto/message.pb-c.c /^void nebula__subscribe_response__init$/;" f +nebula__subscribe_response__number_ranges ./sdk/proto/message.pb-c.c /^static const ProtobufCIntRange nebula__subscribe_response__number_ranges[1 + 1] =$/;" v file: +nebula__subscribe_response__pack ./sdk/proto/message.pb-c.c /^size_t nebula__subscribe_response__pack$/;" f +nebula__subscribe_response__pack_to_buffer ./sdk/proto/message.pb-c.c /^size_t nebula__subscribe_response__pack_to_buffer$/;" f +nebula__subscribe_response__unpack ./sdk/proto/message.pb-c.c /^ nebula__subscribe_response__unpack$/;" f +next ./sdk/dict.h /^ struct dictEntry *next;$/;" m struct:dictEntry typeref:struct:dictEntry::dictEntry +next ./sdk/list.h /^ struct Node *next;$/;" m struct:Node typeref:struct:Node::Node +nextEntry ./sdk/dict.h /^ dictEntry *entry, *nextEntry;$/;" m struct:dictIterator +next_status ./sdk/config.h 45;" d +nonce ./sdk/proto/message.pb-c.h /^ char *nonce;$/;" m struct:_Nebula__AuthRequest +nonce ./sdk/proto/message.pb-c.h /^ char *nonce;$/;" m struct:_Nebula__AuthResponse +null ./sdk/util_rbtree.c /^ const util_rbtree_node_t *null; \/* sentinel of the tree *\/$/;" m struct:rbtree_check_s file: +null ./sdk/util_rbtree.h /^ util_rbtree_node_t null;$/;" m struct:util_rbtree_s +on_connect ./sdk/net.h /^ void (*on_connect)(Conn*, int);$/;" m struct:_Conn +on_disconnect ./sdk/net.h /^ void (*on_disconnect)(Conn*);$/;" m struct:_Conn +on_read ./sdk/net.h /^ void (*on_read)(Conn*, NebulaHeader*);$/;" m struct:_Conn +other_info ./sdk/proto/message.pb-c.h /^ Nebula__Param **other_info;$/;" m struct:_Nebula__AuthRequest +parent ./sdk/util_rbtree.h /^ util_rbtree_node_t *parent;$/;" m struct:util_rbtree_node_s +pdu ./sdk/proto/message.pb-c.h /^ char *pdu;$/;" m struct:_Nebula__SmsRequest +phone ./sdk/proto/message.pb-c.h /^ char *phone;$/;" m struct:_Nebula__AccountUpdateRequest +phone ./sdk/proto/message.pb-c.h /^ char *phone;$/;" m struct:_Nebula__AccountUpdateResponse +port ./sdk/net.h /^ uint16_t port;$/;" m struct:_Conn +port ./sdk/proto/message.pb-c.h /^ int32_t port;$/;" m struct:_Nebula__Address +pos ./sdk/net.c /^ int pos;$/;" m struct:_NebulaBuf file: +prev ./sdk/list.h /^ struct Node *prev;$/;" m struct:Node typeref:struct:Node::Node +privdata ./sdk/dict.h /^ void *privdata;$/;" m struct:dict +ptr ./sdk/str.h /^ char* ptr;$/;" m struct:str +pushid ./sdk/proto/message.pb-c.h /^ char *pushid;$/;" m struct:_Nebula__SubscribeResponse__Content +rbh ./sdk/util_rbtree.c /^ short rbh; \/* rb height of the tree *\/$/;" m struct:rbtree_check_s file: +rbnode ./sdk/timer.h /^ util_rbtree_node_t rbnode;$/;" m struct:timer_entry +rbt_clear_node ./sdk/util_rbtree.h 37;" d +rbtree ./sdk/timer.c /^ util_rbtree_t rbtree;$/;" m struct:timer_heap_t file: +rbtree_check_s ./sdk/util_rbtree.c /^struct rbtree_check_s$/;" s file: +rbtree_check_subtree ./sdk/util_rbtree.c /^static void rbtree_check_subtree(const util_rbtree_node_t *node, rbtree_check_t *check, $/;" f file: +rbtree_check_t ./sdk/util_rbtree.c /^typedef struct rbtree_check_s rbtree_check_t;$/;" t typeref:struct:rbtree_check_s file: +rbtree_left_rotate ./sdk/util_rbtree.c /^static void rbtree_left_rotate(util_rbtree_node_t **root,$/;" f file: +rbtree_mid_travel ./sdk/util_rbtree.c /^static void rbtree_mid_travel(util_rbtree_node_t *node, util_rbtree_node_t *sentinel, $/;" f file: +rbtree_right_rotate ./sdk/util_rbtree.c /^static void rbtree_right_rotate(util_rbtree_node_t **root,$/;" f file: +read ./sdk/net.h /^ int (*read)(Conn*);$/;" m struct:_Conn +realm ./sdk/proto/message.pb-c.h /^ char *realm;$/;" m struct:_Nebula__AuthRequest +realm ./sdk/proto/message.pb-c.h /^ char *realm;$/;" m struct:_Nebula__AuthResponse +recv_buf ./sdk/net.h /^ char recv_buf[8192];$/;" m struct:_Conn +recv_pos ./sdk/net.h /^ int recv_pos;$/;" m struct:_Conn +rehashidx ./sdk/dict.h /^ int rehashidx; \/* rehashing not in progress if rehashidx == -1 *\/$/;" m struct:dict +report_flag ./sdk/proto/message.pb-c.h /^ protobuf_c_boolean report_flag;$/;" m struct:_Nebula__SmsRequest +report_status ./sdk/proto/message.pb-c.h /^ char *report_status;$/;" m struct:_Nebula__SmsRequest +report_type ./sdk/proto/message.pb-c.h /^ Nebula__SmsRequest__ReportType report_type;$/;" m struct:_Nebula__SmsRequest +result ./sdk/proto/message.pb-c.h /^ Nebula__AccountStatusResponse__AccountStatus **result;$/;" m struct:_Nebula__AccountStatusResponse +right ./sdk/util_rbtree.h /^ util_rbtree_node_t *right;$/;" m struct:util_rbtree_node_s +root ./sdk/util_rbtree.h /^ util_rbtree_node_t *root;$/;" m struct:util_rbtree_s +s64 ./sdk/dict.h /^ int64_t s64;$/;" m union:dictEntry::__anon4 +safe ./sdk/dict.h /^ int table, index, safe;$/;" m struct:dictIterator +save_timer ./sdk/archive.c /^void save_timer(timer_heap_t* ht, timer_entry* entry)$/;" f +send_list ./sdk/net.h /^ List* send_list;$/;" m struct:_Conn +seq ./sdk/proto/message.pb-c.h /^ uint32_t seq;$/;" m struct:_Nebula__MessageSeq__Content +seq ./sdk/proto/message.pb-c.h /^ uint32_t seq;$/;" m struct:_Nebula__Message__Content +seqs ./sdk/archive.h /^ dict **seqs;$/;" m struct:_Archive +seqs ./sdk/proto/message.pb-c.h /^ Nebula__MessageSeq *seqs;$/;" m struct:_Nebula__MessageKievAck +sequence ./sdk/proto/message.pb-c.h /^ uint32_t sequence;$/;" m struct:_Nebula__PresenceRequest +sequence ./sdk/proto/message.pb-c.h /^ uint32_t sequence;$/;" m struct:_Nebula__PresenceResponse +set_timer_limit ./sdk/timer.c /^void set_timer_limit(timer_heap_t *ht, int32_t limit)$/;" f +size ./sdk/dict.h /^ unsigned long size;$/;" m struct:dictht +size ./sdk/list.h /^ unsigned long size;$/;" m struct:List +size ./sdk/proto/message.pb-c.h /^ int32_t size;$/;" m struct:_Nebula__SmsRequest +size ./sdk/proto/message.pb-c.h /^ int32_t size;$/;" m struct:_Nebula__SmsRequest__FileInfo +size ./sdk/str.h /^ size_t size; \/*buf所占内存长度*\/$/;" m struct:str +size ./sdk/util_rbtree.h /^ uint32_t size;$/;" m struct:util_rbtree_s +sizemask ./sdk/dict.h /^ unsigned long sizemask;$/;" m struct:dictht +socketfd ./sdk/net.h /^ int socketfd;$/;" m struct:_Conn +src ./sdk/proto/message.pb-c.h /^ char *src;$/;" m struct:_Nebula__DialogRequest +src ./sdk/proto/message.pb-c.h /^ char *src;$/;" m struct:_Nebula__DialogResponse +src ./sdk/proto/message.pb-c.h /^ char *src;$/;" m struct:_Nebula__SmsRequest +state ./sdk/net.h /^ ConnState state;$/;" m struct:_Conn +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__AccountStatusResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__AccountStatusResponse__AccountStatus +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__AccountUpdateResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__AuthResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__DialogResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__PresenceNotify__Content +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__PresenceResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__SmsResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__SubscribeResponse +status ./sdk/proto/message.pb-c.h /^ int32_t status;$/;" m struct:_Nebula__SubscribeResponse__Content +str ./sdk/str.h /^struct str{$/;" s +string_append ./sdk/str.c /^int string_append(struct str *str, const char *buf, size_t buflen)$/;" f +string_append_fast ./sdk/str.h 37;" d +string_compare ./sdk/str.c /^int string_compare(const struct str *s1, const struct str *s2)$/;" f +string_copy ./sdk/str.c /^int string_copy(struct str *dst, const char *src, size_t srclen)$/;" f +string_deinit ./sdk/str.c /^void string_deinit(struct str *str)$/;" f +string_duplicate ./sdk/str.c /^int string_duplicate(struct str *dst, const struct str *src)$/;" f +string_empty ./sdk/str.c /^bool string_empty(const struct str *str)$/;" f +string_init ./sdk/str.c /^void string_init(struct str *str)$/;" f +string_length ./sdk/str.h 35;" d +string_reset ./sdk/str.c /^void string_reset(struct str *str)$/;" f +string_sprintf ./sdk/str.c /^int string_sprintf(struct str *str, const char* fmt, ...)$/;" f +strlevel ./sdk/logger.c /^static const char* strlevel[] = {$/;" v file: +sub_apps ./sdk/archive.h /^ char **sub_apps;$/;" m struct:_Archive +subscribe ./sdk/subscribe.c /^int subscribe()$/;" f +subscribe_loop ./sdk/subscribe.c /^int subscribe_loop()$/;" f +table ./sdk/dict.h /^ dictEntry **table;$/;" m struct:dictht +table ./sdk/dict.h /^ int table, index, safe;$/;" m struct:dictIterator +tail ./sdk/list.h /^ Node *tail;$/;" m struct:List +time ./sdk/proto/message.pb-c.h /^ char *time;$/;" m struct:_Nebula__SmsRequest +timeInMilliseconds ./sdk/dict.c /^long long timeInMilliseconds(void) {$/;" f +timeout_cb ./sdk/timer.h /^ void (*timeout_cb)(timer_heap_t* ht, struct timer_entry *entry);$/;" m struct:timer_entry +timer_add ./sdk/timer.c /^int32_t timer_add( timer_heap_t* ht, timer_entry* entry, uint32_t expires)$/;" f +timer_del ./sdk/timer.c /^void timer_del( timer_heap_t* ht, timer_entry* entry)$/;" f +timer_destroy ./sdk/timer.c /^void timer_destroy( timer_heap_t* ht)$/;" f +timer_earliest_time ./sdk/timer.c /^int32_t timer_earliest_time(timer_heap_t* ht)$/;" f +timer_entry ./sdk/timer.h /^typedef struct timer_entry$/;" s +timer_entry ./sdk/timer.h /^}timer_entry;$/;" t typeref:struct:timer_entry +timer_entry_init ./sdk/timer.c /^void timer_entry_init(timer_entry* entry, int32_t id, void* user_data, \\$/;" f +timer_heap_create ./sdk/timer.c /^timer_heap_t* timer_heap_create(int32_t limit_size) $/;" f +timer_heap_t ./sdk/timer.c /^struct timer_heap_t$/;" s file: +timer_heap_t ./sdk/timer.h /^typedef struct timer_heap_t timer_heap_t;$/;" t typeref:struct:timer_heap_t +timer_run ./sdk/timer.c /^int32_t timer_run(timer_heap_t* ht)$/;" f +timer_size ./sdk/timer.c /^int32_t timer_size(timer_heap_t* ht)$/;" f +timer_update ./sdk/timer.c /^int32_t timer_update(timer_heap_t* ht, timer_entry *entry, uint32_t expires)$/;" f +token ./sdk/proto/message.pb-c.h /^ char *token;$/;" m struct:_Nebula__AuthRequest +type ./sdk/dict.h /^ dictType *type;$/;" m struct:dict +type ./sdk/proto/message.pb-c.h /^ Nebula__Message__Content__MsgType type;$/;" m struct:_Nebula__Message__Content +type ./sdk/proto/message.pb-c.h /^ Nebula__PresenceType type;$/;" m struct:_Nebula__PresenceRequest +type ./sdk/proto/message.pb-c.h /^ Nebula__PresenceType type;$/;" m struct:_Nebula__PresenceResponse +type ./sdk/proto/message.pb-c.h /^ Nebula__SmsRequest__SmsType type;$/;" m struct:_Nebula__SmsRequest +type ./sdk/proto/nebula_proto.h /^ uint8_t type;$/;" m struct:_NebulaHeader +u64 ./sdk/dict.h /^ uint64_t u64;$/;" m union:dictEntry::__anon4 +uid ./sdk/proto/message.pb-c.h /^ char *uid;$/;" m struct:_Nebula__AuthRequest +url ./sdk/proto/message.pb-c.h /^ char *url;$/;" m struct:_Nebula__SmsRequest__FileInfo +used ./sdk/dict.h /^ unsigned long used;$/;" m struct:dictht +user_data ./sdk/timer.h /^ void *user_data; $/;" m struct:timer_entry +username ./sdk/proto/message.pb-c.h /^ char *username;$/;" m struct:_Nebula__AuthRequest +util_rbsubtree_max ./sdk/util_rbtree.c /^util_rbtree_node_t* util_rbsubtree_max(util_rbtree_node_t *node, util_rbtree_node_t *sentinel)$/;" f +util_rbsubtree_min ./sdk/util_rbtree.c /^util_rbtree_node_t* util_rbsubtree_min(util_rbtree_node_t *node, util_rbtree_node_t *sentinel)$/;" f +util_rbt_black ./sdk/util_rbtree.h 31;" d +util_rbt_isblack ./sdk/util_rbtree.h 33;" d +util_rbt_isred ./sdk/util_rbtree.h 34;" d +util_rbt_red ./sdk/util_rbtree.h 32;" d +util_rbtree_check ./sdk/util_rbtree.c /^int util_rbtree_check(const util_rbtree_t *rbtree, int *blackheight, int *maxdepth)$/;" f +util_rbtree_delete ./sdk/util_rbtree.c /^void util_rbtree_delete(util_rbtree_t *rbtree, util_rbtree_node_t *node)$/;" f +util_rbtree_init ./sdk/util_rbtree.c /^void util_rbtree_init(util_rbtree_t *rbtree)$/;" f +util_rbtree_insert ./sdk/util_rbtree.c /^void util_rbtree_insert(util_rbtree_t *rbtree, util_rbtree_node_t *node)$/;" f +util_rbtree_isempty ./sdk/util_rbtree.h 44;" d +util_rbtree_lookup ./sdk/util_rbtree.c /^util_rbtree_node_t* util_rbtree_lookup(util_rbtree_t *rbtree, long key)$/;" f +util_rbtree_max ./sdk/util_rbtree.h 56;" d +util_rbtree_mid_travel ./sdk/util_rbtree.c /^void util_rbtree_mid_travel(util_rbtree_t *rbtree, $/;" f +util_rbtree_min ./sdk/util_rbtree.h 50;" d +util_rbtree_node_s ./sdk/util_rbtree.h /^struct util_rbtree_node_s$/;" s +util_rbtree_node_t ./sdk/util_rbtree.h /^typedef struct util_rbtree_node_s util_rbtree_node_t;$/;" t typeref:struct:util_rbtree_node_s +util_rbtree_s ./sdk/util_rbtree.h /^struct util_rbtree_s$/;" s +util_rbtree_search ./sdk/util_rbtree.c /^util_rbtree_node_t* util_rbtree_search(util_rbtree_t *rbtree, long key)$/;" f +util_rbtree_t ./sdk/util_rbtree.h /^typedef struct util_rbtree_s util_rbtree_t;$/;" t typeref:struct:util_rbtree_s +v ./sdk/dict.h /^ } v;$/;" m struct:dictEntry typeref:union:dictEntry::__anon4 +val ./sdk/dict.h /^ void *val;$/;" m union:dictEntry::__anon4 +valDestructor ./sdk/dict.h /^ void (*valDestructor)(void *privdata, void *obj);$/;" m struct:dictType +valDup ./sdk/dict.h /^ void *(*valDup)(void *privdata, const void *obj);$/;" m struct:dictType +value ./sdk/proto/message.pb-c.h /^ char *value;$/;" m struct:_Nebula__Param +vasprintf ./sdk/str.c /^static int vasprintf(char **buf, const char *fmt, va_list ap)$/;" f file: +ver ./sdk/proto/message.pb-c.h /^ char *ver;$/;" m struct:_Nebula__SmsRequest +ver ./sdk/proto/nebula_proto.h /^ uint8_t ver;$/;" m struct:_NebulaHeader +write ./sdk/net.h /^ int (*write)(Conn*);$/;" m struct:_Conn diff --git a/1_8.sip_push/nebula_sdk/test71 b/1_8.sip_push/nebula_sdk/test71 new file mode 100644 index 0000000..b1c38bd Binary files /dev/null and b/1_8.sip_push/nebula_sdk/test71 differ diff --git a/vi_res_config/vimrc b/vi_res_config/vimrc new file mode 100644 index 0000000..e3c29e1 --- /dev/null +++ b/vi_res_config/vimrc @@ -0,0 +1,533 @@ +set sw=4 +set ts=4 +set et +set smarttab +set smartindent +set lbr +set fo+=mB +set sm +set selection=inclusive +set wildmenu +set mousemodel=popup + +au FileType php setlocal dict+=~/.vim/dict/php_funclist.dict +au FileType css setlocal dict+=~/.vim/dict/css.dict +au FileType c setlocal dict+=~/.vim/dict/c.dict +au FileType cpp setlocal dict+=~/.vim/dict/cpp.dict +au FileType scale setlocal dict+=~/.vim/dict/scale.dict +au FileType javascript setlocal dict+=~/.vim/dict/javascript.dict +au FileType html setlocal dict+=~/.vim/dict/javascript.dict +au FileType html setlocal dict+=~/.vim/dict/css.dict + +" +"syntastic相关 +execute pathogen#infect() +let g:syntastic_python_checkers=['pylint'] +let g:syntastic_php_checkers=['php', 'phpcs', 'phpmd'] +"golang +"Processing... % (ctrl+c to stop) +let g:fencview_autodetect=0 +set rtp+=$GOROOT/misc/vim +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" 显示相关 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +syntax on +set cul "高亮光标所在行 +set cuc +set shortmess=atI " 启动的时候不显示那个援助乌干达儿童的提示 +set go= " 不要图形按钮 +"color desert " 设置背景主题 +color molokai " 设置背景主题 +"color torte " 设置背景主题 +"set guifont=Courier_New:h10:cANSI " 设置字体 +"autocmd InsertLeave * se nocul " 用浅色高亮当前行 +autocmd InsertEnter * se cul " 用浅色高亮当前行 +set ruler " 显示标尺 +set showcmd " 输入的命令显示出来,看的清楚些 +"set whichwrap+=<,>,h,l " 允许backspace和光标键跨越行边界(不建议) +set scrolloff=3 " 光标移动到buffer的顶部和底部时保持3行距离 +set statusline=%F%m%r%h%w\ [FORMAT=%{&ff}]\ [TYPE=%Y]\ [POS=%l,%v][%p%%]\ %{strftime(\"%d/%m/%y\ -\ %H:%M\")} "状态行显示的内容 +set laststatus=2 " 启动显示状态行(1),总是显示状态行(2) +"set foldenable " 允许折叠 +""set foldmethod=manual " 手动折叠 +set nocompatible "去掉讨厌的有关vi一致性模式,避免以前版本的一些bug和局限 +" 显示中文帮助 +if version >= 603 + set helplang=cn + set encoding=utf-8 +endif +" 自动缩进 +set autoindent +set cindent +" Tab键的宽度 +set tabstop=4 +" 统一缩进为4 +set softtabstop=4 +set shiftwidth=4 +" 不要用空格代替制表符 +set expandtab +" 在行和段开始处使用制表符 +set smarttab +" 显示行号 +set number +" 历史记录数 +set history=1000 +"搜索逐字符高亮 +set hlsearch +set incsearch +"语言设置 +set langmenu=zh_CN.UTF-8 +set helplang=cn +" 总是显示状态行 +set cmdheight=2 +" 侦测文件类型 +filetype on +" 载入文件类型插件 +filetype plugin on +" 为特定文件类型载入相关缩进文件 +filetype indent on +" 保存全局变量 +set viminfo+=! +" 带有如下符号的单词不要被换行分割 +set iskeyword+=_,$,@,%,#,- +" 字符间插入的像素行数目 + +"markdown配置 +au BufRead,BufNewFile *.{md,mdown,mkd,mkdn,markdown,mdwn} set filetype=mkd +au BufRead,BufNewFile *.{go} set filetype=go +au BufRead,BufNewFile *.{js} set filetype=javascript +"rkdown to HTML +nmap md :!~/.vim/markdown.pl % > %.html +nmap fi :!firefox %.html & +nmap \ \cc +vmap \ \cc + +"将tab替换为空格 +nmap tt :%s/\t/ /g + +set gfn=Liberation\ Mono\ 13 + +highlight Comment ctermfg=green guifg=green + + + +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"""""新文件标题 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"新建.c,.h,.sh,.java文件,自动插入文件头 +autocmd BufNewFile *.cpp,*.[ch],*.sh,*.rb,*.java,*.py exec ":call SetTitle()" +""定义函数SetTitle,自动插入文件头 +func SetTitle() + "如果文件类型为.sh文件 + if &filetype == 'sh' + call setline(1,"\#!/bin/bash") + call append(line("."), "") + elseif &filetype == 'python' + call setline(1,"#!/usr/bin/env python") + call append(line("."),"# coding=utf-8") + call append(line(".")+1, "") + + elseif &filetype == 'ruby' + call setline(1,"#!/usr/bin/env ruby") + call append(line("."),"# encoding: utf-8") + call append(line(".")+1, "") + +" elseif &filetype == 'mkd' +" call setline(1,"") + else + call setline(1, "/*************************************************************************") + call append(line("."), " > File Name: ".expand("%")) + call append(line(".")+1, " > Description: ") + call append(line(".")+2, " > Conclusion: ") + call append(line(".")+3, " > Author: rh_Jameson") + call append(line(".")+4, " > Created Time: ".strftime("%c")) + call append(line(".")+5, " ************************************************************************/") + call append(line(".")+6, "") + endif + if expand("%:e") == 'cpp' + call append(line(".")+7, "#include") + call append(line(".")+8, "#include") + call append(line(".")+9, "#include") + call append(line(".")+10, "#include \"Solution.h\"") + call append(line(".")+11, "") + call append(line(".")+12, "using namespace std;") + call append(line(".")+13, "") + call append(line(".")+14, "int main()") + call append(line(".")+15, "{") + call append(line(".")+16, " Solution solution;") + call append(line(".")+17, " \/\/Error test cases from leetcode.com") + call append(line(".")+18, " \/\/Test cases") + call append(line(".")+19, "") + call append(line(".")+20, " return 0;") + call append(line(".")+21, "}") + endif + if &filetype == 'c' + call append(line(".")+7, "#include") + call append(line(".")+8, "") + endif + if expand("%:e") == 'h' + call append(line(".")+7, "#ifndef _".toupper(expand("%:r"))."_H") + call append(line(".")+8, "#define _".toupper(expand("%:r"))."_H") + call append(line(".")+9, "") + call append(line(".")+10, "#include") + call append(line(".")+11, "#include") + call append(line(".")+12, "#include") + call append(line(".")+13, "") + call append(line(".")+14, "using namespace std;") + call append(line(".")+15, "") + call append(line(".")+16, "class Solution {") + call append(line(".")+17, "public:") + call append(line(".")+18, "") + call append(line(".")+19, "};") + call append(line(".")+20, "") + call append(line(".")+21, "#endif") + endif + if &filetype == 'java' + call append(line(".")+7,"public class ".expand("%:r")) + call append(line(".")+8,"") + endif + "新建文件后,自动定位到文件末尾 +endfunc +autocmd BufNewFile * normal G + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"键盘命令 +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +:nmap :Tlist +" shift tab pages +map :tabp +map :tabn +map! zzi +map! , +map ggVG$"+y +map gg=G +map w +imap , +imap +imap +" 选中状态下 Ctrl+c 复制 +"map "*pa +imap "*pa +imap ^ +imap $ +vmap "+y +set mouse=v +"set clipboard=unnamed +"去空行 +nnoremap :g/^\s*$/d +"比较文件 +nnoremap :vert diffsplit +"nnoremap fu :CtrlPFunky +"nnoremap :CtrlPFunky +"列出当前目录文件 +map :NERDTreeToggle +imap :NERDTreeToggle +"打开树状文件目录 +map \be +:autocmd BufRead,BufNewFile *.dot map :w:!dot -Tjpg -o %<.jpg % && eog %<.jpg && exec "redr!" +"C,C++ 按F5编译运行 +map :call CompileRunGcc() +func! CompileRunGcc() + exec "w" + if &filetype == 'c' + exec "!g++ % -o %<" + exec "!time ./%<" + elseif &filetype == 'cpp' + exec "!g++ % -o %<" + exec "!time ./%<" + elseif &filetype == 'java' + exec "!javac %" + exec "!time java %<" + elseif &filetype == 'sh' + :!time bash % + elseif &filetype == 'python' + exec "!time python2.7 %" + elseif &filetype == 'html' + exec "!firefox % &" + elseif &filetype == 'go' +" exec "!go build %<" + exec "!time go run %" + elseif &filetype == 'mkd' + exec "!~/.vim/markdown.pl % > %.html &" + exec "!firefox %.html &" + endif +endfunc +"C,C++的调试 +map :call Rungdb() +func! Rungdb() + exec "w" + exec "!g++ % -g -o %<" + exec "!gdb ./%<" +endfunc + + +"代码格式优化化 + +map :call FormartSrc() + +"定义FormartSrc() +func FormartSrc() + exec "w" + if &filetype == 'c' + exec "!astyle --style=ansi -a --suffix=none %" + elseif &filetype == 'cpp' || &filetype == 'hpp' + exec "r !astyle --style=ansi --one-line=keep-statements -a --suffix=none %> /dev/null 2>&1" + elseif &filetype == 'perl' + exec "!astyle --style=gnu --suffix=none %" + elseif &filetype == 'py'||&filetype == 'python' + exec "r !autopep8 -i --aggressive %" + elseif &filetype == 'java' + exec "!astyle --style=java --suffix=none %" + elseif &filetype == 'jsp' + exec "!astyle --style=gnu --suffix=none %" + elseif &filetype == 'xml' + exec "!astyle --style=gnu --suffix=none %" + else + exec "normal gg=G" + return + endif + exec "e! %" +endfunc +"结束定义FormartSrc + + + + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +""实用设置 +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +if has("autocmd") + autocmd BufReadPost * + \ if line("'\"") > 0 && line("'\"") <= line("$") | + \ exe "normal g`\"" | + \ endif +endif +"当打开vim且没有文件时自动打开NERDTree +autocmd vimenter * if !argc() | NERDTree | endif +" 只剩 NERDTree时自动关闭 +autocmd bufenter * if (winnr("$") == 1 && exists("b:NERDTreeType") && b:NERDTreeType == "primary") | q | endif + +" 设置当文件被改动时自动载入 +set autoread +" quickfix模式 +autocmd FileType c,cpp map :w:make +"代码补全 +set completeopt=preview,menu +"允许插件 +"filetype plugin on +"共享剪贴板 +"set clipboard+=unnamed +"自动保存 +set autowrite +"set ruler " 打开状态栏标尺 +"set cursorline " 突出显示当前行 +set magic " 设置魔术 +set guioptions-=T " 隐藏工具栏 +set guioptions-=m " 隐藏菜单栏 +""set foldcolumn=0 +""set foldmethod=indent +""set foldlevel=3 +" 不要使用vi的键盘模式,而是vim自己的 +set nocompatible +" 去掉输入错误的提示声音 +set noeb +" 在处理未保存或只读文件的时候,弹出确认 +set confirm +"禁止生成临时文件 +set nobackup +set noswapfile +"搜索忽略大小写 +set ignorecase + + + + +set linespace=0 +" 增强模式中的命令行自动完成操作 +set wildmenu +" 使回格键(backspace)正常处理indent, eol, start等 +set backspace=2 +" 允许backspace和光标键跨越行边界 +set whichwrap+=<,>,h,l +" 可以在buffer的任何地方使用鼠标(类似office中在工作区双击鼠标定位) +set mouse=a +set selection=exclusive +set selectmode=mouse,key +" 通过使用: commands命令,告诉我们文件的哪一行被改变过 +set report=0 +" 在被分割的窗口间显示空白,便于阅读 +set fillchars=vert:\ ,stl:\ ,stlnc:\ +" 高亮显示匹配的括号 +set showmatch +" 匹配括号高亮的时间(单位是十分之一秒) +set matchtime=1 +" 光标移动到buffer的顶部和底部时保持3行距离 +set scrolloff=3 +" 为C程序提供自动缩进 +"自动补全 +"":inoremap ( ()i +"":inoremap ) =ClosePair(')') +":inoremap { {}O +":inoremap } =ClosePair('}') +"":inoremap [ []i +"":inoremap ] =ClosePair(']') +"":inoremap " ""i +"":inoremap ' ''i +""function! ClosePair(char) +"" if getline('.')[col('.') - 1] == a:char +"" return "\" +"" else +"" return a:char +"" endif +""endfunction +filetype plugin indent on +"打开文件类型检测, 加了这句才可以用智能补全 +set completeopt=longest,menu +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +" CTags的设定 +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +let Tlist_Sort_Type = "name" " 按照名称排序 +let Tlist_Use_Right_Window = 1 " 在右侧显示窗口 +let Tlist_Compart_Format = 1 " 压缩方式 +let Tlist_Exist_OnlyWindow = 1 " 如果只有一个buffer,kill窗口也kill掉buffer +""let Tlist_File_Fold_Auto_Close = 0 " 不要关闭其他文件的tags +""let Tlist_Enable_Fold_Column = 0 " 不要显示折叠树 +"let Tlist_Show_One_File=1 "不同时显示多个文件的tag,只显示当前文件的 +"设置tags +"set tags=tags +"set autochdir + + + + + + + + + + + +"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"其他东东 +""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" +"默认打开Taglist +let Tlist_Auto_Open=0 +"""""""""""""""""""""""""""""" +" Tag list (ctags) +"""""""""""""""""""""""""""""""" +let Tlist_Ctags_Cmd = '/usr/local/bin/ctags' +let Tlist_Show_One_File = 1 "不同时显示多个文件的tag,只显示当前文件的 +let Tlist_File_Fold_Auto_Close = 1 +let Tlist_Exit_OnlyWindow = 1 "如果taglist窗口是最后一个窗口,则退出vim +let Tlist_Use_Right_Window = 1 "在右侧窗口中显示taglist窗口 +" minibufexpl插件的一般设置 +let g:miniBufExplMapWindowNavVim = 1 +let g:miniBufExplMapWindowNavArrows = 1 +let g:miniBufExplMapCTabSwitchBufs = 1 +let g:miniBufExplModSelTarget = 1 +nmap tl :Tlist + + + +"输入法 +:let g:vimim_map='c-/' +":let g:vimim_cloud='sougou' " QQ云输入 +:let g:vimim_punctuation=0 " 不用中文标点 +:set pastetoggle= +:let g:vimim_cloud=-1 + + +"python补全 +let g:pydiction_location = '~/.vim/after/complete-dict' +let g:pydiction_menu_height = 20 +let Tlist_Ctags_Cmd='/usr/local/bin/ctags' +let g:miniBufExplMapWindowNavVim = 1 +let g:miniBufExplMapWindowNavArrows = 1 +let g:miniBufExplMapCTabSwitchBufs = 1 +let g:miniBufExplModSelTarget = 1 + + +set iskeyword+=. +set termencoding=utf-8 +set encoding=utf8 +set fileencodings=utf8,ucs-bom,gbk,cp936,gb2312,gb18030 + +autocmd FileType python set omnifunc=pythoncomplete#Complete + +"set nocompatible " be iMproved +"filetype off " required! + +set rtp+=~/.vim/bundle/vundle/ +call vundle#rc() + +" let Vundle manage Vundle +" required! +Bundle 'gmarik/vundle' + +" My Bundles here: +" +" original repos on github +Bundle 'tpope/vim-fugitive' +Bundle 'rstacruz/sparkup', {'rtp': 'vim/'} +Bundle 'Yggdroot/indentLine' +let g:indentLine_char = '┊' +"ndle 'tpope/vim-rails.git' +" vim-scripts repos +Bundle 'L9' +Bundle 'FuzzyFinder' +" non github repos +Bundle 'git://git.wincent.com/command-t.git' +Bundle 'Auto-Pairs' +Bundle 'python-imports.vim' +Bundle 'CaptureClipboard' +Bundle 'ctrlp-modified.vim' +Bundle 'last_edit_marker.vim' +Bundle 'synmark.vim' +"Bundle 'Python-mode-klen' +Bundle 'SQLComplete.vim' +Bundle 'Javascript-OmniCompletion-with-YUI-and-j' +"Bundle 'JavaScript-Indent' +"Bundle 'Better-Javascript-Indentation' +Bundle 'jslint.vim' +Bundle "pangloss/vim-javascript" +Bundle 'Vim-Script-Updater' +Bundle 'ctrlp.vim' +Bundle 'tacahiroy/ctrlp-funky' +Bundle 'jsbeautify' +Bundle 'The-NERD-Commenter' +"django +Bundle 'django_templates.vim' +Bundle 'Django-Projects' + +"Bundle 'FredKSchott/CoVim' +"Bundle 'djangojump' +" ... +let g:html_indent_inctags = "html,body,head,tbody" +let g:html_indent_script1 = "inc" +let g:html_indent_style1 = "inc" + +filetype plugin indent on " required! +" +" Brief help +" :BundleList - list configured bundles +" :BundleInstall(!) - install(update) bundles +" :BundleSearch(!) foo - search(or refresh cache first) for foo +" :BundleClean(!) - confirm(or auto-approve) removal of unused bundles +" +" see :h vundle for more details or wiki for FAQ +" NOTE: comments after Bundle command are not allowed.. +" +" +"ctrlp设置 +" +set wildignore+=*/tmp/*,*.so,*.swp,*.zip,*.pyc,*.png,*.jpg,*.gif " MacOSX/Linux +set wildignore+=*\\tmp\\*,*.swp,*.zip,*.exe,*.pyc,*.png,*.jpg,*.gif " Windows + +let g:ctrlp_custom_ignore = '\v[\/]\.(git|hg|svn)$' +let g:ctrlp_custom_ignore = '\v\.(exe|so|dll)$' +let g:ctrlp_extensions = ['funky'] + +let NERDTreeIgnore=['\.pyc'] +let NERDTreeIgnore=['\.pyc']