stat,rate_ctr: Introduce new API to get counter at given index

Having this API and forcing apps to use it will allow easily adding new
members to the group structure without having so much impact in users of
this struct.

Related: SYS#5456
Change-Id: Iebbf401f11e36645f8964d389460918eb9e0910e
diff --git a/src/stat_item.c b/src/stat_item.c
index 40374a7..a6f86cb 100644
--- a/src/stat_item.c
+++ b/src/stat_item.c
@@ -167,6 +167,16 @@
 	talloc_free(grp);
 }
 
+/*! Get statistics item from group, identified by index idx
+ *  \param[in] grp Rate counter group
+ *  \param[in] idx Index of the counter to retrieve
+ *  \returns rate counter requested
+ */
+struct osmo_stat_item *osmo_stat_item_group_get_item(struct osmo_stat_item_group *grp, unsigned int idx)
+{
+	return grp->items[idx];
+}
+
 /*! Increase the stat_item to the given value.
  *  This function adds a new value for the given stat_item at the end of
  *  the FIFO.