summaryrefslogtreecommitdiffstats
path: root/include/dscp.h
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:25:49 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-30 03:25:49 +0000
commit04fc174d50fd19d6ae78fd2fd2faae221acff807 (patch)
tree23e5482ac4eb332df0fc69bf932118f0d4e42eb0 /include/dscp.h
parentAdding upstream version 2.1.9+dfsg. (diff)
downloadiperf-upstream.tar.xz
iperf-upstream.zip
Adding upstream version 2.2.0+dfsg.upstream/2.2.0+dfsgupstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'include/dscp.h')
-rw-r--r--include/dscp.h16
1 files changed, 16 insertions, 0 deletions
diff --git a/include/dscp.h b/include/dscp.h
index fe5486e..79d779b 100644
--- a/include/dscp.h
+++ b/include/dscp.h
@@ -44,11 +44,27 @@
* by Robert J. McMahon (rjmcmahon@rjmcmahon.com, bob.mcmahon@broadcom.com)
* ------------------------------------------------------------------- */
+/*
+ * 7 6 5 4 3 2 1 0
+ * +--+--+--+--+--+--+--+--+
+ * | DSCP | ECN |
+ * +--+--+--+--+--+--+--+--+
+ *
+ */
+
#ifndef DSCP_H
#define DSCP_H
#ifdef __cplusplus
extern "C" {
#endif
+
+// DSCP bits
+#define DSCP_SHIFT 2
+#define DSCP_BITMASK 0xFC
+#define ECN_BITMASK 0x03
+#define DSCP_VALUE(value) (int)((value & DSCP_BITMASK) >> DSCP_SHIFT)
+#define ECN_VALUE(value) (int)(value & ECN_BITMASK)
+
int parse_ipqos(const char *cp);
const char * iptos2str(int iptos);
#ifdef __cplusplus