aboutsummaryrefslogtreecommitdiffstats
path: root/package/wprobe/src/user/wprobe.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-06-10 14:37:36 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-06-10 14:37:36 +0000
commitf87baeb3e0096a43d4647f549078c53bec68543f (patch)
tree0c6d0fe3f556165e3ae85ad7867257eac0b24c8f /package/wprobe/src/user/wprobe.h
parentcc12508ee32a954ae1296563194ede69a3063309 (diff)
downloadupstream-f87baeb3e0096a43d4647f549078c53bec68543f.tar.gz
upstream-f87baeb3e0096a43d4647f549078c53bec68543f.tar.bz2
upstream-f87baeb3e0096a43d4647f549078c53bec68543f.zip
wprobe: move measurement task to the kernel, add some configurability (work in progress)
SVN-Revision: 16402
Diffstat (limited to 'package/wprobe/src/user/wprobe.h')
-rw-r--r--package/wprobe/src/user/wprobe.h60
1 files changed, 38 insertions, 22 deletions
diff --git a/package/wprobe/src/user/wprobe.h b/package/wprobe/src/user/wprobe.h
index e0c33faef2..c0b4902f3c 100644
--- a/package/wprobe/src/user/wprobe.h
+++ b/package/wprobe/src/user/wprobe.h
@@ -87,15 +87,21 @@ struct wprobe_link {
unsigned char addr[6];
};
-/**
- * wprobe_init: initialize internal data structures and connect to the wprobe netlink api
- */
-extern int wprobe_init(void);
+struct wprobe_iface {
+ const char *ifname;
+ char addr[6];
-/**
- * wprobe_free: free all internally allocated data structures
- */
-extern void wprobe_free(void);
+ struct list_head global_attr;
+ struct list_head link_attr;
+ struct list_head links;
+
+ /* config */
+ int interval;
+ int scale_min;
+ int scale_max;
+ int scale_m;
+ int scale_d;
+};
/**
* wprobe_update_links: get a list of all link partners
@@ -105,7 +111,7 @@ extern void wprobe_free(void);
* when wprobe_update_links is called multiple times, the linked list
* is updated with new link partners, old entries are automatically expired
*/
-extern int wprobe_update_links(const char *ifname, struct list_head *list);
+extern int wprobe_update_links(struct wprobe_iface *dev);
/**
* wprobe_measure: start a measurement request for all global attributes
@@ -115,29 +121,39 @@ extern int wprobe_update_links(const char *ifname, struct list_head *list);
* it may be desirable to control the sampling interval from user space
* you can use this function to do that.
*/
-extern void wprobe_measure(const char *ifname);
+extern int wprobe_measure(struct wprobe_iface *dev);
/**
- * wprobe_dump_attributes: create a linked list of available attributes
+ * wprobe_get_dev: get device information
* @ifname: name of the wprobe interface
- * @link: false: get the list of global attributes; true: get the list of per-link attributes
- * @list: linked list to store the attributes in
- * @addr: buffer to store the interface's mac address in (optional)
*
- * attributes must be freed by the caller
+ * queries the wprobe interface for all attributes
+ * must be freed with wprobe_free_dev
+ */
+extern struct wprobe_iface *wprobe_get_dev(const char *ifname);
+
+/**
+ * wprobe_get_dev: free all device information
+ * @dev: wprobe device structure
+ */
+extern void wprobe_free_dev(struct wprobe_iface *dev);
+
+/**
+ * wprobe_apply_config: apply configuration data
+ * @dev: wprobe device structure
+ *
+ * uploads all configuration values from @dev that are not set to -1
*/
-extern int wprobe_dump_attributes(const char *ifname, bool link, struct list_head *list, char *addr);
+extern int wprobe_apply_config(struct wprobe_iface *dev);
/**
* wprobe_request_data: request new sampling values for the given list of attributes
- * @ifname: name of the wprobe interface
- * @attrs: attribute list
+ * @dev: wprobe device structure
* @addr: (optional) mac address of the link partner
- * @scale: scale down values by a factor (scale < 0: reset statistics entirely)
*
- * if addr is unset, attrs must point to the list of global attributes,
- * if addr is set, attrs must point to the list of per-link attributes
+ * if addr is unset, global values are stored in the global attributes list
+ * if addr is set, per-link values for the given address are stored in the link attributes list
*/
-extern int wprobe_request_data(const char *ifname, struct list_head *attrs, const unsigned char *addr, int scale);
+extern int wprobe_request_data(struct wprobe_iface *dev, const unsigned char *addr);
#endif