From: Guo-Fu Tseng <[email protected]>
Signed-off-by: Guo-Fu Tseng <[email protected]> --- src/include/gpxe/tcp.h | 20 ++++++++++++++++++++ 1 files changed, 20 insertions(+), 0 deletions(-) diff --git a/src/include/gpxe/tcp.h b/src/include/gpxe/tcp.h index cb33713..94091b8 100644 --- a/src/include/gpxe/tcp.h +++ b/src/include/gpxe/tcp.h @@ -28,6 +28,26 @@ struct tcp_header { uint16_t urg; /* Urgent pointer */ }; +/** @Sequence helper functions ported from Linux + * @{ + */ + +/* + * The next routines deal with comparing 32 bit unsigned ints + * and worry about wraparound (automatic with unsigned arithmetic). + */ +static inline int before ( uint32_t seq1, uint32_t seq2 ) { + return ( int32_t ) ( seq1 - seq2 ) < 0; +} +#define after(seq2,seq1) before(seq1,seq2) + +/* is s2<=s1<=s3 ? */ +static inline int between ( uint32_t seq1, uint32_t seq2, uint32_t seq3) { + return seq3 - seq2 >= seq1 - seq2; +} + +/** @} */ + /** @defgroup tcpopts TCP options * @{ */ -- 1.7.1 _______________________________________________ gPXE-devel mailing list [email protected] http://etherboot.org/mailman/listinfo/gpxe-devel
