aboutsummaryrefslogtreecommitdiffstats
path: root/package/wprobe/src/user/wprobe.h
diff options
context:
space:
mode:
authorFelix Fietkau <nbd@openwrt.org>2009-07-06 19:05:24 +0000
committerFelix Fietkau <nbd@openwrt.org>2009-07-06 19:05:24 +0000
commit5447d6c44b63354b11ceb648e199282dbb65f623 (patch)
tree762b9ea294024b359d37d7cd6b649158666591cc /package/wprobe/src/user/wprobe.h
parent069dbf6fd412aa01e384c8ca5fd2b51306a51412 (diff)
downloadupstream-5447d6c44b63354b11ceb648e199282dbb65f623.tar.gz
upstream-5447d6c44b63354b11ceb648e199282dbb65f623.tar.bz2
upstream-5447d6c44b63354b11ceb648e199282dbb65f623.zip
upgrade to the new version of wprobe - includes reconfigurable layer 2 statistics, remote access, more configuration options and many bugfixes
SVN-Revision: 16719
Diffstat (limited to 'package/wprobe/src/user/wprobe.h')
-rw-r--r--package/wprobe/src/user/wprobe.h60
1 files changed, 57 insertions, 3 deletions
diff --git a/package/wprobe/src/user/wprobe.h b/package/wprobe/src/user/wprobe.h
index c0b4902f3c..706facc808 100644
--- a/package/wprobe/src/user/wprobe.h
+++ b/package/wprobe/src/user/wprobe.h
@@ -87,8 +87,19 @@ struct wprobe_link {
unsigned char addr[6];
};
+struct wprobe_filter_item {
+ char name[32];
+ uint64_t rx;
+ uint64_t tx;
+};
+
+struct wprobe_iface_ops;
struct wprobe_iface {
+ const struct wprobe_iface_ops *ops;
+
+ int sockfd;
const char *ifname;
+ unsigned int genl_family;
char addr[6];
struct list_head global_attr;
@@ -101,11 +112,23 @@ struct wprobe_iface {
int scale_max;
int scale_m;
int scale_d;
+
+ /* filter */
+ void *filter;
+
+ /* filter_len:
+ * set to -1 to drop the current filter
+ * automatically reset to 0 after config apply
+ */
+ int filter_len;
};
+typedef void (*wprobe_filter_cb)(void *arg, const char *group, struct wprobe_filter_item *items, int n_items);
+extern int wprobe_port;
+
/**
* wprobe_update_links: get a list of all link partners
- * @ifname: name of the wprobe interface
+ * @dev: wprobe device structure
* @list: linked list for storing link descriptions
*
* when wprobe_update_links is called multiple times, the linked list
@@ -114,8 +137,16 @@ struct wprobe_iface {
extern int wprobe_update_links(struct wprobe_iface *dev);
/**
+ * wprobe_dump_filters: dump all layer 2 filter counters
+ * @dev: wprobe device structure
+ * @cb: callback (called once per filter group)
+ * @arg: user argument for the callback
+ */
+extern int wprobe_dump_filters(struct wprobe_iface *dev, wprobe_filter_cb cb, void *arg);
+
+/**
* wprobe_measure: start a measurement request for all global attributes
- * @ifname: name of the wprobe interface
+ * @dev: wprobe device structure
*
* not all attributes are automatically filled with data, since for some
* it may be desirable to control the sampling interval from user space
@@ -124,7 +155,7 @@ extern int wprobe_update_links(struct wprobe_iface *dev);
extern int wprobe_measure(struct wprobe_iface *dev);
/**
- * wprobe_get_dev: get device information
+ * wprobe_get_dev: get a handle to a local wprobe device
* @ifname: name of the wprobe interface
*
* queries the wprobe interface for all attributes
@@ -133,6 +164,12 @@ extern int wprobe_measure(struct wprobe_iface *dev);
extern struct wprobe_iface *wprobe_get_dev(const char *ifname);
/**
+ * wprobe_get_auto: get a handle to a local or remote wprobe device
+ * @arg: pointer to the wprobe device, either <dev> (local) or <host>:<dev> (remote)
+ */
+extern struct wprobe_iface *wprobe_get_auto(const char *arg, char **err);
+
+/**
* wprobe_get_dev: free all device information
* @dev: wprobe device structure
*/
@@ -156,4 +193,21 @@ extern int wprobe_apply_config(struct wprobe_iface *dev);
*/
extern int wprobe_request_data(struct wprobe_iface *dev, const unsigned char *addr);
+/**
+ * wprobe_server_init: send a wprobe server init message to a server's client socket
+ * @socket: socket of the connection to the client
+ */
+extern int wprobe_server_init(int socket);
+
+/**
+ * wprobe_server_handle: read a request from the client socket, process it, send the response
+ * @socket: socket of the connection to the client
+ */
+extern int wprobe_server_handle(int socket);
+
+/**
+ * wprobe_server_done: release memory allocated for the server connection
+ */
+extern void wprobe_server_done(void);
+
#endif