| 748 | } |
| 749 | |
| 750 | static int output_stats_json_dump(output_stats_t *output_stats, cJSON *output) |
| 751 | { |
| 752 | cJSON *fwd_bytes = cJSON_CreateObject(); |
| 753 | if (!fwd_bytes) |
| 754 | return -1; |
| 755 | cJSON_AddItemToObject(output, "fwd_bytes", fwd_bytes); |
| 756 | if (bytes_stats_json_dump(output_stats->fwd_bytes, fwd_bytes) != 0) |
| 757 | return -1; |
| 758 | |
| 759 | cJSON *fwd_packets = cJSON_CreateObject(); |
| 760 | if (!fwd_packets) |
| 761 | return -1; |
| 762 | cJSON_AddItemToObject(output, "fwd_packets", fwd_packets); |
| 763 | if (packets_stats_json_dump(output_stats->fwd_packets, fwd_packets) != 0) |
| 764 | return -1; |
| 765 | |
| 766 | cJSON *direction_drop_bytes = cJSON_CreateObject(); |
| 767 | if (!direction_drop_bytes) |
| 768 | return -1; |
| 769 | cJSON_AddItemToObject(output, "direction_drop_bytes", direction_drop_bytes); |
| 770 | if (bytes_stats_json_dump(output_stats->direction_drop_bytes, direction_drop_bytes) != 0) |
| 771 | return -1; |
| 772 | |
| 773 | cJSON *direction_drop_packets = cJSON_CreateObject(); |
| 774 | if (!direction_drop_packets) |
| 775 | return -1; |
| 776 | cJSON_AddItemToObject(output, "direction_drop_packets", direction_drop_packets); |
| 777 | if (packets_stats_json_dump(output_stats->direction_drop_packets, direction_drop_packets) != 0) |
| 778 | return -1; |
| 779 | |
| 780 | cJSON *error_drop_bytes = cJSON_CreateObject(); |
| 781 | if (!error_drop_bytes) |
| 782 | return -1; |
| 783 | cJSON_AddItemToObject(output, "error_drop_bytes", error_drop_bytes); |
| 784 | if (bytes_stats_json_dump(output_stats->error_drop_bytes, error_drop_bytes) != 0) |
| 785 | return -1; |
| 786 | |
| 787 | cJSON *error_drop_packets = cJSON_CreateObject(); |
| 788 | if (!error_drop_packets) |
| 789 | return -1; |
| 790 | cJSON_AddItemToObject(output, "error_drop_packets", error_drop_packets); |
| 791 | if (packets_stats_json_dump(output_stats->error_drop_packets, error_drop_packets) != 0) |
| 792 | return -1; |
| 793 | |
| 794 | cJSON *ratelimit_drop_bytes = cJSON_CreateObject(); |
| 795 | if (!ratelimit_drop_bytes) |
| 796 | return -1; |
| 797 | cJSON_AddItemToObject(output, "ratelimit_drop_bytes", ratelimit_drop_bytes); |
| 798 | if (bytes_stats_json_dump(output_stats->ratelimit_drop_bytes, ratelimit_drop_bytes) != 0) |
| 799 | return -1; |
| 800 | |
| 801 | cJSON *ratelimit_drop_packets = cJSON_CreateObject(); |
| 802 | if (!ratelimit_drop_packets) |
| 803 | return -1; |
| 804 | cJSON_AddItemToObject(output, "ratelimit_drop_packets", ratelimit_drop_packets); |
| 805 | if (packets_stats_json_dump(output_stats->ratelimit_drop_packets, ratelimit_drop_packets) != 0) |
| 806 | return -1; |
| 807 |
no test coverage detected