diff --git a/inc/tsg_label.h b/inc/tsg_label.h index 11e4a35..6ce52cd 100644 --- a/inc/tsg_label.h +++ b/inc/tsg_label.h @@ -135,6 +135,12 @@ struct mirrored_stat int compile_id; }; +struct policy_capture_result +{ + int compile_id; + char *packet_path; +}; + struct tsg_notify_data { int compile_id; @@ -149,7 +155,8 @@ struct tsg_notify_data struct tsg_notify_execution_result { int stat_mirrored_cnt; - char *capture_packet_path; + int capture_result_cnt; + struct policy_capture_result capture_result[MAX_RESULT_NUM]; struct mirrored_stat stat_mirrored[MAX_RESULT_NUM]; }; diff --git a/src/tsg_send_log.cpp b/src/tsg_send_log.cpp index 52120f3..f1ccaa2 100644 --- a/src/tsg_send_log.cpp +++ b/src/tsg_send_log.cpp @@ -1512,23 +1512,28 @@ int set_notify_execution_result(struct tsg_log_instance_t *_instance, struct TLD { return 0; } + + TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_PKTS].name); + TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_BYTES].name); + TLD_delete(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name); for(i=0; istat_mirrored_cnt; i++) { if(execution_result->stat_mirrored[i].compile_id==p_result->config_id) { - TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_PKTS].name); - TLD_delete(_handle, _instance->id2field[LOG_COMMON_MIRRORED_BYTES].name); TLD_append(_handle, _instance->id2field[LOG_COMMON_MIRRORED_PKTS].name, (void *)(execution_result->stat_mirrored[i].packets), TLD_TYPE_LONG); TLD_append(_handle, _instance->id2field[LOG_COMMON_MIRRORED_BYTES].name, (void *)(execution_result->stat_mirrored[i].bytes), TLD_TYPE_LONG); break; } } - if(execution_result->capture_packet_path!=NULL) + for(i=0; icapture_result_cnt; i++) { - TLD_delete(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name); - TLD_append(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name, (void *)(execution_result->capture_packet_path), TLD_TYPE_STRING); + if(execution_result->capture_result[i].compile_id==p_result->config_id) + { + TLD_append(_handle, _instance->id2field[LOG_COMMON_PACKET_CAPTURE_FILE].name, (void *)(execution_result->capture_result[i].packet_path), TLD_TYPE_STRING); + break; + } } return 1;