aboutsummaryrefslogtreecommitdiff
path: root/sys/netinet/sctp_constants.h
diff options
context:
space:
mode:
authorMichael Tuexen <tuexen@FreeBSD.org>2010-12-30 21:32:35 +0000
committerMichael Tuexen <tuexen@FreeBSD.org>2010-12-30 21:32:35 +0000
commit20b07a4d851fb7da5f16b66fcdc15a00ef116e5a (patch)
tree01d2d584408afde4e2cdf35e0cac80a0d93045d2 /sys/netinet/sctp_constants.h
parenta71ad78761012fa78945d67395659d1d80d534db (diff)
downloadsrc-20b07a4d851fb7da5f16b66fcdc15a00ef116e5a.tar.gz
src-20b07a4d851fb7da5f16b66fcdc15a00ef116e5a.zip
Define and use SCTP_SSN_GE, SCTP_SSN_GT, SCTP_TSN_GE, SCTP_TSN_GT macros
and use them instead of the generic compare_with_wrap. Retire compare_with_wrap. MFC after: 3 months.
Notes
Notes: svn path=/head/; revision=216825
Diffstat (limited to 'sys/netinet/sctp_constants.h')
-rw-r--r--sys/netinet/sctp_constants.h12
1 files changed, 7 insertions, 5 deletions
diff --git a/sys/netinet/sctp_constants.h b/sys/netinet/sctp_constants.h
index 212a2f9e05f0..e07afb466c98 100644
--- a/sys/netinet/sctp_constants.h
+++ b/sys/netinet/sctp_constants.h
@@ -322,7 +322,6 @@ __FBSDID("$FreeBSD$");
#define SCTP_VERSION_NUMBER 0x3
#define MAX_TSN 0xffffffff
-#define MAX_SEQ 0xffff
/* how many executions every N tick's */
#define SCTP_ITERATOR_MAX_AT_ONCE 20
@@ -906,10 +905,13 @@ __FBSDID("$FreeBSD$");
#define SCTP_MAX_DATA_BUNDLING 256
/* modular comparison */
-/* True if a > b (mod = M) */
-#define compare_with_wrap(a, b, M) (((a > b) && ((a - b) < ((M >> 1) + 1))) || \
- ((b > a) && ((b - a) > ((M >> 1) + 1))))
-
+/* See RFC 1982 for details. */
+#define SCTP_SSN_GT(a, b) (((a < b) && ((b - a) > (1<<15))) || \
+ ((a > b) && ((a - b) < (1<<15))))
+#define SCTP_SSN_GE(a, b) (SCTP_SSN_GT(a, b) || (a == b))
+#define SCTP_TSN_GT(a, b) (((a < b) && ((b - a) > (1<<31))) || \
+ ((a > b) && ((a - b) < (1<<31))))
+#define SCTP_TSN_GE(a, b) (SCTP_TSN_GT(a, b) || (a == b))
/* Mapping array manipulation routines */
#define SCTP_IS_TSN_PRESENT(arry, gap) ((arry[(gap >> 3)] >> (gap & 0x07)) & 0x01)