1 /* 2 * Licensed to the Apache Software Foundation (ASF) under one 3 * or more contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. The ASF licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 20 /** 21 * @file 22 * @brief Declares implementation-specific functions required by statistics 23 * management. The default stubs can be overridden with functions that 24 * are compatible with the host OS. 25 */ 26 27 #ifndef H_STAT_MGMT_IMPL_ 28 #define H_STAT_MGMT_IMPL_ 29 30 #ifdef __cplusplus 31 extern "C" { 32 #endif 33 34 struct stat_mgmt_entry; 35 36 typedef int stat_mgmt_foreach_entry_fn(struct stat_mgmt_entry *entry, 37 void *arg); 38 39 /** 40 * @brief Retrieves the name of the stat group at the specified index. 41 * 42 * @param idx The index of the stat group to retrieve. 43 * @param out_name On success, the name of the requested stat 44 * group gets written here. 45 * 46 * @return 0 on success; 47 * MGMT_ERR_ENOENT if no group with the specified 48 * index exists; 49 * Other MGMT_ERR_[...] code on failure. 50 */ 51 int stat_mgmt_impl_get_group(int idx, const char **out_name); 52 53 /** 54 * @brief Applies a function to every entry in the specified stat group. 55 * 56 * @param group_name The name of the stat group to operate on. 57 * @param cb The callback to apply to each stat entry. 58 * @param arg An optional argument to pass to the callback. 59 * 60 * @return 0 on success; MGMT_ERR_[...] code on failure. 61 */ 62 int stat_mgmt_impl_foreach_entry(const char *group_name, 63 stat_mgmt_foreach_entry_fn *cb, 64 void *arg); 65 66 #ifdef __cplusplus 67 } 68 #endif 69 70 #endif 71