-void __connman_counter_notify(const char *interface,
- unsigned int rx_bytes, unsigned int tx_bytes)
-{
- struct connman_stats *stats;
- GHashTableIter iter;
- gpointer key, value;
-
- stats = g_hash_table_lookup(stats_table, interface);
- if (stats != NULL)
- goto update;
-
- stats = g_try_new0(struct connman_stats, 1);
- if (stats == NULL)
- return;
-
- stats->interface = g_strdup(interface);
-
- g_hash_table_replace(stats_table, stats->interface, stats);
-
-update:
- if (stats->rx_bytes == rx_bytes && stats->rx_bytes == tx_bytes)
- return;
-
- stats->rx_bytes = rx_bytes;
- stats->tx_bytes = tx_bytes;
-
- g_hash_table_iter_init(&iter, counter_table);
-
- while (g_hash_table_iter_next(&iter, &key, &value) == TRUE) {
- struct connman_counter *counter = value;
-
- send_usage(counter, stats);
- }
-}
-