diff options
| author | wangmenglan <[email protected]> | 2024-08-23 17:16:24 +0800 |
|---|---|---|
| committer | wangmenglan <[email protected]> | 2024-08-27 10:34:13 +0800 |
| commit | 9e2b08ab53f2b62e0e0e33b3bb2b7aebbd1a0229 (patch) | |
| tree | 334016dbd9cdf4f2cd9cc0dc14f47509a52e9f39 /common/test/test_mpack.cpp | |
| parent | c2c20d33108dbe35e4ee1f98b7ed956d27cfc710 (diff) | |
TSG-22333 修改控制报文
Diffstat (limited to 'common/test/test_mpack.cpp')
| -rw-r--r-- | common/test/test_mpack.cpp | 70 |
1 files changed, 23 insertions, 47 deletions
diff --git a/common/test/test_mpack.cpp b/common/test/test_mpack.cpp index 268a23e..6a3aa83 100644 --- a/common/test/test_mpack.cpp +++ b/common/test/test_mpack.cpp @@ -31,31 +31,19 @@ void build_mpack_data(char **data, size_t *size) uint32_t ts_client_val = 4213358146; uint32_t ts_server_val = 1218524397; uint8_t packet_cur_dir = 1; + uint16_t incoming_link_id = 1; + uint16_t outgoing_link_id = 65535; uint8_t src_sub_id[256] = {0}; - uint8_t dst_sub_id[256] = {0}; - uint64_t src_asn_val = 7676; - uint64_t dst_asn_val = 7878; - uint64_t src_asn_id = 1234; - uint64_t dst_asn_id = 4321; - // ip location array - const char *src_ip_location[4] = { - "src_region", - "src_province", - "src_city", - "src_subdivision" - }; - const char *dst_ip_location[4] = { - "dst_region", - "dst_province", - "dst_city", - "dst_subdivision" - }; - - uint64_t src_ip_location_obj_id[4] = {1, 2, 3, 4}; - uint64_t dst_ip_location_obj_id[4] = {1, 2, 3, 4}; + char src_imsi[256] = "810035141486423"; + char src_imei[256] = "25762917001364"; + char src_phone_number[256] = "623335886431"; + char src_apn[256] = "www.lytest.com"; + uint64_t src_ip_tags_ids[] = {18446744073709551615ULL, 324137, 324129}; + uint64_t dst_ip_tags_ids[] = {324119, 18446744073709551615ULL, 324137, 324129}; + uint64_t fqdn_tags_ids[] = {324109, 324105, 18446744073709551615ULL, 324137, 324129}; uint8_t ja3_fingerprint[32] = {0}; - uint16_t seq_sid[4] = {1000, 1001, 1002, 1003}; - uint16_t ack_sid[4] = {1003, 1002, 1001, 1000}; + uint16_t seq_sid[] = {1000, 1001, 1002, 1003}; + uint16_t ack_sid[] = {1003, 1002, 1001, 1000}; uint8_t seq_route_ctx[] = {0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07}; uint8_t ack_route_ctx[] = {0x08, 0x09, 0x0A, 0x0B, 0x0C, 0x0D, 0x0E, 0x0F}; uint8_t seq_header[] = {0x00, 0x10, 0x20, 0x30, 0x40, 0x50, 0x60, 0x70}; @@ -116,39 +104,27 @@ void build_mpack_data(char **data, size_t *size) mpack_write_u32(&writer, ts_client_val); mpack_write_u32(&writer, ts_server_val); mpack_write_u8(&writer, packet_cur_dir); + mpack_write_u16(&writer, incoming_link_id); + mpack_write_u16(&writer, outgoing_link_id); mpack_write_str(&writer, (const char*)src_sub_id, 0); - mpack_write_str(&writer, (const char*)dst_sub_id, 0); - mpack_write_u64(&writer, src_asn_val); - mpack_write_u64(&writer, dst_asn_val); - mpack_write_u64(&writer, src_asn_id); - mpack_write_u64(&writer, dst_asn_id); + mpack_write_str(&writer, (const char*)src_imsi, strlen(src_imsi)); + mpack_write_str(&writer, (const char*)src_imei, strlen(src_imei)); + mpack_write_str(&writer, (const char*)src_phone_number, strlen(src_phone_number)); + mpack_write_str(&writer, (const char*)src_apn, strlen(src_apn)); mpack_build_array(&writer); - mpack_write_str(&writer, src_ip_location[0], strlen(src_ip_location[0])); - mpack_write_str(&writer, src_ip_location[1], strlen(src_ip_location[1])); - mpack_write_str(&writer, src_ip_location[2], strlen(src_ip_location[2])); - mpack_write_str(&writer, src_ip_location[3], strlen(src_ip_location[3])); mpack_complete_array(&writer); mpack_build_array(&writer); - mpack_write_str(&writer, dst_ip_location[0], strlen(dst_ip_location[0])); - mpack_write_str(&writer, dst_ip_location[1], strlen(dst_ip_location[1])); - mpack_write_str(&writer, dst_ip_location[2], strlen(dst_ip_location[2])); - mpack_write_str(&writer, dst_ip_location[3], strlen(dst_ip_location[3])); - mpack_complete_array(&writer); - - mpack_build_array(&writer); - mpack_write_u64(&writer, src_ip_location_obj_id[0]); - mpack_write_u64(&writer, src_ip_location_obj_id[1]); - mpack_write_u64(&writer, src_ip_location_obj_id[2]); - mpack_write_u64(&writer, src_ip_location_obj_id[3]); + for (size_t i = 0; i < sizeof(dst_ip_tags_ids)/sizeof(dst_ip_tags_ids[0]); i++) { + mpack_write_u64(&writer, dst_ip_tags_ids[i]); + } mpack_complete_array(&writer); mpack_build_array(&writer); - mpack_write_u64(&writer, dst_ip_location_obj_id[0]); - mpack_write_u64(&writer, dst_ip_location_obj_id[1]); - mpack_write_u64(&writer, dst_ip_location_obj_id[2]); - mpack_write_u64(&writer, dst_ip_location_obj_id[3]); + for (size_t i = 0; i < sizeof(fqdn_tags_ids)/sizeof(fqdn_tags_ids[0]); i++) { + mpack_write_u64(&writer, fqdn_tags_ids[i]); + } mpack_complete_array(&writer); mpack_write_str(&writer, (const char*)ja3_fingerprint, 0); |
