stats: Support statsd Multi-Metric Packets

If the MTU is given, combine several messages into a single UDP
packet until the limit is reached. Flush all reporters after the
values have been scanned.

New vty commands (node config-stats):
  mtu <100-65535>     Enable multi-metric packets and set the maximum
                      packet size (in byte)
  no mtu              Disable multi-metric packets

Note that single messages that are longer than the given MTU (minus
28 octets protocol overhead) will be dropped.

Sponsored-by: On-Waves ehf
diff --git a/include/osmocom/core/stats.h b/include/osmocom/core/stats.h
index 489e0e4..ed461dd 100644
--- a/include/osmocom/core/stats.h
+++ b/include/osmocom/core/stats.h
@@ -22,6 +22,8 @@
 #include <sys/socket.h>
 #include <osmocom/core/linuxlist.h>
 
+struct msgb;
+
 enum stats_reporter_type {
 	STATS_REPORTER_STATSD,
 };
@@ -45,6 +47,8 @@
 	struct sockaddr bind_addr;
 	int bind_addr_len;
 	int fd;
+	struct msgb *buffer;
+	int agg_enabled;
 
 	struct llist_head list;
 };
@@ -71,6 +75,7 @@
 int stats_reporter_set_remote_addr(struct stats_reporter *srep, const char *addr);
 int stats_reporter_set_remote_port(struct stats_reporter *srep, int port);
 int stats_reporter_set_local_addr(struct stats_reporter *srep, const char *addr);
+int stats_reporter_set_mtu(struct stats_reporter *srep, int mtu);
 int stats_reporter_set_name_prefix(struct stats_reporter *srep, const char *prefix);
 int stats_reporter_enable(struct stats_reporter *srep);
 int stats_reporter_disable(struct stats_reporter *srep);