20180929 first commit
This commit is contained in:
37
bin/conf/app_detect.conf
Normal file
37
bin/conf/app_detect.conf
Normal file
@@ -0,0 +1,37 @@
|
||||
[APPDTC]
|
||||
RUN_LOG_LV=10
|
||||
DEC_LOG_LV=10
|
||||
RUN_LOG_DIR=./log
|
||||
|
||||
RM_DECODED_FILE=1
|
||||
RM_DECODE_FAIL_APK=1
|
||||
|
||||
#maximum thread num: plus it with maskey's thread num, sum should < 64
|
||||
THREAD_NUM=8
|
||||
HTABLE_SIZE=33554432
|
||||
HTABLE_TIME=0
|
||||
QUEUE_SIZE=100000
|
||||
|
||||
STAT_FIELD_CYCLE=60
|
||||
STAT_FIELD_TRIG=1
|
||||
|
||||
[MAAT]
|
||||
#Json only for MD5
|
||||
MAAT_JSON_ON=0
|
||||
JSON_CGF_DIR=./conf/maat_pz/json/maat_json.json
|
||||
TABLE_INFO_JSON=./conf/maat_pz/json/table_info.conf
|
||||
|
||||
TABLE_INFO_PATH=./conf/maat_pz/table_info.conf
|
||||
FUL_CFG_DIR=./conf/maat_pz/full/index/
|
||||
INC_CFG_DIR=./conf/maat_pz/inc/index/
|
||||
|
||||
[MAGALLEN_LOG]
|
||||
LOG_IP_NUM=1
|
||||
#format: 192.168.1.1-192.168.1.10;192.168.1.20;192.168.1.30-192.168.1.33;
|
||||
#ATTENTION: Must end with ';', length of LOG_IP should < 1024
|
||||
LOG_IP=10.0.6.212;
|
||||
LOG_PORT=56785
|
||||
|
||||
PZ_IP_NUM=1
|
||||
PZ_IP=10.0.6.212;
|
||||
PZ_PORT=56785
|
||||
385
bin/conf/frag_monitor.json
Normal file
385
bin/conf/frag_monitor.json
Normal file
@@ -0,0 +1,385 @@
|
||||
{
|
||||
"compile_table": "FRAG_MONITOR_CONFIG_FULL",
|
||||
"group_table": "FRAG_MONITOR_GROUP",
|
||||
"rules":
|
||||
[
|
||||
{
|
||||
"compile_id": 11,
|
||||
"service": 3122,
|
||||
"action": 0,
|
||||
"do_blacklist": 166,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "iqiyi_data_c2s",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "iqiyi_data_c2s",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_MESSAGE_URL",
|
||||
"keywords": "video&f4v&range",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 12,
|
||||
"service": 3122,
|
||||
"action": 2,
|
||||
"do_blacklist": 167,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "iqiyi_data_s2c",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "iqiyi_data_s2c",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONT_TYPE",
|
||||
"keywords": "application/octet-stream",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 7,
|
||||
"service": 2222,
|
||||
"action": 0,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "tudou_data_c2s",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "tudou_data_c2s",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_MESSAGE_URL",
|
||||
"keywords": ".ts&ts_start&ts_end&ts_seg_no",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 8,
|
||||
"service": 2222,
|
||||
"action": 2,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "tudou_data_s2c",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "tudou_data_s2c",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_SERVER",
|
||||
"keywords": "YOUKU.BJ.FBN",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 9,
|
||||
"service": 2221,
|
||||
"action": 1,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 0,
|
||||
"effective_range": 0,
|
||||
"user_region": "tudou_index_c2s",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "tudou_index_c2s",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_MESSAGE_URL",
|
||||
"keywords": "/playlist/m3u8",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 10,
|
||||
"service": 2221,
|
||||
"action": 1,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 0,
|
||||
"effective_range": 0,
|
||||
"user_region": "tudou_index_s2c",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "tudou_index_s2c",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONTENT",
|
||||
"keywords": "#EXTM3U&#EXTINF&ts&start&end",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 1,
|
||||
"service": 1122,
|
||||
"action": 0,
|
||||
"do_blacklist": 161,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "osmf_data_c2s",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "osmf_data_c2s",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_MESSAGE_URL",
|
||||
"keywords": "Seg&Frag",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 2,
|
||||
"service": 1122,
|
||||
"action": 2,
|
||||
"do_blacklist": 161,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "osmf_data_s2c",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "osmf_data_s2c",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONT_TYPE",
|
||||
"keywords": "f4f",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
|
||||
{
|
||||
"compile_id": 3,
|
||||
"service": 2122,
|
||||
"action": 0,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "hls_data_c2s",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "hls_data_c2s",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_MESSAGE_URL",
|
||||
"keywords": ".ts",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 4,
|
||||
"service": 2122,
|
||||
"action": 2,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 2,
|
||||
"effective_range": 0,
|
||||
"user_region": "hls_data_s2c",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "hls_data_s2c",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONT_TYPE",
|
||||
"keywords": "application/x-transportstream",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
},
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONT_TYPE",
|
||||
"keywords": "video/mp2t",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
},
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONT_TYPE",
|
||||
"keywords": "video/x-flv",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 5,
|
||||
"service": 2121,
|
||||
"action": 1,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 0,
|
||||
"effective_range": 0,
|
||||
"user_region": "hls_index_c2s",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "hls_index_c2s",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_MESSAGE_URL",
|
||||
"keywords": ".m3u8",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 6,
|
||||
"service": 2121,
|
||||
"action": 1,
|
||||
"do_blacklist": 162,
|
||||
"do_log": 0,
|
||||
"effective_range": 0,
|
||||
"user_region": "hls_index_s2c",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "hls_index_s2c_1",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONT_TYPE",
|
||||
"keywords": "application/vnd.apple.mpegurl",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}, {
|
||||
"table_name": "FRAG_MONITOR_KEYWORDS",
|
||||
"table_type": "expr_plus",
|
||||
"table_content": {
|
||||
"district": "HTTP_CONTENT",
|
||||
"keywords": "#EXTM3U",
|
||||
"expr_type": "and",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
40
bin/conf/frag_reassembly.conf
Normal file
40
bin/conf/frag_reassembly.conf
Normal file
@@ -0,0 +1,40 @@
|
||||
[NETWORK]
|
||||
RedisClusterSwitch=1
|
||||
RedisTimeout=5
|
||||
|
||||
#cluster mode
|
||||
RedisBrokers=10.0.6.192:9012
|
||||
RedisNet=192
|
||||
#HIRCLUSTER_FLAG_UNIQIP_FRAG_ONE=0x100=256,HIRCLUSTER_FLAG_UNIQIP_FRAG_TWO=0x200=512,HIRCLUSTER_FLAG_UNIQIP_FRAG_THREE=0x400=1024,HIRCLUSTER_FLAG_UNIQIP_FRAG_FOUR=0x800=2048
|
||||
RedisUniqIPFlag=2048
|
||||
|
||||
#no cluster mode
|
||||
RedisIP=
|
||||
RedisPort=
|
||||
|
||||
[SYSTEM]
|
||||
WaitQueueNum=1000000
|
||||
|
||||
ConvergeHashSize=65536
|
||||
ConvergeHashElemNum=1048576
|
||||
ConvergeHashExpireTime=300
|
||||
|
||||
[LOG]
|
||||
#frag reassembly log <20><><EFBFBD><EFBFBD>ƴ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
FragReassemblyLogLevel=10
|
||||
FragReassemblyLogName=./frag_reassembly.log
|
||||
|
||||
#media log
|
||||
MediaLogLevel=10
|
||||
MediaLogName=./frag_reassembly_media.log
|
||||
|
||||
#stat log
|
||||
StatInterval=5
|
||||
StatFile=./frag_reassembly_stat.log
|
||||
SysinfoInterval=5
|
||||
SysinfoFile=./frag_reassembly_sysinfo.log
|
||||
|
||||
#Maat
|
||||
MaatStatSwitch=0
|
||||
MaatPerfSwitch=0
|
||||
MaatStatFile=./maat_stat.log
|
||||
488
bin/conf/maat_pz/full/2015-11-05/APP_PKG_INFO.0000000001
Normal file
488
bin/conf/maat_pz/full/2015-11-05/APP_PKG_INFO.0000000001
Normal file
@@ -0,0 +1,488 @@
|
||||
487
|
||||
1940852427915264 15c376da5429e744a22762a8dd80a529 1
|
||||
1940852429488128 4c76fe2fa77b1dc9d48f3da728194d55 1
|
||||
1940852445347840 7c7d0217dc9d0508935148c413928dd4 1
|
||||
1940852448034816 22de101ec0aff28d9beb930cbec9482a 1
|
||||
1940852456882176 eb47ba3444699120cfcb2ab07e9a53a5 1
|
||||
1940852456947712 fcac6bb15e1e5bf73d224892654497c9 1
|
||||
1940852459896832 d2114e90f289819d25fb133f8a592085 1
|
||||
1940852461600768 0f182a3ccb72cc7b2fb57099efd176fa 1
|
||||
1940852472807424 52c29608416bea60b7d6d397c4d7189e 1
|
||||
1940852476346368 6f3557027ce344f454c90ef29e8ba180 1
|
||||
1940852476411904 fcd1d27443712329d9af9b8bde876c76 1
|
||||
1940852478967808 d27b6520683068f5164a89a6fc57f4c6 1
|
||||
1940852486963200 fe6c54263a7fe0d6974578b3cc69562b 1
|
||||
1940852486897664 7310a11f0989626c8477a8c4d3e79f8b 1
|
||||
1940852502233088 708a3d6c271e927b3eece1f5d82094bf 1
|
||||
1940852513767424 cd4d04354a964d7b799256a8cec0bd0c 1
|
||||
1940852521566208 340ee2d6cf6a209bcf3f8e9b7d53c0c7 1
|
||||
1940852536836096 e9a014519f254dc5b381a2b97b066f09 1
|
||||
1940852545159168 76b7465d34e9abb67e6ba83647d550cd 1
|
||||
1940852545814528 20f65e758759f46443bd11650da0306f 1
|
||||
1940852553089024 8bf9c4a4d87cde36acb963d89592c68e 1
|
||||
1940852553809920 2a84e67fd40699f0bba53c98e89ed3b5 1
|
||||
1940852561870848 2b3b04d8446b1a9b274238c8324f37e5 1
|
||||
1940852562264064 9da7e0121f85855496ba04087258323b 1
|
||||
1940852570193920 05fe347fa3827b24e60c3564ef7c711a 1
|
||||
1940852574846976 5f2e06f13a888a81a87b6c74f2807475 1
|
||||
1940852574846977 d784e23301ce77ec1016e4f164587275 1
|
||||
1940852577796096 ba3ec633188ec6837ab062f9cd01c2ad 1
|
||||
1940852578189312 d10ab6ba5d8b59925787d5048bcc84ab 1
|
||||
1940852578582528 66a2d0b795752328514b7f861c130cd3 1
|
||||
1940852582711296 94235749eede620878de543d5233710a 1
|
||||
1940852586184704 246fea6e8318716c87cde6c6cb0ec624 1
|
||||
1940852585922560 25962e14ce5ecfd24f85a822ddb8ee0b 1
|
||||
1940852593852416 5816b661ee73ac68b0e7a0e3c0d15670 1
|
||||
1940852594376704 b144aa11151f4b079fdfbf40e2e35ca2 1
|
||||
1940852601716736 49ed2ea13b70503492f66b93e370e27e 1
|
||||
1940852602175488 5762fa6dea65d6959d61c552f981d30e 1
|
||||
1940852610105344 15449bd69d2a6a4bc1158f562bc436d7 1
|
||||
1940852610039808 9d5fbc1093e8fc68e8a073009a4a6e08 1
|
||||
1940852619608064 a539d1251ca64cc23027f73e9d62e295 1
|
||||
1940851667435520 08f8097f2dd64c30a542fc157cbea5fd 1
|
||||
1940851674120192 2a5b7df792d3efc5c7479d8e018c7e6a 1
|
||||
1940851674054656 568495cdf093f04184354c54911b9361 1
|
||||
1940851676872704 a146e5e7ac1d4e6734b1dc66a6dcba5a 1
|
||||
1940851678183424 9f6f8de5d4d578797b29f4705b33971b 1
|
||||
1940851680477184 5debe5300591fcd6c97be5f95ddbc841 1
|
||||
1940851681329152 349f868612f8be90fd9a36f7304ae5f1 1
|
||||
1940851681460224 c1c53544873448ddeb89d02410bfdd7c 1
|
||||
1940851682312192 4fa93a171922670efc9a076d52981a82 1
|
||||
1940851682967552 f50111fe3c1177f29b0e880983c9039d 1
|
||||
1940851683622912 d61b97be489895a10416257c6b29dd1d 1
|
||||
1940851689324544 aa0f90384a4043eabf775371889896e5 1
|
||||
1940851689455616 46e477fb455561f44ec60c07877ff488 1
|
||||
1940851690962944 0197d91dedc5d3e316d8345c3b128823 1
|
||||
1940851711868928 e92a4c03640420b4bdfe65202bc3360d 1
|
||||
1940851716128768 96597e92e7f08d3e7972eb20d4c42f85 1
|
||||
1940851766132736 083a786e7d461d4ff00859912e904981 1
|
||||
1940851768164352 062d25fd96ed01b0edd32221eea084b4 1
|
||||
1940851768885248 12d643f494cedf5c93f5359b64f6fb7c 1
|
||||
1940851773538304 6ac9b81e760f6597ec4cd2a401302cc9 1
|
||||
1940851775504384 44c0b4526151b0aff34e4dca761faad6 1
|
||||
1940851777798144 3ec4980a18924d3e8804f37e171723eb 1
|
||||
1940851778125824 2153241ba86bca5002522951ed0a6418 1
|
||||
1940851778912256 d47e19181ea152311aa15ef88132357c 1
|
||||
1940851789529088 f4eaf96b0832374363fdb719b7ee4d28 1
|
||||
1940851793526784 3a95895d1b9f1e7c6f74af67783149f2 1
|
||||
1940851794444288 c7f25e8d229ad749523ef09f56ca352b 1
|
||||
1940851794903040 e48f07951296dcc00ccfb7a5697c3e7a 1
|
||||
1940851795492864 14ee8493244bd410acc29ce7881c07a0 1
|
||||
1940851796213760 0fd7fcb6996bb420cc729c367f08b143 1
|
||||
1940851798179840 e513765fb4fbb7d11b5adc03a954f5cc 1
|
||||
1940851799490560 2cbdd91e441f2f7ef126fb833013a390 1
|
||||
1940851803488256 92fea806ebeba4ff8fcf03fd16588bfd 1
|
||||
1940851804798976 3b6fd310e3880ac408d9e49fbaa53ea7 1
|
||||
1940851808141312 da417c161aab2ce362b48421e66313de 1
|
||||
1940851808796672 f8eba1ad249699fd2c6f2b2fe5086e98 1
|
||||
1940851809452032 5bb7711676a42c2b716e2f61ede0f1e6 1
|
||||
1940851810172928 18968dd7e2b0dde020d737694abc5917 1
|
||||
1940851811287040 0ba1e910d902ba82be4b55032f48ec09 1
|
||||
1940851811549184 a99ae7873903db6dcdead90236a95926 1
|
||||
1940851814760448 af3c68b5f2cfbbfe70cf060f95325284 1
|
||||
1940851819806720 e80ec3f84cb88cec3ce8a867dec32736 1
|
||||
1940851819806721 7e5aa478041c04c1a0704bf4503234ad 1
|
||||
1940851843858432 94a8e2ba433c5d8f6471bab19450c7eb 1
|
||||
1940851843858434 59f11086dc4bdaede37e11b6aaa5e35e 1
|
||||
1940851852115968 dd602fe6409ab78fd5f44072e33a73e9 1
|
||||
1940851853230080 20a4cad1cca773e2e75620f780c92e7c 1
|
||||
1940851860897792 45b0ff014a8f025b80d3610c74737faa 1
|
||||
1940851867058176 7b668022754ad14a928d9b5ea4f74e97 1
|
||||
1940851867975680 fd22542edc594d8f24e81578aa718901 1
|
||||
1940851875971072 189ccd67bd267c1d75f58b286cc9370c 1
|
||||
1940851876560896 6ac36fa98264f1cd4785b5056f1a87c8-old 1
|
||||
1940851877085184 70494836abba7b7c1f148a49c4a80c64 1
|
||||
1940851879378944 1fc2b7acc8c46078fdd73db54bf7e5fe 1
|
||||
1940851884032000 6e9d2f22f79ed4bb04d2898522221267 1
|
||||
1940851885539328 b20169567feea5d7bb3a80a0b26bf2ff 1
|
||||
1940851885801472 255888a02a45849d779b90ea499936bf 1
|
||||
1940851891830784 e160110f4dcbf0bb8f1b7f081a9c49eb 1
|
||||
1940851895435264 ed50cee975b345f6851ddd3f47f2697f 1
|
||||
1940851899891712 16ec89b5ff018dcf885c0652fff35a73 1
|
||||
1940851900743680 6ac36fa98264f1cd4785b5056f1a87c8 1
|
||||
1940851919814656 67172b5dfdefb45412929d72abaa02fe 1
|
||||
1940851920076800 bf2056b83891e1006b75a9d4399711dc 1
|
||||
1940851923877888 c286132bfd2cd43768eae91da945ac61 1
|
||||
1940851923943424 c983d37eae2455a70c2f0d06447fba09 1
|
||||
1940851926302720 18723fab224a1d708f97bfb93ace15f0 1
|
||||
1940851927678976 8c3dec86d176308e8ceb013be774ad90 1
|
||||
1940851935608832 5e7ad1cbd7973f4a8dab88cc48170e22 1
|
||||
1940851942555648 69321ac91593f08fb1ec0c63588c9176 1
|
||||
1940851943931904 e7c2fe59a89a10bd288961ab08fec3b3 1
|
||||
1940851943931905 f87a1268f600eb6bcdc958d862965212 1
|
||||
1940851948257280 5216e31dcf8974071618e332839f4d80 1
|
||||
1940851952123904 96cadedb0707ad8af159c157acaae39a 1
|
||||
1940851955990528 03d121d0ede5b2e7426ccd0fdf2aa670 1
|
||||
1940851955990529 4642e0174127be315ab2da5349ea1b1c 1
|
||||
1940851958546432 5bfc167a211e3e93dd036cb42f26e7de 1
|
||||
1940851966476288 818b96727e0fe48d7dc833ca388d83b7 1
|
||||
1940851974668288 e986871e022830e57957f67c6e529db3 1
|
||||
1940851974930432 f674623fdf868d5887f4b3357ce0be51 1
|
||||
1940851980763136 bba79db859e9b7ee857b4fe007da63fe 1
|
||||
1940851991707648 b0b495bdee97827ba0b3551d031a8906 1
|
||||
1940851999637504 f3bc0330f385dc0b3042a38bd81eed9a 1
|
||||
1940852004421632 04b898025c74b9c1c6f42eaada13d83e 1
|
||||
1940852008091648 281bdbcd7e72fd218db292660ee93734 1
|
||||
1940852015300608 dec559541b5bf593aa19a66502f09d9c 1
|
||||
1940852016414720 b7ada91ec1df3f21814978b04a4f930d 1
|
||||
1940852020477952 949c8a8544ea1b3360d99f8f9468fe64 1
|
||||
1940852024279040 7f7dfb53be2d983e64679aedcdf8d0e5 1
|
||||
1940852024934400 4176f6082a0b9ab6eb46e8dd5ae8a019 1
|
||||
1940852028145664 87c91cdbdf1f70a1385fad8f9819a96f 1
|
||||
1940852033454080 2d5b94ef597f96b9b1235071bb150c8b 1
|
||||
1940852033781760 32c8cffb1b21e6b01d0efd9f96675396 1
|
||||
1940852041711616 12354066acb7e152f8c64514c0317e9d 1
|
||||
1940852041711617 1d4bad5fd67a9995fb8aeae706a8159f 1
|
||||
1940852041908224 dfbf497e0185d983681a614f0586b27c-old 1
|
||||
1940852050034688 afabdebd1731dc5cac2581086bd9d6b9 1
|
||||
1940852051345408 dfbf497e0185d983681a614f0586b27c 1
|
||||
1940852058226688 17877e88fa331ccea529d4d7cce5a408 1
|
||||
1940852058554368 cb0d0be59ffa11fcd5e5e4e6011304c5 1
|
||||
1940852060454912 012293d9930fc351f6023adbff15abb5 1
|
||||
1940852074807296 9a748308b710aff32894be4eb6174d85 1
|
||||
1940852082081792 38e1c73a49e71def36718a917788e413 1
|
||||
1940852090142720 a42cee0df6456020f91a59fe88952e48 1
|
||||
1940852093485056 1887f326f5bf55ca4d671f882deca345 1
|
||||
1940852100104192 ea815151944921ec9220feee4bbbd193 1
|
||||
1940852106133504 e91e5f1ad91b33c390c00eb019edc8af 1
|
||||
1940852108623872 1c9de45efb3d58bc82112bf4bc2c5092 1
|
||||
1940852134051840 e01c93c096ed331d68eff216706ef383-old 1
|
||||
1940852138573824 620b5d1bd041fc558f24aca297eb2553 1
|
||||
1940852140539904 8f4742a3b939350ea78dd1822357ae0a 1
|
||||
1940852158103552 cc549cb9fe0232fcde32e7f2c3d3b87b 1
|
||||
1940852162691072 b5ad89ac9604b4a1cb9090587c0a71a8 1
|
||||
1940852164919296 528b1b421c79450a8db3d390095195ca 1
|
||||
1940852170358784 1dd427c87f2b97779061774bea6a18ee 1
|
||||
1940852170817536 e0cf0289128e41729d5312e6c3c553ec-old 1
|
||||
1940852172783616 010658277c9fc8c10c25b45013a425ff 1
|
||||
1940852220624896 e0cf0289128e41729d5312e6c3c553ec 1
|
||||
1940852231634944 e01c93c096ed331d68eff216706ef383 1
|
||||
1940852268924928 084d226cff792bc5ba64e59a602adf62 1
|
||||
1940852291403776 6b5f56f91e419bb1af0fdf6f6455da9f 1
|
||||
1940852299333632 751e4320a147beed6c08ae43954e8a98 1
|
||||
1940852315717632 f796b1787286bb4ce2c13216fa9a6d68 1
|
||||
1940852323713024 53416fa1b75f94ba350c6e787d3372cc 1
|
||||
1940852324433920 e1d523041980f57f36d4f5ce0c6e2190 1
|
||||
1940852331708416 b6f913928348886656ae8f1e906bf731 1
|
||||
1940852333084672 b5b8fa2ca126319ae5c38e7086d19d1d-old 1
|
||||
1940852341014529 03a4ed7fca422e6f7b094c895dff8359 1
|
||||
1940852354318336 b5b8fa2ca126319ae5c38e7086d19d1d 1
|
||||
1940852372733952 43ba0a13598c6ab6f47defedd534dcee 1
|
||||
1940852373389312 11d92f7d818b9c8285236d2201ba202c 1
|
||||
1940852373913600 1a53f8dcda97551c3806d3955cc313fb 1
|
||||
1940852382105600 63eeb5a1533eb177dad0583daf4388d5 1
|
||||
1940852389576704 a1f22794609f45b00b5d3e22ff82d25b 1
|
||||
1940852405567488 1d401c06063e46d6e597f96f4415d320 1
|
||||
1940852407336960 0a9a101c3e2739a080b1a7cd88979dfc 1
|
||||
1940852407271424 047d6fe29d1c232eedbe3a2a9337e197 1
|
||||
1940852411990016 f36ededdf7555be78008f32fda517dbd 1
|
||||
1940852414021632 011046eb73ef358a668a2d20dd0eeb73 1
|
||||
1940852421558272 e3f3adb924a2e673a72a647f8d28c8bb 1
|
||||
1940854040756224 f0d580a4d1f160a273a9b1a77d161950 1
|
||||
1940854155575296 1dda83c67f47cd0722f51d93a9e96450 1
|
||||
1940854205120512 3a61043baf003f70337af4d13131a177 1
|
||||
1940854205186048 e3b1cdffd5adaced9ccd37215b2aa60e 1
|
||||
1940854268100608 9f71fac5da85f7a735fe90934bd46fb4 1
|
||||
1940854667935744 4cdfc12ce5f1d5807fffb3282adecc7c 1
|
||||
1940854668853248 9f883c0d57021f6f6bf65fc61691c8ba 1
|
||||
1940854772989952 eeb0213939fa87d3c18cf35eea651706 1
|
||||
1940854811787264 f328d284dd95b5b91deb95aab92c59a9 1
|
||||
1940854970974208 bec5042612696b9e67ce2a944525c9c1 1
|
||||
1940854978969600 7cee9e491c68c926efc1b129a4060fc8 1
|
||||
1940854994567168 4ef7dfd15399e0ad57988ffaf0fd7c0a 1
|
||||
1940855001251840 41f9d59d799e3e7313d907bcc71f29b6 1
|
||||
1940855002562560 a95af326bd119d207280bfc9d5e120c3 1
|
||||
1940855002628096 810959f22d473ba5921e8acdcda2a116 1
|
||||
1940855019077632 a7162fa7d922b16655cc9cd3cd9fbe10 1
|
||||
1940855026614272 cb5be3865ab06faa23dab64fae4370c4 1
|
||||
1940855043588096 113703e1475e6330409c6e7996ef8e68 1
|
||||
1940855058857984 0c68518d3645644b9769ac8332b8de94 1
|
||||
1940855066591232 a3dccfc6ea62c792d968d39ebb0714a0 1
|
||||
1940855066656769 62fa26cfbf7c0850f741baf24e67addf 1
|
||||
1940855074652160 decdbe5d817d0eaf1790c74e7d3c2241 1
|
||||
1940855082713088 ee2b0dd4a445a2cc4b8d9571ba1e71b5 1
|
||||
1940855090446336 06bc1f217cbf943abe5a1519df32e56a 1
|
||||
1940855090642944 0e387ab3aa29c551ce654d85fa0a2957 1
|
||||
1940855098441728 47947d4b1e51710fa508f7065f4443f8 1
|
||||
1940855098572800 d6dd367c279bf5b10acd53c3f30dfffa 1
|
||||
1940855106371584 2a830cb2b5a21b0c3b0b3adac3e1427f 1
|
||||
1940855106568192 e84e0f35e26e0f4429c4c6d80f0c3d5e 1
|
||||
1940855114432512 9095feb4c8e575fb034b061d6fef7b0e 1
|
||||
1940855114498048 d9f819f1ad01c67f2cf10f507e9e98b6 1
|
||||
1940855122100224 3264c2f3f4b3789d3df694ff07c563e7 1
|
||||
1940855130226688 310b075c8b4fd660f916660f0b4b998e 1
|
||||
1940855138025472 91fa0136b3aa5a1de8bd41a841db45cc 1
|
||||
1940855137959936 3ec8627b5dffe6b3a89ee0909b2a3f58 1
|
||||
1940855138222080 5d61c145519c4326968e6e6fb23c7410 1
|
||||
1940855146151936 d7b3dbdf88c3f7fc60549e66a5f20176 1
|
||||
1940855162404864 6fb9daebe266b60e56164ee59a39e08e 1
|
||||
1940855162142720 c913b56c5a5cbfe4842789a25209b1f0 1
|
||||
1940855169810432 7656d5de890db3a7391b10053d7b7bbc 1
|
||||
1940855170072576 c8de9e6efa32106410c93e8efa9dda07 1
|
||||
1940855185539072 c358af5655d7e64bda3a20e5108532f8 1
|
||||
1940855186128896 d9bb47cc7cb4f13f759b12f1dbab5188 1
|
||||
1940852623278080 efe9f527162774b59c0a71397aed148a 1
|
||||
1940852626292736 7f7eccfe667b2862b959e38375225e3f 1
|
||||
1940852627406848 a10e0d86616589ebf0f33ea96c2651fd 1
|
||||
1940852631142400 b70c2a7c71458c8150d810ce98ad2fb3 1
|
||||
1940852651393024 d32c463c4a61775c1ae6d705c2b6f706 1
|
||||
1940852664041472 0cc15cf9fc1f2b296fa6f722c994a4b7 1
|
||||
1940852681605120 d37651f15f3631d72bd7ed7b10e5a197 1
|
||||
1940852683046912 ee6835b647ece094e28f54da1f84f1fd 1
|
||||
1940852685144064 18ab1d16f7ec5e61acd263dc693449c9 1
|
||||
1940852685799424 2bfca84d0ff4399df422ecffb47b6d94 1
|
||||
1940852691107840 6dfbd5b4de91f12f03cb9763141af3b3 1
|
||||
1940852702969856 42e2319c778633d8c0a4d8b716757337 1
|
||||
1940852709523456 d95fc7247783b7ac411164460bc13f5e 1
|
||||
1940852711555072 ebfb3d36380e0f52bcaeaebb1c5a1c30 1
|
||||
1940852727414784 b47bb0a4fabcbfc2fd8da9cb389f578d 1
|
||||
1940852727873536 b1348285ed19eea721ffd9addec64d11 1
|
||||
1940852735803392 3f099a4c94fbb1f871874fc0ae1c5bc5 1
|
||||
1940852737376256 2b6da6a196e6cc91d10191f9491368d2 1
|
||||
1940852743667712 ce45b997d7287d3b1fe42374531b13f3 1
|
||||
1940852751990784 b9748bbb3424ba983c16c4e21ebe2e3c 1
|
||||
1940852751990786 c1a92207df76da666eeb0a1c15d849ff 1
|
||||
1940852752908288 d76f7708763f5f85f5084af62203168b 1
|
||||
1940852775780352 db5245dd50178f63dead38445431bf36 1
|
||||
1940852984709120 4a3f52cac109e03d556430ed9d248e2e 1
|
||||
1940853036023808 80ebd5053675baf2bca25636638a2ab4 1
|
||||
1940853262254080 72e3001ba4d2c60f1dac41b7246f46fc 1
|
||||
1940853299609600 f7e00709ec509211dd59ac1eb36d3ab6 1
|
||||
1940853779136512 0b558c168bf35b5c2e37090cfdafdd93 1
|
||||
1940853792243712 d3cf74fcfef339f4e29ba3361e34422f 1
|
||||
1940855193403392 d1f6ea03c31e4146a3010ae1efacff39 1
|
||||
1940855201398784 fd012846f43ae9bf49fcc313ff55860e 1
|
||||
1940855201398785 63e492508a2e5be984ba6996b6e7c630 1
|
||||
1940855209787392 03d3ebcae31f43341a6aafcff80e260f 1
|
||||
1940855209852928 eb65b506e21f6562576cfdc48dc3b311 1
|
||||
1940855217979392 2062b6eaf897329d1a0384ddc9666341 1
|
||||
1940855233314816 ff6c309572ed32617fcf60059787f38c 1
|
||||
1940855233708032 57ee5d2cb61006a0c1d60e4f2a89deaa 1
|
||||
1940855241179136 8e67a05a6972f57d50303311a056af09 1
|
||||
1940855241506817 2f4397dab877a272abe98d738324b111 1
|
||||
1940855249436672 756cb996e49fb9db58acee17888c731e 1
|
||||
1940855249436673 0ad79ecb64ee29b083f087a7f36243ed 1
|
||||
1940855257104384 b3689e54af18465f5bfd98ff03b767b1 1
|
||||
1940855265296384 744bcc7d90dbd7bbc460f3755ef1abae 1
|
||||
1940855273422848 cd8c1069d9aad070a4398acc57031e5d 1
|
||||
1940855273684992 af17dbbc3f8829b0558afa916aa9ade0 1
|
||||
1940855274799104 18f30a4406bdc0bf3fd8a548272c24ed 1
|
||||
1940855281614848 a1f2ba4e74667afe6ed4743957e4f37c 1
|
||||
1940855297802241 c691818b59c4e9ebe493132752b0e5aa 1
|
||||
1940855298326528 082e38697b66b7bd7790e125b6f3a706 1
|
||||
1940855306715136 af81ff8d0d4d1ec3dd9052fc6659fddc 1
|
||||
1940855330439168 ad62aae563912a8a7faecc1d1fffa4aa 1
|
||||
1940855330635776 68f6cc1592bec22e7d9a9e54e0e2c051 1
|
||||
1940855339941888 7ff7136d34f0ce23da547f682177ed63 1
|
||||
1940855346692096 1bc7f50818a3a39f4afb383a3ead53fb 1
|
||||
1940855347085312 62b4930d2b98407439af26d5bfe5f16d 1
|
||||
1940855347347456 64c69c1c0b5e68926863b9b54a62f6b1 1
|
||||
1940855355342848 86229e5ca74c4a18538e12b7e9af70c9 1
|
||||
1940855355146240 9804cc61e464d2ca410bee4d501f559a 1
|
||||
1940855355211776 3df79c65840dcfc4d3d105baf807fe6b 1
|
||||
1940855362486272 2de43c5ed2bc77c27b4fcdfa0ab6b130 1
|
||||
1940855370416128 25f08ee4aeffab02057b796e2a213953 1
|
||||
1940855371071488 2782544d1579ae25b0091d75e8688e51 1
|
||||
1940855386341376 0e03c31d9089c7ba588fe86b2de2491b 1
|
||||
1940855387193344 d75594119134fdff4b87202477aa08c2 1
|
||||
1940855395581952 baeeca97f63a79c979347d98b59f31da 1
|
||||
1940855410130945 0b9f96cdc196d57839edcc14a967d9d2 1
|
||||
1940855411376128 3ba5c55b8489627a9a2dbf0184e5d273 1
|
||||
1940855411376129 cadf366661c2dc24aba87d24e6743532 1
|
||||
1940855419174912 980e2ec9e7396e3f4971a81f2bc53336 1
|
||||
1940855427039232 a550f543318f81a5ae5be8f465d37ceb 1
|
||||
1940855435427840 224b475732488ee277e92ddc6d62d513 1
|
||||
1940855442964480 1782360ba52b2e6398fd045f7efc3886 1
|
||||
1940855449845760 9ccf00f09b342d7f0bd3fcde78dbd669 1
|
||||
1940855459151873 820f116afc07afa33dccd3c7c91b224a 1
|
||||
1940855467278336 c59a4f23b2a8a2b87dd664bb40687a0a 1
|
||||
1940855482089472 757f0def3314882b838df12c7dfc4e73 1
|
||||
1940855498014720 3fa0751b8ed69f06ee05a98f62427805 1
|
||||
1940855507386368 dd3be33cea24c95536cd6b37b5628070 1
|
||||
1940855515316224 3d0d0407e19b6371ccede416b8dc4c11 1
|
||||
1940855515447296 cd2c8634dee9a1ace6fd35069c9213ca 1
|
||||
1940855521869824 acd0051e50c0629bc54b59e2b701a680 1
|
||||
1940855523311616 b2ca13e8b495fb030fa931015f2cd9f0 1
|
||||
1940855523246080 41a46d21e6e96be8a0f2ecc1d3b79d15 1
|
||||
1940855538057216 52e7c123c8bf57d417e027d0956fa776 1
|
||||
1940855539040256 e949e14dfab4921bd6a7cf3afe4f67c1 1
|
||||
1940855578361856 404c6f7ebdeba30cc1ee5a40a20f513f 1
|
||||
1940855579082752 2b34a136bdb4f01a7463e97d132ede2b 1
|
||||
1940855580983296 92af32ff3ea1d1178abb82c83d7e3c4f 1
|
||||
1940855586947072 ac20fd3de3796291952629c423689de0 1
|
||||
1940855602675712 c2da464d95fd75a04fe69c6564f5eb14 1
|
||||
1940855610671104 9a25439e6ae5bdb5b1e4137351122b29 1
|
||||
1940855621484544 e6fd820de5d791b88eefca6bd1cd1434 1
|
||||
1940855634788352 1b2fc615bf4240fb7ca7b8ee3f22b36f 1
|
||||
1940855634788353 d909032d5474516747fccd9bc91a7d96 1
|
||||
1940855905714176 fe1424e3006baeb5b379888b6e7305f3 1
|
||||
1940855929765888 7b19129819284553c5496c49c84e1e9b 1
|
||||
1940855930355712 e62598ee6b5957a0c84048d59c4c4e11 1
|
||||
1940855938351104 a60d43b857c4615814f0f147bc310e9c 1
|
||||
1940855943921664 463b58f1b73db133a840b22770e00495 1
|
||||
1940855946280960 91b555afbe3c7b14766694df47065bf8 1
|
||||
1940855946805248 9edf0851de04ab23db0e8f50d55e6a97 1
|
||||
1940855951851520 2c1c33a05cf22d49510b89825606538f 1
|
||||
1940855959846912 a9231fa51a2081efc1ef3f5606d98854 1
|
||||
1940855962664960 d8ff818933ea1922a5cb9f83a85c4543 1
|
||||
1940855967907840 a1583b3dc309960bca834746e986a824 1
|
||||
1940855970922496 189e8005f5223c2d3e040212ee211952 1
|
||||
1940855971381248 3663ea0446232be36072f177d35427ad 1
|
||||
1940855976034304 cbbd6d4e39d312732feaba46e536b0e1 1
|
||||
1940855978786816 ce95a9de9d90f1c3816b331c69e79d84 1
|
||||
1940855984357376 99b8e986374420718d8066a62e7859dc 1
|
||||
1940856006770688 de1a422e8a81f2567a759bb77512dfa8 1
|
||||
1940856027545600 cc3c453666751a9057189be82497bcec 1
|
||||
1940856075911168 2f21818271817d996916597acf3ab3f5 1
|
||||
1940856084824064 3982ec13ea4f8e06294ded23c626f04b 1
|
||||
1940856089673728 09aaddd391311ec2a9e05e776cb4d5b8 1
|
||||
1940856091836416 91a72080f897a7c32537c49eb3d77b91 1
|
||||
1940856091836417 902b24cac3787b1ff12a5f49e1261613 1
|
||||
1940856092819456 d68044bf16d125b6ef20e225b5fcffff 1
|
||||
1940856093278208 0ab2288c9be0620193b1cf4ee6b0c4a2 1
|
||||
1940856099897344 00a347c995ff7cff63e5b3218b3ebe65 1
|
||||
1940856101470208 ad5e3bf93b37d4861a49f3af3add4fa5 1
|
||||
1940856103698432 85ed891e1567bb0aa0dad41daefc7fb7 1
|
||||
1940856103763968 30a55b2f102b5d0109946b93533353d9 1
|
||||
1940856105730048 5d8f5e011183a671ecd62afa94512acb 1
|
||||
1940856107696128 b2d954422d90b3e130d3fcc9cab58c3f 1
|
||||
1940856107696129 2ea69b7d12799635a043b51ea447f05e 1
|
||||
1940856109400064 dc9651c6dd88a6088b4bb421dc7bb322 1
|
||||
1940856113725440 d86bb9bf100db6312303397aba5ed778 1
|
||||
1940856115822592 e0a588ad58c3cba6cd26df21eb5b6445 1
|
||||
1940856131747840 5e16c2afdb7348e5a8e4cff4892e29d0 1
|
||||
1940856133058560 011d458237281d8b2fb4ea1d581033b2 1
|
||||
1940856141185024 49adba03763ffc20402a25b1d8bf1fad 1
|
||||
1940856149573632 12e71fa38b8991d71ab8d16f5d1cd425 1
|
||||
1940856154161152 abeac59b64c16c3e93564eff51a812b5 1
|
||||
1940856165629952 a7fd882e5766f95c024eb7c72ccf5642 1
|
||||
1940856173756416 f6b70fa645f4e9ed5939046d0ef62d5a 1
|
||||
1940856174215168 cf903e086e91dd9a049574318958e449 1
|
||||
1940856178147328 8e60d1351fc88ee0ace9e76f7aa33c4e 1
|
||||
1940856178212864 74df38bc9ea5407f22742ac129303fe4 1
|
||||
1940856182145024 56dc01f6aff0c418797eacef82f579e5 1
|
||||
1940856205737984 8f777ab23cec8503500b5444050d6573 1
|
||||
1940856222187520 2932791ec18eda1d929ea87219ea7752 1
|
||||
1940856226775040 bd8e0af3a4c55ea2fd8580b6cdf2a2aa 1
|
||||
1940856230772736 262f9d050fcd161c06b455b31831ec4a 1
|
||||
1940855658512384 ee075ac43f1451fcc2a34413cf7ac016 1
|
||||
1940855666245632 368480e2a1a2695d6b44dfe553ed70cb 1
|
||||
1940855674765312 d93efdcea4ee10818a160966dc17081f 1
|
||||
1940855677190144 514a5016496d7223cf1019a420a1b3cb 1
|
||||
1940855682433024 74c53aac6f92de2c1f7b9578a6838388 1
|
||||
1940855685120000 2c84ff929c4898c16c04ed1a0b2219f7 1
|
||||
1940855692984320 afedaa08c86fb3a4c00a99e8d2de2c7f 1
|
||||
1940855714021376 57ab8e08e51d9640d5980d92b88c576d 1
|
||||
1940855721951233 d94fb11dcf3505fe6d87aa82b1c2ff20 1
|
||||
1940855725621248 52c8d351d3e0a8397d32b91712312506 1
|
||||
1940855733551104 2f4841474c796171135acad6a6b050e1 1
|
||||
1940855745675264 6ab70552253e56bc908a5a747f6d5286 1
|
||||
1940855746920448 d377b64044a5754c62032497aa0b36eb 1
|
||||
1940855769399296 b2be3e1152c0848039cc400bcee35483 1
|
||||
1940855770841088 1bd9d00358d2a76f9a5abe3c15d30245 1
|
||||
1940855793778688 d2cb3d30a733a56fda80b62332cc7e0e 1
|
||||
1940855793844224 9fcd4c3e047a3118ebfa82b4eb423142 1
|
||||
1940855806427136 40432752125636d9f3e0010d93ffa881 1
|
||||
1940855814225920 3d93a1490952f2ea6dc27cb45e57667c 1
|
||||
1940855818158080 dca7028395da7737e339f9ffb8ac277c 1
|
||||
1940855818027008 c658073ec3957e3e66880c35de8a8c4e 1
|
||||
1940855826022400 a36c264dfeb28c6787f3bdc494cd4532 1
|
||||
1940855834083328 fec9510ea92f7af8d253ba074d4ef63f 1
|
||||
1940855834083329 785e7ef822d66644b8d5b14a976b5be1 1
|
||||
1940855838670848 2a78a17d8f1281149527d370f0c62391 1
|
||||
1940855841947648 eb817acef3419ef3d291cba7e4bd7535 1
|
||||
1940855850008576 ce02230ca579892ecd2efe30771193e3 1
|
||||
1940855854792704 4d82a748a57534af3b0aee1d8b9ad145 1
|
||||
1940855862722560 75073e1bbaaab013096425c763eb3cd2 1
|
||||
1940855865933824 aa034167ef1de02a4010365587f95e45 1
|
||||
1940855873994752 c377c7ea540ea8d928e94542bb810b9c 1
|
||||
1940855879237632 b1db617e89505b07d88afa8854e059be 1
|
||||
1940855881793536 1b89575b587475afd98edc2782bf0ae5 1
|
||||
1940855887364096 f80baee08490378d6fb4121a89ad39a7 1
|
||||
1940855895425024 2c0b62fdd6436970ba63f2b5b2de90b9 1
|
||||
1940855897980928 2edd8029b12fd392c7a4262ef4d8b89a 1
|
||||
1940855897980930 a67e4c6e6fc7b34e2702ee9294f873fb 1
|
||||
1940856426528768 d6ae35d977178d47abb4f89abe6aa6c8 1
|
||||
1940856426266624 427885e3a4a71d53a770b048dbf22c14 1
|
||||
1940856427642880 1c1aeb70d8fadea5448ac820afce336d 1
|
||||
1940856434458624 0ce3a822fdbd620e97c4a19f604a9d2a 1
|
||||
1940856444551168 ccb688428117e4fe457f9828a4c53d0d 1
|
||||
1940856444616704 46a47c0285cadeb937ea9552ae11e2e5 1
|
||||
1940856458117120 fb7c3771fea89a29db909618c0a8331a 1
|
||||
1940856460607488 c24cde4f1beb9afabbe5cb86a4c8d891 1
|
||||
1940856474697728 20ecb7b620a42afea728cbd76715ebc3 1
|
||||
1940856484986880 68f4ddae107ad9b1c32bf22cbb6e1851 1
|
||||
1940856493309952 b0e0fc2f59d8148b5f18bfce88d0efe7 1
|
||||
1940856493637632 3c1dbdac5a149f317f64af286b0d2047 1
|
||||
1940856510283776 db7bbad982402f2a81bf71f91344f162 1
|
||||
1940856539250688 8b4191f592a7c937f58ffde794060e25 1
|
||||
1940856541347840 d4cf26f921206de7fd254145c164d2e7 1
|
||||
1940856550326272 822709c49f775ce9a01ee26a672f4a5b 1
|
||||
1940856558452736 578c3423e032ed8e5a81bd6ea05c9b8c 1
|
||||
1940856561401856 96e4333e98439698cd96cf0f01dc35a6 1
|
||||
1940856564678656 91acdc06aba8be416a7df01e7f80dec7 1
|
||||
1940856566382592 039ed8ad20d5b6ff5d957c69801ee45b 1
|
||||
1940856569266176 b886de4944c12b6fad7c338ee23fbbfc 1
|
||||
1940856573001728 6f035023cbab708d6a1e28be395be1e1 1
|
||||
1940856773869568 8440c100fcddc3d1e7e1eac63c7d3421 1
|
||||
1940856783241216 e3d7700a3c9e5aff7eb4491c2844c75c 1
|
||||
1940856809062400 a65865baef281fe77322b5e146c9bcd2 1
|
||||
1940856951078912 67163344a9113a7352c7a7ac1e53aee4 1
|
||||
1940857131040768 94bc5a2102a4bc7c4931dbc826397bdd 1
|
||||
1940857139888128 12aa82090b095b29432ccdb0cf131a24 1
|
||||
1940857277644800 04a01ea95229e2e86cd783e5b1fcbb16 1
|
||||
1940857298288640 4b5905e68a5e9e150349c713f470b9a8 1
|
||||
1940857469599744 cbcfdff16730295094803ecd5cb6c597 1
|
||||
1940857622691840 7d40192c5441d06d8cefe76c0ab93d21 1
|
||||
1940857771720704 e93f62761a158b819009a3922d68a817 1
|
||||
1940857784369152 38ddd5da6c54eeb7c1df5f3517b6e178 1
|
||||
1940857907314688 5440110e253851a8628b371ec76dbfed 1
|
||||
1940857960136704 f8e47285ca6d4615391e2c72f2fdad1f 1
|
||||
1940858014138368 e21d2d77a5df2d2ffb7e95993488f036 1
|
||||
1940858028425216 d517193c163cbff87eaa293f415128b4 1
|
||||
1940858086162432 8e45e7603b03617c5c470b21a068253b 1
|
||||
1940858088259584 8d31b83d1fbbc4dafeb1fec1d9af4fe2 1
|
||||
1940873266462720 cc9a8f782a05db3e6db0fd2903bc9382 1
|
||||
1940873318563840 795a81e7da57225261220313d2b1894d 1
|
||||
1940873318563841 b2d2f33da2661261223cbc36025ce3e7 1
|
||||
1940873326559232 d19cf5f22a2dcc6a838935d4eb603c40 1
|
||||
1940873890627584 05335bb8022663a45e0db265c22b81fa 1
|
||||
1940873898229760 8b08823e5b0913d61956cf2dd7a0f596 1
|
||||
1940873953214464 464551667e156b76ab5833ea1c799910 1
|
||||
1940873953738752 55dc6a75dbe250249f75dd4402e6bcb6 1
|
||||
1940873955573760 b1a2e2336c07b07a4ea41b9cda9568c4 1
|
||||
1940874214440960 2403b935170f746c25f793f8bf356924 1
|
||||
1940874216144896 f3bb0d8742c357f99f5f30b70351a4e3 1
|
||||
1940874216669184 5d2bbb7cb0c2fc43c87014e25ac69a8f 1
|
||||
1940874274406400 b2607a8856a864cadc51cd53b2b5f264 1
|
||||
1940874364846080 aa227122b9549cb6030268ea8cabb095 1
|
||||
1940874523181056 607d91a9104fecc8f171db1784f141c5 1
|
||||
1940874566369280 573e574c89ddbbd567e922ca39903831 1
|
||||
1940874827071488 ba5d7dacaadd4b20df40a048511ac013 1
|
||||
1940874862985216 18cebbb39828a094716c1df4f86bada4 1
|
||||
1940874901651456 bdf5721c7584ade606a3912d23073b43 1
|
||||
1940874902437888 a333ad07eec924c14ac96bfd19ec96b5 1
|
||||
1940875114774528 432516bd4a25aa62d28b5d0f91040349 1
|
||||
1940875114774529 33d3778bbf511fe091f6e2d5483101f4 1
|
||||
1940875115167744 fb4dcc812c271008fd2e3828002c7434 1
|
||||
1940875115167745 8ad84566f1878f2cbe22c959bc2ddb17 1
|
||||
1940875119034368 658ded9763b3a9ed200418d5ac7e3e19 1
|
||||
1940878937161728 b0ce7d0bcb5f291ec57d42e20bf32e33 1
|
||||
1940878951383040 6267e291b696b109e887adc0c0dd9355 1
|
||||
1940878957871104 f2a980288bdadb8552e7e96e3bafa0b3 1
|
||||
1940878967308288 b1b9bc9fa36ccda663496b389bbb058c 1
|
||||
1940878974386176 c310158a27a348eca25b892671d20534 1
|
||||
1940879026094080 fe0733519a9990d5eb9bbbc4aba322ee 1
|
||||
1940879043919872 f50b92044e88db7e62079262e11fb7a2 1
|
||||
1940879047983104 e17213020d2f77059f7c1fabc8daad50 1
|
||||
1940879077081088 d7481d983be32f0e7a6c2db97f175404 1
|
||||
1940879084814336 937f580d4b67ea4edfc0c469afe49d1d 1
|
||||
1940879090843648 a7c1f44a05f663e8d07c955b4e3813d3 1
|
||||
1940879123087360 4d28c23b491d02b90f316b7d4931a3cf 1
|
||||
1940879125250048 118b995f69c12b69a1a9a12b62b03d75 1
|
||||
1940879127871488 ddafda78ff0e4454e929821646201a73 1
|
||||
1940879178727424 497e4829b19e8544565ad23afac0ff54 1
|
||||
1940880460087296 8aee05bf62820fee4bcd1a124bab139d 1
|
||||
1940880467099648 2615ff688f751b1815f5985f52cc63e3 1
|
||||
1940880470900736 574ad6fc735223a7e79071762fbcbc64 1
|
||||
1940890051870720 24c9e1a768fa58ba69ade4a96e458249 1
|
||||
@@ -0,0 +1,25 @@
|
||||
24
|
||||
1 1 1 0 1 0 3 1 1
|
||||
2 1 1 0 1 0 3 1 1
|
||||
3 1 1 0 1 0 3 1 1
|
||||
4 1 1 0 1 0 3 1 1
|
||||
5 1 1 0 1 0 3 1 1
|
||||
6 1 1 0 1 0 3 1 1
|
||||
7 1 1 0 1 0 3 1 1
|
||||
8 1 1 0 1 0 3 1 1
|
||||
9 1 1 0 1 0 3 1 1
|
||||
10 1 1 0 1 0 3 1 1
|
||||
11 1 1 0 1 0 3 1 1
|
||||
12 1 1 0 1 0 3 1 1
|
||||
13 1 1 0 1 0 3 1 1
|
||||
14 1 1 0 1 0 3 1 1
|
||||
15 1 1 0 1 0 3 1 1
|
||||
16 1 1 0 1 0 3 1 1
|
||||
17 1 1 0 1 0 3 1 1
|
||||
18 1 1 0 1 0 3 1 1
|
||||
19 1 1 0 1 0 3 1 1
|
||||
20 1 1 0 1 0 3 1 1
|
||||
21 1 1 0 1 0 3 1 1
|
||||
22 1 1 0 1 0 3 1 1
|
||||
23 1 1 0 1 0 3 1 1
|
||||
24 1 1 0 1 0 3 1 1
|
||||
26
bin/conf/maat_pz/full/2015-11-05/TARGET_APP_GROUP.0000000001
Normal file
26
bin/conf/maat_pz/full/2015-11-05/TARGET_APP_GROUP.0000000001
Normal file
@@ -0,0 +1,26 @@
|
||||
24
|
||||
10001 1 1
|
||||
10002 2 1
|
||||
10003 3 1
|
||||
10004 4 1
|
||||
10005 5 1
|
||||
10006 6 1
|
||||
10007 7 1
|
||||
10008 8 1
|
||||
10009 9 1
|
||||
10010 10 1
|
||||
10011 11 1
|
||||
10012 12 1
|
||||
10013 13 1
|
||||
10014 14 1
|
||||
10015 15 1
|
||||
10016 16 1
|
||||
10017 17 1
|
||||
10018 18 1
|
||||
10019 19 1
|
||||
10020 20 1
|
||||
10021 21 1
|
||||
10022 22 1
|
||||
10023 23 1
|
||||
10024 24 1
|
||||
|
||||
25
bin/conf/maat_pz/full/2015-11-05/TARGET_APP_NAME.0000000001
Normal file
25
bin/conf/maat_pz/full/2015-11-05/TARGET_APP_NAME.0000000001
Normal file
@@ -0,0 +1,25 @@
|
||||
24
|
||||
20001 10001 circuitiOS 0 0 0 1
|
||||
20002 10002 keek 0 0 0 1
|
||||
20003 10003 path 0 0 0 1
|
||||
20004 10004 snapvpn 0 0 0 1
|
||||
20005 10005 puffin 0 0 0 1
|
||||
20006 10006 glympse 0 0 0 1
|
||||
20007 10007 pinterest 0 0 0 1
|
||||
20008 10008 operramini1km 0 0 0 1
|
||||
20009 10009 turbovpn 0 0 0 1
|
||||
20010 10010 youfreedom 0 0 0 1
|
||||
20011 10011 hola 0 0 0 1
|
||||
20012 10012 shadowsocks 0 0 0 1
|
||||
20013 10013 vpngateviewer 0 0 0 1
|
||||
20014 10014 badoo 0 0 0 1
|
||||
20015 10015 hotspotshield 0 0 0 1
|
||||
20016 10016 betternet 0 0 0 1
|
||||
20017 10017 Tumblr 0 0 0 1
|
||||
20018 10018 Whisper 0 0 0 1
|
||||
20019 10019 Instagram 0 0 0 1
|
||||
20020 10020 Paltalk 0 0 0 1
|
||||
20021 10021 Twitter 0 0 0 1
|
||||
20022 10022 Telegram 0 0 0 1
|
||||
20023 10023 自由门 0 0 0 1
|
||||
20024 10024 无界 0 0 0 1
|
||||
3
bin/conf/maat_pz/full/index/full_config_index.0000000001
Normal file
3
bin/conf/maat_pz/full/index/full_config_index.0000000001
Normal file
@@ -0,0 +1,3 @@
|
||||
TARGET_APP_NAME 24 /home/zhangchengwei/maskey/conf/maat_pz//full//2015-11-05//TARGET_APP_NAME.0000000001
|
||||
TARGET_APP_COMPILE 24 /home/zhangchengwei/maskey/conf/maat_pz//full//2015-11-05//TARGET_APP_COMPILE.0000000001
|
||||
TARGET_APP_GROUP 24 /home/zhangchengwei/maskey/conf/maat_pz//full//2015-11-05//TARGET_APP_GROUP.0000000001
|
||||
44
bin/conf/maat_pz/json/maat_json.json
Normal file
44
bin/conf/maat_pz/json/maat_json.json
Normal file
@@ -0,0 +1,44 @@
|
||||
{
|
||||
"compile_table": "TARGET_APP_COMPILE",
|
||||
"group_table": "GROUP2",
|
||||
"rules": [
|
||||
{
|
||||
"compile_id": 125,
|
||||
"service": 1,
|
||||
"action": 1,
|
||||
"do_blacklist": 1,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "anything",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "group_1",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "TARGET_APP_NAME",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "Duplicate",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"plugin_table": [
|
||||
{
|
||||
"table_name": "APP_PKG_INFO",
|
||||
"table_content": [
|
||||
"191889408\t93f6e44fab0985f5e981af2e1615c30f\t1",
|
||||
"190644224\t3ddca28ae783b95add6b4542b2bb92cd\t1",
|
||||
"193462272\t29f6afcdfc7ae07c2130fa07879f2787\t1",
|
||||
"191889408\t93f6e44fab0985f5e981af2e1615c30f\t0"
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
@@ -0,0 +1,5 @@
|
||||
0000000004
|
||||
191889408 93f6e44fab0985f5e981af2e1615c30f 1
|
||||
190644224 3ddca28ae783b95add6b4542b2bb92cd 1
|
||||
193462272 29f6afcdfc7ae07c2130fa07879f2787 1
|
||||
191889408 93f6e44fab0985f5e981af2e1615c30f 0
|
||||
@@ -0,0 +1,2 @@
|
||||
0000000001
|
||||
0 125 1
|
||||
@@ -0,0 +1,2 @@
|
||||
0000000001
|
||||
125 1 1 1 1 0 anything 1
|
||||
@@ -0,0 +1,2 @@
|
||||
0000000001
|
||||
0 0 Duplicate 0 0 0 1
|
||||
@@ -0,0 +1,4 @@
|
||||
TARGET_APP_COMPILE 1 ./conf/maat_pz/json/maat_json.json_iris_tmp/TARGET_APP_COMPILE.local
|
||||
GROUP2 1 ./conf/maat_pz/json/maat_json.json_iris_tmp/GROUP2.local
|
||||
TARGET_APP_NAME 1 ./conf/maat_pz/json/maat_json.json_iris_tmp/TARGET_APP_NAME.local
|
||||
APP_PKG_INFO 4 ./conf/maat_pz/json/maat_json.json_iris_tmp/APP_PKG_INFO.local
|
||||
12
bin/conf/maat_pz/json/table_info.conf
Normal file
12
bin/conf/maat_pz/json/table_info.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
#each collumn seperate with '\t'
|
||||
#id (0~65535(
|
||||
#name string
|
||||
#type one of ip,expr,compile or plugin
|
||||
#src_charset one of GBK,BIG5,UNICODE,UTF8
|
||||
#dst_charset combined by GBK,BIG5,UNICODE,UTF8,seperate with '/'
|
||||
#do_merege yes or no
|
||||
#id name type src_charset dst_charset do_merge
|
||||
0 TARGET_APP_COMPILE compile UTF8 GBK no
|
||||
1 GROUP2 group UTF8 GBK/BIG5/UNICODE/UTF8 yes
|
||||
2 APP_PKG_INFO plugin UTF8 GBK/BIG5/UNICODE/UTF8 yes
|
||||
3 TARGET_APP_NAME expr UTF8 GBK/BIG5/UNICODE/UTF8 yes
|
||||
12
bin/conf/maat_pz/table_info.conf
Normal file
12
bin/conf/maat_pz/table_info.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
#each collumn seperate with '\t'
|
||||
#id (0~65535(
|
||||
#name string
|
||||
#type one of ip,expr,compile or plugin
|
||||
#src_charset one of GBK,BIG5,UNICODE,UTF8
|
||||
#dst_charset combined by GBK,BIG5,UNICODE,UTF8,seperate with '/'
|
||||
#do_merege yes or no
|
||||
#id name type src_charset dst_charset do_merge
|
||||
0 TARGET_APP_COMPILE compile UTF8 UTF8 no
|
||||
1 TARGET_APP_GROUP group UTF8 UTF8 no
|
||||
2 APP_PKG_INFO plugin UTF8 GBK/BIG5/UNICODE/UTF8 yes
|
||||
3 TARGET_APP_NAME expr UTF8 GBK/BIG5/UNICODE/UTF8 yes
|
||||
235
bin/conf/main.conf
Normal file
235
bin/conf/main.conf
Normal file
@@ -0,0 +1,235 @@
|
||||
#--------------------------------------------------------------------NETWORK
|
||||
[NETWORK]
|
||||
LocalIP=em1
|
||||
FwdIP=em1
|
||||
|
||||
#recv bizman param, recv data from sapp
|
||||
BizmanAckSmoothTime = 10
|
||||
BizmanAckAccumulateTime=10
|
||||
BizmanAckAccumulateNum=5
|
||||
BizmanPort=22082
|
||||
|
||||
#sapp recv resp msg port
|
||||
BizmanAckPort=22084
|
||||
|
||||
#msg port:recv msg
|
||||
MsgPort=22080
|
||||
|
||||
#unix-domain socket file path <20><>send frag
|
||||
UnixSocketSendSrcAddr=/home/mesasoft/frag_rssb/un_send
|
||||
UnixSocketSendDestAddr=/home/mcger/un_recv;/home/audiorecognition/aufilter/un_recv
|
||||
#udp socket recv port <20><>recv response msg
|
||||
UnixSocketRecvAddr=/home/mesasoft/frag_rssb/un_recv
|
||||
|
||||
#udp socket:send frag
|
||||
UdpSendIP=127.0.0.1;
|
||||
UdpSendIPNum=1
|
||||
UdpSendPort=33082
|
||||
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4><EFBFBD><EFBFBD><EFBFBD>
|
||||
USM_ON_FLAG=0
|
||||
USM_SHM_KEY=1635151988
|
||||
#USM_SHM_KEY=12346
|
||||
USM_SHM_SIZE=100000
|
||||
USM_READER_CNT=3
|
||||
USM_SMOOTH_TIME=1000000
|
||||
USM_Q_SIZE=1048576
|
||||
USM_READER_PATH=/home/mcger/un_recv;/home/audiorecognition/aufilter/un_recv;/home/mesasoft/un_test/un_recv
|
||||
USM_LOG_LEVEL=40
|
||||
USM_LOG_PATH=./log/usm_writer0;./log/usm_writer1;./log/usm_writer2
|
||||
|
||||
#special media type, send windows system , sep: ";" : IP1+PORT1/PORT2 or IP2+PORT1/PORT2
|
||||
SpecialMediaWindowsIP=10.0.6.5;10.0.6.1;
|
||||
SpecialMediaWindowsIPNum=2
|
||||
SpecialMediaWindowsPort=44096;44098
|
||||
|
||||
#white list IP and PORT : IP1+PORT and IP2+PORT
|
||||
WhiteListIP = 10.52.178.15;
|
||||
WhiteListIPNum=1
|
||||
WhiteListPort=22085
|
||||
#--------------------------------------------------------------------SYSTEM
|
||||
[SYSTEM]
|
||||
#cpz<70><7A><EFBFBD><EFBFBD> 0:AV_PIC 1:voip
|
||||
CPZTpye=0
|
||||
|
||||
ThreadNum=1
|
||||
BizmanQueueMode=0
|
||||
BizmanQueueMaxnum=2000000
|
||||
|
||||
AsmisSwitch=1
|
||||
|
||||
#<23><>ǰ<EFBFBD>˷<EFBFBD><CBB7>ͽ<EFBFBD>Ŀȷ<C4BF><C8B7>
|
||||
AckSwitch=0
|
||||
|
||||
#IVIȥ<49>ؿ<EFBFBD><D8BF><EFBFBD>
|
||||
IVISwitch=0
|
||||
|
||||
#<23><><EFBFBD>ͽӿ<CDBD><D3BF>Ƿ<EFBFBD><C7B7><EFBFBD><EFBFBD><EFBFBD>AV_sendback
|
||||
AVSendbackSwitch=1
|
||||
|
||||
#index<65>ڶ<EFBFBD><DAB6>η<EFBFBD><CEB7><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
IndexQueryTime=10
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>ʱ<EFBFBD><CAB1><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
IndexQueryTimerCbMaxNum=500
|
||||
|
||||
#media renew time
|
||||
RenewTimeMax=7200
|
||||
RenewTimeMin=600
|
||||
RenewTimeStep=6
|
||||
|
||||
#<23><>ĿHASH<53><48>
|
||||
MediaHashSize=65536
|
||||
MediaHashElemNum=1048576
|
||||
MediaHashExpireTime=300
|
||||
|
||||
#<23><><EFBFBD>ٻ<EFBFBD>дhash<73>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>DumpfileHashElemNum<75><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ŀ
|
||||
DumpfileHashSize=1024
|
||||
DumpfileHashElemNum=512
|
||||
DumpfileHahsExpireTime=120
|
||||
|
||||
#monitor service
|
||||
MonitorHashSize=65536
|
||||
MonitorHashElemNum=1048576
|
||||
MonitorHahsExpireTime=120
|
||||
|
||||
MonitorFileSwitch=1
|
||||
MonitorFileRootDir=/home/yspdata/qd_monitor/
|
||||
MonitorFileDay=1
|
||||
|
||||
#special media type, send windows system
|
||||
ForwardSpecialMediaSwitch=1
|
||||
SpecialMediaType=0x68
|
||||
|
||||
#AV record switch
|
||||
AVRecordFileSwitch=1
|
||||
AVRecordFileRootDir=./AVrecord/
|
||||
AVRecordFileMaxNum=100000
|
||||
|
||||
#ģ<><C4A3>hashժҪ<D5AA><D2AA><EFBFBD>㿪<EFBFBD><E3BFAA>
|
||||
FuzzyDigestSwitch=1
|
||||
|
||||
#Ԫ<><D4AA>Ϣѡ<CFA2><D1A1>capIP<49>Ƿ<EFBFBD><C7B7><EFBFBD> 1<><31><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>capIP, 0:ѡ<><D1A1>Ϊǰ<CEAA>˻<EFBFBD>CapIP
|
||||
ModifyCapIPSwitch=1
|
||||
|
||||
#==============================================================DEDUP
|
||||
[DEDUP]
|
||||
#av_dedup service <20><><EFBFBD>ض<EFBFBD>Դҵ<D4B4><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
ThriftIP=127.0.0.1;
|
||||
ThriftIPNum=1
|
||||
ThriftPort=9090
|
||||
DedupBalanceNum=1000
|
||||
DedupQueueNum=100000
|
||||
DedupStatInterval=60
|
||||
DedupThriftTime=5
|
||||
DedupHtableArg=0
|
||||
|
||||
#<23><><EFBFBD>ض<EFBFBD>Դҵ<D4B4><EFBFBD>
|
||||
AVDedupSwitch=1
|
||||
AVDedupInvalid=0
|
||||
#td=(URL+ServerIP...)+data(<=65536)
|
||||
DedupTdDataSize=65536
|
||||
#<23><>Դ<EFBFBD>ȴ<EFBFBD><C8B4>ij<EFBFBD>ʱʱ<CAB1><CAB1>
|
||||
MultiWaitTimeout=30
|
||||
#<23><>Դ<EFBFBD><D4B4>ʱ<EFBFBD><CAB1><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MultiTimerCbMaxNum=500
|
||||
|
||||
#av_dedup log
|
||||
DedupLogLevel= 10
|
||||
DedupLogPath= ./log/dedup.log
|
||||
#==============================================================MULTIMEDIA
|
||||
[MULTIMEDIA]
|
||||
#JSON to kafka <20><>ý<EFBFBD><C3BD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ش<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MediaJSONKafkaBrokers=
|
||||
|
||||
#media info send to kfaka <20><>ý<EFBFBD><C3BD>JSON<4F><4E>Ϣ<EFBFBD>ش<EFBFBD>KAFKA<4B><41><EFBFBD><EFBFBD>
|
||||
MediaJSONSwitch=1
|
||||
|
||||
#==============================================================VOIP
|
||||
[VOIP]
|
||||
VOIPFilterSwitch=1
|
||||
|
||||
#VOIP survey log <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
VOIPSurveyLogIP=
|
||||
VOIPSurveyLogIPNum=
|
||||
VOIPSurveyLogPort=
|
||||
|
||||
#VOIP total log ȫ<><C8AB><EFBFBD><EFBFBD>־
|
||||
VOIPFullLogIP=
|
||||
VOIPFullLogIPNum=
|
||||
VOIPFullLogPort=
|
||||
|
||||
#voip log
|
||||
VOIPLogLevel= 30
|
||||
VOIPLogPath= ./log/voip.log
|
||||
|
||||
#==============================================================APP
|
||||
[APP]
|
||||
#<23>ֻ<EFBFBD>app<70><70><EFBFBD><EFBFBD>
|
||||
AppSwitch=0
|
||||
|
||||
|
||||
#--------------------------------------------------------------------LOG
|
||||
[LOG]
|
||||
AppName=rssb
|
||||
StatRemoteSwitch=
|
||||
StatServerIP=
|
||||
StatServerPort=
|
||||
|
||||
#field_stat
|
||||
StatCycle=2
|
||||
StatFile=./log/rssb_stat.log
|
||||
|
||||
SysinfoCycle=2
|
||||
SysinfoFile=./log/rssb_sysinfo.log
|
||||
|
||||
#log in general
|
||||
LogLevel= 10
|
||||
LogPath= ./log/runtime.log
|
||||
|
||||
#frag msg log
|
||||
FragLogLevel= 10
|
||||
FragLogPath= ./log/frag.log
|
||||
|
||||
#resp msg log
|
||||
RespLogPath= ./log/survey.log
|
||||
|
||||
#media create log
|
||||
MediaCreateLogPath= ./log/media_create.log
|
||||
|
||||
#media expire log
|
||||
MediaExpireLogPath= ./log/media_expire.log
|
||||
|
||||
#--------------------------------------------------------------------DEBUG
|
||||
[DEBUG]
|
||||
/*<2A><>Ŀ<EFBFBD><C4BF><EFBFBD>б<EFBFBD><D0B1>ش洢*/
|
||||
FileStoreSwitch=0
|
||||
FileStorePath=./log/file/
|
||||
|
||||
/*<2A><><EFBFBD>н<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1>ظ<EFBFBD><D8B8>ٻ<EFBFBD>д*/
|
||||
AllHitMonitorSwitch=2
|
||||
AllHitMonitorCompleteRate=90
|
||||
AllHitMonitorFilenameType=1
|
||||
|
||||
#1: (reoffset-1)*content-length 0: accoffset
|
||||
HlsAboffsetInMode=1
|
||||
|
||||
/*<2A><>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7>־*/
|
||||
FragSurveyInvalid=0
|
||||
|
||||
/*JSON<4F>ļ<EFBFBD>д<EFBFBD><D0B4><EFBFBD><EFBFBD>*/
|
||||
JSONLocalSwitch=1
|
||||
|
||||
|
||||
[WLB]
|
||||
wlb_on=1
|
||||
wlb_topic=AV
|
||||
wlb_group_name=xx
|
||||
user_tag=xx
|
||||
health_check_port=52100
|
||||
health_check_interval=10
|
||||
data_port=30000
|
||||
capacity=32
|
||||
cost=32
|
||||
wlb_report_interval=10
|
||||
|
||||
hard_balance_port=20000
|
||||
1
bin/conf/mid_trace.conf
Normal file
1
bin/conf/mid_trace.conf
Normal file
@@ -0,0 +1 @@
|
||||
#mid or pid
|
||||
11
bin/conf/sifter/app_data.sft
Normal file
11
bin/conf/sifter/app_data.sft
Normal file
@@ -0,0 +1,11 @@
|
||||
[INFOR]
|
||||
sft_id = 3122
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
12
bin/conf/sifter/dash_data.sft
Normal file
12
bin/conf/sifter/dash_data.sft
Normal file
@@ -0,0 +1,12 @@
|
||||
[INFOR]
|
||||
sft_id = 5222
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$Tag$/vmind$/$?cdncode=$
|
||||
{2}{FRAG_UNIT_ID}={61}{C2S_URL}$Tag$/vmind$/$?cdncode=$
|
||||
13
bin/conf/sifter/dash_index.sft
Normal file
13
bin/conf/sifter/dash_index.sft
Normal file
@@ -0,0 +1,13 @@
|
||||
[INFOR]
|
||||
sft_id = 5221
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = [61][C2S_URL], [0xD1][S2C_CONTENT-DISPOSITION],[0xE1][C2S_CONTENT],[0xF1][S2C_CONTENT]
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$Tag$&vid=$\x0$&ad_type=$
|
||||
{2}{FRAG_UNIT_ID}={73}{S2C_CONTENT}$Tag$<image><index>0</index><url><![CDATA[http://$qq.com/$?vkey=$
|
||||
|
||||
57
bin/conf/sifter/frag_reassembly.conf
Normal file
57
bin/conf/sifter/frag_reassembly.conf
Normal file
@@ -0,0 +1,57 @@
|
||||
[NETWORK]
|
||||
RedisBrokers=10.0.6.80:9001,10.0.6.80:9002,10.0.6.80:9003,10.0.6.80:9004,10.0.6.80:9005
|
||||
RedisTimeout=5
|
||||
|
||||
[SYSTEM]
|
||||
ConvergeHashSize=65536
|
||||
ConvergeHashElemNum=1048576
|
||||
ConvergeHashExpireTime=120
|
||||
|
||||
#same with protocol in frag_monitor
|
||||
ProtocolNetdisk=17
|
||||
ProtocolWebmail=18
|
||||
|
||||
#webmail param================================start
|
||||
WebmailHashSize=65536
|
||||
WebmailHashElemNum=1048576
|
||||
WebmailHashExpireTime=120
|
||||
|
||||
StoreidAttachHashSize=65536
|
||||
StoreidAttachHashElemNum=1048576
|
||||
StoreidAttachHashExpireTime=120
|
||||
|
||||
StoreidMidHashSize=65536
|
||||
StoreidMidHashElemNum=1048576
|
||||
StoreidMidHashExpireTime=120
|
||||
|
||||
#0, not open iterate thread to output
|
||||
WebmailIterateTimeout=60
|
||||
WebmailAttachIterateTimeout=60
|
||||
|
||||
WebmailService=123,163,sina,sohu,qq
|
||||
WebmailAction=send,recv
|
||||
#webmail param================================end
|
||||
|
||||
[LOG]
|
||||
#frag reassembly log <20><><EFBFBD><EFBFBD>ƴ<EFBFBD>ӵ<EFBFBD><D3B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
FragReassemblyLogLevel=30
|
||||
FragReassemblyLogName=./frag_reassembly.log
|
||||
|
||||
#media log
|
||||
MediaLogLevel=30
|
||||
MediaLogName=./frag_reassembly_media.log
|
||||
|
||||
#stat log
|
||||
StatInterval=5
|
||||
StatFile=./frag_reassembly_stat.log
|
||||
SysinfoInterval=5
|
||||
SysinfoFile=./frag_reassembly_sysinfo.log
|
||||
|
||||
#webmail log
|
||||
WebmailLogLevel=10
|
||||
WebmailLogName=./webmail.log
|
||||
|
||||
#Maat
|
||||
MaatStatSwitch=0
|
||||
MaatPerfSwitch=0
|
||||
#MaatStatFile=./maat_stat.log
|
||||
12
bin/conf/sifter/hls_data.sft
Normal file
12
bin/conf/sifter/hls_data.sft
Normal file
@@ -0,0 +1,12 @@
|
||||
[INFOR]
|
||||
sft_id = 2122
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
{2}{FRAG_UNIT_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
13
bin/conf/sifter/hls_index.sft
Normal file
13
bin/conf/sifter/hls_index.sft
Normal file
@@ -0,0 +1,13 @@
|
||||
[INFOR]
|
||||
sft_id = 2121
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = [61][C2S_URL], [0xD1][S2C_CONTENT-DISPOSITION],[0xE1][C2S_CONTENT],[0xF1][S2C_CONTENT]
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
{2}{FRAG_UNIT_ID}={73}{S2C_CONTENT}$Tag$#EXTINF:$,\x0a$\x0a$
|
||||
{4}{FRAG_UNIT_REOFFSET}={73}{S2C_CONTENT}$Tag$#EXT-X-MEDIA-SEQUENCE:$\x0$\x0a$
|
||||
12
bin/conf/sifter/iqiyi_data.sft
Normal file
12
bin/conf/sifter/iqiyi_data.sft
Normal file
@@ -0,0 +1,12 @@
|
||||
[INFOR]
|
||||
sft_id = 3122
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$End$\x0$\x0$f4v$
|
||||
{4}{FRAG_UNIT_ABOFFSET}={61}{C2S_URL}$Tag$range=$\x0$-$
|
||||
147
bin/conf/sifter/main.conf
Normal file
147
bin/conf/sifter/main.conf
Normal file
@@ -0,0 +1,147 @@
|
||||
[NETWORK]
|
||||
LocalIP=em1
|
||||
|
||||
#recv bizman param, recv data from sapp
|
||||
BizmanAckSmoothTime = 10
|
||||
BizmanAckAccumulateTime=10
|
||||
BizmanAckAccumulateNum=5
|
||||
BizmanPort=22082
|
||||
|
||||
#sapp recv resp msg port
|
||||
BizmanAckPort=22084
|
||||
|
||||
#msg port
|
||||
MsgPort=22080
|
||||
|
||||
#unix-domain socket file path <20><>send frag
|
||||
UnixSocketSendSrcAddr=/home/lishu/frag/frag_rssb/maskey/bin/un_send
|
||||
UnixSocketSendDestAddr=/home/lishu/frag/frag_rssb/maskey/bin/data_recv
|
||||
|
||||
#udp socket recv port <20><>recv response msg
|
||||
UnixSocketRecvAddr=/home/lishu/frag/frag_rssb/maskey/bin/un_recv
|
||||
|
||||
#usm
|
||||
USM_ON_FLAG=1
|
||||
USM_SHM_KEY=1635151988
|
||||
#USM_SHM_KEY=12346
|
||||
USM_SHM_SIZE=100000
|
||||
USM_READER_CNT=3
|
||||
USM_SMOOTH_TIME=1000000
|
||||
USM_Q_SIZE=1048576
|
||||
USM_READER_PATH=/home/mcger/un_recv;/home/audiorecognition/aufilter/un_recv;/home/mesasoft/un_test/un_recv
|
||||
USM_LOG_LEVEL=40
|
||||
USM_LOG_PATH=./log/usm_writer0;./log/usm_writer1;./log/usm_writer2
|
||||
|
||||
#special media type, send windows system , sep: ";" : IP1+PORT1/PORT2 or IP2+PORT1/PORT2
|
||||
SpecialMediaWindowsIP=10.0.6.5;10.0.6.1;
|
||||
SpecialMediaWindowsIPNum=2
|
||||
SpecialMediaWindowsPort=44096;44098
|
||||
|
||||
#white list IP and PORT : IP1+PORT and IP2+PORT
|
||||
WhiteListIP = 10.52.178.15;
|
||||
WhiteListIPNum=1
|
||||
WhiteListPort=22085
|
||||
|
||||
#av_dedup service <20><><EFBFBD><EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
ThriftIP=127.0.0.1;
|
||||
ThriftIPNum=1
|
||||
ThriftPort=9090
|
||||
DedupBalanceNum=1000
|
||||
DedupQueueNum=100000
|
||||
DedupStatInterval=60
|
||||
DedupThriftNum=5
|
||||
DedupHtableArg=0
|
||||
|
||||
#JSON to kafka <20><>ý<EFBFBD><C3BD><EFBFBD><EFBFBD>Ϣ<EFBFBD>ش<EFBFBD>ҵ<EFBFBD><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
MediaJSONKafkaBrokers=
|
||||
|
||||
|
||||
[SYSTEM]
|
||||
ThreadNum=4
|
||||
BizmanQueueMode=0
|
||||
|
||||
#media renew time
|
||||
RenewTimeMax=7200
|
||||
RenewTimeMin=600
|
||||
RenewTimeStep=6
|
||||
|
||||
#<23><>ĿHASH<53><48>
|
||||
MediaHashSize=65536
|
||||
MediaHashElemNum=1048576
|
||||
MediaHashExpireTime=2
|
||||
|
||||
#<23><><EFBFBD>ٻ<EFBFBD>дhash<73>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>DumpfileHashElemNum<75><6D><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IJ<EFBFBD><C4B2><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>Ŀ
|
||||
DumpfileHashSize=1024
|
||||
DumpfileHashElemNum=512
|
||||
DumpfileHahsExpireTime=6
|
||||
|
||||
#monitor service
|
||||
MonitorHashSize=65536
|
||||
MonitorHashElemNum=1048576
|
||||
MonitorHahsExpireTime=120
|
||||
|
||||
MonitorFileSwitch=1
|
||||
MonitorFileRootDir=/home/yspdata/qd_monitor/
|
||||
MonitorFileDay=1
|
||||
|
||||
#special media type, send windows system
|
||||
ForwardSpecialMediaSwitch=1
|
||||
SpecialMediaType=0x68
|
||||
|
||||
#AV record switch
|
||||
AVRecordFileSwitch=0
|
||||
AVRecordFileRootDir=./AVrecord/
|
||||
AVRecordFileMaxNum=100000
|
||||
|
||||
#<23><><EFBFBD><EFBFBD>ҵ<EFBFBD><EFBFBD>
|
||||
AVDedupSwitch=0
|
||||
#td=(URL+ServerIP...)+data(<=65536)
|
||||
DedupTdDataSize=0
|
||||
|
||||
#media info send to kfaka <20><>ý<EFBFBD><C3BD>JSON<4F><4E>Ϣ<EFBFBD>ش<EFBFBD>KAFKA<4B><41><EFBFBD><EFBFBD>
|
||||
MediaJSONSwitch=0
|
||||
|
||||
#<23>ֻ<EFBFBD>app<70><70><EFBFBD><EFBFBD>
|
||||
AppSwitch=0
|
||||
|
||||
[LOG]
|
||||
#field_stat
|
||||
StatCycle=2
|
||||
StatFile=./log/rssb_stat.log
|
||||
|
||||
SysinfoCycle=2
|
||||
SysinfoFile=./log/rssb_sysinfo.log
|
||||
|
||||
#log in general
|
||||
LogLevel= 30
|
||||
LogPath= ./log/runtime.log
|
||||
|
||||
#frag msg log
|
||||
FragLogLevel= 20
|
||||
FragLogPath= ./log/frag.log
|
||||
|
||||
#av_dedup log
|
||||
DedupLogLevel= 10
|
||||
DedupLogPath= ./log/dedup.log
|
||||
|
||||
#resp msg log
|
||||
RespLogPath= ./log/survey.log
|
||||
|
||||
#media create log
|
||||
MediaCreateLogPath= ./log/media_create.log
|
||||
|
||||
#media expire log
|
||||
MediaExpireLogPath= ./log/media_expire.log
|
||||
|
||||
[DEBUG]
|
||||
/*<2A><><EFBFBD><EFBFBD>mid_trace.conf<6E>Ľ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>б<EFBFBD><D0B1>ش洢*/
|
||||
FileStoreSwitch=0
|
||||
FileStorePath=./log/file/
|
||||
|
||||
/*<2A><><EFBFBD>н<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD>б<EFBFBD><D0B1>ظ<EFBFBD><D8B8>ٻ<EFBFBD>д*/
|
||||
AllHitMonitorSwitch=0
|
||||
#1: (reoffset-1)*content-length 0: accoffset
|
||||
HlsAboffsetInMode=1
|
||||
|
||||
/*trace log path*/
|
||||
TracePath=./log/
|
||||
1
bin/conf/sifter/mid_trace.conf
Normal file
1
bin/conf/sifter/mid_trace.conf
Normal file
@@ -0,0 +1 @@
|
||||
#mid or pid
|
||||
12
bin/conf/sifter/osmf_data.sft
Normal file
12
bin/conf/sifter/osmf_data.sft
Normal file
@@ -0,0 +1,12 @@
|
||||
[INFOR]
|
||||
sft_id = 1122
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$End$\x0$\x0$Seg$
|
||||
{4}{FRAG_UNIT_REOFFSET}={61}{C2S_URL}$Tag$Frag$\x0$\x0$
|
||||
276
bin/conf/sifter/sifter.json
Normal file
276
bin/conf/sifter/sifter.json
Normal file
@@ -0,0 +1,276 @@
|
||||
{
|
||||
"compile_table": "SIFTER_CONFIG_FULL",
|
||||
"group_table":"SIFTER_GROUP",
|
||||
"rules":
|
||||
[
|
||||
{
|
||||
"compile_id": 1,
|
||||
"service": 2221,
|
||||
"action": 2,
|
||||
"do_blacklist": 1,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_ID",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "0_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "http://",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 2,
|
||||
"service": 2221,
|
||||
"action": 4,
|
||||
"do_blacklist": 1,
|
||||
"do_log": 2,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_REOFFSET",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "1_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "&ts_seg_no=",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 3,
|
||||
"service": 5221,
|
||||
"action": 1,
|
||||
"do_blacklist": 2,
|
||||
"do_log": 0,
|
||||
"effective_rage": 0,
|
||||
"user_region": "MEDIA_ID",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "2_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "&vid=",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 4,
|
||||
"service": 5221,
|
||||
"action": 2,
|
||||
"do_blacklist": 2,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_ID",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "3_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "<image><index>0</index><url><![CDATA[http://",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 5,
|
||||
"service": 3122,
|
||||
"action": 4,
|
||||
"do_blacklist": 4,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_ABOFFSET",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "4_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "range=",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 6,
|
||||
"service": 1122,
|
||||
"action": 4,
|
||||
"do_blacklist": 5,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_REOFFSET",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "5_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "Frag",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 7,
|
||||
"service": 2121,
|
||||
"action": 2,
|
||||
"do_blacklist": 7,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_ID",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "6_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "#EXTINF:",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 8,
|
||||
"service": 2121,
|
||||
"action": 4,
|
||||
"do_blacklist": 7,
|
||||
"do_log": 2,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_REOFFSET",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "7_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "#EXT-X-MEDIA-SEQUENCE:",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 9,
|
||||
"service": 5222,
|
||||
"action": 1,
|
||||
"do_blacklist": 8,
|
||||
"do_log": 0,
|
||||
"effective_rage": 0,
|
||||
"user_region": "MEDIA_ID",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "8_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "/vmind",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
},
|
||||
{
|
||||
"compile_id": 10,
|
||||
"service": 5222,
|
||||
"action": 2,
|
||||
"do_blacklist": 8,
|
||||
"do_log": 1,
|
||||
"effective_rage": 0,
|
||||
"user_region": "FRAG_UNIT_ID",
|
||||
"is_valid": "yes",
|
||||
"groups": [
|
||||
{
|
||||
"group_name": "9_start",
|
||||
"regions": [
|
||||
{
|
||||
"table_name": "SIFTER_START",
|
||||
"table_type": "string",
|
||||
"table_content": {
|
||||
"keywords": "/vmind",
|
||||
"expr_type": "none",
|
||||
"match_method": "sub",
|
||||
"format": "uncase plain"
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
} ]
|
||||
}
|
||||
11
bin/conf/sifter/table_info.conf
Normal file
11
bin/conf/sifter/table_info.conf
Normal file
@@ -0,0 +1,11 @@
|
||||
#each collumn seperate with '\t'
|
||||
#id (0~65535(
|
||||
#name string
|
||||
#type one of ip,expr,compile or plugin
|
||||
#src_charset one of GBK,BIG5,UNICODE,UTF8
|
||||
#dst_charset combined by GBK,BIG5,UNICODE,UTF8,seperate with '/'
|
||||
#do_merege yes or no
|
||||
#id name type src_charset dst_charset do_merge
|
||||
1 SIFTER_CONFIG_FULL compile GBK GBK no
|
||||
2 SIFTER_GROUP group GBK GBK no
|
||||
3 SIFTER_START expr GBK GBK yes
|
||||
12
bin/conf/sifter/tudou_data.sft
Normal file
12
bin/conf/sifter/tudou_data.sft
Normal file
@@ -0,0 +1,12 @@
|
||||
[INFOR]
|
||||
sft_id = 2222
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
{2}{FRAG_UNIT_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
13
bin/conf/sifter/tudou_index.sft
Normal file
13
bin/conf/sifter/tudou_index.sft
Normal file
@@ -0,0 +1,13 @@
|
||||
[INFOR]
|
||||
sft_id = 2221
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = [61][C2S_URL], [0xD1][S2C_CONTENT-DISPOSITION],[0xE1][C2S_CONTENT],[0xF1][S2C_CONTENT]
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$RawText$\x0$\x0$\x0$
|
||||
{2}{FRAG_UNIT_ID}={73}{S2C_CONTENT}$Tag$http://$\x0$\x0d\x0a$
|
||||
{4}{FRAG_UNIT_REOFFSET}={73}{S2C_CONTENT}$Tag$&ts_seg_no=$\x0$&$
|
||||
12
bin/conf/sifter/urloffset_data.sft
Normal file
12
bin/conf/sifter/urloffset_data.sft
Normal file
@@ -0,0 +1,12 @@
|
||||
[INFOR]
|
||||
sft_id = 3122
|
||||
|
||||
[EXTRACT]
|
||||
#[expect_type][expect_name] = extract_location$extract_method$start$mid$end$
|
||||
#expect_type and expect_name must be one
|
||||
#sifter_method = Tag | RawText | Boundary | Reposition
|
||||
#special character : \r\n = 0x0d0x0a, \x30 = no end , \x0 = null
|
||||
#expect_name = {1}{MEDIA_ID}, {2}{FRAG_UNIT_ID}, {3}{FRAG_UNIT_ABOFFSET}, {4}{FRAG_UNIT_REOFFSET}, {5}{MEDIA_SIZE}, {6}{MEDIA_NAME}, {7}{MEDIA_CONTENT}
|
||||
#extract_location = {61}{C2S_URL}, {0xD1}{S2C_CONTENT-DISPOSITION},{0xE1}{C2S_CONTENT},{0xF1}{S2C_CONTENT}
|
||||
{1}{MEDIA_ID}={61}{C2S_URL}$End$\x0$\x0$f4v$
|
||||
{4}{FRAG_UNIT_REOFFSET}={61}{C2S_URL}$Tag$range=$\x0$-$
|
||||
12
bin/conf/table_info.conf
Normal file
12
bin/conf/table_info.conf
Normal file
@@ -0,0 +1,12 @@
|
||||
#each collumn seperate with '\t'
|
||||
#id (0~65535(
|
||||
#name string
|
||||
#type one of ip,expr,compile or plugin
|
||||
#src_charset one of GBK,BIG5,UNICODE,UTF8
|
||||
#dst_charset combined by GBK,BIG5,UNICODE,UTF8,seperate with '/'
|
||||
#do_merege yes or no
|
||||
#id name type src_charset dst_charset do_merge
|
||||
1 FRAG_MONITOR_CONFIG_FULL compile GBK GBK no
|
||||
2 FRAG_MONITOR_GROUP group GBK GBK no
|
||||
3 FRAG_MONITOR_KEYWORDS expr_plus GBK GBK yes
|
||||
4 FRAG_MONITOR_IP ip GBK GBK no
|
||||
156
readme.txt
Normal file
156
readme.txt
Normal file
@@ -0,0 +1,156 @@
|
||||
time:20180927
|
||||
1.<2E><><EFBFBD><EFBFBD>Ӳ<EFBFBD><D3B2><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
********************************************************
|
||||
time:20180913
|
||||
1.<2E><>Ƭ<EFBFBD><C6AC>ȥ<EFBFBD><C8A5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD>һ<EFBFBD><D2BB>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
********************************************************
|
||||
time:20180905
|
||||
1.<2E><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>洢<EFBFBD><E6B4A2><EFBFBD>Կ<EFBFBD><D4BF><EFBFBD>
|
||||
2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>DATAURL<52><4C>־
|
||||
********************************************************
|
||||
time:20180816
|
||||
1.<2E><EFBFBD>bug<75><67><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><D0BC>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD>Ƕ<EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ľ<EFBFBD>ĿID<49><44><EFBFBD><EFBFBD>ȷ
|
||||
|
||||
|
||||
********************************************************
|
||||
time:20180718
|
||||
1.<2E><><EFBFBD><EFBFBD>av_sendback.h <20><><EFBFBD><EFBFBD>ѡ<EFBFBD><EFBFBD><EFBFBD>CEC<45>Ľӿ<C4BD><D3BF>ĵ<EFBFBD>
|
||||
|
||||
********************************************************
|
||||
time:20180711
|
||||
1.main.conf
|
||||
FragForecastSwitch=0
|
||||
2.<2E><><EFBFBD>³<EFBFBD><C2B3><EFBFBD>
|
||||
<EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD>ƬԤ<EFBFBD><EFBFBD>
|
||||
kafka<EFBFBD><EFBFBD><EFBFBD><EFBFBD>refer<EFBFBD><EFBFBD>Ϣ
|
||||
********************************************************
|
||||
time:20180628
|
||||
1.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD>Ϣд<CFA2><D0B4>kafka
|
||||
2.<2E><><EFBFBD>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>
|
||||
|
||||
********************************************************
|
||||
time:20180613
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>mediatype<EFBFBD><EFBFBD>dumpfile<EFBFBD>ļ<EFBFBD>
|
||||
<EFBFBD><EFBFBD>main.conf<6E><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӹر<D3B9><D8B1><EFBFBD>ƬԤ<C6AC><D4A4><EFBFBD>Ĺ<EFBFBD><C4B9><EFBFBD>
|
||||
json<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ж<EFBFBD>addr
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܼ<EFBFBD><EFBFBD><EFBFBD>
|
||||
********************************************************
|
||||
time:20180509
|
||||
<EFBFBD>ϲ<EFBFBD><EFBFBD><EFBFBD>ƬԤ<EFBFBD><EFBFBD>+<2B><>־<EFBFBD>ɼ<EFBFBD>+<2B><><EFBFBD>ؾ<EFBFBD><D8BE><EFBFBD>
|
||||
********************************************************
|
||||
time:20180408
|
||||
֧<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƬԤ<EFBFBD><EFBFBD>
|
||||
1.main.conf<6E><66><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ
|
||||
MaatTableInfo=./conf/table_info.conf
|
||||
FragMonitorJSON=./conf/frag_monitor.json
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>
|
||||
|
||||
********************************************************
|
||||
time:20180321
|
||||
1.<2E><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Ŀǿ<C4BF><C7BF>ˢ<EFBFBD>»<EFBFBD><C2BB>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD>յ<EFBFBD>Ԫ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>offsetѡ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻ<EFBFBD><EFBFBD><EFBFBD>Ϊ0
|
||||
2. ǿ<><C7BF>ˢ<EFBFBD>½<EFBFBD>Ŀ<EFBFBD><C4BF>ʱ<EFBFBD><CAB1>expire<72><65>־<EFBFBD><D6BE><EFBFBD><EFBFBD>renew.
|
||||
********************************************************
|
||||
time:20171219
|
||||
1.<2E><><EFBFBD>ܹ<EFBFBD><DCB9><EFBFBD>
|
||||
2.TD<54><44>Ϣ<EFBFBD><CFA2>kafka
|
||||
3.<2E><>Դ<EFBFBD><D4B4>ѯ
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
main.conf<6E><66><EFBFBD><EFBFBD>
|
||||
#index<65>ڶ<EFBFBD><DAB6>η<EFBFBD><CEB7><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
IndexQueryTime=10
|
||||
#<23><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF>ʱ<EFBFBD><CAB1><EFBFBD>ص<EFBFBD><D8B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
IndexQueryTimerCbMaxNum=500
|
||||
|
||||
frag_reassembly.conf<6E><66><EFBFBD>²<EFBFBD><C2B2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɾ<EFBFBD><C9BE>
|
||||
RedisNet=80,81,83
|
||||
#HIRCLUSTER_FLAG_UNIQIP_FRAG_ONE=0x100=256,HIRCLUSTER_FLAG_UNIQIP_FRAG_TWO=0x200=512,HIRCLUSTER_FLAG_UNIQIP_FRAG_THREE=0x400=1024,HIRCLUSTER_FLAG_UNIQIP_FRAG_FOUR=0x800=2048
|
||||
RedisUniqIPFlag=2048
|
||||
********************************************************
|
||||
time:20171114
|
||||
1.AV_record<72><64>¼TD<54><44><EFBFBD><EFBFBD>Ϣ
|
||||
********************************************************
|
||||
time:20170920
|
||||
1.<2E><><EFBFBD><EFBFBD>fs<66><73><EFBFBD>͵Ŀ<CDB5><C4BF><EFBFBD>
|
||||
2.<2E><><EFBFBD><EFBFBD>frag_rssb<73><62><EFBFBD>͵Ŀ<CDB5><C4BF><EFBFBD>
|
||||
********************************************************
|
||||
time:20170914
|
||||
1.
|
||||
********************************************************
|
||||
time:20170904
|
||||
1.<2E><><EFBFBD>Ӹ<EFBFBD><D3B8>ؿ<EFBFBD>IP
|
||||
2.<2E><>ƴװ<C6B4><D7B0><EFBFBD>ն<EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>ķ<EFBFBD><C4B7>½<EFBFBD><C2BD>飬<EFBFBD><E9A3AC><EFBFBD><EFBFBD>ת<EFBFBD><D7AA><EFBFBD><EFBFBD>Ӧǰ<D3A6>˻<EFBFBD><CBBB><EFBFBD>
|
||||
|
||||
1.ȷ<><C8B7><EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD><D6BC><EFBFBD><EFBFBD>ij<EFBFBD>ʱ<EFBFBD><CAB1><EFBFBD>洢
|
||||
2.<2E>˿<EFBFBD><CBBF><EFBFBD><EFBFBD><EFBFBD>
|
||||
ǰ<EFBFBD>ˣ<EFBFBD>
|
||||
22084<EFBFBD>Լ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>22082<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>Bizman<EFBFBD><EFBFBD>
|
||||
22080<EFBFBD>ս<EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD>ƿװ<EFBFBD><EFBFBD>
|
||||
22084<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͽ<EFBFBD><EFBFBD>鵽22080<EFBFBD><EFBFBD>ʹ<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD>Bizman<EFBFBD><EFBFBD>
|
||||
22082<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
********************************************************
|
||||
time:20170803
|
||||
1.<2E><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD>
|
||||
********************************************************
|
||||
time:20170724
|
||||
1.SIP<49><50><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD>궨<EFBFBD><EAB6A8><EFBFBD><EFBFBD>ԭ<EFBFBD><D4AD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>̫<EFBFBD>࣬<EFBFBD>˷<EFBFBD><CBB7><EFBFBD><EFBFBD>ݽṹ<DDBD><E1B9B9>Ӱ<EFBFBD><D3B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
*******************************************************
|
||||
time:20170713
|
||||
1.<2E><>Ƭ<EFBFBD><C6AC>GK<47><4B><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><D2BB>URLѡ<4C><D1A1>
|
||||
2.ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>68->0
|
||||
*******************************************************
|
||||
time:20170622
|
||||
1.<2E><>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>½<EFBFBD><C2BD><EFBFBD>
|
||||
2.SIP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>⽨<EFBFBD><E2BDA8>
|
||||
*******************************************************
|
||||
time:20170401
|
||||
1.Ŀǰ<C4BF><C7B0><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>Ľ<EFBFBD>ĿURL/UA/refererֻ<72><D6BB>¼<EFBFBD><C2BC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC>URL/UA/referer
|
||||
*******************************************************
|
||||
time:20170331
|
||||
1.support <20><><EFBFBD><EFBFBD>makefile<6C><65><EFBFBD>ڰ<EFBFBD>װ
|
||||
*******************************************************
|
||||
time:20170315
|
||||
1.<2E>ϲ<EFBFBD><CFB2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڴ<EFBFBD><DAB4>汾
|
||||
*********************************************************
|
||||
time:20170309
|
||||
1.ʹ<><CAB9>redis<69><73><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD>IJ<EFBFBD>ѯ
|
||||
*********************************************************
|
||||
time:20170214
|
||||
1.<2E><><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>Ľ<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>н<EFBFBD><D0BD><EFBFBD>
|
||||
*********************************************************
|
||||
time:20170105
|
||||
1.wins <20><><EFBFBD><EFBFBD>MIDѡ<44><D1A1>һ<EFBFBD><D2BB>IP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˿<EFBFBD>
|
||||
2.<2E><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>̨<EFBFBD><CCA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬһ<CDAC><D2BB><EFBFBD>˿<EFBFBD>
|
||||
*********************************************************
|
||||
time<EFBFBD><EFBFBD>20161225
|
||||
1. <20><><EFBFBD><EFBFBD>trace<63><65>־
|
||||
*********************************************************
|
||||
time<EFBFBD><EFBFBD>20161222
|
||||
1.ԭ<>ȴ<EFBFBD>ƴװ<C6B4><D7B0>û<EFBFBD><C3BB>Ԫ<EFBFBD><D4AA>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>յ<EFBFBD><D5B5><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>Ŀ<EFBFBD><C4BF>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>POST<EFBFBD>ϴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ<EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD><EFBFBD>ٴ<EFBFBD>Ԫ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>֧<EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>û<EFBFBD><EFBFBD>ԭ<EFBFBD><EFBFBD>ϢҲ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD>
|
||||
2.<2E><>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>Բ<EFBFBD><D4B2>ܿ<EFBFBD>Ԫ<EFBFBD><D4AA>Ϣȥ<CFA2><C8A5>̭<EFBFBD><CCAD>Ŀ<EFBFBD><C4BF>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><EFBFBD><EFBFBD>ظ<EFBFBD><EFBFBD>յ<EFBFBD>Ԫ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̭<EFBFBD><EFBFBD>Ŀ<EFBFBD>ɡ<EFBFBD>
|
||||
3.<2E>յ<EFBFBD>Ԫ<EFBFBD><D4AA>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD>ý<EFBFBD>Ŀ<EFBFBD><C4BF>ԭ<EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF>̭֮<CCAD>䣬<EFBFBD><E4A3AC><EFBFBD>ý<EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD>ݾͿ<DDBE><CDBF><EFBFBD><EFBFBD>ٴη<D9B4><CEB7>͡<EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀû<EFBFBD><EFBFBD><EFBFBD><EFBFBD>̭<EFBFBD><EFBFBD><EFBFBD>յ<EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>µ<EFBFBD>Ԫ<EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ؽ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫˢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŀ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><EFBFBD>
|
||||
*********************************************************
|
||||
time<EFBFBD><EFBFBD>20160918
|
||||
1.IVIȥ<49><C8A5>
|
||||
2.frag_unit<69><74><EFBFBD>Ӵ<EFBFBD><D3B4><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
*********************************************************
|
||||
time<EFBFBD><EFBFBD>20160531
|
||||
1. dumpfileʹ<65><CAB9>aboffset_in
|
||||
2. ͳ<><CDB3><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>¼
|
||||
|
||||
|
||||
|
||||
|
||||
*************************<2A><>¼********************************
|
||||
<EFBFBD><EFBFBD><EFBFBD>⽨<EFBFBD>飺
|
||||
ǰ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>cfg_id=1,<2C><>ǰ<EFBFBD>˽<EFBFBD><CBBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD>ּ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ã<EFBFBD>cfg_id=0
|
||||
|
||||
|
||||
<EFBFBD><EFBFBD><EFBFBD>ػ<EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><EFBFBD>Ԫ<EFBFBD><EFBFBD>Ϣ<EFBFBD>е<EFBFBD>ѡ<EFBFBD><EFBFBD>
|
||||
224
src/AV_interface.h
Normal file
224
src/AV_interface.h
Normal file
@@ -0,0 +1,224 @@
|
||||
#ifndef _AV_INTERFACE_H
|
||||
#define _AV_INTERFACE_H
|
||||
|
||||
#define K_PROJECT 0 //<2F>Ƿ<EFBFBD><C7B7><EFBFBD>K<EFBFBD><4B>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>Ҫ<EFBFBD>ǽ<EFBFBD><C7BD><EFBFBD><EFBFBD>Ľӿڲ<D3BF>һ<EFBFBD><D2BB>
|
||||
|
||||
#define PROTO_VERSION 3
|
||||
#define PROTO_MAGICNUM 0x5641
|
||||
|
||||
/*META_OPT_* same with av_master <20><><EFBFBD><EFBFBD>ǰ<EFBFBD><C7B0>*/
|
||||
#define META_OPT_LAYER_ADDR 0x52 //META_OPT_LAYER_ADDR
|
||||
#define META_OPT_SINGLE_KEY 0x68
|
||||
#define META_OPT_LAYER_URL 0x61
|
||||
#define META_OPT_ETAG 0x62
|
||||
#define META_OPT_LAST_MODIFY 0x63
|
||||
#define META_OPT_REFERER 0x64 //AV_IdentifyFormatDoc
|
||||
#define META_OPT_USER_AGENT 0x65
|
||||
#define META_OPT_C2S_CONT_TYPE 0x66 //cache and send because of boundary
|
||||
#define META_OPT_S2C_CONT_TYPE 0x67 //cache and send because of boundary
|
||||
#define META_OPT_SERVICE_ID 0x71 /*<2A><>Ƭ<EFBFBD><C6AC>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define META_OPT_C2S_CONT 0x72 /*<2A><>Ƭ<EFBFBD><C6AC>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define META_OPT_S2C_CONT 0x73 /*<2A><>Ƭ<EFBFBD><C6AC>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define META_OPT_CONT_DISPOSITION 0x74 /*<2A><>Ƭ<EFBFBD><C6AC>ʹ<EFBFBD>ã<EFBFBD><C3A3><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define META_OPT_SIP_DIADATA_ID 0x81 /*VOIPʹ<50><CAB9>*/
|
||||
#define META_OPT_SIP_DATA_DIR 0x82
|
||||
#define META_OPT_SIP_RATE_INFO 0x83
|
||||
#define META_OPT_OFFSET 0x69 /*offset<65><74>ѡ<EFBFBD><D1A1>,<2C><>ǰ<EFBFBD><C7B0>һ<EFBFBD><D2BB>*/
|
||||
#define META_OPT_SERVER 0x6A
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD>ݷ<EFBFBD><DDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>*/
|
||||
#define OPT_SOURCE_IP 0x41 /*localIPѡ<50><D1A1>*/
|
||||
#define META_OPT_SIP_SEND_RATE_INFO 0x71 /*VOIPҵ<50><D2B5>*/
|
||||
|
||||
/*<2A><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD>ƿװ<C6BF><D7B0><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿװ<C6BF><D7B0>ѡ<EFBFBD><D1A1>*/
|
||||
#define META_OPT_INFO_BEFORE_MULTISRC 0x91 /*<2A><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD>֮ǰ<D6AE>Ľ<EFBFBD>Ŀ<EFBFBD><C4BF>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD>MID<49><44>capIP<49><50><EFBFBD>ڲ<EFBFBD><DAB2><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
|
||||
#define FILE_OSMF 0xA1
|
||||
#define FILE_HLS 0xA2
|
||||
#define FILE_IOS 0xA3
|
||||
#define FILE_ANDRIOD 0xA4
|
||||
#define FILE_APP 0xA5
|
||||
#define FILE_FRAG 0xA6 /*<2A><>ƬԤ<C6AC><D4A4>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>,<2C><><EFBFBD><EFBFBD>url<72><6C><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƫ<EFBFBD><C6AB><EFBFBD><EFBFBD><EFBFBD>ģ<EFBFBD><C4A3><EFBFBD><EFBFBD><EFBFBD>iqiyi*/
|
||||
#define FILE_MAYBE_FRAG 0xA7 /*ǰ<>˻ش<CBBB><D8B4>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ*/
|
||||
#define FILE_AV 0x00 /*<2A><>ƬԤ<C6AC><D4A4>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ת<EFBFBD><D7AA>Ϊ0x00*/
|
||||
|
||||
#define VOIP_UNKNOWN_MEDIA_TYPE 0xB0
|
||||
|
||||
/*from papp*/
|
||||
#define MSG_DATA_META 0x31
|
||||
#define MSG_DATA_BODY 0x32
|
||||
#define MSG_DATA_TAIL 0x33
|
||||
|
||||
/*live*/
|
||||
#define MSG_LIVE_CHECK 0x41 //from sapp
|
||||
#define MSG_LIVE_RESPONS 0x42 //to sapp
|
||||
|
||||
/*from av_analyse*/
|
||||
#define MSG_RESP_CHECKRESULT 0x11 // Check Result notification
|
||||
#define MSG_RESP_REJECT 0x12 // Reject Message notification, not proc now
|
||||
#define MSG_RESP_CHARACTER 0x13 // Character notification, 1. wins ack, 2. send to sapp
|
||||
#define MSG_RESP_CHECKRESULT_ACK 0x14 //not send now
|
||||
#define MSG_PROG_SYNC 0x15 //
|
||||
|
||||
/*prog sync*/
|
||||
#define SYNC_SENDER_VIDEO_ANALYZER 0x01
|
||||
#define SYNC_SENDER_AUDIO_ANALYZER 0x02
|
||||
#define SYNC_ACTION_STOP_TO_SUBSYSTEM 0x01
|
||||
#define SYNC_ACTION_STOP_TO_MAINSYSTEM 0x02
|
||||
#define SYNC_ACTION_ELIMINATE_PROGRAM 0x03
|
||||
|
||||
/*<2A><><EFBFBD>½<EFBFBD><C2BD><EFBFBD><EFBFBD><EFBFBD>Ƭ<EFBFBD><C6AC><EFBFBD>ܿ<EFBFBD><DCBF><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1>*/
|
||||
#define OPT_FRAG_ORIGIN_URL 0x11
|
||||
#define OPT_FRAG_CTRL_SUBSTR 0x12
|
||||
#define OPT_FRAG_INDEX_URL 0x13
|
||||
|
||||
/*FD<46><44><EFBFBD><EFBFBD>: ͼƬ<CDBC><C6AC><EFBFBD><EFBFBD>set opt_num=0*/
|
||||
#define SURVEY_PIC_TYPE 0x31
|
||||
#define SURVEY_PIC_MONITOR_TYPE 0xB1
|
||||
#define SURVEY_PIC_KEYWORD_TYPE 0xB2
|
||||
|
||||
// FD<46><44><EFBFBD><EFBFBD>, 0<><30>ʾ<EFBFBD><CABE>̬<EFBFBD>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ʾ<EFBFBD><CABE>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>2<EFBFBD><32>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>С<EFBFBD>
|
||||
#define FD_TYPE_DYNAMIC_LIST 0
|
||||
#define FD_TYPE_STATIC_CONF 1
|
||||
#define FD_TYPE_ANALYSE 2
|
||||
|
||||
|
||||
/*=================================monitor service===============================================*/
|
||||
|
||||
#define SERVICE_AUDIO_LANG 0x97 //<2F><>ѧ<EFBFBD><D1A7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_AUDIO_LANG_FULL 0x98 //<2F><>ƴװ<C6B4><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־
|
||||
|
||||
/*=================================ack msg===============================================*/
|
||||
typedef struct msg_data_ack_s
|
||||
{
|
||||
char prog_id[8];
|
||||
uint16_t pad;
|
||||
uint64_t ack_offset:48;
|
||||
}msg_data_ack_t;
|
||||
|
||||
/*=================================data msg===============================================*/
|
||||
#define MSG_HEADER_LEN sizeof(msg_header_t)
|
||||
typedef struct msg_header_s
|
||||
{
|
||||
uint16_t magic_num;
|
||||
uint8_t version;
|
||||
uint8_t msg_type; // msg data type
|
||||
uint32_t cont_len;
|
||||
}msg_header_t; /* sizeof = 8B */
|
||||
|
||||
#define MSG_MEDIAINFO_HEAD_LEN (sizeof(msg_metainfo_t))
|
||||
/*Data_flag defination*/
|
||||
typedef struct msg_metainfo_s
|
||||
{
|
||||
char prog_id[8];
|
||||
char flag;
|
||||
#if K_PROJECT
|
||||
uint8_t pad[3];
|
||||
int hitservice;
|
||||
uint64_t prog_len;
|
||||
#else
|
||||
uint8_t hitservice;
|
||||
uint64_t prog_len:48;
|
||||
#endif
|
||||
uint32_t cap_IP;
|
||||
uint8_t protocol;
|
||||
uint8_t media_type;
|
||||
uint8_t data_flag;
|
||||
uint8_t opt_num;
|
||||
}msg_metainfo_t;
|
||||
|
||||
typedef struct msg_data_s
|
||||
{
|
||||
char prog_id[8];
|
||||
union
|
||||
{
|
||||
struct
|
||||
{
|
||||
uint8_t pad;
|
||||
uint8_t flags;
|
||||
};
|
||||
uint16_t frag_seq;
|
||||
};
|
||||
uint64_t offset:48;
|
||||
}msg_data_t;
|
||||
#define MSG_DATA_HEAD_LEN (sizeof(msg_data_t))
|
||||
|
||||
/*==============================response msg==================================================*/
|
||||
typedef struct msg_prog_sync_s
|
||||
{
|
||||
char prog_id[8];
|
||||
uint8_t sender; //0:reserved,1: video analyzer,2:audio analyzer
|
||||
char action; //0:reserved,1:stop send to subsystem,2:stop send to main system,3:eliminate this programm
|
||||
}msg_prog_sync_t;
|
||||
|
||||
#define MSG_RESP_CHECKRESULT_LEN (sizeof(resp_checkresult_t))
|
||||
typedef struct resp_checkresult_s
|
||||
{
|
||||
char prog_id[8];
|
||||
#if K_PROJECT
|
||||
int service;
|
||||
char level; //the level of check result
|
||||
uint8_t opt_num; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
|
||||
uint8_t pad[6]; // Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0ֵ
|
||||
#else
|
||||
uint8_t service;
|
||||
char level; //the level of check result
|
||||
uint8_t opt_num; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD>
|
||||
uint8_t pad; // Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0ֵ
|
||||
#endif
|
||||
uint32_t cfg_id; //config ID
|
||||
uint32_t file_header_size;
|
||||
uint32_t file_packet_size;
|
||||
}resp_checkresult_t;
|
||||
|
||||
typedef struct msg_log_s
|
||||
{
|
||||
char prog_id[8]; // program rule id;
|
||||
uint32_t cfg_id; // hitted rule id;
|
||||
uint32_t fount_time; // found time
|
||||
uint32_t server_ip; // server ip;
|
||||
uint32_t client_ip; // client ip;
|
||||
uint16_t server_port; // server port;
|
||||
uint16_t client_port; // client port;
|
||||
uint8_t protocol; // translation protocol num;
|
||||
uint8_t service; // service type;
|
||||
uint8_t level; // result level;
|
||||
uint8_t fd_type; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, 0<><30>ʾ<EFBFBD><CABE>̬<EFBFBD>ڰ<EFBFBD><DAB0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>1<EFBFBD><31>ʾ<EFBFBD><CABE>̬<EFBFBD><CCAC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>У<EFBFBD>2<EFBFBD><32>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD>С<EFBFBD>
|
||||
}msg_log_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
RECV_RESP=0,
|
||||
RECV_RESP_WHITELIST,
|
||||
RESP_MEDIA_NOFOUND,
|
||||
RESP_REPEAT,
|
||||
RESP_AUDIO_LANG_MONITOR_NEW,
|
||||
RESP_AUDIO_LANG_MONITOR_OLD,
|
||||
RESP_SEND_BLOCK,
|
||||
RESP_SEND_BLOCK_MULTI,
|
||||
|
||||
RECV_PROG_SYNC,
|
||||
RECV_PROG_SYNC_NOFOUND,
|
||||
RECV_PROG_SYNC_AUDIO_STOP,
|
||||
RECV_PROG_SYNC_VIDEO_STOP,
|
||||
RECV_PROG_SYNC_UNKNOW,
|
||||
|
||||
SEND_CONFIG_MONITOR,
|
||||
SEND_LANG_MONITOR,
|
||||
}RESP_LOG_TYPE;
|
||||
|
||||
/*VOIP <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE>ַ<EFBFBD><D6B7>ʽ*/
|
||||
typedef struct layer_addr_v4_s
|
||||
{
|
||||
uint8_t layer_cnt;
|
||||
uint8_t reserved[3];
|
||||
uint32_t client_addr; /* network order, client IP */
|
||||
uint32_t server_addr; /* network order, server IP */
|
||||
uint16_t client_port; /* network order */
|
||||
uint16_t server_port; /* network order */
|
||||
}layer_addr_v4_t;
|
||||
|
||||
void resp_write_to_log(int type, resp_checkresult_t* check_res, void* param1, void* param2, uint64_t param3);
|
||||
|
||||
|
||||
#endif
|
||||
198
src/AV_sendback.h
Normal file
198
src/AV_sendback.h
Normal file
@@ -0,0 +1,198 @@
|
||||
#ifndef _AV_SENDBACK_H
|
||||
#define _AV_SENDBACK_H
|
||||
|
||||
/*ħ<><C4A7>*/
|
||||
#define AV_MAGIC_VALUE 0x8739
|
||||
|
||||
/*<2A><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
||||
#define AV_TYPE_META 0x01
|
||||
#define AV_TYPE_DATA 0x02
|
||||
#define AV_TYPE_RESULT 0x11
|
||||
|
||||
/*Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define PROTOCOL_DEFAULT 0x00
|
||||
#define PROTOCOL_HTTP 0x01
|
||||
#define PROTOCOL_SMTP 0x02
|
||||
#define PROTOCOL_POP3 0x03
|
||||
#define PROTOCOL_IMAP 0x04
|
||||
#define PROTOCOL_FTP 0x05
|
||||
#define PROTOCOL_HTTP_PIC 0x06
|
||||
#define PROTOCOL_RTSP_RDT 0x07
|
||||
#define PROTOCOL_RTSP_RTP 0x08
|
||||
#define PROTOCOL_MMS 0x09
|
||||
#define PROTOCOL_RTMP 0x0A
|
||||
#define PROTOCOL_SIP 0x0B
|
||||
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_UNKNOWN 0x00
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>Ƶ֧<C6B5>ֵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_VIDEO 0x01
|
||||
#define MEDIA_TYPE_WMV 0x02
|
||||
#define MEDIA_TYPE_MPG 0x03
|
||||
#define MEDIA_TYPE_FLV 0x04
|
||||
#define MEDIA_TYPE_RMFF 0x05
|
||||
#define MEDIA_TYPE_AVI 0x06
|
||||
#define MEDIA_TYPE_SWF 0x07
|
||||
#define MEDIA_TYPE_MPG4 0x08
|
||||
#define MEDIA_TYPE_AIFF 0x09
|
||||
#define MEDIA_TYPE_OGG 0x0A
|
||||
#define MEDIA_TYPE_DRC 0x0B
|
||||
#define MEDIA_TYPE_DIRECTSHOW 0x0C
|
||||
#define MEDIA_TYPE_FLIC 0x0E
|
||||
#define MEDIA_TYPE_INDEO 0x0F
|
||||
#define MEDIA_TYPE_MKV 0x10
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>Ƶ֧<C6B5>ֵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_AUDIO 0x20
|
||||
#define MEDIA_TYPE_MP3 0x21
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:ͼƬ֧<C6AC>ֵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_IMAGE 0x30
|
||||
#define MEDIA_TYPE_JPG 0x31
|
||||
#define MEDIA_TYPE_BMP 0x32
|
||||
#define MEDIA_TYPE_GIF 0x33
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:ʵʱ<CAB5><CAB1>ý<EFBFBD><C3BD>֧<EFBFBD>ֵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_MMS 0x40
|
||||
#define MEDIA_TYPE_RTSP_RDT 0x41
|
||||
#define MEDIA_TYPE_RTSP_RTP 0x42
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:<3A><>Ƭ<EFBFBD><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƶ֧<C6B5>ֵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_OSMF 0x50
|
||||
#define MEDIA_TYPE_HLS 0x51
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:VOIP֧<50>ֵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3>༴<EFBFBD><E0BCB4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_TYPE_AUDIO_UNKNOWN 0x60
|
||||
#define MEDIA_TYPE_AUDIO_G711_ULAW 0x61
|
||||
#define MEDIA_TYPE_AUDIO_G711_ALAW 0x62
|
||||
#define MEDIA_TYPE_AUDIO_G722 0x63
|
||||
#define MEDIA_TYPE_AUDIO_G723 0x64
|
||||
#define MEDIA_TYPE_AUDIO_G726_40 0x65
|
||||
#define MEDIA_TYPE_AUDIO_G726_32 0x66
|
||||
#define MEDIA_TYPE_AUDIO_G726_24 0x67
|
||||
#define MEDIA_TYPE_AUDIO_G726_16 0x68
|
||||
#define MEDIA_TYPE_AUDIO_AAL2_G726_40 0x69
|
||||
#define MEDIA_TYPE_AUDIO_AAL2_G726_32 0x6A
|
||||
#define MEDIA_TYPE_AUDIO_AAL2_G726_24 0x6B
|
||||
#define MEDIA_TYPE_AUDIO_AAL2_G726_16 0x6C
|
||||
#define MEDIA_TYPE_AUDIO_G728 0x6D
|
||||
#define MEDIA_TYPE_AUDIO_G729D 0x6E
|
||||
#define MEDIA_TYPE_AUDIO_G729E 0x6F
|
||||
#define MEDIA_TYPE_AUDIO_GSM 0x70
|
||||
#define MEDIA_TYPE_AUDIO_GSM_EFR 0x71
|
||||
#define MEDIA_TYPE_AUDIO_ILBC 0x72
|
||||
#define MEDIA_TYPE_AUDIO_AMR 0x73
|
||||
#define MEDIA_TYPE_AUDIO_AMR_WB 0x74
|
||||
#define MEDIA_TYPE_AUDIO_SILK 0x75
|
||||
#define MEDIA_TYPE_AUDIO_LPC 0x76
|
||||
#define MEDIA_TYPE_AUDIO_LPC1016 0x77
|
||||
#define MEDIA_TYPE_AUDIO_LPC1015 0x78
|
||||
#define MEDIA_TYPE_AUDIO_L16 0x79
|
||||
#define MEDIA_TYPE_AUDIO_SPEEX 0x7A
|
||||
#define MEDIA_TYPE_AUDIO_L8 0x7B
|
||||
#define MEDIA_TYPE_AUDIO_MPA 0x7C
|
||||
#define MEDIA_TYPE_AUDIO_DVI4 0x7D
|
||||
#define MEDIA_TYPE_AUDIO_VDVI 0x7E
|
||||
#define MEDIA_TYPE_AUDIO_CN 0x7F
|
||||
#define MEDIA_TYPE_AUDIO_RED 0x80
|
||||
#define MEDIA_TYPE_AUDIO_QCELP 0x81
|
||||
#define MEDIA_TYPE_AUDIO_EVRC0 0x82
|
||||
#define MEDIA_TYPE_AUDIO_EVRCB0 0x83
|
||||
#define MEDIA_TYPE_AUDIO_G729 0x84
|
||||
#define MEDIA_TYPE_AUDIO_VIVOX 0x85
|
||||
|
||||
/*ָ<><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
/*ָ<><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>-VOIPѡ<50><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define OPT_SIP_SEND_RATE_INFO 0x71 /*VOIP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ*/
|
||||
|
||||
/*==================================<3D><>Ϣͷ<CFA2><CDB7>==============================================*/
|
||||
typedef struct msg_head_s
|
||||
{
|
||||
uint16_t magic;
|
||||
uint16_t m_type;
|
||||
uint32_t c_len; //<2F><>Ϣ<EFBFBD>峤<EFBFBD><E5B3A4>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣͷ<CFA2><CDB7>)
|
||||
}msg_head_t;
|
||||
|
||||
/*==================================ָ<><D6B8><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>==============================================*/
|
||||
typedef struct msg_meta_s
|
||||
{
|
||||
char pid[8]; //ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint64_t proglen; //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<D6BD><DAB3>ȣ<EFBFBD>Ϊ0<CEAA><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>δ֪
|
||||
uint32_t capip; // <20><>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>IP
|
||||
uint8_t protocol; // <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t mediatype; // <20><><EFBFBD>ܵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t data_flag; // <20><><EFBFBD>ݱ<EFBFBD>־
|
||||
uint8_t opt_num; // ѡ<><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}msg_meta_t;
|
||||
|
||||
/*<2A>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD>涨<EFBFBD><E6B6A8><EFBFBD><EFBFBD>
|
||||
struct opt_unit_t
|
||||
{
|
||||
uint32_t opt_len; //<2F><><EFBFBD><EFBFBD>opt_len<65><6E>opt_type<70><65>opt_value
|
||||
uint8_t opt_type;
|
||||
char* opt_value;
|
||||
};
|
||||
*/
|
||||
|
||||
/*==================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>==============================================*/
|
||||
typedef struct av_data_s
|
||||
{
|
||||
char pid[8]; // <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t frag_seq; // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5>Ƭ:Ƭ<><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD> VOIP:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int64_t offset:48; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD>ƫ<EFBFBD><C6AB>λ<EFBFBD><CEBB>
|
||||
//char* avs; // <20><>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}av_data_t;
|
||||
|
||||
/*VOIP<49><50>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ*/
|
||||
struct voip_header_t
|
||||
{
|
||||
uint32_t time_stamp; // <20><><EFBFBD><EFBFBD>֡<EFBFBD><D6A1>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD>, <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t sequence;
|
||||
//char* data; //VOIP<49><50><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
/*RTSP/RTMP<4D><50>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ*/
|
||||
struct sdp_data_packet
|
||||
{
|
||||
char sdp[8]; // <20><>Ϊ"RTSP_SDP"
|
||||
uint32_t sdp_len; // Ϊsdp<64><70><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
//char * data; // sdp<64><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
/*RTSP sdp<64><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ*/
|
||||
struct rtsp_data_packet
|
||||
{
|
||||
uint32_t flag; // RTSP<53><50><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ͷ<EFBFBD><CDB7>־ 0x46464646 "FFFF"
|
||||
uint8_t type; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD>1 for RDT<44><54>2 for RTP
|
||||
uint8_t channel; // <20><><EFBFBD>ݵ<EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD>
|
||||
uint16_t len; // <20><><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
//char * data; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
/*RTMP sdp<64><70><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ*/
|
||||
struct rtmp_data_packet
|
||||
{
|
||||
uint32_t flag; // RTMP<4D><50><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>ͷ<EFBFBD><CDB7>־ 0x52544D50"RTMP"
|
||||
uint32_t av_type:8; // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD>ͣ<EFBFBD>8 for Audio, 9 for Video
|
||||
uint32_t cs_id:24; // Chunk Stream ID
|
||||
uint32_t timestamp; // ʱ<><CAB1><EFBFBD><EFBFBD>
|
||||
uint32_t len; // <20><><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>(<28><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7><EFBFBD>ֶγ<D6B6><CEB3>ȣ<EFBFBD>20<32>ֽ<EFBFBD>)
|
||||
uint32_t stream_id; // <20><>ID
|
||||
//char * data; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
/*MMS<4D><53>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݸ<EFBFBD>ʽ*/
|
||||
struct mms_data_packet
|
||||
{
|
||||
uint32_t frame_flag; // <20><>Ϊ0x46464646 "FFFF"
|
||||
uint32_t data_len; // Ϊ<><CEAA><EFBFBD>ݳ<EFBFBD><DDB3><EFBFBD>
|
||||
//char * data; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>H<EFBFBD><48><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>D<EFBFBD><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
};
|
||||
|
||||
/*==================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>==================================================*/
|
||||
typedef struct msg_result_s
|
||||
{
|
||||
char pid[8]; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
int servicetype; // ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint32_t cfgid; // <20><><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ID<49><44>ֵΪ0<CEAA><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||
int8_t level; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷȣ<C5B6> [0, 100]
|
||||
uint8_t pad[7]; // Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0ֵ
|
||||
//char* logindex; // <20><><EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ĵ洢·<E6B4A2><C2B7>URL<52><4C><EFBFBD><EFBFBD>"/0"<22><><EFBFBD><EFBFBD>
|
||||
}msg_result_t;
|
||||
|
||||
#endif
|
||||
233
src/AV_sendback_all.h
Normal file
233
src/AV_sendback_all.h
Normal file
@@ -0,0 +1,233 @@
|
||||
#ifndef _AV_SENDBACK_H
|
||||
#define _AV_SENDBACK_H
|
||||
|
||||
/*ħ<><C4A7>*/
|
||||
#define AV_MAGIC_VALUE 0x8739
|
||||
|
||||
/*<2A><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>*/
|
||||
#define AV_TYPE_META 0x01
|
||||
#define AV_TYPE_DATA 0x02
|
||||
#define AV_TYPE_RESULT 0x11
|
||||
|
||||
/*Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define AV_PROTOCOL_HTTP 0x01
|
||||
#define AV_PROTOCOL_SMTP 0x02
|
||||
#define AV_PROTOCOL_POP3 0x03
|
||||
#define AV_PROTOCOL_FTP 0x04
|
||||
#define AV_PROTOCOL_IMAP 0x05
|
||||
#define AV_PROTOCOL_HTTP_STREAM 0x81
|
||||
#define AV_PROTOCOL_RTSP_RDT 0x82
|
||||
#define AV_PROTOCOL_RTSP_RTP 0x83
|
||||
#define AV_PROTOCOL_ED2K 0x85
|
||||
#define AV_PROTOCOL_MMS 0x84
|
||||
#define AV_PROTOCOL_RTMP 0x86
|
||||
#define AV_PROTOCOL_SIP 0x91
|
||||
#define AV_PROTOCOL_BT 0x08
|
||||
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define FILE_UNKNOWN 0x00
|
||||
#define FILE_VIDEO 0x60
|
||||
#define FILE_WMV 0x61
|
||||
#define FILE_MPG 0x62
|
||||
#define FILE_FLV 0x63
|
||||
#define FILE_RMFF 0x65
|
||||
#define FILE_AVI 0x66
|
||||
#define FILE_SWF 0x67
|
||||
#define FILE_MPG4 0x68
|
||||
#define FILE_AIFF 0x69
|
||||
#define FILE_OGG 0x6A
|
||||
#define FILE_DRC 0x6B
|
||||
#define FILE_DIRECTSHOW 0x6C
|
||||
#define FILE_FLIC 0x6D
|
||||
#define FILE_INDEO 0x6E
|
||||
#define FILE_MKV 0x6F
|
||||
|
||||
#define FILE_AUDIO 0x70
|
||||
#define FILE_MP3 0x71
|
||||
|
||||
#define FILE_OSMF 0xA1
|
||||
#define FILE_HLS 0xA2
|
||||
#define FILE_IOS 0xA3
|
||||
#define FILE_ANDRIOD 0xA4
|
||||
#define FILE_APP 0xA5
|
||||
|
||||
#define AUDIO_UNKNOWN 0xB0
|
||||
#define AUDIO_G711_ULAW 0xB1
|
||||
#define AUDIO_G711_ALAW 0xB2
|
||||
#define AUDIO_G722 0xB3
|
||||
#define AUDIO_G723 0xB4
|
||||
#define AUDIO_G726_40 0xB5
|
||||
#define AUDIO_G726_32 0xB6
|
||||
#define AUDIO_G726_24 0xB7
|
||||
#define AUDIO_G726_16 0xB8
|
||||
#define AUDIO_AAL2_G726_40 0xB9
|
||||
#define AUDIO_AAL2_G726_32 0xBA
|
||||
#define AUDIO_AAL2_G726_24 0xBB
|
||||
#define AUDIO_AAL2_G726_16 0xBC
|
||||
#define AUDIO_G728 0xBD
|
||||
#define AUDIO_G729D 0xBE
|
||||
#define AUDIO_G729E 0xBF
|
||||
#define AUDIO_GSM 0xC0
|
||||
#define AUDIO_GSM_EFR 0xC1
|
||||
#define AUDIO_ILBC 0xC2
|
||||
#define AUDIO_AMR 0xC3
|
||||
#define AUDIO_AMR_WB 0xC4
|
||||
#define AUDIO_SILK 0xC5
|
||||
#define AUDIO_LPC 0xC6
|
||||
#define AUDIO_LPC1016 0xC7
|
||||
#define AUDIO_LPC1015 0xC8
|
||||
#define AUDIO_L16 0xC9
|
||||
#define AUDIO_SPEEX 0xCA
|
||||
#define AUDIO_L8 0xCB
|
||||
#define AUDIO_MPA 0xCC
|
||||
#define AUDIO_DVI4 0xCD
|
||||
#define AUDIO_VDVI 0xCE
|
||||
#define AUDIO_CN 0xCF
|
||||
#define AUDIO_RED 0xD0
|
||||
#define AUDIO_QCELP 0xD1
|
||||
#define AUDIO_EVRC0 0xD2
|
||||
#define AUDIO_EVRCB0 0xD3
|
||||
#define AUDIO_G729 0xD4
|
||||
#define AUDIO_VIVOX 0xD5
|
||||
#define BE_FRAG_TYPE(t) ((t>=FILE_OSMF) && (t<=0xA2))
|
||||
#define BE_APP_TYPE(t) ((t>=FILE_IOS) && (t<=0xA5))
|
||||
#define BE_IMAGE_TYPE(t) ((t>=FILE_IMAGE) && (t<0x90))
|
||||
#define BE_VIDEO_TYPE(t) ((t>=FILE_VIDEO) && (t<0x70))
|
||||
#define BE_AUDIO_TYPE(t) ((t>=FILE_AUDIO) && (t<0x80))
|
||||
#define BE_VOIP_TYPE(t) ((t>=AUDIO_UNKNOWN) && (t<=AUDIO_VIVOX))
|
||||
|
||||
|
||||
#define FILE_IMAGE 0x80
|
||||
|
||||
#define FILE_JPG 0x84
|
||||
#define FILE_BMP 0x85
|
||||
#define FILE_GIF 0x86
|
||||
|
||||
#define MMS_TYPE 0x90
|
||||
#define HTTP_STREAM_TYPE 0x90
|
||||
#define RTSP_RDT_TYPE 0x92
|
||||
#define RTSP_RTP_TYPE 0x91
|
||||
|
||||
/*ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define SERVICE_FLAG_FD 0 // FenDu Flag
|
||||
#define SERVICE_FLAG_JC 1 // JianCe Flag
|
||||
// Defination of service type ;
|
||||
#define SERVICE_IPPORT_WHITE 0x01 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_IPPORT_BLACK 0x02 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_URL_WHITE 0x03 //<2F><>Ŀ<EFBFBD><C4BF>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_URL_BLACK 0x04 //<2F><>Ŀ<EFBFBD><C4BF>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_HOST_WHITE 0x05 //<2F><>Ŀ<EFBFBD><C4BF>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_HOST_BLACK 0x06 //<2F><>Ŀ<EFBFBD><C4BF>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
//add by lqy 20120427
|
||||
#define SERVICE_FAKE_SERVERIP 0x07 //<2F><><EFBFBD>ٷ<EFBFBD><D9B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD>
|
||||
|
||||
// added by cxj 20100811
|
||||
#define SERVICE_P2P_STATIC_WHITEIP 0x15
|
||||
#define SERVICE_P2P_BI_WHITEIP 0x16
|
||||
#define SERVICE_P2P_MI_WHITEIP 0x17
|
||||
|
||||
#define SERVICE_AUDIO_SAMPLE_FD 0x11
|
||||
#define SERVICE_VIDEO_LABEL_FD 0x21
|
||||
#define SERVICE_SPEEKER_FD 0x22
|
||||
#define SERVICE_VIDEO_SAMPLE_FD 0x23
|
||||
#define SERVICE_VIDEO_FACE_FD 0x24
|
||||
#define SERVICE_AUDIO_SEX_FD 0x25
|
||||
|
||||
#define SERVICE_IMAGE_SAMPLE_FD 0x31
|
||||
#define SERVICE_DYN_SUBSTR_FD 0x32
|
||||
|
||||
|
||||
#define SERVICE_P2P_EMULE_SERVER 0x51 //
|
||||
#define SERVICE_P2P_EMULE_KEY 0x52 //
|
||||
#define SERVICE_P2P_EMULE_FILEID 0x53 //
|
||||
#define SERVICE_P2P_EMULE_NODE 0x54 //
|
||||
|
||||
#define SERVICE_P2P_BT_INFOHASH 0x41 // BT Infohash Black List
|
||||
#define SERVICE_P2P_BT_NODE 0x44 // BT Bone Node
|
||||
#define SERVICE_P2P_BT_SERVICE 0x61 // BT DHT Index Server List
|
||||
|
||||
#define SERVICE_P2P_BT_ECLIPSE_IPLIST 0x45
|
||||
#define SERVICE_P2P_BT_POLLUTION_IPLIST 0x46
|
||||
#define SERVICE_P2P_EMULE_POLLUTION_IPLIST 0x55
|
||||
|
||||
#define SERVICE_P2P_BT_TRACKEIP 0x43 // BT tracke ip
|
||||
#define SERVICE_P2P_BT_PEERIP 0x47 // BT peer ip
|
||||
#define SERVICE_P2P_EMULE_PEERIP 0x56 // emule peer ip
|
||||
|
||||
|
||||
//
|
||||
#define SERVICE_EMULE_SERVER 0x71 //<2F><>ĿΨһID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_EMULE_KEYS 0x72 //<2F><>ĿΨһID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_EMULE_FHID 0x73 //emule<6C><65>hashkey<65><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_EMULE_FNAME 0x74 //emule<6C><65>hashkey<65><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_EMULE_NODE 0x75 //emule<6C><65>hashkey<65><79><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
|
||||
#define SERVICE_IPPORT_WHITE_JC 0x81 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_IPPORT_BLACK_JC 0x82 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_URL_WHITE_JC 0x83 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_URL_BLACK_JC 0x84 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_HOST_WHITE_JC 0x85 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_HOST_BLACK_JC 0x86 //IP+PORT<52><54><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
#define SERVICE_LOAD_ACTION_JC 0x87 /* liuxueli */
|
||||
#define SERVICE_USER_REGION_JC 0x88 /* liuxueli */
|
||||
|
||||
#define SERVICE_AUDIO_SAMPLE_JC 0x91
|
||||
#define SERVICE_SPEEKER_JC 0x92
|
||||
#define SERVICE_AUDIO_CONT_JC 0x93
|
||||
#define SERVICE_AUDIO_SECEN_JC 0x94
|
||||
#define SERVICE_AUDIO_LANG_JC 0x97
|
||||
#define SERVICE_AUDIO_LANG_FULL_JC 0x98
|
||||
|
||||
#define SERVICE_VIDEO_LOGO_JC 0xA1
|
||||
#define SERVICE_VIDEO_SRT_JC 0xA2
|
||||
#define SERVICE_VIDEO_SAMPLE_JC 0xA3
|
||||
#define SERVICE_VIDEO_FACE_JC 0xA4
|
||||
#define SERVICE_VIDEO_SEC_JC 0xA5
|
||||
|
||||
#define SERVICE_IMAGE_SAMPLE_JC 0xB1
|
||||
#define SERVICE_IMAGE_KEYWORD_JC 0xB2
|
||||
#define SERVICE_IMG_FEEDBACK_IP 0xB3
|
||||
#define SERVICE_IMG_FEEDBACK_SIZE 0xB4
|
||||
|
||||
|
||||
/*==================================<3D><>Ϣͷ<CFA2><CDB7>==============================================*/
|
||||
typedef struct msg_header_s
|
||||
{
|
||||
uint16_t magic;
|
||||
uint16_t m_type;
|
||||
uint32_t c_len;
|
||||
}msg_header_t;
|
||||
|
||||
/*==================================ָ<><D6B8><EFBFBD><EFBFBD>Ϣ==============================================*/
|
||||
typedef struct metainfo_s
|
||||
{
|
||||
char pid[8]; //ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint64_t proglen; //<2F><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽڳ<D6BD><DAB3>ȣ<EFBFBD>Ϊ0<CEAA><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>δ֪
|
||||
uint32_t capip; // <20><>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD>IP
|
||||
uint8_t protocol; // <20><><EFBFBD><EFBFBD>Э<EFBFBD><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t mediatype; // <20><><EFBFBD>ܵ<EFBFBD>ý<EFBFBD><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t pad2; // <20>̶<EFBFBD><CCB6><EFBFBD>0
|
||||
}metainfo_t;
|
||||
|
||||
|
||||
/*==================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ==============================================*/
|
||||
typedef struct av_data_s
|
||||
{
|
||||
char pid[8]; // <20><><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t frag_seq; // Ƭ<><C6AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int64_t offset:48; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>е<EFBFBD>ƫ<EFBFBD><C6AB>λ<EFBFBD><CEBB>
|
||||
char* avs; // <20><><EFBFBD><EFBFBD>Ƶ<EFBFBD><C6B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
}av_data_t;
|
||||
|
||||
/*==================================<3D><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ==================================================*/
|
||||
typedef struct msg_result_s
|
||||
{
|
||||
char pid[8]; // <20><><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC><EFBFBD>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t servicetype; // ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
int8_t level; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷȣ<C5B6> [0, 100]
|
||||
uint16_t pad; // Ԥ<><D4A4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>0ֵ
|
||||
uint32_t cfgid; // <20><><EFBFBD>е<EFBFBD><D0B5><EFBFBD><EFBFBD><EFBFBD>ID<49><44>ֵΪ0<CEAA><30>ʾ<EFBFBD><CABE><EFBFBD><EFBFBD>δ֪<CEB4><D6AA><EFBFBD><EFBFBD>
|
||||
char* logindex; //<2F><><EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD><D6B3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><C4BC>Ĵ洢·<E6B4A2><C2B7>URL<52><4C><EFBFBD><EFBFBD>"/0"<22><><EFBFBD><EFBFBD>
|
||||
}msg_result_t;
|
||||
|
||||
#endif
|
||||
107
src/AV_sendback_in.h
Normal file
107
src/AV_sendback_in.h
Normal file
@@ -0,0 +1,107 @@
|
||||
#ifndef _AV_SENDBACK_IN_H
|
||||
#define _AV_SENDBACK_IN_H
|
||||
|
||||
|
||||
#define AV_MEDAI_TYPE_MAXNUM 128
|
||||
#define AV_PROTO_MAXNUM 16
|
||||
|
||||
/*Э<><D0AD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ǰ<EFBFBD><C7B0>һ<EFBFBD><D2BB>*/
|
||||
#define AV_PROTOCOL_HTTP 0x01
|
||||
#define AV_PROTOCOL_SMTP 0x02
|
||||
#define AV_PROTOCOL_POP3 0x03
|
||||
#define AV_PROTOCOL_FTP 0x04
|
||||
#define AV_PROTOCOL_IMAP 0x05
|
||||
#define AV_PROTOCOL_HTTP_STREAM 0x81
|
||||
#define AV_PROTOCOL_RTSP_RDT 0x82
|
||||
#define AV_PROTOCOL_RTSP_RTP 0x83
|
||||
#define AV_PROTOCOL_ED2K 0x85
|
||||
#define AV_PROTOCOL_MMS 0x84
|
||||
#define AV_PROTOCOL_RTMP 0x86
|
||||
#define AV_PROTOCOL_SIP 0x91
|
||||
#define AV_PROTOCOL_BT 0x08
|
||||
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ǰ<EFBFBD><C7B0>һ<EFBFBD><D2BB>*/
|
||||
#define FILE_UNKNOWN 0x00
|
||||
#define FILE_VIDEO 0x60
|
||||
#define FILE_WMV 0x61
|
||||
#define FILE_MPG 0x62
|
||||
#define FILE_FLV 0x63
|
||||
#define FILE_RMFF 0x65
|
||||
#define FILE_AVI 0x66
|
||||
#define FILE_SWF 0x67
|
||||
#define FILE_MPG4 0x68
|
||||
#define FILE_AIFF 0x69
|
||||
#define FILE_OGG 0x6A
|
||||
#define FILE_DRC 0x6B
|
||||
#define FILE_DIRECTSHOW 0x6C
|
||||
#define FILE_FLIC 0x6D
|
||||
#define FILE_INDEO 0x6E
|
||||
#define FILE_MKV 0x6F
|
||||
|
||||
#define FILE_AUDIO 0x70
|
||||
#define FILE_MP3 0x71
|
||||
|
||||
#define FILE_OSMF 0xA1
|
||||
#define FILE_HLS 0xA2
|
||||
#define FILE_IOS 0xA3
|
||||
#define FILE_ANDRIOD 0xA4
|
||||
#define FILE_APP 0xA5
|
||||
|
||||
#define AUDIO_UNKNOWN 0xB0
|
||||
#define AUDIO_G711_ULAW 0xB1
|
||||
#define AUDIO_G711_ALAW 0xB2
|
||||
#define AUDIO_G722 0xB3
|
||||
#define AUDIO_G723 0xB4
|
||||
#define AUDIO_G726_40 0xB5
|
||||
#define AUDIO_G726_32 0xB6
|
||||
#define AUDIO_G726_24 0xB7
|
||||
#define AUDIO_G726_16 0xB8
|
||||
#define AUDIO_AAL2_G726_40 0xB9
|
||||
#define AUDIO_AAL2_G726_32 0xBA
|
||||
#define AUDIO_AAL2_G726_24 0xBB
|
||||
#define AUDIO_AAL2_G726_16 0xBC
|
||||
#define AUDIO_G728 0xBD
|
||||
#define AUDIO_G729D 0xBE
|
||||
#define AUDIO_G729E 0xBF
|
||||
#define AUDIO_GSM 0xC0
|
||||
#define AUDIO_GSM_EFR 0xC1
|
||||
#define AUDIO_ILBC 0xC2
|
||||
#define AUDIO_AMR 0xC3
|
||||
#define AUDIO_AMR_WB 0xC4
|
||||
#define AUDIO_SILK 0xC5
|
||||
#define AUDIO_LPC 0xC6
|
||||
#define AUDIO_LPC1016 0xC7
|
||||
#define AUDIO_LPC1015 0xC8
|
||||
#define AUDIO_L16 0xC9
|
||||
#define AUDIO_SPEEX 0xCA
|
||||
#define AUDIO_L8 0xCB
|
||||
#define AUDIO_MPA 0xCC
|
||||
#define AUDIO_DVI4 0xCD
|
||||
#define AUDIO_VDVI 0xCE
|
||||
#define AUDIO_CN 0xCF
|
||||
#define AUDIO_RED 0xD0
|
||||
#define AUDIO_QCELP 0xD1
|
||||
#define AUDIO_EVRC0 0xD2
|
||||
#define AUDIO_EVRCB0 0xD3
|
||||
#define AUDIO_G729 0xD4
|
||||
#define AUDIO_VIVOX 0xD5
|
||||
|
||||
#define FILE_IMAGE 0x80
|
||||
|
||||
#define FILE_JPG 0x84
|
||||
#define FILE_BMP 0x85
|
||||
#define FILE_GIF 0x86
|
||||
|
||||
#define MMS_TYPE 0x90
|
||||
#define HTTP_STREAM_TYPE 0x90
|
||||
#define RTSP_RDT_TYPE 0x92
|
||||
#define RTSP_RTP_TYPE 0x91
|
||||
|
||||
typedef struct msg_map_s
|
||||
{
|
||||
uint8_t nodeA;
|
||||
uint8_t nodeB;
|
||||
}msg_map_t;
|
||||
|
||||
|
||||
#endif
|
||||
76
src/KafkaProducer.cpp
Normal file
76
src/KafkaProducer.cpp
Normal file
@@ -0,0 +1,76 @@
|
||||
/*
|
||||
* KafkaProducer.cpp
|
||||
*
|
||||
* Created on:
|
||||
* Author:
|
||||
*/
|
||||
#include "KafkaProducer.h"
|
||||
|
||||
KafkaProducer::KafkaProducer(const string& b):brokers(b)
|
||||
{
|
||||
partition = RD_KAFKA_PARTITION_UA;
|
||||
};
|
||||
|
||||
int KafkaProducer::KafkaConnection()
|
||||
{
|
||||
config = rd_kafka_conf_new();
|
||||
rd_kafka_conf_set(config, "queue.buffering.max.messages", "1000000", NULL, 0);
|
||||
rd_kafka_conf_set(config, "topic.metadata.refresh.interval.ms", "600000", NULL, 0);
|
||||
|
||||
if (!(kafka = rd_kafka_new(RD_KAFKA_PRODUCER, config, errString, sizeof(errString))))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (rd_kafka_brokers_add(kafka, brokers.c_str()) == 0)
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
KafkaProducer::~KafkaProducer()
|
||||
{
|
||||
rd_kafka_destroy(kafka);
|
||||
for(iter = topicHandleMap.begin(); iter!=topicHandleMap.end(); ++iter)
|
||||
{
|
||||
rd_kafka_topic_destroy(iter->second);
|
||||
}
|
||||
rd_kafka_wait_destroyed(5000);
|
||||
}
|
||||
|
||||
rd_kafka_topic_t* KafkaProducer::CreateTopicHandle(const string& topicName)
|
||||
{
|
||||
if(!topicHandleMap.count(topicName))
|
||||
{
|
||||
rd_kafka_topic_conf_t* config = rd_kafka_topic_conf_new();
|
||||
rd_kafka_topic_t* rkt = rd_kafka_topic_new(kafka, topicName.c_str(), config);
|
||||
topicHandleMap[topicName] = rkt;
|
||||
}
|
||||
return topicHandleMap[topicName];
|
||||
}
|
||||
|
||||
int KafkaProducer::SendData(string& topicName, void *payload, size_t paylen)
|
||||
{
|
||||
rd_kafka_topic_t* currentTopicHandle = topicHandleMap[topicName];
|
||||
|
||||
int status = rd_kafka_produce(currentTopicHandle, partition, RD_KAFKA_MSG_F_COPY, payload,
|
||||
paylen, NULL, 0, NULL);
|
||||
return status;
|
||||
|
||||
}
|
||||
|
||||
int KafkaProducer::MessageInQueue()
|
||||
{
|
||||
return rd_kafka_outq_len(kafka);
|
||||
}
|
||||
|
||||
void KafkaProducer::KafkaPoll(int interval)
|
||||
{
|
||||
rd_kafka_poll(kafka, interval);
|
||||
}
|
||||
|
||||
|
||||
|
||||
|
||||
54
src/KafkaProducer.h
Normal file
54
src/KafkaProducer.h
Normal file
@@ -0,0 +1,54 @@
|
||||
/*
|
||||
* kafkaProducer.h
|
||||
*
|
||||
* Created on:
|
||||
* Author:
|
||||
*/
|
||||
|
||||
#ifndef KAFKAPRODUCER_H_
|
||||
#define KAFKAPRODUCER_H_
|
||||
|
||||
#include <string>
|
||||
#include <iostream>
|
||||
#include <map>
|
||||
|
||||
|
||||
extern "C"
|
||||
{
|
||||
#include "librdkafka/rdkafka.h"
|
||||
}
|
||||
|
||||
using namespace std;
|
||||
|
||||
|
||||
class KafkaProducer
|
||||
{
|
||||
public:
|
||||
KafkaProducer(const string& b);
|
||||
|
||||
~KafkaProducer();
|
||||
|
||||
int KafkaConnection();
|
||||
|
||||
int SendData(string& topicName, void *payload, size_t paylen);
|
||||
|
||||
int MessageInQueue();
|
||||
|
||||
void KafkaPoll(int interval);
|
||||
rd_kafka_topic_t* CreateTopicHandle(const string& topicName);
|
||||
|
||||
private:
|
||||
int partition;
|
||||
|
||||
string brokers;
|
||||
char errString[512];
|
||||
|
||||
rd_kafka_conf_t* config;
|
||||
rd_kafka_t* kafka;
|
||||
map < string, rd_kafka_topic_t* > topicHandleMap;
|
||||
map < string, rd_kafka_topic_t* >::iterator iter;
|
||||
};
|
||||
|
||||
|
||||
|
||||
#endif /* KAFKAPRODUCER_H_ */
|
||||
62
src/Makefile
Normal file
62
src/Makefile
Normal file
@@ -0,0 +1,62 @@
|
||||
vpath %.a ../lib
|
||||
vpath %.h ./inc
|
||||
|
||||
PAPP_PATH=/home/mesasoft/frag_rssb/
|
||||
|
||||
#CFLAGS = -g3 -Wall -fPIC -Werror -O
|
||||
#CFLAGS = -g3 -Wall -fPIC -O
|
||||
INCLUDES = -I./inc/
|
||||
INCLUDES += -I/usr/include/MESA/
|
||||
INCLUDES += -I./support/hiredis-vip-master/
|
||||
CFLAGS = -g3 -Wall -fPIC -D__STDC_FORMAT_MACROS
|
||||
CFLAGS += $(INCLUDES)
|
||||
#LDDICTATOR = -Wl,-wrap,malloc -Wl,-wrap,calloc -Wl,-wrap,free -Wl,-wrap,realloc
|
||||
LDDICTATOR =
|
||||
CC = g++
|
||||
CCC = g++
|
||||
|
||||
LIB = -L./lib/
|
||||
LIB += -lsoqav_dedup
|
||||
#LIB += -lappdetect
|
||||
LIB += -lrdkafka
|
||||
LIB += -lssl -lcrypto
|
||||
LIB += -lMESA_handle_logger -lMESA_prof_load -lmaatframe -lrulescan -lMESA_htable -lMESA_field_stat2 -lpthread -lasmislog -lwiredcfg -lWiredLB
|
||||
LIB += ./lib/libsifter.a ./lib/libmy_socket.a ./lib/libbusinessman.a ./lib/libMESA_trace.a ./lib/lib_interval_index.a ./lib/lib_MESA_timer.a
|
||||
#LIB += -lhiredis_vip
|
||||
LIB += ./lib/libhiredis_vip.a
|
||||
LIB += ./lib/usm_comm.a
|
||||
#LIB += ./lib/libdictator_debug.a
|
||||
|
||||
LIB_FILE = $(wildcard ../lib/*.a)
|
||||
SOURCES = $(wildcard *.c)
|
||||
SOURCESCPP = $(wildcard *.cpp)
|
||||
OBJECTS = $(SOURCES:.c=.o)
|
||||
OBJECTSCPP = $(SOURCESCPP:.cpp=.o)
|
||||
#DEPS = $(SOURCES:.c=.d)
|
||||
|
||||
|
||||
TARGET = rssb_maskey
|
||||
|
||||
.PHONY:clean all
|
||||
|
||||
all:$(TARGET)
|
||||
|
||||
$(TARGET):$(OBJECTS) $(OBJECTSCPP) $(LIB_FILE)
|
||||
#$(CCC) -shared $(CFLAGS) $(OBJECTS) $(LIB) -o $@
|
||||
$(CCC) $(CFLAGS) $(OBJECTS) $(OBJECTSCPP) $(LIB) $(LDDICTATOR) -o $@
|
||||
cp $(TARGET) ../bin/
|
||||
cp $(TARGET) /home/mesasoft/frag_rssb/
|
||||
|
||||
.c.o:
|
||||
#%.d:%.c
|
||||
# $(CCC) $< -MM $(INCLUDES) > $@
|
||||
|
||||
.cpp.o:
|
||||
#%.dpp:%.cpp
|
||||
$(CCC) $(CFLAGS) -c $<
|
||||
|
||||
-include $(DEPS)
|
||||
|
||||
clean :
|
||||
rm -f $(OBJECTS) $(DEPS) $(TARGET)
|
||||
|
||||
393
src/av_record.c
Normal file
393
src/av_record.c
Normal file
@@ -0,0 +1,393 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
#include "stream_fuzzy_hash.h"
|
||||
|
||||
#include "av_record.h"
|
||||
#include "common.h"
|
||||
#include "log.h"
|
||||
#include "frag_reassembly_in.h"
|
||||
#include "frag_proc.h"
|
||||
|
||||
extern frag_rssb_parameter_t g_frag_run;
|
||||
extern frag_rssb_configure_t g_frag_cfg;
|
||||
extern frag_rssb_status_t g_frag_stat;
|
||||
|
||||
void free_av_record(av_record_t* av_record)
|
||||
{
|
||||
if(NULL!=av_record->url)
|
||||
{
|
||||
free(av_record->url);
|
||||
}
|
||||
if(NULL!=av_record->referer)
|
||||
{
|
||||
free(av_record->referer);
|
||||
}
|
||||
if(NULL!=av_record->addr)
|
||||
{
|
||||
free(av_record->addr);
|
||||
}
|
||||
free(av_record);
|
||||
}
|
||||
|
||||
int av_record_open_file(int tid)
|
||||
{
|
||||
char str_time[64];
|
||||
time_t currTime;
|
||||
struct tm* now;
|
||||
char filename[MAX_PATH_LEN] = {0};
|
||||
|
||||
time(&currTime);
|
||||
now = localtime(&currTime);
|
||||
strftime(str_time, sizeof(str_time), "%Y-%m-%d-%H-%M-%S", now);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/av_record_capip%u_tid%d_%s", g_frag_cfg.avrecord_filepath, g_frag_cfg.local_ip_nr, tid ,str_time);
|
||||
g_frag_run.av_record_curfile[tid] = fopen(filename,"a+");
|
||||
if(NULL==g_frag_run.av_record_curfile[tid])
|
||||
{
|
||||
MESA_handle_runtime_log(g_frag_run.logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} av_record open filr error: [filename:%s]", __FILE__,__LINE__, filename);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* av_record_thread(void *param)
|
||||
{
|
||||
av_record_t* av_record = NULL;
|
||||
long av_record_len = sizeof(av_record);
|
||||
int rec = 0;
|
||||
long tid = (long)param;
|
||||
|
||||
while(1)
|
||||
{
|
||||
av_record = NULL;
|
||||
rec = MESA_lqueue_get_head(g_frag_run.av_record_lq[tid], &av_record, &av_record_len);
|
||||
if(0!=rec)
|
||||
{
|
||||
usleep(10);
|
||||
continue;
|
||||
}
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[AV_RECORD_QUEUE][QUEUE_OUT]);
|
||||
/*first*/
|
||||
if(NULL==g_frag_run.av_record_curfile[tid])
|
||||
{
|
||||
if(av_record_open_file(tid)<0)
|
||||
{
|
||||
free_av_record(av_record);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/*file full*/
|
||||
if(g_frag_run.av_record_curcnt[tid]>=g_frag_cfg.avrecord_maxnum)
|
||||
{
|
||||
fclose(g_frag_run.av_record_curfile[tid]);
|
||||
if(av_record_open_file(tid)<0)
|
||||
{
|
||||
free_av_record(av_record);
|
||||
continue;
|
||||
}
|
||||
g_frag_run.av_record_curcnt[tid] = 0;
|
||||
}
|
||||
/*capip*/
|
||||
char capip4[18] = {0};
|
||||
inet_ntop(AF_INET,(const void *)&av_record->capIP,capip4,18);
|
||||
/*av record write to file*/
|
||||
/*mid*//*media_type*/ /*media_len*/
|
||||
fprintf(g_frag_run.av_record_curfile[tid],"%lu;0x%02x;%lu;%s", av_record->mid,
|
||||
av_record->media_type,
|
||||
av_record->media_len,
|
||||
capip4);
|
||||
/*url*/
|
||||
if(NULL!=av_record->url)
|
||||
{
|
||||
fwrite(";", 1, 1, g_frag_run.av_record_curfile[tid]);
|
||||
fwrite(av_record->url, av_record->url_len, 1, g_frag_run.av_record_curfile[tid]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(g_frag_run.av_record_curfile[tid],";NULL");
|
||||
|
||||
}
|
||||
/*referer*/
|
||||
if(NULL!=av_record->referer)
|
||||
{
|
||||
fwrite(";", 1, 1, g_frag_run.av_record_curfile[tid]);
|
||||
fwrite(av_record->referer, av_record->referer_len, 1, g_frag_run.av_record_curfile[tid]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(g_frag_run.av_record_curfile[tid],";NULL");
|
||||
|
||||
}
|
||||
fwrite("\n", 1, 1, g_frag_run.av_record_curfile[tid]);
|
||||
fflush(g_frag_run.av_record_curfile[tid]);
|
||||
|
||||
g_frag_run.av_record_curcnt[tid]++;
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_AV_RECORD]);
|
||||
free_av_record(av_record);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int av_record(frag_unit_t* frg_unit)
|
||||
{
|
||||
if(g_frag_cfg.avrecord_switch!=AV_RECORD_TYPR_BASIC) return 0;
|
||||
|
||||
av_record_t* av_record = (av_record_t*)calloc(1, sizeof(av_record_t));
|
||||
av_record->mid = frg_unit->mid;
|
||||
av_record->media_len = frg_unit->media_len;
|
||||
av_record->media_type = frg_unit->media_type;
|
||||
av_record->capIP = frg_unit->capIP;
|
||||
|
||||
/*addr*/
|
||||
if(NULL!=frg_unit->opt[MEDIA_OPT_ADDR])
|
||||
{
|
||||
av_record->addr = (char*)malloc(frg_unit->opt[MEDIA_OPT_ADDR]->opt_len);
|
||||
av_record->addr_len = frg_unit->opt[MEDIA_OPT_ADDR]->opt_len;
|
||||
memcpy(av_record->addr, frg_unit->opt[MEDIA_OPT_ADDR]->opt_value, frg_unit->opt[MEDIA_OPT_ADDR]->opt_len);
|
||||
}
|
||||
/*url*/
|
||||
if(NULL!=frg_unit->opt[MEDIA_OPT_URL])
|
||||
{
|
||||
av_record->url = (char*)malloc(frg_unit->opt[MEDIA_OPT_URL]->opt_len);
|
||||
av_record->url_len = frg_unit->opt[MEDIA_OPT_URL]->opt_len;
|
||||
memcpy(av_record->url, frg_unit->opt[MEDIA_OPT_URL]->opt_value, frg_unit->opt[MEDIA_OPT_URL]->opt_len);
|
||||
}
|
||||
/*referer*/
|
||||
if(NULL!=frg_unit->opt[MEDIA_OPT_REFERER])
|
||||
{
|
||||
av_record->referer = (char*)malloc(frg_unit->opt[MEDIA_OPT_REFERER]->opt_len);
|
||||
av_record->referer_len = frg_unit->opt[MEDIA_OPT_REFERER]->opt_len;
|
||||
memcpy(av_record->referer, frg_unit->opt[MEDIA_OPT_REFERER]->opt_value, frg_unit->opt[MEDIA_OPT_REFERER]->opt_len);
|
||||
}
|
||||
MESA_lqueue_join_tail(g_frag_run.av_record_lq[frg_unit->thread_seq], &av_record, sizeof(av_record));
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[AV_RECORD_QUEUE][QUEUE_IN]);
|
||||
return 1;
|
||||
}
|
||||
|
||||
void free_av_digest_record(av_digest_record_t* av_digest_record)
|
||||
{
|
||||
if(NULL!=av_digest_record->digest)
|
||||
{
|
||||
free(av_digest_record->digest);
|
||||
}
|
||||
free(av_digest_record);
|
||||
}
|
||||
|
||||
int av_digest_record_open_file(int tid)
|
||||
{
|
||||
char str_time[64];
|
||||
time_t currTime;
|
||||
struct tm* now;
|
||||
char filename[MAX_PATH_LEN] = {0};
|
||||
|
||||
time(&currTime);
|
||||
now = localtime(&currTime);
|
||||
strftime(str_time, sizeof(str_time), "%Y-%m-%d-%H-%M-%S", now);
|
||||
|
||||
snprintf(filename, sizeof(filename), "%s/av_digest_record_capip%u_tid%d_%s", g_frag_cfg.avrecord_filepath, g_frag_cfg.local_ip_nr, tid, str_time);
|
||||
g_frag_run.av_digest_record_curfile[tid] = fopen(filename,"a+");
|
||||
if(NULL==g_frag_run.av_digest_record_curfile[tid])
|
||||
{
|
||||
MESA_handle_runtime_log(g_frag_run.logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} av_digest_record open filr error: [filename:%s]", __FILE__,__LINE__, filename);
|
||||
return -1;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void* av_digest_record_thread(void *param)
|
||||
{
|
||||
av_digest_record_t* av_digest_record = NULL;
|
||||
long av_digest_record_len = sizeof(av_digest_record_t);
|
||||
int rec = 0;
|
||||
long tid = (long)param;
|
||||
time_t currTime;
|
||||
struct tm* now;
|
||||
char strTime[32] = {0};
|
||||
char td[TD_LEN] = {0};
|
||||
|
||||
while(1)
|
||||
{
|
||||
av_digest_record = NULL;
|
||||
rec = MESA_lqueue_get_head(g_frag_run.av_digest_record_lq[tid], &av_digest_record, &av_digest_record_len);
|
||||
if(0!=rec)
|
||||
{
|
||||
usleep(10);
|
||||
continue;
|
||||
}
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[AV_DIGEST_RECORD_QUEUE][QUEUE_OUT]);
|
||||
/*first*/
|
||||
if(NULL==g_frag_run.av_digest_record_curfile[tid])
|
||||
{
|
||||
if(av_digest_record_open_file(tid)<0)
|
||||
{
|
||||
free_av_digest_record(av_digest_record);
|
||||
continue;
|
||||
}
|
||||
}
|
||||
/*file full*/ /*maxnum and path are same with avrecord*/
|
||||
if(g_frag_run.av_digest_record_curcnt[tid]>=g_frag_cfg.avrecord_maxnum)
|
||||
{
|
||||
fclose(g_frag_run.av_digest_record_curfile[tid]);
|
||||
if(av_digest_record_open_file(tid)<0)
|
||||
{
|
||||
free_av_digest_record(av_digest_record);
|
||||
continue;
|
||||
}
|
||||
g_frag_run.av_digest_record_curcnt[tid] = 0;
|
||||
}
|
||||
/*av fuzzy record write to file*/
|
||||
time(&currTime);
|
||||
now = localtime(&currTime);
|
||||
memset(strTime, 0, sizeof(strTime) );
|
||||
strftime(strTime, sizeof(strTime), "%Y-%m-%d %H:%M:%S", now);
|
||||
if(g_frag_cfg.avrecord_switch==AV_RECORD_TYPR_TD)
|
||||
{
|
||||
/*mid*/ /*media_type*/ /*media_len*/
|
||||
fprintf(g_frag_run.av_digest_record_curfile[tid],"%s;%lu;0x%02x;%lu", strTime,
|
||||
av_digest_record->mid,
|
||||
av_digest_record->media_type,
|
||||
av_digest_record->media_len);
|
||||
|
||||
/*td_ori*/
|
||||
fwrite(";", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fwrite(av_digest_record->td_ori, av_digest_record->td_ori_len-1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
|
||||
/*td_0k*/
|
||||
caculate_md5(av_digest_record->td_ori, av_digest_record->td_ori_len, NULL, 0, td, TD_LEN);
|
||||
fwrite(";", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fwrite(td, strlen(td), 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
|
||||
/*td_data_md5_1k*/ /*td_1k*/
|
||||
/*td_data_md5_2k*/ /*td_2k*/
|
||||
/*td_data_md5_4k*/ /*td_4k*/
|
||||
/*td_data_md5_8k*/ /*td_8k*/
|
||||
/*td_data_md5_16k*/ /*td_16k*/
|
||||
/*td_data_md5_32k*/ /*td_32k*/
|
||||
/*td_data_md5_64k*/ /*td_64k*/
|
||||
int i=0;
|
||||
for(int j=0;j<=6;j++)
|
||||
{
|
||||
i=1<<j;
|
||||
if(av_digest_record->td_data_len>=i*1024)
|
||||
{
|
||||
caculate_md5(NULL, 0, av_digest_record->td_data, i*1024, td, TD_LEN);
|
||||
fwrite(";", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fwrite(td, strlen(td), 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
caculate_md5(av_digest_record->td_ori, av_digest_record->td_ori_len, av_digest_record->td_data, i*1024, td, TD_LEN);
|
||||
fwrite(";", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fwrite(td, strlen(td), 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*mid*/ /*media_type*/ /*media_len*/ /*digist len*/
|
||||
fprintf(g_frag_run.av_digest_record_curfile[tid],"%s;%lu;0x%02x;%lu", strTime,
|
||||
av_digest_record->mid,
|
||||
av_digest_record->media_type,
|
||||
av_digest_record->media_len);
|
||||
}
|
||||
|
||||
/*digist*/ /*digist len*/
|
||||
fprintf(g_frag_run.av_digest_record_curfile[tid],";%lu",av_digest_record->digest_len);
|
||||
if(NULL!=av_digest_record->digest)
|
||||
{
|
||||
fwrite(";", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fwrite(av_digest_record->digest, av_digest_record->digest_len, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(g_frag_run.av_digest_record_curfile[tid],";NULL");
|
||||
}
|
||||
|
||||
/*url*/
|
||||
if(NULL!=av_digest_record->url)
|
||||
{
|
||||
fwrite(";", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fwrite(av_digest_record->url, av_digest_record->url_len, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
}
|
||||
else
|
||||
{
|
||||
fprintf(g_frag_run.av_digest_record_curfile[tid],";NULL");
|
||||
}
|
||||
|
||||
fwrite("\n", 1, 1, g_frag_run.av_digest_record_curfile[tid]);
|
||||
fflush(g_frag_run.av_digest_record_curfile[tid]);
|
||||
|
||||
g_frag_run.av_digest_record_curcnt[tid]++;
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_AV_DIGEST_RECORD]);
|
||||
free_av_digest_record(av_digest_record);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
/*record the last url*/
|
||||
int av_digest_record(media_t* mdi)
|
||||
{
|
||||
if(!g_frag_cfg.avrecord_switch) return 0;
|
||||
char* digest_buff = NULL;
|
||||
unsigned long long digest_len = 0;
|
||||
|
||||
if(g_frag_cfg.avrecord_switch==AV_RECORD_TYPR_TD && !mdi->td_complete) return 0;
|
||||
|
||||
av_digest_record_t* av_digest_record = (av_digest_record_t*)calloc(1, sizeof(av_digest_record_t));
|
||||
av_digest_record->mid = mdi->mid;
|
||||
av_digest_record->media_len = mdi->media_len;
|
||||
av_digest_record->media_type = mdi->media_type;
|
||||
|
||||
/*digest*/
|
||||
digest_len = SFH_status(mdi->fuzzy, HASH_LENGTH);
|
||||
digest_buff = (char*)malloc(sizeof(char)*digest_len);
|
||||
av_digest_record->digest_len = SFH_digest(mdi->fuzzy, digest_buff, digest_len);
|
||||
av_digest_record->digest = digest_buff;
|
||||
/*free by av_fuzzy_record_t*/
|
||||
digest_buff = NULL;
|
||||
|
||||
/*td information*/
|
||||
if(g_frag_cfg.avrecord_switch==AV_RECORD_TYPR_TD && mdi->td_complete)
|
||||
{
|
||||
av_digest_record->td_ori_len = mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len;
|
||||
av_digest_record->td_ori = (char*)calloc(1, av_digest_record->td_ori_len);
|
||||
memcpy(av_digest_record->td_ori, mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len);
|
||||
|
||||
av_digest_record->td_data_len = mdi->td_datalen;
|
||||
av_digest_record->td_data = (char*)malloc(mdi->td_datalen);
|
||||
memcpy(av_digest_record->td_data, mdi->td_data, mdi->td_datalen);
|
||||
}
|
||||
|
||||
/*url*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index])
|
||||
{
|
||||
av_digest_record->url = (char*)malloc(mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
av_digest_record->url_len = mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len;
|
||||
memcpy(av_digest_record->url, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
}
|
||||
|
||||
MESA_lqueue_join_tail(g_frag_run.av_digest_record_lq[mdi->thread_seq], &av_digest_record, sizeof(av_digest_record));
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[AV_DIGEST_RECORD_QUEUE][QUEUE_IN]);
|
||||
|
||||
return 1;
|
||||
}
|
||||
|
||||
52
src/av_record.h
Normal file
52
src/av_record.h
Normal file
@@ -0,0 +1,52 @@
|
||||
#ifndef _AV_RECORD_H
|
||||
#define _AV_RECORD_H
|
||||
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
#define AV_RECORD_TYPR_BASIC 1 //basic information
|
||||
#define AV_RECORD_TYPR_TD 2 //TD information
|
||||
|
||||
typedef struct av_record_s
|
||||
{
|
||||
uint64_t mid;
|
||||
uint64_t media_len;
|
||||
uint8_t media_type;
|
||||
uint16_t _pad_;
|
||||
uint32_t capIP;
|
||||
char* addr;
|
||||
char* url;
|
||||
char* referer;
|
||||
uint32_t url_len;
|
||||
uint32_t referer_len;
|
||||
uint32_t addr_len; /*IPV4 IPV6*/
|
||||
}av_record_t;
|
||||
|
||||
typedef struct av_digest_record_s
|
||||
{
|
||||
uint64_t mid;
|
||||
uint64_t media_len;
|
||||
uint64_t digest_len;
|
||||
uint64_t td_data_len;
|
||||
char* digest;
|
||||
char* url;
|
||||
char* td_ori; /*<2A><><EFBFBD><EFBFBD>\0*/
|
||||
char* td_data;
|
||||
uint32_t url_len;
|
||||
uint32_t td_ori_len;
|
||||
uint8_t media_type;
|
||||
}av_digest_record_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int av_record(frag_unit_t* frg_unit);
|
||||
int av_digest_record(media_t* mdi);
|
||||
void* av_record_thread(void *param);
|
||||
void* av_digest_record_thread(void *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
596
src/cJSON.c
Normal file
596
src/cJSON.c
Normal file
@@ -0,0 +1,596 @@
|
||||
/*
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
/* cJSON */
|
||||
/* JSON parser in C. */
|
||||
|
||||
#include <string.h>
|
||||
#include <stdio.h>
|
||||
#include <math.h>
|
||||
#include <stdlib.h>
|
||||
#include <float.h>
|
||||
#include <limits.h>
|
||||
#include <ctype.h>
|
||||
#include "cJSON.h"
|
||||
|
||||
static const char *ep;
|
||||
|
||||
const char *cJSON_GetErrorPtr(void) {return ep;}
|
||||
|
||||
static int cJSON_strcasecmp(const char *s1,const char *s2)
|
||||
{
|
||||
if (!s1) return (s1==s2)?0:1;if (!s2) return 1;
|
||||
for(; tolower(*s1) == tolower(*s2); ++s1, ++s2) if(*s1 == 0) return 0;
|
||||
return tolower(*(const unsigned char *)s1) - tolower(*(const unsigned char *)s2);
|
||||
}
|
||||
|
||||
static void *(*cJSON_malloc)(size_t sz) = malloc;
|
||||
static void (*cJSON_free)(void *ptr) = free;
|
||||
|
||||
static char* cJSON_strdup(const char* str)
|
||||
{
|
||||
size_t len;
|
||||
char* copy;
|
||||
|
||||
len = strlen(str) + 1;
|
||||
if (!(copy = (char*)cJSON_malloc(len))) return 0;
|
||||
memcpy(copy,str,len);
|
||||
return copy;
|
||||
}
|
||||
|
||||
void cJSON_InitHooks(cJSON_Hooks* hooks)
|
||||
{
|
||||
if (!hooks) { /* Reset hooks */
|
||||
cJSON_malloc = malloc;
|
||||
cJSON_free = free;
|
||||
return;
|
||||
}
|
||||
|
||||
cJSON_malloc = (hooks->malloc_fn)?hooks->malloc_fn:malloc;
|
||||
cJSON_free = (hooks->free_fn)?hooks->free_fn:free;
|
||||
}
|
||||
|
||||
/* Internal constructor. */
|
||||
static cJSON *cJSON_New_Item(void)
|
||||
{
|
||||
cJSON* node = (cJSON*)cJSON_malloc(sizeof(cJSON));
|
||||
if (node) memset(node,0,sizeof(cJSON));
|
||||
return node;
|
||||
}
|
||||
|
||||
/* Delete a cJSON structure. */
|
||||
void cJSON_Delete(cJSON *c)
|
||||
{
|
||||
cJSON *next;
|
||||
while (c)
|
||||
{
|
||||
next=c->next;
|
||||
if (!(c->type&cJSON_IsReference) && c->child) cJSON_Delete(c->child);
|
||||
if (!(c->type&cJSON_IsReference) && c->valuestring) cJSON_free(c->valuestring);
|
||||
if (c->string) cJSON_free(c->string);
|
||||
cJSON_free(c);
|
||||
c=next;
|
||||
}
|
||||
}
|
||||
|
||||
/* Parse the input text to generate a number, and populate the result into item. */
|
||||
static const char *parse_number(cJSON *item,const char *num)
|
||||
{
|
||||
double n=0,sign=1,scale=0;int subscale=0,signsubscale=1;
|
||||
|
||||
if (*num=='-') sign=-1,num++; /* Has sign? */
|
||||
if (*num=='0') num++; /* is zero */
|
||||
if (*num>='1' && *num<='9') do n=(n*10.0)+(*num++ -'0'); while (*num>='0' && *num<='9'); /* Number? */
|
||||
if (*num=='.' && num[1]>='0' && num[1]<='9') {num++; do n=(n*10.0)+(*num++ -'0'),scale--; while (*num>='0' && *num<='9');} /* Fractional part? */
|
||||
if (*num=='e' || *num=='E') /* Exponent? */
|
||||
{ num++;if (*num=='+') num++; else if (*num=='-') signsubscale=-1,num++; /* With sign? */
|
||||
while (*num>='0' && *num<='9') subscale=(subscale*10)+(*num++ - '0'); /* Number? */
|
||||
}
|
||||
|
||||
n=sign*n*pow(10.0,(scale+subscale*signsubscale)); /* number = +/- number.fraction * 10^+/- exponent */
|
||||
|
||||
item->valuedouble=n;
|
||||
item->valueint=(int)n;
|
||||
item->type=cJSON_Number;
|
||||
return num;
|
||||
}
|
||||
|
||||
/* Render the number nicely from the given item into a string. */
|
||||
static char *print_number(cJSON *item)
|
||||
{
|
||||
char *str;
|
||||
double d=item->valuedouble;
|
||||
if (fabs(((double)item->valueint)-d)<=DBL_EPSILON && d<=INT_MAX && d>=INT_MIN)
|
||||
{
|
||||
str=(char*)cJSON_malloc(21); /* 2^64+1 can be represented in 21 chars. */
|
||||
if (str) sprintf(str,"%d",item->valueint);
|
||||
}
|
||||
else
|
||||
{
|
||||
str=(char*)cJSON_malloc(64); /* This is a nice tradeoff. */
|
||||
if (str)
|
||||
{
|
||||
if (fabs(floor(d)-d)<=DBL_EPSILON && fabs(d)<1.0e60)sprintf(str,"%.0f",d);
|
||||
else if (fabs(d)<1.0e-6 || fabs(d)>1.0e9) sprintf(str,"%e",d);
|
||||
else sprintf(str,"%f",d);
|
||||
}
|
||||
}
|
||||
return str;
|
||||
}
|
||||
|
||||
static unsigned parse_hex4(const char *str)
|
||||
{
|
||||
unsigned h=0;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
h=h<<4;str++;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
h=h<<4;str++;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
h=h<<4;str++;
|
||||
if (*str>='0' && *str<='9') h+=(*str)-'0'; else if (*str>='A' && *str<='F') h+=10+(*str)-'A'; else if (*str>='a' && *str<='f') h+=10+(*str)-'a'; else return 0;
|
||||
return h;
|
||||
}
|
||||
|
||||
/* Parse the input text into an unescaped cstring, and populate item. */
|
||||
static const unsigned char firstByteMark[7] = { 0x00, 0x00, 0xC0, 0xE0, 0xF0, 0xF8, 0xFC };
|
||||
static const char *parse_string(cJSON *item,const char *str)
|
||||
{
|
||||
const char *ptr=str+1;char *ptr2;char *out;int len=0;unsigned uc,uc2;
|
||||
if (*str!='\"') {ep=str;return 0;} /* not a string! */
|
||||
|
||||
while (*ptr!='\"' && *ptr && ++len) if (*ptr++ == '\\') ptr++; /* Skip escaped quotes. */
|
||||
|
||||
out=(char*)cJSON_malloc(len+1); /* This is how long we need for the string, roughly. */
|
||||
if (!out) return 0;
|
||||
|
||||
ptr=str+1;ptr2=out;
|
||||
while (*ptr!='\"' && *ptr)
|
||||
{
|
||||
if (*ptr!='\\') *ptr2++=*ptr++;
|
||||
else
|
||||
{
|
||||
ptr++;
|
||||
switch (*ptr)
|
||||
{
|
||||
case 'b': *ptr2++='\b'; break;
|
||||
case 'f': *ptr2++='\f'; break;
|
||||
case 'n': *ptr2++='\n'; break;
|
||||
case 'r': *ptr2++='\r'; break;
|
||||
case 't': *ptr2++='\t'; break;
|
||||
case 'u': /* transcode utf16 to utf8. */
|
||||
uc=parse_hex4(ptr+1);ptr+=4; /* get the unicode char. */
|
||||
|
||||
if ((uc>=0xDC00 && uc<=0xDFFF) || uc==0) break; /* check for invalid. */
|
||||
|
||||
if (uc>=0xD800 && uc<=0xDBFF) /* UTF16 surrogate pairs. */
|
||||
{
|
||||
if (ptr[1]!='\\' || ptr[2]!='u') break; /* missing second-half of surrogate. */
|
||||
uc2=parse_hex4(ptr+3);ptr+=6;
|
||||
if (uc2<0xDC00 || uc2>0xDFFF) break; /* invalid second-half of surrogate. */
|
||||
uc=0x10000 + (((uc&0x3FF)<<10) | (uc2&0x3FF));
|
||||
}
|
||||
|
||||
len=4;if (uc<0x80) len=1;else if (uc<0x800) len=2;else if (uc<0x10000) len=3; ptr2+=len;
|
||||
|
||||
switch (len) {
|
||||
case 4: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
|
||||
case 3: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
|
||||
case 2: *--ptr2 =((uc | 0x80) & 0xBF); uc >>= 6;
|
||||
case 1: *--ptr2 =(uc | firstByteMark[len]);
|
||||
}
|
||||
ptr2+=len;
|
||||
break;
|
||||
default: *ptr2++=*ptr; break;
|
||||
}
|
||||
ptr++;
|
||||
}
|
||||
}
|
||||
*ptr2=0;
|
||||
if (*ptr=='\"') ptr++;
|
||||
item->valuestring=out;
|
||||
item->type=cJSON_String;
|
||||
return ptr;
|
||||
}
|
||||
|
||||
/* Render the cstring provided to an escaped version that can be printed. */
|
||||
static char *print_string_ptr(const char *str)
|
||||
{
|
||||
const char *ptr;char *ptr2,*out;int len=0;unsigned char token;
|
||||
|
||||
if (!str) return cJSON_strdup("");
|
||||
ptr=str;while ((token=*ptr) && ++len) {if (strchr("\"\\\b\f\n\r\t",token)) len++; else if (token<32) len+=5;ptr++;}
|
||||
|
||||
out=(char*)cJSON_malloc(len+3);
|
||||
if (!out) return 0;
|
||||
|
||||
ptr2=out;ptr=str;
|
||||
*ptr2++='\"';
|
||||
while (*ptr)
|
||||
{
|
||||
if ((unsigned char)*ptr>31 && *ptr!='\"' && *ptr!='\\') *ptr2++=*ptr++;
|
||||
else
|
||||
{
|
||||
*ptr2++='\\';
|
||||
switch (token=*ptr++)
|
||||
{
|
||||
case '\\': *ptr2++='\\'; break;
|
||||
case '\"': *ptr2++='\"'; break;
|
||||
case '\b': *ptr2++='b'; break;
|
||||
case '\f': *ptr2++='f'; break;
|
||||
case '\n': *ptr2++='n'; break;
|
||||
case '\r': *ptr2++='r'; break;
|
||||
case '\t': *ptr2++='t'; break;
|
||||
default: sprintf(ptr2,"u%04x",token);ptr2+=5; break; /* escape and print */
|
||||
}
|
||||
}
|
||||
}
|
||||
*ptr2++='\"';*ptr2++=0;
|
||||
return out;
|
||||
}
|
||||
/* Invote print_string_ptr (which is useful) on an item. */
|
||||
static char *print_string(cJSON *item) {return print_string_ptr(item->valuestring);}
|
||||
|
||||
/* Predeclare these prototypes. */
|
||||
static const char *parse_value(cJSON *item,const char *value);
|
||||
static char *print_value(cJSON *item,int depth,int fmt);
|
||||
static const char *parse_array(cJSON *item,const char *value);
|
||||
static char *print_array(cJSON *item,int depth,int fmt);
|
||||
static const char *parse_object(cJSON *item,const char *value);
|
||||
static char *print_object(cJSON *item,int depth,int fmt);
|
||||
|
||||
/* Utility to jump whitespace and cr/lf */
|
||||
static const char *skip(const char *in) {while (in && *in && (unsigned char)*in<=32) in++; return in;}
|
||||
|
||||
/* Parse an object - create a new root, and populate. */
|
||||
cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated)
|
||||
{
|
||||
const char *end=0;
|
||||
cJSON *c=cJSON_New_Item();
|
||||
ep=0;
|
||||
if (!c) return 0; /* memory fail */
|
||||
|
||||
end=parse_value(c,skip(value));
|
||||
if (!end) {cJSON_Delete(c);return 0;} /* parse failure. ep is set. */
|
||||
|
||||
/* if we require null-terminated JSON without appended garbage, skip and then check for a null terminator */
|
||||
if (require_null_terminated) {end=skip(end);if (*end) {cJSON_Delete(c);ep=end;return 0;}}
|
||||
if (return_parse_end) *return_parse_end=end;
|
||||
return c;
|
||||
}
|
||||
/* Default options for cJSON_Parse */
|
||||
cJSON *cJSON_Parse(const char *value) {return cJSON_ParseWithOpts(value,0,0);}
|
||||
|
||||
/* Render a cJSON item/entity/structure to text. */
|
||||
char *cJSON_Print(cJSON *item) {return print_value(item,0,1);}
|
||||
char *cJSON_PrintUnformatted(cJSON *item) {return print_value(item,0,0);}
|
||||
|
||||
/* Parser core - when encountering text, process appropriately. */
|
||||
static const char *parse_value(cJSON *item,const char *value)
|
||||
{
|
||||
if (!value) return 0; /* Fail on null. */
|
||||
if (!strncmp(value,"null",4)) { item->type=cJSON_NULL; return value+4; }
|
||||
if (!strncmp(value,"false",5)) { item->type=cJSON_False; return value+5; }
|
||||
if (!strncmp(value,"true",4)) { item->type=cJSON_True; item->valueint=1; return value+4; }
|
||||
if (*value=='\"') { return parse_string(item,value); }
|
||||
if (*value=='-' || (*value>='0' && *value<='9')) { return parse_number(item,value); }
|
||||
if (*value=='[') { return parse_array(item,value); }
|
||||
if (*value=='{') { return parse_object(item,value); }
|
||||
|
||||
ep=value;return 0; /* failure. */
|
||||
}
|
||||
|
||||
/* Render a value to text. */
|
||||
static char *print_value(cJSON *item,int depth,int fmt)
|
||||
{
|
||||
char *out=0;
|
||||
if (!item) return 0;
|
||||
switch ((item->type)&255)
|
||||
{
|
||||
case cJSON_NULL: out=cJSON_strdup("null"); break;
|
||||
case cJSON_False: out=cJSON_strdup("false");break;
|
||||
case cJSON_True: out=cJSON_strdup("true"); break;
|
||||
case cJSON_Number: out=print_number(item);break;
|
||||
case cJSON_String: out=print_string(item);break;
|
||||
case cJSON_Array: out=print_array(item,depth,fmt);break;
|
||||
case cJSON_Object: out=print_object(item,depth,fmt);break;
|
||||
}
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Build an array from input text. */
|
||||
static const char *parse_array(cJSON *item,const char *value)
|
||||
{
|
||||
cJSON *child;
|
||||
if (*value!='[') {ep=value;return 0;} /* not an array! */
|
||||
|
||||
item->type=cJSON_Array;
|
||||
value=skip(value+1);
|
||||
if (*value==']') return value+1; /* empty array. */
|
||||
|
||||
item->child=child=cJSON_New_Item();
|
||||
if (!item->child) return 0; /* memory fail */
|
||||
value=skip(parse_value(child,skip(value))); /* skip any spacing, get the value. */
|
||||
if (!value) return 0;
|
||||
|
||||
while (*value==',')
|
||||
{
|
||||
cJSON *new_item;
|
||||
if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */
|
||||
child->next=new_item;new_item->prev=child;child=new_item;
|
||||
value=skip(parse_value(child,skip(value+1)));
|
||||
if (!value) return 0; /* memory fail */
|
||||
}
|
||||
|
||||
if (*value==']') return value+1; /* end of array */
|
||||
ep=value;return 0; /* malformed. */
|
||||
}
|
||||
|
||||
/* Render an array to text */
|
||||
static char *print_array(cJSON *item,int depth,int fmt)
|
||||
{
|
||||
char **entries;
|
||||
char *out=0,*ptr,*ret;int len=5;
|
||||
cJSON *child=item->child;
|
||||
int numentries=0,i=0,fail=0;
|
||||
|
||||
/* How many entries in the array? */
|
||||
while (child) numentries++,child=child->next;
|
||||
/* Explicitly handle numentries==0 */
|
||||
if (!numentries)
|
||||
{
|
||||
out=(char*)cJSON_malloc(3);
|
||||
if (out) strcpy(out,"[]");
|
||||
return out;
|
||||
}
|
||||
/* Allocate an array to hold the values for each */
|
||||
entries=(char**)cJSON_malloc(numentries*sizeof(char*));
|
||||
if (!entries) return 0;
|
||||
memset(entries,0,numentries*sizeof(char*));
|
||||
/* Retrieve all the results: */
|
||||
child=item->child;
|
||||
while (child && !fail)
|
||||
{
|
||||
ret=print_value(child,depth+1,fmt);
|
||||
entries[i++]=ret;
|
||||
if (ret) len+=strlen(ret)+2+(fmt?1:0); else fail=1;
|
||||
child=child->next;
|
||||
}
|
||||
|
||||
/* If we didn't fail, try to malloc the output string */
|
||||
if (!fail) out=(char*)cJSON_malloc(len);
|
||||
/* If that fails, we fail. */
|
||||
if (!out) fail=1;
|
||||
|
||||
/* Handle failure. */
|
||||
if (fail)
|
||||
{
|
||||
for (i=0;i<numentries;i++) if (entries[i]) cJSON_free(entries[i]);
|
||||
cJSON_free(entries);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compose the output array. */
|
||||
*out='[';
|
||||
ptr=out+1;*ptr=0;
|
||||
for (i=0;i<numentries;i++)
|
||||
{
|
||||
strcpy(ptr,entries[i]);ptr+=strlen(entries[i]);
|
||||
if (i!=numentries-1) {*ptr++=',';if(fmt)*ptr++=' ';*ptr=0;}
|
||||
cJSON_free(entries[i]);
|
||||
}
|
||||
cJSON_free(entries);
|
||||
*ptr++=']';*ptr++=0;
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Build an object from the text. */
|
||||
static const char *parse_object(cJSON *item,const char *value)
|
||||
{
|
||||
cJSON *child;
|
||||
if (*value!='{') {ep=value;return 0;} /* not an object! */
|
||||
|
||||
item->type=cJSON_Object;
|
||||
value=skip(value+1);
|
||||
if (*value=='}') return value+1; /* empty array. */
|
||||
|
||||
item->child=child=cJSON_New_Item();
|
||||
if (!item->child) return 0;
|
||||
value=skip(parse_string(child,skip(value)));
|
||||
if (!value) return 0;
|
||||
child->string=child->valuestring;child->valuestring=0;
|
||||
if (*value!=':') {ep=value;return 0;} /* fail! */
|
||||
value=skip(parse_value(child,skip(value+1))); /* skip any spacing, get the value. */
|
||||
if (!value) return 0;
|
||||
|
||||
while (*value==',')
|
||||
{
|
||||
cJSON *new_item;
|
||||
if (!(new_item=cJSON_New_Item())) return 0; /* memory fail */
|
||||
child->next=new_item;new_item->prev=child;child=new_item;
|
||||
value=skip(parse_string(child,skip(value+1)));
|
||||
if (!value) return 0;
|
||||
child->string=child->valuestring;child->valuestring=0;
|
||||
if (*value!=':') {ep=value;return 0;} /* fail! */
|
||||
value=skip(parse_value(child,skip(value+1))); /* skip any spacing, get the value. */
|
||||
if (!value) return 0;
|
||||
}
|
||||
|
||||
if (*value=='}') return value+1; /* end of array */
|
||||
ep=value;return 0; /* malformed. */
|
||||
}
|
||||
|
||||
/* Render an object to text. */
|
||||
static char *print_object(cJSON *item,int depth,int fmt)
|
||||
{
|
||||
char **entries=0,**names=0;
|
||||
char *out=0,*ptr,*ret,*str;int len=7,i=0,j;
|
||||
cJSON *child=item->child;
|
||||
int numentries=0,fail=0;
|
||||
/* Count the number of entries. */
|
||||
while (child) numentries++,child=child->next;
|
||||
/* Explicitly handle empty object case */
|
||||
if (!numentries)
|
||||
{
|
||||
out=(char*)cJSON_malloc(fmt?depth+4:3);
|
||||
if (!out) return 0;
|
||||
ptr=out;*ptr++='{';
|
||||
if (fmt) {*ptr++='\n';for (i=0;i<depth-1;i++) *ptr++='\t';}
|
||||
*ptr++='}';*ptr++=0;
|
||||
return out;
|
||||
}
|
||||
/* Allocate space for the names and the objects */
|
||||
entries=(char**)cJSON_malloc(numentries*sizeof(char*));
|
||||
if (!entries) return 0;
|
||||
names=(char**)cJSON_malloc(numentries*sizeof(char*));
|
||||
if (!names) {cJSON_free(entries);return 0;}
|
||||
memset(entries,0,sizeof(char*)*numentries);
|
||||
memset(names,0,sizeof(char*)*numentries);
|
||||
|
||||
/* Collect all the results into our arrays: */
|
||||
child=item->child;depth++;if (fmt) len+=depth;
|
||||
while (child)
|
||||
{
|
||||
names[i]=str=print_string_ptr(child->string);
|
||||
entries[i++]=ret=print_value(child,depth,fmt);
|
||||
if (str && ret) len+=strlen(ret)+strlen(str)+2+(fmt?2+depth:0); else fail=1;
|
||||
child=child->next;
|
||||
}
|
||||
|
||||
/* Try to allocate the output string */
|
||||
if (!fail) out=(char*)cJSON_malloc(len);
|
||||
if (!out) fail=1;
|
||||
|
||||
/* Handle failure */
|
||||
if (fail)
|
||||
{
|
||||
for (i=0;i<numentries;i++) {if (names[i]) cJSON_free(names[i]);if (entries[i]) cJSON_free(entries[i]);}
|
||||
cJSON_free(names);cJSON_free(entries);
|
||||
return 0;
|
||||
}
|
||||
|
||||
/* Compose the output: */
|
||||
*out='{';ptr=out+1;if (fmt)*ptr++='\n';*ptr=0;
|
||||
for (i=0;i<numentries;i++)
|
||||
{
|
||||
if (fmt) for (j=0;j<depth;j++) *ptr++='\t';
|
||||
strcpy(ptr,names[i]);ptr+=strlen(names[i]);
|
||||
*ptr++=':';if (fmt) *ptr++='\t';
|
||||
strcpy(ptr,entries[i]);ptr+=strlen(entries[i]);
|
||||
if (i!=numentries-1) *ptr++=',';
|
||||
if (fmt) *ptr++='\n';*ptr=0;
|
||||
cJSON_free(names[i]);cJSON_free(entries[i]);
|
||||
}
|
||||
|
||||
cJSON_free(names);cJSON_free(entries);
|
||||
if (fmt) for (i=0;i<depth-1;i++) *ptr++='\t';
|
||||
*ptr++='}';*ptr++=0;
|
||||
return out;
|
||||
}
|
||||
|
||||
/* Get Array size/item / object item. */
|
||||
int cJSON_GetArraySize(cJSON *array) {cJSON *c=array->child;int i=0;while(c)i++,c=c->next;return i;}
|
||||
cJSON *cJSON_GetArrayItem(cJSON *array,int item) {cJSON *c=array->child; while (c && item>0) item--,c=c->next; return c;}
|
||||
cJSON *cJSON_GetObjectItem(cJSON *object,const char *string) {cJSON *c=object->child; while (c && cJSON_strcasecmp(c->string,string)) c=c->next; return c;}
|
||||
|
||||
/* Utility for array list handling. */
|
||||
static void suffix_object(cJSON *prev,cJSON *item) {prev->next=item;item->prev=prev;}
|
||||
/* Utility for handling references. */
|
||||
static cJSON *create_reference(cJSON *item) {cJSON *ref=cJSON_New_Item();if (!ref) return 0;memcpy(ref,item,sizeof(cJSON));ref->string=0;ref->type|=cJSON_IsReference;ref->next=ref->prev=0;return ref;}
|
||||
|
||||
/* Add item to array/object. */
|
||||
void cJSON_AddItemToArray(cJSON *array, cJSON *item) {cJSON *c=array->child;if (!item) return; if (!c) {array->child=item;} else {while (c && c->next) c=c->next; suffix_object(c,item);}}
|
||||
void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item) {if (!item) return; if (item->string) cJSON_free(item->string);item->string=cJSON_strdup(string);cJSON_AddItemToArray(object,item);}
|
||||
void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item) {cJSON_AddItemToArray(array,create_reference(item));}
|
||||
void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item) {cJSON_AddItemToObject(object,string,create_reference(item));}
|
||||
|
||||
cJSON *cJSON_DetachItemFromArray(cJSON *array,int which) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return 0;
|
||||
if (c->prev) c->prev->next=c->next;if (c->next) c->next->prev=c->prev;if (c==array->child) array->child=c->next;c->prev=c->next=0;return c;}
|
||||
void cJSON_DeleteItemFromArray(cJSON *array,int which) {cJSON_Delete(cJSON_DetachItemFromArray(array,which));}
|
||||
cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string) {int i=0;cJSON *c=object->child;while (c && cJSON_strcasecmp(c->string,string)) i++,c=c->next;if (c) return cJSON_DetachItemFromArray(object,i);return 0;}
|
||||
void cJSON_DeleteItemFromObject(cJSON *object,const char *string) {cJSON_Delete(cJSON_DetachItemFromObject(object,string));}
|
||||
|
||||
/* Replace array/object items with new ones. */
|
||||
void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem) {cJSON *c=array->child;while (c && which>0) c=c->next,which--;if (!c) return;
|
||||
newitem->next=c->next;newitem->prev=c->prev;if (newitem->next) newitem->next->prev=newitem;
|
||||
if (c==array->child) array->child=newitem; else newitem->prev->next=newitem;c->next=c->prev=0;cJSON_Delete(c);}
|
||||
void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem){int i=0;cJSON *c=object->child;while(c && cJSON_strcasecmp(c->string,string))i++,c=c->next;if(c){newitem->string=cJSON_strdup(string);cJSON_ReplaceItemInArray(object,i,newitem);}}
|
||||
|
||||
/* Create basic types: */
|
||||
cJSON *cJSON_CreateNull(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_NULL;return item;}
|
||||
cJSON *cJSON_CreateTrue(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_True;return item;}
|
||||
cJSON *cJSON_CreateFalse(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_False;return item;}
|
||||
cJSON *cJSON_CreateBool(int b) {cJSON *item=cJSON_New_Item();if(item)item->type=b?cJSON_True:cJSON_False;return item;}
|
||||
cJSON *cJSON_CreateNumber(double num) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_Number;item->valuedouble=num;item->valueint=(int)num;}return item;}
|
||||
cJSON *cJSON_CreateString(const char *string) {cJSON *item=cJSON_New_Item();if(item){item->type=cJSON_String;item->valuestring=cJSON_strdup(string);}return item;}
|
||||
cJSON *cJSON_CreateArray(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Array;return item;}
|
||||
cJSON *cJSON_CreateObject(void) {cJSON *item=cJSON_New_Item();if(item)item->type=cJSON_Object;return item;}
|
||||
|
||||
/* Create Arrays: */
|
||||
cJSON *cJSON_CreateIntArray(const int *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
cJSON *cJSON_CreateFloatArray(const float *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
cJSON *cJSON_CreateDoubleArray(const double *numbers,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateNumber(numbers[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
cJSON *cJSON_CreateStringArray(const char **strings,int count) {int i;cJSON *n=0,*p=0,*a=cJSON_CreateArray();for(i=0;a && i<count;i++){n=cJSON_CreateString(strings[i]);if(!i)a->child=n;else suffix_object(p,n);p=n;}return a;}
|
||||
|
||||
/* Duplication */
|
||||
cJSON *cJSON_Duplicate(cJSON *item,int recurse)
|
||||
{
|
||||
cJSON *newitem,*cptr,*nptr=0,*newchild;
|
||||
/* Bail on bad ptr */
|
||||
if (!item) return 0;
|
||||
/* Create new item */
|
||||
newitem=cJSON_New_Item();
|
||||
if (!newitem) return 0;
|
||||
/* Copy over all vars */
|
||||
newitem->type=item->type&(~cJSON_IsReference),newitem->valueint=item->valueint,newitem->valuedouble=item->valuedouble;
|
||||
if (item->valuestring) {newitem->valuestring=cJSON_strdup(item->valuestring); if (!newitem->valuestring) {cJSON_Delete(newitem);return 0;}}
|
||||
if (item->string) {newitem->string=cJSON_strdup(item->string); if (!newitem->string) {cJSON_Delete(newitem);return 0;}}
|
||||
/* If non-recursive, then we're done! */
|
||||
if (!recurse) return newitem;
|
||||
/* Walk the ->next chain for the child. */
|
||||
cptr=item->child;
|
||||
while (cptr)
|
||||
{
|
||||
newchild=cJSON_Duplicate(cptr,1); /* Duplicate (with recurse) each item in the ->next chain */
|
||||
if (!newchild) {cJSON_Delete(newitem);return 0;}
|
||||
if (nptr) {nptr->next=newchild,newchild->prev=nptr;nptr=newchild;} /* If newitem->child already set, then crosswire ->prev and ->next and move on */
|
||||
else {newitem->child=newchild;nptr=newchild;} /* Set newitem->child and move to it */
|
||||
cptr=cptr->next;
|
||||
}
|
||||
return newitem;
|
||||
}
|
||||
|
||||
void cJSON_Minify(char *json)
|
||||
{
|
||||
char *into=json;
|
||||
while (*json)
|
||||
{
|
||||
if (*json==' ') json++;
|
||||
else if (*json=='\t') json++; // Whitespace characters.
|
||||
else if (*json=='\r') json++;
|
||||
else if (*json=='\n') json++;
|
||||
else if (*json=='/' && json[1]=='/') while (*json && *json!='\n') json++; // double-slash comments, to end of line.
|
||||
else if (*json=='/' && json[1]=='*') {while (*json && !(*json=='*' && json[1]=='/')) json++;json+=2;} // multiline comments.
|
||||
else if (*json=='\"'){*into++=*json++;while (*json && *json!='\"'){if (*json=='\\') *into++=*json++;*into++=*json++;}*into++=*json++;} // string literals, which are \" sensitive.
|
||||
else *into++=*json++; // All other characters.
|
||||
}
|
||||
*into=0; // and null-terminate.
|
||||
}
|
||||
143
src/cJSON.h
Normal file
143
src/cJSON.h
Normal file
@@ -0,0 +1,143 @@
|
||||
/*
|
||||
Copyright (c) 2009 Dave Gamble
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||
of this software and associated documentation files (the "Software"), to deal
|
||||
in the Software without restriction, including without limitation the rights
|
||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||
copies of the Software, and to permit persons to whom the Software is
|
||||
furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in
|
||||
all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||
THE SOFTWARE.
|
||||
*/
|
||||
|
||||
#ifndef cJSON__h
|
||||
#define cJSON__h
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/* cJSON Types: */
|
||||
#define cJSON_False 0
|
||||
#define cJSON_True 1
|
||||
#define cJSON_NULL 2
|
||||
#define cJSON_Number 3
|
||||
#define cJSON_String 4
|
||||
#define cJSON_Array 5
|
||||
#define cJSON_Object 6
|
||||
|
||||
#define cJSON_IsReference 256
|
||||
|
||||
/* The cJSON structure: */
|
||||
typedef struct cJSON {
|
||||
struct cJSON *next,*prev; /* next/prev allow you to walk array/object chains. Alternatively, use GetArraySize/GetArrayItem/GetObjectItem */
|
||||
struct cJSON *child; /* An array or object item will have a child pointer pointing to a chain of the items in the array/object. */
|
||||
|
||||
int type; /* The type of the item, as above. */
|
||||
|
||||
char *valuestring; /* The item's string, if type==cJSON_String */
|
||||
int valueint; /* The item's number, if type==cJSON_Number */
|
||||
double valuedouble; /* The item's number, if type==cJSON_Number */
|
||||
|
||||
char *string; /* The item's name string, if this item is the child of, or is in the list of subitems of an object. */
|
||||
} cJSON;
|
||||
|
||||
typedef struct cJSON_Hooks {
|
||||
void *(*malloc_fn)(size_t sz);
|
||||
void (*free_fn)(void *ptr);
|
||||
} cJSON_Hooks;
|
||||
|
||||
/* Supply malloc, realloc and free functions to cJSON */
|
||||
extern void cJSON_InitHooks(cJSON_Hooks* hooks);
|
||||
|
||||
|
||||
/* Supply a block of JSON, and this returns a cJSON object you can interrogate. Call cJSON_Delete when finished. */
|
||||
extern cJSON *cJSON_Parse(const char *value);
|
||||
/* Render a cJSON entity to text for transfer/storage. Free the char* when finished. */
|
||||
extern char *cJSON_Print(cJSON *item);
|
||||
/* Render a cJSON entity to text for transfer/storage without any formatting. Free the char* when finished. */
|
||||
extern char *cJSON_PrintUnformatted(cJSON *item);
|
||||
/* Delete a cJSON entity and all subentities. */
|
||||
extern void cJSON_Delete(cJSON *c);
|
||||
|
||||
/* Returns the number of items in an array (or object). */
|
||||
extern int cJSON_GetArraySize(cJSON *array);
|
||||
/* Retrieve item number "item" from array "array". Returns NULL if unsuccessful. */
|
||||
extern cJSON *cJSON_GetArrayItem(cJSON *array,int item);
|
||||
/* Get item "string" from object. Case insensitive. */
|
||||
extern cJSON *cJSON_GetObjectItem(cJSON *object,const char *string);
|
||||
|
||||
/* For analysing failed parses. This returns a pointer to the parse error. You'll probably need to look a few chars back to make sense of it. Defined when cJSON_Parse() returns 0. 0 when cJSON_Parse() succeeds. */
|
||||
extern const char *cJSON_GetErrorPtr(void);
|
||||
|
||||
/* These calls create a cJSON item of the appropriate type. */
|
||||
extern cJSON *cJSON_CreateNull(void);
|
||||
extern cJSON *cJSON_CreateTrue(void);
|
||||
extern cJSON *cJSON_CreateFalse(void);
|
||||
extern cJSON *cJSON_CreateBool(int b);
|
||||
extern cJSON *cJSON_CreateNumber(double num);
|
||||
extern cJSON *cJSON_CreateString(const char *string);
|
||||
extern cJSON *cJSON_CreateArray(void);
|
||||
extern cJSON *cJSON_CreateObject(void);
|
||||
|
||||
/* These utilities create an Array of count items. */
|
||||
extern cJSON *cJSON_CreateIntArray(const int *numbers,int count);
|
||||
extern cJSON *cJSON_CreateFloatArray(const float *numbers,int count);
|
||||
extern cJSON *cJSON_CreateDoubleArray(const double *numbers,int count);
|
||||
extern cJSON *cJSON_CreateStringArray(const char **strings,int count);
|
||||
|
||||
/* Append item to the specified array/object. */
|
||||
extern void cJSON_AddItemToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemToObject(cJSON *object,const char *string,cJSON *item);
|
||||
/* Append reference to item to the specified array/object. Use this when you want to add an existing cJSON to a new cJSON, but don't want to corrupt your existing cJSON. */
|
||||
extern void cJSON_AddItemReferenceToArray(cJSON *array, cJSON *item);
|
||||
extern void cJSON_AddItemReferenceToObject(cJSON *object,const char *string,cJSON *item);
|
||||
|
||||
/* Remove/Detatch items from Arrays/Objects. */
|
||||
extern cJSON *cJSON_DetachItemFromArray(cJSON *array,int which);
|
||||
extern void cJSON_DeleteItemFromArray(cJSON *array,int which);
|
||||
extern cJSON *cJSON_DetachItemFromObject(cJSON *object,const char *string);
|
||||
extern void cJSON_DeleteItemFromObject(cJSON *object,const char *string);
|
||||
|
||||
/* Update array items. */
|
||||
extern void cJSON_ReplaceItemInArray(cJSON *array,int which,cJSON *newitem);
|
||||
extern void cJSON_ReplaceItemInObject(cJSON *object,const char *string,cJSON *newitem);
|
||||
|
||||
/* Duplicate a cJSON item */
|
||||
extern cJSON *cJSON_Duplicate(cJSON *item,int recurse);
|
||||
/* Duplicate will create a new, identical cJSON item to the one you pass, in new memory that will
|
||||
need to be released. With recurse!=0, it will duplicate any children connected to the item.
|
||||
The item->next and ->prev pointers are always zero on return from Duplicate. */
|
||||
|
||||
/* ParseWithOpts allows you to require (and check) that the JSON is null terminated, and to retrieve the pointer to the final byte parsed. */
|
||||
extern cJSON *cJSON_ParseWithOpts(const char *value,const char **return_parse_end,int require_null_terminated);
|
||||
|
||||
extern void cJSON_Minify(char *json);
|
||||
|
||||
/* Macros for creating things quickly. */
|
||||
#define cJSON_AddNullToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateNull())
|
||||
#define cJSON_AddTrueToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateTrue())
|
||||
#define cJSON_AddFalseToObject(object,name) cJSON_AddItemToObject(object, name, cJSON_CreateFalse())
|
||||
#define cJSON_AddBoolToObject(object,name,b) cJSON_AddItemToObject(object, name, cJSON_CreateBool(b))
|
||||
#define cJSON_AddNumberToObject(object,name,n) cJSON_AddItemToObject(object, name, cJSON_CreateNumber(n))
|
||||
#define cJSON_AddStringToObject(object,name,s) cJSON_AddItemToObject(object, name, cJSON_CreateString(s))
|
||||
|
||||
/* When assigning an integer value, it needs to be propagated to valuedouble too. */
|
||||
#define cJSON_SetIntValue(object,val) ((object)?(object)->valueint=(object)->valuedouble=(val):(val))
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
291
src/common.c
Normal file
291
src/common.c
Normal file
@@ -0,0 +1,291 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <errno.h>
|
||||
#include <pthread.h>
|
||||
#include <inttypes.h>
|
||||
#include <string.h>
|
||||
#include <stdint.h>
|
||||
#include <inttypes.h>
|
||||
#include <sys/stat.h>
|
||||
#include <sys/time.h>
|
||||
#include <errno.h>
|
||||
#include <stddef.h>
|
||||
|
||||
#include "common.h"
|
||||
#include "stream.h"
|
||||
#include "MESA_handle_logger.h"
|
||||
|
||||
|
||||
int pag_send_av_udp(int Datasize, const char *pData, u_int src_ip, u_int dst_ip, u_short src_prt, u_short dst_prt)
|
||||
{
|
||||
printf("empty function,should not be called by preprocesosor!\n");
|
||||
exit(-1);
|
||||
return 0;
|
||||
}
|
||||
|
||||
int create_pthread(void *(*worker)(void *), void * params, void* logger)
|
||||
{
|
||||
pthread_t thread_desc;
|
||||
pthread_attr_t attr;
|
||||
|
||||
memset(&thread_desc, 0, sizeof(thread_desc));
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
|
||||
if(0 != pthread_attr_init(&(attr)))
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME, "pthread_attr_init(): %d %s", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if(0 != pthread_attr_setdetachstate(&(attr), PTHREAD_CREATE_DETACHED))
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME, "pthread_attr_setdetachstate(): %d %s", errno, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
if(0 != pthread_create(&(thread_desc), &(attr), (void *(*)(void *))(worker), (void *)(params)))
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME, "pthread_create(): %d %s", errno, strerror(errno));
|
||||
pthread_attr_destroy(&(attr));
|
||||
return -1;
|
||||
}
|
||||
pthread_attr_destroy(&(attr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
int string_split (const char* src, char dest[][MAX_PATH_LEN], int dest_maxnum, char sep)
|
||||
{
|
||||
if(NULL==src) return 0;
|
||||
int dest_cnt = 0;
|
||||
const char* start_token = src;
|
||||
const char* end_token = src;
|
||||
const char* end_pos = src+strlen(src);
|
||||
|
||||
while(end_token<end_pos&&dest_cnt<dest_maxnum)
|
||||
{
|
||||
end_token = (char*)memchr(start_token, sep, end_pos-start_token);
|
||||
if(end_token!=NULL)
|
||||
{
|
||||
memcpy(dest[dest_cnt], start_token, end_token-start_token);
|
||||
start_token = end_token+1;
|
||||
end_token += 1;
|
||||
dest_cnt++;
|
||||
}
|
||||
else
|
||||
{
|
||||
memcpy(dest[dest_cnt], start_token, end_pos-start_token);
|
||||
end_token = end_pos;
|
||||
dest_cnt++;
|
||||
}
|
||||
}
|
||||
return dest_cnt;
|
||||
}
|
||||
|
||||
int mkdir_r(const char *path)
|
||||
{
|
||||
int i=0, len=0;
|
||||
int ret=0;
|
||||
len = strlen(path);
|
||||
char dir_path[len+1];
|
||||
dir_path[len] = '\0';
|
||||
|
||||
strncpy(dir_path, path, len);
|
||||
|
||||
for (i=0; i<len; i++)
|
||||
{
|
||||
if (dir_path[i] == '/' && i > 0)
|
||||
{
|
||||
dir_path[i]='\0';
|
||||
if (access(dir_path, F_OK) < 0)
|
||||
{
|
||||
ret=mkdir(dir_path,0755);
|
||||
if (ret < 0)
|
||||
{
|
||||
printf("mkdir=%s:msg=%s\n", dir_path, strerror(errno));
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
dir_path[i]='/';
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
//read ip from string like "127.0.1-32;"
|
||||
int MESA_split_read_IP(char *ipstr, int ipnum, unsigned int *output_ip)
|
||||
{
|
||||
char buf[1024] = { 0 };
|
||||
char *begin, *end;
|
||||
int i;
|
||||
int rc = 0;
|
||||
begin = ipstr;
|
||||
end = NULL;
|
||||
for(i = 0; i < ipnum; )
|
||||
{
|
||||
if(NULL != (end = strchr(begin, ';') ) )
|
||||
{
|
||||
memset(buf, 0, 524);
|
||||
strncpy(buf, begin, end - begin);
|
||||
begin = end + 1;
|
||||
char *pchr = strchr(buf, '-');
|
||||
int tmp = 0, tmp2 = 0;
|
||||
if(pchr == NULL)
|
||||
{
|
||||
tmp = 1;
|
||||
}
|
||||
else
|
||||
{
|
||||
char *ptmp2 = strrchr(buf, '.');
|
||||
tmp2 = atoi(ptmp2 + 1);
|
||||
tmp = atoi(pchr + 1);
|
||||
tmp = tmp - tmp2 + 1;
|
||||
*pchr = '\0';
|
||||
if(tmp <= 0)
|
||||
{
|
||||
printf("MESA_split_read_IP Bad bsendip format %s\n", ipstr);
|
||||
}
|
||||
}
|
||||
rc = inet_addr(buf);
|
||||
if(rc == -1)
|
||||
{
|
||||
printf("MESA_split_read_IP Bad bsendip format %s\n", ipstr);
|
||||
}
|
||||
unsigned int tmpid = ntohl(rc);
|
||||
for(int j = 0; j < tmp; j++)
|
||||
{
|
||||
if(i >= ipnum)
|
||||
{
|
||||
printf("Bad bsendip format,bsendipnum %d not right\n", ipnum);
|
||||
}
|
||||
output_ip[i] = (unsigned int)htonl( (tmpid + j) );
|
||||
i++;
|
||||
}
|
||||
}
|
||||
}
|
||||
return(0);
|
||||
}
|
||||
|
||||
unsigned int get_ip_by_ifname(const char *ifname)
|
||||
{
|
||||
int sockfd;
|
||||
struct ifreq ifr;
|
||||
unsigned int ip;
|
||||
|
||||
sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (-1 == sockfd)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
strcpy(ifr.ifr_name,ifname);
|
||||
if (ioctl(sockfd, SIOCGIFADDR, &ifr) < 0)
|
||||
{
|
||||
goto error;
|
||||
}
|
||||
|
||||
ip = ((struct sockaddr_in*)&(ifr.ifr_addr))->sin_addr.s_addr;
|
||||
close(sockfd);
|
||||
return ip;
|
||||
|
||||
error:
|
||||
close(sockfd);
|
||||
return INADDR_NONE;
|
||||
}
|
||||
|
||||
/* this function is copy from other system. */
|
||||
/*
|
||||
char *memcasemem(const char *strsrc,int len1,const char *substr,int len2)
|
||||
{
|
||||
|
||||
char *p1,*p2,*pend;
|
||||
char *p;
|
||||
char *substrS;
|
||||
int i,lenth;
|
||||
|
||||
if((strsrc==NULL)||substr==NULL)
|
||||
return NULL;
|
||||
if(len1<len2) return NULL;
|
||||
|
||||
lenth=len2;
|
||||
substrS=(char *)malloc(sizeof(char)*(lenth+1));
|
||||
if(substrS==NULL)
|
||||
return NULL;
|
||||
for(i=0;i<lenth;i++)
|
||||
{
|
||||
substrS[i]=tolower(*(substr+i));
|
||||
}
|
||||
substrS[lenth]=0;
|
||||
|
||||
lenth=len1;
|
||||
pend =(char *)strsrc + lenth;
|
||||
for(p1 =(char *) strsrc; p1 != pend;p1++)
|
||||
{
|
||||
for(p2 = p1,p = substrS;*p != '\0'&& p2 != pend;p++,p2++)
|
||||
{
|
||||
if(tolower(*p2) != *p)
|
||||
break;
|
||||
}
|
||||
if(*p == '\0')
|
||||
{
|
||||
free(substrS);
|
||||
return p1;
|
||||
}
|
||||
}
|
||||
|
||||
free(substrS);
|
||||
return NULL;
|
||||
}
|
||||
*/
|
||||
/*from sapp*/
|
||||
extern "C" const char *printaddr (const struct layer_addr *paddrinfo, int threadindex)
|
||||
{
|
||||
static char maxbuf[64+1][128];
|
||||
char *buf=maxbuf[threadindex];
|
||||
char ip_str[64];
|
||||
struct stream_tuple4_v4 *paddr;
|
||||
struct stream_tuple4_v6 *paddr6;
|
||||
|
||||
if(NULL == paddrinfo){
|
||||
return NULL;
|
||||
}
|
||||
|
||||
if(paddrinfo->addrtype==ADDR_TYPE_IPV4)
|
||||
{
|
||||
paddr=(struct stream_tuple4_v4 *)paddrinfo->paddr;
|
||||
memset(buf,0,64);
|
||||
//strcpy (buf, int_ntoa (paddr->saddr));
|
||||
inet_ntop(AF_INET, &paddr->saddr, ip_str, 64);
|
||||
strcpy (buf, ip_str);
|
||||
sprintf (buf + strlen (buf), ".%u>", ntohs(paddr->source));
|
||||
//strcat (buf, int_ntoa (paddr->daddr));
|
||||
inet_ntop(AF_INET, &paddr->daddr, ip_str, 64);
|
||||
strcat (buf, ip_str);
|
||||
sprintf (buf + strlen (buf), ".%u", ntohs(paddr->dest));
|
||||
}
|
||||
//to addjust
|
||||
else if(paddrinfo->addrtype==ADDR_TYPE_IPV6)
|
||||
{
|
||||
paddr6=(struct stream_tuple4_v6 *)(paddrinfo->paddr);
|
||||
memset(buf,0,128);
|
||||
inet_ntop(AF_INET6, paddr6->saddr, ip_str, 64);
|
||||
strcpy (buf, ip_str);
|
||||
sprintf (buf + strlen (buf), ".%u>", ntohs(paddr6->source));
|
||||
inet_ntop(AF_INET6, paddr6->daddr, ip_str, 64);
|
||||
strcat (buf, ip_str);
|
||||
sprintf (buf + strlen (buf), ".%u", ntohs(paddr6->dest));
|
||||
}
|
||||
else
|
||||
{
|
||||
return (const char *)"Not support layer type";
|
||||
}
|
||||
return buf;
|
||||
}
|
||||
|
||||
|
||||
|
||||
27
src/common.h
Normal file
27
src/common.h
Normal file
@@ -0,0 +1,27 @@
|
||||
#ifndef _COMMON_H
|
||||
#define _COMMON_H
|
||||
|
||||
#define FRAG_REASSEMBLY_MODULE_NAME "frag_rssb"
|
||||
#define MAX_PATH_LEN 256
|
||||
#define SPLIT_BUF_MAXNUM 8 //config split buf cnt
|
||||
|
||||
#define MIN(a,b) ((a)<(b)?(a):(b))
|
||||
#define MAX(a,b) ((a)>(b)?(a):(b))
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int create_pthread(void *(*worker)(void *), void * params, void* logger);
|
||||
int pag_send_av_udp(int Datasize, const char *pData, u_int src_ip, u_int dst_ip, u_short src_prt, u_short dst_prt);
|
||||
int string_split (const char* src, char dest[][MAX_PATH_LEN], int dest_maxnum, char sep);
|
||||
int mkdir_r(const char *path);
|
||||
int MESA_split_read_IP(char *ipstr, int ipnum, unsigned int *output_ip);
|
||||
unsigned int get_ip_by_ifname(const char *ifname);
|
||||
char *memcasemem(const char *strsrc,int len1,const char *substr,int len2);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
237
src/frag_app.c
Normal file
237
src/frag_app.c
Normal file
@@ -0,0 +1,237 @@
|
||||
/*
|
||||
* APP
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
|
||||
#include "app_detect.h"
|
||||
|
||||
#include "AV_interface.h"
|
||||
|
||||
#include "frag_app.h"
|
||||
#include "frag_proc.h"
|
||||
#include "log.h"
|
||||
|
||||
extern frag_rssb_parameter_t g_frag_run;
|
||||
extern frag_rssb_configure_t g_frag_cfg;
|
||||
extern frag_rssb_status_t g_frag_stat;
|
||||
extern frag_reassembly_t frag_rssb;
|
||||
|
||||
void app_change_pid(frag_unit_t* frg_unit)
|
||||
{
|
||||
char pid_buf[1024] = {0};
|
||||
char serverIP[64] = {0};
|
||||
uint64_t pid_before = frg_unit->pid;
|
||||
/*APP<50><50>PID<49><EFBFBD>ΪserverIP+len, <20><><EFBFBD><EFBFBD>tuple7*/
|
||||
get_serverIP(frg_unit->opt[MEDIA_OPT_ADDR]->opt_value, frg_unit->opt[MEDIA_OPT_ADDR]->opt_len, serverIP);
|
||||
snprintf(pid_buf, sizeof(pid_buf), "APP_%s->%" PRIu64 "", serverIP, frg_unit->content_length);
|
||||
frg_unit->pid = make_mid(pid_buf, strlen(pid_buf), PID_TYPE_IPLEN);
|
||||
frg_unit->mid = frg_unit->pid;
|
||||
frag_write_to_log(APP_CHANGE_PID, pid_before, frg_unit, NULL, 0);
|
||||
}
|
||||
|
||||
static int url_indicated_app(const char *url)
|
||||
{
|
||||
const char *pfilename = NULL, *p1 = NULL, *p2 = NULL, *p3 = NULL, *p = NULL;
|
||||
unsigned int len=0;
|
||||
|
||||
if(url == NULL)
|
||||
return 0;
|
||||
|
||||
pfilename = strrchr(url, '/');
|
||||
if(pfilename == NULL || *(pfilename + 1) == '\0')
|
||||
return 0;
|
||||
|
||||
pfilename = pfilename + 1;
|
||||
len = strlen(pfilename);
|
||||
|
||||
p1 = strchr(pfilename, ';');
|
||||
p2 = strchr(pfilename, '?');
|
||||
p3 = strchr(pfilename, '#');
|
||||
|
||||
if(p1>p2)
|
||||
{
|
||||
p = p1; p1 = p2; p2 = p;
|
||||
}
|
||||
if(p1>p3)
|
||||
{
|
||||
p = p3; p1 = p3; p3 = p;
|
||||
}
|
||||
if(p2>p3)
|
||||
{
|
||||
p = p2; p2 = p3; p3 = p;
|
||||
}
|
||||
if(p1 != NULL)
|
||||
len = p1 - pfilename;
|
||||
else if(p2 != NULL)
|
||||
len = p2 - pfilename;
|
||||
else if(p3 != NULL)
|
||||
len = p3 - pfilename;
|
||||
|
||||
if(!strncasecmp(pfilename + len - 4, ".apk", 4))
|
||||
return FILE_ANDRIOD;
|
||||
if(!strncasecmp(pfilename + len - 4, ".ipa", 4))
|
||||
return FILE_IOS;
|
||||
return 0;
|
||||
}
|
||||
|
||||
void free_appdtc_detail(appdtc_detail_in_t* detail)
|
||||
{
|
||||
if(NULL!=detail)
|
||||
{
|
||||
if(NULL!=detail->app_data)
|
||||
{
|
||||
free(detail->app_data);
|
||||
}
|
||||
if(NULL!=detail->tuple4)
|
||||
{
|
||||
free(detail->tuple4);
|
||||
}
|
||||
if(NULL!=detail->url)
|
||||
{
|
||||
free(detail->url);
|
||||
}
|
||||
if(NULL!=detail->user_agent)
|
||||
{
|
||||
free(detail->user_agent);
|
||||
}
|
||||
if(NULL!=detail->app_frg_lq)
|
||||
{
|
||||
MESA_lqueue_destroy(detail->app_frg_lq, NULL, NULL);
|
||||
detail->app_frg_lq = NULL;
|
||||
}
|
||||
free(detail);
|
||||
}
|
||||
}
|
||||
|
||||
void proc_app_data(media_t* mdi)
|
||||
{
|
||||
appdtc_detail_in_t* detail = (appdtc_detail_in_t*)calloc(1, sizeof(appdtc_detail_in_t));
|
||||
char* p_url = NULL;
|
||||
|
||||
/*appid*/
|
||||
detail->appid = mdi->mid;
|
||||
|
||||
/*app_type*/
|
||||
if(mdi->media_type==FILE_APP)
|
||||
{
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index])
|
||||
{
|
||||
p_url = (char*)malloc(mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len+1);
|
||||
memset(p_url, 0 , mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len+1);
|
||||
memcpy(p_url, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
mdi->media_type = url_indicated_app(p_url);
|
||||
if(NULL!=p_url)
|
||||
{
|
||||
free(p_url);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch(mdi->media_type)
|
||||
{
|
||||
case FILE_IOS:
|
||||
detail->app_type = APP_TYPE_IOS;
|
||||
break;
|
||||
case FILE_ANDRIOD:
|
||||
detail->app_type = APP_TYPE_ANDROID;
|
||||
break;
|
||||
default:
|
||||
detail->app_type = APP_TYPE_UNKNOWN;
|
||||
break;
|
||||
}
|
||||
|
||||
/*data*/
|
||||
detail->app_frg_lq = mdi->app_frg_lq;
|
||||
mdi->app_frg_lq = NULL;
|
||||
|
||||
/*tuple4*/
|
||||
if(NULL!=mdi->addrlist)
|
||||
{
|
||||
detail->tuple4 = (char*)malloc(mdi->addrlist_len);
|
||||
memcpy(detail->tuple4, mdi->addrlist, mdi->addrlist_len);
|
||||
detail->tuple4_len = mdi->addrlist_len;
|
||||
}
|
||||
|
||||
/*url : app_http_session urls are same, so save one*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index])
|
||||
{
|
||||
detail->url = (char*)malloc(mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
memcpy(detail->url, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
detail->url_len = mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
|
||||
/*ua*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index])
|
||||
{
|
||||
detail->user_agent = (char*)malloc(mdi->opt[MEDIA_OPT_UA][mdi->url_opt_index]->opt_len);
|
||||
memcpy(detail->user_agent, mdi->opt[MEDIA_OPT_UA][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_UA][mdi->url_opt_index]->opt_len);
|
||||
detail->ua_len = mdi->opt[MEDIA_OPT_UA][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[APP_QUEUE][QUEUE_IN]);
|
||||
MESA_lqueue_join_tail(g_frag_run.app_lq, &detail, sizeof(detail));
|
||||
}
|
||||
|
||||
void* thread_send_app_data(void *param)
|
||||
{
|
||||
appdtc_detail_in_t* detail = NULL;
|
||||
long detail_len = sizeof(detail);
|
||||
frag_in_t* frg = NULL;
|
||||
long frglen = sizeof(frg);
|
||||
int rec_detail = 0;
|
||||
int rec_frg = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
rec_detail = MESA_lqueue_try_get_head(g_frag_run.app_lq, &detail, &detail_len);
|
||||
if (rec_detail<0)
|
||||
{
|
||||
usleep(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
rec_frg = MESA_lqueue_try_get_head(detail->app_frg_lq, &frg, &frglen);
|
||||
while(0==rec_frg)
|
||||
{
|
||||
atomic_inc(&frag_rssb.sysinfo_stat[RSSB_WAIT_QUEUE][QUEUE_OUT]);
|
||||
MESA_handle_runtime_log(frag_rssb.logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} get app_frg_lq: [PID: %llu, offset: %llu, datalen:%u]",
|
||||
__FILE__,__LINE__, frg->pid, frg->offset, frg->datalen);
|
||||
if(detail->data_len > frg->offset+frg->datalen)
|
||||
{
|
||||
memcpy((char*)detail->app_data+frg->offset, (void*)frg->data, frg->datalen);
|
||||
}
|
||||
else
|
||||
{
|
||||
detail->app_data = (char*)realloc(detail->app_data, frg->offset+frg->datalen);
|
||||
memcpy((char*)detail->app_data+frg->offset, (void*)frg->data, frg->datalen);
|
||||
detail->data_len = frg->offset+frg->datalen;
|
||||
}
|
||||
free_frag_in(frg,0,NULL);
|
||||
rec_frg = MESA_lqueue_try_get_head(detail->app_frg_lq, &frg, &frglen);
|
||||
}
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[APP_QUEUE][QUEUE_OUT]);
|
||||
atomic_inc(&g_frag_stat.stat_info[TO_SEND][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[TO_SEND][TOTAL_BYTES], detail->data_len);
|
||||
#if APP_FUNC
|
||||
APPDTC_PLUG_ENTRY(g_frag_run.appdtc_handle, (appdtc_detail_t*)detail, 0);
|
||||
#endif
|
||||
free_appdtc_detail(detail);
|
||||
detail = NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
34
src/frag_app.h
Normal file
34
src/frag_app.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef _FRAG_APP_H
|
||||
#define _FRAG_APP_H
|
||||
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
typedef struct __appdtc_detail_in_s
|
||||
{
|
||||
char *tuple4;
|
||||
char *user_agent;
|
||||
char *url;
|
||||
void *app_data;
|
||||
unsigned int tuple4_len;
|
||||
unsigned short app_type; //APP_TYPE_t
|
||||
unsigned int ua_len;
|
||||
unsigned int url_len;
|
||||
unsigned long long data_len;
|
||||
unsigned long long appid;
|
||||
MESA_lqueue_head app_frg_lq; //app<70><70><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
|
||||
}appdtc_detail_in_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void app_change_pid(frag_unit_t* frg_unit);
|
||||
void proc_app_data(media_t* mdi);
|
||||
void* thread_send_app_data(void *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
1510
src/frag_av.c
Normal file
1510
src/frag_av.c
Normal file
File diff suppressed because it is too large
Load Diff
35
src/frag_av.h
Normal file
35
src/frag_av.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef _FRAG_AV_H
|
||||
#define _FRAG_AV_H
|
||||
|
||||
#define MAAT_RESULT_NUM 8
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void frag_set_offset(uint8_t media_type, frag_in_t* frg, frag_unit_t* frg_unit);
|
||||
int frag_redis_index_twice(frag_unit_t* frg_unit);
|
||||
|
||||
long converge_mediainfo_search_cb(void *data, const uint8_t *key, uint size, void *user_arg);
|
||||
int expire_cnvg_hash_node(void *data, int eliminate_type);
|
||||
void set_frag_unit(rssb_media_info_t* media_info, frag_unit_t* frg_unit);
|
||||
void proc_index_queue(frag_unit_t* frg_unit);
|
||||
|
||||
int is_frag(uint8_t media_type);
|
||||
void media_stat(media_t* mdi, frag_unit_t* frg_unit);
|
||||
void media_byte_stat(media_t* mdi, frag_unit_t* frg_unit, frag_in_t* frg);
|
||||
int media_frag_removal(media_t* mdi, frag_unit_t* frg_unit);
|
||||
int media_removal(media_t* mdi, frag_unit_t* frg_unit, frag_in_t* frg, frag_ivi_info_t* frag_ivi_info);
|
||||
|
||||
int av_query(frag_unit_t* frg_unit);
|
||||
int redis_av_query(frag_unit_t* frg_unit);
|
||||
void index_query_timeout_free(void * context);
|
||||
void index_query_timeout(void * context);
|
||||
long index_query_timeout_cb(void *data, const uint8_t *key, uint size, void *user_arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
514
src/frag_dedup.c
Normal file
514
src/frag_dedup.c
Normal file
@@ -0,0 +1,514 @@
|
||||
/*
|
||||
* <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>ѯҵ<D1AF><D2B5>
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
#include "MESA_htable.h"
|
||||
#include "MESA_list_queue.h"
|
||||
#include "stream_fuzzy_hash.h"
|
||||
#include "soqav_dedup.h"
|
||||
|
||||
#include "common.h"
|
||||
#include "frag_reassembly_in.h"
|
||||
#include "frag_proc.h"
|
||||
#include "frag_dedup.h"
|
||||
#include "frag_av.h"
|
||||
#include "log.h"
|
||||
|
||||
extern frag_rssb_parameter_t g_frag_run;
|
||||
extern frag_rssb_configure_t g_frag_cfg;
|
||||
extern frag_rssb_status_t g_frag_stat;
|
||||
|
||||
uchar addrlist_to_streamtuple4(const char *addr, struct stream_tuple4_v4 *tuple4_v4, struct stream_tuple4_v6 *tuple4_v6)
|
||||
{
|
||||
uchar addrtype = 0;
|
||||
|
||||
touple4_type_t touple4;
|
||||
|
||||
if(sscanf(addr, "%[0-9.],%hu>%[0-9.],%hu", touple4.sip, &touple4.sport, touple4.dip, &touple4.dport) == 4)
|
||||
{
|
||||
addrtype = ADDR_TYPE_IPV4;
|
||||
inet_pton(AF_INET, touple4.sip, &tuple4_v4->saddr);
|
||||
inet_pton(AF_INET, touple4.dip, &tuple4_v4->daddr);
|
||||
tuple4_v4->source = htons(touple4.sport);
|
||||
tuple4_v4->dest = htons(touple4.dport);
|
||||
}
|
||||
else if(sscanf(addr, "%[0-9A-Fa-f:.],%hu>%[0-9A-Fa-f:.],%hu", touple4.sip, &touple4.sport, touple4.dip, &touple4.dport) == 4)
|
||||
{
|
||||
addrtype = ADDR_TYPE_IPV6;
|
||||
inet_pton(AF_INET6, touple4.sip, tuple4_v6->saddr);
|
||||
inet_pton(AF_INET6, touple4.dip, tuple4_v6->daddr);
|
||||
tuple4_v6->source = htons(touple4.sport);
|
||||
tuple4_v6->dest = htons(touple4.dport);
|
||||
}
|
||||
return addrtype;
|
||||
}
|
||||
|
||||
void media_dedup_report(media_t* mdi)
|
||||
{
|
||||
char* digest_buff = NULL;
|
||||
unsigned long long digest_len = 0;
|
||||
report_detail_t detail;
|
||||
struct stream_tuple4_v4 tuple4_v4;
|
||||
struct stream_tuple4_v6 tuple4_v6;
|
||||
|
||||
memset(&detail, 0, sizeof(report_detail_t));
|
||||
|
||||
if(mdi->configID)
|
||||
{
|
||||
detail.scan_detail = (scan_detail_t*)malloc(sizeof(scan_detail_t));
|
||||
detail.scan_detail->config_id = mdi->configID;
|
||||
}
|
||||
|
||||
detail.mid = mdi->mid;
|
||||
detail.current_len = mdi->byte_proc;
|
||||
detail.total_len = mdi->media_len;
|
||||
detail.ivi_handle = mdi->ivi;
|
||||
|
||||
/*digest*/
|
||||
if(NULL!=mdi->fuzzy)
|
||||
{
|
||||
digest_len = SFH_status(mdi->fuzzy, HASH_LENGTH);
|
||||
digest_buff = (char*)malloc(sizeof(char)*digest_len);
|
||||
detail.sfh_len = SFH_digest(mdi->fuzzy, digest_buff, digest_len);
|
||||
detail.file_sfh = digest_buff;
|
||||
}
|
||||
|
||||
/*url*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index])
|
||||
{
|
||||
detail.urllen = mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len;
|
||||
detail.url = mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_value;
|
||||
}
|
||||
|
||||
/*addr*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index])
|
||||
{
|
||||
detail.addrtype = addrlist_to_streamtuple4(mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index]->opt_value, &tuple4_v4, &tuple4_v6);
|
||||
switch(detail.addrtype)
|
||||
{
|
||||
case ADDR_TYPE_IPV4:
|
||||
detail.tuple4_v4 = &tuple4_v4;
|
||||
break;
|
||||
case ADDR_TYPE_IPV6:
|
||||
detail.tuple4_v6 = &tuple4_v6;
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if(FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_DEDUP) && !FLAG_TEST(mdi->td_query, TD_QUERY_RES_NOREPORT))
|
||||
{
|
||||
soqav_dedup_report(g_frag_run.dedup_hd, mdi->td, &detail);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*<2A>ظ<EFBFBD><D8B8><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>Ҫ<EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD>TD<54><44>ΪNULL*/
|
||||
soqav_dedup_report(g_frag_run.dedup_hd, NULL, &detail);
|
||||
}
|
||||
frag_write_to_log(AV_DEDUP_REPORT, mdi->mid, (void*)mdi->td, (void*)&mdi->byte_proc, mdi->configID);
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP_REPORT]);
|
||||
if(mdi->td_complete)
|
||||
{
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP_REPORT_COMPLETE]);
|
||||
}
|
||||
|
||||
if(NULL!=digest_buff)
|
||||
{
|
||||
free(digest_buff);
|
||||
}
|
||||
if(NULL!=detail.scan_detail)
|
||||
{
|
||||
free(detail.scan_detail);
|
||||
}
|
||||
}
|
||||
|
||||
long media_query_ack(void *data, const uint8_t *key, uint size, void *user_arg)
|
||||
{
|
||||
media_t* mdi = (media_t*)data;
|
||||
char ip_buf[64] = {0};
|
||||
query_result_t* ack_rsl = (query_result_t*)user_arg;
|
||||
int result = ack_rsl->status;
|
||||
uint32_t multisrc_bizmanip = ack_rsl->cpz_payload_ip;
|
||||
|
||||
/*<2A><><EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>*/
|
||||
/*
|
||||
result = BIT_TD_MULTI_SOURCE;
|
||||
multisrc_bizmanip = 16777343;
|
||||
ack_rsl->mid = 1111283823269670000;
|
||||
*/
|
||||
|
||||
if(NULL!=mdi)
|
||||
{
|
||||
/*<2A><><EFBFBD><EFBFBD>֮ǰ<D6AE>յ<EFBFBD><D5B5><EFBFBD>Ӧ<EFBFBD>𣬲<EFBFBD><F0A3ACB2><EFBFBD><EFBFBD>ٴ<EFBFBD><D9B4><EFBFBD>*/
|
||||
if(FLAG_TEST(mdi->td_query, TD_QUERY_ACK_DEDUP) || FLAG_TEST(mdi->td_query, TD_QUERY_ACK_MULTISRC))
|
||||
{
|
||||
return 0;
|
||||
}
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_ACK_DEDUP);
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_ACK_MULTISRC);
|
||||
|
||||
/*debug <20><><EFBFBD>ز<EFBFBD><D8B2><EFBFBD><EFBFBD>ߵ<EFBFBD><DFB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD>debugģʽ<C4A3><CABD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧЧ*/
|
||||
/*<2A><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>*/
|
||||
if(FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_MULTISRC))
|
||||
{
|
||||
if(result & BIT_TD_KNOWN)
|
||||
{
|
||||
frag_write_to_log(RECV_AV_DEDUP_ACK_KNOWN, mdi->mid, (void*)mdi->td, &result, 0);
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP]);
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_RES_DEDUP);
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_RES_NOREPORT);
|
||||
}
|
||||
/*<2A><><EFBFBD><EFBFBD>IP<49>DZ<EFBFBD><C7B1><EFBFBD>16777343(127.0.0.1)<29><><EFBFBD>ҽ<EFBFBD>ĿIDһ<44><D2BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD>ۺ<EFBFBD>*/
|
||||
else if(result & BIT_TD_MULTI_SOURCE && (multisrc_bizmanip!=16777343 ||(multisrc_bizmanip==16777343 && mdi->mid != (uint64_t)ack_rsl->mid)))
|
||||
{
|
||||
inet_ntop(AF_INET, &multisrc_bizmanip, ip_buf, 64);
|
||||
frag_write_to_log(RECV_AV_DEDUP_ACK_MULTI, mdi->mid, mdi, ip_buf, 0);
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_MULTI]);
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_RES_MULTISRC);
|
||||
mdi->mid_after_multisrc = ack_rsl->mid;
|
||||
mdi->multisrc_bizmanip = multisrc_bizmanip;
|
||||
create_media_write_to_log(mdi, MEDIA_MID_CHANGE, &ack_rsl->mid);
|
||||
}
|
||||
|
||||
struct queue_item* first_item = TAILQ_FIRST(&mdi->query_wait_lq);
|
||||
frag_ivi_info_t frag_ivi_info;
|
||||
while(first_item != NULL)
|
||||
{
|
||||
memset(&frag_ivi_info, 0, sizeof(frag_ivi_info));
|
||||
struct queue_item *item = TAILQ_NEXT(first_item, entries);
|
||||
TAILQ_REMOVE(&mdi->query_wait_lq, first_item, entries);
|
||||
frag_ivi_info.frg = (frag_in_t*)first_item->node;
|
||||
frag_ivi_info.thread_seq = first_item->thread_seq;
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[MULTISRC_QUEUE][QUEUE_OUT]);
|
||||
frag_write_to_log(ADD_FRAG_FROM_TAILQ, frag_ivi_info.frg->mid, frag_ivi_info.frg, NULL, 0);
|
||||
/*<2A><>Ŀ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>ֱ<EFBFBD>Ӷ<EFBFBD><D3B6><EFBFBD>*/
|
||||
if(result & BIT_TD_KNOWN && !g_frag_cfg.dedup_invalid)
|
||||
{
|
||||
/*<2A><>Ӧ<EFBFBD>ü<EFBFBD><C3BC><EFBFBD>ȥ<EFBFBD><C8A5>ͳ<EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD>Ϊ<EFBFBD>ⲿ<EFBFBD><E2B2BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><CDB8>˷<EFBFBD><CBB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
free_frag_in(frag_ivi_info.frg,0,NULL);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(result & BIT_TD_MULTI_SOURCE && (multisrc_bizmanip!=16777343 ||(multisrc_bizmanip==16777343 && mdi->mid != (uint64_t)ack_rsl->mid)))
|
||||
{
|
||||
frag_ivi_info.frg->new_mid = mdi->mid_after_multisrc;
|
||||
frag_ivi_info.frg->multisrc_bizmanip = mdi->multisrc_bizmanip;
|
||||
FLAG_SET(frag_ivi_info.frg->frag_flag, FRAG_FLAG_MULTISRC);
|
||||
frag_add_wait_lq(&frag_ivi_info, 1, frag_ivi_info.thread_seq);
|
||||
}
|
||||
/*<2A><><EFBFBD>ۺϵĶ<CFB5>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD><DDB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD>Ѿ<EFBFBD><D1BE><EFBFBD><EFBFBD><EFBFBD><CDB9><EFBFBD>*/
|
||||
else
|
||||
{
|
||||
free_frag_in(frag_ivi_info.frg,0,NULL);
|
||||
}
|
||||
}
|
||||
free(first_item);
|
||||
first_item = NULL;
|
||||
first_item = item;
|
||||
}
|
||||
}
|
||||
else if(result & BIT_TD_KNOWN)
|
||||
{
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP]);
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_RES_DEDUP);
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_RES_NOREPORT);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP_TIMEOUT]);
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
long soqav_query_callback(const char *td, const query_result_t *result, void *user_arg)
|
||||
{
|
||||
long rec_cb = 0;
|
||||
uint64_t media_mid = (uint64_t)user_arg;
|
||||
|
||||
frag_write_to_log(RECV_AV_DEDUP_ACK, media_mid, (void*)td, (void*)&result->status, 0);
|
||||
MESA_htable_search_cb(g_frag_run.media_hash, (const uint8_t *)&media_mid, sizeof(media_mid),
|
||||
media_query_ack, (void*)result, &rec_cb);
|
||||
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP_ACK]);
|
||||
return rec_cb;
|
||||
}
|
||||
|
||||
void generate_td_meta(media_t* mdi)
|
||||
{
|
||||
char* td_buf = NULL;
|
||||
int td_buflen = 0;
|
||||
char media_len[64] = {0};
|
||||
char media_type[16] = {0};
|
||||
char serverIP[64] = {0};
|
||||
|
||||
snprintf(media_type, sizeof(media_type), "%hhu", mdi->media_type);
|
||||
if(is_frag(mdi->media_type))
|
||||
{
|
||||
snprintf(media_len, sizeof(media_len), "%lu", mdi->media_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
snprintf(media_len, sizeof(media_len), "%d", 0);
|
||||
}
|
||||
|
||||
if(mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index] != NULL)
|
||||
{
|
||||
get_serverIP(mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index]->opt_len, serverIP);
|
||||
}
|
||||
|
||||
td_buflen = strlen("URL:")
|
||||
+strlen("ServerIP:")+strlen(serverIP)
|
||||
+strlen("MediaType:")+strlen(media_type)
|
||||
+strlen("MediaLen:")+strlen(media_len)
|
||||
+strlen("Etag:")
|
||||
+strlen("LastModify:")
|
||||
+1;
|
||||
if(mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index] != NULL)
|
||||
{
|
||||
td_buflen+=mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
if(mdi->opt[MEDIA_OPT_ETAG][mdi->url_opt_index] != NULL)
|
||||
{
|
||||
td_buflen+=mdi->opt[MEDIA_OPT_ETAG][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
if(mdi->opt[MEDIA_OPT_LAST_MODIFY][mdi->url_opt_index] !=NULL)
|
||||
{
|
||||
td_buflen+=mdi->opt[MEDIA_OPT_LAST_MODIFY][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
td_buf = (char*)calloc(1, td_buflen);
|
||||
char* p_td_buf = td_buf;
|
||||
|
||||
memcpy(p_td_buf, "URL:" ,strlen("URL:"));
|
||||
p_td_buf += strlen("URL:");
|
||||
if(mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index] != NULL)
|
||||
{
|
||||
memcpy(p_td_buf,mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_value,mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
p_td_buf += mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
memcpy(p_td_buf, "ServerIP:" ,strlen("ServerIP:"));
|
||||
p_td_buf += strlen("ServerIP:");
|
||||
if(strlen(serverIP) >0)
|
||||
{
|
||||
memcpy(p_td_buf, serverIP,strlen(serverIP));
|
||||
p_td_buf += strlen(serverIP);
|
||||
}
|
||||
memcpy(p_td_buf, "MediaType:" ,strlen("MediaType:"));
|
||||
p_td_buf += strlen("MediaType:");
|
||||
memcpy(p_td_buf, media_type, strlen(media_type));
|
||||
p_td_buf += strlen(media_type);
|
||||
memcpy(p_td_buf, "MediaLen:" ,strlen("MediaLen:"));
|
||||
p_td_buf += strlen("MediaLen:");
|
||||
memcpy(p_td_buf, media_len, strlen(media_len));
|
||||
p_td_buf += strlen(media_len);
|
||||
|
||||
memcpy(p_td_buf, "Etag:" ,strlen("Etag:"));
|
||||
p_td_buf += strlen("Etag:");
|
||||
if(mdi->opt[MEDIA_OPT_ETAG][mdi->url_opt_index] != NULL)
|
||||
{
|
||||
memcpy(p_td_buf, mdi->opt[MEDIA_OPT_ETAG][mdi->url_opt_index]->opt_value,mdi->opt[MEDIA_OPT_ETAG][mdi->url_opt_index]->opt_len);
|
||||
p_td_buf += mdi->opt[MEDIA_OPT_ETAG][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
memcpy(p_td_buf, "LastModify:" ,strlen("LastModify:"));
|
||||
p_td_buf += strlen("LastModify:");
|
||||
if(mdi->opt[MEDIA_OPT_LAST_MODIFY][mdi->url_opt_index] != NULL)
|
||||
{
|
||||
memcpy(p_td_buf, mdi->opt[MEDIA_OPT_LAST_MODIFY][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_LAST_MODIFY][mdi->url_opt_index]->opt_len);
|
||||
p_td_buf += mdi->opt[MEDIA_OPT_LAST_MODIFY][mdi->url_opt_index]->opt_len;
|
||||
}
|
||||
|
||||
mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index] = (opt_in_t*)malloc(sizeof(opt_in_t));
|
||||
mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len = td_buflen;
|
||||
mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_type = 0;
|
||||
mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value = (char*)malloc(td_buflen);
|
||||
memcpy(mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value,td_buf,td_buflen);
|
||||
if(NULL!=td_buf)
|
||||
{
|
||||
free(td_buf);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
long set_td_data(media_t* mdi, frag_in_t* frg)
|
||||
{
|
||||
uint64_t cur_td_datalen = 0;
|
||||
|
||||
if(mdi->td_complete==0 && frg->offset<g_frag_cfg.td_data_maxsize)
|
||||
{
|
||||
if(NULL==mdi->td_data)
|
||||
{
|
||||
mdi->td_data = (char*)malloc(g_frag_cfg.td_data_maxsize);
|
||||
}
|
||||
if(NULL!=mdi->td_data)
|
||||
{
|
||||
cur_td_datalen = ((frg->offset+frg->datalen)>g_frag_cfg.td_data_maxsize) ? (g_frag_cfg.td_data_maxsize-frg->offset): frg->datalen;
|
||||
memcpy(mdi->td_data+frg->offset, frg->data, cur_td_datalen);
|
||||
mdi->td_datalen += cur_td_datalen;
|
||||
/*td_data<74><61><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܲ<EFBFBD>ѯ*/
|
||||
if(mdi->td_datalen==g_frag_cfg.td_data_maxsize)
|
||||
{
|
||||
//url is not empty,<2C>ȴ<EFBFBD><C8B4><EFBFBD>Դ<EFBFBD><D4B4>ѯURL<52><4C><EFBFBD><EFBFBD><EFBFBD><EFBFBD>url<72><6C><EFBFBD><EFBFBD>TD
|
||||
if(NULL != mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index])
|
||||
{
|
||||
FLAG_SET(mdi->td_query,TD_QUERY_TYPE_DEDUP);
|
||||
generate_td_meta(mdi);
|
||||
caculate_md5(mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len, mdi->td_data, mdi->td_datalen, mdi->td, TD_LEN);
|
||||
mdi->td_complete = 1;
|
||||
return 1;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void soqav_query_timeout(void * context)
|
||||
{
|
||||
struct timer_context_t *ctx = (struct timer_context_t *)context;
|
||||
uint64_t mid = ctx->mid;
|
||||
long rec_cb = 0;
|
||||
|
||||
query_result_t result;
|
||||
|
||||
result.status = 0;
|
||||
result.cpz_mg_ip = 0;
|
||||
result.cpz_payload_ip = 0;
|
||||
result.reserve = 0;
|
||||
result.mid = mid;
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP_ACK_TIMEOUT]);
|
||||
|
||||
MESA_htable_search_cb(g_frag_run.media_hash, (const uint8_t *)&mid, sizeof(mid),
|
||||
media_query_ack, &result, &rec_cb);
|
||||
}
|
||||
|
||||
void soqav_query_free_timeout(void * context)
|
||||
{
|
||||
if(NULL!=context)
|
||||
{
|
||||
free(context);
|
||||
}
|
||||
}
|
||||
|
||||
void free_query_detail(query_detail_t* query_detail)
|
||||
{
|
||||
if(NULL!=query_detail)
|
||||
{
|
||||
switch(query_detail->addrtype)
|
||||
{
|
||||
case ADDR_TYPE_IPV4:
|
||||
if(NULL!=query_detail->tuple4_v4)
|
||||
{
|
||||
free(query_detail->tuple4_v4);
|
||||
}
|
||||
break;
|
||||
case ADDR_TYPE_IPV6:
|
||||
if(NULL!=query_detail->tuple4_v6)
|
||||
{
|
||||
free(query_detail->tuple4_v6);
|
||||
}
|
||||
break;
|
||||
}
|
||||
if(NULL!=query_detail->url)
|
||||
{
|
||||
free((void*)query_detail->url);
|
||||
}
|
||||
free(query_detail);
|
||||
}
|
||||
}
|
||||
|
||||
void proc_media_multisrc(media_t* mdi, int timeout)
|
||||
{
|
||||
query_detail_t* query_detail = NULL;
|
||||
struct stream_tuple4_v4 tuple4_v4 ;
|
||||
struct stream_tuple4_v6 tuple4_v6 ;
|
||||
|
||||
/*<2A>ж<EFBFBD><D0B6>Ƿ<EFBFBD><C7B7><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ*/
|
||||
/*<2A><><EFBFBD><D7BC>ʱ֮<CAB1><D6AE>һ<EFBFBD><D2BB><EFBFBD>ᷢ<EFBFBD><E1B7A2><EFBFBD><EFBFBD>ѯ*/
|
||||
if(!FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_YES)&&
|
||||
(((FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_DEDUP)||mdi->byte_proc>g_frag_cfg.td_data_maxsize)
|
||||
&& FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_MULTISRC))||timeout))
|
||||
{
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>td_meta,<2C>̶<EFBFBD><CCB6><EFBFBD><EFBFBD><EFBFBD>td*/
|
||||
if((g_frag_cfg.av_dedup_switch) && (mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index] == NULL))
|
||||
{
|
||||
generate_td_meta(mdi);
|
||||
if(mdi->td_complete != 1 && mdi->td_datalen==g_frag_cfg.td_data_maxsize)
|
||||
{
|
||||
caculate_md5(mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len, mdi->td_data, mdi->td_datalen, mdi->td, TD_LEN);
|
||||
mdi->td_complete = 1;
|
||||
}
|
||||
}
|
||||
|
||||
FLAG_SET(mdi->td_query, TD_QUERY_TYPE_YES);
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD>ж<EFBFBD>Դ<EFBFBD><D4B4><EFBFBD>߽<EFBFBD><DFBD>ز<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD><EFBFBD><EFBFBD><EFBFBD>query_detail*/
|
||||
query_detail = (query_detail_t*)calloc(1, sizeof(query_detail_t));
|
||||
query_detail->total_len = mdi->media_len;
|
||||
query_detail->mid = mdi->mid;
|
||||
|
||||
/*addr*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index])
|
||||
{
|
||||
query_detail->addrtype = addrlist_to_streamtuple4(mdi->opt[MEDIA_OPT_ADDR][mdi->url_opt_index]->opt_value, &tuple4_v4, &tuple4_v6);
|
||||
switch(query_detail->addrtype)
|
||||
{
|
||||
case ADDR_TYPE_IPV4:
|
||||
query_detail->tuple4_v4 = (struct stream_tuple4_v4*)malloc(sizeof(struct stream_tuple4_v4));;
|
||||
memcpy(query_detail->tuple4_v4, &tuple4_v4, sizeof(tuple4_v4));
|
||||
break;
|
||||
case ADDR_TYPE_IPV6:
|
||||
query_detail->tuple4_v6 = (struct stream_tuple4_v6*)malloc(sizeof(struct stream_tuple4_v6));;
|
||||
memcpy(query_detail->tuple4_v6, &tuple4_v6, sizeof(tuple4_v6));
|
||||
break;
|
||||
}
|
||||
}
|
||||
/*<2A><>Դ<EFBFBD><D4B4>ѯ*/
|
||||
if(FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_MULTISRC))
|
||||
{
|
||||
/*<2A><><EFBFBD>ö<EFBFBD>ʱ<EFBFBD><CAB1>*/
|
||||
struct timer_context_t *context = (struct timer_context_t *)calloc(1, sizeof(struct timer_context_t));
|
||||
context->mid = mdi->mid;
|
||||
MESA_timer_add(g_frag_run.multisrc_timer[mdi->thread_seq],
|
||||
time(NULL),
|
||||
g_frag_cfg.multisrc_wait_timeout,
|
||||
soqav_query_timeout,
|
||||
context,
|
||||
soqav_query_free_timeout,
|
||||
&mdi->timer_idx);
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index])
|
||||
{
|
||||
query_detail->url = (char*)malloc(mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
query_detail->urllen = mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len;
|
||||
memcpy((void*)query_detail->url, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_URL][mdi->url_opt_index]->opt_len);
|
||||
}
|
||||
}
|
||||
if(FLAG_TEST(mdi->td_query, TD_QUERY_TYPE_DEDUP))
|
||||
{
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_TD_QUERY]);
|
||||
soqav_dedup_query(g_frag_run.dedup_hd, mdi->td, query_detail, soqav_query_callback, (void*)mdi->mid);
|
||||
}
|
||||
else
|
||||
{
|
||||
soqav_dedup_query(g_frag_run.dedup_hd, NULL, query_detail, soqav_query_callback, (void*)mdi->mid);
|
||||
}
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_DEDUP_QUERY]);
|
||||
frag_write_to_log(SEND_AV_DEDUP_QUERY, mdi->mid, mdi, NULL, 0);
|
||||
if(NULL!=query_detail)
|
||||
{
|
||||
free_query_detail(query_detail);
|
||||
query_detail =NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
34
src/frag_dedup.h
Normal file
34
src/frag_dedup.h
Normal file
@@ -0,0 +1,34 @@
|
||||
#ifndef _FRAG_DEDUP_H
|
||||
#define _FRAG_DEDUP_H
|
||||
|
||||
#define TD_QUERY_TYPE_DEDUP 0x01 //<2F><><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><D1AF>־λ
|
||||
#define TD_QUERY_TYPE_MULTISRC 0x02 //<2F><>Դ<EFBFBD><D4B4>ѯ<EFBFBD><D1AF>־λ
|
||||
#define TD_QUERY_TYPE_YES 0x04 //<2F><>ѯ<EFBFBD>ı<EFBFBD>־λ
|
||||
#define TD_QUERY_ACK_DEDUP 0x10 //<2F><><EFBFBD>ز<EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD>־λ
|
||||
#define TD_QUERY_ACK_MULTISRC 0x20 //<2F><>Դ<EFBFBD><D4B4>ѯ<EFBFBD><D1AF><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD><EFBFBD><EFBFBD>־λ
|
||||
#define TD_QUERY_RES_DEDUP 0x40 //<2F><><EFBFBD>ر<EFBFBD>ʶ
|
||||
#define TD_QUERY_RES_MULTISRC 0x80 //<2F><>Դ<EFBFBD><D4B4>ʶ
|
||||
#define TD_QUERY_RES_NOREPORT 0x08 //<2F>ϱ<EFBFBD><CFB1><EFBFBD>ʶ
|
||||
|
||||
struct timer_context_t
|
||||
{
|
||||
uint64_t mid;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void generate_td_meta(media_t* mdi);
|
||||
long set_td_data(media_t* mdi, frag_in_t* frg);
|
||||
void media_dedup_report(media_t* mdi);
|
||||
void free_query_detail(query_detail_t* query_detail);
|
||||
void proc_media_multisrc(media_t* mdi, int timeout);
|
||||
long soqav_query_callback(const char *td, const query_result_t* result, void *user_arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
354
src/frag_json.c
Normal file
354
src/frag_json.c
Normal file
@@ -0,0 +1,354 @@
|
||||
/*
|
||||
* <20><>ý<EFBFBD><C3BD>:<3A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>״̬
|
||||
*/
|
||||
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <time.h>
|
||||
#include <openssl/md5.h>
|
||||
|
||||
#include "cJSON.h"
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
#include "stream_fuzzy_hash.h"
|
||||
#include "AV_sendback_in.h"
|
||||
#include "frag_json.h"
|
||||
#include "frag_proc.h"
|
||||
#include "log.h"
|
||||
|
||||
extern frag_rssb_parameter_t g_frag_run;
|
||||
extern frag_rssb_configure_t g_frag_cfg;
|
||||
extern frag_rssb_status_t g_frag_stat;
|
||||
|
||||
extern sip_opt_t g_sip_opt_type[SIP_OPT_NUM];
|
||||
|
||||
const char* g_td_des_json[] =
|
||||
{
|
||||
"data_md5_1k",
|
||||
"td_1k",
|
||||
"data_md5_2k",
|
||||
"td_2k",
|
||||
"data_md5_4k",
|
||||
"td_4k" ,
|
||||
"data_md5_8k",
|
||||
"td_8k" ,
|
||||
"data_md5_16k",
|
||||
"td_16k",
|
||||
"data_md5_32k",
|
||||
"td_32k",
|
||||
"data_md5_64k",
|
||||
"td_64k",
|
||||
};
|
||||
|
||||
/*<2A><>kafka<6B><61>ѡ<EFBFBD><D1A1>*/
|
||||
#define JSON_MAXOPT 8
|
||||
int json_opt[JSON_MAXOPT] = {MEDIA_OPT_CAP_IP,MEDIA_OPT_URL, MEDIA_OPT_REFERER, MEDIA_OPT_UA, MEDIA_OPT_SINGLE_KEY, MEDIA_OPT_ETAG, MEDIA_OPT_LAST_MODIFY, MEDIA_OPT_SERVER};
|
||||
const char* json_optname[JSON_MAXOPT] = {"cap_ip", "url", "referer", "ua", "single_key", "etag", "last_modify", "server"};
|
||||
void media_json_report(media_t* mdi, int topic_event)
|
||||
{
|
||||
cJSON* root;
|
||||
char* digest_buff = NULL;
|
||||
unsigned long long digest_len = 0;
|
||||
uint64_t pid = 0;
|
||||
cJSON* ip_array = NULL;
|
||||
cJSON* pid_array = NULL;
|
||||
cJSON* muti_url_array = NULL;
|
||||
uint32_t ip = 0;
|
||||
char* out = NULL;
|
||||
uint32_t out_len = 0;
|
||||
char pbuf[32] = {0};
|
||||
int buf_len = 32;
|
||||
char filename[64] = {0};
|
||||
FILE* fp = NULL;
|
||||
string topic_name;
|
||||
const char* topic = NULL;
|
||||
char pid_buf[32] = {0};
|
||||
char td[TD_LEN] = {0};
|
||||
int cb_ret = 0;
|
||||
touple4_type_t touple4;
|
||||
|
||||
if(topic_event==TOPIC_EVENT_CREATE)
|
||||
{
|
||||
if(mdi->proto==AV_PROTOCOL_SIP)
|
||||
{
|
||||
topic = TOPIC_VOIP_CREATE_JSON;
|
||||
}
|
||||
else
|
||||
{
|
||||
topic = TOPIC_MEDIA_CREATE_JSON;
|
||||
}
|
||||
}
|
||||
else if(topic_event==TOPIC_EVENT_EXPIRE)
|
||||
{
|
||||
if(mdi->proto==AV_PROTOCOL_SIP)
|
||||
{
|
||||
topic = TOPIC_VOIP_EXPIRE_JSON;
|
||||
}
|
||||
else
|
||||
{
|
||||
topic = TOPIC_MEDIA_EXPIRE_JSON;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
return ;
|
||||
}
|
||||
|
||||
topic_name = topic;
|
||||
|
||||
root = cJSON_CreateObject();
|
||||
|
||||
/*mid*/
|
||||
snprintf(pid_buf, sizeof(pid_buf), "%lu", mdi->mid);
|
||||
cJSON_AddStringToObject(root, "mid", pid_buf);
|
||||
|
||||
/*trans_len*/
|
||||
cJSON_AddNumberToObject(root, "trans_len", mdi->byte_proc);
|
||||
|
||||
/*media_len*/
|
||||
cJSON_AddNumberToObject(root, "media_len", mdi->media_len);
|
||||
|
||||
/*media_type*/
|
||||
cJSON_AddNumberToObject(root, "media_type", mdi->media_type);
|
||||
|
||||
/*create_time*/
|
||||
cJSON_AddNumberToObject(root, "create_time", mdi->create_time);
|
||||
|
||||
/*expire_time*/
|
||||
cJSON_AddNumberToObject(root, "expire_time", time(NULL));
|
||||
|
||||
/*cpz_ip*/
|
||||
memset(pbuf, 0, sizeof(pbuf));
|
||||
inet_ntop(AF_INET, &g_frag_cfg.local_ip_nr, pbuf, buf_len);
|
||||
cJSON_AddStringToObject(root, "cpz_ip", pbuf);
|
||||
|
||||
/*pid*/
|
||||
if(NULL!=mdi->pid)
|
||||
{
|
||||
pid_array = cJSON_CreateArray();
|
||||
for(int i=0;i<PID_MAXNUM;i++)
|
||||
{
|
||||
pid = mdi->pid[i];
|
||||
if(!pid)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
memset(pid_buf, 0, sizeof(pid_buf));
|
||||
snprintf(pid_buf, sizeof(pid_buf), "%lu", pid);
|
||||
cJSON_AddStringToObject(pid_array, "pid", pid_buf);
|
||||
}
|
||||
cJSON_AddItemToObject(root, "pid", pid_array);
|
||||
}
|
||||
|
||||
/*cap_ip*/
|
||||
ip_array = cJSON_CreateArray();
|
||||
for(int i=0;i<QD_MAXNUM;i++)
|
||||
{
|
||||
ip = mdi->qd_info[i].cap_ip;
|
||||
if(!ip)
|
||||
{
|
||||
continue;
|
||||
}
|
||||
memset(pbuf, 0, sizeof(pbuf));
|
||||
inet_ntop(AF_INET, &ip, pbuf, buf_len);
|
||||
cJSON_AddStringToObject(ip_array, "cap_ip", pbuf);
|
||||
}
|
||||
cJSON_AddItemToObject(root, "cap_ip", ip_array);
|
||||
|
||||
/*SIP<49><50>¼<EFBFBD>ֽ<EFBFBD><D6BD><EFBFBD>*/
|
||||
if(mdi->media_service_type==MEDIA_SERVICE_TYPE_SIP)
|
||||
{
|
||||
cJSON_AddNumberToObject(root, "pkt_in", mdi->pkt_in);
|
||||
cJSON_AddNumberToObject(root, "pkt_out", mdi->pkt_proc);
|
||||
cJSON_AddNumberToObject(root, "byte_in", mdi->byte_in);
|
||||
cJSON_AddNumberToObject(root, "byte_out", mdi->byte_proc);
|
||||
cJSON_AddNumberToObject(root, "reoffset", mdi->re_offset);
|
||||
char buf[128] = {0};
|
||||
for(int i=0;i<SIP_OPT_NUM;i++)
|
||||
{
|
||||
if(NULL!=mdi->sip_opt[i])
|
||||
{
|
||||
memset(buf, 0, sizeof(buf));
|
||||
memcpy(buf, mdi->sip_opt[i]->opt_value, MIN(mdi->sip_opt[i]->opt_len, 127));
|
||||
cJSON_AddStringToObject(root, g_sip_opt_type[i].opt_name, buf);
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
/*digest*/
|
||||
if(NULL!=mdi->fuzzy)
|
||||
{
|
||||
digest_len = SFH_status(mdi->fuzzy, HASH_LENGTH);
|
||||
digest_buff = (char*)calloc(1, sizeof(char)*digest_len+1);
|
||||
SFH_digest(mdi->fuzzy, digest_buff, digest_len);
|
||||
cJSON_AddStringToObject(root, "digest", digest_buff);
|
||||
}
|
||||
/*digest_len*/
|
||||
cJSON_AddNumberToObject(root, "digest_len", digest_len);
|
||||
|
||||
/*multi_url*/
|
||||
char opt_temp[JSON_MAXOPT][4096] = {{0}};
|
||||
cJSON* url_obj[OPT_MAXNUN] = {NULL};
|
||||
muti_url_array = cJSON_CreateArray();
|
||||
for(int i=0;i<mdi->opt_index;i++)
|
||||
{
|
||||
url_obj[i] = cJSON_CreateObject();
|
||||
|
||||
//pid
|
||||
memset(pid_buf, 0, sizeof(pid_buf));
|
||||
snprintf(pid_buf, sizeof(pid_buf), "%lu", *(uint64_t*)mdi->opt[MEDIA_OPT_PID][i]->opt_value);
|
||||
cJSON_AddStringToObject(url_obj[i], "pid", pid_buf);
|
||||
|
||||
//addr
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_ADDR][i])
|
||||
{
|
||||
if(sscanf(mdi->opt[MEDIA_OPT_ADDR][i]->opt_value, "%[0-9.],%hu>%[0-9.],%hu", touple4.sip, &touple4.sport, touple4.dip, &touple4.dport) == 4)
|
||||
{
|
||||
touple4.addr_type = 4;
|
||||
}
|
||||
else if(sscanf(mdi->opt[MEDIA_OPT_ADDR][i]->opt_value, "%[0-9A-Fa-f:.],%hu>%[0-9A-Fa-f:.],%hu", touple4.sip, &touple4.sport, touple4.dip, &touple4.dport) == 4)
|
||||
{
|
||||
touple4.addr_type = 6;
|
||||
}
|
||||
cJSON_AddStringToObject(url_obj[i], "s_ip", touple4.sip);
|
||||
cJSON_AddNumberToObject(url_obj[i], "s_port", touple4.sport);
|
||||
cJSON_AddStringToObject(url_obj[i], "d_ip", touple4.dip);
|
||||
cJSON_AddNumberToObject(url_obj[i], "d_port", touple4.dport);
|
||||
}
|
||||
|
||||
//protocol
|
||||
cJSON_AddNumberToObject(url_obj[i], "protocol", *(uint8_t*)mdi->opt[MEDIA_OPT_PROTOCOL][i]->opt_value);
|
||||
|
||||
//others
|
||||
for(int j=0;j<JSON_MAXOPT;j++)
|
||||
{
|
||||
if(NULL!=mdi->opt[json_opt[j]][i])
|
||||
{
|
||||
memcpy(opt_temp[j], mdi->opt[json_opt[j]][i]->opt_value, MIN(sizeof(opt_temp[j])-1, mdi->opt[json_opt[j]][i]->opt_len));
|
||||
cJSON_AddStringToObject(url_obj[i], json_optname[j], opt_temp[j]);
|
||||
}
|
||||
}
|
||||
cJSON_AddItemToObject(muti_url_array, "multi_session", url_obj[i]);
|
||||
}
|
||||
cJSON_AddItemToObject(root, "multi_session", muti_url_array);
|
||||
|
||||
/*index_url*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_INDEX_URL][mdi->url_opt_index])
|
||||
{
|
||||
cJSON_AddStringToObject(root, "index_url", mdi->opt[MEDIA_OPT_INDEX_URL][mdi->url_opt_index]->opt_value);
|
||||
}
|
||||
/*index_referer*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_INDEX_REFERER][mdi->url_opt_index])
|
||||
{
|
||||
cJSON_AddStringToObject(root, "index_referer", mdi->opt[MEDIA_OPT_INDEX_REFERER][mdi->url_opt_index]->opt_value);
|
||||
}
|
||||
/*index_ua*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_INDEX_UA][mdi->url_opt_index])
|
||||
{
|
||||
cJSON_AddStringToObject(root, "index_ua", mdi->opt[MEDIA_OPT_INDEX_UA][mdi->url_opt_index]->opt_value);
|
||||
}
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
if(NULL!=mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index])
|
||||
{
|
||||
/*td_meta*/
|
||||
cJSON_AddStringToObject(root, "td_meta", mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value);
|
||||
|
||||
/*td_0k*/
|
||||
caculate_md5(mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len, NULL, 0, td, TD_LEN);
|
||||
cJSON_AddStringToObject(root, "td_0k", td);
|
||||
|
||||
/*data_md5_1k*/ /*td_1k*/
|
||||
/*data_md5_2k*/ /*td_2k*/
|
||||
/*data_md5_4k*/ /*td_4k*/
|
||||
/*data_md5_8k*/ /*td_8k*/
|
||||
/*data_md5_16k*/ /*td_16k*/
|
||||
/*data_md5_32k*/ /*td_32k*/
|
||||
/*data_md5_64k*/ /*td_64k*/
|
||||
uint32 i=0;
|
||||
for(int j=0;j<=6;j++)
|
||||
{
|
||||
i=1<<j;
|
||||
if(mdi->td_datalen>=i*1024)
|
||||
{
|
||||
caculate_md5(NULL, 0, mdi->td_data, i*1024, td, TD_LEN);
|
||||
cJSON_AddStringToObject(root, g_td_des_json[2*j], td);
|
||||
|
||||
caculate_md5(mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_value, mdi->opt[MEDIA_OPT_TD_META][mdi->url_opt_index]->opt_len, mdi->td_data, i*1024, td, TD_LEN);
|
||||
cJSON_AddStringToObject(root, g_td_des_json[2*j+1], td);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*<2A><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>*/
|
||||
/*cfg_id*/
|
||||
cJSON_AddNumberToObject(root, "cfg_id", mdi->cfg_id);
|
||||
|
||||
/*service*/
|
||||
cJSON_AddNumberToObject(root, "service", mdi->service);
|
||||
|
||||
/*level*/
|
||||
cJSON_AddNumberToObject(root, "level", mdi->level);
|
||||
|
||||
/*survey time*/
|
||||
cJSON_AddNumberToObject(root, "survey_time", mdi->survey_time);
|
||||
|
||||
/*log_url*/
|
||||
cJSON_AddStringToObject(root, "log_url", mdi->log_url);
|
||||
|
||||
//out = cJSON_PrintUnformatted(root);
|
||||
out = cJSON_Print(root);
|
||||
out_len = strlen(out);
|
||||
|
||||
cb_ret = g_frag_run.kafka_producer->SendData(topic_name, (void *)out, (size_t)out_len);
|
||||
if(0!=cb_ret)
|
||||
{
|
||||
/*fail output*/
|
||||
atomic_inc(&g_frag_stat.stat_info[MEDIA_JSON][FAIL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[MEDIA_JSON][FAIL_BYTES], out_len);
|
||||
}
|
||||
else
|
||||
{
|
||||
/*succ output*/
|
||||
atomic_inc(&g_frag_stat.stat_info[MEDIA_JSON][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[MEDIA_JSON][TOTAL_BYTES], out_len);
|
||||
}
|
||||
|
||||
/*for debug*/
|
||||
if(g_frag_cfg.json_local_switch)
|
||||
{
|
||||
struct tm now;
|
||||
char day_time[32] = {0};
|
||||
struct timeval tv;
|
||||
struct timezone tz;
|
||||
gettimeofday(&tv, &tz);
|
||||
localtime_r(&tv.tv_sec, &now);
|
||||
strftime(day_time, sizeof(day_time), "%Y-%m-%d", &now);
|
||||
snprintf(filename, sizeof(filename), "%s%s%s_%s", "./log/", topic, ".json", day_time);
|
||||
if(NULL!=(fp=fopen(filename,"a+")))
|
||||
{
|
||||
fwrite(out, strlen(out), 1, fp);
|
||||
fclose(fp);
|
||||
}
|
||||
}
|
||||
cJSON_Delete(root);
|
||||
|
||||
if(NULL!=out)
|
||||
{
|
||||
free(out);
|
||||
}
|
||||
if(NULL!=digest_buff)
|
||||
{
|
||||
free(digest_buff);
|
||||
}
|
||||
}
|
||||
|
||||
28
src/frag_json.h
Normal file
28
src/frag_json.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _FRAG_JSON_H
|
||||
#define _FRAG_JSON_H
|
||||
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
#define TOPIC_EVENT_CREATE 0
|
||||
#define TOPIC_EVENT_EXPIRE 1
|
||||
|
||||
/*¿çýÌ廨´«JSONÐÅÏ¢µÄtopic_name*/
|
||||
#define TOPIC_MEDIA_CREATE_JSON "MEDIA_CREATE_INFO"
|
||||
#define TOPIC_MEDIA_EXPIRE_JSON "MEDIA_EXPIRE_INFO"
|
||||
#define TOPIC_SURVEY_JSON "SURVEY_INFO"
|
||||
|
||||
#define TOPIC_VOIP_CREATE_JSON "VOIP_CREATE_INFO"
|
||||
#define TOPIC_VOIP_EXPIRE_JSON "VOIP_EXPIRE_INFO"
|
||||
#define TOPIC_VOIP_SURVEY_JSON "VOIP_SURVEY_INFO"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void media_json_report(media_t* mdi, int topic_event);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
1721
src/frag_proc.c
Normal file
1721
src/frag_proc.c
Normal file
File diff suppressed because it is too large
Load Diff
42
src/frag_proc.h
Normal file
42
src/frag_proc.h
Normal file
@@ -0,0 +1,42 @@
|
||||
#ifndef _FRAG_PROC_H
|
||||
#define _FRAG_PROC_H
|
||||
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
#define PID_TYPE_DEF 0
|
||||
#define PID_TYPE_URL 1
|
||||
#define PID_TYPE_IPLEN 2
|
||||
#define PID_TYPE_CON 3
|
||||
#define PID_TYPE_ADDR 4
|
||||
#define PID_TYPE_COUNT 5
|
||||
#define PID_TYPE_RESORT 6
|
||||
#define PID_TYPE_IMAGE 7
|
||||
|
||||
#define FLAG_SET(x, flag) ((x) |= (flag))
|
||||
#define FLAG_CLEAR(x, flag) ((x) &= ~(flag))
|
||||
#define FLAG_TEST(x, flag) (0 != ((x) & (flag)))
|
||||
|
||||
#define SET_BIT(x, n) ( (x) |= (1<<n) )
|
||||
#define GET_BIT(x, n) ( ((x)>>(n)) & 1 )
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void create_media_write_to_log(media_t* mdi, int type, void* param);
|
||||
void expire_media_write_to_log(media_t* mdi, int type, void* param);
|
||||
void send_ack_to_qd(frag_in_t* frg, uint32_t src_ip, int thread_seq);
|
||||
int get_serverIP(const char *addr, uint32_t addr_len, char* d_ip);
|
||||
int save_qd_info(qd_info_t qd_info[], uint32_t qd_info_maxnum, uint8_t* qd_info_idx_last, uint32_t capip, uint64_t mid);
|
||||
void frag_write_to_log(int type, uint64_t mid, void* param1, void* param2, uint32_t param3);
|
||||
int caculate_md5(const char *meta, unsigned long meta_len, const char *data, unsigned long len, char *result, unsigned int result_len);
|
||||
int frag_unit_removal(media_t* mdi, uint64_t reoffset);
|
||||
int frag_removal_and_merge(IVI_t* ivi, frag_ivi_info_t* frag_ivi_info);
|
||||
char* merge_addr(char* addr_buf, uint32_t* addr_buflen, char* opt_addr, uint32_t opt_addrlen, int thread_seq);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
1639
src/frag_reassembly.c
Normal file
1639
src/frag_reassembly.c
Normal file
File diff suppressed because it is too large
Load Diff
70
src/frag_reassembly.h
Normal file
70
src/frag_reassembly.h
Normal file
@@ -0,0 +1,70 @@
|
||||
#ifndef _FRAG_REASSEMBLY_H
|
||||
#define _FRAG_REASSEMBLY_H
|
||||
|
||||
|
||||
#define RETURN_FRAG 0x01
|
||||
#define RETURN_MEDIA 0x02
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MEDIA_INFO_NAME=0,
|
||||
MEDIA_INFO_MAXNUM,
|
||||
}MEDIA_INFO_TYPE;
|
||||
|
||||
/*more opt_unit than msg_metainfo_t*/
|
||||
typedef struct media_info_s
|
||||
{
|
||||
uint64_t mid;
|
||||
char flag;
|
||||
#if K_PROJECT
|
||||
int hitservice;
|
||||
uint8_t pad[5];
|
||||
#else
|
||||
uint8_t hitservice;
|
||||
#endif
|
||||
uint64_t prog_len:48;
|
||||
uint32_t cap_IP;
|
||||
uint8_t protocol;
|
||||
uint8_t media_type;
|
||||
uint8_t data_flag;
|
||||
uint8_t opt_num;
|
||||
struct opt_unit_t* opt_unit;
|
||||
uint32_t multisrc_bizmanip;
|
||||
int8_t mdi_flag; //same with media_t
|
||||
int8_t td_query;
|
||||
}media_info_t;
|
||||
|
||||
/*same with AV_type.h*/
|
||||
struct opt_unit_t
|
||||
{
|
||||
uint32_t opt_len; //include this variable
|
||||
uint8_t opt_type;
|
||||
char* opt_value;
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
1. frag_rssb_cfg_dir: path of config file; frag_rssb_log_dir: path of log file
|
||||
2. return value: (0:succ -1:error)
|
||||
*/
|
||||
int frag_reassembly_init(const char* frag_rssb_cfg_dir, const char* frag_rssb_log_dir, int thread_num);
|
||||
void frag_reassembly_release();
|
||||
|
||||
/*
|
||||
1. return value: ( 0: succ -1:error )
|
||||
2.data will be copied.
|
||||
*/
|
||||
int add_media_info(msg_metainfo_t* minfo, char* opt, uint32_t src_ip, int thread_seq);
|
||||
//int add_media_info(uint64_t pid, uint16_t media_type, uint64_t media_len, uint8_t protocol, uint8_t hitservice, uint8_t data_flag, uint32_t cap_IP, char* opt, int opt_num, int thread_seq);
|
||||
int add_frag(uint64_t pid, uint64_t offset, char* data, uint32_t datalen, uint8_t protocol, uint32_t src_ip, int thread_seq);
|
||||
long get_media(void *data, const uint8_t *key, uint size, void *user_arg);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
454
src/frag_reassembly_in.h
Normal file
454
src/frag_reassembly_in.h
Normal file
@@ -0,0 +1,454 @@
|
||||
#ifndef _FRAG_REASSEMBLY_IN_H
|
||||
#define _FRAG_REASSEMBLY_IN_H
|
||||
|
||||
#include </usr/include/stdint.h>
|
||||
#include <sys/queue.h>
|
||||
|
||||
#include "stream_fuzzy_hash.h"
|
||||
#include "MESA_list_queue.h"
|
||||
#include "MESA_timer.h"
|
||||
|
||||
#include "interval_index.h"
|
||||
#include "hiredis.h"
|
||||
#include "hircluster.h"
|
||||
#include "soqav_dedup.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "sifter.h"
|
||||
#include "frag_reassembly.h"
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
#define LAY_ADDR_CNT 8
|
||||
#define PID_MAX_LEN 64
|
||||
#define SIFTER_MAX_NUM 8 //for sifter
|
||||
|
||||
#define TD_LEN 64
|
||||
#define REDIS_CMMD_MAXLEN 2048 /*redis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
|
||||
/*<2A><>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>ǰ<EFBFBD>˻<EFBFBD><CBBB><EFBFBD>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define QD_MAXNUM 8
|
||||
|
||||
/*log type*/
|
||||
typedef enum
|
||||
{
|
||||
MEDIA_NEW=0,
|
||||
MEDIA_RENEW,
|
||||
MEDIA_RENEW_EXPIRE,
|
||||
MEDIA_EXPIRE,
|
||||
MEDIA_MID_CHANGE,
|
||||
MEDIA_OFFSET_ZERO,
|
||||
MEDIA_FROM_CAPIP,
|
||||
MEDIA_FROM_CPZIP,
|
||||
MEDIA_FROM_QDIP,
|
||||
}MEDIA_LOG_TYPE;
|
||||
|
||||
/*response from frag_index*/
|
||||
#define CONVG_MAXNUM 16
|
||||
typedef struct frag_cnvg_s
|
||||
{
|
||||
text_t* opt[CONVG_MAXNUM];
|
||||
int opt_num;
|
||||
}frag_cnvg_t;
|
||||
|
||||
/*opt_unit_t is for trans*/
|
||||
typedef struct opt_in_s
|
||||
{
|
||||
uint32_t opt_len; //the len of opt_value in CPZ
|
||||
uint8_t opt_type;
|
||||
char* opt_value;
|
||||
}opt_in_t;
|
||||
|
||||
#define FRAG_FLAG_SEND_META 0x01 //<2F><>Ŀ<EFBFBD>ĵ<EFBFBD>һ<EFBFBD><D2BB><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA>Ϣ
|
||||
#define FRAG_FLAG_MULTISRC 0x02 //<2F><>Դ<EFBFBD><D4B4>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD>͵<EFBFBD><CDB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƿװ
|
||||
#define FRAG_FLAG_WINS 0x04 //<2F><>ϵͳ<CFB5><CDB3>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>wins
|
||||
typedef struct frag_in_s
|
||||
{
|
||||
uint64_t mid;
|
||||
uint64_t new_mid; //<2F>Ƕ<EFBFBD>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:mid=new_mid; <20><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD>:new_midΪ<64><CEAA>Դ<EFBFBD><D4B4><EFBFBD>۵<EFBFBD>ID
|
||||
uint64_t pid;
|
||||
uint64_t offset_in;
|
||||
uint16_t seq;
|
||||
uint64_t offset:48;
|
||||
char* data; //not copy
|
||||
uint32_t datalen;
|
||||
uint32_t multisrc_bizmanip; //<2F><>Դ<EFBFBD>ۺϵ<DBBA>IP
|
||||
// int64_t create_time;
|
||||
uint32_t src_ip;
|
||||
int thread_seq; //record thread_seq when converge is not complete
|
||||
int frag_flag; //<2F><><EFBFBD><EFBFBD><EFBFBD>ݰ<EFBFBD><DDB0>ı<EFBFBD>־
|
||||
// uint8_t media_type;
|
||||
// uint8_t proto;
|
||||
}frag_in_t;
|
||||
|
||||
/*netdisk and other frag*/
|
||||
#define FRAG_UNIT_INFO_NUM 6
|
||||
typedef enum
|
||||
{
|
||||
FRAG_UNIT_ID=0, //from frag_sifter
|
||||
FRAG_UNIT_ABOFFSET=1, //maybe from index info or frag_sifter
|
||||
FRAG_UNIT_REOFFSET=2, //maybe from index info or frag_sifter
|
||||
MEDIA_ID=3, //maybe from index info or frag_sifter
|
||||
MEDIA_SIZE=4, //maybe from index info or frag_sifter
|
||||
MEDIA_NAME=5, //maybe from index info or frag_sifter
|
||||
}FRAG_UNIT_INFO;
|
||||
|
||||
/*frag_stat <20><><EFBFBD>ε<EFBFBD>״̬*/
|
||||
#define STAT_INIT 0x00
|
||||
#define STAT_CNVG_QUERY 0x01 //query but not result
|
||||
#define STAT_CNVG_OK 0x02
|
||||
#define STAT_INDEX_QUERY 0x03
|
||||
#define STAT_OK 0x04
|
||||
|
||||
/* frag_unit_t flag*/
|
||||
#define FRAG_UNIT_ADDMEDIA 0x01
|
||||
#define FRAG_UNIT_MONITOR 0x02
|
||||
#define FRAG_UNIT_OFFSET 0x04
|
||||
#define FRAG_UNIT_RECORD 0x08
|
||||
#define FRAG_UNIT_MULTI 0x10
|
||||
|
||||
#define WEBMAIL_CONT_INFO_NUM 10
|
||||
|
||||
/*SIPѡ<50><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define SIP_OPT_NUM 32
|
||||
/*SIP<49><50>ѯredis<69><73><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define SIP_REDIS_CMMD_NUM 34
|
||||
/*SIP<49><50>ѡ<EFBFBD><D1A1>*/
|
||||
typedef struct sip_opt_s
|
||||
{
|
||||
char opt_name[32];
|
||||
int opt_type; /*<2A><>ȫ<EFBFBD><C8AB><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>JC<4A><43>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
}sip_opt_t;
|
||||
|
||||
typedef struct qd_info_s
|
||||
{
|
||||
uint64_t mid;
|
||||
uint32_t cap_ip;
|
||||
}qd_info_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
MEDIA_OPT_URL=0,
|
||||
MEDIA_OPT_PID,
|
||||
MEDIA_OPT_ADDR,
|
||||
MEDIA_OPT_SINGLE_KEY,
|
||||
MEDIA_OPT_UA,
|
||||
MEDIA_OPT_REFERER,
|
||||
MEDIA_OPT_ETAG,
|
||||
MEDIA_OPT_LAST_MODIFY,
|
||||
MEDIA_OPT_SERVER,
|
||||
MEDIA_OPT_TD_META,
|
||||
MEDIA_OPT_OFFSET,
|
||||
MEDIA_OPT_C2S_CONT_TYPE,
|
||||
MEDIA_OPT_S2C_CONT_TYPE,
|
||||
MEDIA_OPT_CAP_IP,
|
||||
MEDIA_OPT_PROTOCOL,
|
||||
|
||||
MEDIA_OPT_INDEX_URL,
|
||||
MEDIA_OPT_INDEX_REFERER,
|
||||
MEDIA_OPT_INDEX_UA,
|
||||
MEDIA_OPT_FD_SUBSTR,
|
||||
|
||||
MEDIA_OPT_S_IP,
|
||||
MEDIA_OPT_S_PORT,
|
||||
MEDIA_OPT_C_IP,
|
||||
MEDIA_OPT_C_PORT,
|
||||
|
||||
MEDIA_OPT_MAXNUN,
|
||||
}MEDIA_OPT;
|
||||
|
||||
typedef struct frag_unit_s
|
||||
{
|
||||
MESA_lqueue_head frg_cnvg_lq;
|
||||
MESA_lqueue_head frg_index_lq;
|
||||
text_t** frg_info; //useful info after sifter
|
||||
|
||||
text_t* text; //from media_info opt to sifter
|
||||
int text_num;
|
||||
int thread_seq;
|
||||
|
||||
uint64_t pid; //from media_info
|
||||
uint64_t media_len; //from media_info
|
||||
|
||||
uint32_t capIP; //<2F><>ƿװ<C6BF><D7B0><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵ<EFBFBD>ǰ<EFBFBD>˻<EFBFBD><CBBB><EFBFBD>IP
|
||||
uint32_t src_ip;
|
||||
|
||||
#if K_PROJECT
|
||||
int hitservice; //from media_info
|
||||
#else
|
||||
uint8_t hitservice; //from media_info
|
||||
uint8_t pad[3];
|
||||
#endif
|
||||
uint8_t data_flag; //from media_info
|
||||
int8_t flag; //from media_info
|
||||
uint8_t media_type; //from media_info
|
||||
uint8_t proto; //from data
|
||||
|
||||
qd_info_t qd_info_from_cpz[QD_MAXNUM]; //ǰ<>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
opt_in_t* opt[MEDIA_OPT_MAXNUN];
|
||||
uint64_t content_length; //from media_info opt
|
||||
|
||||
uint64_t mid;
|
||||
uint64_t re_offset;
|
||||
uint64_t ab_offset;
|
||||
uint64_t ab_offset_for_in;
|
||||
uint64_t ab_offset_for_mime; //mime extract data, update offset
|
||||
|
||||
int service_id;
|
||||
uint32_t mediainfo_cnt;
|
||||
|
||||
uint8_t repeat_not_proc; //such hls, osmf , same reoffset
|
||||
uint8_t frag_state;
|
||||
uint8_t multi_flag;
|
||||
uint8_t qd_info_from_cpz_idx_last;
|
||||
|
||||
opt_in_t* sip_diadata_ID; //<2F>洢META_OPT_SIP_DIADATA_ID
|
||||
opt_in_t* sip_data_dir; //<2F>洢META_OPT_SIP_DATA_DIR
|
||||
opt_in_t* sip_rate_info; //<2F>洢META_OPT_SIP_DATA_DIR
|
||||
opt_in_t* sip_opt[SIP_OPT_NUM];
|
||||
}frag_unit_t;
|
||||
|
||||
#define INFO_MEDIA_NUM 1
|
||||
#define PID_MAXNUM 256
|
||||
#define KEEP_REOFFSET_MAXNUM 2048
|
||||
|
||||
/*<2A><>Դ<EFBFBD><D4B4>ѯ<EFBFBD><D1AF><EFBFBD>ؽ<EFBFBD><D8BD><EFBFBD>ǰ<EFBFBD>Ļ<EFBFBD><C4BB><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
struct queue_item
|
||||
{
|
||||
void* node;
|
||||
int thread_seq;
|
||||
TAILQ_ENTRY(queue_item) entries;
|
||||
};
|
||||
|
||||
TAILQ_HEAD(qw_queue, queue_item);
|
||||
|
||||
#define AUDIO_WINS_DISABLE 0x01
|
||||
#define VEDIO_WINS_DISABLE 0x02
|
||||
|
||||
#define SIP_SURVEY_TYPE_FD 0x01
|
||||
#define SIP_SURVEY_TYPE_JC 0x02
|
||||
#define SIP_SURVEY_TYPE_FD_JC 0x03
|
||||
|
||||
#define MEDIA_SERVICE_TYPE_AV 0x00
|
||||
#define MEDIA_SERVICE_TYPE_FRAG 0x01
|
||||
#define MEDIA_SERVICE_TYPE_SIP 0x02
|
||||
#define MEDIA_SERVICE_TYPE_APP 0x03
|
||||
#define MEDIA_SERVICE_TYPE_PIC 0x04
|
||||
|
||||
/*ÿ<><C3BF><EFBFBD><EFBFBD>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>߳<EFBFBD>*/
|
||||
#define OPT_MAXNUN 256
|
||||
typedef struct media_s
|
||||
{
|
||||
IVI_t* ivi; //complete frag removal
|
||||
IVI_t* save_ivi;
|
||||
sfh_instance_t* fuzzy;
|
||||
uint64_t fuzzy_acc_len; //SFH_feed acc len
|
||||
|
||||
MESA_lqueue_head app_frg_lq; //app<70><70><EFBFBD>ݻ<EFBFBD><DDBB><EFBFBD>
|
||||
|
||||
text_t* media_info[INFO_MEDIA_NUM]; //MEDIA_INFO_TYPE
|
||||
|
||||
uint64_t mid_after_multisrc; //<2F><>Դ֮<D4B4><D6AE>mid<69><64><EFBFBD>ܱ<EFBFBD><DCB1><EFBFBD>
|
||||
uint64_t mid; //ǰ<>˷<EFBFBD><CBB7>͵Ľ<CDB5>ĿID
|
||||
uint64_t* pid; //PID_MAXNUM, need when media_json
|
||||
int64_t create_time;
|
||||
int64_t renew_time;
|
||||
int64_t lastpkt_time;
|
||||
int64_t dedup_query_time;
|
||||
|
||||
char td[TD_LEN];
|
||||
char* td_data;
|
||||
uint32_t td_datalen;
|
||||
uint32_t addrlist_len; //for app
|
||||
char* addrlist;
|
||||
|
||||
opt_in_t* opt[MEDIA_OPT_MAXNUN][OPT_MAXNUN];
|
||||
int opt_index;
|
||||
int url_opt_index; //<2F><><EFBFBD><EFBFBD>url<72><6C><EFBFBD><EFBFBD><EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>λ<EFBFBD><CEBB>
|
||||
|
||||
struct qw_queue query_wait_lq; //<2F>ȴ<EFBFBD><C8B4><EFBFBD><EFBFBD>ض<EFBFBD>Դ<EFBFBD><D4B4>ѯ<EFBFBD>Ľ<EFBFBD><C4BD><EFBFBD>
|
||||
MESA_timer_index_t* timer_idx;
|
||||
MESA_timer_index_t* index_query_timer_idx;
|
||||
|
||||
uint64_t byte_in;
|
||||
uint64_t byte_proc;
|
||||
uint32_t pkt_in;
|
||||
uint32_t pkt_proc;
|
||||
|
||||
uint64_t maxoffset;
|
||||
uint64_t media_len; //from more frag_unit
|
||||
|
||||
#if K_PROJECT
|
||||
int hit_service; //monitor flag
|
||||
#else
|
||||
uint8_t hit_service; //monitor flag
|
||||
uint8_t pad[3]; //monitor flag
|
||||
#endif
|
||||
uint8_t proto; //from data, from frag_unit
|
||||
uint8_t media_type; //from media_info, from frag_unit
|
||||
uint8_t data_flag; //monitor flag
|
||||
int8_t meta_flag;
|
||||
|
||||
int8_t flag; // PROG_FLAG_EXCP PROG_FLAG_DUMP
|
||||
uint8_t qdinfo_idx_last;
|
||||
uint8_t pid_idx_last;
|
||||
uint8_t repeat_reoffset_idx_last;
|
||||
|
||||
uint64_t acc_offset; //HLS acc offset
|
||||
int64_t repeat_reoffset[KEEP_REOFFSET_MAXNUM]; //HLS reoffset that have proc,<2C><><EFBFBD>ౣ<EFBFBD><E0B1A3>KEEP_REOFFSET_MAXNUM<55><4D>Ƭ<EFBFBD><C6AC><EFBFBD>ظ<EFBFBD><D8B8>Ľ<EFBFBD><C4BD><EFBFBD>ȥ<EFBFBD><C8A5>
|
||||
|
||||
qd_info_t qd_info[QD_MAXNUM]; //<2F><><EFBFBD><EFBFBD>ǰ<EFBFBD>˻<EFBFBD><CBBB><EFBFBD><EFBFBD><EFBFBD>mid<69><64>capIP<49><50>Ӧ<EFBFBD><D3A6>ϵ
|
||||
qd_info_t qd_info_from_cpz[QD_MAXNUM]; //<2F><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴװ<C6B4><D7B0>ǰ<EFBFBD><C7B0><EFBFBD><EFBFBD>Ϣ
|
||||
|
||||
uint32_t frag_unit_cnt; //for pid
|
||||
uint32_t configID;
|
||||
uint32_t multisrc_bizmanip;
|
||||
int thread_seq; //the first frag_unit thread_seq
|
||||
|
||||
char wins_dest_disabled_bit; //stop send to subsystem,equal to MAX_EXCP_PORT
|
||||
uint8_t media_service_type; //HLS or OSMF... SIP AV
|
||||
int8_t td_query; //0:init
|
||||
int8_t cache_flag;
|
||||
uint8_t td_complete; //0:init
|
||||
uint8_t qdinfo_from_cpz_idx_last;
|
||||
|
||||
uint8_t sip_survey_type; //SIP_SURVEY_TYPE_FD SIP_SURVEY_TYPE_JC SIP_SURVEY_TYPE_FD_JC
|
||||
//uint8_t sip_sendlog_flag;
|
||||
opt_in_t* sip_opt[SIP_OPT_NUM]; //opttype is fulllog type
|
||||
opt_in_t* sip_rate_info;
|
||||
opt_in_t* sip_diadata_ID;
|
||||
uint64_t re_offset;
|
||||
char* fd_buf;
|
||||
char* jc_buf;
|
||||
uint32_t fd_buflen;
|
||||
uint32_t jc_buflen;
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
int64_t survey_time;
|
||||
uint32_t cfg_id; //config ID
|
||||
uint8_t service;
|
||||
char level; //the level of check result
|
||||
char log_url[512];
|
||||
char* monitor_path;
|
||||
//char frag_bitmap[KEEP_REOFFSET_MAXNUM/8+1]; //bitmap for frag removal
|
||||
}media_t;
|
||||
|
||||
/*recv : add_media_info for cnvg_hash*/
|
||||
typedef struct rssb_media_info_s
|
||||
{
|
||||
uint64_t pid;
|
||||
uint64_t media_len;
|
||||
char* opt;
|
||||
|
||||
int opt_num;
|
||||
int thread_seq;
|
||||
|
||||
uint32_t cap_IP;
|
||||
uint32_t src_ip;
|
||||
|
||||
#if K_PROJECT
|
||||
int hitservice;
|
||||
#else
|
||||
uint8_t hitservice;
|
||||
uint8_t pad[3];
|
||||
#endif
|
||||
uint8_t media_type;
|
||||
uint8_t protocol;
|
||||
uint8_t data_flag;
|
||||
int8_t flag;
|
||||
}rssb_media_info_t;
|
||||
|
||||
typedef struct frag_reassembly_s
|
||||
{
|
||||
void* sifter;
|
||||
void* logger;
|
||||
void* media_logger;
|
||||
|
||||
MESA_htable_handle converge_hash; /*frag <20><>Ƭ<EFBFBD>ỰHASH*/
|
||||
|
||||
MESA_lqueue_head* wait_lq;
|
||||
|
||||
uint16_t lq_num;
|
||||
uint16_t logger_level;
|
||||
|
||||
uint32_t cnvg_hash_thread_safe;
|
||||
uint32_t cnvg_hash_size;
|
||||
uint32_t cnvg_hash_max_elem_num;
|
||||
uint32_t cnvg_hash_expire_time;
|
||||
|
||||
/*stat**/
|
||||
uint32_t sysinfo_interval;
|
||||
uint32_t stat_interval;
|
||||
|
||||
void* sysinfo_handle;
|
||||
void* stat_handle;
|
||||
|
||||
/*sysinfo*/
|
||||
uint64_t stat_info[RSSB_LOG_TYPE_MAXNUM];
|
||||
uint64_t data_info[RSSB_DATALOG_TYPE_MAXNUM][LOG_STAT_MAXNUM];
|
||||
uint64_t sysinfo_stat[RSSB_SYSLOG_TYPE_MAXNUM][SYSLOG_STAT_MAXNUM];
|
||||
|
||||
int log_field_id[RSSB_LOG_TYPE_MAXNUM];
|
||||
int datalog_column_id[LOG_STAT_MAXNUM];
|
||||
int datalog_line_id[RSSB_DATALOG_TYPE_MAXNUM];
|
||||
int syslog_column_id[SYSLOG_STAT_MAXNUM];
|
||||
int syslog_line_id[RSSB_SYSLOG_TYPE_MAXNUM];
|
||||
|
||||
/*redis*/
|
||||
struct timeval redis_tv;
|
||||
char redis_addr[20480];
|
||||
redisClusterContext* redis_cluster_ctx[MAX_THREAD_NUM];
|
||||
redisContext* redis_ctx[MAX_THREAD_NUM];
|
||||
int redis_cluster_switch;
|
||||
char redis_ip[32];
|
||||
int redis_port;
|
||||
|
||||
uint32_t wait_lq_num;
|
||||
}frag_reassembly_t;
|
||||
|
||||
/*printaddr <20><>ʽ, used in app*/
|
||||
typedef struct __touple4_type
|
||||
{
|
||||
char sip[64];
|
||||
char dip[64];
|
||||
unsigned short sport;
|
||||
unsigned short dport;
|
||||
int addr_type;
|
||||
}touple4_type_t;
|
||||
|
||||
#define FRAG_CONTAIN_MAXNUM 8 //ȥ<><C8A5>:<3A><>ȫ<EFBFBD><C8AB><EFBFBD>ǵ<EFBFBD>frag<61><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȥ<EFBFBD><C8A5>
|
||||
/*for create_media because IVI */
|
||||
typedef struct frag_ivi_info_s
|
||||
{
|
||||
frag_unit_t* frg_unit;
|
||||
frag_in_t* frg;
|
||||
//query_detail_t* query_detail;
|
||||
frag_in_t* frg_array[FRAG_CONTAIN_MAXNUM];//frag<61><67><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊȥ<CEAA>ر<EFBFBD><D8B1><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA><EFBFBD><EFBFBD>frag
|
||||
//char td_result[TD_LEN];
|
||||
uint64_t mid;
|
||||
int frg_array_cnt;
|
||||
uint8_t td_query; //TD_QUERY_TYPE_MULTISRC TD_QUERY_TYPE_DEDUP
|
||||
uint8_t thread_seq; //for av dedup
|
||||
}frag_ivi_info_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
int frag_add_wait_lq(frag_ivi_info_t* frag_ivi_info, uint32_t frag_stat, int thread_seq);
|
||||
void init_frag_unit(frag_unit_t* frg_unit, uchar protocol);
|
||||
int media_create(frag_unit_t* frg_unit);
|
||||
int frag_service(frag_ivi_info_t* frag_ivi_info, uint32_t src_ip, int thread_seq);
|
||||
void free_opt(opt_in_t** data);
|
||||
void free_text(text_t** pp, int n_p);
|
||||
int free_frag_in(void *data, long data_len, void *arg);
|
||||
uint64_t make_mid(char * key, unsigned int size, unsigned char type);
|
||||
void free_frag_unit(void* data);
|
||||
void free_media(void* data);
|
||||
int expire_media_hash_node(void *data, int eliminate_type);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
255
src/frag_recv.c
Normal file
255
src/frag_recv.c
Normal file
@@ -0,0 +1,255 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "AV_interface.h"
|
||||
#include "frag_reassembly.h"
|
||||
#include "frag_recv.h"
|
||||
#include "my_socket.h"
|
||||
#include "bizman.h"
|
||||
#include "log.h"
|
||||
#include "frag_voip.h"
|
||||
#include "wiredLB.h"
|
||||
#include "service.h"
|
||||
|
||||
extern frag_rssb_parameter_t g_frag_run;
|
||||
extern frag_rssb_configure_t g_frag_cfg;
|
||||
extern frag_rssb_status_t g_frag_stat;
|
||||
|
||||
void heart_beat(unsigned int thread_id,char *buf, uint32_t size, uint32_t src_ip)
|
||||
{
|
||||
msg_header_t *mh = (msg_header_t*)buf;
|
||||
mh->msg_type = MSG_LIVE_RESPONS;
|
||||
bizman_send(g_frag_run.answer_sapp_bizman, thread_id, src_ip, g_frag_cfg.msg_port, (const char*)buf, size, 1, BIZMAN_SMOOTH_DEST|BIZMAN_PUSH_SEND);
|
||||
}
|
||||
|
||||
void proc_data_msg(uint32_t thread_id, uint32_t src_ip, char* packet, int size)
|
||||
{
|
||||
msg_header_t* mhead = (msg_header_t*)packet;
|
||||
msg_metainfo_t* minfo = (msg_metainfo_t*)(packet + MSG_HEADER_LEN);
|
||||
msg_data_t* mdata = (msg_data_t*)(packet + MSG_HEADER_LEN);
|
||||
char* data = (char*)mdata + MSG_DATA_HEAD_LEN;
|
||||
char* opt_ptr = NULL;
|
||||
|
||||
/* Ignore invalid packet */
|
||||
if(PROTO_MAGICNUM != mhead->magic_num || PROTO_VERSION != mhead->version|| size <= (int)MSG_HEADER_LEN || size>1600)
|
||||
{
|
||||
atomic_inc(&g_frag_stat.stat_info[INVALID_RECV][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[INVALID_RECV][TOTAL_BYTES],size);
|
||||
return;
|
||||
}
|
||||
/*prco msg*/
|
||||
switch(mhead->msg_type)
|
||||
{
|
||||
case MSG_DATA_META:
|
||||
/*write log*/
|
||||
if(RLOG_LV_INFO>=g_frag_run.frag_loglevel)
|
||||
{
|
||||
int buf_len = 32;
|
||||
char pbuf[32] = {0};
|
||||
char qbuf[32] = {0};
|
||||
inet_ntop(AF_INET, &src_ip, pbuf, buf_len);
|
||||
inet_ntop(AF_INET, &minfo->cap_IP, qbuf, buf_len);
|
||||
MESA_handle_runtime_log(g_frag_run.frag_logger, RLOG_LV_INFO, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} %s:%hd RECV META [PID:%llu, media_len:%llu, media_type:0x%02x, cap_IP:%s]",
|
||||
__FILE__,__LINE__, pbuf, g_frag_cfg.bizman_port, *(uint64_t*)minfo->prog_id, minfo->prog_len, minfo->media_type, qbuf);
|
||||
}
|
||||
/*avoid uncomplete chunk*/
|
||||
if(mhead->cont_len-MSG_HEADER_LEN>2000) return;
|
||||
/*for frag_reassembly*/
|
||||
opt_ptr = packet + MSG_HEADER_LEN + sizeof(msg_metainfo_t);
|
||||
if(g_frag_cfg.all_hit_monitor_switch==ALL_HIT_MONITOR_SWITCH)
|
||||
{
|
||||
#if K_PROJECT
|
||||
minfo->hitservice = 0x181;
|
||||
#else
|
||||
minfo->hitservice = 0x81;
|
||||
#endif
|
||||
minfo->data_flag = 4;
|
||||
}
|
||||
add_media_info(minfo, opt_ptr, src_ip, thread_id);
|
||||
atomic_inc(&g_frag_stat.stat_info[META_RECV][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[META_RECV][TOTAL_BYTES],size);
|
||||
break;
|
||||
|
||||
case MSG_DATA_BODY:
|
||||
case MSG_DATA_TAIL:
|
||||
/*write log*/
|
||||
if(RLOG_LV_DEBUG>=g_frag_run.frag_loglevel)
|
||||
{
|
||||
int buf_len = 32;
|
||||
char pbuf[32] = {0};
|
||||
inet_ntop(AF_INET, &src_ip, pbuf, buf_len);
|
||||
/*<2A><>ӡVOIP<49><50><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD>SEQ*/
|
||||
if(g_frag_cfg.cpz_type==CPZ_VOIP)
|
||||
{
|
||||
int rtp_seq = ntohl(*(int*)(data+VOIP_DATA_SEQ_OFFSET));
|
||||
MESA_handle_runtime_log(g_frag_run.frag_logger, RLOG_LV_DEBUG, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} %s:%hd RECV DATA [PID:%llu, offset:%llu, rtp_seq:%d, datalen:%u]",
|
||||
__FILE__,__LINE__, pbuf, g_frag_cfg.bizman_port, *(uint64_t*)mdata->prog_id, mdata->offset, rtp_seq, mhead->cont_len-MSG_DATA_HEAD_LEN);
|
||||
}
|
||||
else
|
||||
{
|
||||
MESA_handle_runtime_log(g_frag_run.frag_logger, RLOG_LV_DEBUG, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} %s:%hd RECV DATA [PID:%llu, offset:%llu, datalen:%u]",
|
||||
__FILE__,__LINE__, pbuf, g_frag_cfg.bizman_port, *(uint64_t*)mdata->prog_id, mdata->offset, mhead->cont_len-MSG_DATA_HEAD_LEN);
|
||||
}
|
||||
}
|
||||
/*??? protocol lost debug for uncomplete chunk*/
|
||||
if(mhead->cont_len-MSG_DATA_HEAD_LEN>2000) return;
|
||||
if(mdata->offset>1000000000000) return;
|
||||
/*for frag_reassembly*/
|
||||
add_frag(*(uint64_t*)mdata->prog_id,mdata->offset,data,mhead->cont_len-MSG_DATA_HEAD_LEN,0,src_ip,thread_id);
|
||||
atomic_inc(&g_frag_stat.stat_info[DATA_RECV][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[DATA_RECV][TOTAL_BYTES],size);
|
||||
break;
|
||||
|
||||
case MSG_LIVE_CHECK:
|
||||
heart_beat(thread_id, packet, size, src_ip);
|
||||
break;
|
||||
|
||||
default:
|
||||
atomic_inc(&g_frag_stat.stat_info[OTHER_RECV][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[OTHER_RECV][TOTAL_BYTES],size);
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
void free_recv_data(bizman_recv_data_t* recv_data)
|
||||
{
|
||||
if(NULL!=recv_data)
|
||||
{
|
||||
if(NULL!=recv_data->data)
|
||||
{
|
||||
free(recv_data->data);
|
||||
recv_data->data = NULL;
|
||||
}
|
||||
free(recv_data);
|
||||
}
|
||||
}
|
||||
|
||||
void* bizman_recv_data_from_queue(void *param)
|
||||
{
|
||||
long tid = (long)param;
|
||||
bizman_recv_data_t* recv_data = NULL;
|
||||
long recv_data_size = sizeof(recv_data);
|
||||
|
||||
while(1)
|
||||
{
|
||||
recv_data = NULL;
|
||||
int rec = MESA_lqueue_get_head(g_frag_run.recv_bizman_lq[tid], &recv_data, &recv_data_size);
|
||||
if (rec<0)
|
||||
{
|
||||
usleep(10);
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
if(NULL!=recv_data && NULL!=recv_data->data)
|
||||
{
|
||||
/*get from queue stat */
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[BIZMAN_RECV_QUEUE][QUEUE_OUT]);
|
||||
proc_data_msg(tid, recv_data->src_ip, recv_data->data, recv_data->size);
|
||||
}
|
||||
free_recv_data(recv_data);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* bizman_recv_data_to_queue(void *param)
|
||||
{
|
||||
char buf[BIZMAN_RECV_BUFFSIZE] = {0};
|
||||
int size = 0;
|
||||
uint32_t src_ip = 0;
|
||||
uint16_t src_port = 0;
|
||||
uint32_t is_complete = 0, stream_id = 0;
|
||||
long tid = (long)param;
|
||||
int lq_rec = 0;
|
||||
bizman_recv_data_t* recv_data = NULL;
|
||||
|
||||
while(1)
|
||||
{
|
||||
size = bizman_recv(g_frag_run.recv_bizman[tid],(char*)buf,sizeof(buf),&src_ip,&src_port,&stream_id,&is_complete);
|
||||
if(is_complete&BIZMAN_READ_CHUNK && size>0)
|
||||
{
|
||||
if(g_frag_stat.sysinfo_stat[BIZMAN_RECV_QUEUE][QUEUE_CURRENT]<g_frag_cfg.bizman_queue_maxnum)
|
||||
{
|
||||
recv_data = (bizman_recv_data_t*)calloc(1, sizeof(bizman_recv_data_t));
|
||||
recv_data->size = size;
|
||||
recv_data->src_ip = src_ip;
|
||||
recv_data->data = (char*)malloc(size);
|
||||
memcpy(recv_data->data, buf, size);
|
||||
/*data[15] = the last byte of PID*/
|
||||
tid = recv_data->data[15]%g_frag_cfg.thread_num;
|
||||
lq_rec = MESA_lqueue_join_tail(g_frag_run.recv_bizman_lq[tid], &recv_data, sizeof(recv_data));
|
||||
if(lq_rec==MESA_QUEUE_RET_OK)
|
||||
{
|
||||
/*add to queue stat */
|
||||
atomic_inc(&g_frag_stat.sysinfo_stat[BIZMAN_RECV_QUEUE][QUEUE_IN]);
|
||||
}
|
||||
else
|
||||
{
|
||||
free_recv_data(recv_data);
|
||||
atomic_inc(&g_frag_stat.stat_info[RECV_DROP][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[RECV_DROP][TOTAL_BYTES], size);
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
atomic_inc(&g_frag_stat.stat_info[RECV_DROP][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[RECV_DROP][TOTAL_BYTES], size);
|
||||
}
|
||||
atomic_inc(&g_frag_stat.stat_info[RECV][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[RECV][TOTAL_BYTES], size);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* bizman_recv_data(void *param)
|
||||
{
|
||||
long tid = (long)param;
|
||||
char buf[BIZMAN_RECV_BUFFSIZE] = {0};
|
||||
int size = 0;
|
||||
uint32_t src_ip = 0;
|
||||
uint16_t src_port = 0;
|
||||
uint32_t is_complete = 0, stream_id = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
size = bizman_recv(g_frag_run.recv_bizman[tid],(char*)buf,sizeof(buf),&src_ip,&src_port,&stream_id,&is_complete);
|
||||
if(is_complete&BIZMAN_READ_CHUNK && size>0)
|
||||
{
|
||||
proc_data_msg(tid, src_ip, buf, size);
|
||||
atomic_inc(&g_frag_stat.stat_info[RECV][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[RECV][TOTAL_BYTES], size);
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
void* wlb_report(void *param)
|
||||
{
|
||||
uint64_t start_bytes = g_frag_stat.stat_info[RECV][TOTAL_BYTES];
|
||||
uint64_t start_pkts = g_frag_stat.stat_info[RECV][TOTAL_PKTS];
|
||||
while(1)
|
||||
{
|
||||
wiredLB_report(g_frag_cfg.rssb_wlb_handle, g_frag_stat.stat_info[RECV][TOTAL_BYTES] - start_bytes,g_frag_stat.stat_info[RECV][TOTAL_PKTS]- start_pkts, "I am fine!");
|
||||
start_bytes = g_frag_stat.stat_info[RECV][TOTAL_BYTES];
|
||||
start_pkts = g_frag_stat.stat_info[RECV][TOTAL_PKTS];
|
||||
sleep(g_frag_cfg.wlb_report_interval);
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
|
||||
28
src/frag_recv.h
Normal file
28
src/frag_recv.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _FRAG_RECV_H
|
||||
#define _FRAG_RECV_H
|
||||
|
||||
/*from preproc*/
|
||||
#define BIZMAN_RECV_BUFFSIZE (1024+512)
|
||||
|
||||
typedef struct bizman_recv_data_s
|
||||
{
|
||||
int size;
|
||||
uint32_t src_ip;
|
||||
char* data;
|
||||
}bizman_recv_data_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void* bizman_recv_data_from_queue(void *param);
|
||||
void* bizman_recv_data_to_queue(void *param);
|
||||
void* bizman_recv_data(void *param);
|
||||
void* wlb_report(void *param);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
181
src/frag_redis.c
Normal file
181
src/frag_redis.c
Normal file
@@ -0,0 +1,181 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "hiredis.h"
|
||||
#include "hircluster.h"
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
|
||||
#include "frag_redis.h"
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
extern frag_reassembly_t frag_rssb; //use media hash
|
||||
|
||||
/*
|
||||
<EFBFBD><EFBFBD><EFBFBD>ܣ<EFBFBD> Ϊ<><CEAA>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ṩ<EFBFBD><E1B9A9>ʵ<EFBFBD><CAB5><EFBFBD><EFBFBD>Ϣ,<2C><><EFBFBD><EFBFBD>redis<69><73>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ӻ<EFBFBD><D3BA><EFBFBD><EFBFBD><EFBFBD>
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> cc: <09><>Ⱥ<EFBFBD><C8BA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
flag<61><67> <09>Ӽ<EFBFBD>Ⱥ<EFBFBD><C8BA>ΨһIP<49>α<EFBFBD>ʶ<EFBFBD><CAB6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>涨<EFBFBD><E6B6A8><EFBFBD><EFBFBD><EFBFBD>ĸ<EFBFBD><C4B8><EFBFBD>ѡһ
|
||||
uni_ipfrag: ΨһIP<49>εľ<CEB5><C4BE><EFBFBD>ֵ
|
||||
<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD>0 <20>ɹ<EFBFBD>
|
||||
-1 ʧ<><CAA7>
|
||||
*/
|
||||
extern "C" int redisClusterEnableSalve(redisClusterContext *cc, int flag, const char *uni_ipfrag);
|
||||
|
||||
/**
|
||||
*
|
||||
*return :
|
||||
* -1:connect error;
|
||||
* -2:reply error(need to freeReplyObject) ;
|
||||
* 0:succ(need to freeReplyObject)
|
||||
*/
|
||||
int redis_nocluster_excute_command(int thread_seq, void* logger, redisReply** reply, char* cmmd, int argc, const char **argv, const size_t *argvlen)
|
||||
{
|
||||
int rec = 0;
|
||||
redisReply* cmmd_reply = *reply;
|
||||
|
||||
if(NULL==frag_rssb.redis_ctx[thread_seq] || frag_rssb.redis_ctx[thread_seq]->err)
|
||||
{
|
||||
if(NULL!=frag_rssb.redis_ctx[thread_seq])
|
||||
{
|
||||
redisFree(frag_rssb.redis_ctx[thread_seq]);
|
||||
frag_rssb.redis_ctx[thread_seq] = NULL;
|
||||
}
|
||||
frag_rssb.redis_ctx[thread_seq] = redisConnectWithTimeout(frag_rssb.redis_ip, frag_rssb.redis_port, frag_rssb.redis_tv);
|
||||
}
|
||||
if(NULL==frag_rssb.redis_ctx[thread_seq]) return -1;
|
||||
|
||||
if(frag_rssb.redis_ctx[thread_seq]->err)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis exec command '%s' fail, connect error:%s].",
|
||||
__FILE__,__LINE__, cmmd, frag_rssb.redis_ctx[thread_seq]->errstr);
|
||||
redisFree(frag_rssb.redis_ctx[thread_seq]);
|
||||
frag_rssb.redis_ctx[thread_seq] = NULL;
|
||||
rec = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cmmd_reply = (redisReply *)redisCommand(frag_rssb.redis_ctx[thread_seq], cmmd);
|
||||
cmmd_reply = (redisReply *)redisCommandArgv(frag_rssb.redis_ctx[thread_seq], argc, argv, argvlen);
|
||||
/*replyΪNULL<4C><4C><EFBFBD><EFBFBD>ʾ<EFBFBD>ͻ<EFBFBD><CDBB>˺ͷ<CBBA><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
if(NULL==cmmd_reply)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis exec command '%s' fail, connect error:%s].",
|
||||
__FILE__,__LINE__, cmmd, frag_rssb.redis_ctx[thread_seq]->errstr);
|
||||
redisFree(frag_rssb.redis_ctx[thread_seq]);
|
||||
frag_rssb.redis_ctx[thread_seq] = NULL;
|
||||
freeReplyObject(cmmd_reply);
|
||||
rec = -2;
|
||||
}
|
||||
else if(cmmd_reply->type==REDIS_REPLY_ERROR)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis exec command '%s' fail, reply error:%s].",
|
||||
__FILE__,__LINE__, cmmd, cmmd_reply->str);
|
||||
freeReplyObject(cmmd_reply);
|
||||
rec = -2;
|
||||
}
|
||||
}
|
||||
|
||||
if(0==rec)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_INFO, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis exec command '%s' succ].",
|
||||
__FILE__,__LINE__, cmmd);
|
||||
}
|
||||
*reply = cmmd_reply;
|
||||
return rec;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
*return :
|
||||
* -1:connect error;
|
||||
* -2:reply error(need to freeReplyObject) ;
|
||||
* 0:succ(need to freeReplyObject)
|
||||
*/
|
||||
int redis_cluster_excute_command(int thread_seq, void* logger, redisReply** reply, char* cmmd, int argc, const char **argv, const size_t *argvlen)
|
||||
{
|
||||
int rec = 0;
|
||||
redisReply* cmmd_reply = *reply;
|
||||
|
||||
if(NULL==frag_rssb.redis_cluster_ctx[thread_seq] || frag_rssb.redis_cluster_ctx[thread_seq]->err)
|
||||
{
|
||||
if(NULL!=frag_rssb.redis_cluster_ctx[thread_seq])
|
||||
{
|
||||
redisClusterFree(frag_rssb.redis_cluster_ctx[thread_seq]);
|
||||
frag_rssb.redis_cluster_ctx[thread_seq] = NULL;
|
||||
}
|
||||
frag_rssb.redis_cluster_ctx[thread_seq] = redisClusterConnectWithTimeout(frag_rssb.redis_addr, frag_rssb.redis_tv, HIRCLUSTER_FLAG_NULL);
|
||||
//redisClusterEnableSalve(frag_rssb.redis_cluster_ctx[thread_seq], frag_rssb.redis_cluster_netflag, frag_rssb.redis_cluster_net);
|
||||
}
|
||||
if(NULL==frag_rssb.redis_cluster_ctx[thread_seq]) return -1;
|
||||
|
||||
if(frag_rssb.redis_cluster_ctx[thread_seq]->err)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis cluster exec command '%s' fail, connect error:%s].",
|
||||
__FILE__,__LINE__, cmmd, frag_rssb.redis_cluster_ctx[thread_seq]->errstr);
|
||||
redisClusterFree(frag_rssb.redis_cluster_ctx[thread_seq]);
|
||||
frag_rssb.redis_cluster_ctx[thread_seq] = NULL;
|
||||
rec = -1;
|
||||
}
|
||||
else
|
||||
{
|
||||
//cmmd_reply = (redisReply *)redisClusterCommand(frag_rssb.redis_cluster_ctx[thread_seq], cmmd);
|
||||
cmmd_reply = (redisReply *)redisClusterCommandArgv(frag_rssb.redis_cluster_ctx[thread_seq], argc, argv, argvlen);
|
||||
/*replyΪNULL<4C><4C><EFBFBD><EFBFBD>ʾ<EFBFBD>ͻ<EFBFBD><CDBB>˺ͷ<CBBA><CDB7><EFBFBD><EFBFBD><EFBFBD><EFBFBD>˳<EFBFBD><CBB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ش<EFBFBD><D8B4><EFBFBD><F3A3ACB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
if(NULL==cmmd_reply)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis cluster exec command '%s' fail, connect error:%s].",
|
||||
__FILE__,__LINE__, cmmd, frag_rssb.redis_cluster_ctx[thread_seq]->errstr);
|
||||
redisClusterFree(frag_rssb.redis_cluster_ctx[thread_seq]);
|
||||
frag_rssb.redis_cluster_ctx[thread_seq] = NULL;
|
||||
freeReplyObject(cmmd_reply);
|
||||
rec = -2;
|
||||
}
|
||||
else if(cmmd_reply->type==REDIS_REPLY_ERROR)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_FATAL, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis cluster exec command '%s' fail, reply error:%s].",
|
||||
__FILE__,__LINE__, cmmd, cmmd_reply->str);
|
||||
freeReplyObject(cmmd_reply);
|
||||
rec = -2;
|
||||
}
|
||||
}
|
||||
|
||||
if(0==rec)
|
||||
{
|
||||
MESA_handle_runtime_log(logger, RLOG_LV_INFO, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} [redis cluster exec command '%s' succ].",
|
||||
__FILE__,__LINE__, cmmd);
|
||||
}
|
||||
*reply = cmmd_reply;
|
||||
return rec;
|
||||
}
|
||||
|
||||
int redis_excute_command(int thread_seq, void* logger, redisReply** reply, char* cmmd, int argc, const char **argv, const size_t *argvlen)
|
||||
{
|
||||
if(frag_rssb.redis_cluster_switch==1)
|
||||
{
|
||||
return redis_cluster_excute_command(thread_seq, logger, reply, cmmd, argc, argv, argvlen);
|
||||
}
|
||||
else if(frag_rssb.redis_cluster_switch==2)
|
||||
{
|
||||
return redis_nocluster_excute_command(thread_seq, logger, reply, cmmd, argc, argv, argvlen);
|
||||
}
|
||||
else
|
||||
{
|
||||
return -2;
|
||||
}
|
||||
}
|
||||
|
||||
15
src/frag_redis.h
Normal file
15
src/frag_redis.h
Normal file
@@ -0,0 +1,15 @@
|
||||
#ifndef _FRAG_REDIS_H
|
||||
#define _FRAG_REDIS_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int redis_excute_command(int thread_seq, void* logger, redisReply** reply, char* cmmd, int argc, const char **argv, const size_t *argvlen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
753
src/frag_send.c
Normal file
753
src/frag_send.c
Normal file
@@ -0,0 +1,753 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <math.h>
|
||||
#include <net/if.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
|
||||
#include "MESA_handle_logger.h"
|
||||
|
||||
#include "bizman.h"
|
||||
|
||||
#include "main.h"
|
||||
#include "frag_reassembly.h"
|
||||
#include "AV_interface.h"
|
||||
#include "AV_sendback.h"
|
||||
#include "AV_sendback_in.h"
|
||||
#include "my_socket.h"
|
||||
#include "common.h"
|
||||
#include "service.h"
|
||||
#include "usm_api.h"
|
||||
#include "frag_proc.h"
|
||||
|
||||
extern frag_rssb_parameter_t g_frag_run;
|
||||
extern frag_rssb_configure_t g_frag_cfg;
|
||||
extern frag_rssb_status_t g_frag_stat;
|
||||
extern frag_reassembly_t frag_rssb;
|
||||
|
||||
extern "C" void* frag_forward(void *param);
|
||||
|
||||
msg_map_t g_av_mediatype_map[AV_MEDAI_TYPE_MAXNUM] =
|
||||
{
|
||||
{FILE_UNKNOWN, MEDIA_TYPE_UNKNOWN},
|
||||
{FILE_VIDEO, MEDIA_TYPE_VIDEO},
|
||||
{FILE_WMV, MEDIA_TYPE_WMV},
|
||||
{FILE_MPG, MEDIA_TYPE_MPG},
|
||||
{FILE_FLV, MEDIA_TYPE_FLV},
|
||||
{FILE_RMFF, MEDIA_TYPE_RMFF},
|
||||
{FILE_AVI, MEDIA_TYPE_AVI},
|
||||
{FILE_SWF, MEDIA_TYPE_SWF},
|
||||
{FILE_MPG4, MEDIA_TYPE_MPG4},
|
||||
{FILE_AIFF, MEDIA_TYPE_AIFF},
|
||||
{FILE_OGG, MEDIA_TYPE_OGG},
|
||||
{FILE_DRC, MEDIA_TYPE_DRC},
|
||||
{FILE_DIRECTSHOW, MEDIA_TYPE_DIRECTSHOW},
|
||||
|
||||
{FILE_FLIC, MEDIA_TYPE_FLIC},
|
||||
{FILE_INDEO, MEDIA_TYPE_INDEO},
|
||||
{FILE_MKV, MEDIA_TYPE_MKV},
|
||||
{FILE_AUDIO, MEDIA_TYPE_AUDIO},
|
||||
{FILE_MP3, MEDIA_TYPE_MP3},
|
||||
{FILE_OSMF, MEDIA_TYPE_OSMF},
|
||||
{FILE_HLS, MEDIA_TYPE_HLS},
|
||||
{FILE_IOS, MEDIA_TYPE_UNKNOWN},
|
||||
{FILE_ANDRIOD, MEDIA_TYPE_UNKNOWN},
|
||||
{FILE_APP, MEDIA_TYPE_UNKNOWN},
|
||||
|
||||
{AUDIO_UNKNOWN, MEDIA_TYPE_AUDIO_UNKNOWN},
|
||||
{AUDIO_G711_ULAW, MEDIA_TYPE_AUDIO_G711_ULAW},
|
||||
{AUDIO_G711_ALAW, MEDIA_TYPE_AUDIO_G711_ALAW},
|
||||
{AUDIO_G722, MEDIA_TYPE_AUDIO_G722},
|
||||
{AUDIO_G723, MEDIA_TYPE_AUDIO_G723},
|
||||
{AUDIO_G726_40, MEDIA_TYPE_AUDIO_G726_40},
|
||||
{AUDIO_G726_32, MEDIA_TYPE_AUDIO_G726_32},
|
||||
{AUDIO_G726_24, MEDIA_TYPE_AUDIO_G726_24},
|
||||
{AUDIO_G726_16, MEDIA_TYPE_AUDIO_G726_16},
|
||||
{AUDIO_AAL2_G726_40, MEDIA_TYPE_AUDIO_AAL2_G726_40},
|
||||
{AUDIO_AAL2_G726_32, MEDIA_TYPE_AUDIO_AAL2_G726_32},
|
||||
{AUDIO_AAL2_G726_24, MEDIA_TYPE_AUDIO_AAL2_G726_24},
|
||||
{AUDIO_AAL2_G726_16, MEDIA_TYPE_AUDIO_AAL2_G726_16},
|
||||
{AUDIO_G728, MEDIA_TYPE_AUDIO_G728},
|
||||
{AUDIO_G729D, MEDIA_TYPE_AUDIO_G729D},
|
||||
{AUDIO_G729E, MEDIA_TYPE_AUDIO_G729E},
|
||||
{AUDIO_GSM, MEDIA_TYPE_AUDIO_GSM},
|
||||
{AUDIO_GSM_EFR, MEDIA_TYPE_AUDIO_GSM_EFR},
|
||||
{AUDIO_ILBC, MEDIA_TYPE_AUDIO_ILBC},
|
||||
{AUDIO_AMR, MEDIA_TYPE_AUDIO_AMR},
|
||||
{AUDIO_AMR_WB, MEDIA_TYPE_AUDIO_AMR_WB},
|
||||
{AUDIO_SILK, MEDIA_TYPE_AUDIO_SILK},
|
||||
{AUDIO_LPC, MEDIA_TYPE_AUDIO_LPC},
|
||||
{AUDIO_LPC1016, MEDIA_TYPE_AUDIO_LPC1016},
|
||||
{AUDIO_LPC1015, MEDIA_TYPE_AUDIO_LPC1015},
|
||||
{AUDIO_L16, MEDIA_TYPE_AUDIO_L16},
|
||||
{AUDIO_SPEEX, MEDIA_TYPE_AUDIO_SPEEX},
|
||||
{AUDIO_L8, MEDIA_TYPE_AUDIO_L8},
|
||||
{AUDIO_MPA, MEDIA_TYPE_AUDIO_MPA},
|
||||
{AUDIO_DVI4, MEDIA_TYPE_AUDIO_DVI4},
|
||||
{AUDIO_VDVI, MEDIA_TYPE_AUDIO_VDVI},
|
||||
{AUDIO_CN, MEDIA_TYPE_AUDIO_CN},
|
||||
{AUDIO_RED, MEDIA_TYPE_AUDIO_RED},
|
||||
{AUDIO_QCELP, MEDIA_TYPE_AUDIO_QCELP},
|
||||
{AUDIO_EVRC0, MEDIA_TYPE_AUDIO_EVRC0},
|
||||
{AUDIO_EVRCB0, MEDIA_TYPE_AUDIO_EVRCB0},
|
||||
{AUDIO_G729, MEDIA_TYPE_AUDIO_G729},
|
||||
{AUDIO_VIVOX, MEDIA_TYPE_AUDIO_VIVOX},
|
||||
|
||||
{FILE_IMAGE, MEDIA_TYPE_IMAGE},
|
||||
{FILE_JPG, MEDIA_TYPE_JPG},
|
||||
{FILE_BMP, MEDIA_TYPE_BMP},
|
||||
{FILE_GIF, MEDIA_TYPE_GIF},
|
||||
|
||||
{MMS_TYPE, MEDIA_TYPE_MMS},
|
||||
{RTSP_RDT_TYPE, MEDIA_TYPE_RTSP_RDT},
|
||||
{RTSP_RTP_TYPE, MEDIA_TYPE_RTSP_RTP}
|
||||
};
|
||||
|
||||
/*
|
||||
msg_map_t g_av_mediatype_map[AV_MEDAI_TYPE_MAXNUM] =
|
||||
{
|
||||
{FILE_UNKNOWN, MEDIA_TYPE_UNKNOWN},
|
||||
{FILE_VIDEO, MEDIA_TYPE_VIDEO},
|
||||
{FILE_WMV, MEDIA_TYPE_WMV},
|
||||
{FILE_MPG, MEDIA_TYPE_MPG},
|
||||
{FILE_FLV, MEDIA_TYPE_FLV},
|
||||
{FILE_RMFF, MEDIA_TYPE_RMFF},
|
||||
{FILE_AVI, MEDIA_TYPE_AVI},
|
||||
{FILE_SWF, MEDIA_TYPE_SWF},
|
||||
{FILE_MPG4, MEDIA_TYPE_MPG4},
|
||||
{FILE_AIFF, MEDIA_TYPE_AIFF},
|
||||
{FILE_OGG, MEDIA_TYPE_OGG},
|
||||
{FILE_DRC, MEDIA_TYPE_DRC},
|
||||
{FILE_DIRECTSHOW, MEDIA_TYPE_DIRECTSHOW},
|
||||
|
||||
{FILE_FLIC, MEDIA_TYPE_FLIC},
|
||||
{FILE_INDEO, MEDIA_TYPE_INDEO},
|
||||
{FILE_MKV, MEDIA_TYPE_MKV},
|
||||
{FILE_AUDIO, MEDIA_TYPE_AUDIO},
|
||||
{FILE_MP3, MEDIA_TYPE_MP3},
|
||||
{FILE_OSMF, MEDIA_TYPE_OSMF},
|
||||
{FILE_HLS, MEDIA_TYPE_HLS},
|
||||
{FILE_IOS, MEDIA_TYPE_UNKNOWN},
|
||||
{FILE_ANDRIOD, MEDIA_TYPE_UNKNOWN},
|
||||
{FILE_APP, MEDIA_TYPE_UNKNOWN},
|
||||
|
||||
{AUDIO_UNKNOWN, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G711_ULAW, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G711_ALAW, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G722, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G723, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G726_40, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G726_32, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G726_24, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G726_16, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_AAL2_G726_40, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_AAL2_G726_32, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_AAL2_G726_16, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G728, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G729D, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G729E, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_GSM, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_GSM_EFR, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_ILBC, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_AMR, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_AMR_WB, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_SILK, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_LPC, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_LPC1016, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_LPC1015, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_L16, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_SPEEX, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_L8, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_MPA, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_DVI4, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_VDVI, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_CN, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_RED, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_QCELP, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_EVRC0, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_EVRCB0, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_G729, MEDIA_TYPE_VOIP},
|
||||
{AUDIO_VIVOX, MEDIA_TYPE_VOIP},
|
||||
|
||||
{FILE_IMAGE, MEDIA_TYPE_IMAGE},
|
||||
{FILE_JPG, MEDIA_TYPE_JPG},
|
||||
{FILE_BMP, MEDIA_TYPE_BMP},
|
||||
{FILE_GIF, MEDIA_TYPE_GIF},
|
||||
|
||||
{MMS_TYPE, MEDIA_TYPE_MMS},
|
||||
{HTTP_STREAM_TYPE, MEDIA_TYPE_HTTP_STREAM},
|
||||
{RTSP_RDT_TYPE, MEDIA_TYPE_RTSP_RDT},
|
||||
{RTSP_RTP_TYPE, MEDIA_TYPE_RTSP_RTP}
|
||||
};
|
||||
*/
|
||||
|
||||
msg_map_t g_av_proto_map[AV_PROTO_MAXNUM] =
|
||||
{
|
||||
{AV_PROTOCOL_HTTP, PROTOCOL_HTTP},
|
||||
{AV_PROTOCOL_SMTP, PROTOCOL_SMTP},
|
||||
{AV_PROTOCOL_POP3, PROTOCOL_POP3},
|
||||
{AV_PROTOCOL_IMAP, PROTOCOL_IMAP},
|
||||
{AV_PROTOCOL_FTP, PROTOCOL_FTP},
|
||||
{AV_PROTOCOL_HTTP_STREAM, PROTOCOL_HTTP_PIC},
|
||||
{AV_PROTOCOL_RTSP_RDT, PROTOCOL_RTSP_RDT},
|
||||
{AV_PROTOCOL_RTSP_RTP, PROTOCOL_RTSP_RTP},
|
||||
{AV_PROTOCOL_MMS, PROTOCOL_MMS},
|
||||
{AV_PROTOCOL_RTMP, PROTOCOL_RTMP},
|
||||
{AV_PROTOCOL_SIP, PROTOCOL_SIP},
|
||||
};
|
||||
|
||||
void send_data_by_udp(const char* data, uint32_t datalen, int thread_id)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
int send_rec = 0;
|
||||
|
||||
atomic_inc(&g_frag_stat.stat_info[SRC_WINS_SEND][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[SRC_WINS_SEND][TOTAL_BYTES], datalen);
|
||||
for(i=0;i<g_frag_cfg.send_dest_udp_ip_num;i++)
|
||||
{
|
||||
send_rec = send_udp_socket_send(g_frag_run.send_sd[thread_id],
|
||||
g_frag_cfg.send_dest_udp_iplist[i],
|
||||
g_frag_cfg.send_dest_udp_port[i],
|
||||
(char*)data,datalen);
|
||||
if(-1==send_rec)
|
||||
{
|
||||
/*static output*/
|
||||
atomic_inc(&g_frag_stat.send_stat[i][FAIL_PKTS]);
|
||||
atomic_add(&g_frag_stat.send_stat[i][FAIL_BYTES], datalen);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*static output*/
|
||||
atomic_inc(&g_frag_stat.send_stat[i][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.send_stat[i][TOTAL_BYTES], datalen);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void send_data_by_unixsocket(const char* data, uint32_t datalen, int thread_id)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
int send_rec = 0;
|
||||
// send data to linux backend
|
||||
if(0<g_frag_cfg.send_dest_addr_num)
|
||||
{
|
||||
//static output
|
||||
atomic_inc(&g_frag_stat.stat_info[SRC_SEND_LOCAL][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[SRC_SEND_LOCAL][TOTAL_BYTES], datalen);
|
||||
for(i=0;i<g_frag_cfg.send_dest_addr_num;i++)
|
||||
{
|
||||
send_rec = unix_socket_send(g_frag_run.send_fd[thread_id],&g_frag_cfg.send_dest_addr[i],data,datalen);
|
||||
|
||||
if(-1==send_rec)
|
||||
{
|
||||
//static output
|
||||
atomic_inc(&g_frag_stat.send_stat[i][FAIL_PKTS]);
|
||||
atomic_add(&g_frag_stat.send_stat[i][FAIL_BYTES], datalen);
|
||||
}
|
||||
else
|
||||
{
|
||||
//static output
|
||||
atomic_inc(&g_frag_stat.send_stat[i][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.send_stat[i][TOTAL_BYTES], datalen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void send_data(const char* data, uint32_t datalen, int thread_id)
|
||||
{
|
||||
/*<2A><><EFBFBD><EFBFBD>UDP<44>ش<EFBFBD>*/
|
||||
#if K_PROJECT
|
||||
send_data_by_udp(data, datalen, thread_id);
|
||||
/*<2A><><EFBFBD><EFBFBD>unix socket<65>ش<EFBFBD>*/
|
||||
#else
|
||||
send_data_by_unixsocket(data, datalen, thread_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
void send_data_bizman(const char* data, uint32_t datalen, uint64_t mid,uint32_t ip, int thread_id)
|
||||
{
|
||||
atomic_inc(&g_frag_stat.stat_info[SRC_SEND_CPZ][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[SRC_SEND_CPZ][TOTAL_BYTES], datalen);
|
||||
int i = mid%g_frag_cfg.thread_num;
|
||||
bizman_send(g_frag_run.cpz_send_bizman,
|
||||
thread_id,
|
||||
ip,
|
||||
g_frag_cfg.bizman_port+i,
|
||||
data,
|
||||
datalen,
|
||||
1,BIZMAN_RELIABLE_SEND|BIZMAN_SMOOTH_DEST|BIZMAN_PUSH_SEND);
|
||||
}
|
||||
|
||||
void send_data_usm(const char* data, uint32_t datalen, int thread_id)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
int send_rec = 0;
|
||||
/* send data to linux backend*/
|
||||
if(0<g_frag_cfg.send_dest_addr_num)
|
||||
{
|
||||
/*static output*/
|
||||
atomic_inc(&g_frag_stat.stat_info[SRC_SEND_LOCAL][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[SRC_SEND_LOCAL][TOTAL_BYTES], datalen);
|
||||
|
||||
send_rec = USM_write(g_frag_run.a_usm_handle,data,datalen);
|
||||
|
||||
for(i=0;i<g_frag_cfg.send_dest_addr_num;i++)
|
||||
{
|
||||
g_frag_stat.send_stat[i][TOTAL_PKTS] = USM_stat(g_frag_run.a_usm_handle,READED_CNT,i);
|
||||
g_frag_stat.send_stat[i][TOTAL_BYTES] = USM_stat(g_frag_run.a_usm_handle,READED_SIZE,i);
|
||||
g_frag_stat.send_stat[i][FAIL_PKTS] = USM_stat(g_frag_run.a_usm_handle,READER_DROP_CNT,i);
|
||||
g_frag_stat.send_stat[i][FAIL_BYTES] = USM_stat(g_frag_run.a_usm_handle,READER_DROP_SIZE,i);
|
||||
g_frag_stat.send_lq_stat[i][TOTAL_PKTS] = USM_stat(g_frag_run.a_usm_handle,LQ_COUNT,i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
long check_sendto_wins_cb(void *data, const uint8_t *key, uint size, void *user_arg)
|
||||
{
|
||||
media_t* mdi = (media_t*)data;
|
||||
|
||||
if(NULL!=mdi)
|
||||
{
|
||||
*(char*)user_arg = mdi->wins_dest_disabled_bit;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
int check_sendto_wins(uint64_t mid, char* wins_dest_disabled_bit)
|
||||
{
|
||||
long rec_cb = 0;
|
||||
MESA_htable_search_cb(g_frag_run.media_hash, (const uint8_t*)&mid, sizeof(mid),
|
||||
check_sendto_wins_cb, wins_dest_disabled_bit, &rec_cb);
|
||||
return 0;
|
||||
}
|
||||
|
||||
void send_data_to_wins(uint64_t mid, const char* data, uint32_t datalen, int thread_id)
|
||||
{
|
||||
uint32_t i = 0;
|
||||
int send_rec = 0;
|
||||
uint32_t sendip = g_frag_cfg.special_media_wins_ip[mid % g_frag_cfg.special_media_wins_ip_num];
|
||||
char wins_dest_disabled_bit = 0;
|
||||
char wins_dest_disabled_flag[DEST_MAXNUM] = {0};
|
||||
|
||||
check_sendto_wins(mid, &wins_dest_disabled_bit);
|
||||
if(FLAG_TEST(wins_dest_disabled_bit, AUDIO_WINS_DISABLE))
|
||||
{
|
||||
wins_dest_disabled_flag[0] = 1;
|
||||
}
|
||||
if(FLAG_TEST(wins_dest_disabled_bit, VEDIO_WINS_DISABLE))
|
||||
{
|
||||
wins_dest_disabled_flag[2] = 1;
|
||||
}
|
||||
/* send data to windows backend*/
|
||||
if(g_frag_cfg.special_media_wins_port_num)
|
||||
{
|
||||
atomic_inc(&g_frag_stat.stat_info[SRC_WINS_SEND][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.stat_info[SRC_WINS_SEND][TOTAL_BYTES], datalen);
|
||||
for(i=0;i<g_frag_cfg.special_media_wins_port_num;i++)
|
||||
{
|
||||
if(wins_dest_disabled_flag[i])
|
||||
{
|
||||
continue;
|
||||
}
|
||||
send_rec = send_udp_socket_send(g_frag_run.send_windows_sd[thread_id],
|
||||
sendip,g_frag_cfg.special_media_wins_port[i],
|
||||
(char*)data,datalen);
|
||||
if(-1==send_rec)
|
||||
{
|
||||
/*static output*/
|
||||
atomic_inc(&g_frag_stat.wins_send_stat[i][FAIL_PKTS]);
|
||||
atomic_add(&g_frag_stat.wins_send_stat[i][FAIL_BYTES], datalen);
|
||||
|
||||
}
|
||||
else
|
||||
{
|
||||
/*static output*/
|
||||
atomic_inc(&g_frag_stat.wins_send_stat[i][TOTAL_PKTS]);
|
||||
atomic_add(&g_frag_stat.wins_send_stat[i][TOTAL_BYTES], datalen);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void pack_and_send_data(frag_in_t* frg, int thread_id)
|
||||
{
|
||||
msg_head_t* msghead = NULL;
|
||||
av_data_t* msgdata = NULL;
|
||||
char* sendbuf = NULL;
|
||||
int sendbuflen = 0;
|
||||
|
||||
/*calculate sendbuflen*/
|
||||
sendbuflen = sizeof(msg_head_t)+sizeof(av_data_t)+frg->datalen;
|
||||
sendbuf = (char*)malloc(sendbuflen);
|
||||
memset(sendbuf, 0, sendbuflen);
|
||||
|
||||
/*set msg header*/
|
||||
msghead = (msg_head_t*)sendbuf;
|
||||
msghead->magic = AV_MAGIC_VALUE;
|
||||
msghead->m_type = AV_TYPE_DATA;
|
||||
msghead->c_len = sizeof(av_data_t)+frg->datalen;
|
||||
|
||||
/*set msg data*/
|
||||
msgdata = (av_data_t*)(sendbuf + sizeof(msg_head_t));
|
||||
memcpy(msgdata->pid, &frg->mid, sizeof(frg->mid));
|
||||
msgdata->frag_seq = frg->seq;
|
||||
msgdata->offset = frg->offset;
|
||||
|
||||
/*send data*/
|
||||
memcpy(sendbuf+sizeof(msg_head_t)+sizeof(av_data_t), frg->data, frg->datalen);
|
||||
|
||||
if(FLAG_TEST(frg->frag_flag, FRAG_FLAG_MULTISRC))
|
||||
{
|
||||
send_data_bizman(sendbuf, sendbuflen, frg->mid, frg->multisrc_bizmanip, thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(g_frag_run.usm_on_flag)
|
||||
{
|
||||
send_data_usm(sendbuf,sendbuflen,thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
send_data(sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
if(g_frag_cfg.special_media_fwd_switch && FLAG_TEST(frg->frag_flag, FRAG_FLAG_WINS))
|
||||
{
|
||||
send_data_to_wins(frg->mid, sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
}
|
||||
/*free*/
|
||||
if(NULL!=sendbuf)
|
||||
{
|
||||
free(sendbuf);
|
||||
}
|
||||
}
|
||||
|
||||
void pack_and_send_frag(frag_in_t* frg, int thread_id)
|
||||
{
|
||||
msg_header_t* msghead = NULL;
|
||||
msg_data_t* msgdata = NULL;
|
||||
char* sendbuf = NULL;
|
||||
int sendbuflen = 0;
|
||||
|
||||
/*calculate sendbuflen*/
|
||||
sendbuflen = sizeof(msg_header_t)+sizeof(msg_data_t)+frg->datalen;
|
||||
sendbuf = (char*)malloc(sendbuflen);
|
||||
memset(sendbuf, 0, sendbuflen);
|
||||
|
||||
/*set msg header*/
|
||||
msghead = (msg_header_t*)sendbuf;
|
||||
msghead->magic_num = PROTO_MAGICNUM;
|
||||
msghead->version = PROTO_VERSION;
|
||||
msghead->msg_type = MSG_DATA_BODY;
|
||||
msghead->cont_len = MSG_DATA_HEAD_LEN+frg->datalen;
|
||||
|
||||
/*set msg data*/
|
||||
msgdata = (msg_data_t*)(sendbuf + MSG_HEADER_LEN);
|
||||
memcpy(msgdata->prog_id, &frg->mid, sizeof(frg->mid));
|
||||
msgdata->offset = frg->offset;
|
||||
msgdata->frag_seq = frg->seq;
|
||||
|
||||
/*send data*/
|
||||
memcpy(sendbuf+MSG_HEADER_LEN+MSG_DATA_HEAD_LEN, frg->data, frg->datalen);
|
||||
|
||||
if(FLAG_TEST(frg->frag_flag, FRAG_FLAG_MULTISRC))
|
||||
{
|
||||
send_data_bizman(sendbuf, sendbuflen, frg->mid, frg->multisrc_bizmanip, thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(g_frag_run.usm_on_flag)
|
||||
{
|
||||
send_data_usm(sendbuf,sendbuflen,thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
send_data(sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
if(g_frag_cfg.special_media_fwd_switch && FLAG_TEST(frg->frag_flag, FRAG_FLAG_WINS))
|
||||
{
|
||||
send_data_to_wins(frg->mid, sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
}
|
||||
/*free*/
|
||||
if(NULL!=sendbuf)
|
||||
{
|
||||
free(sendbuf);
|
||||
}
|
||||
}
|
||||
|
||||
void send_frag(frag_in_t* frg, int thread_id)
|
||||
{
|
||||
/*<2A><><EFBFBD><EFBFBD>AV_sendback.h<><68><EFBFBD><EFBFBD><EFBFBD>Ļش<C4BB><D8B4>ӿ<EFBFBD>*/
|
||||
#if K_PROJECT
|
||||
pack_and_send_data(frg, thread_id);
|
||||
/*<2A><><EFBFBD><EFBFBD>AV_interface.h<><68><EFBFBD><EFBFBD><EFBFBD>Ļش<C4BB><D8B4>ӿ<EFBFBD>*/
|
||||
#else
|
||||
pack_and_send_frag(frg, thread_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
uint8_t msg_convertion(uint8_t src, msg_map_t* map_list, int list_size)
|
||||
{
|
||||
for(int i=0;i<list_size;i++)
|
||||
{
|
||||
if(src==map_list[i].nodeA)
|
||||
{
|
||||
return map_list[i].nodeB;
|
||||
}
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void pack_and_send_meta_info(media_info_t* media_info, frag_in_t* frg, int thread_id)
|
||||
{
|
||||
msg_head_t* msghead = NULL;
|
||||
msg_meta_t* msginfo = NULL;
|
||||
char* sendbuf = NULL;
|
||||
int sendbuflen = 0;
|
||||
char* ptr = NULL;
|
||||
int opt_len = 0;
|
||||
|
||||
/*calculate sendbuflen*/
|
||||
sendbuflen = sizeof(msg_head_t)+sizeof(msg_meta_t);
|
||||
|
||||
/*calculate opts len*/
|
||||
for(int i=0;i<media_info->opt_num;i++)
|
||||
{
|
||||
sendbuflen += media_info->opt_unit[i].opt_len;
|
||||
opt_len += media_info->opt_unit[i].opt_len;
|
||||
}
|
||||
|
||||
/*get mem*/
|
||||
sendbuf = (char*)malloc(sendbuflen);
|
||||
memset(sendbuf, 0, sendbuflen);
|
||||
|
||||
/*set msg header*/
|
||||
msghead = (msg_head_t*)sendbuf;
|
||||
msghead->magic = AV_MAGIC_VALUE;
|
||||
msghead->m_type = AV_TYPE_META;
|
||||
msghead->c_len = sizeof(msg_meta_t);
|
||||
|
||||
/*set msg media info*/
|
||||
msginfo = (msg_meta_t*)(sendbuf + sizeof(msg_head_t));
|
||||
memcpy(msginfo->pid, &media_info->mid, sizeof(media_info->mid));
|
||||
msginfo->proglen = media_info->prog_len;
|
||||
msginfo->capip = media_info->cap_IP;
|
||||
msginfo->data_flag = media_info->data_flag;
|
||||
/*Э<><D0AD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽṹ<D6BD><E1B9B9>֮<EFBFBD><D6AE>ת<EFBFBD><D7AA>av_interface->av_sendback*/
|
||||
msginfo->protocol = msg_convertion(media_info->protocol, g_av_proto_map, AV_PROTO_MAXNUM);
|
||||
/*ý<><C3BD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֽṹ<D6BD><E1B9B9>֮<EFBFBD><D6AE>ת<EFBFBD><D7AA>av_interface->av_sendback*/
|
||||
msginfo->mediatype = msg_convertion(media_info->media_type, g_av_mediatype_map, AV_MEDAI_TYPE_MAXNUM);
|
||||
|
||||
/*opt*/
|
||||
msginfo->opt_num = media_info->opt_num;
|
||||
ptr = sendbuf + sizeof(msg_head_t)+sizeof(msg_meta_t);
|
||||
for(int i=0;i<media_info->opt_num;i++)
|
||||
{
|
||||
*(unsigned int *)ptr = media_info->opt_unit[i].opt_len;
|
||||
ptr += sizeof(unsigned int);
|
||||
*(unsigned char *)ptr = media_info->opt_unit[i].opt_type;
|
||||
ptr += sizeof(unsigned char);
|
||||
memcpy(ptr, media_info->opt_unit[i].opt_value, media_info->opt_unit[i].opt_len-sizeof(uint8_t)-sizeof(uint32_t));
|
||||
ptr += media_info->opt_unit[i].opt_len-sizeof(uint8_t)-sizeof(uint32_t);
|
||||
}
|
||||
|
||||
/*send data*/
|
||||
if(FLAG_TEST(frg->frag_flag, FRAG_FLAG_MULTISRC))
|
||||
{
|
||||
send_data_bizman(sendbuf, sendbuflen, media_info->mid, frg->multisrc_bizmanip, thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(g_frag_run.usm_on_flag)
|
||||
{
|
||||
send_data_usm(sendbuf,sendbuflen,thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
send_data(sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
if(g_frag_cfg.special_media_fwd_switch && FLAG_TEST(frg->frag_flag, FRAG_FLAG_WINS))
|
||||
{
|
||||
send_data_to_wins(frg->mid, sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
}
|
||||
/*free*/
|
||||
if(NULL!=sendbuf)
|
||||
{
|
||||
free(sendbuf);
|
||||
}
|
||||
}
|
||||
|
||||
void pack_and_send_media_info(media_info_t* media_info, frag_in_t* frg, int thread_id)
|
||||
{
|
||||
msg_header_t* msghead = NULL;
|
||||
msg_metainfo_t* msginfo = NULL;
|
||||
char* ptr = NULL;
|
||||
char* sendbuf = NULL;
|
||||
int sendbuflen = 0;
|
||||
int i=0;
|
||||
int opt_len = 0;
|
||||
|
||||
/*calculate sendbuflen*/
|
||||
sendbuflen = sizeof(msg_header_t)+sizeof(msg_metainfo_t);
|
||||
|
||||
/*calculate opts len*/
|
||||
for(i=0;i<media_info->opt_num;i++)
|
||||
{
|
||||
sendbuflen += media_info->opt_unit[i].opt_len;
|
||||
opt_len += media_info->opt_unit[i].opt_len;
|
||||
}
|
||||
|
||||
/*get mem*/
|
||||
sendbuf = (char*)malloc(sendbuflen);
|
||||
memset(sendbuf, 0, sendbuflen);
|
||||
|
||||
/*set msg header*/
|
||||
msghead = (msg_header_t*)sendbuf;
|
||||
msghead->magic_num = PROTO_MAGICNUM;
|
||||
msghead->version = PROTO_VERSION;
|
||||
msghead->msg_type = MSG_DATA_META;
|
||||
msghead->cont_len = MSG_MEDIAINFO_HEAD_LEN+opt_len;
|
||||
|
||||
/*set msg media info*/
|
||||
msginfo = (msg_metainfo_t*)(sendbuf + MSG_HEADER_LEN);
|
||||
memcpy(msginfo->prog_id, &media_info->mid, sizeof(media_info->mid));
|
||||
msginfo->prog_len = media_info->prog_len;
|
||||
msginfo->hitservice = media_info->hitservice;
|
||||
msginfo->cap_IP = media_info->cap_IP;
|
||||
msginfo->protocol = media_info->protocol;
|
||||
msginfo->media_type = media_info->media_type;
|
||||
msginfo->data_flag = media_info->data_flag;
|
||||
msginfo->flag = media_info->flag;
|
||||
msginfo->opt_num = media_info->opt_num;
|
||||
|
||||
ptr = sendbuf + sizeof(msg_header_t) + sizeof(msg_metainfo_t);
|
||||
for(i=0;i<media_info->opt_num;i++)
|
||||
{
|
||||
*(unsigned int *)ptr = media_info->opt_unit[i].opt_len;
|
||||
ptr += sizeof(unsigned int);
|
||||
*(unsigned char *)ptr = media_info->opt_unit[i].opt_type;
|
||||
ptr += sizeof(unsigned char);
|
||||
memcpy(ptr, media_info->opt_unit[i].opt_value, media_info->opt_unit[i].opt_len-sizeof(uint8_t)-sizeof(uint32_t));
|
||||
ptr += media_info->opt_unit[i].opt_len-sizeof(uint8_t)-sizeof(uint32_t);
|
||||
}
|
||||
|
||||
/*send data*/
|
||||
if(FLAG_TEST(frg->frag_flag, FRAG_FLAG_MULTISRC))
|
||||
{
|
||||
send_data_bizman(sendbuf, sendbuflen, media_info->mid, frg->multisrc_bizmanip, thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
if(g_frag_run.usm_on_flag)
|
||||
{
|
||||
send_data_usm(sendbuf,sendbuflen,thread_id);
|
||||
}
|
||||
else
|
||||
{
|
||||
send_data(sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
if(g_frag_cfg.special_media_fwd_switch && FLAG_TEST(frg->frag_flag, FRAG_FLAG_WINS))
|
||||
{
|
||||
send_data_to_wins(frg->mid, sendbuf, sendbuflen, thread_id);
|
||||
}
|
||||
}
|
||||
/*free*/
|
||||
if(NULL!=sendbuf)
|
||||
{
|
||||
free(sendbuf);
|
||||
}
|
||||
}
|
||||
|
||||
void send_media_info(media_info_t* media_info, frag_in_t* frg, int thread_id)
|
||||
{
|
||||
/*<2A><><EFBFBD><EFBFBD>AV_sendback.h<><68><EFBFBD><EFBFBD><EFBFBD>Ļش<C4BB><D8B4>ӿ<EFBFBD>*/
|
||||
#if K_PROJECT
|
||||
pack_and_send_meta_info(media_info, frg, thread_id);
|
||||
#else
|
||||
/*<2A><><EFBFBD><EFBFBD>AV_interface.h<><68><EFBFBD><EFBFBD><EFBFBD>Ļش<C4BB><D8B4>ӿ<EFBFBD>*/
|
||||
pack_and_send_media_info(media_info, frg, thread_id);
|
||||
#endif
|
||||
}
|
||||
|
||||
void* frag_forward(void *param)
|
||||
{
|
||||
long thread_seq = (long)param;
|
||||
frag_in_t* frg_in = NULL;
|
||||
long frglen = sizeof(frg_in);
|
||||
media_info_t media_info;
|
||||
long rec_cb = 0;
|
||||
|
||||
while(1)
|
||||
{
|
||||
int rec = MESA_lqueue_get_head(frag_rssb.wait_lq[thread_seq], &frg_in, &frglen);
|
||||
if (rec<0)
|
||||
{
|
||||
usleep(10);
|
||||
}
|
||||
else
|
||||
{
|
||||
memset(&media_info,0,sizeof(media_info_t));
|
||||
if(FLAG_TEST(frg_in->frag_flag, FRAG_FLAG_SEND_META))
|
||||
{
|
||||
/*borrow only*/
|
||||
media_info.prog_len = frg_in->datalen;
|
||||
MESA_htable_search_cb(g_frag_run.media_hash, (const uint8_t *)&frg_in->mid,sizeof(frg_in->mid),
|
||||
get_media, (void*)&media_info, &rec_cb);
|
||||
/*<2A><>Դ<EFBFBD><D4B4>ʹ<EFBFBD>þɵ<C3BE>mid<69><64>ѯ<EFBFBD><D1AF>Ŀ<EFBFBD><C4BF>Ϣ*/
|
||||
/*
|
||||
if(FLAG_TEST(frg_in->frag_flag, FRAG_FLAG_MULTISRC))
|
||||
{
|
||||
MESA_htable_search_cb(g_frag_run.media_hash, (const uint8_t *)&frg_in->old_mid,sizeof(frg_in->old_mid),
|
||||
get_media, (void*)&media_info, &rec_cb);
|
||||
}
|
||||
else
|
||||
{
|
||||
MESA_htable_search_cb(g_frag_run.media_hash, (const uint8_t *)&frg_in->mid,sizeof(frg_in->mid),
|
||||
get_media, (void*)&media_info, &rec_cb);
|
||||
}
|
||||
*/
|
||||
if(rec_cb)
|
||||
{
|
||||
frag_write_to_log(GET_META, media_info.mid, &media_info, NULL, 0);
|
||||
send_media_info(&media_info, frg_in, thread_seq);
|
||||
MESA_handle_runtime_log(g_frag_run.frag_logger, RLOG_LV_INFO, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} SEND META [MID:%llu, proto:%hu, media_len:%llu, media_type:0x%02x]",
|
||||
__FILE__,__LINE__, media_info.mid, media_info.protocol, media_info.prog_len, media_info.media_type);
|
||||
atomic_inc(&g_frag_stat.media_stat[LOG_MEDIA_OUTPUT]);
|
||||
/*free mediainfo opt , this is not good free outside*/
|
||||
if(NULL!=media_info.opt_unit)
|
||||
{
|
||||
for(int i=0;i<media_info.opt_num;i++)
|
||||
{
|
||||
if(NULL!=media_info.opt_unit[i].opt_value)
|
||||
{
|
||||
free(media_info.opt_unit[i].opt_value);
|
||||
media_info.opt_unit[i].opt_value = NULL;
|
||||
}
|
||||
}
|
||||
free(media_info.opt_unit);
|
||||
media_info.opt_unit = NULL;
|
||||
}
|
||||
}
|
||||
}
|
||||
/*<2A><>Դ<EFBFBD><D4B4><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>£<EFBFBD><C2A3><EFBFBD>Ҫ<EFBFBD><EFBFBD>midΪ<64>µ<EFBFBD>mid*/
|
||||
frg_in->mid = frg_in->new_mid;
|
||||
send_frag(frg_in, thread_seq);
|
||||
frag_write_to_log(GET_FRAG, frg_in->mid, frg_in, NULL, 0);
|
||||
atomic_inc(&frag_rssb.sysinfo_stat[RSSB_WAIT_QUEUE][QUEUE_OUT]);
|
||||
MESA_handle_runtime_log(g_frag_run.frag_logger, RLOG_LV_DEBUG, FRAG_REASSEMBLY_MODULE_NAME,
|
||||
"{%s:%d} SEND DATA [MID:%llu, PID:%llu, seq:%u, offset:%llu, datalen:%u]",
|
||||
__FILE__,__LINE__, frg_in->mid, frg_in->pid, frg_in->seq, frg_in->offset, frg_in->datalen);
|
||||
free_frag_in(frg_in, 0, NULL);
|
||||
frg_in = NULL;
|
||||
}
|
||||
}
|
||||
return NULL;
|
||||
}
|
||||
23
src/frag_send.h
Normal file
23
src/frag_send.h
Normal file
@@ -0,0 +1,23 @@
|
||||
#ifndef _FRAG_SEND_H
|
||||
#define _FRAG_SEND_H
|
||||
|
||||
/*ͨ<><CDA8>sokcet<65>ӿڷ<D3BF><DAB7>ͱ<EFBFBD><CDB1><EFBFBD>*/
|
||||
#define FRAG_SEND_SOCKET 0x01
|
||||
/*<2A><>Դͨ<D4B4><CDA8>bizman<61><6E><EFBFBD><EFBFBD><CDB8><EFBFBD><EFBFBD><EFBFBD>frag_rssb*/
|
||||
#define FRAG_SEND_BIZMAN 0x02
|
||||
/*<2A>쳣<EFBFBD><ECB3A3><EFBFBD><EFBFBD><EFBFBD>ݶ<EFBFBD>ʧ*/
|
||||
#define FRAG_SEND_DROP 0x03
|
||||
|
||||
/*<2A><>Դ<EFBFBD>ۺϵĵ<CFB5>ַ*/
|
||||
#define MEDIA_SEND_DST_LOCAL 0x00 /*<2A><><EFBFBD><EFBFBD>*/
|
||||
#define MEDIA_SEND_DST_OTHER 0x01 /*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƴװ*/
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
1051
src/frag_voip.c
Normal file
1051
src/frag_voip.c
Normal file
File diff suppressed because it is too large
Load Diff
156
src/frag_voip.h
Normal file
156
src/frag_voip.h
Normal file
@@ -0,0 +1,156 @@
|
||||
#ifndef _VOIP_REASSEMBLY_H
|
||||
#define _VOIP_REASSEMBLY_H
|
||||
|
||||
#include "frag_reassembly_in.h"
|
||||
|
||||
/*index in g_sip_opt_type*/
|
||||
#define SIP_CALL_ID_OPT_INDEX 11
|
||||
#define SIP_FROM_TAGS_OPT_INDEX 9
|
||||
#define SIP_TO_TAGS_OPT_INDEX 10
|
||||
#define SIP_RESCODE_OPT_INDEX 30
|
||||
#define SIP_REASON_OPT_INDEX 22
|
||||
#define SIP_CSEQ_OPT_INDEX 12
|
||||
#define SIP_USERAGENT_OPT_INDEX 15
|
||||
#define SIP_URI_OPT_INDEX 1
|
||||
#define SIP_C_CONTACT_OPT_INDEX 13
|
||||
#define SIP_S_CONTACT_OPT_INDEX 14
|
||||
#define SIP_C_VIA_OPT_INDEX 27
|
||||
#define SIP_S_VIA_OPT_INDEX 24
|
||||
#define SIP_C_RECORD_ROUTES_OPT_INDEX 28
|
||||
#define SIP_S_RECORD_ROUTES_OPT_INDEX 25
|
||||
#define SIP_C_ROUTE_OPT_INDEX 29
|
||||
#define SIP_S_ROUTE_OPT_INDEX 26
|
||||
#define SIP_C_CODING_OPT_INDEX 8
|
||||
#define SIP_S_CODING_OPT_INDEX 7
|
||||
#define SIP_FROM_OPT_INDEX 2
|
||||
#define SIP_TO_OPT_INDEX 3
|
||||
#define SIP_RTP_4TUPLE_OPT_INDEX 0
|
||||
#define SIP_SIP_4TUPLE_OPT_INDEX 23
|
||||
#define SIP_DURATION_OPT_INDEX 6
|
||||
|
||||
#define SIP_PROTO_SIP "SIP-RTP"
|
||||
#define SIP_PROTO_RTP "RTP"
|
||||
#define SIP_METHOD_OPT "INVITE"
|
||||
#define SIP_PROTO_OPT "SIP"
|
||||
|
||||
/*ȫ<><C8AB><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѡ<EFBFBD><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define SIP_OPT_MAXNUM 16
|
||||
/*voip<69><70>־<EFBFBD><D6BE>Ϣͷsip_log_msg_header_t*/
|
||||
#define SIP_LOG_CONT_CODE_NOTHING 0
|
||||
#define SIP_LOG_VERSION 3
|
||||
#define SIP_FULLLOG_MAGIC_NUM 0x5632
|
||||
#define SIP_FULLLOG_CONT_CODE_VERSION 0X03
|
||||
#define SIP_FULLLOG_MSG_TYPE 0x21
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־<EFBFBD><D6BE>Ϣͷsip_og_msg_header_t*/
|
||||
#define SIP_SURVEYLOG_MAGIC_NUM 0x5641
|
||||
#define SIP_SURVEYLOG_MSG_TYPE 0x21
|
||||
|
||||
/*ȫ<><C8AB><EFBFBD><EFBFBD>־<EFBFBD><D6BE><EFBFBD><EFBFBD>g_sip_opt_type*/
|
||||
#define OPT_VOIP_PID 0x29
|
||||
#define OPT_VOIP_DUATION_FULLLOG 0x2A
|
||||
#define OPT_VOIP_VOICE_DIR_FULLLOG 0x2B
|
||||
|
||||
/*<2A><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־ѡ<D6BE><D1A1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>*/
|
||||
#define OPT_LAYER_ADDR_V4 0x3B //0x3B:RTP, 0x2D:SIP, change
|
||||
#define OPT_VOIP_RECV_TIME 0x2F
|
||||
#define OPT_VOIP_DUATION 0x30
|
||||
#define OPT_VOIP_PROTOCOL 0x31
|
||||
#define OPT_VOIP_CALLING_ACCOUNT 0x32
|
||||
#define OPT_VOIP_CALLED_ACCOUNT 0x33
|
||||
#define OPT_VOIP_RELATION_RTP_LAYER_ADDR_V4 0x2D //0x3B:RTP, 0x2D:SIP, change
|
||||
#define OPT_VOIP_FROM_TO_STORE_IP 0x36
|
||||
#define OPT_VOIP_FROM_TO_STORE_URL 0x37
|
||||
#define OPT_VOIP_TO_FROM_STORE_IP 0x38
|
||||
#define OPT_VOIP_TO_FROM_STORE_URL 0x39
|
||||
|
||||
/*sip_sendlog_flag*/
|
||||
#define SIP_SEND_FULL_LOG 0x01
|
||||
#define SIP_SEND_SURVEY_LOG 0x02
|
||||
|
||||
/*sip<69><70>ѯʹ<D1AF><CAB9>key1 key2 key3*/
|
||||
#define SIP_KEY_1 1
|
||||
#define SIP_KEY_2 2
|
||||
#define SIP_KEY_3 3
|
||||
|
||||
/*RTP<54><50><EFBFBD><EFBFBD>ǰ8<C7B0><38><EFBFBD>ֽڣ<D6BD>4<EFBFBD><34><EFBFBD>ֽڵ<D6BD>ʱ<EFBFBD><CAB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD>4<EFBFBD><34><EFBFBD>ֽڵ<D6BD>rtp_seq*/
|
||||
#define VOIP_DATA_SEQ_OFFSET 4
|
||||
#define VOIP_DATA_TIME_SEQ_LEN 8
|
||||
|
||||
typedef struct sip_fulllog_msg_body_s
|
||||
{
|
||||
char call_id[128]; // not NULL
|
||||
char from_tags[64];
|
||||
char to_tags[64];
|
||||
char version[16];
|
||||
char method[16];
|
||||
char status[8]; //?? rescode not exist
|
||||
char reason[128];
|
||||
char cseq[128];
|
||||
char src_ip[20];
|
||||
uint32_t src_port;
|
||||
char dst_ip[20];
|
||||
uint32_t dst_port;
|
||||
char useragent[128];
|
||||
char from_rtp_ip[20];
|
||||
uint32_t from_rtp_port;
|
||||
char to_rtp_ip[20];
|
||||
uint32_t to_rtp_port;
|
||||
uint32_t paw_num; //<2F><><EFBFBD><EFBFBD><EFBFBD>ڱ<EFBFBD><DAB1>ţ<EFBFBD><C5A3><EFBFBD>ʱΪ0
|
||||
char cly_ip[20]; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>дΪ<D0B4><CEAA>ƿװIP
|
||||
time_t found_time;
|
||||
uint16_t opt_num; //ѡ<><D1A1><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>
|
||||
}__attribute__((packed))sip_fulllog_msg_body_t;
|
||||
|
||||
typedef struct sip_surveylog_msg_body_s
|
||||
{
|
||||
unsigned long long prog_id; // <20><>Ŀ<EFBFBD><C4BF>ID<49><44><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݻ<EFBFBD>ȡ<EFBFBD>ڵ<EFBFBD><DAB5><EFBFBD><EFBFBD><EFBFBD>,<2C><><EFBFBD>ַ<EFBFBD><D6B7><EFBFBD>
|
||||
uint32_t cfg_id; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ID
|
||||
uint32_t found_time; // <20><><EFBFBD><EFBFBD>ʱ<EFBFBD><CAB1>
|
||||
uint32_t cap_ip; // Ϊ<><CEAA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ
|
||||
uint8_t protocol; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Э<EFBFBD><D0AD>
|
||||
uint8_t service; // ҵ<><D2B5><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint8_t level; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ŷ<EFBFBD>
|
||||
uint8_t fd_type; // <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
||||
uint16_t opt_num; //ѡ<><D1A1><EFBFBD><EFBFBD>Ϣ<EFBFBD><CFA2>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>
|
||||
//struct opt_unit_t opt_info[opt_num]; //ѡ<><D1A1><EFBFBD><EFBFBD>Ϣ,<2C><><EFBFBD><EFBFBD>ʾ<EFBFBD>⣬<EFBFBD><E2A3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͷ<EFBFBD><CDB7>
|
||||
}__attribute__((packed))sip_surveylog_msg_body_t;
|
||||
|
||||
typedef struct sip_log_msg_header_s
|
||||
{
|
||||
uint16_t magic_num; // ħ<><C4A7><EFBFBD><EFBFBD>survey logֵ<67><D6B5><EFBFBD><EFBFBD>Ϊ0x5641 ; fulllogֵ<67><D6B5><EFBFBD><EFBFBD>Ϊ0x5632
|
||||
uint8_t cont_code:4; // <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ
|
||||
uint8_t version:4; // Э<><D0AD><EFBFBD>汾<EFBFBD><E6B1BE>Ŀǰֵ<C7B0><D6B5>3
|
||||
uint8_t msg_type; // <20><>Ϣ<EFBFBD><CFA2><EFBFBD><EFBFBD>
|
||||
uint32_t cont_len; // <20><>Ϣ<EFBFBD>岿<EFBFBD>ֵ<EFBFBD><D6B5>ֽڳ<D6BD><DAB3><EFBFBD>
|
||||
}sip_log_msg_header_t;
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
void free_media_sip(media_t* mdi);
|
||||
void free_frag_unit_sip_opt(frag_unit_t* frg_unit);
|
||||
|
||||
|
||||
int redis_sip_index_query(frag_unit_t* frg_unit, int thread_seq);
|
||||
int sip_index_query(frag_unit_t* frg_unit, int thread_seq);
|
||||
|
||||
|
||||
int sip_send_full_log(media_t* mdi);
|
||||
int sip_send_survey_log(media_t* mdi, char* survey, uint32_t survey_len);
|
||||
void send_sip_log_when_expire(media_t* mdi);
|
||||
|
||||
void proc_sip_opt(frag_unit_t* frg_unit, media_t* mdi);
|
||||
int proc_sip_mediainfo_opt(frag_unit_t* frg_unit, rssb_media_info_t* media_info);
|
||||
|
||||
|
||||
void set_frag_unit_from_media(media_t* mdi, frag_unit_t* frg_unit);
|
||||
void set_sip_frag_unit(rssb_media_info_t* media_info, frag_unit_t* frg_unit);
|
||||
int parse_sip_4tuple(char* str_4tuple,char* s_ip,char* s_port,char* c_ip,char* c_port);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
181
src/hard_keepalive.c
Normal file
181
src/hard_keepalive.c
Normal file
@@ -0,0 +1,181 @@
|
||||
|
||||
#include <sys/socket.h>
|
||||
#include <netinet/in.h>
|
||||
#include <pthread.h>
|
||||
#include <stdio.h>
|
||||
#include <stdlib.h>
|
||||
#include <unistd.h>
|
||||
#include <fcntl.h>
|
||||
#include <errno.h>
|
||||
#include <string.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/socket.h>
|
||||
#include <net/if.h>
|
||||
#include <netinet/in.h>
|
||||
#include <arpa/inet.h>
|
||||
#include <netdb.h>
|
||||
#include <sys/un.h>
|
||||
#include <stddef.h>//offsetof
|
||||
|
||||
#include "hard_keepalive.h"
|
||||
|
||||
int udp_socket_recv(int sockfd, uint32_t *src_ip, uint8_t *buf, uint32_t buf_size)
|
||||
{
|
||||
if (NULL == buf) return -1;
|
||||
|
||||
int numbytes;
|
||||
struct sockaddr_storage their_addr;
|
||||
socklen_t addr_len = sizeof(their_addr);
|
||||
|
||||
if ((numbytes = recvfrom(sockfd, buf, buf_size , 0,(struct sockaddr *)&their_addr, &addr_len)) == -1)
|
||||
{
|
||||
perror("recvfrom");
|
||||
return -1;
|
||||
}
|
||||
*src_ip = ((struct sockaddr_in *)&their_addr)->sin_addr.s_addr;
|
||||
return numbytes;
|
||||
}
|
||||
|
||||
// send udp packet
|
||||
int udp_socket_send(int sockfd, uint32_t addr, uint16_t port, char *data, int datalen)
|
||||
{
|
||||
struct sockaddr_in dst_addr; /* connector's address information */
|
||||
dst_addr.sin_family = AF_INET; /* host byte order */
|
||||
dst_addr.sin_port = port; /* short, network byte order */
|
||||
dst_addr.sin_addr.s_addr = addr;
|
||||
bzero(&(dst_addr.sin_zero), 8); /* zero the rest of the struct */
|
||||
int to_send_len=datalen;
|
||||
int already_sended_len=0;
|
||||
while(to_send_len>0)
|
||||
{
|
||||
already_sended_len=sendto(sockfd,data,
|
||||
to_send_len-already_sended_len,
|
||||
0,
|
||||
(struct sockaddr *)&(dst_addr),
|
||||
sizeof(dst_addr));
|
||||
if(already_sended_len==-1)
|
||||
{
|
||||
if((EAGAIN == errno)||( EINTR == errno )|| (EWOULDBLOCK==errno))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
else
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
}
|
||||
to_send_len-=already_sended_len;
|
||||
}
|
||||
return already_sended_len;
|
||||
}
|
||||
|
||||
int create_recv_udp_socket(uint16_t port)
|
||||
{
|
||||
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (-1 == sockfd)
|
||||
{
|
||||
perror("listener: socket");
|
||||
return -1;
|
||||
}
|
||||
struct sockaddr_in my_addr; /* my address information */
|
||||
my_addr.sin_family = AF_INET; /* host byte order */
|
||||
my_addr.sin_port = port; /* short, network byte order */
|
||||
my_addr.sin_addr.s_addr = INADDR_ANY; /* auto-fill with my IP */
|
||||
bzero(&(my_addr.sin_zero), 8); /* zero the rest of the struct */
|
||||
|
||||
if (bind(sockfd, (struct sockaddr *)&my_addr, sizeof(struct sockaddr)) == -1)
|
||||
{
|
||||
perror("listener: bind");
|
||||
close(sockfd);
|
||||
return -1;
|
||||
}
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
|
||||
int create_send_udp_socket()
|
||||
{
|
||||
int sockfd = socket(AF_INET, SOCK_DGRAM, 0);
|
||||
if (-1 == sockfd)
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
return sockfd;
|
||||
}
|
||||
|
||||
void* thread_hard_keepalive(void *param)
|
||||
{
|
||||
char buf[1500] = {0};
|
||||
long port = (long)param;
|
||||
int size = 0;
|
||||
uint32_t src_ip = 0;
|
||||
int send_rec = 0;
|
||||
fd_set rset;
|
||||
int recv_pkt_sd = create_recv_udp_socket(htons(port));
|
||||
int send_pkt_sd = create_send_udp_socket();
|
||||
|
||||
if(-1==recv_pkt_sd || -1==send_pkt_sd)
|
||||
{
|
||||
printf("hard_keepalive create socket error.\n");
|
||||
return NULL;
|
||||
}
|
||||
|
||||
while(1)
|
||||
{
|
||||
FD_ZERO(&rset);
|
||||
FD_SET(recv_pkt_sd,&rset);
|
||||
if(-1==select(recv_pkt_sd+1,&rset,NULL,NULL,NULL))
|
||||
{
|
||||
continue;
|
||||
}
|
||||
if(FD_ISSET(recv_pkt_sd, &rset))
|
||||
{
|
||||
size = udp_socket_recv(recv_pkt_sd, &src_ip, (unsigned char*)buf, sizeof(buf));
|
||||
if(size>0)
|
||||
{
|
||||
send_rec = udp_socket_send(send_pkt_sd,
|
||||
src_ip,
|
||||
htons(port),
|
||||
(char*)buf,size);
|
||||
if(-1==send_rec)
|
||||
{
|
||||
printf("hard_keepalive send pkt error.\n");
|
||||
}
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
continue;
|
||||
}
|
||||
}
|
||||
|
||||
return NULL;
|
||||
}
|
||||
|
||||
int hard_keepalive_run(uint32_t udp_port)
|
||||
{
|
||||
if(udp_port<=0) return -1;
|
||||
|
||||
pthread_t thread_desc;
|
||||
pthread_attr_t attr;
|
||||
|
||||
memset(&thread_desc, 0, sizeof(thread_desc));
|
||||
memset(&attr, 0, sizeof(attr));
|
||||
|
||||
if(0 != pthread_attr_init(&(attr)))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(0 != pthread_attr_setdetachstate(&(attr), PTHREAD_CREATE_DETACHED))
|
||||
{
|
||||
return -1;
|
||||
}
|
||||
if(0 != pthread_create(&(thread_desc), &(attr), thread_hard_keepalive, (void*)udp_port))
|
||||
{
|
||||
pthread_attr_destroy(&(attr));
|
||||
return -1;
|
||||
}
|
||||
pthread_attr_destroy(&(attr));
|
||||
return 0;
|
||||
}
|
||||
|
||||
18
src/hard_keepalive.h
Normal file
18
src/hard_keepalive.h
Normal file
@@ -0,0 +1,18 @@
|
||||
#ifndef _HARD_KEEPALIVE_H
|
||||
#define _HARD_KEEPALIVE_H
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*return 0:succ -1:fail*/
|
||||
int hard_keepalive_run(uint32_t udp_port);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
156
src/inc/MESA_timer.h
Normal file
156
src/inc/MESA_timer.h
Normal file
@@ -0,0 +1,156 @@
|
||||
/************************************************
|
||||
* MESA timer API
|
||||
* author:tangqi@iie.ac.cn,zhengchao@iie.ac.cn
|
||||
* version: v1.0
|
||||
* last modify:2015.08.18
|
||||
************************************************/
|
||||
|
||||
#ifndef _MESA_TIMER_INCLUDE_
|
||||
#define _MESA_TIMER_INCLUDE_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Timer's handler */
|
||||
typedef struct{
|
||||
}MESA_timer_t;
|
||||
|
||||
typedef struct{
|
||||
}MESA_timer_index_t;
|
||||
|
||||
typedef void (*timeout_cb_t)(void *event);
|
||||
typedef void (*event_free_cb_t)(void *event);
|
||||
|
||||
#define TM_TYPE_QUEUE 0
|
||||
#define TM_TYPE_WHEEL 1
|
||||
|
||||
#define MAX_WHEEL_SIZE 10000
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Create a timer with type of TS_TYPE. Until now we support queue
|
||||
* and time wheel.
|
||||
* Params:
|
||||
* wheel_size: When timer's type is TM_TYPE_QUEUE, wheel_size is unused. It is
|
||||
* the size to initlize time wheel
|
||||
* TS_TYPE: It is a micro defination for timer's type.
|
||||
* TM_TYPE_QUEUE represents double linedlist,
|
||||
* TM_TYPE_WHEEL represents time wheel.
|
||||
* Return:
|
||||
* On success, return a timer, else return NULL
|
||||
*
|
||||
**/
|
||||
MESA_timer_t *MESA_timer_create(long wheel_size, int TM_TYPE);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Add a timeout work to a given timer
|
||||
* Params:
|
||||
* timer: The timer returned by MESA_timer_create function.
|
||||
* current_time: The current time when add the timer element. It MUST >= 0
|
||||
* timeout: The work's timeout time. It MUST >= 0
|
||||
* timeout_cb: It is callback function of a work when timeout.
|
||||
* event: It is the event for user to define.
|
||||
* free_cb: event's free callback function.
|
||||
* index: Address(Index) of the timer_node pointer related to the event is
|
||||
* stored in index.
|
||||
* Return:
|
||||
* On success 0 is returned, else -1 is returned
|
||||
**/
|
||||
int MESA_timer_add(MESA_timer_t *timer,
|
||||
long current_time,
|
||||
long timeout,
|
||||
timeout_cb_t timeout_cb,
|
||||
void* event,
|
||||
event_free_cb_t free_cb,
|
||||
MESA_timer_index_t **index);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Delete a MESA_timer_index_t from timer, and then execute callback function.
|
||||
* Params:
|
||||
* timer: The timer created by MESA_timer_create.
|
||||
* index: MESA_timer_index_t structure returned by MESA_timer_add function.
|
||||
* Now we want to delete it.
|
||||
* Return:
|
||||
* On success, return the event's expire. Otherwise -1 is returned.
|
||||
**/
|
||||
long MESA_timer_del(MESA_timer_t *timer, MESA_timer_index_t *index);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* This function is called by user one or severial times every time_tick.
|
||||
* It will check event's in timer and find the events which are timeout.
|
||||
* Then invoke the callback function registered by related event.
|
||||
* Params:
|
||||
* timer: The same as upper funtion.
|
||||
* current_tick: Current time when call MESA_timer_check function. NOTE
|
||||
* that it is also absolute time, and have the same accuracy
|
||||
* with the timeout in function MESA_timer_add.
|
||||
* max_cb_times: Max times to call callback function.
|
||||
* Return:
|
||||
* Return execute times of callback if success, 0 means no timeout event.
|
||||
* Return -1 when error occurs.
|
||||
**/
|
||||
long MESA_timer_check(MESA_timer_t *timer, long current_time, long max_cb_times);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Destroy the given timer, free the memory and execute callback function.
|
||||
* Params:
|
||||
* timer: The timer we wants to destroy.
|
||||
* Return:
|
||||
* void
|
||||
**/
|
||||
|
||||
void MESA_timer_destroy(MESA_timer_t *timer);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Get the count of events in timer
|
||||
* Params:
|
||||
* timer: Timer returned by MESA_timer_create function.
|
||||
* Return:
|
||||
* Return the count of events in timer.
|
||||
**/
|
||||
long MESA_timer_count(MESA_timer_t *timer);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Get the memory of timer
|
||||
* Params:
|
||||
* timer: Timer returned by MESA_timer_create function.
|
||||
* Return:
|
||||
* Return the memory occupancy of timer.
|
||||
**/
|
||||
|
||||
long MESA_timer_memsize(MESA_timer_t *timer);
|
||||
|
||||
|
||||
/**
|
||||
* Description:
|
||||
* Reset an existing timer element to new current_time and timeout.
|
||||
* Params:
|
||||
* timer: The timer returned by MESA_timer_create function.
|
||||
* index: pointer to a pointer of timer element't index.
|
||||
* current_time: current time.
|
||||
* timeout: relative timeout of timer element.
|
||||
* Return:
|
||||
* On success, 0 is returned, else -1 is returned.
|
||||
**/
|
||||
int MESA_timer_reset(MESA_timer_t *timer, MESA_timer_index_t *index, long current_time, long timeout);
|
||||
void MESA_timer_idx_print(MESA_timer_index_t *index);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif //_MESA_TIMER_INCLUDE_
|
||||
147
src/inc/MESA_trace.h
Normal file
147
src/inc/MESA_trace.h
Normal file
@@ -0,0 +1,147 @@
|
||||
#ifndef _MESA_TRACE_H_
|
||||
#define _MESA_TRACE_H_
|
||||
|
||||
#include <netinet/in.h>
|
||||
#include <netinet/ip.h>
|
||||
#include <netinet/ip6.h>
|
||||
|
||||
#define H_TRACE_VERSION_1_20150204 0
|
||||
|
||||
typedef void* MESA_trace_addr_handle_t;
|
||||
typedef void* MESA_trace_fullstr_handle_t;
|
||||
typedef void* MESA_trace_substr_handle_t;
|
||||
typedef void* MESA_trace_numerical_handle_t;
|
||||
|
||||
struct trace_tuple4_v4
|
||||
{
|
||||
unsigned int saddr;
|
||||
unsigned int daddr;
|
||||
unsigned short source;
|
||||
unsigned short dest;
|
||||
};
|
||||
|
||||
#ifndef IPV6_ADDR_LEN
|
||||
#define IPV6_ADDR_LEN (sizeof(struct in6_addr))
|
||||
#endif
|
||||
|
||||
struct trace_tuple4_v6
|
||||
{
|
||||
unsigned char saddr[IPV6_ADDR_LEN] ;
|
||||
unsigned char daddr[IPV6_ADDR_LEN] ;
|
||||
unsigned short source;
|
||||
unsigned short dest;
|
||||
};
|
||||
|
||||
enum trace_addr_type_t
|
||||
{
|
||||
_TRACE_ADDR_TYPE_INIT = 0,
|
||||
TRACE_ADDR_TYPE_IPV4 = 1,
|
||||
TRACE_ADDR_TYPE_IPV6 = 2,
|
||||
TRACE__ADDR_TYPE_IP_PAIR_V4 = 12,
|
||||
TRACE__ADDR_TYPE_IP_PAIR_V6 = 13,
|
||||
};
|
||||
|
||||
/*stream.h*/
|
||||
typedef struct
|
||||
{
|
||||
unsigned char addrtype;
|
||||
unsigned char pkttype;
|
||||
unsigned char addrlen;
|
||||
unsigned char __pad[5];
|
||||
union
|
||||
{
|
||||
struct trace_tuple4_v4 *tuple4_v4;
|
||||
struct trace_tuple4_v6 *tuple4_v6;
|
||||
};
|
||||
}trace_layer_addr;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"
|
||||
{
|
||||
#endif
|
||||
|
||||
/*-------------------------------Part1-------------------------------------------*/
|
||||
/*
|
||||
*Paras: logger: trace runtime_log; filename: configure file
|
||||
*Return: addr_trace_handle_t, NULL means error.
|
||||
*configure file form: addr_type\tsip\tsource\tdip\tdest (separator : '\t', ' ', ';')
|
||||
*such as:
|
||||
*4 192.168.10.147 125 10.10.6.203 80
|
||||
*6 10::25:156::5 20662 10::25:156::45 80
|
||||
*4 0 0 0 0 0 (means all IPV4 tuple4)
|
||||
*6 0 0 0 0 0 (means all IPV6 tuple4)
|
||||
*/
|
||||
MESA_trace_addr_handle_t MESA_trace_create_addr_handle(void* logger, const char *filename);
|
||||
/*
|
||||
*Paras: handle: addr_trace_handle_t paddr:addr
|
||||
*Return: 1 when match success, return 0 when match failed
|
||||
*/
|
||||
int MESA_trace_match_addr(MESA_trace_addr_handle_t handle, trace_layer_addr *paddr);
|
||||
void MESA_trace_destory_addr_handle(MESA_trace_addr_handle_t handle);
|
||||
/*--------------------------------Part2------------------------------------------*/
|
||||
/*
|
||||
*Paras: logger: trace runtime_log; filename: configure file
|
||||
*Return: trace_substr_handle_t
|
||||
*configure file form: string
|
||||
*such as:
|
||||
*192.168.10.123:26662
|
||||
*10:25::68:58
|
||||
*then 192.168.10.123:2545-55.25.65.55:123 will match
|
||||
*/
|
||||
MESA_trace_substr_handle_t MESA_trace_create_substr_handle(void* logger, const char *filename);
|
||||
/*
|
||||
*Paras: handle: trace_substr_handle_t ; str: str_len:
|
||||
*Return: 1 when match success, return 0 when match failed
|
||||
*func: sub match
|
||||
*/
|
||||
int MESA_trace_match_substr(MESA_trace_substr_handle_t handle, const char *str, int str_len);
|
||||
void MESA_trace_destory_substr_handle(MESA_trace_substr_handle_t handle);
|
||||
|
||||
/*-------------------------------Part3-------------------------------------------*/
|
||||
/*
|
||||
*Paras: logger: trace runtime_log; filename: configure file
|
||||
*Return: trace_fullstr_handle_t
|
||||
*configure file form: string
|
||||
*such as:
|
||||
*HTTP
|
||||
*MAIL
|
||||
*then HTTP will match , HTTP_UP will not match
|
||||
*/
|
||||
MESA_trace_fullstr_handle_t MESA_trace_create_fullstr_handle(void* logger, const char *filename);
|
||||
/*
|
||||
*Paras: handle: addr_trace_handle_t ; str: str_len:
|
||||
*Return: 1 when match success, return 0 when match failed
|
||||
*func: complete match
|
||||
*/
|
||||
int MESA_trace_match_fullstr(MESA_trace_fullstr_handle_t handle, const char *str, int str_len);
|
||||
void MESA_trace_destory_fullstr_handle(MESA_trace_fullstr_handle_t handle);
|
||||
|
||||
|
||||
/*-------------------------------Part4-------------------------------------------*/
|
||||
/*
|
||||
*Paras: logger: trace runtime_log; filename: configure file
|
||||
*Return: trace_fullstr_handle_t
|
||||
*configure file form: string
|
||||
*such as:
|
||||
*HTTP
|
||||
*MAIL
|
||||
*then HTTP will match , HTTP_UP will not match
|
||||
*/
|
||||
MESA_trace_numerical_handle_t MESA_trace_create_numerical_handle(void* logger, const char *filename);
|
||||
|
||||
/*
|
||||
*Paras: handle: addr_trace_handle_t ; str: str_len:
|
||||
*Return: 1 when match success, return 0 when match failed
|
||||
*func: complete match
|
||||
*/
|
||||
int MESA_trace_match_numerial(MESA_trace_numerical_handle_t handle, uint64_t value);
|
||||
void MESA_trace_destory_numberial_handle(MESA_trace_numerical_handle_t handle);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
35
src/inc/app_detect.h
Normal file
35
src/inc/app_detect.h
Normal file
@@ -0,0 +1,35 @@
|
||||
#ifndef __APP_DETECT_H__
|
||||
#define __APP_DETECT_H__
|
||||
|
||||
#define TUPLE4_TYPE_V4 1
|
||||
#define TUPLE4_TYPE_V6 2
|
||||
|
||||
typedef enum __APP_TYPE
|
||||
{
|
||||
APP_TYPE_UNKNOWN=1,
|
||||
APP_TYPE_ANDROID,
|
||||
APP_TYPE_IOS,
|
||||
}APP_TYPE_t;
|
||||
|
||||
typedef struct __appdtc_detail
|
||||
{
|
||||
char *tuple4;
|
||||
char *user_agent;
|
||||
char *url;
|
||||
void *app_data;
|
||||
unsigned int tuple4_len;
|
||||
unsigned short app_type; //APP_TYPE_t
|
||||
unsigned int ua_len;
|
||||
unsigned int url_len;
|
||||
unsigned long long data_len;
|
||||
unsigned long long appid;
|
||||
}appdtc_detail_t;
|
||||
|
||||
typedef void * appdtc_handle_t;
|
||||
|
||||
extern "C" appdtc_handle_t APPDETECT_PLUG_INIT(int thread_num, const char *conf_file_name);
|
||||
//<2F><><EFBFBD><EFBFBD>ֵ: 0-succ
|
||||
extern "C" int APPDTC_PLUG_ENTRY(appdtc_handle_t handle, appdtc_detail_t *detail, unsigned int thread_id);
|
||||
|
||||
#endif
|
||||
|
||||
25
src/inc/appdsender.h
Normal file
25
src/inc/appdsender.h
Normal file
@@ -0,0 +1,25 @@
|
||||
#ifndef _APPDSENDER_H
|
||||
#define _APPDSENDER_H
|
||||
|
||||
#include "opt.h"
|
||||
#include "MESA_tcp_interface.h"
|
||||
|
||||
typedef void* appdsender_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*gloable init*/
|
||||
int init_appdsender(int iovalue, int thread_num, uint32 local_ip_nr);
|
||||
void release_appdsender();
|
||||
|
||||
appdsender_t creat_appdsender(uint32 sendip, uint16 port, char is_trace, const char* fileinfo,int thread_seq);
|
||||
int appdsender(appdsender_t handle, opt_t opt, int thread_seq);
|
||||
void destory_appdsender(appdsender_t handle, int thread_seq);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
76
src/inc/asmis_log.h
Normal file
76
src/inc/asmis_log.h
Normal file
@@ -0,0 +1,76 @@
|
||||
#ifndef __ASMIS_LOG_H
|
||||
#define __ASMIS_LOG_H
|
||||
#ifndef __cplusplus
|
||||
#error("This file should be compiled with C++ compiler")
|
||||
#endif
|
||||
#include <stdlib.h>
|
||||
#include <stdio.h>
|
||||
#include <string.h>
|
||||
#include <time.h>
|
||||
#include <sys/types.h>
|
||||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <netinet/in.h>
|
||||
#include <net/if.h>
|
||||
#include <sys/ioctl.h>
|
||||
#include <arpa/inet.h>
|
||||
|
||||
//#include <support/thread_safe.h>
|
||||
|
||||
#define ASMIS_KEY 0x01
|
||||
#define ASMIS_ALARM 0x02
|
||||
#define ASMIS_OTHER 0x03
|
||||
|
||||
#define ASMIS_LOGMSG_TIMEOUT 300 //second
|
||||
#define ASMIS_LOGMSG_LENGTH 40000 //bytes
|
||||
|
||||
//系统使用端口信息结构体
|
||||
struct info_port_used {
|
||||
unsigned short nPort;
|
||||
unsigned char nProtocolType;
|
||||
unsigned char nPortType;
|
||||
char sPortDesc[128];
|
||||
};
|
||||
|
||||
//系统实时流量信息结构体
|
||||
struct info_rtd_flow {
|
||||
char sValType[32];
|
||||
char sBDType[32];
|
||||
time_t nRTTS;
|
||||
int nDuration;
|
||||
unsigned long long nValue;
|
||||
};
|
||||
|
||||
//系统策略更新信息结构体
|
||||
struct info_policy_update {
|
||||
char sName[128];
|
||||
char sDesc[256];
|
||||
time_t nUpdateTime;
|
||||
char sVersion[33];
|
||||
int nTotal;
|
||||
int nNew;
|
||||
int nDelete;
|
||||
int nUpdate;
|
||||
int nSize;
|
||||
};
|
||||
|
||||
//NetLog初始化
|
||||
void* asmis_log_Init(const char *pProcName);
|
||||
//登记程序版本信息
|
||||
int asmis_log_AppVer(void* netlog_handle,const char *pVersionTime, const char *pVersionNO, const char *pVersionDesc);
|
||||
//系统运行日志
|
||||
int asmis_log_LogMsg(void* netlog_handle,const char *pMsg, const char *pNo, int nAlarmType);
|
||||
//登记系统使用端口
|
||||
int asmis_log_PortUsed(void* netlog_handle,struct info_port_used *info, int nPort);
|
||||
//登记系统实时流量信息
|
||||
int asmis_log_RtdFlow(void* netlog_handle,time_t nStartTime, int nDuration, struct info_rtd_flow *info, int nFlow);
|
||||
//登记系统开始运行
|
||||
int asmis_log_RunStart(void* netlog_handle,int nContiRun);
|
||||
//登记系统停止信息
|
||||
int asmis_log_RunStop(void* netlog_handle,int nContiRun);
|
||||
//心跳信息
|
||||
int asmis_log_HeartBeat(void* netlog_handle,const char *pMsg);
|
||||
//策略更新信息
|
||||
int asmis_log_Policy(void* netlog_handle,struct info_policy_update *info, int nPolicy);
|
||||
|
||||
#endif
|
||||
161
src/inc/bizman.h
Normal file
161
src/inc/bizman.h
Normal file
@@ -0,0 +1,161 @@
|
||||
/*Businessman Data Exchange System
|
||||
*Based on the short story "The fisherman and the businessman"
|
||||
*Author:zhengchao@iie.ac.cn
|
||||
*History:2011-08-24 first build;
|
||||
2011-09-20 v0.01 start test;
|
||||
2011-12-31 v0.02 multi bug fixed;
|
||||
2012-01-16 memset 1MB memory can cause obvious performance reduction;
|
||||
2012-01-19 v0.03 1)support multi cast interface
|
||||
2)support smooth by dest ip and port;
|
||||
2012-03-06 v0.04 1)fix crash recovery bug;
|
||||
2)support chunk mode receive;
|
||||
3)support push send,send immediately after smooth without timeout;
|
||||
2012-03-08 v0.05 1)add choke recv mode,recv will blocked if no data in bizman;
|
||||
2012-03-12 v0.06 1)add magic number as packet header check;
|
||||
2)fix bug,when receiver crash restore leave gabarge in to_ack_timout_queue and
|
||||
ready_index_queue;
|
||||
2012-03-13 v0.07 1)count_last_frag_num_in_packet bug fixed;
|
||||
2)defrozen failed bug caused by no sendtimes reset fixed;
|
||||
3)fix memleaks at destory sender when receiver crush;
|
||||
2012-03-15 v0.07 1)fix copy_recv_data's queue operation before mutex;
|
||||
2)defrozen stream's first slice maybe incomplete is normal,because its previous part
|
||||
have been abandoned;
|
||||
2012-03-19 v0.08 1)add use pag(special network interface)send packets;
|
||||
2012-03-20 v0.09 1)reconstruct bizman.h,hide internal information to outside;
|
||||
2012-03-21 v0.10 1)use define instead of const in bizman.h
|
||||
2)rename functions in hash.cpp,to avoid function name collision in link
|
||||
2012-03-22 v0.11 1)add simple statistic,read reliable layer's stream first packet send and resend count;
|
||||
2012-03-26 v0.12 add reliable receive stream expire,fix stream expire bug in reliabe send;
|
||||
2012-03-29 v0.13 1)fix stream expire bug in reliable receive;
|
||||
2) improve send and resend statistic;
|
||||
2012-04-01 v0.14 1)fix bug when receive reduandent force establish stream packet reduandent, cause
|
||||
app receive duplicate app data.Add force establish stream interval to fix this bug;
|
||||
2)On heavy load,may expire send stream which have in use task, will screwed queue,
|
||||
fixed by check stream's in_use_task_num before expired;
|
||||
2012-04-11 v0.15 1)add sender cached packets limit;
|
||||
2)stat dropped pkts;
|
||||
3)fix bugs, send smooth stream expire time + max resend interval *2 = reliabe recv stream
|
||||
expire time,send smooth stream expire time > reliable send time;
|
||||
2012-04-12 v0.16 1)rebuild stat interface;
|
||||
2)fix bugs of memory corrupt caused by thread conflict when recv,enlarge mutex proctect
|
||||
range;
|
||||
2012-04-14 v0.18 1)fix do_actual_send's sendto return value judgemen;
|
||||
2)fix add_raw_packet function false abandon dup START_SEQ_NUM,also lose first sequence
|
||||
when receiver unordered sequence ;
|
||||
2012-05-11 v0.19 1)fix sender's smooth default interval zero bug;
|
||||
2)fix FORCE_EST_INTERVAL 20min(1000000ms) bug,sho
|
||||
3)fix receiver's ack smooth default interval 10s bug;
|
||||
2012-05-24 v0.20 1)fix smooth block may copy expired father stream bug;
|
||||
2)use mutex_lock instead of try_lock to get smoothed block;
|
||||
3)add thread smooth space limit;
|
||||
2012-06-11 v0.21 1)add choke recv timeout feature;
|
||||
2012-06-18 v0.22 1)businesman_limit.h TIMEOUT_RECV_STREAM_USEC init read array overflow;
|
||||
2)smooth send and reliable send stream expire after send data,a busy receiver may drop lazy
|
||||
sender's packet,move expire operation in front of send;
|
||||
2012-07-24 v1.0 1)check slice_len in is_bizman_packet;
|
||||
2013-03-20 v1.01 1)shorten mutex contension area in recv;
|
||||
2)fix add_raw_packet bugs of filling wrong sequence in ack packet,which caused 250Mbps bottleneck;
|
||||
2013-05-14 v1.02 fix unreliable packet receive dead lock bug in add_raw_packet,caused by v1.01 shorten mutex improvement;
|
||||
2013-06-19 v1.03 1)fix isolate_recv_record dead lock;
|
||||
2)last_send_time type is uint ,cause overflow,change to time_tick_t;
|
||||
2013-07-02 v1.04 v1.01 shorten mutex proved wrong,called deadlock,backward.
|
||||
2013-10-28 v1.05 Not set chunk end after read uncomplete slice.
|
||||
TODO: 1)add select unreachable error;
|
||||
2)add send file interface,save one memory copy time;
|
||||
3)add max memory used limited;
|
||||
|
||||
NOTICE: 1)recv function is NOT thread safe,MUST use your own mutex lock protect the handle;
|
||||
2)send function is thread safe when you send with differenct thread id,but call send function\
|
||||
with the same thread id in different thread is NOT safe;
|
||||
3)unsigned short port is host order,unsigned int ip address is network layer.
|
||||
4)compatible with gcc,link with -lstdc++
|
||||
*/
|
||||
#ifndef _BIZMAN_HEADER_INCLUDE_
|
||||
#define _BIZMAN_HEADER_INCLUDE_
|
||||
|
||||
//initial flag
|
||||
#define BIZMAN_SENDER_ACTIVE 0x01
|
||||
#define BIZMAN_RECEIVER_ACTIVE 0x02
|
||||
|
||||
#define BIZMAN_CHUNK_RECEIVE 0x08
|
||||
#define BIZMAN_CHOKE_RECEIVE 0x10
|
||||
|
||||
|
||||
//set option
|
||||
#define BIZMAN_OPT_SOCKET_INTERFACE_NAME 0x00
|
||||
#define BIZMAN_OPT_PAG_INTERFACE_NAME 0x01
|
||||
|
||||
//set parameter
|
||||
#define BIZMAN_PARAMETER_SEND_SMOOTH_TIME_MSEC 0x01
|
||||
#define BIZMAN_PARAMETER_RESEND_BASE_MSEC 0x02
|
||||
#define BIZMAN_PARAMETER_RESEND_TIMES 0x03 //5 at most
|
||||
#define BIZMAN_PARAMETER_SEND_CACHE_PKTS_LIMIT 0x04
|
||||
#define BIZMAN_PARAMETER_ACK_ACCUMULATE_NUM 0x05
|
||||
#define BIZMAN_PARAMETER_ACK_ACCUMULATE_MSEC 0x06
|
||||
#define BIZMAN_PARAMETER_SEND_WINDOWSIZE 0x07
|
||||
#define BIZMAN_PARAMETER_RECV_WINDOWSIZE 0x08
|
||||
#define BIZMAN_PARAMETER_ACK_SMOOTH_TIME_MSEC 0x09
|
||||
#define BIZMAN_PARAMETER_FROZEN_STREAM_MSEC 0x0a
|
||||
#define BIZMAN_PARAMETER_SMOOTH_CACHE_PKTS_LIMIT 0x0b
|
||||
|
||||
#define BIZMAN_PARAMETER_CHUNK_RECEIVE 0x10
|
||||
#define BIZMAN_PARAMETER_CHOKE_RECEIVE 0x11
|
||||
#define BIZMAN_PARAMETER_CHOKE_RECV_TIMEOUT_MSEC 0x12
|
||||
|
||||
//send flag
|
||||
#define BIZMAN_RELIABLE_SEND 0x01
|
||||
#define BIZMAN_UNRELIABLE_SEND 0x00
|
||||
#define BIZMAN_LAST_PKT 0x02
|
||||
#define BIZMAN_PUSH_SEND 0x04
|
||||
#define BIZMAN_SMOOTH_DEST 0x08
|
||||
|
||||
|
||||
//recv flag
|
||||
#define BIZMAN_READ_CRAM 0x00
|
||||
#define BIZMAN_READ_STREAM 0x01
|
||||
#define BIZMAN_READ_CHUNK 0x02
|
||||
|
||||
//stat
|
||||
#define BIZMAN_STAT_FIRST_SEND_PKTS 0x01
|
||||
#define BIZMAN_STAT_FIRST_RESEND_PKTS 0x02
|
||||
#define BIZMAN_STAT_LAST_RESEND 0x03
|
||||
#define BIZMAN_STAT_MEM_DROPPED 0x04
|
||||
#define BIZMAN_STAT_FROZEN_DROPPED 0x05
|
||||
#define BIZMAN_STAT_ACK_PKT_NUM 0x06
|
||||
#define BIZMAN_STAT_FIRST_SEND_STREAM 0x07
|
||||
#define BIZMAN_STAT_FIRST_RESEND_STREAM 0x08
|
||||
#define BIZMAN_STAT_ACTIVE_STREAM 0x09
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
/*
|
||||
*return an unintialized handle when success;
|
||||
*return NULL when failed.
|
||||
*/
|
||||
void *bizman_get_handle(void);
|
||||
void bizman_destroy_handle(void * raw_handle);
|
||||
/*
|
||||
BIZMAN_SENDER_ACTIVE:0x01;BIZMAN_RECEIVER_ACTIVE:0x02;BIZMAN_PAG_USE:0x04;
|
||||
*/
|
||||
int bizman_set_handle(void* raw_handle,unsigned short flags);
|
||||
int bizman_set_handle_option(void* raw_handle,int option_type, const char* option_value);
|
||||
int bizman_set_handle_parameter(void* raw_handle,int type, unsigned int value);
|
||||
//only used on sender
|
||||
int bizman_set_pkts_cached_limit(void* raw_handle,unsigned long long cached_pkts_limit);
|
||||
|
||||
//unsigned short port is host order,unsigned int ip address is network layer.
|
||||
int bizman_listen(void* raw_handle,unsigned short port);
|
||||
int bizman_init_handle(void* raw_handle);
|
||||
|
||||
int bizman_recv(void* raw_handle,char* buff,int buf_len,unsigned int *src_ip,unsigned short *src_port,unsigned int *stream_id,unsigned int* is_complete);
|
||||
int bizman_send(void* raw_handle,unsigned int thread_id,unsigned int dest_ip,unsigned short dest_port,
|
||||
const char*data,unsigned int len,unsigned long long app_id,unsigned short flags);
|
||||
int bizman_multi_send(void* raw_handle,unsigned int thread_id,const unsigned int *dest_ip,const unsigned short *dest_port,unsigned int dest_num,
|
||||
const char*data,unsigned int len,unsigned long long app_id,unsigned short flags);
|
||||
unsigned long long bizman_stat(void* raw_handle,int type);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
26
src/inc/dynamic_array.h
Normal file
26
src/inc/dynamic_array.h
Normal file
@@ -0,0 +1,26 @@
|
||||
#ifndef _DYNAMIC_ARRAY_H_
|
||||
#define _DYNAMIC_ARRAY_H_
|
||||
|
||||
#define DYNAMIC_ARRAY_DEBUG (1)
|
||||
|
||||
typedef void * maskey_dynamic_array_handle;
|
||||
|
||||
typedef int (* maskey_dynamic_array_init_cb)(void *struct_data);
|
||||
typedef int (* maskey_dynamic_array_iterate_cb)(int index, void *struct_data, void *user_arg);
|
||||
typedef int (* maskey_dynamic_array_safe_copy_cb)(int index, void *new_data, void *old_data);
|
||||
|
||||
maskey_dynamic_array_handle maskey_dynamic_array_init(int struct_len, int array_init_num, int array_max_num);
|
||||
maskey_dynamic_array_handle maskey_dynamic_array_init_with_cb(int struct_len, int array_init_num,
|
||||
int array_max_num, maskey_dynamic_array_init_cb init_cb);
|
||||
void maskey_dynamic_array_destroy(maskey_dynamic_array_handle dah, maskey_dynamic_array_iterate_cb cb, void *);
|
||||
int maskey_dynamic_array_append(maskey_dynamic_array_handle dah, void *struct_data, int struct_len);
|
||||
int maskey_dynamic_array_append_distinct(maskey_dynamic_array_handle dah, void *struct_data, int struct_len);
|
||||
void *maskey_dynamic_array_fetch(maskey_dynamic_array_handle dah, int index);
|
||||
int maskey_dynamic_array_get_num(maskey_dynamic_array_handle dah);
|
||||
void *maskey_dynamic_array_get_data(maskey_dynamic_array_handle dah);
|
||||
void *maskey_dynamic_array_get_last_item(maskey_dynamic_array_handle dah);
|
||||
int maskey_dynamic_array_iterate(maskey_dynamic_array_handle dah, maskey_dynamic_array_iterate_cb cb, void *user_arg);
|
||||
maskey_dynamic_array_handle maskey_dynamic_array_quick_copy(maskey_dynamic_array_handle old_dah);
|
||||
|
||||
#endif
|
||||
|
||||
66
src/inc/field_stat2.h
Normal file
66
src/inc/field_stat2.h
Normal file
@@ -0,0 +1,66 @@
|
||||
#ifndef H_SCREEN_STAT_H_INCLUDE
|
||||
#define H_SCREEN_STAT_H_INCLUDE
|
||||
#include <stdio.h>
|
||||
|
||||
#ifndef __cplusplus
|
||||
#error("This file should be compiled with C++ compiler")
|
||||
#endif
|
||||
|
||||
enum field_dsp_style_t
|
||||
{
|
||||
FS_STYLE_FIELD=0,
|
||||
FS_STYLE_COLUMN,
|
||||
FS_STYLE_LINE,
|
||||
FS_STYLE_STATUS
|
||||
};
|
||||
enum field_calc_algo
|
||||
{
|
||||
FS_CALC_CURRENT=0,
|
||||
FS_CALC_SPEED
|
||||
};
|
||||
enum field_op
|
||||
{
|
||||
FS_OP_ADD=1,
|
||||
FS_OP_SET
|
||||
};
|
||||
|
||||
|
||||
typedef void* screen_stat_handle_t;
|
||||
|
||||
enum FS_option
|
||||
{
|
||||
OUTPUT_DEVICE, //VALUE is a const char*, indicate a file path string, SIZE = strlen(string+'\0')+1.DEFAULT:output to stdout.
|
||||
PRINT_MODE, //VALUE is an interger,1:Rewrite ,2: Append. SIZE=4,DEFALUT:REWRITE.
|
||||
STAT_CYCLE, //VALUE is an interger idicate interval seconds of every output, SIZE=4 ,DEFUALT:2 seconds.
|
||||
PRINT_TRIGGER, //VALUE is an interger,1:Do print,0: Don't print.SIZE=4.DEFAULT:1.
|
||||
CREATE_THREAD, //VALUE is an interger,1: Create a print thread,0:not create,output by call passive_output function,
|
||||
//and the STAT_CYCLE is meaningless.SIZE=4,DEFAULT:0.
|
||||
ID_INVISBLE, //value is field_id/status_id/column_id, not output this string, SIZE=4,DEFAULT: shutdown NO one.
|
||||
FLUSH_BY_DATE, //value is 1(ture) or 0(false),SIZE=4,DEFAULT: Do not flush by date.
|
||||
APP_NAME, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT is "?".
|
||||
STATS_SERVER_IP, //VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. No DEFAULT.
|
||||
STATS_SERVER_PORT, //VALUE is a unsigned short, host order, SIZE= sizeof(unsigned short). No DEFAULT.
|
||||
};
|
||||
|
||||
//Always success.
|
||||
screen_stat_handle_t FS_create_handle(void);
|
||||
|
||||
int FS_set_para(screen_stat_handle_t handle, enum FS_option type,const void* value,int size);
|
||||
void FS_start(screen_stat_handle_t handle);
|
||||
void FS_stop(screen_stat_handle_t* handle);
|
||||
|
||||
//return field_id/line_id/column_id greater than zero if success,return an interger less than zero if failed.
|
||||
//should NOT include "|:\n\r.\t<>[]#!@"or space in the parameter name.
|
||||
int FS_register(screen_stat_handle_t handle,enum field_dsp_style_t style,enum field_calc_algo calc_type,const char* name);
|
||||
|
||||
//numerator_id and denominator_id must be column/field/status style.
|
||||
//scaling: negative value: zoom in; positive value: zoom out;
|
||||
int FS_register_ratio(screen_stat_handle_t handle,int numerator_id,int denominator_id,int scaling,enum field_dsp_style_t style,enum field_calc_algo calc_type,const char* name);
|
||||
|
||||
//id: when id's type is FIELD , column_id is ignore.
|
||||
int FS_operate(screen_stat_handle_t handle,int id,int column_id,enum field_op op,long long value);
|
||||
|
||||
void FS_passive_output(screen_stat_handle_t handle);
|
||||
|
||||
#endif
|
||||
|
||||
187
src/inc/hircluster.h
Normal file
187
src/inc/hircluster.h
Normal file
@@ -0,0 +1,187 @@
|
||||
#ifndef __HIRCLUSTER_H
|
||||
#define __HIRCLUSTER_H
|
||||
|
||||
#include "hiredis.h"
|
||||
#include "async.h"
|
||||
#include "command.h"
|
||||
#define HIREDIS_VIP_MAJOR 0
|
||||
#define HIREDIS_VIP_MINOR 2
|
||||
#define HIREDIS_VIP_PATCH 2
|
||||
|
||||
#define REDIS_CLUSTER_SLOTS 16384
|
||||
|
||||
#define REDIS_ROLE_NULL 0
|
||||
#define REDIS_ROLE_MASTER 1
|
||||
#define REDIS_ROLE_SLAVE 2
|
||||
|
||||
|
||||
#define HIRCLUSTER_FLAG_NULL 0x0
|
||||
/* The flag to decide whether add slave node in
|
||||
* redisClusterContext->nodes. This is set in the
|
||||
* least significant bit of the flags field in
|
||||
* redisClusterContext. (1000000000000) */
|
||||
#define HIRCLUSTER_FLAG_ADD_SLAVE 0x1000
|
||||
/* The flag to decide whether add open slot
|
||||
* for master node. (10000000000000) */
|
||||
#define HIRCLUSTER_FLAG_ADD_OPENSLOT 0x2000
|
||||
/* The flag to decide whether add open slot
|
||||
* for master node. (100000000000000) */
|
||||
#define HIRCLUSTER_FLAG_ROUTE_USE_SLOTS 0x4000
|
||||
|
||||
/*
|
||||
The following flags are used for deciding which part of IP will
|
||||
be used when the salve for reading is enabled
|
||||
*/
|
||||
#define HIRCLUSTER_FLAG_UNIQIP_FRAG_ONE 0x100
|
||||
#define HIRCLUSTER_FLAG_UNIQIP_FRAG_TWO 0x200
|
||||
#define HIRCLUSTER_FLAG_UNIQIP_FRAG_THREE 0x400
|
||||
#define HIRCLUSTER_FLAG_UNIQIP_FRAG_FOUR 0x800
|
||||
|
||||
struct dict;
|
||||
struct hilist;
|
||||
|
||||
typedef struct cluster_node
|
||||
{
|
||||
sds name;
|
||||
sds addr;
|
||||
sds host;
|
||||
int port;
|
||||
uint8_t role;
|
||||
uint8_t myself; /* myself ? */
|
||||
redisContext *con;
|
||||
redisAsyncContext *acon;
|
||||
struct hilist *slots;
|
||||
struct hilist *slaves;
|
||||
int failure_count;
|
||||
void *data; /* Not used by hiredis */
|
||||
struct hiarray *migrating; /* copen_slot[] */
|
||||
struct hiarray *importing; /* copen_slot[] */
|
||||
}cluster_node;
|
||||
|
||||
typedef struct cluster_slot
|
||||
{
|
||||
uint32_t start;
|
||||
uint32_t end;
|
||||
cluster_node *node; /* master that this slot region belong to */
|
||||
}cluster_slot;
|
||||
|
||||
typedef struct copen_slot
|
||||
{
|
||||
uint32_t slot_num; /* slot number */
|
||||
int migrate; /* migrating or importing? */
|
||||
sds remote_name; /* name for the node that this slot migrating to/importing from */
|
||||
cluster_node *node; /* master that this slot belong to */
|
||||
}copen_slot;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* Context for a connection to Redis cluster */
|
||||
typedef struct redisClusterContext {
|
||||
int err; /* Error flags, 0 when there is no error */
|
||||
char errstr[128]; /* String representation of error when applicable */
|
||||
sds ip;
|
||||
sds *uni_ipfrag;
|
||||
int ipfrag_count;
|
||||
int port;
|
||||
|
||||
int flags;
|
||||
|
||||
enum redisConnectionType connection_type;
|
||||
struct timeval *timeout;
|
||||
|
||||
struct hiarray *slots;
|
||||
|
||||
struct dict *nodes;
|
||||
cluster_node *table[REDIS_CLUSTER_SLOTS];
|
||||
|
||||
uint64_t route_version;
|
||||
|
||||
int max_redirect_count;
|
||||
int retry_count;
|
||||
|
||||
struct hilist *requests;
|
||||
|
||||
int need_update_route;
|
||||
int64_t update_route_time;
|
||||
} redisClusterContext;
|
||||
|
||||
redisClusterContext *redisClusterConnect(const char *addrs, int flags);
|
||||
redisClusterContext *redisClusterConnectWithTimeout(const char *addrs,
|
||||
const struct timeval tv, int flags);
|
||||
redisClusterContext *redisClusterConnectNonBlock(const char *addrs, int flags);
|
||||
|
||||
void redisClusterFree(redisClusterContext *cc);
|
||||
|
||||
void redisClusterSetMaxRedirect(redisClusterContext *cc, int max_redirect_count);
|
||||
|
||||
void *redisClusterFormattedCommand(redisClusterContext *cc, char *cmd, int len);
|
||||
void *redisClustervCommand(redisClusterContext *cc, const char *format, va_list ap);
|
||||
void *redisClusterCommand(redisClusterContext *cc, const char *format, ...);
|
||||
void *redisClusterCommandArgv(redisClusterContext *cc, int argc, const char **argv, const size_t *argvlen);
|
||||
|
||||
redisContext *ctx_get_by_node(redisClusterContext *cc, struct cluster_node *node, const struct timeval *timeout, int flags);
|
||||
|
||||
int redisClusterAppendFormattedCommand(redisClusterContext *cc, char *cmd, int len);
|
||||
int redisClustervAppendCommand(redisClusterContext *cc, const char *format, va_list ap);
|
||||
int redisClusterAppendCommand(redisClusterContext *cc, const char *format, ...);
|
||||
int redisClusterAppendCommandArgv(redisClusterContext *cc, int argc, const char **argv, const size_t *argvlen);
|
||||
int redisClusterGetReply(redisClusterContext *cc, void **reply);
|
||||
void redisCLusterReset(redisClusterContext *cc);
|
||||
|
||||
int cluster_update_route(redisClusterContext *cc);
|
||||
int test_cluster_update_route(redisClusterContext *cc);
|
||||
struct dict *parse_cluster_nodes(redisClusterContext *cc, char *str, int str_len, int flags);
|
||||
struct dict *parse_cluster_slots(redisClusterContext *cc, redisReply *reply, int flags);
|
||||
|
||||
|
||||
/*############redis cluster async############*/
|
||||
|
||||
struct redisClusterAsyncContext;
|
||||
|
||||
typedef int (adapterAttachFn)(redisAsyncContext*, void*);
|
||||
|
||||
typedef void (redisClusterCallbackFn)(struct redisClusterAsyncContext*, void*, void*);
|
||||
|
||||
/* Context for an async connection to Redis */
|
||||
typedef struct redisClusterAsyncContext {
|
||||
|
||||
redisClusterContext *cc;
|
||||
|
||||
/* Setup error flags so they can be used directly. */
|
||||
int err;
|
||||
char errstr[128]; /* String representation of error when applicable */
|
||||
|
||||
/* Not used by hiredis */
|
||||
void *data;
|
||||
|
||||
void *adapter;
|
||||
adapterAttachFn *attach_fn;
|
||||
|
||||
/* Called when either the connection is terminated due to an error or per
|
||||
* user request. The status is set accordingly (REDIS_OK, REDIS_ERR). */
|
||||
redisDisconnectCallback *onDisconnect;
|
||||
|
||||
/* Called when the first write event was received. */
|
||||
redisConnectCallback *onConnect;
|
||||
|
||||
} redisClusterAsyncContext;
|
||||
|
||||
redisClusterAsyncContext *redisClusterAsyncConnect(const char *addrs, int flags);
|
||||
int redisClusterAsyncSetConnectCallback(redisClusterAsyncContext *acc, redisConnectCallback *fn);
|
||||
int redisClusterAsyncSetDisconnectCallback(redisClusterAsyncContext *acc, redisDisconnectCallback *fn);
|
||||
int redisClusterAsyncFormattedCommand(redisClusterAsyncContext *acc, redisClusterCallbackFn *fn, void *privdata, char *cmd, int len);
|
||||
int redisClustervAsyncCommand(redisClusterAsyncContext *acc, redisClusterCallbackFn *fn, void *privdata, const char *format, va_list ap);
|
||||
int redisClusterAsyncCommand(redisClusterAsyncContext *acc, redisClusterCallbackFn *fn, void *privdata, const char *format, ...);
|
||||
int redisClusterAsyncCommandArgv(redisClusterAsyncContext *acc, redisClusterCallbackFn *fn, void *privdata, int argc, const char **argv, const size_t *argvlen);
|
||||
void redisClusterAsyncDisconnect(redisClusterAsyncContext *acc);
|
||||
void redisClusterAsyncFree(redisClusterAsyncContext *acc);
|
||||
|
||||
redisAsyncContext *actx_get_by_node(redisClusterAsyncContext *acc, cluster_node *node);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
221
src/inc/hiredis.h
Normal file
221
src/inc/hiredis.h
Normal file
@@ -0,0 +1,221 @@
|
||||
/*
|
||||
* Copyright (c) 2009-2011, Salvatore Sanfilippo <antirez at gmail dot com>
|
||||
* Copyright (c) 2010-2014, Pieter Noordhuis <pcnoordhuis at gmail dot com>
|
||||
* Copyright (c) 2015, Matt Stancliff <matt at genges dot com>,
|
||||
* Jan-Erik Rediger <janerik at fnordig dot com>
|
||||
*
|
||||
* 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.
|
||||
*/
|
||||
|
||||
#ifndef __HIREDIS_H
|
||||
#define __HIREDIS_H
|
||||
#include "read.h"
|
||||
#include <stdarg.h> /* for va_list */
|
||||
#include <sys/time.h> /* for struct timeval */
|
||||
#include <stdint.h> /* uintXX_t, etc */
|
||||
#include "sds.h" /* for sds */
|
||||
|
||||
#define HIREDIS_MAJOR 0
|
||||
#define HIREDIS_MINOR 13
|
||||
#define HIREDIS_PATCH 1
|
||||
|
||||
/* Connection type can be blocking or non-blocking and is set in the
|
||||
* least significant bit of the flags field in redisContext. */
|
||||
#define REDIS_BLOCK 0x1
|
||||
|
||||
/* Connection may be disconnected before being free'd. The second bit
|
||||
* in the flags field is set when the context is connected. */
|
||||
#define REDIS_CONNECTED 0x2
|
||||
|
||||
/* The async API might try to disconnect cleanly and flush the output
|
||||
* buffer and read all subsequent replies before disconnecting.
|
||||
* This flag means no new commands can come in and the connection
|
||||
* should be terminated once all replies have been read. */
|
||||
#define REDIS_DISCONNECTING 0x4
|
||||
|
||||
/* Flag specific to the async API which means that the context should be clean
|
||||
* up as soon as possible. */
|
||||
#define REDIS_FREEING 0x8
|
||||
|
||||
/* Flag that is set when an async callback is executed. */
|
||||
#define REDIS_IN_CALLBACK 0x10
|
||||
|
||||
/* Flag that is set when the async context has one or more subscriptions. */
|
||||
#define REDIS_SUBSCRIBED 0x20
|
||||
|
||||
/* Flag that is set when monitor mode is active */
|
||||
#define REDIS_MONITORING 0x40
|
||||
|
||||
/* Flag that is set when we should set SO_REUSEADDR before calling bind() */
|
||||
#define REDIS_REUSEADDR 0x80
|
||||
|
||||
#define REDIS_KEEPALIVE_INTERVAL 15 /* seconds */
|
||||
|
||||
/* number of times we retry to connect in the case of EADDRNOTAVAIL and
|
||||
* SO_REUSEADDR is being used. */
|
||||
#define REDIS_CONNECT_RETRIES 10
|
||||
|
||||
/* strerror_r has two completely different prototypes and behaviors
|
||||
* depending on system issues, so we need to operate on the error buffer
|
||||
* differently depending on which strerror_r we're using. */
|
||||
#ifndef _GNU_SOURCE
|
||||
/* "regular" POSIX strerror_r that does the right thing. */
|
||||
#define __redis_strerror_r(errno, buf, len) \
|
||||
do { \
|
||||
strerror_r((errno), (buf), (len)); \
|
||||
} while (0)
|
||||
#else
|
||||
/* "bad" GNU strerror_r we need to clean up after. */
|
||||
#define __redis_strerror_r(errno, buf, len) \
|
||||
do { \
|
||||
char *err_str = strerror_r((errno), (buf), (len)); \
|
||||
/* If return value _isn't_ the start of the buffer we passed in, \
|
||||
* then GNU strerror_r returned an internal static buffer and we \
|
||||
* need to copy the result into our private buffer. */ \
|
||||
if (err_str != (buf)) { \
|
||||
buf[(len)] = '\0'; \
|
||||
strncat((buf), err_str, ((len) - 1)); \
|
||||
} \
|
||||
} while (0)
|
||||
#endif
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/* This is the reply object returned by redisCommand() */
|
||||
typedef struct redisReply {
|
||||
int type; /* REDIS_REPLY_* */
|
||||
long long integer; /* The integer when type is REDIS_REPLY_INTEGER */
|
||||
int len; /* Length of string */
|
||||
char *str; /* Used for both REDIS_REPLY_ERROR and REDIS_REPLY_STRING */
|
||||
size_t elements; /* number of elements, for REDIS_REPLY_ARRAY */
|
||||
struct redisReply **element; /* elements vector for REDIS_REPLY_ARRAY */
|
||||
} redisReply;
|
||||
|
||||
redisReader *redisReaderCreate(void);
|
||||
|
||||
/* Function to free the reply objects hiredis returns by default. */
|
||||
void freeReplyObject(void *reply);
|
||||
|
||||
/* Functions to format a command according to the protocol. */
|
||||
int redisvFormatCommand(char **target, const char *format, va_list ap);
|
||||
int redisFormatCommand(char **target, const char *format, ...);
|
||||
int redisFormatCommandArgv(char **target, int argc, const char **argv, const size_t *argvlen);
|
||||
int redisFormatSdsCommandArgv(sds *target, int argc, const char ** argv, const size_t *argvlen);
|
||||
void redisFreeCommand(char *cmd);
|
||||
void redisFreeSdsCommand(sds cmd);
|
||||
|
||||
enum redisConnectionType {
|
||||
REDIS_CONN_TCP,
|
||||
REDIS_CONN_UNIX,
|
||||
};
|
||||
|
||||
/* Context for a connection to Redis */
|
||||
typedef struct redisContext {
|
||||
int err; /* Error flags, 0 when there is no error */
|
||||
char errstr[128]; /* String representation of error when applicable */
|
||||
int fd;
|
||||
int flags;
|
||||
char *obuf; /* Write buffer */
|
||||
redisReader *reader; /* Protocol reader */
|
||||
|
||||
enum redisConnectionType connection_type;
|
||||
struct timeval *timeout;
|
||||
|
||||
struct {
|
||||
char *host;
|
||||
char *source_addr;
|
||||
int port;
|
||||
} tcp;
|
||||
|
||||
struct {
|
||||
char *path;
|
||||
} unix_sock;
|
||||
} redisContext;
|
||||
|
||||
redisContext *redisConnect(const char *ip, int port);
|
||||
redisContext *redisConnectWithTimeout(const char *ip, int port, const struct timeval tv);
|
||||
redisContext *redisConnectNonBlock(const char *ip, int port);
|
||||
redisContext *redisConnectBindNonBlock(const char *ip, int port,
|
||||
const char *source_addr);
|
||||
redisContext *redisConnectBindNonBlockWithReuse(const char *ip, int port,
|
||||
const char *source_addr);
|
||||
redisContext *redisConnectUnix(const char *path);
|
||||
redisContext *redisConnectUnixWithTimeout(const char *path, const struct timeval tv);
|
||||
redisContext *redisConnectUnixNonBlock(const char *path);
|
||||
redisContext *redisConnectFd(int fd);
|
||||
|
||||
/**
|
||||
* Reconnect the given context using the saved information.
|
||||
*
|
||||
* This re-uses the exact same connect options as in the initial connection.
|
||||
* host, ip (or path), timeout and bind address are reused,
|
||||
* flags are used unmodified from the existing context.
|
||||
*
|
||||
* Returns REDIS_OK on successfull connect or REDIS_ERR otherwise.
|
||||
*/
|
||||
int redisReconnect(redisContext *c);
|
||||
|
||||
int redisSetTimeout(redisContext *c, const struct timeval tv);
|
||||
int redisEnableKeepAlive(redisContext *c);
|
||||
void redisFree(redisContext *c);
|
||||
int redisFreeKeepFd(redisContext *c);
|
||||
int redisBufferRead(redisContext *c);
|
||||
int redisBufferWrite(redisContext *c, int *done);
|
||||
|
||||
/* In a blocking context, this function first checks if there are unconsumed
|
||||
* replies to return and returns one if so. Otherwise, it flushes the output
|
||||
* buffer to the socket and reads until it has a reply. In a non-blocking
|
||||
* context, it will return unconsumed replies until there are no more. */
|
||||
int redisGetReply(redisContext *c, void **reply);
|
||||
int redisGetReplyFromReader(redisContext *c, void **reply);
|
||||
|
||||
/* Write a formatted command to the output buffer. Use these functions in blocking mode
|
||||
* to get a pipeline of commands. */
|
||||
int redisAppendFormattedCommand(redisContext *c, const char *cmd, size_t len);
|
||||
|
||||
/* Write a command to the output buffer. Use these functions in blocking mode
|
||||
* to get a pipeline of commands. */
|
||||
int redisvAppendCommand(redisContext *c, const char *format, va_list ap);
|
||||
int redisAppendCommand(redisContext *c, const char *format, ...);
|
||||
int redisAppendCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
|
||||
|
||||
/* Issue a command to Redis. In a blocking context, it is identical to calling
|
||||
* redisAppendCommand, followed by redisGetReply. The function will return
|
||||
* NULL if there was an error in performing the request, otherwise it will
|
||||
* return the reply. In a non-blocking context, it is identical to calling
|
||||
* only redisAppendCommand and will always return NULL. */
|
||||
void *redisvCommand(redisContext *c, const char *format, va_list ap);
|
||||
void *redisCommand(redisContext *c, const char *format, ...);
|
||||
void *redisCommandArgv(redisContext *c, int argc, const char **argv, const size_t *argvlen);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
313
src/inc/interval_index.h
Normal file
313
src/inc/interval_index.h
Normal file
@@ -0,0 +1,313 @@
|
||||
/************************************************************************
|
||||
* InterVal Index interface
|
||||
* NOTE that:
|
||||
* (1) There are no overlapping intervals in InterVal Index;
|
||||
* (2) Each interval is closed;
|
||||
* (3) The interval supports rollback.
|
||||
*
|
||||
* author: zhengchao@iie.ac.cn tangqi@iie.ac.cn
|
||||
* last modify time: 2015-12-04
|
||||
*************************************************************************/
|
||||
|
||||
#ifndef _INTERVAL_INDEX_H_
|
||||
#define _INTERVAL_INDEX_H_
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C"{
|
||||
#endif
|
||||
|
||||
|
||||
#define SIZE_8
|
||||
|
||||
#ifdef SIZE_8
|
||||
typedef unsigned long OFFSET_TYPE;
|
||||
typedef signed long S_OFFSET_TYPE;
|
||||
#else
|
||||
typedef unsigned int OFFSET_TYPE;
|
||||
typedef signed int S_OFFSET_TYPE;
|
||||
#endif
|
||||
|
||||
|
||||
typedef struct{
|
||||
}IVI_t;
|
||||
|
||||
|
||||
/**
|
||||
* structure of segment
|
||||
**/
|
||||
typedef struct __IVI_seg_t{
|
||||
OFFSET_TYPE left;
|
||||
OFFSET_TYPE right;
|
||||
void * data;
|
||||
}IVI_seg_t;
|
||||
|
||||
|
||||
typedef void IVI_callback_t(IVI_seg_t * seg, void * usr_para);
|
||||
|
||||
/**
|
||||
* Deal with rollback
|
||||
* Refering to the approach of Linux's kernel to solute tcp seq rollback
|
||||
**/
|
||||
static inline int before(OFFSET_TYPE off1, OFFSET_TYPE off2)
|
||||
{
|
||||
return (S_OFFSET_TYPE)(off1 - off2) < 0;
|
||||
}
|
||||
#define after(off2, off1) before(off1, off2)
|
||||
|
||||
static inline int continuous(OFFSET_TYPE prev, OFFSET_TYPE next)
|
||||
{
|
||||
return ((next - prev) == 1);
|
||||
}
|
||||
|
||||
|
||||
IVI_seg_t * IVI_first_seg(IVI_t * handler);
|
||||
IVI_seg_t * IVI_last_seg(IVI_t * handler);
|
||||
IVI_seg_t * IVI_prev_seg(IVI_seg_t * seg);
|
||||
IVI_seg_t * IVI_next_seg(IVI_seg_t * seg);
|
||||
IVI_seg_t * IVI_prev_continuous_seg(IVI_seg_t * seg);
|
||||
IVI_seg_t * IVI_next_continuous_seg(IVI_seg_t * seg);
|
||||
|
||||
|
||||
/**
|
||||
* Relation of two segments
|
||||
**/
|
||||
typedef enum __Relation_t{
|
||||
LEFT_NO_OVERLAP = 1, // |___A___|
|
||||
// |___B___|
|
||||
|
||||
LEFT_OVERLAP, // |___A___|
|
||||
// |___B___|
|
||||
|
||||
CONTAINED, // |___A___|
|
||||
// |_____B_____|
|
||||
|
||||
CONTAIN, // |_____A_____|
|
||||
// |___B___|
|
||||
|
||||
RIGHT_OVERLAP, // |___A___|
|
||||
// |___B___|
|
||||
|
||||
RIGHT_NO_OVERLAP, // |___A___|
|
||||
// |___B___|
|
||||
|
||||
ERROR
|
||||
}Relation_t;
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_relative_position
|
||||
* Description:
|
||||
* Get relative position of given two interval segments
|
||||
* Params:
|
||||
* seg1: Subject of relation
|
||||
* seg2: Object of relation
|
||||
* Relation:
|
||||
* On success, return the relation of two segments with enum;
|
||||
* Else, return ERROR in enum;
|
||||
**/
|
||||
Relation_t IVI_relative_position(IVI_seg_t * seg1, IVI_seg_t * seg2);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_create
|
||||
* Description:
|
||||
* Create an InterVal Index
|
||||
* Params:
|
||||
* void
|
||||
* Return:
|
||||
* Return a handler of this InterVal Index
|
||||
**/
|
||||
IVI_t * IVI_create(void);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_destroy
|
||||
* Description:
|
||||
* Destroy a given InterVal Index's handler
|
||||
* Params:
|
||||
* handler: The InterVal Index you want to destroy
|
||||
* cb: Callback function for user to free data in segement
|
||||
* usr_para: User parameter
|
||||
* Return:
|
||||
* void
|
||||
**/
|
||||
void IVI_destroy(IVI_t * handler, IVI_callback_t cb, void * usr_para);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_seg_malloc
|
||||
* Description:
|
||||
* Malloc a segment with given parameters
|
||||
* Params:
|
||||
* left: Left point of segment
|
||||
* right: Right point of segment
|
||||
* data: User data
|
||||
* Return:
|
||||
* Return a pointer of segment structure.
|
||||
**/
|
||||
IVI_seg_t * IVI_seg_malloc(OFFSET_TYPE left, OFFSET_TYPE right, void * data);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_seg_free
|
||||
* Description:
|
||||
* Free the memory of given segment
|
||||
* Params:
|
||||
* seg: The segment that you want to free
|
||||
* cb: Callback function for user to free *data in seg
|
||||
* usr_para: User parameter for cb
|
||||
* Return:
|
||||
* void
|
||||
**/
|
||||
void IVI_seg_free(IVI_seg_t * seg, IVI_callback_t cb, void * usr_para);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_insert
|
||||
* Description:
|
||||
* Insert a segment to an InterVal Index handler,and the segment
|
||||
* MUST not be overlapped with others in handler.
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create
|
||||
* seg: A segment that user wants to add. It MUST be created
|
||||
* by IVI_seg_malloc.
|
||||
* Return:
|
||||
* On success, 0 is returned;
|
||||
* Else when overlapp occures or error occures, -1 is returned.
|
||||
**/
|
||||
int IVI_insert(IVI_t * handler, IVI_seg_t * seg);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_remove
|
||||
* Description:
|
||||
* Remove a given segment from given InterVal Index handler.
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create
|
||||
* seg: A segment that user wants to delete. It MUST be created
|
||||
* by IVI_seg_malloc.
|
||||
* Return:
|
||||
* On success, 0 is returned;
|
||||
* Else when overlapp occures, -1 is returned.
|
||||
**/
|
||||
int IVI_remove(IVI_t * handler, IVI_seg_t * seg);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_query
|
||||
* Description:
|
||||
* Query from given InterVal Index and get the number of segments
|
||||
* which are overlapped with given interval, and store those segments
|
||||
* in the last parameter.
|
||||
* Params:
|
||||
* handler: The handler of interval index created by IVI_create
|
||||
* left: Left point of given interval
|
||||
* right: Right point of given interval
|
||||
* segs: An address of a segment pointer array to store those segments which
|
||||
* are overlapped with given interval. NOTE that user should not malloc
|
||||
* the array, and segs need to be freed by user. The element of *segs
|
||||
* MUST not be freed by user.
|
||||
* Return:
|
||||
* Return the number of segments which are overlapped with given interval
|
||||
**/
|
||||
int IVI_query(IVI_t * handler, OFFSET_TYPE left, OFFSET_TYPE right, IVI_seg_t *** segs);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_query_continuous
|
||||
* Description:
|
||||
* Query from interval index handler and get the number of continous segments
|
||||
* which are overlapped with given interval.
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create.
|
||||
* left: Left point of given interval
|
||||
* right: Right point of given interval
|
||||
* segs: An address of a segment pointer array to store those segments which
|
||||
* are overlapped with given interval. NOTE that user should not malloc
|
||||
* the array, and segs need to be freed by user. The element of *segs
|
||||
* MUST not be freed by user.
|
||||
* Return:
|
||||
* Return the number of continous segments which are overlapped with given interval
|
||||
**/
|
||||
int IVI_query_continuous(IVI_t * handler, OFFSET_TYPE left, OFFSET_TYPE right, IVI_seg_t *** segs);
|
||||
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_seg_cnt
|
||||
* Description:
|
||||
* Get the count of segments in given interval index handler
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create.
|
||||
* Return:
|
||||
* Return the count of segments in given interval index handler
|
||||
**/
|
||||
int IVI_seg_cnt(IVI_t * handler);
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_seg_len
|
||||
* Description:
|
||||
* Get the length of whole segments in given interval index handler
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create.
|
||||
* Return:
|
||||
* Return the length of whole segments in given interval index handler
|
||||
**/
|
||||
OFFSET_TYPE IVI_seg_length(IVI_t * handler);
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_mem_occupy
|
||||
* Description:
|
||||
* Get the memory occupy of given interval index handler
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create.
|
||||
* Return:
|
||||
* Return the memory occupy of given interval index handler
|
||||
**/
|
||||
unsigned long long IVI_mem_occupy(IVI_t * handler);
|
||||
|
||||
|
||||
/**
|
||||
* Name:
|
||||
* IVI_traverse
|
||||
* Description:
|
||||
* Traverse given InterVal Index and execute given callback function
|
||||
* one time for each seg in InterVal Index.
|
||||
* Params:
|
||||
* handler: The handler of InterVal Index created by IVI_create.
|
||||
* IVI_callback_t: Callback function for user to define.
|
||||
* usr_para: Parameter user want to pass to callback function.
|
||||
* Return:
|
||||
* void
|
||||
**/
|
||||
void IVI_traverse(IVI_t * handler, IVI_callback_t cb, void * usr_para);
|
||||
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* _INTERVAL_INDEX_H_ */
|
||||
85
src/inc/mesa_fuzzy.h
Normal file
85
src/inc/mesa_fuzzy.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifndef _MESA_FUZZY_
|
||||
#define _MESA_FUZZY_
|
||||
|
||||
/*
|
||||
* Copyright (C) MESA 2015
|
||||
*
|
||||
* These functions allow a programmer to compute the fuzzy hashes
|
||||
* (also called the context-triggered piecewise hashes) of
|
||||
* buffer[s] of text.
|
||||
*
|
||||
* See also:
|
||||
* ssdeep, and
|
||||
* Identifying almost identical files using context triggered piecewise hashing
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TOTAL_LENGTH 0
|
||||
#define EFFECTIVE_LENGTH 1
|
||||
#define HASH_LENGTH 2
|
||||
|
||||
// typedef fuzzy_handle_t void*;
|
||||
typedef struct
|
||||
{
|
||||
}fuzzy_handle_t;
|
||||
|
||||
/**
|
||||
* create a fuzzy hash handle and return it.
|
||||
* @return [handle]
|
||||
*/
|
||||
fuzzy_handle_t * fuzzy_create_handle(unsigned long long origin_len);
|
||||
|
||||
/**
|
||||
* destroy context by a fuzzy hash handle.
|
||||
* @param handle [handle]
|
||||
*/
|
||||
void fuzzy_destroy_handle(fuzzy_handle_t * handle);
|
||||
|
||||
/**
|
||||
* Feed the function your data.
|
||||
* Call this function several times, if you have several parts of data to feed.
|
||||
* @param handle [handle]
|
||||
* @param data [data that you want to fuzzy_hash]
|
||||
* @param size [data size]
|
||||
* @param offset [offset]
|
||||
* @return [return effective data length in current feed]
|
||||
*/
|
||||
unsigned int fuzzy_feed(fuzzy_handle_t * handle, const char* data, unsigned int size, unsigned long long offset);
|
||||
|
||||
/**
|
||||
* Obtain the fuzzy hash values.
|
||||
* @param handle [handle]
|
||||
* @param result [fuzzy hash result]
|
||||
* Fuzzy hash result with offsets(in the square brackets, with colon splitted).
|
||||
* eg. abc[1:100]def[200:300]
|
||||
* @param size [@result size]
|
||||
* @return [return zero on success, non-zero on error]
|
||||
*/
|
||||
int fuzzy_digest(fuzzy_handle_t * handle, char* result, unsigned int size);
|
||||
|
||||
/**
|
||||
* Obtain certain length of fuzzy hash status.
|
||||
* @param handle [handle]
|
||||
* @param type [length type]
|
||||
* TOTAL_LENGTH:Total length of data you have fed.
|
||||
* Overlapped data will NOT count for 2 times.
|
||||
* EFFECTIVE_LENGTH:Length of data that involved in the calculation of hash.
|
||||
* HASH_LENGTH:Hash result length.
|
||||
* @return [length value]
|
||||
*/
|
||||
unsigned long long fuzzy_status(fuzzy_handle_t * handle, int type);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
28
src/inc/my_socket.h
Normal file
28
src/inc/my_socket.h
Normal file
@@ -0,0 +1,28 @@
|
||||
#ifndef _MY_SOCKET_H_
|
||||
#define _MY_SOCKET_H_
|
||||
|
||||
#include <stdint.h>
|
||||
#include <sys/un.h>
|
||||
|
||||
#define SOCKET_BUF_SIZE 1500
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
int init_unix_socket(const char* file_name);
|
||||
int unix_socket_send(int sockfd, struct sockaddr_un *dest_un, const char*data, int datalen);
|
||||
int init_recv_udp_socket(uint16_t port);
|
||||
int recv_udp_socket_recv(int sockfd, uint32_t *src_ip, uint8_t *buf, uint32_t buf_size);
|
||||
int init_recv_unix_socket(const char* file_name);
|
||||
int recv_unix_socket_recv(int sockfd,char*buf,int buf_len);
|
||||
int init_send_udp_socket();
|
||||
int send_udp_socket_send(int sockfd, uint32_t addr, uint16_t port, char *data, int datalen);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
113
src/inc/queue.h
Normal file
113
src/inc/queue.h
Normal file
@@ -0,0 +1,113 @@
|
||||
/***************************************************
|
||||
* TAILQ int Linux's <sys/queue.h>
|
||||
****************************************************/
|
||||
|
||||
|
||||
#ifndef _QUEUE_H_
|
||||
#define _QUEUE_H_
|
||||
|
||||
/**
|
||||
* Tail queue definitions.
|
||||
*/
|
||||
#define _TAILQ_HEAD(name, type, qual) \
|
||||
struct name { \
|
||||
qual type *tqh_first; /* first element */ \
|
||||
qual type *qual *tqh_last; /* addr of last next element */ \
|
||||
}
|
||||
#define TAILQ_HEAD(name, type) _TAILQ_HEAD(name, struct type,)
|
||||
|
||||
#define TAILQ_HEAD_INITIALIZER(head) \
|
||||
{ NULL, &(head).tqh_first }
|
||||
|
||||
#define _TAILQ_ENTRY(type, qual) \
|
||||
struct { \
|
||||
qual type *tqe_next; /* next element */ \
|
||||
qual type *qual *tqe_prev; /* address of previous next element */\
|
||||
}
|
||||
#define TAILQ_ENTRY(type) _TAILQ_ENTRY(struct type,)
|
||||
|
||||
/*
|
||||
* Tail queue functions.
|
||||
*/
|
||||
#define TAILQ_INIT(head) do { \
|
||||
(head)->tqh_first = NULL; \
|
||||
(head)->tqh_last = &(head)->tqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_HEAD(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (head)->tqh_first) != NULL) \
|
||||
(head)->tqh_first->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(head)->tqh_first = (elm); \
|
||||
(elm)->field.tqe_prev = &(head)->tqh_first; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_TAIL(head, elm, field) do { \
|
||||
(elm)->field.tqe_next = NULL; \
|
||||
(elm)->field.tqe_prev = (head)->tqh_last; \
|
||||
*(head)->tqh_last = (elm); \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_AFTER(head, listelm, elm, field) do { \
|
||||
if (((elm)->field.tqe_next = (listelm)->field.tqe_next) != NULL)\
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
&(elm)->field.tqe_next; \
|
||||
else \
|
||||
(head)->tqh_last = &(elm)->field.tqe_next; \
|
||||
(listelm)->field.tqe_next = (elm); \
|
||||
(elm)->field.tqe_prev = &(listelm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_INSERT_BEFORE(listelm, elm, field) do { \
|
||||
(elm)->field.tqe_prev = (listelm)->field.tqe_prev; \
|
||||
(elm)->field.tqe_next = (listelm); \
|
||||
*(listelm)->field.tqe_prev = (elm); \
|
||||
(listelm)->field.tqe_prev = &(elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_REMOVE(head, elm, field) do { \
|
||||
if (((elm)->field.tqe_next) != NULL) \
|
||||
(elm)->field.tqe_next->field.tqe_prev = \
|
||||
(elm)->field.tqe_prev; \
|
||||
else \
|
||||
(head)->tqh_last = (elm)->field.tqe_prev; \
|
||||
*(elm)->field.tqe_prev = (elm)->field.tqe_next; \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
#define TAILQ_FOREACH(var, head, field) \
|
||||
for ((var) = ((head)->tqh_first); \
|
||||
(var); \
|
||||
(var) = ((var)->field.tqe_next))
|
||||
|
||||
#define TAILQ_FOREACH_REVERSE(var, head, headname, field) \
|
||||
for ((var) = (*(((struct headname *)((head)->tqh_last))->tqh_last)); \
|
||||
(var); \
|
||||
(var) = (*(((struct headname *)((var)->field.tqe_prev))->tqh_last)))
|
||||
|
||||
#define TAILQ_CONCAT(head1, head2, field) do { \
|
||||
if (!TAILQ_EMPTY(head2)) { \
|
||||
*(head1)->tqh_last = (head2)->tqh_first; \
|
||||
(head2)->tqh_first->field.tqe_prev = (head1)->tqh_last; \
|
||||
(head1)->tqh_last = (head2)->tqh_last; \
|
||||
TAILQ_INIT((head2)); \
|
||||
} \
|
||||
} while (/*CONSTCOND*/0)
|
||||
|
||||
/*
|
||||
* Tail queue access methods.
|
||||
*/
|
||||
#define TAILQ_EMPTY(head) ((head)->tqh_first == NULL)
|
||||
#define TAILQ_FIRST(head) ((head)->tqh_first)
|
||||
#define TAILQ_NEXT(elm, field) ((elm)->field.tqe_next)
|
||||
|
||||
#define TAILQ_LAST(head, headname) \
|
||||
(*(((struct headname *)((head)->tqh_last))->tqh_last))
|
||||
#define TAILQ_PREV(elm, headname, field) \
|
||||
(*(((struct headname *)((elm)->field.tqe_prev))->tqh_last))
|
||||
|
||||
|
||||
|
||||
#endif
|
||||
46
src/inc/sifter.h
Normal file
46
src/inc/sifter.h
Normal file
@@ -0,0 +1,46 @@
|
||||
#ifndef _SIFTER_H
|
||||
#define _SIFTER_H
|
||||
|
||||
|
||||
#ifndef U_INT32_H
|
||||
#define U_INT32_H
|
||||
typedef unsigned int uint32;
|
||||
#endif
|
||||
|
||||
|
||||
typedef void* sifter_t;
|
||||
|
||||
typedef struct expect_outcome_s
|
||||
{
|
||||
char* data; //not copy, only point to text
|
||||
int datalen;
|
||||
}expect_outcome_t;
|
||||
|
||||
#define TEXT_NAME_LEN 32
|
||||
typedef struct text_s
|
||||
{
|
||||
char* text;
|
||||
char text_name[TEXT_NAME_LEN];
|
||||
uint32 text_len;
|
||||
uchar text_type;
|
||||
}text_t;
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
//file dir, all file is *.sft.
|
||||
sifter_t create_sifter(const char* sifter_cfg_dir, const char* sifter_log_dir, int maat_stat_swicth, int maat_perf_swicth, int thread_num, void* logger);
|
||||
void destroy_sifter(sifter_t handle);
|
||||
//return:res num;
|
||||
int sifter(sifter_t handle, int sftid,
|
||||
int expect_type, const char* expect_name, int expect_res_num, expect_outcome_t* res,
|
||||
const text_t* text, int text_num, const char* cont_type, unsigned int cont_type_len, int thread_seq);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
100
src/inc/soqav_dedup.h
Normal file
100
src/inc/soqav_dedup.h
Normal file
@@ -0,0 +1,100 @@
|
||||
#ifndef __SOQ_AV_DEDUPLICATION_H__
|
||||
#define __SOQ_AV_DEDUPLICATION_H__
|
||||
|
||||
#include "stream.h"
|
||||
#include "interval_index.h"
|
||||
|
||||
#define BIT_TD_KNOWN 1
|
||||
#define BIT_TD_MULTI_SOURCE 2
|
||||
|
||||
typedef struct __htable_opt
|
||||
{
|
||||
unsigned int htable_num;
|
||||
int htable_exp_time;
|
||||
}htable_opt_t;
|
||||
|
||||
typedef struct __addr_node{
|
||||
unsigned int ip_nr; //network order
|
||||
unsigned short port_nr; //network order
|
||||
}addr_node_t ;
|
||||
|
||||
typedef struct __query_detail
|
||||
{
|
||||
unsigned long long mid;
|
||||
unsigned long total_len; //<2F><>Ŀ<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>
|
||||
const char *url;
|
||||
const char *other; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>ԴTD<54>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
unsigned int urllen;
|
||||
unsigned int otherlen;
|
||||
union
|
||||
{
|
||||
struct stream_tuple4_v4 *tuple4_v4;
|
||||
struct stream_tuple4_v6 *tuple4_v6;
|
||||
};
|
||||
unsigned char addrtype; //ADDR_TYPE_IPV4/* 1, <20><><EFBFBD><EFBFBD>IPv4<76><34>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>Ϣ */ADDR_TYPE_IPV6,/* 2, <20><><EFBFBD><EFBFBD>IPv6<76><36>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>Ϣ */
|
||||
}query_detail_t;
|
||||
|
||||
//TODO
|
||||
typedef struct __scan_detail
|
||||
{
|
||||
long long config_id;
|
||||
}scan_detail_t;
|
||||
|
||||
typedef struct __report_detail
|
||||
{
|
||||
unsigned long long mid;
|
||||
scan_detail_t *scan_detail; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϣ
|
||||
unsigned long current_len; //<2F><>ǰ<EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><D0A7><EFBFBD><EFBFBD>
|
||||
unsigned long total_len; //<2F><>Ŀ<EFBFBD>ܳ<EFBFBD><DCB3><EFBFBD>
|
||||
union
|
||||
{
|
||||
struct stream_tuple4_v4 *tuple4_v4;
|
||||
struct stream_tuple4_v6 *tuple4_v6;
|
||||
};
|
||||
IVI_t *ivi_handle;
|
||||
const char *file_sfh;
|
||||
const char *url;
|
||||
const char *other; //<2F><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڶ<EFBFBD>ԴTD<54>Ĵ<EFBFBD><C4B4><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><CEAA>
|
||||
unsigned int sfh_len;
|
||||
unsigned int urllen;
|
||||
unsigned int otherlen;
|
||||
unsigned char addrtype; //ADDR_TYPE_IPV4/* 1, <20><><EFBFBD><EFBFBD>IPv4<76><34>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>Ϣ */ADDR_TYPE_IPV6,/* 2, <20><><EFBFBD><EFBFBD>IPv6<76><36>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD>Ԫ<EFBFBD><D4AA><EFBFBD><EFBFBD>Ϣ */
|
||||
}report_detail_t;
|
||||
|
||||
typedef enum
|
||||
{
|
||||
DEDUP_TYPE_BALANCE_NUM, //unsgined int<6E><74><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD>ж<EFBFBD><D0B6><EFBFBD><EFBFBD><EFBFBD><F3BCB6A3><EFBFBD><EFBFBD>и<EFBFBD><D0B8>ؾ<EFBFBD><D8BE>⣬Ĭ<E2A3AC><C4AC>һ<EFBFBD><D2BB><EFBFBD><EFBFBD>ѯ2000<30>Σ<EFBFBD>
|
||||
DEDUP_TYPE_QUEUE_NUM, //unsgined int<6E><74><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ϱ<EFBFBD><CFB1>Ķ<EFBFBD><C4B6><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>100000<30><30>
|
||||
DEDUP_TYPE_STAT_INTERVAL, //unsigned int<6E><74><EFBFBD>ͣ<EFBFBD>Ĭ<EFBFBD><C4AC>ͳ<EFBFBD><CDB3><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>300<30>룬<EFBFBD><EBA3AC><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ0<CEAA><30><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>
|
||||
DEDUP_TYPE_THRIFT_TIME, //unsigned int<6E><74><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD><EFBFBD><EFBFBD>THRIFT<46><54>ʱʱ<CAB1>䣬<EFBFBD><E4A3AC>λ<EFBFBD><CEBB><EFBFBD>롣Ĭ<EBA1A3><C4AC>5s
|
||||
DEDUP_TYPE_HTABLE_ARG, //htable_opt_t<5F><74><EFBFBD>ͣ<EFBFBD><CDA3><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ػ<EFBFBD><D8BB><EFBFBD><EFBFBD>Ĺ<EFBFBD>ϣ<EFBFBD><CFA3><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD><EFBFBD><EFBFBD>Ĭ<EFBFBD><C4AC>1048576<37><36><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<CAB1><CAB1>3600s
|
||||
}DEDUP_OPT_TYPE_t;
|
||||
|
||||
typedef void * soqav_dedup_handle_t;
|
||||
|
||||
typedef struct __query_result
|
||||
{
|
||||
int status; //status & BIT_TD_KNOWN<57><4E><EFBFBD><EFBFBD>Ŀ<EFBFBD>ظ<EFBFBD><D8B8><EFBFBD>status & BIT_TD_MULTI_SOURCE<43><45><EFBFBD><EFBFBD>Դ<EFBFBD><D4B4>
|
||||
int cpz_mg_ip; //<2F><>Ҫע<D2AA><D7A2><EFBFBD><EFBFBD>Դʱ<D4B4><CAB1><EFBFBD><EFBFBD>ƴװIP<49><50>ַ<EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16777343(127.0.0.1)
|
||||
int cpz_payload_ip; //<2F><>Ҫע<D2AA><D7A2><EFBFBD><EFBFBD>Դʱ<D4B4><CAB1><EFBFBD><EFBFBD>ƴװIP<49><50>ַ<EFBFBD>DZ<EFBFBD><C7B1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>16777343(127.0.0.1)
|
||||
int reserve; //Ԥ<><D4A4>
|
||||
long long mid; //mid: <20><>Դʱ<D4B4><CAB1><EFBFBD><EFBFBD>Ŀ<EFBFBD>״γ<D7B4><CEB3>ֵ<EFBFBD>mid
|
||||
}query_result_t;
|
||||
|
||||
//user_arg: <20>û<EFBFBD><C3BB>Զ<EFBFBD><D4B6><EFBFBD>
|
||||
typedef long soqav_query_callback_t(const char *td, const query_result_t *result, void *user_arg);
|
||||
|
||||
extern "C" int soqav_dedup_set_opt(soqav_dedup_handle_t handle, DEDUP_OPT_TYPE_t type, const void *value, int size);
|
||||
//local_ifname<6D><65><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͨ<EFBFBD><CDA8><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƣ<EFBFBD><C6A3><EFBFBD><EFBFBD>ڻش<DABB><D8B4><EFBFBD><EFBFBD><EFBFBD>IP<49><50>ַ<EFBFBD><D6B7><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ˡ<EFBFBD>
|
||||
extern "C" soqav_dedup_handle_t soqav_dedup_plug_init(addr_node_t *addr_array, unsigned int addr_num, int mg_ip, int payload_ip, unsigned int thread_num, void *handle_log);
|
||||
extern "C" void soqav_dedup_plug_destroy(soqav_dedup_handle_t handle);
|
||||
|
||||
//<2F><><EFBFBD><EFBFBD>TDΪNULL<4C><4C><EFBFBD><EFBFBD>ʾֻ<CABE><D6BB>ѯ<EFBFBD><D1AF>Դ<EFBFBD><D4B4>
|
||||
//<2F><>Դ<EFBFBD><D4B4>Ŀ<EFBFBD><C4BF><EFBFBD><EFBFBD>Ҫ<EFBFBD><D2AA><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>soqav_dedup_report<72><74><EFBFBD><EFBFBD><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѯ<EFBFBD><D1AF><EFBFBD>ϱ<EFBFBD><CFB1><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƶ<EFBFBD>Դ<EFBFBD>Ľ<EFBFBD>Ŀһ<C4BF><D2BB>Ҫ<EFBFBD><D2AA>ѯ<EFBFBD><D1AF>
|
||||
extern "C" int soqav_dedup_query(soqav_dedup_handle_t handle, const char *td, const query_detail_t *detail, soqav_query_callback_t *callback_fun, void *user_arg);
|
||||
|
||||
//soqav_dedup_reportֻ<74><D6BB><EFBFBD><EFBFBD>ȥ<EFBFBD>أ<EFBFBD><D8A3>ظ<EFBFBD><D8B8>Ľ<EFBFBD>Ŀ<EFBFBD><C4BF>Ҫ<EFBFBD>ϱ<EFBFBD>
|
||||
extern "C" int soqav_dedup_report(soqav_dedup_handle_t handle, const char *td, const report_detail_t *detail);
|
||||
|
||||
#endif
|
||||
|
||||
85
src/inc/stream_fuzzy_hash.h
Normal file
85
src/inc/stream_fuzzy_hash.h
Normal file
@@ -0,0 +1,85 @@
|
||||
#ifndef _MESA_FUZZY_
|
||||
#define _MESA_FUZZY_
|
||||
|
||||
/*
|
||||
* Copyright (C) MESA 2015
|
||||
*
|
||||
* These functions allow a programmer to compute the fuzzy hashes
|
||||
* (also called the context-triggered piecewise hashes) of
|
||||
* buffer[s] of text.
|
||||
*
|
||||
* See also:
|
||||
* ssdeep, and
|
||||
* Identifying almost identical files using context triggered piecewise hashing
|
||||
*
|
||||
*/
|
||||
|
||||
#include <stdint.h>
|
||||
#include <stdio.h>
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
#define TOTAL_LENGTH 0
|
||||
#define EFFECTIVE_LENGTH 1
|
||||
#define HASH_LENGTH 2
|
||||
|
||||
// typedef sfh_instance_t void*;
|
||||
typedef struct
|
||||
{
|
||||
}sfh_instance_t;
|
||||
|
||||
/**
|
||||
* create a fuzzy hash handle and return it.
|
||||
* @return [handle]
|
||||
*/
|
||||
sfh_instance_t * SFH_instance(unsigned long long origin_len);
|
||||
|
||||
/**
|
||||
* destroy context by a fuzzy hash handle.
|
||||
* @param handle [handle]
|
||||
*/
|
||||
void SFH_release(sfh_instance_t * handle);
|
||||
|
||||
/**
|
||||
* Feed the function your data.
|
||||
* Call this function several times, if you have several parts of data to feed.
|
||||
* @param handle [handle]
|
||||
* @param data [data that you want to fuzzy_hash]
|
||||
* @param size [data size]
|
||||
* @param offset [offset]
|
||||
* @return [return effective data length in current feed]
|
||||
*/
|
||||
unsigned int SFH_feed(sfh_instance_t * handle, const char* data, unsigned int size, unsigned long long offset);
|
||||
|
||||
/**
|
||||
* Obtain the fuzzy hash values.
|
||||
* @param handle [handle]
|
||||
* @param result [fuzzy hash result]
|
||||
* Fuzzy hash result with offsets(in the square brackets, with colon splitted).
|
||||
* eg. abc[1:100]def[200:300]
|
||||
* @param size [@result size]
|
||||
* @return [return zero on success, non-zero on error]
|
||||
*/
|
||||
int SFH_digest(sfh_instance_t * handle, char* result, unsigned int size);
|
||||
|
||||
/**
|
||||
* Obtain certain length of fuzzy hash status.
|
||||
* @param handle [handle]
|
||||
* @param type [length type]
|
||||
* TOTAL_LENGTH:Total length of data you have fed.
|
||||
* Overlapped data will NOT count for 2 times.
|
||||
* EFFECTIVE_LENGTH:Length of data that involved in the calculation of hash.
|
||||
* HASH_LENGTH:Hash result length.
|
||||
* @return [length value]
|
||||
*/
|
||||
unsigned long long SFH_status(sfh_instance_t * handle, int type);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
78
src/inc/usm_api.h
Normal file
78
src/inc/usm_api.h
Normal file
@@ -0,0 +1,78 @@
|
||||
/*
|
||||
* usm_api.h
|
||||
*
|
||||
* Created on: 2017-1-17
|
||||
* Author: dmj
|
||||
*/
|
||||
#ifndef __USM_COMM_H_INCLUDE_
|
||||
#define __USM_COMM_H_INCLUDE_
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/*
|
||||
#ifndef uint64_t
|
||||
typedef unsigned long long uint64_t;
|
||||
#endif
|
||||
|
||||
#ifndef uint16_t
|
||||
typedef unsigned int uint16_t;
|
||||
#endif
|
||||
*/
|
||||
typedef struct
|
||||
{
|
||||
}USM_t;
|
||||
|
||||
#define USM_READER 0x01
|
||||
#define USM_WRITER 0x02
|
||||
|
||||
enum USM_rst_t
|
||||
{
|
||||
USM_SUCC = 0,
|
||||
USM_RD_SHMGET_ERR = -1,
|
||||
USM_SHMCTL_ERR = -2,
|
||||
USM_WT_SHMGET_ERR = -3,
|
||||
USM_SHMAT_ERR = -4,
|
||||
USM_SOCKET_INIT_ERR = -5,
|
||||
USM_QUEUE_INIT_ERR = -6
|
||||
};
|
||||
|
||||
enum USM_opt_t
|
||||
{
|
||||
SHM_BUF_SIZE,//WRITER and READER VIEW.VALUE is interger,SIZE=sizeof(int). DEFAULT:65535.
|
||||
READER_CNT,//WRITER VIEW.
|
||||
SMOOTH_TIME,//WRITER VIEW.but every reader need to set
|
||||
READER_ID,//READER VIEW.VALUE is interger,SIZE=sizeof(int). 0-7.Reader needs set read_id first.
|
||||
MAX_LQUEUE_SIZE,//READER VIEW.VALUE is interger,SIZE=sizeof(int). DEFAULT:1500.
|
||||
READER_PATH,//READER VIEW.data is a const char* und_path, define the reader's Unix named domain socket file path. return reader id if success.
|
||||
LOG_HANDLE
|
||||
};
|
||||
|
||||
enum USM_stat_t
|
||||
{
|
||||
WRITED_SIZE,
|
||||
WRITED_CNT,
|
||||
WRITING_CLASH_SIZE,
|
||||
WRITING_CLASH_CNT,
|
||||
SENDED_CNT, //READERS
|
||||
READED_SIZE,
|
||||
READED_CNT,
|
||||
READER_DROP_SIZE,//number of reader missed due to overwrite
|
||||
READER_DROP_CNT,
|
||||
READING_CLASH_SIZE,
|
||||
READING_CLASH_CNT,
|
||||
LQ_COUNT
|
||||
};
|
||||
|
||||
USM_t* USM_handle(int shm_key,uint64_t shm_size,int role);
|
||||
int USM_init(USM_t* handle);
|
||||
int USM_write(USM_t* handle,const char* data,int datalen);
|
||||
int USM_read(USM_t* handle,char** data,int* datalen,int* data_cnt);
|
||||
int USM_set_opt(USM_t* handle,enum USM_opt_t type,void* data,int size,int reader_id);
|
||||
uint64_t USM_stat(USM_t* handle,enum USM_stat_t type,int reader_id);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
69
src/inc/wiredLB.h
Normal file
69
src/inc/wiredLB.h
Normal file
@@ -0,0 +1,69 @@
|
||||
|
||||
/*
|
||||
*****************Wired Load Balancer********
|
||||
* Load balance form producer to the consumer.
|
||||
* Cooperate with consul, which is a service discovery infrastructure.
|
||||
* See document for detail instructions.
|
||||
* Author: zhengchao@iie.ac.cn, MESA
|
||||
* All right reserved by www.mesalab.cn 2018~2021
|
||||
*********************************************************
|
||||
*/
|
||||
|
||||
#ifndef H_WIRED_LOAD_BALANCER_H_INCLUDE
|
||||
#define H_WIRED_LOAD_BALANCER_H_INCLUDE
|
||||
#include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define WLB_CONSUMER 0
|
||||
#define WLB_PRODUCER 1
|
||||
#define WLB_MAX_TAG_SIZE 1024
|
||||
#define ADDRSRLEN_MAX 46
|
||||
|
||||
enum WLB_OPTION
|
||||
{
|
||||
WLB_OPT_ENABLE_OVERRIDE=0, // VALUE is an int, 1 for enable, 0 for disable. DEFAULT: 0.
|
||||
WLB_OPT_HEALTH_CHECK_PORT, // VALUE is a short int, SIZE=sizeof(short int). DEFAULT:52100.
|
||||
WLB_OPT_HEALTH_CHECK_INTERVAL, // VALUE is a short int, SIZE=sizeof(short int). DEFAULT:10 seconds.
|
||||
WLB_CONS_OPT_DATA_PORT, // VALUE is an unsigned short, SIZE=sizeof(unsigned short). DEFAULT: 0.
|
||||
WLB_CONS_OPT_PRIMARY_ADDR, // VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT: use consul agent listen address.
|
||||
WLB_CONS_OPT_SECONDARY_ADDR, // VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT: no default.
|
||||
WLB_CONS_OPT_CAPACITY, // VALUE is an int that range from 1 to 100, SIZE=sizeof(int). DEFAULT: 32.
|
||||
WLB_CONS_OPT_COST, // VALUE is an int that range from 1 to 100, SIZE=sizeof(int). DEFAULT: 32.
|
||||
WLB_CONS_OPT_USER_TAG, // VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT: "null". Size must Not exceed WLB_MAX_TAG_SIZE.
|
||||
WLB_PROD_OPT_OVERRIDE_PRIMARY_IP, // VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT: "null", format: "10.2.0.1-250;123.57.35.100-250;"
|
||||
WLB_PROD_OPT_OVERRIDE_SECONDARY_IP, // VALUE is a const char*, MUST end with '\0', SIZE= strlen(string+'\0')+1. DEFAULT: "null", same format as WLB_PROD_OPT_OVERRIDE_PRIMARY_IP.
|
||||
WLB_PROD_OPT_OVERRIDE_DATAPORT, // VALUE is an unsigned short, SIZE=sizeof(unsigned short). DEFAULT: 0.
|
||||
WLB_PROD_OPT_OVERRIDE_USER_TAG // Same requirement as WLB_CONS_OPT_USER_TAG.
|
||||
};
|
||||
typedef void* WLB_handle_t;
|
||||
|
||||
struct WLB_consumer_t
|
||||
{
|
||||
char ip_addr[ADDRSRLEN_MAX];
|
||||
unsigned short data_port;
|
||||
char user_tag[WLB_MAX_TAG_SIZE];
|
||||
};
|
||||
// Lookup is THREAD SAFE.
|
||||
int wiredLB_lookup(WLB_handle_t handle, const void* key, int len, struct WLB_consumer_t* consumer);
|
||||
|
||||
int wiredLB_list(WLB_handle_t handle,size_t n_cons, struct WLB_consumer_t* cons_array);
|
||||
|
||||
|
||||
//Report is THREAD SAFE, NULL is allowed for runtime_info.
|
||||
void wiredLB_report(WLB_handle_t handle,long proc_bytes, long proc_count, const char* runtime_info);
|
||||
|
||||
//[IN] topic, MADATORY, use utf-8 for non English character.
|
||||
//[IN] group_name, OPTIONALl, could be NULL, use utf-8 for non English character.
|
||||
//[IN] role, WLB_COSUMER or WLB_PRODUCER
|
||||
WLB_handle_t wiredLB_create(const char* topic, const char* group_name, int role);
|
||||
int wiredLB_set_opt(WLB_handle_t handle, enum WLB_OPTION opt, const void* value, size_t size);
|
||||
int wiredLB_init(WLB_handle_t handle);
|
||||
void wiredLB_destroy(WLB_handle_t handle);
|
||||
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
|
||||
39
src/inc/wired_cfg.h
Normal file
39
src/inc/wired_cfg.h
Normal file
@@ -0,0 +1,39 @@
|
||||
#ifndef H_WIRED_CFG_H_INCLUDE
|
||||
#define H_WIRED_CFG_H_INCLUDE
|
||||
#include <stddef.h>
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
#define WCFG_RET_ERR -1
|
||||
#define WCFG_RET_NOT_EXIST 0
|
||||
#define WCFG_RET_OK 1
|
||||
|
||||
enum WCFG_OPTION
|
||||
{
|
||||
LOCAL_ONLY=0,
|
||||
REMOTE_TIMEOUT,
|
||||
DCFG_ERR
|
||||
};
|
||||
|
||||
void * wired_cfg_create(const char* app_name, const char* cfg_path);
|
||||
|
||||
// return DCFG_RET_xx
|
||||
int wired_cfg_set_opt(void*handle, enum WCFG_OPTION option, const char* val, size_t size);
|
||||
|
||||
// return DCFG_RET_xx
|
||||
int wired_cfg_init(void* handle);
|
||||
|
||||
// convert the value as your own wish with sscanf
|
||||
// handle [IN] which aquired by wired_cfg_create
|
||||
// section [IN] section name in initialization file
|
||||
// key [IN] keyword name in initialization file
|
||||
// value [OUT] returned string
|
||||
// size [IN] buffer size(bytes)
|
||||
//default_value[IN] default string
|
||||
int wired_cfg_read(void*handle, const char* section, const char* key,char* value, size_t size,const char* default_value);
|
||||
|
||||
void wired_cfg_destroy(void* handle);
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
#endif
|
||||
BIN
src/lib/libMESA_trace.a
Normal file
BIN
src/lib/libMESA_trace.a
Normal file
Binary file not shown.
BIN
src/lib/lib_MESA_timer.a
Normal file
BIN
src/lib/lib_MESA_timer.a
Normal file
Binary file not shown.
BIN
src/lib/lib_interval_index.a
Normal file
BIN
src/lib/lib_interval_index.a
Normal file
Binary file not shown.
BIN
src/lib/libbusinessman.a
Normal file
BIN
src/lib/libbusinessman.a
Normal file
Binary file not shown.
BIN
src/lib/libdictator_debug.a
Normal file
BIN
src/lib/libdictator_debug.a
Normal file
Binary file not shown.
BIN
src/lib/libhiredis_vip.a
Normal file
BIN
src/lib/libhiredis_vip.a
Normal file
Binary file not shown.
BIN
src/lib/libmy_socket.a
Normal file
BIN
src/lib/libmy_socket.a
Normal file
Binary file not shown.
BIN
src/lib/libsifter.a
Normal file
BIN
src/lib/libsifter.a
Normal file
Binary file not shown.
BIN
src/lib/usm_comm.a
Normal file
BIN
src/lib/usm_comm.a
Normal file
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user