summaryrefslogtreecommitdiffstats
path: root/sys/netgraph/ng_source.h
diff options
context:
space:
mode:
authoremaste <emaste@FreeBSD.org>2007-03-02 01:44:04 +0000
committeremaste <emaste@FreeBSD.org>2007-03-02 01:44:04 +0000
commit2c703c51040815bcbea3abef8443311df004a185 (patch)
treeba56e1660c27d43db023b5c33955ea2fe2648d0a /sys/netgraph/ng_source.h
parentbad5e1f23bb88c38d434cea58e1cb0e216ab35ce (diff)
downloadFreeBSD-src-2c703c51040815bcbea3abef8443311df004a185.zip
FreeBSD-src-2c703c51040815bcbea3abef8443311df004a185.tar.gz
Add "setcounter" and "getcounter" messages, providing the the ability
to embed up to four counters in outgoing packets. The message specifies the offset at which the counter should be inserted as well as the parameters of the counter. Example usage: ngctl msg src0: setcounter \ '{ index=0 offset=0x40 flags=1 width=4 increment=1 max_val=12345 }' Sponsored by: Sandvine Incorporated
Diffstat (limited to 'sys/netgraph/ng_source.h')
-rw-r--r--sys/netgraph/ng_source.h29
1 files changed, 29 insertions, 0 deletions
diff --git a/sys/netgraph/ng_source.h b/sys/netgraph/ng_source.h
index b3db2cf..81a30d7 100644
--- a/sys/netgraph/ng_source.h
+++ b/sys/netgraph/ng_source.h
@@ -85,6 +85,7 @@ struct ng_source_embed_info {
uint8_t spare;
};
#define NGM_SOURCE_EMBED_ENABLE 0x01 /* enable embedding */
+#define NGM_SOURCE_INC_CNT_PER_LIST 0x02 /* increment once per list */
/* Keep this in sync with the above structure definition. */
#define NG_SOURCE_EMBED_TYPE_INFO { \
@@ -93,6 +94,32 @@ struct ng_source_embed_info {
{ NULL } \
}
+/* Packet embedding info for NGM_SOURCE_GET/SET_COUNTER */
+#define NG_SOURCE_COUNTERS 4
+struct ng_source_embed_cnt_info {
+ uint16_t offset; /* offset from ethernet header */
+ uint8_t flags; /* as above */
+ uint8_t width; /* in bytes (1, 2, 4) */
+ uint32_t next_val;
+ uint32_t min_val;
+ uint32_t max_val;
+ int32_t increment;
+ uint8_t index; /* which counter (0..3) */
+};
+
+/* Keep this in sync with the above structure definition. */
+#define NG_SOURCE_EMBED_CNT_TYPE_INFO { \
+ { "offset", &ng_parse_hint16_type }, \
+ { "flags", &ng_parse_hint8_type }, \
+ { "width", &ng_parse_uint8_type }, \
+ { "next_val", &ng_parse_uint32_type }, \
+ { "min_val", &ng_parse_uint32_type }, \
+ { "max_val", &ng_parse_uint32_type }, \
+ { "increment", &ng_parse_int32_type }, \
+ { "index", &ng_parse_uint8_type }, \
+ { NULL } \
+}
+
/* Netgraph commands */
enum {
NGM_SOURCE_GET_STATS = 1, /* get stats */
@@ -105,6 +132,8 @@ enum {
NGM_SOURCE_SETPPS, /* rate-limiting packets per second */
NGM_SOURCE_SET_TIMESTAMP, /* embed xmit timestamp */
NGM_SOURCE_GET_TIMESTAMP,
+ NGM_SOURCE_SET_COUNTER, /* embed counter */
+ NGM_SOURCE_GET_COUNTER,
};
#endif /* _NETGRAPH_NG_SOURCE_H_ */
OpenPOWER on IntegriCloud