summaryrefslogtreecommitdiffstats
path: root/include/dscp.h
diff options
context:
space:
mode:
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