| 690 | } |
| 691 | |
| 692 | static int capture_stats_json_dump(capture_stats_t *stats, cJSON *capture) |
| 693 | { |
| 694 | cJSON *cap_bytes = cJSON_CreateObject(); |
| 695 | if (!cap_bytes) |
| 696 | return -1; |
| 697 | cJSON_AddItemToObject(capture, "cap_bytes", cap_bytes); |
| 698 | if (bytes_stats_json_dump(stats->cap_bytes, cap_bytes) != 0) |
| 699 | return -1; |
| 700 | |
| 701 | cJSON *cap_packets = cJSON_CreateObject(); |
| 702 | if (!cap_packets) |
| 703 | return -1; |
| 704 | cJSON_AddItemToObject(capture, "cap_packets", cap_packets); |
| 705 | if (packets_stats_json_dump(stats->cap_packets, cap_packets) != 0) |
| 706 | return -1; |
| 707 | |
| 708 | cJSON *drop_packets = cJSON_CreateObject(); |
| 709 | if (!drop_packets) |
| 710 | return -1; |
| 711 | cJSON_AddItemToObject(capture, "drop_packets", drop_packets); |
| 712 | if (packets_stats_json_dump(stats->drop_packets, drop_packets) != 0) |
| 713 | return -1; |
| 714 | |
| 715 | cJSON *ifdrop_packets = cJSON_CreateObject(); |
| 716 | if (!ifdrop_packets) |
| 717 | return -1; |
| 718 | cJSON_AddItemToObject(capture, "ifdrop_packets", ifdrop_packets); |
| 719 | if (packets_stats_json_dump(stats->ifdrop_packets, ifdrop_packets) != 0) |
| 720 | return -1; |
| 721 | |
| 722 | return 0; |
| 723 | } |
| 724 | |
| 725 | static int pipeline_buffer_stats_json_dump(pipeline_buffer_stats_t *stats, cJSON *obj) |
| 726 | { |
no test coverage detected