summaryrefslogtreecommitdiffstats
path: root/sys/netinet/sctp_constants.h
diff options
context:
space:
mode:
authortuexen <tuexen@FreeBSD.org>2010-12-30 21:32:35 +0000
committertuexen <tuexen@FreeBSD.org>2010-12-30 21:32:35 +0000
commit12d4883ccf51c51d512fc50f38d6fba359e78fd3 (patch)
tree01d2d584408afde4e2cdf35e0cac80a0d93045d2 /sys/netinet/sctp_constants.h
parent543d6f8f19d01a1c2b2c7ae511afd03acf3176d2 (diff)
downloadFreeBSD-src-12d4883ccf51c51d512fc50f38d6fba359e78fd3.zip
FreeBSD-src-12d4883ccf51c51d512fc50f38d6fba359e78fd3.tar.gz
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.
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 212a2f9..e07afb4 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)
OpenPOWER on IntegriCloud