src/lb_fas.o src/clock.o src/sock_inet.o src/ev_select.o \
src/lb_map.o src/shctx.o src/mworker-prog.o src/hpack-dec.o \
src/arg.o src/signal.o src/fix.o src/dynbuf.o src/guid.o \
- src/cfgparse-tcp.o src/lb_ss.o src/chunk.o \
+ src/cfgparse-tcp.o src/lb_ss.o src/chunk.o src/counters.o \
src/cfgparse-unix.o src/regex.o src/fcgi.o src/uri_auth.o \
src/eb64tree.o src/eb32tree.o src/eb32sctree.o src/lru.o \
src/limits.o src/ebimtree.o src/wdt.o src/hpack-tbl.o \
--- /dev/null
+/*
+ * include/haproxy/counters.h
+ * objects counters management
+ *
+ * Copyright 2025 HAProxy Technologies
+ *
+ * This library is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU Lesser General Public
+ * License as published by the Free Software Foundation, version 2.1
+ * exclusively.
+ *
+ * This library is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this library; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#ifndef _HAPROXY_COUNTERS_H
+# define _HAPROXY_COUNTERS_H
+
+#include <haproxy/counters-t.h>
+#include <haproxy/guid-t.h>
+
+struct fe_counters_shared *counters_fe_shared_get(const struct guid_node *guid);
+struct be_counters_shared *counters_be_shared_get(const struct guid_node *guid);
+
+void counters_fe_shared_drop(struct fe_counters_shared *counters);
+void counters_be_shared_drop(struct be_counters_shared *counters);
+
+#endif /* _HAPROXY_COUNTERS_H */
--- /dev/null
+/*
+ * objects counters management
+ *
+ * Copyright 2025 HAProxy Technologies
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation; either version 2 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
+ */
+
+#include <stdlib.h>
+#include <haproxy/counters.h>
+
+/* retrieved shared counters pointer for a given <guid> object
+ * <size> hint is expected to reflect the actual type size (fe/be)
+ * Returns the pointer on success or NULL on failure
+ */
+static void *_counters_shared_get(const struct guid_node *guid, size_t size)
+{
+ /* no shared memory for now, simply allocate a memory block
+ * for the counters (zero-initialized), ignore guid
+ */
+ return calloc(1, size);
+}
+
+/* retrieve shared fe counters pointer for a given <guid> object */
+struct fe_counters_shared *counters_fe_shared_get(const struct guid_node *guid)
+{
+ return _counters_shared_get(guid, sizeof(struct fe_counters_shared));
+}
+
+/* retrieve shared be counters pointer for a given <guid> object */
+struct be_counters_shared *counters_be_shared_get(const struct guid_node *guid)
+{
+ return _counters_shared_get(guid, sizeof(struct be_counters_shared));
+}
+
+static void _counters_shared_drop(void *counters)
+{
+ /* memory was allocated using calloc(), simply free it */
+ free(counters);
+}
+
+/* release a shared fe counters struct */
+void counters_fe_shared_drop(struct fe_counters_shared *counters)
+{
+ _counters_shared_drop(counters);
+}
+
+/* release a shared be counters struct */
+void counters_be_shared_drop(struct be_counters_shared *counters)
+{
+ _counters_shared_drop(counters);
+}