mirror of
https://github.com/apache/nuttx.git
synced 2026-08-31 06:03:12 +00:00
tcp: add macros to deal with sequence number wraparound
This commit is contained in:
parent
bf1d587063
commit
433a2b27d9
1 changed files with 9 additions and 0 deletions
|
|
@ -86,6 +86,15 @@
|
|||
# endif
|
||||
#endif
|
||||
|
||||
/* 32-bit modular arithmetics for tcp sequence numbers */
|
||||
|
||||
#define TCP_SEQ_LT(a, b) ((int32_t)((a) - (b)) < 0)
|
||||
#define TCP_SEQ_GT(a, b) TCP_SEQ_LT(b, a)
|
||||
#define TCP_SEQ_LTE(a, b) (!TCP_SEQ_GT(a, b))
|
||||
#define TCP_SEQ_GTE(a, b) (!TCP_SEQ_LT(a, b))
|
||||
|
||||
#define TCP_SEQ_SUB(a, b) ((uint32_t)((a) - (b)))
|
||||
|
||||
/****************************************************************************
|
||||
* Public Type Definitions
|
||||
****************************************************************************/
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue