aboutsummaryrefslogtreecommitdiffstats
path: root/package/wprobe/src
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-03-29 04:47:19 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-03-29 04:47:19 +0000
commit8dce7522b3599dff32d9955ed18e91fb3c39fc8a (patch)
treebfee5bb9e9c4adb9b524dc67493db7fd7e896de6 /package/wprobe/src
parent48592d1229b86a997c3f8b9ce72c6a0526441e58 (diff)
downloadupstream-8dce7522b3599dff32d9955ed18e91fb3c39fc8a.tar.gz
upstream-8dce7522b3599dff32d9955ed18e91fb3c39fc8a.tar.bz2
upstream-8dce7522b3599dff32d9955ed18e91fb3c39fc8a.zip
wprobe: export the newly added fields via ipfix
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@15065 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'package/wprobe/src')
-rw-r--r--package/wprobe/src/exporter/wprobe-export.c28
1 files changed, 25 insertions, 3 deletions
diff --git a/package/wprobe/src/exporter/wprobe-export.c b/package/wprobe/src/exporter/wprobe-export.c
index 974f4a10f3..e9aa3de8c4 100644
--- a/package/wprobe/src/exporter/wprobe-export.c
+++ b/package/wprobe/src/exporter/wprobe-export.c
@@ -17,12 +17,14 @@
#include <ipfix.h>
#include <mlog.h>
#include <wprobe.h>
+#include <stdbool.h>
static ipfix_datarecord_t g_data = { NULL, NULL, 0 };
static int do_close = 0;
struct wprobe_mapping {
int id;
+ bool counter;
float scale;
const char *wprobe_id;
struct wprobe_value *val;
@@ -35,11 +37,22 @@ struct wprobe_mapping {
#define WMAP(_id, _name, ...) \
{ \
.scale = 1.0f, \
+ .counter = false, \
.id = IPFIX_FT_WPROBE_##_id##_AVG, \
.wprobe_id = _name \
, ## __VA_ARGS__ \
}
+#define WMAP_COUNTER(_id, _name, ...) \
+ { \
+ .scale = 1.0f, \
+ .counter = true, \
+ .id = IPFIX_FT_WPROBE_##_id, \
+ .wprobe_id = _name \
+ , ## __VA_ARGS__ \
+ }
+
+
#define WPROBE_OFFSET 2
static struct wprobe_mapping map_globals[] = {
@@ -47,6 +60,8 @@ static struct wprobe_mapping map_globals[] = {
WMAP(PHY_BUSY, "phy_busy"),
WMAP(PHY_RX, "phy_rx"),
WMAP(PHY_TX, "phy_tx"),
+ WMAP_COUNTER(FRAMES, "frames"),
+ WMAP_COUNTER(PROBEREQ, "probereq"),
};
static struct wprobe_mapping map_perlink[] = {
@@ -129,12 +144,19 @@ add_template_fields(ipfix_t *handle, ipfix_template_t *t, struct wprobe_mapping
if (!map[i].val)
continue;
- g_data.addrs[f++] = &map[i].val->avg;
- g_data.addrs[f++] = &map[i].val->stdev;
- g_data.addrs[f++] = &map[i].val->n;
+ if (map[i].counter)
+ g_data.addrs[f++] = &map[i].val->U32;
+ else
+ g_data.addrs[f++] = &map[i].val->avg;
if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 0, 4) < 0)
exit(1);
+
+ if (map[i].counter)
+ continue;
+
+ g_data.addrs[f++] = &map[i].val->stdev;
+ g_data.addrs[f++] = &map[i].val->n;
if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 1, 4) < 0)
exit(1);
if (ipfix_add_field( handle, t, FOKUS_USERID, map[i].id + 2, 4) < 0)